diff options
author | Johannes Schickel | 2010-01-30 15:19:15 +0000 |
---|---|---|
committer | Johannes Schickel | 2010-01-30 15:19:15 +0000 |
commit | 8e3646e062528d1604d28676fa2faec5c5ac878b (patch) | |
tree | 68769735690ce17f0da01e525508184d0dd5b7c5 /engines/scumm/sound.cpp | |
parent | 523181d7193d829c86e5b255b47c35a4c28bca14 (diff) | |
download | scummvm-rg350-8e3646e062528d1604d28676fa2faec5c5ac878b.tar.gz scummvm-rg350-8e3646e062528d1604d28676fa2faec5c5ac878b.tar.bz2 scummvm-rg350-8e3646e062528d1604d28676fa2faec5c5ac878b.zip |
Get rid of Audio::makeRawMemoryStream_OLD.
svn-id: r47715
Diffstat (limited to 'engines/scumm/sound.cpp')
-rw-r--r-- | engines/scumm/sound.cpp | 19 |
1 files changed, 12 insertions, 7 deletions
diff --git a/engines/scumm/sound.cpp b/engines/scumm/sound.cpp index 2efab8acdd..eb0ae856c7 100644 --- a/engines/scumm/sound.cpp +++ b/engines/scumm/sound.cpp @@ -349,7 +349,8 @@ void Sound::playSound(int soundID) { } size -= waveSize; - stream = Audio::makeRawMemoryStream_OLD(sound, waveSize, rate, Audio::FLAG_UNSIGNED, loopStart, loopEnd); + Audio::SeekableAudioStream *s = Audio::makeRawStream(sound, waveSize, rate, Audio::FLAG_UNSIGNED); + stream = Audio::makeLoopingAudioStream(s, Audio::Timestamp(0, loopStart, rate), Audio::Timestamp(0, loopEnd, rate), 0); _mixer->playInputStream(Audio::Mixer::kSFXSoundType, NULL, stream, soundID, 255, 0); } break; @@ -430,17 +431,21 @@ void Sound::playSound(int soundID) { int vol = ptr[24] * 4; int loopStart = 0, loopEnd = 0; int loopcount = ptr[27]; + + memcpy(sound, ptr + READ_BE_UINT16(ptr + 8), size); + Audio::SeekableAudioStream *plainStream = Audio::makeRawStream(sound, size, rate, 0); + if (loopcount > 1) { - // TODO: We can only loop once, or infinitely many times, but - // have no support for a finite number of repetitions. - // So far, I have seen only 1 and 255 (for infinite repetitions), - // so maybe this is not really a problem. loopStart = READ_BE_UINT16(ptr + 10) - READ_BE_UINT16(ptr + 8); loopEnd = READ_BE_UINT16(ptr + 14); + + // TODO: Currently we will only ever play till "loopEnd", even when we only have + // a finite repition count. + stream = Audio::makeLoopingAudioStream(plainStream, Audio::Timestamp(0, loopStart, rate), Audio::Timestamp(0, loopEnd, rate), loopcount == 255 ? 0 : loopcount); + } else { + stream = plainStream; } - memcpy(sound, ptr + READ_BE_UINT16(ptr + 8), size); - stream = Audio::makeRawMemoryStream_OLD(sound, size, rate, 0, loopStart, loopEnd); _mixer->playInputStream(Audio::Mixer::kSFXSoundType, NULL, stream, soundID, vol, 0); } else { |