From 55583214ad7f421c59b2b742c43a49ae372fc824 Mon Sep 17 00:00:00 2001 From: Matthew Hoops Date: Sat, 16 Nov 2013 20:18:39 -0500 Subject: 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. --- engines/sword1/music.cpp | 6 +++--- engines/sword1/music.h | 2 +- engines/sword1/sound.cpp | 3 +-- 3 files changed, 5 insertions(+), 6 deletions(-) (limited to 'engines') diff --git a/engines/sword1/music.cpp b/engines/sword1/music.cpp index c34630aceb..f31faffd5e 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 f1366202d7..4207019c13 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 268da74508..643657c71f 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); -- cgit v1.2.3