From 80e3c23482fbcea15b545f001d983c7657263761 Mon Sep 17 00:00:00 2001 From: Max Horn Date: Tue, 18 Mar 2003 21:46:44 +0000 Subject: cleanup; add stopID method to stop a currently playing sound via its ID svn-id: r6835 --- sound/mixer.h | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) (limited to 'sound/mixer.h') diff --git a/sound/mixer.h b/sound/mixer.h index acf6e9e051..61ef5553a6 100644 --- a/sound/mixer.h +++ b/sound/mixer.h @@ -46,6 +46,7 @@ private: public: bool _toBeDestroyed; int _id; + Channel() : _id(-1) {} virtual void mix(int16 *data, uint len) = 0; void destroy() { _toBeDestroyed = true; @@ -196,16 +197,14 @@ public: // start playing a raw sound enum { // Do *NOT* change any of these flags without looking at the code in mixer.cpp - FLAG_UNSIGNED = 1, // unsigned samples - FLAG_STEREO = 2, // sound is in stereo - FLAG_16BITS = 4, // sound is 16 bits wide - FLAG_AUTOFREE = 8, // sound buffer is freed automagically at the end of playing - FLAG_FILE = 16, // sound is a FILE * that's read from - FLAG_REVERSE_STEREO = 32, // sound should be reverse stereo - FLAG_LOOP = 64 // loop the audio + FLAG_UNSIGNED = 1 << 0, // unsigned samples + FLAG_STEREO = 1 << 1, // sound is in stereo + FLAG_16BITS = 1 << 2, // sound is 16 bits wide + FLAG_AUTOFREE = 1 << 3, // sound buffer is freed automagically at the end of playing + FLAG_REVERSE_STEREO = 1 << 4, // sound should be reverse stereo + FLAG_LOOP = 1 << 5 // loop the audio }; - int playRaw(PlayingSoundHandle *handle, void *sound, uint32 size, uint rate, byte flags); - int playRaw(PlayingSoundHandle *handle, void *sound, uint32 size, uint rate, byte flags, int id); + 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, byte flags, int32 timeout = 3, int32 buffer_size = 2000000); #ifdef USE_MAD @@ -228,6 +227,9 @@ public: /* stop playing a specific sound */ void stop(int index); + /* stop playing a specific sound */ + void stopID(int id); + /* append to existing sound */ int append(int index, void * sound, uint32 size, uint rate, byte flags); -- cgit v1.2.3