[Scummvm-cvs-logs] SF.net SVN: scummvm:[54680] scummvm/trunk/engines/mohawk
fuzzie at users.sourceforge.net
fuzzie at users.sourceforge.net
Tue Nov 30 16:35:23 CET 2010
Revision: 54680
http://scummvm.svn.sourceforge.net/scummvm/?rev=54680&view=rev
Author: fuzzie
Date: 2010-11-30 15:35:22 +0000 (Tue, 30 Nov 2010)
Log Message:
-----------
MOHAWK: some LBSoundItem fixes
Modified Paths:
--------------
scummvm/trunk/engines/mohawk/livingbooks.cpp
scummvm/trunk/engines/mohawk/livingbooks.h
Modified: scummvm/trunk/engines/mohawk/livingbooks.cpp
===================================================================
--- scummvm/trunk/engines/mohawk/livingbooks.cpp 2010-11-30 15:07:00 UTC (rev 54679)
+++ scummvm/trunk/engines/mohawk/livingbooks.cpp 2010-11-30 15:35:22 UTC (rev 54680)
@@ -1869,27 +1869,45 @@
LBSoundItem::LBSoundItem(MohawkEngine_LivingBooks *vm, Common::Rect rect) : LBItem(vm, rect) {
debug(3, "new LBSoundItem");
+ _running = false;
}
LBSoundItem::~LBSoundItem() {
- _vm->_sound->stopSound(_resourceId);
+ if (_running)
+ _vm->_sound->stopSound(_resourceId);
}
+void LBSoundItem::update() {
+ if (_running && !_vm->_sound->isPlaying(_resourceId)) {
+ _running = false;
+ done(true);
+ }
+
+ LBItem::update();
+}
+
bool LBSoundItem::togglePlaying(bool playing, bool restart) {
if (!playing)
return LBItem::togglePlaying(playing, restart);
- _vm->_sound->stopSound(_resourceId);
+ if (_running) {
+ _running = false;
+ _vm->_sound->stopSound(_resourceId);
+ }
if (_neverEnabled || !_enabled)
return false;
+ _running = true;
_vm->_sound->playSound(_resourceId, Audio::Mixer::kMaxChannelVolume, false);
return true;
}
void LBSoundItem::stop() {
- _vm->_sound->stopSound(_resourceId);
+ if (_running) {
+ _running = false;
+ _vm->_sound->stopSound(_resourceId);
+ }
LBItem::stop();
}
Modified: scummvm/trunk/engines/mohawk/livingbooks.h
===================================================================
--- scummvm/trunk/engines/mohawk/livingbooks.h 2010-11-30 15:07:00 UTC (rev 54679)
+++ scummvm/trunk/engines/mohawk/livingbooks.h 2010-11-30 15:35:22 UTC (rev 54680)
@@ -259,8 +259,12 @@
LBSoundItem(MohawkEngine_LivingBooks *_vm, Common::Rect rect);
~LBSoundItem();
+ void update();
bool togglePlaying(bool playing, bool restart);
void stop();
+
+protected:
+ bool _running;
};
struct GroupEntry {
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