[Scummvm-cvs-logs] CVS: scummvm/sound mixer.cpp,1.42,1.43 mixer.h,1.22,1.23
Max Horn
fingolfin at users.sourceforge.net
Sat Jun 21 14:18:02 CEST 2003
- Previous message: [Scummvm-cvs-logs] CVS: scummvm/scumm/smush channel.h,1.10,1.11 imuse_channel.cpp,1.19,1.20 smush_mixer.cpp,1.7,1.8
- Next message: [Scummvm-cvs-logs] CVS: scummvm/scumm imuse_digi.cpp,1.20,1.21 sound.cpp,1.138,1.139
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
Update of /cvsroot/scummvm/scummvm/sound
In directory sc8-pr-cvs1:/tmp/cvs-serv32545
Modified Files:
mixer.cpp mixer.h
Log Message:
modified & cleaned up the playStream/append code a bit; but this API really could stand some refinement
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 21 Jun 2003 19:52:12 -0000 1.42
+++ mixer.cpp 21 Jun 2003 21:17:04 -0000 1.43
@@ -157,18 +157,14 @@
error("SoundMixer::channel_deleted chan not found");
}
-int SoundMixer::append(int index, void *sound, uint32 size, uint rate, byte flags) {
+int SoundMixer::append(int index, void *sound, uint32 size) {
_syst->lock_mutex(_mutex);
Channel *chan = _channels[index];
if (!chan) {
- debug(2, "Trying to stream to an unexistant streamer : %d", index);
- playStream(NULL, index, sound, size, rate, flags);
- chan = _channels[index];
+ error("Trying to stream to a nonexistant streamer : %d", index);
} else {
- chan->append(sound, size);
- if (flags & FLAG_AUTOFREE)
- free(sound);
+ dynamic_cast<ChannelStream *>(chan)->append(sound, size);
}
_syst->unlock_mutex(_mutex);
@@ -205,9 +201,9 @@
return -1;
}
-int SoundMixer::playStream(PlayingSoundHandle *handle, int idx, void *sound, uint32 size,
+int SoundMixer::playStream(int idx, void *sound, uint32 size,
uint rate, byte flags, int32 timeout, int32 buffer_size) {
- return insertAt(handle, idx, new ChannelStream(this, sound, size, rate, flags, timeout, buffer_size));
+ return insertAt(NULL, idx, new ChannelStream(this, sound, size, rate, flags, timeout, buffer_size));
}
void SoundMixer::beginSlots(int index) {
@@ -648,10 +644,6 @@
return false;
}
-void Channel::append(void *sound, uint32 size) {
- error("append method should never be called on something else than a _STREAM mixer ");
-}
-
/* RAW mixer */
ChannelRaw::ChannelRaw(SoundMixer *mixer, void *sound, uint32 size, uint rate, byte flags, int id) {
_id = id;
@@ -734,8 +726,6 @@
memcpy(_ptr, sound, size);
_endOfData = _ptr + size;
_endOfBuffer = _ptr + _bufferSize;
- if (_flags & SoundMixer::FLAG_AUTOFREE)
- free(sound);
_pos = _ptr;
_fpPos = 0;
_fpSpeed = (1 << 16) * rate / mixer->_outputRate;
Index: mixer.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/sound/mixer.h,v
retrieving revision 1.22
retrieving revision 1.23
diff -u -d -r1.22 -r1.23
--- mixer.h 21 Jun 2003 19:52:12 -0000 1.22
+++ mixer.h 21 Jun 2003 21:17:04 -0000 1.23
@@ -54,7 +54,6 @@
_toBeDestroyed = true;
}
virtual void realDestroy() = 0;
- virtual void append(void *sound, uint32 size);
virtual bool soundFinished();
};
@@ -94,7 +93,6 @@
~SoundMixer();
int insertAt(PlayingSoundHandle *handle, int index, Channel *chan);
- void append(void *data, uint32 len);
void unInsert(Channel *chan);
void beginSlots(int index);
@@ -109,7 +107,7 @@
FLAG_LOOP = 1 << 5 // loop the audio
};
int playRaw(PlayingSoundHandle *handle, void *sound, uint32 size, uint rate, byte flags, int id = -1);
- int playStream(PlayingSoundHandle *handle, int index, void *sound, uint32 size, uint rate,
+ int playStream(int index, void *sound, uint32 size, uint rate,
byte flags, int32 timeout = 3, int32 buffer_size = 2000000);
#ifdef USE_MAD
int playMP3(PlayingSoundHandle *handle, void *sound, uint32 size, byte flags);
@@ -135,7 +133,7 @@
void stopID(int id);
/** append to existing sound */
- int append(int index, void * sound, uint32 size, uint rate, byte flags);
+ int append(int index, void * sound, uint32 size);
/** is any channel active? */
bool hasActiveChannel();
- Previous message: [Scummvm-cvs-logs] CVS: scummvm/scumm/smush channel.h,1.10,1.11 imuse_channel.cpp,1.19,1.20 smush_mixer.cpp,1.7,1.8
- Next message: [Scummvm-cvs-logs] CVS: scummvm/scumm imuse_digi.cpp,1.20,1.21 sound.cpp,1.138,1.139
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
More information about the Scummvm-git-logs
mailing list