Эх сурвалжийг харах

Fix master volume control on exclusive WASAPI

kiwec 4 сар өмнө
parent
commit
dac1bc5ff3

+ 1 - 0
src/App/Osu/Changelog.cpp

@@ -30,6 +30,7 @@ Changelog::Changelog() : ScreenBackable() {
     latest.title =
         UString::format("%.2f (%s, %s)", convar->getConVarByName("osu_version")->getFloat(), __DATE__, __TIME__);
     latest.changes.push_back("- Changed \"Open Skins folder\" button to open the currently selected skin's folder");
+    latest.changes.push_back("- Fixed master volume control not working on exclusive WASAPI");
     latest.changes.push_back("- Fixed screenshots failing to save");
     latest.changes.push_back("- Fixed skins with non-ANSI folder names failing to open on Windows");
     latest.changes.push_back("- Fixed sliderslide and spinnerspin sounds not looping");

+ 6 - 1
src/Engine/SoundEngine.cpp

@@ -839,7 +839,12 @@ void SoundEngine::setVolume(float volume) {
 #endif
     } else if(m_currentOutputDevice.driver == OutputDriver::BASS_WASAPI) {
 #ifdef _WIN32
-        BASS_WASAPI_SetVolume(BASS_WASAPI_CURVE_WINDOWS | BASS_WASAPI_VOL_SESSION, m_fVolume);
+        if(hasExclusiveOutput()) {
+            // Device volume doesn't seem to work, so we'll use DSP instead
+            BASS_ChannelSetAttribute(g_bassOutputMixer, BASS_ATTRIB_VOLDSP, m_fVolume);
+        } else {
+            BASS_WASAPI_SetVolume(BASS_WASAPI_CURVE_WINDOWS | BASS_WASAPI_VOL_SESSION, m_fVolume);
+        }
 #endif
     } else {
         // 0 (silent) - 10000 (full).