[Scummvm-cvs-logs] scummvm master -> 01b7a2c774cdda3dd0640c37cc41124e4c80743d
fuzzie
fuzzie at fuzzie.org
Tue Mar 29 21:21:16 CEST 2011
This automated email contains information about 2 new commits which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .
Summary:
feefced3ce MOHAWK: Add Sound::isPlaying() function.
01b7a2c774 MOHAWK: Check isAmbient in LB sound priority code.
Commit: feefced3ce98232c6c31a4ae482949c99ad6764c
https://github.com/scummvm/scummvm/commit/feefced3ce98232c6c31a4ae482949c99ad6764c
Author: Alyssa Milburn (fuzzie at fuzzie.org)
Date: 2011-03-29T12:18:55-07:00
Commit Message:
MOHAWK: Add Sound::isPlaying() function.
Changed paths:
engines/mohawk/sound.cpp
engines/mohawk/sound.h
diff --git a/engines/mohawk/sound.cpp b/engines/mohawk/sound.cpp
index 1445754..b4ae50b 100644
--- a/engines/mohawk/sound.cpp
+++ b/engines/mohawk/sound.cpp
@@ -576,6 +576,15 @@ bool Sound::isPlaying(uint16 id) {
return false;
}
+bool Sound::isPlaying() {
+ for (uint32 i = 0; i < _handles.size(); i++)
+ if (_handles[i].type == kUsedHandle)
+ if (_vm->_mixer->isSoundHandleActive(_handles[i].handle))
+ return true;
+
+ return false;
+}
+
uint Sound::getNumSamplesPlayed(uint16 id) {
for (uint32 i = 0; i < _handles.size(); i++)
if (_handles[i].type == kUsedHandle && _handles[i].id == id) {
diff --git a/engines/mohawk/sound.h b/engines/mohawk/sound.h
index 3135b1d..702c6f6 100644
--- a/engines/mohawk/sound.h
+++ b/engines/mohawk/sound.h
@@ -133,6 +133,7 @@ public:
void pauseSound();
void resumeSound();
bool isPlaying(uint16 id);
+ bool isPlaying();
uint getNumSamplesPlayed(uint16 id);
// Myst-specific sound functions
Commit: 01b7a2c774cdda3dd0640c37cc41124e4c80743d
https://github.com/scummvm/scummvm/commit/01b7a2c774cdda3dd0640c37cc41124e4c80743d
Author: Alyssa Milburn (fuzzie at fuzzie.org)
Date: 2011-03-29T12:19:46-07:00
Commit Message:
MOHAWK: Check isAmbient in LB sound priority code.
Changed paths:
engines/mohawk/livingbooks.cpp
engines/mohawk/livingbooks.h
diff --git a/engines/mohawk/livingbooks.cpp b/engines/mohawk/livingbooks.cpp
index 356ad94..6a820f5 100644
--- a/engines/mohawk/livingbooks.cpp
+++ b/engines/mohawk/livingbooks.cpp
@@ -562,22 +562,25 @@ bool MohawkEngine_LivingBooks::playSound(LBItem *source, uint16 resourceId) {
if (_lastSoundId && !_sound->isPlaying(_lastSoundId))
_lastSoundId = 0;
- if (!_soundLockOwner) {
- if (_lastSoundId && _lastSoundOwner != source->getId())
- if (source->getSoundPriority() >= _lastSoundPriority)
+ if (!source->isAmbient() || !_sound->isPlaying()) {
+ if (!_soundLockOwner) {
+ if (_lastSoundId && _lastSoundOwner != source->getId())
+ if (source->getSoundPriority() >= _lastSoundPriority)
+ return false;
+ } else {
+ if (_soundLockOwner != source->getId() && source->getSoundPriority() >= _maxSoundPriority)
return false;
- } else {
- if (_soundLockOwner != source->getId() && source->getSoundPriority() >= _maxSoundPriority)
- return false;
- }
+ }
- if (_lastSoundId)
- _sound->stopSound(_lastSoundId);
+ if (_lastSoundId)
+ _sound->stopSound(_lastSoundId);
+
+ _lastSoundOwner = source->getId();
+ _lastSoundPriority = source->getSoundPriority();
+ }
- _sound->playSound(resourceId);
_lastSoundId = resourceId;
- _lastSoundOwner = source->getId();
- _lastSoundPriority = source->getSoundPriority();
+ _sound->playSound(resourceId);
return true;
}
@@ -588,7 +591,7 @@ void MohawkEngine_LivingBooks::lockSound(LBItem *owner, bool lock) {
return;
}
- if (_soundLockOwner)
+ if (_soundLockOwner || (owner->isAmbient() && _sound->isPlaying()))
return;
if (_lastSoundId && !_sound->isPlaying(_lastSoundId))
diff --git a/engines/mohawk/livingbooks.h b/engines/mohawk/livingbooks.h
index 74bf520..3db71eb 100644
--- a/engines/mohawk/livingbooks.h
+++ b/engines/mohawk/livingbooks.h
@@ -366,6 +366,7 @@ public:
uint16 getId() { return _itemId; }
uint16 getSoundPriority() { return _soundMode; }
+ bool isAmbient() { return _isAmbient; }
protected:
MohawkEngine_LivingBooks *_vm;
More information about the Scummvm-git-logs
mailing list