[Scummvm-cvs-logs] CVS: scummvm/sound audiocd.cpp,1.16,1.17 audiocd.h,1.8,1.9 flac.cpp,1.6,1.7 mixer.cpp,1.184,1.185 mixer.h,1.97,1.98 mp3.cpp,1.17,1.18 vorbis.cpp,1.21,1.22
Max Horn
fingolfin at users.sourceforge.net
Sat Mar 12 10:57:13 CET 2005
- Previous message: [Scummvm-cvs-logs] CVS: scummvm/sound/softsynth mt32.cpp,1.7,1.8
- Next message: [Scummvm-cvs-logs] CVS: scummvm/sword1 animation.cpp,1.36,1.37 credits.cpp,1.10,1.11 sound.cpp,1.43,1.44 sound.h,1.17,1.18
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
Update of /cvsroot/scummvm/scummvm/sound
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv9326/sound
Modified Files:
audiocd.cpp audiocd.h flac.cpp mixer.cpp mixer.h mp3.cpp
vorbis.cpp
Log Message:
PlayingSoundHandle -> SoundHandle; also, turned the handle activity check into a mixer method
Index: audiocd.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/sound/audiocd.cpp,v
retrieving revision 1.16
retrieving revision 1.17
diff -u -d -r1.16 -r1.17
--- audiocd.cpp 10 Jan 2005 22:06:18 -0000 1.16
+++ audiocd.cpp 12 Mar 2005 18:56:05 -0000 1.17
@@ -105,7 +105,7 @@
void AudioCDManager::updateCD() {
if (_cd.playing) {
// If the sound handle is 0, then playback stopped.
- if (!_cd.handle.isActive()) {
+ if (!g_engine->_mixer->isSoundHandleActive(_cd.handle)) {
// If playback just stopped, check if the current track is supposed
// to be repeated, and if that's the case, play it again. Else, stop
// the CD explicitly.
Index: audiocd.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/sound/audiocd.h,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -d -r1.8 -r1.9
--- audiocd.h 6 Jan 2005 18:38:34 -0000 1.8
+++ audiocd.h 12 Mar 2005 18:56:05 -0000 1.9
@@ -30,7 +30,7 @@
class DigitalTrackInfo {
public:
virtual bool error() = 0;
- virtual void play(SoundMixer *mixer, PlayingSoundHandle *handle, int startFrame, int duration) = 0;
+ virtual void play(SoundMixer *mixer, SoundHandle *handle, int startFrame, int duration) = 0;
virtual ~DigitalTrackInfo() { }
};
@@ -62,7 +62,7 @@
private:
/* used for emulated CD music */
struct ExtStatus : Status {
- PlayingSoundHandle handle;
+ SoundHandle handle;
};
ExtStatus _cd;
Index: flac.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/sound/flac.cpp,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -d -r1.6 -r1.7
--- flac.cpp 9 Mar 2005 18:12:48 -0000 1.6
+++ flac.cpp 12 Mar 2005 18:56:06 -0000 1.7
@@ -746,7 +746,7 @@
FlacTrackInfo(File *file);
~FlacTrackInfo();
bool error() { return _file == NULL; }
- void play(SoundMixer *mixer, PlayingSoundHandle *handle, int startFrame, int duration);
+ void play(SoundMixer *mixer, SoundHandle *handle, int startFrame, int duration);
};
FlacTrackInfo::FlacTrackInfo(File *file) : _file(NULL), _firstStream(NULL)
@@ -760,7 +760,7 @@
delete tempStream;
}
-void FlacTrackInfo::play(SoundMixer *mixer, PlayingSoundHandle *handle, int startFrame, int duration) {
+void FlacTrackInfo::play(SoundMixer *mixer, SoundHandle *handle, int startFrame, int duration) {
if (error()) {
debug(1, "FlacTrackInfo::play: invalid state, method should not been called");
}
Index: mixer.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/sound/mixer.cpp,v
retrieving revision 1.184
retrieving revision 1.185
diff -u -d -r1.184 -r1.185
--- mixer.cpp 6 Feb 2005 20:35:05 -0000 1.184
+++ mixer.cpp 12 Mar 2005 18:56:06 -0000 1.185
@@ -47,7 +47,7 @@
const SoundMixer::SoundType _type;
private:
SoundMixer *_mixer;
- PlayingSoundHandle *_handle;
+ SoundHandle *_handle;
bool _autofreeStream;
bool _permanent;
byte _volume;
@@ -64,8 +64,8 @@
public:
- Channel(SoundMixer *mixer, PlayingSoundHandle *handle, SoundMixer::SoundType type, int id = -1);
- Channel(SoundMixer *mixer, PlayingSoundHandle *handle, SoundMixer::SoundType type, AudioStream *input, bool autofreeStream, bool reverseStereo = false, int id = -1, bool permanent = false);
+ Channel(SoundMixer *mixer, SoundHandle *handle, SoundMixer::SoundType type, int id = -1);
+ Channel(SoundMixer *mixer, SoundHandle *handle, SoundMixer::SoundType type, AudioStream *input, bool autofreeStream, bool reverseStereo = false, int id = -1, bool permanent = false);
virtual ~Channel();
void mix(int16 *data, uint len);
@@ -148,7 +148,7 @@
_premixChannel = new Channel(this, 0, type, stream, false);
}
-void SoundMixer::insertChannel(PlayingSoundHandle *handle, Channel *chan) {
+void SoundMixer::insertChannel(SoundHandle *handle, Channel *chan) {
int index = -1;
for (int i = 0; i != NUM_CHANNELS; i++) {
@@ -168,7 +168,7 @@
handle->setIndex(index);
}
-void SoundMixer::playRaw(PlayingSoundHandle *handle, void *sound, uint32 size, uint rate, byte flags,
+void SoundMixer::playRaw(SoundHandle *handle, void *sound, uint32 size, uint rate, byte flags,
int id, byte volume, int8 balance, uint32 loopStart, uint32 loopEnd, SoundType type) {
Common::StackLock lock(_mutex);
@@ -202,7 +202,7 @@
insertChannel(handle, chan);
}
-void SoundMixer::playInputStream(SoundType type, PlayingSoundHandle *handle, AudioStream *input,
+void SoundMixer::playInputStream(SoundType type, SoundHandle *handle, AudioStream *input,
int id, byte volume, int8 balance, bool autofreeStream, bool permanent) {
Common::StackLock lock(_mutex);
@@ -279,7 +279,7 @@
}
}
-void SoundMixer::stopHandle(PlayingSoundHandle handle) {
+void SoundMixer::stopHandle(SoundHandle handle) {
Common::StackLock lock(_mutex);
// Simply ignore stop requests for handles of sounds that already terminated
@@ -299,7 +299,7 @@
}
}
-void SoundMixer::setChannelVolume(PlayingSoundHandle handle, byte volume) {
+void SoundMixer::setChannelVolume(SoundHandle handle, byte volume) {
Common::StackLock lock(_mutex);
if (!handle.isActive())
@@ -316,7 +316,7 @@
_channels[index]->setVolume(volume);
}
-void SoundMixer::setChannelBalance(PlayingSoundHandle handle, int8 balance) {
+void SoundMixer::setChannelBalance(SoundHandle handle, int8 balance) {
Common::StackLock lock(_mutex);
if (!handle.isActive())
@@ -341,7 +341,7 @@
return 0;
}
-uint32 SoundMixer::getSoundElapsedTime(PlayingSoundHandle handle) {
+uint32 SoundMixer::getSoundElapsedTime(SoundHandle handle) {
Common::StackLock lock(_mutex);
if (!handle.isActive())
@@ -375,7 +375,7 @@
}
}
-void SoundMixer::pauseHandle(PlayingSoundHandle handle, bool paused) {
+void SoundMixer::pauseHandle(SoundHandle handle, bool paused) {
Common::StackLock lock(_mutex);
// Simply ignore pause/unpause requests for handles of sound that alreayd terminated
@@ -436,14 +436,14 @@
#pragma mark -
-Channel::Channel(SoundMixer *mixer, PlayingSoundHandle *handle, SoundMixer::SoundType type, int id)
+Channel::Channel(SoundMixer *mixer, SoundHandle *handle, SoundMixer::SoundType type, int id)
: _type(type), _mixer(mixer), _handle(handle), _autofreeStream(true),
_volume(SoundMixer::kMaxChannelVolume), _balance(0), _paused(false), _id(id), _samplesConsumed(0),
_samplesDecoded(0), _mixerTimeStamp(0), _converter(0), _input(0) {
assert(mixer);
}
-Channel::Channel(SoundMixer *mixer, PlayingSoundHandle *handle, SoundMixer::SoundType type, AudioStream *input,
+Channel::Channel(SoundMixer *mixer, SoundHandle *handle, SoundMixer::SoundType type, AudioStream *input,
bool autofreeStream, bool reverseStereo, int id, bool permanent)
: _type(type), _mixer(mixer), _handle(handle), _autofreeStream(autofreeStream),
_volume(SoundMixer::kMaxChannelVolume), _balance(0), _paused(false), _id(id), _samplesConsumed(0),
Index: mixer.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/sound/mixer.h,v
retrieving revision 1.97
retrieving revision 1.98
diff -u -d -r1.97 -r1.98
--- mixer.h 9 Mar 2005 18:12:48 -0000 1.97
+++ mixer.h 12 Mar 2005 18:56:06 -0000 1.98
@@ -33,16 +33,16 @@
class File;
class OSystem;
-class PlayingSoundHandle {
+class SoundHandle {
friend class Channel;
friend class SoundMixer;
int val;
int getIndex() const { return val - 1; }
void setIndex(int i) { val = i + 1; }
void resetIndex() { val = 0; }
-public:
- PlayingSoundHandle() { resetIndex(); }
bool isActive() const { return val > 0; }
+public:
+ SoundHandle() { resetIndex(); }
};
class SoundMixer {
@@ -136,7 +136,7 @@
* (using the makeLinearInputStream factory function), which is then
* passed on to playInputStream.
*/
- void playRaw(PlayingSoundHandle *handle,
+ void playRaw(SoundHandle *handle,
void *sound, uint32 size, uint rate, byte flags,
int id = -1, byte volume = 255, int8 balance = 0,
uint32 loopStart = 0, uint32 loopEnd = 0,
@@ -145,7 +145,7 @@
/**
* Start playing the given audio input stream.
*/
- void playInputStream(SoundType type, PlayingSoundHandle *handle, AudioStream *input,
+ void playInputStream(SoundType type, SoundHandle *handle, AudioStream *input,
int id = -1, byte volume = 255, int8 balance = 0,
bool autofreeStream = true, bool permanent = false);
@@ -168,7 +168,7 @@
*
* @param handle the sound to affect
*/
- void stopHandle(PlayingSoundHandle handle);
+ void stopHandle(SoundHandle handle);
@@ -194,7 +194,7 @@
* @param handle the sound to affect
* @param paused true to pause the sound, false to unpause it
*/
- void pauseHandle(PlayingSoundHandle handle, bool paused);
+ void pauseHandle(SoundHandle handle, bool paused);
@@ -207,6 +207,16 @@
bool isSoundIDActive(int id);
/**
+ * Check if a sound with the given hANDLE is active.
+ *
+ * @param handle the sound to query
+ * @return true if the sound is active
+ */
+ bool isSoundHandleActive(SoundHandle handle) {
+ return handle.isActive();
+ }
+
+ /**
* Check if the mixer is paused (using pauseAll).
*
* @return true if the mixer is paused
@@ -221,7 +231,7 @@
* @param handle the sound to affect
* @param volume the new channel volume (0 - 255)
*/
- void setChannelVolume(PlayingSoundHandle handle, byte volume);
+ void setChannelVolume(SoundHandle handle, byte volume);
/**
* Set the channel balance for the given handle.
@@ -230,7 +240,7 @@
* @param balance the new channel balance:
* (-127 ... 0 ... 127) corresponds to (left ... center ... right)
*/
- void setChannelBalance(PlayingSoundHandle handle, int8 balance);
+ void setChannelBalance(SoundHandle handle, int8 balance);
/**
* Get approximation of for how long the Sound ID has been playing.
@@ -240,7 +250,7 @@
/**
* Get approximation of for how long the channel has been playing.
*/
- uint32 getSoundElapsedTime(PlayingSoundHandle handle);
+ uint32 getSoundElapsedTime(SoundHandle handle);
/**
* Check whether any channel of the given sound type is active.
@@ -275,7 +285,7 @@
uint getOutputRate() const { return _outputRate; }
private:
- void insertChannel(PlayingSoundHandle *handle, Channel *chan);
+ void insertChannel(SoundHandle *handle, Channel *chan);
/**
* Internal main method -- all the actual mixing work is done from here.
Index: mp3.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/sound/mp3.cpp,v
retrieving revision 1.17
retrieving revision 1.18
diff -u -d -r1.17 -r1.18
--- mp3.cpp 9 Mar 2005 18:12:48 -0000 1.17
+++ mp3.cpp 12 Mar 2005 18:56:06 -0000 1.18
@@ -285,7 +285,7 @@
MP3TrackInfo(File *file);
~MP3TrackInfo();
bool error() { return _error_flag; }
- void play(SoundMixer *mixer, PlayingSoundHandle *handle, int startFrame, int duration);
+ void play(SoundMixer *mixer, SoundHandle *handle, int startFrame, int duration);
};
@@ -360,7 +360,7 @@
delete file;
}
-void MP3TrackInfo::play(SoundMixer *mixer, PlayingSoundHandle *handle, int startFrame, int duration) {
+void MP3TrackInfo::play(SoundMixer *mixer, SoundHandle *handle, int startFrame, int duration) {
unsigned int offset;
mad_timer_t durationTime;
Index: vorbis.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/sound/vorbis.cpp,v
retrieving revision 1.21
retrieving revision 1.22
diff -u -d -r1.21 -r1.22
--- vorbis.cpp 9 Mar 2005 18:12:48 -0000 1.21
+++ vorbis.cpp 12 Mar 2005 18:56:06 -0000 1.22
@@ -50,7 +50,7 @@
~VorbisTrackInfo();
bool openTrack();
bool error() { return _error_flag; }
- void play(SoundMixer *mixer, PlayingSoundHandle *handle, int startFrame, int duration);
+ void play(SoundMixer *mixer, SoundHandle *handle, int startFrame, int duration);
};
@@ -166,7 +166,7 @@
#define VORBIS_TREMOR
#endif
-void VorbisTrackInfo::play(SoundMixer *mixer, PlayingSoundHandle *handle, int startFrame, int duration) {
+void VorbisTrackInfo::play(SoundMixer *mixer, SoundHandle *handle, int startFrame, int duration) {
bool err = openTrack();
assert(!err);
- Previous message: [Scummvm-cvs-logs] CVS: scummvm/sound/softsynth mt32.cpp,1.7,1.8
- Next message: [Scummvm-cvs-logs] CVS: scummvm/sword1 animation.cpp,1.36,1.37 credits.cpp,1.10,1.11 sound.cpp,1.43,1.44 sound.h,1.17,1.18
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
More information about the Scummvm-git-logs
mailing list