summaryrefslogtreecommitdiff
path: root/indra/media_plugins
diff options
context:
space:
mode:
authorTofu Linden <tofu.linden@lindenlab.com>2010-05-01 15:52:13 +0100
committerTofu Linden <tofu.linden@lindenlab.com>2010-05-01 15:52:13 +0100
commitb7a3582374c8281919d6b4f52f30a80e1f2c31ce (patch)
treed33bd8e898a32e4e6ccbdbc9fcb737ed47ad68d6 /indra/media_plugins
parentd3eb6ffff5fb6ac93aaf12be3937084645055b67 (diff)
parent0cbdad70611201a94b9550598e61067faa1fac6b (diff)
merge from viewer-trunk
Diffstat (limited to 'indra/media_plugins')
-rw-r--r--indra/media_plugins/webkit/mac_volume_catcher.cpp4
-rw-r--r--indra/media_plugins/webkit/windows_volume_catcher.cpp11
-rw-r--r--indra/media_plugins/winmmshim/winmm_shim.cpp12
3 files changed, 13 insertions, 14 deletions
diff --git a/indra/media_plugins/webkit/mac_volume_catcher.cpp b/indra/media_plugins/webkit/mac_volume_catcher.cpp
index 9788f10a58..38727e5965 100644
--- a/indra/media_plugins/webkit/mac_volume_catcher.cpp
+++ b/indra/media_plugins/webkit/mac_volume_catcher.cpp
@@ -1,5 +1,5 @@
/**
- * @file dummy_volume_catcher.cpp
+ * @file mac_volume_catcher.cpp
* @brief A Mac OS X specific hack to control the volume level of all audio channels opened by a process.
*
* @cond
@@ -98,7 +98,7 @@ VolumeCatcherImpl *VolumeCatcherImpl::getInstance()
VolumeCatcherImpl::VolumeCatcherImpl()
{
mVolume = 1.0; // default to full volume
- mPan = 0.5; // and center pan
+ mPan = 0.0; // and center pan
ComponentDescription desc;
desc.componentType = kAudioUnitType_Output;
diff --git a/indra/media_plugins/webkit/windows_volume_catcher.cpp b/indra/media_plugins/webkit/windows_volume_catcher.cpp
index fdff28c2c1..ef96102a0a 100644
--- a/indra/media_plugins/webkit/windows_volume_catcher.cpp
+++ b/indra/media_plugins/webkit/windows_volume_catcher.cpp
@@ -34,7 +34,6 @@
#include "volume_catcher.h"
#include <windows.h>
#include "llsingleton.h"
-
class VolumeCatcherImpl : public LLSingleton<VolumeCatcherImpl>
{
friend LLSingleton<VolumeCatcherImpl>;
@@ -48,8 +47,8 @@ private:
VolumeCatcherImpl();
~VolumeCatcherImpl();
- typedef void (*set_volume_func_t)(F32);
- typedef void (*set_mute_func_t)(bool);
+ typedef void (WINAPI *set_volume_func_t)(F32);
+ typedef void (WINAPI *set_mute_func_t)(bool);
set_volume_func_t mSetVolumeFunc;
set_mute_func_t mSetMuteFunc;
@@ -57,7 +56,6 @@ private:
F32 mVolume;
F32 mPan;
};
-
VolumeCatcherImpl::VolumeCatcherImpl()
: mVolume(1.0f), // default volume is max
mPan(0.f) // default pan is centered
@@ -77,10 +75,8 @@ VolumeCatcherImpl::~VolumeCatcherImpl()
void VolumeCatcherImpl::setVolume(F32 volume)
{
- //F32 left_volume = volume * min(1.f, 1.f - mPan);
- //F32 right_volume = volume * max(0.f, 1.f + mPan);
-
mVolume = volume;
+
if (mSetMuteFunc)
{
mSetMuteFunc(volume == 0.f);
@@ -123,3 +119,4 @@ void VolumeCatcher::pump()
// No periodic tasks are necessary for this implementation.
}
+
diff --git a/indra/media_plugins/winmmshim/winmm_shim.cpp b/indra/media_plugins/winmmshim/winmm_shim.cpp
index f7df3b19a0..6fbf517d7c 100644
--- a/indra/media_plugins/winmmshim/winmm_shim.cpp
+++ b/indra/media_plugins/winmmshim/winmm_shim.cpp
@@ -120,8 +120,8 @@ extern "C"
{ // zero out the audio buffer when muted
memset(pwh->lpData, 0, pwh->dwBufferLength);
}
- else
- {
+ else if (sVolumeLevel != 1.f)
+ { // need to apply volume level
wave_out_map_t::iterator found_it = sWaveOuts.find(hwo);
if (found_it != sWaveOuts.end())
{
@@ -144,10 +144,11 @@ extern "C"
// copy volume level 4 times into 64 bit MMX register
__m64 volume_64 = _mm_set_pi16(volume_16, volume_16, volume_16, volume_16);
- __m64 *sample_64;
+ __m64* sample_64;
+ __m64* last_sample_64 = (__m64*)(pwh->lpData + pwh->dwBufferLength - sizeof(__m64));
// for everything that can be addressed in 64 bit multiples...
for (sample_64 = (__m64*)pwh->lpData;
- sample_64 < (__m64*)(pwh->lpData + pwh->dwBufferLength);
+ sample_64 <= last_sample_64;
++sample_64)
{
//...multiply the samples by the volume...
@@ -162,10 +163,11 @@ extern "C"
// the captain has turned off the MMX sign, you are now free to use floating point registers
_mm_empty();
+ // finish remaining samples that didn't fit into 64 bit register
for (short* sample_16 = (short*)sample_64;
sample_16 < (short*)(pwh->lpData + pwh->dwBufferLength);
++sample_16)
- { // finish remaining samples that didn't fit into 64 bit register
+ {
*sample_16 = (*sample_16 * volume_16) >> 15;
}