diff options
author | Nipun Garg | 2019-07-30 09:44:01 +0530 |
---|---|---|
committer | Eugene Sandulenko | 2019-09-03 17:17:30 +0200 |
commit | bcb0171891c967a5d0e282c9c9495b023e393901 (patch) | |
tree | c0f7a844c138dd175e08ca1c129244838244c5ce | |
parent | 4539c04181b04c49868f2c1be16c0dbea78a6ddd (diff) | |
download | scummvm-rg350-bcb0171891c967a5d0e282c9c9495b023e393901.tar.gz scummvm-rg350-bcb0171891c967a5d0e282c9c9495b023e393901.tar.bz2 scummvm-rg350-bcb0171891c967a5d0e282c9c9495b023e393901.zip |
HDB: Fix WAV format checker and other minor fixes
-rw-r--r-- | engines/hdb/sound.cpp | 11 |
1 files changed, 3 insertions, 8 deletions
diff --git a/engines/hdb/sound.cpp b/engines/hdb/sound.cpp index 620fd4ae9a..9f82544abc 100644 --- a/engines/hdb/sound.cpp +++ b/engines/hdb/sound.cpp @@ -1430,11 +1430,11 @@ bool Sound::init() { _soundCache[index2].loaded = 0; _soundCache[index2].name = soundList[index].name; _soundCache[index2].luaName = soundList[index].luaName; - if (!scumm_stricmp(_soundCache[index2].name, ".wav")) + if (index2 <= SND_UNLOCKED_ITEM || index2 == SND_BEEPBEEPBEEP) _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"); + debug(9, "Registering sound: sName: %s, \tsLuaName: %s, \tExtension: %s", soundList[index].name, soundList[index].luaName, _soundCache[index].ext == 1 ? "MP3" : "WAV"); index++; if (index > kMaxSounds) error("Reached MAX_SOUNDS in Sound::Init() !"); @@ -1477,7 +1477,6 @@ void Sound::setMusicVolume(int volume) { } bool Sound::playSound(int index) { -#if 0 if (index > _numSounds || !_sfxVolume) return false; @@ -1520,12 +1519,10 @@ bool Sound::playSound(int index) { g_hdb->_mixer->setChannelVolume(_handles[soundChannel], _sfxVolume); g_hdb->_mixer->playStream(Audio::Mixer::kSFXSoundType, &_handles[soundChannel], _soundCache[index].audioStream); -#endif return true; } bool Sound::playSoundEx(int index, int channel, bool loop) { -#if 0 if (g_hdb->_mixer->isSoundHandleActive(_handles[channel])) return false; @@ -1543,7 +1540,7 @@ bool Sound::playSoundEx(int index, int channel, bool loop) { if (stream == nullptr) return false; - if (_soundCache[index].ext) { + if (_soundCache[index].ext == 1) { #ifdef USE_MAD _soundCache[index].audioStream = Audio::makeMP3Stream(stream, DisposeAfterUse::YES); _soundCache[index].loaded = 1; @@ -1562,7 +1559,6 @@ bool Sound::playSoundEx(int index, int channel, bool loop) { } else { g_hdb->_mixer->playStream(Audio::Mixer::kSFXSoundType, &_handles[channel], _soundCache[index].audioStream); } -#endif return true; } @@ -1767,7 +1763,6 @@ int Sound::registerSound(const char *name) { bool Sound::freeSound(int index) { if (_soundCache[index].loaded == 1) { - delete _soundCache[index].audioStream; _soundCache[index].loaded = 0; _soundCache[index].ext = 0; return true; |