summaryrefslogtreecommitdiff
path: root/indra/media_plugins/cef/windows_volume_catcher.cpp
diff options
context:
space:
mode:
authorNat Goodspeed <nat@lindenlab.com>2017-03-13 16:38:00 -0400
committerNat Goodspeed <nat@lindenlab.com>2017-03-13 16:38:00 -0400
commit66de0c9965ff68bcb8cb60975fcffa45e2c6d74c (patch)
treee3fa6c87fe70e487b6fc6e94f6793b7638b568ea /indra/media_plugins/cef/windows_volume_catcher.cpp
parent49e114748fdb52599aaa141c2006198c48aa083b (diff)
parent17c8eadb3d89bc78019f0b50eb8b109f25616781 (diff)
Automated merge with ssh://bitbucket.org/lindenlab/viewer-release
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 c9ea3ed597..6953ad3ab8 100644
--- a/indra/media_plugins/cef/windows_volume_catcher.cpp
+++ b/indra/media_plugins/cef/windows_volume_catcher.cpp
@@ -41,44 +41,15 @@ public:
void setPan(F32 pan);
private:
- 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()
@@ -89,26 +60,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)