[Scummvm-cvs-logs] SF.net SVN: scummvm:[55513] scummvm/trunk/engines/lastexpress/game
littleboy at users.sourceforge.net
littleboy at users.sourceforge.net
Tue Jan 25 03:17:06 CET 2011
Revision: 55513
http://scummvm.svn.sourceforge.net/scummvm/?rev=55513&view=rev
Author: littleboy
Date: 2011-01-25 02:17:05 +0000 (Tue, 25 Jan 2011)
Log Message:
-----------
LASTEXPRESS: Add per-entry sound stream (this fixes all dialog being cut as soon as a new sound is queued)
Modified Paths:
--------------
scummvm/trunk/engines/lastexpress/game/sound.cpp
scummvm/trunk/engines/lastexpress/game/sound.h
Modified: scummvm/trunk/engines/lastexpress/game/sound.cpp
===================================================================
--- scummvm/trunk/engines/lastexpress/game/sound.cpp 2011-01-25 02:16:45 UTC (rev 55512)
+++ scummvm/trunk/engines/lastexpress/game/sound.cpp 2011-01-25 02:17:05 UTC (rev 55513)
@@ -25,8 +25,6 @@
#include "lastexpress/game/sound.h"
-#include "lastexpress/data/snd.h"
-
#include "lastexpress/game/action.h"
#include "lastexpress/game/entities.h"
#include "lastexpress/game/inventory.h"
@@ -106,8 +104,6 @@
};
SoundManager::SoundManager(LastExpressEngine *engine) : _engine(engine), _state(0), _currentType(kSoundType16), _flag(0) {
- _soundStream = new StreamedSound();
-
// Initialize unknown data
_data0 = 0;
_data1 = 0;
@@ -126,8 +122,6 @@
_cache.clear();
- SAFE_DELETE(_soundStream);
-
_currentSubtitle = NULL;
// Zero passed pointers
@@ -146,11 +140,11 @@
SAFE_DELETE(*i);
i = _cache.reverse_erase(i);
continue;
- } else if (!entry->isStreamed) {
- entry->isStreamed = true;
+ } else if (!entry->soundStream) {
+ entry->soundStream = new StreamedSound();
// TODO: stream any sound in the queue after filtering
- _soundStream->load(entry->stream);
+ entry->soundStream->load(entry->stream);
}
}
}
@@ -367,8 +361,12 @@
entry->entity = kEntityPlayer;
if (entry->stream) {
- if (!entry->isStreamed)
+ if (!entry->soundStream) {
SAFE_DELETE(entry->stream);
+ } else {
+ entry->soundStream->stop();
+ SAFE_DELETE(entry->soundStream);
+ }
entry->stream = NULL;
}
@@ -1882,8 +1880,11 @@
warning("SoundManager::playLoopingSound: not implemented!");
}
-void SoundManager::stopAllSound() const {
- _soundStream->stop();
+void SoundManager::stopAllSound() {
+ Common::StackLock locker(_mutex);
+
+ for (Common::List<SoundEntry *>::iterator i = _cache.begin(); i != _cache.end(); ++i)
+ (*i)->soundStream->stop();
}
} // End of namespace LastExpress
Modified: scummvm/trunk/engines/lastexpress/game/sound.h
===================================================================
--- scummvm/trunk/engines/lastexpress/game/sound.h 2011-01-25 02:16:45 UTC (rev 55512)
+++ scummvm/trunk/engines/lastexpress/game/sound.h 2011-01-25 02:17:05 UTC (rev 55513)
@@ -69,6 +69,7 @@
*/
+#include "lastexpress/data/snd.h"
#include "lastexpress/data/subtitle.h"
#include "lastexpress/shared.h"
@@ -83,7 +84,6 @@
namespace LastExpress {
class LastExpressEngine;
-class StreamedSound;
class SubtitleManager;
class SoundManager : Common::Serializable {
@@ -197,7 +197,7 @@
SoundManager::FlagType getSoundFlag(EntityIndex index) const;
// Debug
- void stopAllSound() const;
+ void stopAllSound();
// Serializable
void saveLoadWithSerializer(Common::Serializer &ser);
@@ -271,7 +271,8 @@
//int next; // offset to the next structure in the list (not used)
SubtitleEntry *subtitle;
- bool isStreamed; // TEMPORARY
+ // Sound stream
+ StreamedSound *soundStream;
SoundEntry() {
status.status = 0;
@@ -292,15 +293,15 @@
subtitle = NULL;
- isStreamed = false;
+ soundStream = NULL;
}
~SoundEntry() {
// Entries that have been queued would have their streamed disposed automatically
- if (!isStreamed)
+ if (!soundStream)
SAFE_DELETE(stream);
- //delete subtitle;
+ delete soundStream;
}
};
@@ -328,9 +329,6 @@
int _state;
SoundType _currentType;
- // Sound stream
- StreamedSound *_soundStream;
-
Common::Mutex _mutex;
// Unknown data
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