[Scummvm-cvs-logs] SF.net SVN: scummvm:[54514] scummvm/trunk/engines/mohawk
mthreepwood at users.sourceforge.net
mthreepwood at users.sourceforge.net
Sat Nov 27 22:36:05 CET 2010
Revision: 54514
http://scummvm.svn.sourceforge.net/scummvm/?rev=54514&view=rev
Author: mthreepwood
Date: 2010-11-27 21:36:04 +0000 (Sat, 27 Nov 2010)
Log Message:
-----------
MOHAWK: Add an isPlaying() and stopSound(id) function to Sound (for LB and others)
Modified Paths:
--------------
scummvm/trunk/engines/mohawk/sound.cpp
scummvm/trunk/engines/mohawk/sound.h
Modified: scummvm/trunk/engines/mohawk/sound.cpp
===================================================================
--- scummvm/trunk/engines/mohawk/sound.cpp 2010-11-27 18:46:12 UTC (rev 54513)
+++ scummvm/trunk/engines/mohawk/sound.cpp 2010-11-27 21:36:04 UTC (rev 54514)
@@ -38,12 +38,6 @@
Sound::Sound(MohawkEngine* vm) : _vm(vm) {
_midiDriver = NULL;
_midiParser = NULL;
-
- for (uint32 i = 0; i < _handles.size(); i++) {
- _handles[i].handle = Audio::SoundHandle();
- _handles[i].type = kFreeHandle;
- }
-
initMidi();
}
@@ -81,6 +75,7 @@
SndHandle *handle = getHandle();
handle->type = kUsedHandle;
+ handle->id = id;
Audio::AudioStream *audStream = NULL;
@@ -485,6 +480,7 @@
if (!_vm->_mixer->isSoundHandleActive(_handles[i].handle)) {
_handles[i].type = kFreeHandle;
+ _handles[i].id = 0;
return &_handles[i];
}
}
@@ -493,6 +489,7 @@
SndHandle handle;
handle.handle = Audio::SoundHandle();
handle.type = kFreeHandle;
+ handle.id = 0;
_handles.push_back(handle);
return &_handles[_handles.size() - 1];
@@ -503,9 +500,19 @@
if (_handles[i].type == kUsedHandle) {
_vm->_mixer->stopHandle(_handles[i].handle);
_handles[i].type = kFreeHandle;
+ _handles[i].id = 0;
}
}
+void Sound::stopSound(uint16 id) {
+ for (uint32 i = 0; i < _handles.size(); i++)
+ if (_handles[i].type == kUsedHandle && _handles[i].id == id) {
+ _vm->_mixer->stopHandle(_handles[i].handle);
+ _handles[i].type = kFreeHandle;
+ _handles[i].id = 0;
+ }
+}
+
void Sound::pauseSound() {
for (uint32 i = 0; i < _handles.size(); i++)
if (_handles[i].type == kUsedHandle)
@@ -518,4 +525,12 @@
_vm->_mixer->pauseHandle(_handles[i].handle, false);
}
+bool Sound::isPlaying(uint16 id) {
+ for (uint32 i = 0; i < _handles.size(); i++)
+ if (_handles[i].type == kUsedHandle && _handles[i].id == id)
+ return _vm->_mixer->isSoundHandleActive(_handles[i].handle);
+
+ return false;
+}
+
} // End of namespace Mohawk
Modified: scummvm/trunk/engines/mohawk/sound.h
===================================================================
--- scummvm/trunk/engines/mohawk/sound.h 2010-11-27 18:46:12 UTC (rev 54513)
+++ scummvm/trunk/engines/mohawk/sound.h 2010-11-27 21:36:04 UTC (rev 54514)
@@ -65,6 +65,7 @@
struct SndHandle {
Audio::SoundHandle handle;
SndHandleType type;
+ uint16 id;
};
struct SLSTSndHandle {
@@ -122,8 +123,10 @@
void playSoundBlocking(uint16 id, byte volume = Audio::Mixer::kMaxChannelVolume);
void playMidi(uint16 id);
void stopSound();
+ void stopSound(uint16 id);
void pauseSound();
void resumeSound();
+ bool isPlaying(uint16 id);
// Riven-specific
void playSLST(uint16 index, uint16 card);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
More information about the Scummvm-git-logs
mailing list