aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNipun Garg2019-07-25 04:19:51 +0530
committerEugene Sandulenko2019-09-03 17:17:28 +0200
commit4a44f62b10f7744a363ce448822b71d4abae95e6 (patch)
tree6d88462cfeac92cd429221043bab4952b6785518
parent2ba18da94dd0c4fc3bfac59c1d57d760e80bf9ad (diff)
downloadscummvm-rg350-4a44f62b10f7744a363ce448822b71d4abae95e6.tar.gz
scummvm-rg350-4a44f62b10f7744a363ce448822b71d4abae95e6.tar.bz2
scummvm-rg350-4a44f62b10f7744a363ce448822b71d4abae95e6.zip
HDB: Add extension field to SoundCache
-rw-r--r--engines/hdb/sound.cpp9
-rw-r--r--engines/hdb/sound.h3
2 files changed, 9 insertions, 3 deletions
diff --git a/engines/hdb/sound.cpp b/engines/hdb/sound.cpp
index b10c5d573a..5eda13341c 100644
--- a/engines/hdb/sound.cpp
+++ b/engines/hdb/sound.cpp
@@ -1417,7 +1417,12 @@ bool Sound::init() {
_soundCache[index2].loaded = false;
_soundCache[index2].name = soundList[index].name;
_soundCache[index2].luaName = soundList[index].luaName;
- debug(9, "sName: %s, sLuaName: %s", soundList[index].name, soundList[index].luaName);
+ // FIXME: Create an intuitive way to include #166
+ if (index2 < SND_UNLOCKED_ITEM || index == 166)
+ _soundCache[index2].ext = -1; // WAV
+ else
+ _soundCache[index2].ext = 1; // MP3
+ debug(9, "Registering sound: sName: %s, \tsLuaName: %s, \tExtension: %s", soundList[index2].name, soundList[index2].luaName, _soundCache[index2].ext == 1 ? "MP3" : "WAV");
index++;
if (index > kMaxSounds)
error("Reached MAX_SOUNDS in Sound::Init() !");
@@ -1497,7 +1502,6 @@ int Sound::registerSound(const char *name) {
_soundCache[index].name = name;
_soundCache[index].loaded = 0; // just to be sure!
-
return index;
}
@@ -1505,6 +1509,7 @@ bool Sound::freeSound(int index) {
if (_soundCache[index].loaded == 1) {
warning("STUB: Free the audio stream in cache");
_soundCache[index].loaded = 0;
+ _soundCache[index].ext = 0;
return true;
}
return false;
diff --git a/engines/hdb/sound.h b/engines/hdb/sound.h
index 0dbb1cfc30..67b8d10da5 100644
--- a/engines/hdb/sound.h
+++ b/engines/hdb/sound.h
@@ -1413,10 +1413,11 @@ struct SoundCache {
int32 size; // size of sound
const char *name; // filename / MSD name
const char *luaName; // name used by Lua for i.d.
+ int ext; // 0 = Uninitialized, -1 = WAV, 1 = MP3
//void *data; // actual file data
//FSOUND_SAMPLE *sample; // used to play sound in FMOD
- SoundCache() : loaded(0), size(0), name(nullptr), luaName(nullptr) {
+ SoundCache() : loaded(0), size(0), name(nullptr), luaName(nullptr), ext(0) {
}
};