Dynamic FPS

Dynamic FPS

16M Downloads

Setting sound volume to 0% stops all currently playing sounds, stopping music when unfocussing

Scotsguy opened this issue ยท 6 comments

commented

Steps to reproduce:

  • Start an instance with Dynamic FPS 2.1.0
  • On the title screen, wait for music to start
  • Unfocus the window
  • Focus the window again
  • Notice how the music does not start

If the setting for music volume when unfocussed is set to anything other than 0%, this doesn't happen.

Note: Last i checked, setting the game's volume to 0% is special-cased to turn off the sound system, or something to that effect. If you're doing that, maybe see if there's some workaround to not "really" set the volume to 0%.

commented

This is indeed vanilla behavior. I explicitly decided to keep it because I figured it might have some performance impact (and it generally felt unclean) to still have sounds playing. If you don't want that, you can always set the unfocused volume to something higher, even just 0.001

commented

I'd argue that by default it shouldn't be at exactly 0%, because it's not obvious that this mod causes music to be stopped, especially given that the mod is called "Dynamic FPS", and the settings don't make it obvious that 0% = stop.

Additionally, I ran into this bug while debugging a conflict with my own mod, Now Playing, because it conflicts in quite a peculiar way:
In the End, Minecraft will constantly try to play the boss music to those who aren't currently hearing it. Tabbing out will stop the music, then tabbing in will make Minecraft play the sound multiple times, up to 25 times from the one action. Now Playing shows a toast notification whenever music starts playing, though, which means there are now 25 notifications that have to be displayed.
I'm not quite sure why it happens multiple times, but it happens whether or not the dynamic FPS toggle is enabled or not.

commented

Huh, the default should be 25% volume when unfocused, 0% only when entirely hidden (e.g. minimized). Is that not the case for you?

That end issue is super weird! So the game tries to start the boss music up to 24x until DynFPS finally unmutes it and it succeeds in playing?

The fact that the volume is still reduced when the mod is toggled off is definitely a bug though; I'll have to address that.

commented

Huh, the default should be 25% volume when unfocused, 0% only when entirely hidden (e.g. minimized). Is that not the case for you?

Ah, yeah, it does work like that, but I'm testing this by switching to a different workspace, not by just unfocusing.

That end issue is super weird! So the game tries to start the boss music up to 24x until DynFPS finally unmutes it and it succeeds in playing?

Something like that. It ends up looking like this (with the limit of 5 toasts showing at once):
image

The fact that the volume is still reduced when the mod is toggled off is definitely a bug though; I'll have to address that.

The option is called "Reduce FPS when unfocused", I wouldn't expect it to affect sound in the first place.

commented

Ah, by "the dynamic FPS toggle" I had assumed you meant the keybind to disable the mod temporarily. That's what I wasn't yet incorporating into the sound logic, and I think I should.

As for the other issue, I'm not really comfortable having the default be to reduce sound to a technically inaudible level because it feels super dirty to have it playing if it's not audible. It's too bad that causes sounds to be paused, but I think I'm ok with that over the alternative. If you can come up with a clean way to silence the game without pausing sounds, or to avoid the repeated restarts, I'm happy to merge a PR, but as it stands, I think the mod does what it should there.

commented

As for the other issue, I'm not really comfortable having the default be to reduce sound to a technically inaudible level because it feels super dirty to have it playing if it's not audible. It's too bad that causes sounds to be paused, but I think I'm ok with that over the alternative. If you can come up with a clean way to silence the game without pausing sounds, or to avoid the repeated restarts, I'm happy to merge a PR, but as it stands, I think the mod does what it should there.

For accuracy's sake: it stops sounds and doesn't start them again, they don't just pause.

Fair enough, though. Maybe I'll have a look what I can find in the sound system that isn't quite as hacky.