diff options
author | Max Horn | 2002-07-29 16:18:32 +0000 |
---|---|---|
committer | Max Horn | 2002-07-29 16:18:32 +0000 |
commit | c56c8ea5e618a74000e7bdce09c40eca7f3b01fb (patch) | |
tree | 0e36a73c098e99efcd9187b815a7e77838c00aef /sound | |
parent | a99fe80d4b721e7e8745c6fd0c9d8b75205bba6b (diff) | |
download | scummvm-rg350-c56c8ea5e618a74000e7bdce09c40eca7f3b01fb.tar.gz scummvm-rg350-c56c8ea5e618a74000e7bdce09c40eca7f3b01fb.tar.bz2 scummvm-rg350-c56c8ea5e618a74000e7bdce09c40eca7f3b01fb.zip |
patch 587769 by Fridvin Logi (supposedly helps with Nexus in The Dig)
svn-id: r4678
Diffstat (limited to 'sound')
-rw-r--r-- | sound/mixer.cpp | 34 | ||||
-rw-r--r-- | sound/mixer.h | 1 |
2 files changed, 20 insertions, 15 deletions
diff --git a/sound/mixer.cpp b/sound/mixer.cpp index 06a8c3f99e..7cb75050cf 100644 --- a/sound/mixer.cpp +++ b/sound/mixer.cpp @@ -68,27 +68,19 @@ int SoundMixer::insert_at(PlayingSoundHandle *handle, int index, Channel * chan) return index; } -int SoundMixer::insert(PlayingSoundHandle *handle, Channel * chan) +int SoundMixer::play_raw(PlayingSoundHandle *handle, void *sound, uint32 size, uint rate, + byte flags) { for (int i = 0; i != NUM_CHANNELS; i++) { if (_channels[i] == NULL) { - return insert_at(handle, i, chan); + return insert_at(handle, i, new Channel_RAW(this, sound, size, rate, flags)); } } - warning("SoundMixer::insert out of mixer slots"); - chan->real_destroy(); - + warning("SoundMixer::out of mixer slots"); return -1; } - -int SoundMixer::play_raw(PlayingSoundHandle *handle, void *sound, uint32 size, uint rate, - byte flags) -{ - return insert(handle, new Channel_RAW(this, sound, size, rate, flags)); -} - int SoundMixer::play_stream(PlayingSoundHandle *handle, int idx, void *sound, uint32 size, uint rate, byte flags) { @@ -98,12 +90,26 @@ int SoundMixer::play_stream(PlayingSoundHandle *handle, int idx, void *sound, ui #ifdef COMPRESSED_SOUND_FILE int SoundMixer::play_mp3(PlayingSoundHandle *handle, void *sound, uint32 size, byte flags) { - return insert(handle, new Channel_MP3(this, sound, size, flags)); + for (int i = 0; i != NUM_CHANNELS; i++) { + if (_channels[i] == NULL) { + return insert_at(handle, i, new Channel_MP3(this, sound, size, flags)); + } + } + + warning("SoundMixer::out of mixer slots"); + return -1; } int SoundMixer::play_mp3_cdtrack(PlayingSoundHandle *handle, FILE * file, mad_timer_t duration) { /* Stop the previously playing CD track (if any) */ - return insert(handle, new Channel_MP3_CDMUSIC(this, file, duration)); + for (int i = 0; i != NUM_CHANNELS; i++) { + if (_channels[i] == NULL) { + return insert_at(handle, i, new Channel_MP3_CDMUSIC(this, file, duration)); + } + } + + warning("SoundMixer::out of mixer slots"); + return -1; } #endif diff --git a/sound/mixer.h b/sound/mixer.h index 7f52e88f54..9e4d068d1d 100644 --- a/sound/mixer.h +++ b/sound/mixer.h @@ -145,7 +145,6 @@ public: Channel *_channels[NUM_CHANNELS]; PlayingSoundHandle *_handles[NUM_CHANNELS]; - int insert(PlayingSoundHandle *handle, Channel * chan); int insert_at(PlayingSoundHandle *handle, int index, Channel * chan); void append(void *data, uint32 len); void uninsert(Channel * chan); |