From bd4370c25166ad0e49c78d9e4407d39358e17b91 Mon Sep 17 00:00:00 2001 From: Max Horn Date: Sat, 21 Jun 2003 23:29:34 +0000 Subject: lots of mixer cleanup / refactoring / reengineering svn-id: r8594 --- scumm/imuse_digi.cpp | 26 +++++---- scumm/imuse_digi.h | 2 +- scumm/smush/smush_mixer.cpp | 29 ++++++---- scumm/smush/smush_player.cpp | 4 +- scumm/sound.cpp | 4 +- sound/mixer.cpp | 134 ++++++++++++------------------------------- sound/mixer.h | 16 +++--- 7 files changed, 81 insertions(+), 134 deletions(-) diff --git a/scumm/imuse_digi.cpp b/scumm/imuse_digi.cpp index f2bab909da..f31db2272b 100644 --- a/scumm/imuse_digi.cpp +++ b/scumm/imuse_digi.cpp @@ -94,16 +94,16 @@ IMuseDigital::IMuseDigital(Scumm *scumm) { memset(_channel, 0, sizeof(Channel) * MAX_DIGITAL_CHANNELS); _scumm = scumm; for (int32 l = 0; l < MAX_DIGITAL_CHANNELS; l++) { - _channel[l]._initialized = false; + _channel[l]._mixerChannel = -1; } - _scumm->_mixer->beginSlots(MAX_DIGITAL_CHANNELS + 1); _scumm->_timer->installProcedure(imus_digital_handler, 200000); _pause = false; } IMuseDigital::~IMuseDigital() { for (int32 l = 0; l < MAX_DIGITAL_CHANNELS; l++) { - _scumm->_mixer->stop(l); + if (_channel[l]._mixerChannel != -1) + _scumm->_mixer->stop(_channel[l]._mixerChannel); } _scumm->_timer->releaseProcedure(imus_digital_handler); } @@ -708,17 +708,20 @@ static const imuse_ft_music_table _ftSeqMusicTable[] = { void IMuseDigital::handler() { uint32 l = 0, i = 0; - if (_pause == true) + if (_pause) return; for (l = 0; l < MAX_DIGITAL_CHANNELS;l ++) { if (_channel[l]._used) { if (_channel[l]._toBeRemoved == true) { - _scumm->_mixer->stop(l); + if (_channel[l]._mixerChannel != -1) { + _scumm->_mixer->stop(_channel[l]._mixerChannel); + _channel[l]._mixerChannel = -1; + } if (_scumm->_mixer->_channels[l] == NULL) { free(_channel[l]._data); _channel[l]._used = false; - _channel[l]._initialized = false; + _channel[l]._mixerChannel = -1; } continue; } @@ -764,7 +767,7 @@ void IMuseDigital::handler() { uint32 new_size = _channel[l]._mixerSize; uint32 mixer_size = new_size; - if (_channel[l]._initialized == false) { + if (_channel[l]._mixerChannel == -1) { mixer_size *= 2; new_size *= 2; } @@ -820,12 +823,11 @@ void IMuseDigital::handler() { } if (_scumm->_silentDigitalImuse == false) { - if (_channel[l]._initialized == false) { - _scumm->_mixer->playStream(l, buf, mixer_size, - _channel[l]._freq, _channel[l]._mixerFlags, 3, 100000); - _channel[l]._initialized = true; + if (_channel[l]._mixerChannel == -1) { + _channel[l]._mixerChannel = _scumm->_mixer->playStream(buf, mixer_size, + _channel[l]._freq, _channel[l]._mixerFlags, 100000); } else { - _scumm->_mixer->append(l, buf, mixer_size); + _scumm->_mixer->append(_channel[l]._mixerChannel, buf, mixer_size); } } free(buf); diff --git a/scumm/imuse_digi.h b/scumm/imuse_digi.h index a3239c5e4d..8b50ce218f 100644 --- a/scumm/imuse_digi.h +++ b/scumm/imuse_digi.h @@ -69,9 +69,9 @@ private: int32 _idSound; uint32 _mixerSize; uint8 _mixerFlags; + int _mixerChannel; bool _used; bool _toBeRemoved; - bool _initialized; }; Channel _channel[MAX_DIGITAL_CHANNELS]; diff --git a/scumm/smush/smush_mixer.cpp b/scumm/smush/smush_mixer.cpp index 96a0a00ef0..f75fd92881 100644 --- a/scumm/smush/smush_mixer.cpp +++ b/scumm/smush/smush_mixer.cpp @@ -30,9 +30,9 @@ SmushMixer::SmushMixer(SoundMixer *m) : _mixer(m), - _nextIndex(_mixer->_beginSlots), + _nextIndex(0), _soundFrequency(22050) { - for (int32 i = _mixer->_beginSlots; i < SoundMixer::NUM_CHANNELS; i++) { + for (int32 i = 0; i < SoundMixer::NUM_CHANNELS; i++) { _channels[i].id = -1; _channels[i].chan = NULL; _channels[i].mixer_index = -1; @@ -40,11 +40,15 @@ SmushMixer::SmushMixer(SoundMixer *m) : } SmushMixer::~SmushMixer() { + for (int32 i = 0; i < SoundMixer::NUM_CHANNELS; i++) { + if (_channels[i].mixer_index != -1) + _mixer->stop(_channels[i].mixer_index); + } } SmushChannel *SmushMixer::findChannel(int32 track) { debug(9, "SmushMixer::findChannel(%d)", track); - for (int32 i = _mixer->_beginSlots; i < SoundMixer::NUM_CHANNELS; i++) { + for (int32 i = 0; i < SoundMixer::NUM_CHANNELS; i++) { if (_channels[i].id == track) return _channels[i].chan; } @@ -57,12 +61,12 @@ bool SmushMixer::addChannel(SmushChannel *c) { debug(9, "SmushMixer::addChannel(%d)", track); - for (i = _mixer->_beginSlots; i < SoundMixer::NUM_CHANNELS; i++) { + for (i = 0; i < SoundMixer::NUM_CHANNELS; i++) { if (_channels[i].id == track) warning("SmushMixer::addChannel(%d) : channel already exists", track); } if (_nextIndex >= SoundMixer::NUM_CHANNELS) - _nextIndex = _mixer->_beginSlots; + _nextIndex = 0; for (i = _nextIndex; i < SoundMixer::NUM_CHANNELS; i++) { if (_channels[i].chan == NULL || _channels[i].id == -1) { @@ -74,7 +78,7 @@ bool SmushMixer::addChannel(SmushChannel *c) { } } - for (i = _mixer->_beginSlots; i < _nextIndex; i++) { + for (i = 0; i < _nextIndex; i++) { if (_channels[i].chan == NULL || _channels[i].id == -1) { _channels[i].chan = c; _channels[i].id = track; @@ -86,7 +90,7 @@ bool SmushMixer::addChannel(SmushChannel *c) { warning("_nextIndex == %d", _nextIndex); - for (i = _mixer->_beginSlots; i < SoundMixer::NUM_CHANNELS; i++) { + for (i = 0; i < SoundMixer::NUM_CHANNELS; i++) { warning("channel %d : %p(%d, %d) %d %d", i, (void *)_channels[i].chan, _channels[i].chan ? _channels[i].chan->getTrackIdentifier() : -1, _channels[i].chan ? _channels[i].chan->isTerminated() : 1, @@ -99,9 +103,13 @@ bool SmushMixer::addChannel(SmushChannel *c) { bool SmushMixer::handleFrame() { debug(9, "SmushMixer::handleFrame()"); - for (int i = _mixer->_beginSlots; i < SoundMixer::NUM_CHANNELS; i++) { + for (int i = 0; i < SoundMixer::NUM_CHANNELS; i++) { if (_channels[i].id != -1) { if (_channels[i].chan->isTerminated()) { + if (_channels[i].mixer_index != -1) { + _mixer->stop(_channels[i].mixer_index); + _channels[i].mixer_index = -1; + } delete _channels[i].chan; _channels[i].id = -1; _channels[i].chan = NULL; @@ -131,7 +139,7 @@ bool SmushMixer::handleFrame() { if (_silentMixer == false) { if (_channels[i].mixer_index == -1) { - _channels[i].mixer_index = _mixer->playStream(-1, data, size, rate, flags); + _channels[i].mixer_index = _mixer->playStream(data, size, rate, flags, 2000000); } else { _mixer->append(_channels[i].mixer_index, data, size); } @@ -145,7 +153,7 @@ bool SmushMixer::handleFrame() { bool SmushMixer::stop() { debug(9, "SmushMixer::stop()"); - for (int i = _mixer->_beginSlots; i < SoundMixer::NUM_CHANNELS; i++) { + for (int i = 0; i < SoundMixer::NUM_CHANNELS; i++) { if (_channels[i].id != -1) { delete _channels[i].chan; _channels[i].id = -1; @@ -154,4 +162,3 @@ bool SmushMixer::stop() { } return true; } - diff --git a/scumm/smush/smush_player.cpp b/scumm/smush/smush_player.cpp index 928dbc8f25..d27a92f1c6 100644 --- a/scumm/smush/smush_player.cpp +++ b/scumm/smush/smush_player.cpp @@ -451,8 +451,8 @@ void SmushPlayer::handleImuseAction(Chunk &b) { } while (--count); if (_IACTchannel == -1) { - _IACTchannel = _scumm->_mixer->playStream(-1, output_data, 0x1000, 22050, - SoundMixer::FLAG_STEREO | SoundMixer::FLAG_16BITS, -1, 200000); + _IACTchannel = _scumm->_mixer->playStream(output_data, 0x1000, 22050, + SoundMixer::FLAG_STEREO | SoundMixer::FLAG_16BITS, 200000); } else { _scumm->_mixer->append(_IACTchannel, output_data, 0x1000); } diff --git a/scumm/sound.cpp b/scumm/sound.cpp index 61daedd78c..19f4c74c13 100644 --- a/scumm/sound.cpp +++ b/scumm/sound.cpp @@ -1176,8 +1176,8 @@ void Sound::bundleMusicHandler(Scumm *scumm) { _bundleMusicPosition += final_size; if (_bundleMusicTrack == -1) { - _bundleMusicTrack = _scumm->_mixer->playStream(_scumm->_mixer->_beginSlots - 1, buffer, final_size, rate, - SoundMixer::FLAG_16BITS | SoundMixer::FLAG_STEREO, -1, 300000); + _bundleMusicTrack = _scumm->_mixer->playStream(buffer, final_size, rate, + SoundMixer::FLAG_16BITS | SoundMixer::FLAG_STEREO, 300000); } else { _scumm->_mixer->append(_bundleMusicTrack, buffer, final_size); } diff --git a/sound/mixer.cpp b/sound/mixer.cpp index fffb623257..cdcba77d34 100644 --- a/sound/mixer.cpp +++ b/sound/mixer.cpp @@ -53,16 +53,14 @@ class ChannelStream : public Channel { uint32 _fpPos; uint32 _bufferSize; uint32 _rate; - int32 _timeOut; - int32 _setTimeOut; byte _flags; public: - ChannelStream(SoundMixer *mixer, void *sound, uint32 size, uint rate, byte flags, int32 timout, int32 buffer_size); + ChannelStream(SoundMixer *mixer, void *sound, uint32 size, uint rate, byte flags, int32 buffer_size); - void append(void *sound, uint32 size); void mix(int16 *data, uint len); void realDestroy(); + void append(void *sound, uint32 size); }; #ifdef USE_MAD @@ -129,7 +127,6 @@ SoundMixer::SoundMixer() { memset(this,0,sizeof(SoundMixer)); // palmos _volumeTable = (int16 *)calloc(256 * sizeof(int16), 1); - _beginSlots = 0; for (int i = 0; i != NUM_CHANNELS; i++) { _channels[i] = NULL; } @@ -143,20 +140,6 @@ SoundMixer::~SoundMixer() { } } -void SoundMixer::unInsert(Channel *chan) { - for (int i = 0; i != NUM_CHANNELS; i++) { - if (_channels[i] == chan) { - if (_handles[i]) { - *_handles[i] = 0; - _handles[i] = NULL; - } - _channels[i] = NULL; - return; - } - } - error("SoundMixer::channel_deleted chan not found"); -} - int SoundMixer::append(int index, void *sound, uint32 size) { _syst->lock_mutex(_mutex); @@ -173,8 +156,11 @@ int SoundMixer::append(int index, void *sound, uint32 size) { int SoundMixer::insertAt(PlayingSoundHandle *handle, int index, Channel *chan) { if(index == -1) { - for (int i = _beginSlots; i != NUM_CHANNELS; i++) - if (_channels[i] == NULL) { index = i; break; } + for (int i = 0; i != NUM_CHANNELS; i++) + if (_channels[i] == NULL) { + index = i; + break; + } if(index == -1) { warning("SoundMixer::out of mixer slots"); return -1; @@ -191,7 +177,7 @@ int SoundMixer::insertAt(PlayingSoundHandle *handle, int index, Channel *chan) { } int SoundMixer::playRaw(PlayingSoundHandle *handle, void *sound, uint32 size, uint rate, byte flags, int id) { - for (int i = _beginSlots; i != NUM_CHANNELS; i++) { + for (int i = 0; i != NUM_CHANNELS; i++) { if (_channels[i] == NULL) { return insertAt(handle, i, new ChannelRaw(this, sound, size, rate, flags, id)); } @@ -201,22 +187,13 @@ int SoundMixer::playRaw(PlayingSoundHandle *handle, void *sound, uint32 size, ui return -1; } -int SoundMixer::playStream(int idx, void *sound, uint32 size, - uint rate, byte flags, int32 timeout, int32 buffer_size) { - return insertAt(NULL, idx, new ChannelStream(this, sound, size, rate, flags, timeout, buffer_size)); -} - -void SoundMixer::beginSlots(int index) { - if ((index < 0) && (index >= NUM_CHANNELS)) { - warning("soundMixer::beginSlots has invalid index %d", index); - return; - } - _beginSlots = index; +int SoundMixer::playStream(void *sound, uint32 size, uint rate, byte flags, int32 buffer_size) { + return insertAt(NULL, -1, new ChannelStream(this, sound, size, rate, flags, buffer_size)); } #ifdef USE_MAD int SoundMixer::playMP3(PlayingSoundHandle *handle, void *sound, uint32 size, byte flags) { - for (int i = _beginSlots; i != NUM_CHANNELS; i++) { + for (int i = 0; i != NUM_CHANNELS; i++) { if (_channels[i] == NULL) { return insertAt(handle, i, new ChannelMP3(this, sound, size, flags)); } @@ -227,7 +204,7 @@ int SoundMixer::playMP3(PlayingSoundHandle *handle, void *sound, uint32 size, by } int SoundMixer::playMP3CDTrack(PlayingSoundHandle *handle, File *file, mad_timer_t duration) { /* Stop the previously playing CD track (if any) */ - for (int i = _beginSlots; i != NUM_CHANNELS; i++) { + for (int i = 0; i != NUM_CHANNELS; i++) { if (_channels[i] == NULL) { return insertAt(handle, i, new ChannelMP3CDMusic(this, file, duration)); } @@ -240,7 +217,7 @@ int SoundMixer::playMP3CDTrack(PlayingSoundHandle *handle, File *file, mad_timer #ifdef USE_VORBIS int SoundMixer::playVorbis(PlayingSoundHandle *handle, OggVorbis_File *ov_file, int duration, bool is_cd_track) { - for (int i = _beginSlots; i != NUM_CHANNELS; i++) { + for (int i = 0; i != NUM_CHANNELS; i++) { if (_channels[i] == NULL) { return insertAt(handle, i, new ChannelVorbis(this, ov_file, duration, is_cd_track)); } @@ -266,10 +243,20 @@ void SoundMixer::mix(int16 *buf, uint len) { } if (!_paused) { - /* now mix all channels */ + // now mix all channels for (int i = 0; i != NUM_CHANNELS; i++) - if (_channels[i]) - _channels[i]->mix(buf, len); + if (_channels[i]) { + if (_channels[i]->_toBeDestroyed) { + if (_handles[i]) { + *_handles[i] = 0; + _handles[i] = NULL; + } + _channels[i]->realDestroy(); + delete _channels[i]; + _channels[i] = NULL; + } else + _channels[i]->mix(buf, len); + } } _syst->unlock_mutex(_mutex); @@ -309,7 +296,7 @@ void SoundMixer::stop(int index) { void SoundMixer::stopID(int id) { - for (int i = _beginSlots; i != NUM_CHANNELS; i++) { + for (int i = 0; i != NUM_CHANNELS; i++) { if (_channels[i] != NULL && _channels[i]->_id == id) { _channels[i]->destroy(); return; @@ -322,7 +309,7 @@ void SoundMixer::pause(bool paused) { } bool SoundMixer::hasActiveChannel() { - for (int i = _beginSlots; i != NUM_CHANNELS; i++) + for (int i = 0; i != NUM_CHANNELS; i++) if (_channels[i]) return true; return false; @@ -653,7 +640,6 @@ ChannelRaw::ChannelRaw(SoundMixer *mixer, void *sound, uint32 size, uint rate, b _pos = 0; _fpPos = 0; _fpSpeed = (1 << 16) * rate / mixer->_outputRate; - _toBeDestroyed = false; _realSize = size; // adjust the magnitude to prevent division error @@ -676,11 +662,6 @@ ChannelRaw::ChannelRaw(SoundMixer *mixer, void *sound, uint32 size, uint rate, b void ChannelRaw::mix(int16 *data, uint len) { byte *s, *end; - if (_toBeDestroyed) { - realDestroy(); - return; - } - if (len > _size) len = _size; _size -= len; @@ -702,7 +683,7 @@ void ChannelRaw::mix(int16 *data, uint len) { _pos = 0; _fpPos = 0; } else { - realDestroy(); + _toBeDestroyed = true; } } @@ -711,14 +692,12 @@ void ChannelRaw::mix(int16 *data, uint len) { void ChannelRaw::realDestroy() { if (_flags & SoundMixer::FLAG_AUTOFREE) free(_ptr); - _mixer->unInsert(this); - delete this; } #define WARP_WORKAROUND 50000 ChannelStream::ChannelStream(SoundMixer *mixer, void *sound, uint32 size, uint rate, - byte flags, int32 timeout, int32 buffer_size) { + byte flags, int32 buffer_size) { _mixer = mixer; _flags = flags; _bufferSize = buffer_size; @@ -729,8 +708,6 @@ ChannelStream::ChannelStream(SoundMixer *mixer, void *sound, uint32 size, uint r _pos = _ptr; _fpPos = 0; _fpSpeed = (1 << 16) * rate / mixer->_outputRate; - _toBeDestroyed = false; - _setTimeOut = timeout; // adjust the magnitude to prevent division error while (size & 0xFFFF0000) @@ -769,18 +746,7 @@ void ChannelStream::mix(int16 *data, uint len) { const int16 *vol_tab = _mixer->_volumeTable; byte *end_of_data = _endOfData; - if (_toBeDestroyed) { - realDestroy(); - return; - } - if (_pos == end_of_data) { - if (_timeOut == -1) { - return; - } - if (--_timeOut == 0) { - realDestroy(); - } return; } @@ -813,14 +779,11 @@ void ChannelStream::mix(int16 *data, uint len) { mixer_helper_table[_flags & 0x07] (data, &len, &_pos, &fp_pos, fp_speed, vol_tab, end_of_data, (_flags & SoundMixer::FLAG_REVERSE_STEREO) ? true : false); } } - _timeOut = _setTimeOut; _fpPos = fp_pos; } void ChannelStream::realDestroy() { free(_ptr); - _mixer->unInsert(this); - delete this; } #ifdef USE_MAD @@ -831,7 +794,6 @@ ChannelMP3::ChannelMP3(SoundMixer *mixer, void *sound, uint size, byte flags) { _position = 0; _size = size; _ptr = (byte *)sound; - _toBeDestroyed = false; mad_stream_init(&_stream); #ifdef _WIN32_WCE @@ -875,11 +837,6 @@ void ChannelMP3::mix(int16 *data, uint len) { const int16 * vol_tab = _mixer->_volumeTable; unsigned char volume = ((int)vol_tab[1]) / 8; - if (_toBeDestroyed) { - realDestroy(); - return; - } - while (1) { ch = _synth.pcm.samples[0] + _posInFrame; @@ -908,7 +865,7 @@ void ChannelMP3::mix(int16 *data, uint len) { return; if (_position >= _size) { - realDestroy(); + _toBeDestroyed = true; return; } @@ -918,7 +875,7 @@ void ChannelMP3::mix(int16 *data, uint len) { if (mad_frame_decode(&_frame, &_stream) == -1) { /* End of audio... */ if (_stream.error == MAD_ERROR_BUFLEN) { - realDestroy(); + _toBeDestroyed = true; return; } else if (!MAD_RECOVERABLE(_stream.error)) { error("MAD frame decode error !"); @@ -933,12 +890,9 @@ void ChannelMP3::mix(int16 *data, uint len) { void ChannelMP3::realDestroy() { if (_flags & SoundMixer::FLAG_AUTOFREE) free(_ptr); - _mixer->unInsert(this); mad_synth_finish(&_synth); mad_frame_finish(&_frame); mad_stream_finish(&_stream); - - delete this; } #define MP3CD_BUFFERING_SIZE 131072 @@ -951,7 +905,6 @@ ChannelMP3CDMusic::ChannelMP3CDMusic(SoundMixer *mixer, File *file, _initialized = false; _bufferSize = MP3CD_BUFFERING_SIZE; _ptr = (byte *)malloc(MP3CD_BUFFERING_SIZE); - _toBeDestroyed = false; mad_stream_init(&_stream); #ifdef _WIN32_WCE @@ -968,18 +921,13 @@ void ChannelMP3CDMusic::mix(int16 *data, uint len) { mad_timer_t frame_duration; unsigned char volume = _mixer->_musicVolume / 8; - if (_toBeDestroyed) { - realDestroy(); - return; - } - if (!_initialized) { int skip_loop; // just skipped memset(_ptr, 0, _bufferSize); _size = _file->read(_ptr, _bufferSize); if (!_size) { - realDestroy(); + _toBeDestroyed = true; return; } // Resync @@ -995,7 +943,7 @@ void ChannelMP3CDMusic::mix(int16 *data, uint len) { } else { if (!MAD_RECOVERABLE(_stream.error)) { debug(1, "Unrecoverable error while skipping !"); - realDestroy(); + _toBeDestroyed = true; return; } } @@ -1009,7 +957,7 @@ void ChannelMP3CDMusic::mix(int16 *data, uint len) { _initialized = true; } else { debug(1, "Cannot resume decoding"); - realDestroy(); + _toBeDestroyed = true; return; } } @@ -1069,12 +1017,9 @@ bool ChannelMP3CDMusic::soundFinished() { void ChannelMP3CDMusic::realDestroy() { free(_ptr); - _mixer->unInsert(this); mad_synth_finish(&_synth); mad_frame_finish(&_frame); mad_stream_finish(&_stream); - - delete this; } #endif @@ -1091,14 +1036,9 @@ ChannelVorbis::ChannelVorbis(SoundMixer *mixer, OggVorbis_File *ov_file, int dur _eof_flag = false; _is_cd_track = is_cd_track; - _toBeDestroyed = false; } void ChannelVorbis::mix(int16 *data, uint len) { - if (_toBeDestroyed) { - realDestroy(); - return; - } if (_eof_flag) { memset(data, 0, sizeof(int16) * 2 * len); @@ -1158,12 +1098,10 @@ void ChannelVorbis::mix(int16 *data, uint len) { delete [] samples; if (_eof_flag && ! _is_cd_track) - realDestroy(); + _toBeDestroyed = true; } void ChannelVorbis::realDestroy() { - _mixer->unInsert(this); - delete this; } bool ChannelVorbis::soundFinished() { diff --git a/sound/mixer.h b/sound/mixer.h index 1abfcc4935..afe6560a73 100644 --- a/sound/mixer.h +++ b/sound/mixer.h @@ -39,9 +39,14 @@ typedef uint32 PlayingSoundHandle; +class Channel; class File; class SoundMixer; +// TODO: class Channel should really be declared non-public, inside mixer.cpp +// However, right now Sound::updateMP3CD directly calls soundFinished. That +// should be changed, by adding proper API abstraction to SoundMixer for +// MP3/Vorbis "CD" playback. class Channel { protected: SoundMixer *_mixer; @@ -86,16 +91,10 @@ public: Channel *_channels[NUM_CHANNELS]; - int _beginSlots; - public: SoundMixer(); ~SoundMixer(); - int insertAt(PlayingSoundHandle *handle, int index, Channel *chan); - void unInsert(Channel *chan); - void beginSlots(int index); - // start playing a raw sound enum { // Do *NOT* change any of these flags without looking at the code in mixer.cpp @@ -107,8 +106,7 @@ public: FLAG_LOOP = 1 << 5 // loop the audio }; int playRaw(PlayingSoundHandle *handle, void *sound, uint32 size, uint rate, byte flags, int id = -1); - int playStream(int index, void *sound, uint32 size, uint rate, - byte flags, int32 timeout = 3, int32 buffer_size = 2000000); + int playStream(void *sound, uint32 size, uint rate, byte flags, int32 buffer_size); #ifdef USE_MAD int playMP3(PlayingSoundHandle *handle, void *sound, uint32 size, byte flags); int playMP3CDTrack(PlayingSoundHandle *handle, File *file, mad_timer_t duration); @@ -150,6 +148,8 @@ public: /** pause - unpause */ void pause(bool paused); +private: + int insertAt(PlayingSoundHandle *handle, int index, Channel *chan); }; #endif -- cgit v1.2.3