aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStrangerke2019-08-15 23:40:11 +0200
committerEugene Sandulenko2019-09-03 17:17:33 +0200
commit29eb9dc9d61d15d673530b8aa6cbec02eb8ad30f (patch)
tree54f648b45f805ef16ee24eeca85a4ddea6ff1997
parenteaa972347f42d4e6a5e0e47974ab7d360cdfe44b (diff)
downloadscummvm-rg350-29eb9dc9d61d15d673530b8aa6cbec02eb8ad30f.tar.gz
scummvm-rg350-29eb9dc9d61d15d673530b8aa6cbec02eb8ad30f.tar.bz2
scummvm-rg350-29eb9dc9d61d15d673530b8aa6cbec02eb8ad30f.zip
HDB: Remove an unused member of Song, get rid of the return value of several sound functions
-rw-r--r--engines/hdb/ai-funcs.cpp6
-rw-r--r--engines/hdb/sound.cpp64
-rw-r--r--engines/hdb/sound.h19
3 files changed, 40 insertions, 49 deletions
diff --git a/engines/hdb/ai-funcs.cpp b/engines/hdb/ai-funcs.cpp
index afd6f3a761..137df1c4e9 100644
--- a/engines/hdb/ai-funcs.cpp
+++ b/engines/hdb/ai-funcs.cpp
@@ -2191,7 +2191,8 @@ bool AI::walkThroughEnt(AIType type) {
// Play special sound for every item you get
void AI::getItemSound(AIType type) {
switch (type) {
- case ITEM_GOO_CUP: g_hdb->_sound->playSound(SND_GET_GOO);
+ case ITEM_GOO_CUP:
+ g_hdb->_sound->playSound(SND_GET_GOO);
break;
case ITEM_GEM_WHITE:
case ITEM_GEM_BLUE:
@@ -2239,7 +2240,8 @@ void AI::getItemSound(AIType type) {
break;
}
// fall through
- default: g_hdb->_sound->playSound(SND_GET_THING);
+ default:
+ g_hdb->_sound->playSound(SND_GET_THING);
}
}
diff --git a/engines/hdb/sound.cpp b/engines/hdb/sound.cpp
index 25f13d9b57..b41622b39e 100644
--- a/engines/hdb/sound.cpp
+++ b/engines/hdb/sound.cpp
@@ -1480,9 +1480,9 @@ void Sound::setMusicVolume(int volume) {
}
}
-bool Sound::playSound(int index) {
+void Sound::playSound(int index) {
if (index > _numSounds || !_sfxVolume)
- return false;
+ return;
// is sound in memory at least?
if (_soundCache[index].loaded == SNDMEM_FREEABLE)
@@ -1500,7 +1500,7 @@ bool Sound::playSound(int index) {
stream = g_hdb->_fileMan->findFirstData(_soundCache[index].name, TYPE_BINARY);
if (stream == nullptr)
- return false;
+ return;
if (_soundCache[index].ext == SNDTYPE_MP3) {
#ifdef USE_MAD
@@ -1532,7 +1532,7 @@ bool Sound::playSound(int index) {
// If no free handles found
if (soundChannel == kLaserChannel)
- return false;
+ return;
g_hdb->_mixer->setChannelVolume(_handles[soundChannel], _sfxVolume);
@@ -1547,16 +1547,14 @@ bool Sound::playSound(int index) {
false,
false
);
-
- return true;
}
-bool Sound::playSoundEx(int index, int channel, bool loop) {
+void Sound::playSoundEx(int index, int channel, bool loop) {
if (g_hdb->_mixer->isSoundHandleActive(_handles[channel]))
- return false;
+ return;
if (index > _numSounds || !_sfxVolume)
- return false;
+ return;
// is sound in memory at least?
if (_soundCache[index].loaded == SNDMEM_FREEABLE)
@@ -1574,7 +1572,7 @@ bool Sound::playSoundEx(int index, int channel, bool loop) {
stream = g_hdb->_fileMan->findFirstData(_soundCache[index].name, TYPE_BINARY);
if (stream == nullptr)
- return false;
+ return;
if (_soundCache[index].ext == SNDTYPE_MP3) {
#ifdef USE_MAD
@@ -1622,16 +1620,15 @@ bool Sound::playSoundEx(int index, int channel, bool loop) {
false
);
}
- return true;
}
-bool Sound::playVoice(int index, int actor) {
+void Sound::playVoice(int index, int actor) {
if (!_voicesOn || g_hdb->isPPC())
- return false;
+ return;
// make sure we aren't playing a line more than once this time (only on CHANNEL 0)
if (!actor && _voicePlayed[index - FIRST_VOICE])
- return false;
+ return;
// is voice channel already active? if so, shut 'er down (automagically called StopVoice via callback)
if (_voices[actor].active)
@@ -1646,14 +1643,14 @@ bool Sound::playVoice(int index, int actor) {
stream = g_hdb->_fileMan->findFirstData(soundList[index].name, TYPE_BINARY);
if (stream == nullptr)
- return false;
+ return;
if (g_hdb->getPlatform() == Common::kPlatformLinux) {
#ifdef USE_VORBIS
Audio::AudioStream *audioStream = Audio::makeVorbisStream(stream, DisposeAfterUse::YES);
if (audioStream == nullptr) {
delete stream;
- return false;
+ return;
}
g_hdb->_mixer->setChannelVolume(*_voices[actor].handle, _sfxVolume);
@@ -1675,7 +1672,7 @@ bool Sound::playVoice(int index, int actor) {
Audio::AudioStream *audioStream = Audio::makeMP3Stream(stream, DisposeAfterUse::YES);
if (audioStream == nullptr) {
delete stream;
- return false;
+ return;
}
g_hdb->_mixer->setChannelVolume(*_voices[actor].handle, _sfxVolume);
@@ -1697,26 +1694,26 @@ bool Sound::playVoice(int index, int actor) {
_voices[actor].active = true;
_voicePlayed[index - FIRST_VOICE] = 1;
- return true;
+ return;
}
-bool Sound::startMusic(SoundType song) {
+void Sound::startMusic(SoundType song) {
g_hdb->_menu->saveSong(song);
if (!_musicVolume)
- return false;
+ return;
- return beginMusic(song, false, 0);
+ beginMusic(song, false, 0);
}
-bool Sound::fadeInMusic(SoundType song, int ramp) {
+void Sound::fadeInMusic(SoundType song, int ramp) {
g_hdb->_menu->saveSong(song);
if (!_musicVolume)
- return false;
+ return;
stopMusic();
- return beginMusic(song, false, ramp);
+ beginMusic(song, false, ramp);
}
void Sound::fadeOutMusic(int ramp) {
@@ -1741,10 +1738,8 @@ bool Sound::songPlaying(SoundType song) {
return false;
}
-bool Sound::stopChannel(int channel) {
+void Sound::stopChannel(int channel) {
g_hdb->_mixer->stopHandle(_handles[channel]);
-
- return true;
}
void Sound::stopMusic() {
@@ -1758,7 +1753,7 @@ void Sound::stopMusic() {
}
}
-bool Sound::beginMusic(SoundType song, bool fadeIn, int ramp) {
+void Sound::beginMusic(SoundType song, bool fadeIn, int ramp) {
const char *songName = nullptr;
if (g_hdb->getPlatform() == Common::kPlatformLinux) {
@@ -1796,7 +1791,7 @@ bool Sound::beginMusic(SoundType song, bool fadeIn, int ramp) {
Common::SeekableReadStream *stream = SearchMan.createReadStreamForMember(songName);
if (stream == nullptr)
- return false;
+ return;
if (g_hdb->getPlatform() != Common::kPlatformLinux) {
#ifdef USE_MAD
@@ -1867,7 +1862,7 @@ bool Sound::beginMusic(SoundType song, bool fadeIn, int ramp) {
Common::SeekableReadStream *stream = SearchMan.createReadStreamForMember(songName);
if (stream == nullptr)
- return false;
+ return;
if (g_hdb->getPlatform() != Common::kPlatformLinux) {
#ifdef USE_MAD
@@ -1927,10 +1922,7 @@ bool Sound::beginMusic(SoundType song, bool fadeIn, int ramp) {
_song2.playing = true;
#endif
}
- } else
- return false;
-
- return true;
+ }
}
void Sound::updateMusic() {
@@ -1972,13 +1964,11 @@ int Sound::registerSound(const char *name) {
return index;
}
-bool Sound::freeSound(int index) {
+void Sound::freeSound(int index) {
if (_soundCache[index].loaded == SNDMEM_LOADED) {
_soundCache[index].loaded = SNDMEM_NOTCACHED;
_soundCache[index].ext = SNDTYPE_NONE;
- return true;
}
- return false;
}
const char *Sound::getSNDLuaName(int index) {
diff --git a/engines/hdb/sound.h b/engines/hdb/sound.h
index c9c2eedb37..d810cae28c 100644
--- a/engines/hdb/sound.h
+++ b/engines/hdb/sound.h
@@ -1462,7 +1462,6 @@ struct SoundCache {
struct Song {
bool playing;
SoundType song;
- const char *sndMusic;
Audio::SoundHandle *handle;
bool fadingOut;
@@ -1473,7 +1472,7 @@ struct Song {
int fadeInVol;
int fadeInRamp;
- Song() : playing(false), song(SONG_NONE), sndMusic(nullptr), handle(new Audio::SoundHandle()),
+ Song() : playing(false), song(SONG_NONE), handle(new Audio::SoundHandle()),
fadingOut(false), fadeOutVol(0), fadeOutRamp(0),
fadingIn(false), fadeInVol(0), fadeInRamp(0) {}
~Song() {
@@ -1511,19 +1510,19 @@ public:
memset(&_voicePlayed[0], 0, sizeof(_voicePlayed));
}
- bool playSound(int index);
- bool playSoundEx(int index, int channel, bool loop);
- bool playVoice(int index, int actor);
- bool startMusic(SoundType song);
- bool fadeInMusic(SoundType song, int ramp);
+ void playSound(int index);
+ void playSoundEx(int index, int channel, bool loop);
+ void playVoice(int index, int actor);
+ void startMusic(SoundType song);
+ void fadeInMusic(SoundType song, int ramp);
void fadeOutMusic(int ramp);
void stopMusic();
- bool beginMusic(SoundType song, bool fadeIn, int ramp);
+ void beginMusic(SoundType song, bool fadeIn, int ramp);
void updateMusic();
bool songPlaying(SoundType song);
- bool stopChannel(int channel);
+ void stopChannel(int channel);
int registerSound(const char *name);
- bool freeSound(int index);
+ void freeSound(int index);
const char *getSNDLuaName(int index);
int getSNDIndex(const char *name);
int getNumSounds() {