[Scummvm-cvs-logs] scummvm master -> 55583214ad7f421c59b2b742c43a49ae372fc824

clone2727 clone2727 at gmail.com
Thu Nov 21 03:38:55 CET 2013


This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .

Summary:
55583214ad Revert "SWORD1: Let the XA audio use its own looping"


Commit: 55583214ad7f421c59b2b742c43a49ae372fc824
    https://github.com/scummvm/scummvm/commit/55583214ad7f421c59b2b742c43a49ae372fc824
Author: Matthew Hoops (clone2727 at gmail.com)
Date: 2013-11-20T18:36:16-08:00

Commit Message:
Revert "SWORD1: Let the XA audio use its own looping"

This reverts commit 481a5e0e7c65674728eb31694a787723166a72ae.

Turns out that not all the sounds have the built-in loop flag, such as the piano in the Hotel Ubu.

Changed paths:
    engines/sword1/music.cpp
    engines/sword1/music.h
    engines/sword1/sound.cpp



diff --git a/engines/sword1/music.cpp b/engines/sword1/music.cpp
index c34630a..f31faff 100644
--- a/engines/sword1/music.cpp
+++ b/engines/sword1/music.cpp
@@ -110,7 +110,7 @@ bool MusicHandle::play(const Common::String &filename, bool loop) {
 	return true;
 }
 
-bool MusicHandle::playPSX(uint16 id) {
+bool MusicHandle::playPSX(uint16 id, bool loop) {
 	stop();
 
 	if (!_file.isOpen())
@@ -131,7 +131,7 @@ bool MusicHandle::playPSX(uint16 id) {
 	// not over file size
 	if ((size != 0) && (size != 0xffffffff) && ((int32)(offset + size) <= _file.size())) {
 		_file.seek(offset, SEEK_SET);
-		_audioSource = Audio::makeXAStream(_file.readStream(size), 11025);
+		_audioSource = Audio::makeLoopingAudioStream(Audio::makeXAStream(_file.readStream(size), 11025), loop ? 0 : 1);
 		fadeUp();
 	} else {
 		_audioSource = NULL;
@@ -297,7 +297,7 @@ void Music::startMusic(int32 tuneId, int32 loopFlag) {
 		   the mutex before, to have the soundthread playing normally.
 		   As the corresponding _converter is NULL, the handle will be ignored by the playing thread */
 		if (SwordEngine::isPsx()) {
-			if (_handles[newStream].playPSX(tuneId)) {
+			if (_handles[newStream].playPSX(tuneId, loopFlag != 0)) {
 				_mutex.lock();
 				_converter[newStream] = Audio::makeRateConverter(_handles[newStream].getRate(), _mixer->getOutputRate(), _handles[newStream].isStereo(), false);
 				_mutex.unlock();
diff --git a/engines/sword1/music.h b/engines/sword1/music.h
index f136620..4207019 100644
--- a/engines/sword1/music.h
+++ b/engines/sword1/music.h
@@ -44,7 +44,7 @@ public:
 	MusicHandle() : _fading(0), _audioSource(NULL) {}
 	virtual int readBuffer(int16 *buffer, const int numSamples);
 	bool play(const Common::String &filename, bool loop);
-	bool playPSX(uint16 id);
+	bool playPSX(uint16 id, bool loop);
 	void stop();
 	void fadeUp();
 	void fadeDown();
diff --git a/engines/sword1/sound.cpp b/engines/sword1/sound.cpp
index 268da74..643657c 100644
--- a/engines/sword1/sound.cpp
+++ b/engines/sword1/sound.cpp
@@ -269,9 +269,8 @@ void Sound::playSample(QueueElement *elem) {
 				uint8 volume = (volR + volL) / 2;
 
 				if (SwordEngine::isPsx()) {
-					// We ignore FX_LOOP as XA has its own looping mechanism
 					uint32 size = READ_LE_UINT32(sampleData);
-					Audio::AudioStream *audStream = Audio::makeXAStream(new Common::MemoryReadStream(sampleData + 4, size - 4), 11025);
+					Audio::AudioStream *audStream = Audio::makeLoopingAudioStream(Audio::makeXAStream(new Common::MemoryReadStream(sampleData + 4, size - 4), 11025), (_fxList[elem->id].type == FX_LOOP) ? 0 : 1);
 					_mixer->playStream(Audio::Mixer::kSFXSoundType, &elem->handle, audStream, elem->id, volume, pan);
 				} else {
 					uint32 size = READ_LE_UINT32(sampleData + 0x28);






More information about the Scummvm-git-logs mailing list