diff -r -u scummvm/sound/mixer.cpp scummvm-mod/sound/mixer.cpp
old
|
new
|
|
68 | 68 | return index; |
69 | 69 | } |
70 | 70 | |
71 | | int SoundMixer::insert(PlayingSoundHandle *handle, Channel * chan) |
| 71 | int SoundMixer::play_raw(PlayingSoundHandle *handle, void *sound, uint32 size, uint rate, |
| 72 | byte flags) |
72 | 73 | { |
73 | 74 | for (int i = 0; i != NUM_CHANNELS; i++) { |
74 | 75 | if (_channels[i] == NULL) { |
75 | | return insert_at(handle, i, chan); |
| 76 | return insert_at(handle, i, new Channel_RAW(this, sound, size, rate, flags)); |
76 | 77 | } |
77 | 78 | } |
78 | 79 | |
79 | | warning("SoundMixer::insert out of mixer slots"); |
80 | | chan->real_destroy(); |
81 | | |
| 80 | warning("SoundMixer::out of mixer slots"); |
82 | 81 | return -1; |
83 | 82 | } |
84 | 83 | |
85 | | |
86 | | int SoundMixer::play_raw(PlayingSoundHandle *handle, void *sound, uint32 size, uint rate, |
87 | | byte flags) |
88 | | { |
89 | | return insert(handle, new Channel_RAW(this, sound, size, rate, flags)); |
90 | | } |
91 | | |
92 | 84 | int SoundMixer::play_stream(PlayingSoundHandle *handle, int idx, void *sound, uint32 size, |
93 | 85 | uint rate, byte flags) |
94 | 86 | { |
… |
… |
|
98 | 90 | #ifdef COMPRESSED_SOUND_FILE |
99 | 91 | int SoundMixer::play_mp3(PlayingSoundHandle *handle, void *sound, uint32 size, byte flags) |
100 | 92 | { |
101 | | return insert(handle, new Channel_MP3(this, sound, size, flags)); |
| 93 | for (int i = 0; i != NUM_CHANNELS; i++) { |
| 94 | if (_channels[i] == NULL) { |
| 95 | return insert_at(handle, i, new Channel_MP3(this, sound, size, flags)); |
| 96 | } |
| 97 | } |
| 98 | |
| 99 | warning("SoundMixer::out of mixer slots"); |
| 100 | return -1; |
102 | 101 | } |
103 | 102 | int SoundMixer::play_mp3_cdtrack(PlayingSoundHandle *handle, FILE * file, mad_timer_t duration) |
104 | 103 | { |
105 | 104 | /* Stop the previously playing CD track (if any) */ |
106 | | return insert(handle, new Channel_MP3_CDMUSIC(this, file, duration)); |
| 105 | for (int i = 0; i != NUM_CHANNELS; i++) { |
| 106 | if (_channels[i] == NULL) { |
| 107 | return insert_at(handle, i, new Channel_MP3_CDMUSIC(this, file, duration)); |
| 108 | } |
| 109 | } |
| 110 | |
| 111 | warning("SoundMixer::out of mixer slots"); |
| 112 | return -1; |
107 | 113 | } |
108 | 114 | #endif |
109 | 115 | |
diff -r -u scummvm/sound/mixer.h scummvm-mod/sound/mixer.h
old
|
new
|
|
145 | 145 | Channel *_channels[NUM_CHANNELS]; |
146 | 146 | PlayingSoundHandle *_handles[NUM_CHANNELS]; |
147 | 147 | |
148 | | int insert(PlayingSoundHandle *handle, Channel * chan); |
149 | 148 | int insert_at(PlayingSoundHandle *handle, int index, Channel * chan); |
150 | 149 | void append(void *data, uint32 len); |
151 | 150 | void uninsert(Channel * chan); |