diff options
-rw-r--r-- | scumm/imuse_digi.cpp | 24 | ||||
-rw-r--r-- | scumm/imuse_digi.h | 2 | ||||
-rw-r--r-- | scumm/smush/smush_mixer.cpp | 8 | ||||
-rw-r--r-- | scumm/smush/smush_player.cpp | 9 | ||||
-rw-r--r-- | scumm/sound.cpp | 9 | ||||
-rw-r--r-- | sound/mixer.cpp | 14 | ||||
-rw-r--r-- | sound/mixer.h | 2 |
7 files changed, 26 insertions, 42 deletions
diff --git a/scumm/imuse_digi.cpp b/scumm/imuse_digi.cpp index 3b02f989d7..b4ee1386d5 100644 --- a/scumm/imuse_digi.cpp +++ b/scumm/imuse_digi.cpp @@ -693,7 +693,7 @@ IMuseDigital::IMuseDigital(ScummEngine *scumm) : _scumm(scumm) { memset(_channel, 0, sizeof(Channel) * MAX_DIGITAL_CHANNELS); for (int l = 0; l < MAX_DIGITAL_CHANNELS; l++) { - _channel[l]._mixerChannel = 0; + _channel[l]._handle = 0; } _scumm->_timer->installTimerProc(timer_handler, 200000, this); _pause = false; @@ -703,7 +703,7 @@ IMuseDigital::~IMuseDigital() { _scumm->_timer->removeTimerProc(timer_handler); for (int l = 0; l < MAX_DIGITAL_CHANNELS; l++) { - _scumm->_mixer->stopHandle(_channel[l]._mixerChannel); + _scumm->_mixer->stopHandle(_channel[l]._handle); } } @@ -716,7 +716,7 @@ void IMuseDigital::musicTimer() { for (l = 0; l < MAX_DIGITAL_CHANNELS;l ++) { if (_channel[l]._used) { if (_channel[l]._toBeRemoved) { - _scumm->_mixer->endStream(_channel[l]._mixerChannel); + _scumm->_mixer->endStream(_channel[l]._handle); free(_channel[l]._data); _channel[l]._used = false; @@ -760,7 +760,7 @@ void IMuseDigital::musicTimer() { int32 new_size = _channel[l]._mixerSize; int32 mixer_size = new_size; - if (_channel[l]._mixerChannel == 0) { + if (_channel[l]._handle == 0) { mixer_size *= 2; new_size *= 2; } @@ -780,15 +780,13 @@ void IMuseDigital::musicTimer() { _channel[l]._offset += mixer_size; if (_scumm->_silentDigitalImuse == false) { - int8 pan = _channel[l]._volumeRight - _channel[l]._volume; - if (_channel[l]._mixerChannel == 0) { - _scumm->_mixer->newStream(&_channel[l]._mixerChannel, buf, mixer_size, - _channel[l]._freq, _channel[l]._mixerFlags, 100000, _channel[l]._volume, pan); - } else { - _scumm->_mixer->appendStream(_channel[l]._mixerChannel, buf, mixer_size); - _scumm->_mixer->setChannelVolume(_channel[l]._mixerChannel, _channel[l]._volume); - _scumm->_mixer->setChannelPan(_channel[l]._mixerChannel, pan); - } + if (_channel[l]._handle == 0) + _scumm->_mixer->newStream(&_channel[l]._handle, + _channel[l]._freq, _channel[l]._mixerFlags, 100000); + + _scumm->_mixer->setChannelVolume(_channel[l]._handle, _channel[l]._volume); + _scumm->_mixer->setChannelPan(_channel[l]._handle, _channel[l]._volumeRight - _channel[l]._volume); + _scumm->_mixer->appendStream(_channel[l]._handle, buf, mixer_size); } free(buf); } diff --git a/scumm/imuse_digi.h b/scumm/imuse_digi.h index 5416da47cb..620eea16e5 100644 --- a/scumm/imuse_digi.h +++ b/scumm/imuse_digi.h @@ -58,7 +58,7 @@ private: int _idSound; int32 _mixerSize; int _mixerFlags; - PlayingSoundHandle _mixerChannel; + PlayingSoundHandle _handle; bool _used; bool _toBeRemoved; }; diff --git a/scumm/smush/smush_mixer.cpp b/scumm/smush/smush_mixer.cpp index e6113d3ae3..157a9457d2 100644 --- a/scumm/smush/smush_mixer.cpp +++ b/scumm/smush/smush_mixer.cpp @@ -122,11 +122,9 @@ bool SmushMixer::handleFrame() { } if (_silentMixer == false) { - if (_channels[i].handle == 0) { - _mixer->newStream(&_channels[i].handle, data, size, rate, flags, 500000, 255, 0); - } else { - _mixer->appendStream(_channels[i].handle, data, size); - } + if (_channels[i].handle == 0) + _mixer->newStream(&_channels[i].handle, rate, flags, 500000); + _mixer->appendStream(_channels[i].handle, data, size); } free(data); } diff --git a/scumm/smush/smush_player.cpp b/scumm/smush/smush_player.cpp index b97b771aa2..6db4b3457b 100644 --- a/scumm/smush/smush_player.cpp +++ b/scumm/smush/smush_player.cpp @@ -471,12 +471,9 @@ void SmushPlayer::handleImuseAction(Chunk &b) { } } while (--count); - if (_IACTchannel == 0) { - _scumm->_mixer->newStream(&_IACTchannel, output_data, 0x1000, 22050, - SoundMixer::FLAG_STEREO | SoundMixer::FLAG_16BITS, 200000, 255, 0); - } else { - _scumm->_mixer->appendStream(_IACTchannel, output_data, 0x1000); - } + if (_IACTchannel == 0) + _scumm->_mixer->newStream(&_IACTchannel, 22050, SoundMixer::FLAG_STEREO | SoundMixer::FLAG_16BITS, 200000); + _scumm->_mixer->appendStream(_IACTchannel, output_data, 0x1000); bsize -= len; d_src += len; diff --git a/scumm/sound.cpp b/scumm/sound.cpp index 6a5ade9e5c..9da499b67e 100644 --- a/scumm/sound.cpp +++ b/scumm/sound.cpp @@ -1193,12 +1193,9 @@ void Sound::bundleMusicHandler(ScummEngine *scumm) { _bundleSongPosInMs = (_bundleMusicPosition * 5) / (_outputMixerSize / 200); _bundleMusicPosition += final_size; - if (_bundleMusicTrack == 0) { - _scumm->_mixer->newStream(&_bundleMusicTrack, buffer, final_size, rate, - SoundMixer::FLAG_16BITS | SoundMixer::FLAG_STEREO, 300000); - } else { - _scumm->_mixer->appendStream(_bundleMusicTrack, buffer, final_size); - } + if (_bundleMusicTrack == 0) + _scumm->_mixer->newStream(&_bundleMusicTrack, rate, SoundMixer::FLAG_16BITS | SoundMixer::FLAG_STEREO, 300000); + _scumm->_mixer->appendStream(_bundleMusicTrack, buffer, final_size); free(buffer); } diff --git a/sound/mixer.cpp b/sound/mixer.cpp index a539cfc510..6f43a4c5f9 100644 --- a/sound/mixer.cpp +++ b/sound/mixer.cpp @@ -94,7 +94,7 @@ public: class ChannelStream : public Channel { public: - ChannelStream(SoundMixer *mixer, PlayingSoundHandle *handle, void *sound, uint32 size, uint rate, byte flags, uint32 buffer_size, byte volume, int8 pan); + ChannelStream(SoundMixer *mixer, PlayingSoundHandle *handle, uint rate, byte flags, uint32 buffer_size, byte volume, int8 pan); void append(void *sound, uint32 size); void finish(); @@ -149,9 +149,9 @@ void SoundMixer::setupPremix(PremixProc *proc, void *param) { _premixProc = proc; } -void SoundMixer::newStream(PlayingSoundHandle *handle, void *sound, uint32 size, uint rate, byte flags, uint32 buffer_size, byte volume, int8 pan) { +void SoundMixer::newStream(PlayingSoundHandle *handle, uint rate, byte flags, uint32 buffer_size, byte volume, int8 pan) { Common::StackLock lock(_mutex); - insertChannel(handle, new ChannelStream(this, handle, sound, size, rate, flags, buffer_size, volume, pan)); + insertChannel(handle, new ChannelStream(this, handle, rate, flags, buffer_size, volume, pan)); } void SoundMixer::appendStream(PlayingSoundHandle handle, void *sound, uint32 size) { @@ -496,16 +496,10 @@ void Channel::mix(int16 *data, uint len) { } ChannelStream::ChannelStream(SoundMixer *mixer, PlayingSoundHandle *handle, - void *sound, uint32 size, uint rate, - byte flags, uint32 buffer_size, byte volume, int8 pan) + uint rate, byte flags, uint32 buffer_size, byte volume, int8 pan) : Channel(mixer, handle, true, volume, pan) { - assert(size <= buffer_size); - // Create the input stream _input = makeWrappedInputStream(rate, flags, buffer_size); - - // Append the initial data - append(sound, size); // Get a rate converter instance _converter = makeRateConverter(_input->getRate(), mixer->getOutputRate(), _input->isStereo(), (flags & SoundMixer::FLAG_REVERSE_STEREO) != 0); diff --git a/sound/mixer.h b/sound/mixer.h index eda2df16ad..1f70419c81 100644 --- a/sound/mixer.h +++ b/sound/mixer.h @@ -111,7 +111,7 @@ public: /** Start a new stream. */ - void newStream(PlayingSoundHandle *handle, void *sound, uint32 size, uint rate, byte flags, uint32 buffer_size, byte volume = 255, int8 pan = 0); + void newStream(PlayingSoundHandle *handle, uint rate, byte flags, uint32 buffer_size, byte volume = 255, int8 pan = 0); /** Append to an existing stream. */ void appendStream(PlayingSoundHandle handle, void *sound, uint32 size); |