aboutsummaryrefslogtreecommitdiff
path: root/audio/mixer.cpp
diff options
context:
space:
mode:
authorMatthew Hoops2011-06-13 13:12:23 -0400
committerMatthew Hoops2011-06-13 13:12:23 -0400
commitd355475a0416897ed254fa85f4d63d0f75d9c7ea (patch)
tree184892480ebb704b28163c51999e50c414e85f8a /audio/mixer.cpp
parent224c71e483e09931ba386555ff3b436b9defe63d (diff)
parentbfa26ffc44f80e4eb3d8590f5f865cda6a5188b7 (diff)
downloadscummvm-rg350-d355475a0416897ed254fa85f4d63d0f75d9c7ea.tar.gz
scummvm-rg350-d355475a0416897ed254fa85f4d63d0f75d9c7ea.tar.bz2
scummvm-rg350-d355475a0416897ed254fa85f4d63d0f75d9c7ea.zip
Merge remote branch 'upstream/master' into pegasus
Diffstat (limited to 'audio/mixer.cpp')
-rw-r--r--audio/mixer.cpp38
1 files changed, 38 insertions, 0 deletions
diff --git a/audio/mixer.cpp b/audio/mixer.cpp
index fb4fffb8d8..128224ae85 100644
--- a/audio/mixer.cpp
+++ b/audio/mixer.cpp
@@ -94,6 +94,13 @@ public:
void setVolume(const byte volume);
/**
+ * Gets the channel's own volume.
+ *
+ * @return volume
+ */
+ byte getVolume();
+
+ /**
* Sets the channel's balance setting.
*
* @param balance new balance
@@ -101,6 +108,13 @@ public:
void setBalance(const int8 balance);
/**
+ * Gets the channel's balance setting.
+ *
+ * @return balance
+ */
+ int8 getBalance();
+
+ /**
* Notifies the channel that the global sound type
* volume settings changed.
*/
@@ -342,6 +356,14 @@ void MixerImpl::setChannelVolume(SoundHandle handle, byte volume) {
_channels[index]->setVolume(volume);
}
+byte MixerImpl::getChannelVolume(SoundHandle handle) {
+ const int index = handle._val % NUM_CHANNELS;
+ if (!_channels[index] || _channels[index]->getHandle()._val != handle._val)
+ return 0;
+
+ return _channels[index]->getVolume();
+}
+
void MixerImpl::setChannelBalance(SoundHandle handle, int8 balance) {
Common::StackLock lock(_mutex);
@@ -352,6 +374,14 @@ void MixerImpl::setChannelBalance(SoundHandle handle, int8 balance) {
_channels[index]->setBalance(balance);
}
+int8 MixerImpl::getChannelBalance(SoundHandle handle) {
+ const int index = handle._val % NUM_CHANNELS;
+ if (!_channels[index] || _channels[index]->getHandle()._val != handle._val)
+ return 0;
+
+ return _channels[index]->getBalance();
+}
+
uint32 MixerImpl::getSoundElapsedTime(SoundHandle handle) {
return getElapsedTime(handle).msecs();
}
@@ -482,11 +512,19 @@ void Channel::setVolume(const byte volume) {
updateChannelVolumes();
}
+byte Channel::getVolume() {
+ return _volume;
+}
+
void Channel::setBalance(const int8 balance) {
_balance = balance;
updateChannelVolumes();
}
+int8 Channel::getBalance() {
+ return _balance;
+}
+
void Channel::updateChannelVolumes() {
// From the channel balance/volume and the global volume, we compute
// the effective volume for the left and right channel. Note the