summaryrefslogtreecommitdiff
path: root/indra/media_plugins/cef/windows_volume_catcher.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'indra/media_plugins/cef/windows_volume_catcher.cpp')
-rw-r--r--indra/media_plugins/cef/windows_volume_catcher.cpp55
1 files changed, 6 insertions, 49 deletions
diff --git a/indra/media_plugins/cef/windows_volume_catcher.cpp b/indra/media_plugins/cef/windows_volume_catcher.cpp
index 0cfb810906..3b52941e96 100644
--- a/indra/media_plugins/cef/windows_volume_catcher.cpp
+++ b/indra/media_plugins/cef/windows_volume_catcher.cpp
@@ -42,44 +42,15 @@ private:
VolumeCatcherImpl();
~VolumeCatcherImpl();
- 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;
-
- // tests if running on Vista, 7, 8 + once in CTOR
- bool isWindowsVistaOrHigher();
-
F32 mVolume;
F32 mPan;
bool mSystemIsVistaOrHigher;
};
-bool VolumeCatcherImpl::isWindowsVistaOrHigher()
-{
- OSVERSIONINFO osvi;
- ZeroMemory(&osvi, sizeof(OSVERSIONINFO));
- osvi.dwOSVersionInfoSize = sizeof(OSVERSIONINFO);
- GetVersionEx(&osvi);
- return osvi.dwMajorVersion >= 6;
-}
-
VolumeCatcherImpl::VolumeCatcherImpl()
: mVolume(1.0f), // default volume is max
mPan(0.f) // default pan is centered
{
- mSystemIsVistaOrHigher = isWindowsVistaOrHigher();
-
- if ( ! mSystemIsVistaOrHigher )
- {
- HMODULE handle = ::LoadLibrary(L"winmm.dll");
- if(handle)
- {
- mSetVolumeFunc = (set_volume_func_t)::GetProcAddress(handle, "setPluginVolume");
- mSetMuteFunc = (set_mute_func_t)::GetProcAddress(handle, "setPluginMute");
- }
- }
}
VolumeCatcherImpl::~VolumeCatcherImpl()
@@ -90,26 +61,12 @@ void VolumeCatcherImpl::setVolume(F32 volume)
{
mVolume = volume;
- if ( mSystemIsVistaOrHigher )
- {
- // set both left/right to same volume
- // TODO: use pan value to set independently
- DWORD left_channel = (DWORD)(mVolume * 65535.0f);
- DWORD right_channel = (DWORD)(mVolume * 65535.0f);
- DWORD hw_volume = left_channel << 16 | right_channel;
- ::waveOutSetVolume(NULL, hw_volume);
- }
- else
- {
- if (mSetMuteFunc)
- {
- mSetMuteFunc(volume == 0.f);
- }
- if (mSetVolumeFunc)
- {
- mSetVolumeFunc(mVolume);
- }
- }
+ // set both left/right to same volume
+ // TODO: use pan value to set independently
+ DWORD left_channel = (DWORD)(mVolume * 65535.0f);
+ DWORD right_channel = (DWORD)(mVolume * 65535.0f);
+ DWORD hw_volume = left_channel << 16 | right_channel;
+ ::waveOutSetVolume(NULL, hw_volume);
}
void VolumeCatcherImpl::setPan(F32 pan)