compile on gcc 3.2

This commit is contained in:
David Rose 2003-02-07 18:46:46 +00:00
parent 03c8de6eae
commit 911bb92934
2 changed files with 8 additions and 8 deletions

View File

@ -28,6 +28,7 @@
#include "fmodAudioSound.h" #include "fmodAudioSound.h"
#include "nullAudioSound.h" #include "nullAudioSound.h"
#include "virtualFileSystem.h" #include "virtualFileSystem.h"
#include "string_utils.h"
#include <algorithm> #include <algorithm>
#include <cctype> #include <cctype>
@ -179,8 +180,8 @@ get_sound(const string &file_name) {
FSOUND_STREAM *stream = NULL; FSOUND_STREAM *stream = NULL;
int flags = FSOUND_LOADMEMORY | FSOUND_MPEGACCURATE; int flags = FSOUND_LOADMEMORY | FSOUND_MPEGACCURATE;
string os_path = path.to_os_specific(); string os_path = path.to_os_specific();
string suffix = path.get_extension(); string suffix = downcase(path.get_extension());
std::transform(suffix.begin(), suffix.end(), suffix.begin(), tolower);
if (suffix == "mid" || suffix == "rmi" || suffix == "midi") { if (suffix == "mid" || suffix == "rmi" || suffix == "midi") {
stream = FSOUND_Stream_OpenFile(os_path.c_str(), 0, 0); stream = FSOUND_Stream_OpenFile(os_path.c_str(), 0, 0);
} else { } else {
@ -421,11 +422,10 @@ dec_refcount(const string& file_name) {
// newly-allocated buffer, and stores the size of the // newly-allocated buffer, and stores the size of the
// buffer in size. Returns NULL if an error occurs. // buffer in size. Returns NULL if an error occurs.
//////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////
void* FmodAudioManager:: char* FmodAudioManager::
load(const Filename& filename, size_t &size) const { load(const Filename& filename, size_t &size) const {
// Check file type (based on filename suffix // Check file type (based on filename suffix
string suffix = filename.get_extension(); string suffix = downcase(filename.get_extension());
std::transform(suffix.begin(), suffix.end(), suffix.begin(), tolower);
bool bSupported = false; bool bSupported = false;
if (suffix == "wav" || suffix == "mp3" || suffix == "mid" if (suffix == "wav" || suffix == "mp3" || suffix == "mid"
|| suffix == "rmi" || suffix == "midi") { || suffix == "rmi" || suffix == "midi") {

View File

@ -65,7 +65,7 @@ private:
size_t size; // size of the data field, in bytes size_t size; // size of the data field, in bytes
unsigned int refcount; // how many AudioSound objects are referencing me? unsigned int refcount; // how many AudioSound objects are referencing me?
bool stale; // can this entry be purged from the cache? bool stale; // can this entry be purged from the cache?
void *data; // the memory-mapped audio file. char *data; // the memory-mapped audio file.
} SoundCacheEntry; } SoundCacheEntry;
typedef pmap<string, SoundCacheEntry > SoundMap; typedef pmap<string, SoundCacheEntry > SoundMap;
SoundMap _sounds; SoundMap _sounds;
@ -80,9 +80,9 @@ private:
bool _is_valid; bool _is_valid;
bool _active; bool _active;
void* load(const Filename& filename, size_t &size) const; char* load(const Filename& filename, size_t &size) const;
friend FmodAudioSound; friend class FmodAudioSound;
}; };
EXPCL_FMOD_AUDIO PT(AudioManager) Create_AudioManager(); EXPCL_FMOD_AUDIO PT(AudioManager) Create_AudioManager();