diff options
author | Ankur Ahlawat <anchor@lindenlab.com> | 2018-01-17 15:53:56 -0800 |
---|---|---|
committer | Ankur Ahlawat <anchor@lindenlab.com> | 2018-01-17 15:53:56 -0800 |
commit | 5a12a88f7b53bb99a6b302c35d891a8ecee59855 (patch) | |
tree | dd52f7a9f76ac5d696a517f351371ceb619b7d30 /indra/media_plugins/cef/windows_volume_catcher.cpp | |
parent | d4ce47b09122d1f76601ba402c2b9ad6bb504950 (diff) | |
parent | 7acbd8ed8d73c507675d45360df07d232c431a8b (diff) |
Merged lindenlab/viewer-release into default
Diffstat (limited to 'indra/media_plugins/cef/windows_volume_catcher.cpp')
-rw-r--r-- | indra/media_plugins/cef/windows_volume_catcher.cpp | 55 |
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) |