From ac06b418946773d49341d9b7ac3404e3ec0998b4 Mon Sep 17 00:00:00 2001 From: Paweł Kołodziejski Date: Fri, 28 Jan 2005 11:51:57 +0000 Subject: fixed restoration of sounds params after cross non/compressed bundles svn-id: r16660 --- scumm/imuse_digi/dimuse.cpp | 23 ++++++++++++++++++++--- 1 file changed, 20 insertions(+), 3 deletions(-) (limited to 'scumm') diff --git a/scumm/imuse_digi/dimuse.cpp b/scumm/imuse_digi/dimuse.cpp index f8e5228d16..764d618358 100644 --- a/scumm/imuse_digi/dimuse.cpp +++ b/scumm/imuse_digi/dimuse.cpp @@ -149,15 +149,32 @@ void IMuseDigital::saveOrLoad(Serializer *ser) { assert(track->soundHandle); if (track->compressed) { track->regionOffset = 0; - track->dataOffset = _sound->getRegionOffset(track->soundHandle, track->curRegion); } track->compressed = _sound->isCompressed(track->soundHandle); if (track->compressed) { track->regionOffset = 0; - track->dataOffset = _sound->getRegionOffset(track->soundHandle, track->curRegion); } + track->dataOffset = _sound->getRegionOffset(track->soundHandle, track->curRegion); + int bits = _sound->getBits(track->soundHandle); + int channels = _sound->getChannels(track->soundHandle); + int freq = _sound->getFreq(track->soundHandle); + track->iteration = freq * channels; + track->mixerFlags = 0; + if (channels == 2) + track->mixerFlags = SoundMixer::FLAG_STEREO | SoundMixer::FLAG_REVERSE_STEREO; + + if ((bits == 12) || (bits == 16)) { + track->mixerFlags |= SoundMixer::FLAG_16BITS; + track->iteration *= 2; + } else if (bits == 8) { + track->mixerFlags |= SoundMixer::FLAG_UNSIGNED; + } else + error("IMuseDigital::saveOrLoad(): Can't handle %d bit samples", bits); + + if (track->compressed) + track->mixerFlags |= SoundMixer::FLAG_LITTLE_ENDIAN; + int32 streamBufferSize = track->iteration; - int freq = _sound->getFreq(track->soundHandle); track->stream2 = NULL; track->stream = makeAppendableAudioStream(freq, track->mixerFlags, streamBufferSize); -- cgit v1.2.3