diff options
-rw-r--r-- | sound/mixer.cpp | 14 | ||||
-rw-r--r-- | sound/mixer.h | 15 |
2 files changed, 15 insertions, 14 deletions
diff --git a/sound/mixer.cpp b/sound/mixer.cpp index 805d16a8a7..4937c91934 100644 --- a/sound/mixer.cpp +++ b/sound/mixer.cpp @@ -57,22 +57,24 @@ public: virtual ~Channel(); void destroy(); virtual void mix(int16 *data, uint len); - virtual void pause(bool paused) { + + virtual bool isMusicChannel() const = 0; + + void pause(bool paused) { _paused = paused; } - virtual bool isPaused() { + bool isPaused() { return _paused; } - virtual void setChannelVolume(const byte volume) { + void setChannelVolume(const byte volume) { _volume = volume; } - virtual void setChannelPan(const int8 pan) { + void setChannelPan(const int8 pan) { _pan = pan; } - virtual int getVolume() const { + int getVolume() const { return isMusicChannel() ? _mixer->getMusicVolume() : _mixer->getVolume(); } - virtual bool isMusicChannel() const = 0; }; class ChannelRaw : public Channel { diff --git a/sound/mixer.h b/sound/mixer.h index 4518776799..dcea973826 100644 --- a/sound/mixer.h +++ b/sound/mixer.h @@ -50,14 +50,13 @@ public: }; enum { - FLAG_UNSIGNED = 1 << 0, // unsigned samples (default: signed) - FLAG_STEREO = 1 << 1, // sound is in stereo (default: mono) - FLAG_16BITS = 1 << 2, // sound is 16 bits wide (default: 8bit) - FLAG_AUTOFREE = 1 << 3, // sound buffer is freed automagically at the end of playing - FLAG_REVERSE_STEREO = 1 << 4, // reverse the left and right stereo channel - FLAG_LOOP = 1 << 5, // loop the audio - FLAG_LITTLE_ENDIAN = 1 << 6 // sample is little endian (default: big endian) - + FLAG_UNSIGNED = 1 << 0, /** unsigned samples (default: signed) */ + FLAG_16BITS = 1 << 1, /** sound is 16 bits wide (default: 8bit) */ + FLAG_LITTLE_ENDIAN = 1 << 2, /** sample is little endian (default: big endian) */ + FLAG_STEREO = 1 << 3, /** sound is in stereo (default: mono) */ + FLAG_REVERSE_STEREO = 1 << 4, /** reverse the left and right stereo channel */ + FLAG_AUTOFREE = 1 << 5, /** sound buffer is freed automagically at the end of playing */ + FLAG_LOOP = 1 << 6 /** loop the audio */ }; private: |