[Scummvm-cvs-logs] CVS: scummvm/sound mixer.cpp,1.109,1.110 mixer.h,1.40,1.41
Pawel Kolodziejski
aquadran at users.sourceforge.net
Sat Aug 30 11:13:04 CEST 2003
- Previous message: [Scummvm-cvs-logs] CVS: residual Makefile,1.5,1.6 Makefile.cross,1.5,1.6 Makefile.mingw,1.10,1.11 screen.cpp,1.1,1.2 screen.h,1.1,1.2
- Next message: [Scummvm-cvs-logs] CVS: residual bitmap.cpp,1.8,1.9 engine.cpp,1.9,1.10 model.cpp,1.4,1.5 model.h,1.2,1.3 screen.cpp,1.2,1.3
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
Update of /cvsroot/scummvm/scummvm/sound
In directory sc8-pr-cvs1:/tmp/cvs-serv20815
Modified Files:
mixer.cpp mixer.h
Log Message:
added func isChannelActive for mixer, and fixed handling numbers of channel 0
Index: mixer.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/sound/mixer.cpp,v
retrieving revision 1.109
retrieving revision 1.110
diff -u -d -r1.109 -r1.110
--- mixer.cpp 9 Aug 2003 19:19:27 -0000 1.109
+++ mixer.cpp 30 Aug 2003 18:12:49 -0000 1.110
@@ -159,6 +159,9 @@
void SoundMixer::endStream(int index) {
StackLock lock(_mutex);
+ if (index == -1)
+ return;
+
ChannelStream *chan;
#if !defined(_WIN32_WCE) && !defined(__PALM_OS__)
chan = dynamic_cast<ChannelStream *>(_channels[index]);
@@ -188,7 +191,7 @@
_channels[index] = chan;
if (handle)
- *handle = index + 1;
+ *handle = index;
return index;
}
@@ -297,10 +300,11 @@
StackLock lock(_mutex);
// Simply ignore stop requests for handles of sounds that already terminated
- if (handle == 0)
+ if (handle == -1)
return;
- int index = handle - 1;
+ int index = handle;
+
if ((index < 0) || (index >= NUM_CHANNELS)) {
warning("soundMixer::stopHandle has invalid index %d", index);
return;
@@ -310,6 +314,23 @@
_channels[index]->destroy();
}
+bool SoundMixer::isChannelActive(PlayingSoundHandle handle) {
+ StackLock lock(_mutex);
+
+ if (handle == -1)
+ return false;
+
+ int index = handle;
+ if ((index < 0) || (index >= NUM_CHANNELS)) {
+ warning("soundMixer::isChannelActive has invalid index %d", index);
+ return false;
+ }
+
+ if (_channels[index])
+ return _channels[index] != NULL;
+ else
+ return false;
+}
void SoundMixer::pause(bool paused) {
_paused = paused;
@@ -367,7 +388,7 @@
delete _converter;
delete _input;
if (_handle)
- *_handle = 0;
+ *_handle = -1;
}
void Channel::destroy() {
Index: mixer.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/sound/mixer.h,v
retrieving revision 1.40
retrieving revision 1.41
diff -u -d -r1.40 -r1.41
--- mixer.h 9 Aug 2003 19:19:27 -0000 1.40
+++ mixer.h 30 Aug 2003 18:12:49 -0000 1.41
@@ -107,6 +107,8 @@
/** stop playing the channel for the given handle */
void stopHandle(PlayingSoundHandle handle);
+ bool isChannelActive(PlayingSoundHandle handle);
+
/** Start a new stream. */
int newStream(void *sound, uint32 size, uint rate, byte flags, uint32 buffer_size);
- Previous message: [Scummvm-cvs-logs] CVS: residual Makefile,1.5,1.6 Makefile.cross,1.5,1.6 Makefile.mingw,1.10,1.11 screen.cpp,1.1,1.2 screen.h,1.1,1.2
- Next message: [Scummvm-cvs-logs] CVS: residual bitmap.cpp,1.8,1.9 engine.cpp,1.9,1.10 model.cpp,1.4,1.5 model.h,1.2,1.3 screen.cpp,1.2,1.3
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
More information about the Scummvm-git-logs
mailing list