SPU2: Fix interface for output muting#13316
Conversation
9865a68 to
46111c4
Compare
46111c4 to
c1457ae
Compare
c1457ae to
6b9a36f
Compare
|
Had a brief look at the code, looks okay assuming I've not missed anything However, can someone check what happens in the following situations User mutes via hotkey (which also saves the current volume) User has different volumes for normal and fast forward User has different volumes for normal and FF speed |
New volume is not applied. This is handled by
Same as the first, although this one is even easier to fix because the SPU2 runs a function on nominal rate change. If muted, it could just change the restore volume to whatever the default is for that rate.
This part isn't affected by the mute system improvements, but it works as it always would. I think if, say, the user has 100% standard and 60% FF, but they're on FF and set it to 40%, instead of trying to take some kind of delta and make it 80% when they return to 100%, just make the behavior highly predictable for the end user and return it directly to 100%. |
|
Hmm, now that I think about it, volume sliders in the settings should override up/down hotkeys iff the sliders are used after the user has changed the volume up or down via hotkeys. I did some testing, and that behavior is what felt the most natural and intuitive to me. Having a FF slider (big misnomer; it's just |
6b9a36f to
c104f09
Compare
c104f09 to
39c7057
Compare
kamfretoz
left a comment
There was a problem hiding this comment.
Everything listed in the suggested testing step seems to be working properly.
39c7057 to
7c79a63
Compare
cb9d672 to
8acbe93
Compare
8acbe93 to
070abaa
Compare
7e72296 to
e99da35
Compare
|
Latest pushes after Ziemas' review only exist to split this into two commits. No functionality has been changed. |
Description of Changes
SPU2
s_output_mutedvariable in SPU2 (with accessor) which tracks whether the SPU2 is or isn't muted through EmuConfig/hotkey.s_standard_volumeands_fast_forward_volumevariables in SPU2 which track the current volume level of each "channel" in parallel. This maintains the user's choices such as hotkey volumes and volume slider changes throughout the session.SetOutputMuted()function in SPU2 which sets unmute volume, sets output muted status, and changes the volume correspondingly. Potential future means of muting the SPU2 can make easy, elegant use of this.EmuConfig.SPU2.OutputMutedtakes absolute precedence over e.g. hotkeys.QtHost.cpp.OutputVolumetoStandardVolume. "Output volume" was overloaded, likely as a product of it existing beforeFastForwardVolume. This works better from a user-facing end because it's more clear ("Standard Volume" and "Fast Forward Volume", opposed to "Output Volume" and "Fast Forward Volume") and especially from a maintenance one because we'll have two separate terms for two separate concepts – where one means the current volume of the VM regardless of speed, and the other means the standard-speed volume the user has set.OSD
ICON_FA_VOLUME_OFFwhen at 0% (not muted; see above).ICON_FA_VOLUME_OFFwhen 0%,ICON_FA_VOLUME_LOWwhen < 100%, andICON_FA_VOLUME_HIGHotherwise.I was unable to add an OSD message when toggling the
Mute All Soundssetting. Running from the Qt settings widget is a no-go without linking it to things like the FA icons, which is overkill, and running from inside the SPU2 seems inappropriate.Rationale behind Changes
SPU2
The way we dealt with muting in SPU2 was fundamentally broken with the exception of the EmuConfig setting.
The hotkey conflated setting volume to 0% with toggling a mute. Because this is all the hotkey did, literally anything that wanted to change the volume would override it, including a switch between speeds. The mute hotkey using the same function as the volume adjust hotkeys reinforced this paradigm. The volume adjust hotkeys still override the mute, as that is standard, expected behavior for a mute button.
In current master, if you toggle mute on at a non-default volume (e.g. adjusted via hotkeys) and then back off, you would be reverted to whatever preset you have in the settings. This obviously isn't intuitive or convenient behavior. It likewise isn't intuitive that if you have your standard volume at, say, 70%, change to fast forward, and then back, it'll return to whatever you had in the slider rather than the actual volume.
OSD
Just gives a bit more what I call "continuity", which helps the user more immediately understand the state of the volume.
The changes at the bottom of
spu2.hwere justclang-formatdoing its thing. 🤷Suggested Testing Steps
Mute All Soundsbutton (on startup and during a VM session) and the mute hotkey both work correctly and don't break when you do weird stuff with them, the volume sliders, and the volume adjust hotkeys.Did you use AI to help find, test, or implement this issue or feature?
I created an Audio Interface (AI).