aboutsummaryrefslogtreecommitdiff
path: root/sound
diff options
context:
space:
mode:
authorMax Horn2003-12-17 01:57:37 +0000
committerMax Horn2003-12-17 01:57:37 +0000
commit91997026a0d60d0c66a098f5b653945892eb203b (patch)
tree8fd24ab30e4e538babf9c20f0739c78cccbd27eb /sound
parent4343567458cefe5de8f3493040c79af9f4cdd50a (diff)
downloadscummvm-rg350-91997026a0d60d0c66a098f5b653945892eb203b.tar.gz
scummvm-rg350-91997026a0d60d0c66a098f5b653945892eb203b.tar.bz2
scummvm-rg350-91997026a0d60d0c66a098f5b653945892eb203b.zip
cleanup
svn-id: r11697
Diffstat (limited to 'sound')
-rw-r--r--sound/mixer.cpp26
1 files changed, 11 insertions, 15 deletions
diff --git a/sound/mixer.cpp b/sound/mixer.cpp
index 76c7d19cf0..df2a25036c 100644
--- a/sound/mixer.cpp
+++ b/sound/mixer.cpp
@@ -41,6 +41,7 @@ class Channel {
private:
SoundMixer *_mixer;
PlayingSoundHandle *_handle;
+ const bool _isMusic;
byte _volume;
int8 _pan;
bool _paused;
@@ -52,16 +53,17 @@ protected:
public:
int _id;
- Channel(SoundMixer *mixer, PlayingSoundHandle *handle, byte volume, int8 pan)
- : _mixer(mixer), _handle(handle), _converter(0), _input(0), _volume(volume), _pan(pan), _paused(false), _id(-1) {
+ Channel(SoundMixer *mixer, PlayingSoundHandle *handle, bool isMusic, byte volume, int8 pan)
+ : _mixer(mixer), _handle(handle), _isMusic(isMusic), _volume(volume), _pan(pan), _paused(false), _converter(0), _input(0), _id(-1) {
assert(mixer);
}
virtual ~Channel();
void destroy();
virtual void mix(int16 *data, uint len);
- virtual bool isMusicChannel() const = 0;
-
+ bool isMusicChannel() const {
+ return _isMusic;
+ }
void pause(bool paused) {
_paused = paused;
}
@@ -84,34 +86,28 @@ class ChannelRaw : public Channel {
public:
ChannelRaw(SoundMixer *mixer, PlayingSoundHandle *handle, void *sound, uint32 size, uint rate, byte flags, byte volume, int8 pan, int id, uint32 loopStart, uint32 loopEnd);
~ChannelRaw();
- bool isMusicChannel() const { return false; }
};
class ChannelStream : public Channel {
public:
ChannelStream(SoundMixer *mixer, PlayingSoundHandle *handle, void *sound, uint32 size, uint rate, byte flags, uint32 buffer_size, byte volume, int8 pan);
void append(void *sound, uint32 size);
- bool isMusicChannel() const { return true; }
void finish();
};
#ifdef USE_MAD
class ChannelMP3 : public Channel {
- const bool _isMusic;
public:
ChannelMP3(SoundMixer *mixer, PlayingSoundHandle *handle, File *file, uint size, byte volume, int8 pan);
ChannelMP3(SoundMixer *mixer, PlayingSoundHandle *handle, File *file, mad_timer_t duration, byte volume, int8 pan);
- bool isMusicChannel() const { return _isMusic; }
};
#endif // USE_MAD
#ifdef USE_VORBIS
class ChannelVorbis : public Channel {
- const bool _isMusic;
public:
ChannelVorbis(SoundMixer *mixer, PlayingSoundHandle *handle, OggVorbis_File *ov_file, int duration, bool isMusic, byte volume, int8 pan);
- bool isMusicChannel() const { return _isMusic; }
};
#endif // USE_VORBIS
@@ -506,7 +502,7 @@ void Channel::mix(int16 *data, uint len) {
/* RAW mixer */
ChannelRaw::ChannelRaw(SoundMixer *mixer, PlayingSoundHandle *handle, void *sound, uint32 size, uint rate, byte flags, byte volume, int8 pan, int id, uint32 loopStart, uint32 loopEnd)
- : Channel(mixer, handle, volume, pan) {
+ : Channel(mixer, handle, false, volume, pan) {
_id = id;
_ptr = (byte *)sound;
@@ -536,7 +532,7 @@ ChannelRaw::~ChannelRaw() {
ChannelStream::ChannelStream(SoundMixer *mixer, PlayingSoundHandle *handle,
void *sound, uint32 size, uint rate,
byte flags, uint32 buffer_size, byte volume, int8 pan)
- : Channel(mixer, handle, volume, pan) {
+ : Channel(mixer, handle, true, volume, pan) {
assert(size <= buffer_size);
// Create the input stream
@@ -559,7 +555,7 @@ void ChannelStream::append(void *data, uint32 len) {
#ifdef USE_MAD
ChannelMP3::ChannelMP3(SoundMixer *mixer, PlayingSoundHandle *handle, File *file, uint size, byte volume, int8 pan)
- : Channel(mixer, handle, volume, pan), _isMusic(false) {
+ : Channel(mixer, handle, false, volume, pan) {
// Create the input stream
_input = makeMP3Stream(file, mad_timer_zero, size);
@@ -568,7 +564,7 @@ ChannelMP3::ChannelMP3(SoundMixer *mixer, PlayingSoundHandle *handle, File *file
}
ChannelMP3::ChannelMP3(SoundMixer *mixer, PlayingSoundHandle *handle, File *file, mad_timer_t duration, byte volume, int8 pan)
- : Channel(mixer, handle, volume, pan), _isMusic(true) {
+ : Channel(mixer, handle, true, volume, pan) {
// Create the input stream
_input = makeMP3Stream(file, duration, 0);
@@ -579,7 +575,7 @@ ChannelMP3::ChannelMP3(SoundMixer *mixer, PlayingSoundHandle *handle, File *file
#ifdef USE_VORBIS
ChannelVorbis::ChannelVorbis(SoundMixer *mixer, PlayingSoundHandle *handle, OggVorbis_File *ov_file, int duration, bool isMusic, byte volume, int8 pan)
- : Channel(mixer, handle, volume, pan), _isMusic(isMusic) {
+ : Channel(mixer, handle, isMusic, volume, pan) {
// Create the input stream
_input = makeVorbisStream(ov_file, duration);