[Scummvm-cvs-logs] CVS: scummvm/sound mixer.cpp,1.42,1.43 mixer.h,1.21,1.22
Max Horn
fingolfin at users.sourceforge.net
Mon Jul 29 09:19:04 CEST 2002
Update of /cvsroot/scummvm/scummvm/sound
In directory usw-pr-cvs1:/tmp/cvs-serv14480
Modified Files:
mixer.cpp mixer.h
Log Message:
patch 587769 by Fridvin Logi (supposedly helps with Nexus in The Dig)
Index: mixer.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/sound/mixer.cpp,v
retrieving revision 1.42
retrieving revision 1.43
diff -u -d -r1.42 -r1.43
--- mixer.cpp 28 Jul 2002 20:46:07 -0000 1.42
+++ mixer.cpp 29 Jul 2002 16:18:32 -0000 1.43
@@ -68,27 +68,19 @@
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 @@
#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
Index: mixer.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/sound/mixer.h,v
retrieving revision 1.21
retrieving revision 1.22
diff -u -d -r1.21 -r1.22
--- mixer.h 28 Jul 2002 15:35:26 -0000 1.21
+++ mixer.h 29 Jul 2002 16:18:32 -0000 1.22
@@ -145,7 +145,6 @@
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);
More information about the Scummvm-git-logs
mailing list