diff options
Diffstat (limited to 'scumm')
-rw-r--r-- | scumm/imuse_digi.cpp | 18 | ||||
-rw-r--r-- | scumm/imuse_digi.h | 3 | ||||
-rw-r--r-- | scumm/smush/smush_mixer.cpp | 16 | ||||
-rw-r--r-- | scumm/smush/smush_mixer.h | 2 | ||||
-rw-r--r-- | scumm/smush/smush_player.cpp | 11 | ||||
-rw-r--r-- | scumm/smush/smush_player.h | 2 | ||||
-rw-r--r-- | scumm/sound.cpp | 11 | ||||
-rw-r--r-- | scumm/sound.h | 2 |
8 files changed, 26 insertions, 39 deletions
diff --git a/scumm/imuse_digi.cpp b/scumm/imuse_digi.cpp index 0b79d7aeca..472bc44134 100644 --- a/scumm/imuse_digi.cpp +++ b/scumm/imuse_digi.cpp @@ -699,7 +699,7 @@ IMuseDigital::IMuseDigital(Scumm *scumm) : _scumm(scumm) { memset(_channel, 0, sizeof(Channel) * MAX_DIGITAL_CHANNELS); for (int l = 0; l < MAX_DIGITAL_CHANNELS; l++) { - _channel[l]._mixerChannel = -1; + _channel[l]._mixerChannel = 0; } _scumm->_timer->installProcedure(imus_digital_handler, 200000); _pause = false; @@ -709,10 +709,7 @@ IMuseDigital::~IMuseDigital() { _scumm->_timer->releaseProcedure(imus_digital_handler); for (int l = 0; l < MAX_DIGITAL_CHANNELS; l++) { - if (_channel[l]._mixerChannel != -1) { - _scumm->_mixer->stop(_channel[l]._mixerChannel); - _channel[l]._mixerChannel = -1; - } + _scumm->_mixer->stop(_channel[l]._mixerChannel); } } @@ -725,10 +722,7 @@ void IMuseDigital::handler() { for (l = 0; l < MAX_DIGITAL_CHANNELS;l ++) { if (_channel[l]._used) { if (_channel[l]._toBeRemoved) { - if (_channel[l]._mixerChannel != -1) { - _scumm->_mixer->endStream(_channel[l]._mixerChannel); - _channel[l]._mixerChannel = -1; - } + _scumm->_mixer->endStream(_channel[l]._mixerChannel); free(_channel[l]._data); _channel[l]._used = false; @@ -772,7 +766,7 @@ void IMuseDigital::handler() { int32 new_size = _channel[l]._mixerSize; int32 mixer_size = new_size; - if (_channel[l]._mixerChannel == -1) { + if (_channel[l]._mixerChannel == 0) { mixer_size *= 2; new_size *= 2; } @@ -810,8 +804,8 @@ void IMuseDigital::handler() { } if (_scumm->_silentDigitalImuse == false) { - if (_channel[l]._mixerChannel == -1) { - _channel[l]._mixerChannel = _scumm->_mixer->newStream(buf, mixer_size, + if (_channel[l]._mixerChannel == 0) { + _scumm->_mixer->newStream(&_channel[l]._mixerChannel, buf, mixer_size, _channel[l]._freq, _channel[l]._mixerFlags, 100000, 127, 0); } else { _scumm->_mixer->appendStream(_channel[l]._mixerChannel, buf, mixer_size); diff --git a/scumm/imuse_digi.h b/scumm/imuse_digi.h index 1c4a854890..915b1751e3 100644 --- a/scumm/imuse_digi.h +++ b/scumm/imuse_digi.h @@ -24,6 +24,7 @@ #define IMUSE_DIGI_H #include "common/scummsys.h" +#include "sound/mixer.h" #define MAX_DIGITAL_CHANNELS 8 #define MAX_IMUSE_JUMPS 1 @@ -69,7 +70,7 @@ private: int _idSound; int32 _mixerSize; int _mixerFlags; - int _mixerChannel; + PlayingSoundHandle _mixerChannel; bool _used; bool _toBeRemoved; }; diff --git a/scumm/smush/smush_mixer.cpp b/scumm/smush/smush_mixer.cpp index c01753e2ab..04247fe2b4 100644 --- a/scumm/smush/smush_mixer.cpp +++ b/scumm/smush/smush_mixer.cpp @@ -35,14 +35,13 @@ SmushMixer::SmushMixer(SoundMixer *m) : for (int32 i = 0; i < SoundMixer::NUM_CHANNELS; i++) { _channels[i].id = -1; _channels[i].chan = NULL; - _channels[i].mixer_index = -1; + _channels[i].mixer_index = 0; } } SmushMixer::~SmushMixer() { for (int32 i = 0; i < SoundMixer::NUM_CHANNELS; i++) { - if (_channels[i].mixer_index != -1) - _mixer->stop(_channels[i].mixer_index); + _mixer->stop(_channels[i].mixer_index); } } @@ -72,7 +71,7 @@ bool SmushMixer::addChannel(SmushChannel *c) { if (_channels[i].chan == NULL || _channels[i].id == -1) { _channels[i].chan = c; _channels[i].id = track; - _channels[i].mixer_index = -1; + _channels[i].mixer_index = 0; _nextIndex = i + 1; return true; } @@ -82,7 +81,7 @@ bool SmushMixer::addChannel(SmushChannel *c) { if (_channels[i].chan == NULL || _channels[i].id == -1) { _channels[i].chan = c; _channels[i].id = track; - _channels[i].mixer_index = -1; + _channels[i].mixer_index = 0; _nextIndex = i + 1; return true; } @@ -109,8 +108,7 @@ bool SmushMixer::handleFrame() { delete _channels[i].chan; _channels[i].id = -1; _channels[i].chan = NULL; - if (_channels[i].mixer_index != -1) - _mixer->endStream(_channels[i].mixer_index); + _mixer->endStream(_channels[i].mixer_index); } else { int32 rate; bool stereo, is_short; @@ -136,8 +134,8 @@ bool SmushMixer::handleFrame() { } if (_silentMixer == false) { - if (_channels[i].mixer_index == -1) { - _channels[i].mixer_index = _mixer->newStream(data, size, rate, flags, 500000, 127, 0); + if (_channels[i].mixer_index == 0) { + _mixer->newStream(&_channels[i].mixer_index, data, size, rate, flags, 500000, 127, 0); } else { _mixer->appendStream(_channels[i].mixer_index, data, size); } diff --git a/scumm/smush/smush_mixer.h b/scumm/smush/smush_mixer.h index 6a62f786d4..5fb63381bf 100644 --- a/scumm/smush/smush_mixer.h +++ b/scumm/smush/smush_mixer.h @@ -32,7 +32,7 @@ private: struct { int id; SmushChannel *chan; - int mixer_index; + PlayingSoundHandle mixer_index; } _channels[SoundMixer::NUM_CHANNELS]; int _nextIndex; diff --git a/scumm/smush/smush_player.cpp b/scumm/smush/smush_player.cpp index e3feacdb41..4775167777 100644 --- a/scumm/smush/smush_player.cpp +++ b/scumm/smush/smush_player.cpp @@ -227,7 +227,7 @@ SmushPlayer::SmushPlayer(Scumm *scumm, int speed, bool subtitles) { _storeFrame = false; _width = 0; _height = 0; - _IACTchannel = -1; + _IACTchannel = 0; _IACTpos = 0; _soundFrequency = 22050; _speed = speed; @@ -290,10 +290,7 @@ void SmushPlayer::deinit() { _base = NULL; } - if (_IACTchannel != -1) { - _scumm->_mixer->stop(_IACTchannel); - _IACTchannel = -1; - } + _scumm->_mixer->stop(_IACTchannel); _scumm->_insaneState = false; _scumm->abortCutscene(); @@ -461,8 +458,8 @@ void SmushPlayer::handleImuseAction(Chunk &b) { } } while (--count); - if (_IACTchannel == -1) { - _IACTchannel = _scumm->_mixer->newStream(output_data, 0x1000, 22050, + if (_IACTchannel == 0) { + _scumm->_mixer->newStream(&_IACTchannel, output_data, 0x1000, 22050, SoundMixer::FLAG_STEREO | SoundMixer::FLAG_16BITS, 200000, 127, 0); } else { _scumm->_mixer->appendStream(_IACTchannel, output_data, 0x1000); diff --git a/scumm/smush/smush_player.h b/scumm/smush/smush_player.h index 35ebe00847..b94114a44c 100644 --- a/scumm/smush/smush_player.h +++ b/scumm/smush/smush_player.h @@ -51,7 +51,7 @@ private: bool _skips[37]; int32 _frame; - int _IACTchannel; + PlayingSoundHandle _IACTchannel; byte _IACToutput[4096]; int32 _IACTpos; bool _storeFrame; diff --git a/scumm/sound.cpp b/scumm/sound.cpp index 9b385053e5..8283f5a072 100644 --- a/scumm/sound.cpp +++ b/scumm/sound.cpp @@ -1104,7 +1104,7 @@ void Sound::playBundleMusic(const char *song) { _pauseBundleMusic = false; _musicBundleToBeRemoved = false; _musicBundleToBeChanged = false; - _bundleMusicTrack = -1; + _bundleMusicTrack = 0; _numberSamplesBundleMusic = _bundle->getNumberOfMusicSamplesByName(song); _nameBundleMusic = song; _scumm->_timer->installProcedure(&music_handler, 1000000); @@ -1137,10 +1137,7 @@ void Sound::bundleMusicHandler(Scumm *scumm) { if (_musicBundleToBeRemoved) { _scumm->_timer->releaseProcedure(&music_handler); _nameBundleMusic = ""; - if (_bundleMusicTrack != -1) { - _scumm->_mixer->stop(_bundleMusicTrack); - _bundleMusicTrack = -1; - } + _scumm->_mixer->stop(_bundleMusicTrack); if (_musicBundleBufFinal) { free(_musicBundleBufFinal); _musicBundleBufFinal = NULL; @@ -1248,8 +1245,8 @@ void Sound::bundleMusicHandler(Scumm *scumm) { } _bundleMusicPosition += final_size; - if (_bundleMusicTrack == -1) { - _bundleMusicTrack = _scumm->_mixer->newStream(buffer, final_size, rate, + if (_bundleMusicTrack == 0) { + _scumm->_mixer->newStream(&_bundleMusicTrack, buffer, final_size, rate, SoundMixer::FLAG_16BITS | SoundMixer::FLAG_STEREO, 300000, 127, 0); } else { _scumm->_mixer->appendStream(_bundleMusicTrack, buffer, final_size); diff --git a/scumm/sound.h b/scumm/sound.h index 2cd1763233..7bd54ed6cd 100644 --- a/scumm/sound.h +++ b/scumm/sound.h @@ -57,7 +57,7 @@ protected: byte *_musicBundleBufFinal; byte *_musicBundleBufOutput; bool _pauseBundleMusic; - int32 _bundleMusicTrack; + PlayingSoundHandle _bundleMusicTrack; bool _musicBundleToBeChanged; bool _musicBundleToBeRemoved; int32 _bundleMusicSampleBits; |