more cleanup

svn-id: r8707
This commit is contained in:
Max Horn 2003-07-02 11:04:48 +00:00
parent 01f992db9b
commit fe8719d7bd
2 changed files with 15 additions and 14 deletions

View File

@ -870,8 +870,10 @@ void IMuseDigital::startSound(int sound) {
if (READ_UINT32(ptr) == MKID('Crea')) {
_channel[l]._bits = 8;
// Always output stereo, because in IMuseDigital::handler the data is expected to be in stereo, and
// different volumes for the left and right channel are being applied.
// That might also be the justification for specifying FLAG_REVERSE_STEREO here. Not sure.
_channel[l]._channels = 2;
_channel[l]._mixerSize = (22050 / 5) * 2;
_channel[l]._mixerFlags = SoundMixer::FLAG_STEREO | SoundMixer::FLAG_REVERSE_STEREO | SoundMixer::FLAG_UNSIGNED;
byte * t_ptr= readCreativeVocFile(ptr, size, _channel[l]._freq, _channel[l]._numLoops);
@ -880,10 +882,8 @@ void IMuseDigital::startSound(int sound) {
} else if (_channel[l]._freq == 10989) {
_channel[l]._freq = 11025;
}
if (_channel[l]._freq == 11025) {
_channel[l]._mixerSize /= 2;
}
_channel[l]._mixerSize = (_channel[l]._freq / 5) * 2;
size *= 2;
_channel[l]._data = (byte *)malloc(size);
for (t = 0; t < size / 2; t++) {
@ -971,14 +971,17 @@ void IMuseDigital::startSound(int sound) {
}
}
}
_channel[l]._mixerSize = (22050 / 5) * 2;
// Always output stereo, because in IMuseDigital::handler the data is expected to be in stereo, and
// different volumes for the left and right channel are being applied.
// That might also be the justification for specifying FLAG_REVERSE_STEREO here. Not sure.
_channel[l]._mixerFlags = SoundMixer::FLAG_STEREO | SoundMixer::FLAG_REVERSE_STEREO;
_channel[l]._mixerSize = (_channel[l]._freq / 5) * 2;
if (_channel[l]._bits == 12) {
_channel[l]._mixerSize *= 2;
_channel[l]._mixerFlags |= SoundMixer::FLAG_16BITS;
_channel[l]._size = _scumm->_sound->decode12BitsSample(ptr, &_channel[l]._data, size, (_channel[l]._channels == 2) ? false : true);
}
if (_channel[l]._bits == 8) {
} else if (_channel[l]._bits == 8) {
_channel[l]._mixerFlags |= SoundMixer::FLAG_UNSIGNED;
if (_channel[l]._channels == 1) {
size *= 2;
@ -993,10 +996,8 @@ void IMuseDigital::startSound(int sound) {
memcpy(_channel[l]._data, ptr, size);
}
_channel[l]._size = size;
}
if (_channel[l]._freq == 11025) {
_channel[l]._mixerSize /= 2;
}
} else
error("Can't handle %d bit samples in iMuseDigital", _channel[l]._bits);
}
_channel[l]._toBeRemoved = false;
_channel[l]._used = true;

View File

@ -975,7 +975,7 @@ bool Sound::isSfxFinished() const {
return !_scumm->_mixer->hasActiveSFXChannel();
}
uint32 Sound::decode12BitsSample(byte *src, byte **dst, uint32 size, bool stereo = false) {
uint32 Sound::decode12BitsSample(byte *src, byte **dst, uint32 size, bool stereo) {
uint32 s_size = (size / 3) * 4;
uint32 loop_size = s_size / 4;
if (stereo) {
@ -1178,7 +1178,7 @@ void Sound::bundleMusicHandler(Scumm *scumm) {
byte *buffer = NULL;
uint32 final_size;
if (_bundleMusicSampleBits == 12) {
final_size = decode12BitsSample(ptr, &buffer, _outputMixerSize);
final_size = decode12BitsSample(ptr, &buffer, _outputMixerSize, false);
} else if (_bundleMusicSampleBits == 16) {
buffer = (byte *)malloc(_outputMixerSize);
final_size = _outputMixerSize;