aboutsummaryrefslogtreecommitdiff
path: root/audio/mixer.cpp
diff options
context:
space:
mode:
authorJohannes Schickel2011-04-16 18:32:14 +0200
committerJohannes Schickel2011-04-16 18:32:14 +0200
commit1d60b266879d58663827e7ce0b727c201433394d (patch)
tree0db52a4359011d4facde285426b11fc2f44c2868 /audio/mixer.cpp
parent6b0ccbb095917d5f98722b26bef07d4a0816bb3b (diff)
downloadscummvm-rg350-1d60b266879d58663827e7ce0b727c201433394d.tar.gz
scummvm-rg350-1d60b266879d58663827e7ce0b727c201433394d.tar.bz2
scummvm-rg350-1d60b266879d58663827e7ce0b727c201433394d.zip
AUDIO: Cleanup sound type settings handling in MixerImpl.
Diffstat (limited to 'audio/mixer.cpp')
-rw-r--r--audio/mixer.cpp28
1 files changed, 10 insertions, 18 deletions
diff --git a/audio/mixer.cpp b/audio/mixer.cpp
index a2b50ddbc4..63f006cbc9 100644
--- a/audio/mixer.cpp
+++ b/audio/mixer.cpp
@@ -162,19 +162,11 @@ private:
MixerImpl::MixerImpl(OSystem *system, uint sampleRate)
- : _syst(system), _sampleRate(sampleRate), _mixerReady(false), _handleSeed(0) {
+ : _syst(system), _mutex(), _sampleRate(sampleRate), _mixerReady(false), _handleSeed(0), _soundTypeSettings() {
assert(sampleRate > 0);
- int i;
-
- for (i = 0; i < ARRAYSIZE(_mute); ++i)
- _mute[i] = false;
-
- for (i = 0; i < ARRAYSIZE(_volumeForSoundType); i++)
- _volumeForSoundType[i] = kMaxMixerVolume;
-
- for (i = 0; i != NUM_CHANNELS; i++)
+ for (int i = 0; i != NUM_CHANNELS; i++)
_channels[i] = 0;
}
@@ -326,8 +318,8 @@ void MixerImpl::stopHandle(SoundHandle handle) {
}
void MixerImpl::muteSoundType(SoundType type, bool mute) {
- assert(0 <= type && type < ARRAYSIZE(_mute));
- _mute[type] = mute;
+ assert(0 <= type && type < ARRAYSIZE(_soundTypeSettings));
+ _soundTypeSettings[type].mute = mute;
for (int i = 0; i != NUM_CHANNELS; ++i) {
if (_channels[i] && _channels[i]->getType() == type)
@@ -336,8 +328,8 @@ void MixerImpl::muteSoundType(SoundType type, bool mute) {
}
bool MixerImpl::isSoundTypeMuted(SoundType type) const {
- assert(0 <= type && type < ARRAYSIZE(_mute));
- return _mute[type];
+ assert(0 <= type && type < ARRAYSIZE(_soundTypeSettings));
+ return _soundTypeSettings[type].mute;
}
void MixerImpl::setChannelVolume(SoundHandle handle, byte volume) {
@@ -435,7 +427,7 @@ bool MixerImpl::hasActiveChannelOfType(SoundType type) {
}
void MixerImpl::setVolumeForSoundType(SoundType type, int volume) {
- assert(0 <= type && type < ARRAYSIZE(_volumeForSoundType));
+ assert(0 <= type && type < ARRAYSIZE(_soundTypeSettings));
// Check range
if (volume > kMaxMixerVolume)
@@ -447,7 +439,7 @@ void MixerImpl::setVolumeForSoundType(SoundType type, int volume) {
// scaling? See also Player_V2::setMasterVolume
Common::StackLock lock(_mutex);
- _volumeForSoundType[type] = volume;
+ _soundTypeSettings[type].volume = volume;
for (int i = 0; i != NUM_CHANNELS; ++i) {
if (_channels[i] && _channels[i]->getType() == type)
@@ -456,9 +448,9 @@ void MixerImpl::setVolumeForSoundType(SoundType type, int volume) {
}
int MixerImpl::getVolumeForSoundType(SoundType type) const {
- assert(0 <= type && type < ARRAYSIZE(_volumeForSoundType));
+ assert(0 <= type && type < ARRAYSIZE(_soundTypeSettings));
- return _volumeForSoundType[type];
+ return _soundTypeSettings[type].volume;
}