From f334e6e38ae4bc65d398fa174a8be892cb403063 Mon Sep 17 00:00:00 2001 From: Bastien Bouclet Date: Sat, 4 Feb 2017 14:34:04 +0100 Subject: MOHAWK: Add sound effect related methods --- engines/mohawk/riven_sound.cpp | 9 +++++++++ engines/mohawk/riven_sound.h | 8 +++++++- 2 files changed, 16 insertions(+), 1 deletion(-) (limited to 'engines') diff --git a/engines/mohawk/riven_sound.cpp b/engines/mohawk/riven_sound.cpp index 569bbb478a..354ba2dcce 100644 --- a/engines/mohawk/riven_sound.cpp +++ b/engines/mohawk/riven_sound.cpp @@ -68,6 +68,11 @@ void RivenSoundManager::playSound(uint16 id, uint16 volume, bool playOnDraw) { } } +void RivenSoundManager::playSound(const Common::String &name, uint16 volume, bool playOnDraw) { + uint16 id =_vm->findResourceID(ID_TWAV, name); + playSound(id, volume, playOnDraw); +} + void RivenSoundManager::playSLST(const SLSTRecord &slstRecord) { if (slstRecord.soundIds.empty()) { return; @@ -298,6 +303,10 @@ bool RivenSoundManager::fadeBalance(RivenSoundManager::AmbientSound &ambientSoun } } +bool RivenSoundManager::isEffectPlaying() const { + return _effect != nullptr && _effect->isPlaying(); +} + RivenSound::RivenSound(MohawkEngine *vm, Audio::RewindableAudioStream *rewindStream) : _vm(vm), _volume(Audio::Mixer::kMaxChannelVolume), diff --git a/engines/mohawk/riven_sound.h b/engines/mohawk/riven_sound.h index d4e7872279..bd9237d9a6 100644 --- a/engines/mohawk/riven_sound.h +++ b/engines/mohawk/riven_sound.h @@ -73,13 +73,19 @@ public: * * @param id Sound ID in the stack * @param volume Playback volume, between 0 and 255 - * @param playOnDraw Start playing when the current card is drawn instead of immediatly + * @param playOnDraw Start playing when the current card is drawn instead of immediately */ void playSound(uint16 id, uint16 volume = 255, bool playOnDraw = false); + /** Play an effect sound by its resource name */ + void playSound(const Common::String &name, uint16 volume = 255, bool playOnDraw = false); + /** Start playing the scheduled on-draw effect sound, if any. Called by the GraphicsManager. */ void triggerDrawSound(); + /** Is an effect sound currently playing? */ + bool isEffectPlaying() const; + /** Stop playing the current effect sound, if any */ void stopSound(); -- cgit v1.2.3