[Scummvm-cvs-logs] scummvm master -> eb9b492ce7444400246525a66a316b50f1de2bde
sev-
sev at scummvm.org
Sat Jun 11 13:14:36 CEST 2011
This automated email contains information about 2 new commits which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .
Summary:
eb13803709 AUDIO: Add complementary functions for getting channel volume and balance
eb9b492ce7 SWORD25: Unstub more sound-related functions
Commit: eb13803709ad90df75c38eea4ff1b6c55316ca9b
https://github.com/scummvm/scummvm/commit/eb13803709ad90df75c38eea4ff1b6c55316ca9b
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2011-06-11T04:12:19-07:00
Commit Message:
AUDIO: Add complementary functions for getting channel volume and balance
Changed paths:
audio/mixer.cpp
audio/mixer.h
audio/mixer_intern.h
diff --git a/audio/mixer.cpp b/audio/mixer.cpp
index fb4fffb..128224a 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
diff --git a/audio/mixer.h b/audio/mixer.h
index 1fbe265..de709e1 100644
--- a/audio/mixer.h
+++ b/audio/mixer.h
@@ -211,6 +211,14 @@ public:
virtual void setChannelVolume(SoundHandle handle, byte volume) = 0;
/**
+ * Get the channel volume for the given handle.
+ *
+ * @param handle the sound to affect
+ * @return channel volume
+ */
+ virtual byte getChannelVolume(SoundHandle handle) = 0;
+
+ /**
* Set the channel balance for the given handle.
*
* @param handle the sound to affect
@@ -220,6 +228,14 @@ public:
virtual void setChannelBalance(SoundHandle handle, int8 balance) = 0;
/**
+ * Get the channel balance for the given handle.
+ *
+ * @param handle the sound to affect
+ * @return channel balance
+ */
+ virtual int8 getChannelBalance(SoundHandle handle) = 0;
+
+ /**
* Get approximation of for how long the channel has been playing.
*/
virtual uint32 getSoundElapsedTime(SoundHandle handle) = 0;
diff --git a/audio/mixer_intern.h b/audio/mixer_intern.h
index a04eb55..dc361ce 100644
--- a/audio/mixer_intern.h
+++ b/audio/mixer_intern.h
@@ -105,7 +105,9 @@ public:
virtual bool isSoundTypeMuted(SoundType type) const;
virtual void setChannelVolume(SoundHandle handle, byte volume);
+ virtual byte getChannelVolume(SoundHandle handle);
virtual void setChannelBalance(SoundHandle handle, int8 balance);
+ virtual int8 getChannelBalance(SoundHandle handle);
virtual uint32 getSoundElapsedTime(SoundHandle handle);
virtual Timestamp getElapsedTime(SoundHandle handle);
Commit: eb9b492ce7444400246525a66a316b50f1de2bde
https://github.com/scummvm/scummvm/commit/eb9b492ce7444400246525a66a316b50f1de2bde
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2011-06-11T04:12:27-07:00
Commit Message:
SWORD25: Unstub more sound-related functions
Changed paths:
engines/sword25/sfx/soundengine.cpp
diff --git a/engines/sword25/sfx/soundengine.cpp b/engines/sword25/sfx/soundengine.cpp
index e650ae6..9244137 100644
--- a/engines/sword25/sfx/soundengine.cpp
+++ b/engines/sword25/sfx/soundengine.cpp
@@ -126,11 +126,15 @@ void SoundEngine::resumeAll() {
}
void SoundEngine::pauseLayer(uint layer) {
- warning("STUB: SoundEngine::pauseLayer(%d)", layer);
+ // Not used in the game
+
+ warning("SoundEngine::pauseLayer(%d)", layer);
}
void SoundEngine::resumeLayer(uint layer) {
- warning("STUB: SoundEngine::resumeLayer(%d)", layer);
+ // Not used in the game
+
+ warning("SoundEngine::resumeLayer(%d)", layer);
}
SndHandle *SoundEngine::getHandle(uint *id) {
@@ -238,7 +242,9 @@ void SoundEngine::stopSound(uint handle) {
}
bool SoundEngine::isSoundPaused(uint handle) {
- warning("STUB: SoundEngine::isSoundPaused(%d)", handle);
+ // Not used in the game
+
+ warning("SoundEngine::isSoundPaused(%d)", handle);
return false;
}
@@ -252,20 +258,18 @@ bool SoundEngine::isSoundPlaying(uint handle) {
}
float SoundEngine::getSoundVolume(uint handle) {
- warning("STUB: SoundEngine::getSoundVolume(%d)", handle);
+ debugC(1, kDebugSound, "SoundEngine::getSoundVolume(%d)", handle);
- return 0;
+ return (float)_mixer->getChannelVolume(_handles[handle].handle) / 255.0;
}
float SoundEngine::getSoundPanning(uint handle) {
- warning("STUB: SoundEngine::getSoundPanning(%d)", handle);
+ debugC(1, kDebugSound, "SoundEngine::getSoundPanning(%d)", handle);
- return 0;
+ return (float)_mixer->getChannelBalance(_handles[handle].handle) / 127.0;
}
Resource *SoundEngine::loadResource(const Common::String &fileName) {
- warning("STUB: SoundEngine::loadResource(%s)", fileName.c_str());
-
return new SoundResource(fileName);
}
More information about the Scummvm-git-logs
mailing list