diff options
author | Henrik "Henke37" Andersson | 2019-10-10 03:20:49 +0200 |
---|---|---|
committer | Eugene Sandulenko | 2019-10-11 18:10:46 +0200 |
commit | 89b20bbb86608a6b61b56b13e9c35757bc5c4158 (patch) | |
tree | d8deac7b81a9d3e4cd83402725dfe8b3b1235cc0 /engines/hdb/sound.h | |
parent | 5b401519ebebe22360473a738c805a551114fa6a (diff) | |
download | scummvm-rg350-89b20bbb86608a6b61b56b13e9c35757bc5c4158.tar.gz scummvm-rg350-89b20bbb86608a6b61b56b13e9c35757bc5c4158.tar.bz2 scummvm-rg350-89b20bbb86608a6b61b56b13e9c35757bc5c4158.zip |
HDB: Factor out the song code into the Song class, avoiding a lot of duplicate code.
Diffstat (limited to 'engines/hdb/sound.h')
-rw-r--r-- | engines/hdb/sound.h | 29 |
1 files changed, 23 insertions, 6 deletions
diff --git a/engines/hdb/sound.h b/engines/hdb/sound.h index 8cf687d3d6..accdbff8fd 100644 --- a/engines/hdb/sound.h +++ b/engines/hdb/sound.h @@ -1457,10 +1457,31 @@ struct SoundCache { }; struct Song { - bool playing; - SoundType song; + + Song() : _playing(false), _song(SONG_NONE), + fadingOut(false), fadeOutVol(0), fadeOutRamp(0), + fadingIn(false), fadeInVol(0), fadeInRamp(0) {} + + void playSong(SoundType song, bool fadeIn, int ramp); + void fadeOut(int ramp); + void stop(); + + bool isPlaying() const; + SoundType getSong() const; + + void setVolume(int volume); + + void update(); + +private: + static Common::String Song::getFileName(SoundType song); + Audio::AudioStream* Song::createStream(Common::String fileName); + Audio::SoundHandle handle; + bool _playing; + SoundType _song; + bool fadingOut; int fadeOutVol; int fadeOutRamp; @@ -1468,10 +1489,6 @@ struct Song { bool fadingIn; int fadeInVol; int fadeInRamp; - - Song() : playing(false), song(SONG_NONE), - fadingOut(false), fadeOutVol(0), fadeOutRamp(0), - fadingIn(false), fadeInVol(0), fadeInRamp(0) {} }; class Sound { |