aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBastien Bouclet2017-02-04 14:34:04 +0100
committerEugene Sandulenko2017-07-03 08:50:10 +0200
commitf334e6e38ae4bc65d398fa174a8be892cb403063 (patch)
tree065d6fdc88fae04c54f32248a705039dbcf8d429
parent14990dc91b868816914fd731586e60bb297caeea (diff)
downloadscummvm-rg350-f334e6e38ae4bc65d398fa174a8be892cb403063.tar.gz
scummvm-rg350-f334e6e38ae4bc65d398fa174a8be892cb403063.tar.bz2
scummvm-rg350-f334e6e38ae4bc65d398fa174a8be892cb403063.zip
MOHAWK: Add sound effect related methods
-rw-r--r--engines/mohawk/riven_sound.cpp9
-rw-r--r--engines/mohawk/riven_sound.h8
2 files changed, 16 insertions, 1 deletions
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();