aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
authorMatthew Hoops2011-08-25 02:52:27 -0400
committerMatthew Hoops2011-08-25 10:14:17 -0400
commit481a5e0e7c65674728eb31694a787723166a72ae (patch)
tree5143e87cdcfdddf624734643247bb254301c256f /engines
parent37a401a17295d10f0e5fb104330fc5f21d125362 (diff)
downloadscummvm-rg350-481a5e0e7c65674728eb31694a787723166a72ae.tar.gz
scummvm-rg350-481a5e0e7c65674728eb31694a787723166a72ae.tar.bz2
scummvm-rg350-481a5e0e7c65674728eb31694a787723166a72ae.zip
SWORD1: Let the XA audio use its own looping
Diffstat (limited to 'engines')
-rw-r--r--engines/sword1/music.cpp6
-rw-r--r--engines/sword1/music.h2
-rw-r--r--engines/sword1/sound.cpp3
3 files changed, 6 insertions, 5 deletions
diff --git a/engines/sword1/music.cpp b/engines/sword1/music.cpp
index f31faffd5e..c34630aceb 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 loop) {
+bool MusicHandle::playPSX(uint16 id) {
stop();
if (!_file.isOpen())
@@ -131,7 +131,7 @@ bool MusicHandle::playPSX(uint16 id, bool loop) {
// not over file size
if ((size != 0) && (size != 0xffffffff) && ((int32)(offset + size) <= _file.size())) {
_file.seek(offset, SEEK_SET);
- _audioSource = Audio::makeLoopingAudioStream(Audio::makeXAStream(_file.readStream(size), 11025), loop ? 0 : 1);
+ _audioSource = Audio::makeXAStream(_file.readStream(size), 11025);
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, loopFlag != 0)) {
+ if (_handles[newStream].playPSX(tuneId)) {
_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 4207019c13..f1366202d7 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 loop);
+ bool playPSX(uint16 id);
void stop();
void fadeUp();
void fadeDown();
diff --git a/engines/sword1/sound.cpp b/engines/sword1/sound.cpp
index faa07b16b9..677a9869ce 100644
--- a/engines/sword1/sound.cpp
+++ b/engines/sword1/sound.cpp
@@ -255,8 +255,9 @@ 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::makeLoopingAudioStream(Audio::makeXAStream(new Common::MemoryReadStream(sampleData + 4, size-4), 11025), (_fxList[elem->id].type == FX_LOOP) ? 0 : 1);
+ Audio::AudioStream *audStream = Audio::makeXAStream(new Common::MemoryReadStream(sampleData + 4, size-4), 11025);
_mixer->playStream(Audio::Mixer::kSFXSoundType, &elem->handle, audStream, elem->id, volume, pan);
} else {
uint32 size = READ_LE_UINT32(sampleData + 0x28);