diff options
author | Paweł Kołodziejski | 2004-04-26 21:29:49 +0000 |
---|---|---|
committer | Paweł Kołodziejski | 2004-04-26 21:29:49 +0000 |
commit | 88643e3363666a68b91420ce99e3c9dd903a64d8 (patch) | |
tree | cc7e02bb74cad479bd4cab7abffd6651a89fcc36 | |
parent | d2fa7bbcc7f836406fa69028f58fb6e61d8901bc (diff) | |
download | scummvm-rg350-88643e3363666a68b91420ce99e3c9dd903a64d8.tar.gz scummvm-rg350-88643e3363666a68b91420ce99e3c9dd903a64d8.tar.bz2 scummvm-rg350-88643e3363666a68b91420ce99e3c9dd903a64d8.zip |
imuse audio stream are use dynamic append size now
svn-id: r13647
-rw-r--r-- | scumm/imuse_digi/dimuse.cpp | 33 | ||||
-rw-r--r-- | scumm/imuse_digi/dimuse.h | 1 | ||||
-rw-r--r-- | scumm/imuse_digi/dimuse_track.cpp | 5 |
3 files changed, 23 insertions, 16 deletions
diff --git a/scumm/imuse_digi/dimuse.cpp b/scumm/imuse_digi/dimuse.cpp index 5d8ef034ec..27fbfca58f 100644 --- a/scumm/imuse_digi/dimuse.cpp +++ b/scumm/imuse_digi/dimuse.cpp @@ -153,14 +153,9 @@ void IMuseDigital::callback() { } if (_track[l]->stream) { - int32 mixer_size = _track[l]->pullSize; byte *data = NULL; int32 result = 0; - if (_track[l]->stream->endOfData()) { - mixer_size *= 2; - } - if (_track[l]->curRegion == -1) { switchToNextRegion(l); if (_track[l]->toBeRemoved) @@ -168,6 +163,25 @@ void IMuseDigital::callback() { } int bits = _sound->getBits(_track[l]->soundHandle); + int channels = _sound->getChannels(_track[l]->soundHandle); + + int32 mixer_size = _track[l]->stream->getFreeSpace() - 4; + if ((_track[l]->iteration / 2) > mixer_size) + continue; + + if ((bits == 12) || (bits == 16)) { + if (channels == 1) + mixer_size &= ~1; + if (channels == 2) + mixer_size &= ~3; + } else { + if (channels == 2) + mixer_size &= ~1; + } + + if (mixer_size == 0) + continue; + do { if (bits == 12) { byte *ptr = NULL; @@ -184,16 +198,15 @@ void IMuseDigital::callback() { free(ptr); } else if (bits == 16) { result = _sound->getDataFromRegion(_track[l]->soundHandle, _track[l]->curRegion, &data, _track[l]->regionOffset, mixer_size); - if (_sound->getChannels(_track[l]->soundHandle) == 1) { + if (channels == 1) { result &= ~1; } - if (_sound->getChannels(_track[l]->soundHandle) == 2) { - if (result & 2) - result &= ~2; + if (channels == 2) { + result &= ~3; } } else if (bits == 8) { result = _sound->getDataFromRegion(_track[l]->soundHandle, _track[l]->curRegion, &data, _track[l]->regionOffset, mixer_size); - if (_sound->getChannels(_track[l]->soundHandle) == 2) { + if (channels == 2) { result &= ~1; } } diff --git a/scumm/imuse_digi/dimuse.h b/scumm/imuse_digi/dimuse.h index 660e6be285..a272e87f24 100644 --- a/scumm/imuse_digi/dimuse.h +++ b/scumm/imuse_digi/dimuse.h @@ -63,7 +63,6 @@ private: int volGroupId; int iteration; int mod; - int32 pullSize; int32 mixerFlags; int mixerVol; int mixerPan; diff --git a/scumm/imuse_digi/dimuse_track.cpp b/scumm/imuse_digi/dimuse_track.cpp index e88b24a732..a517773455 100644 --- a/scumm/imuse_digi/dimuse_track.cpp +++ b/scumm/imuse_digi/dimuse_track.cpp @@ -145,20 +145,16 @@ void IMuseDigital::startSound(int soundId, const char *soundName, int soundType, freq -= (freq % 25); _track[l]->iteration = freq * channels; - _track[l]->pullSize = _track[l]->iteration; if (channels == 2) _track[l]->mixerFlags = SoundMixer::FLAG_STEREO | SoundMixer::FLAG_REVERSE_STEREO; if ((bits == 12) || (bits == 16)) { _track[l]->mixerFlags |= SoundMixer::FLAG_16BITS; _track[l]->iteration *= 2; - _track[l]->pullSize = _track[l]->iteration; } else if (bits == 8) { _track[l]->mixerFlags |= SoundMixer::FLAG_UNSIGNED; } else error("IMuseDigital::startSound(): Can't handle %d bit samples", bits); - - _track[l]->pullSize /= 25; // We want a "frame rate" of 25 audio blocks per second } if (input) { @@ -292,7 +288,6 @@ int IMuseDigital::cloneToFadeOutTrack(int track, int fadeDelay, int killNormalTr _track[track]->mixerVol = _track[fadeTrack]->mixerVol; _track[track]->mixerPan = _track[fadeTrack]->mixerPan; _track[track]->mod = _track[fadeTrack]->mod; - _track[track]->pullSize = _track[fadeTrack]->pullSize; _track[track]->used = _track[fadeTrack]->used; _track[track]->toBeRemoved = _track[fadeTrack]->toBeRemoved; _track[track]->started = _track[fadeTrack]->started; |