aboutsummaryrefslogtreecommitdiff
path: root/scumm
diff options
context:
space:
mode:
authorMax Horn2003-12-21 01:17:03 +0000
committerMax Horn2003-12-21 01:17:03 +0000
commit7fbb3e05597e88d0421af2f720ec7d136605836e (patch)
treeff31a330fff91117d54944c9f7a733ab8e641ab6 /scumm
parent2bbaff0890b2f5920052257d7297daa72bb09606 (diff)
downloadscummvm-rg350-7fbb3e05597e88d0421af2f720ec7d136605836e.tar.gz
scummvm-rg350-7fbb3e05597e88d0421af2f720ec7d136605836e.tar.bz2
scummvm-rg350-7fbb3e05597e88d0421af2f720ec7d136605836e.zip
Cleaned up SoundMixer::newStream() a bit (I plan to replace all usages of this by playInputStream(), this cleanup eases this a bit)
svn-id: r11803
Diffstat (limited to 'scumm')
-rw-r--r--scumm/imuse_digi.cpp24
-rw-r--r--scumm/imuse_digi.h2
-rw-r--r--scumm/smush/smush_mixer.cpp8
-rw-r--r--scumm/smush/smush_player.cpp9
-rw-r--r--scumm/sound.cpp9
5 files changed, 21 insertions, 31 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);
}