osu
osu copied to clipboard
Add a 'ducking' effect to the currently playing track when changing ruleset
A combination volume+filter effect is added to attenuate the currently playing track to allow the ruleset selection samples to be better heard.
Also adds 'sample-choking' logic to prevent overlapping sample playback when rapidly cycling through rulesets.
https://github.com/ppy/osu/assets/272140/3c505417-1263-4835-836a-65edc28ff157
The ducking is implemented via new methods added to MusicController
, which are generic enough to also replace some AudioFilter
usages in the codebase that provide a similar effect.
I originally wrote this as a component ala AudioFilter
, but having it coupled with an ITrackStore
to do audio adjustments for volume attenuation felt weird, so I instead just implemented them as methods on MusicControler
(for now?). After ManagedBass
is updated to support the volume effect type (i.e. via peppy/ManagedBass#1 ?), we can do attenuation via a volume effect on the mixer instead of using audio adjustments and that'd allow for a cleaner component.
I also tried adding the ducking effect to other places (f.e. ButtonSystem
), but due to audio adjustments being relative/percentage-based, I couldn't get it sounding consistently nice... with music volume at 70% it would sound okay, but at 100% it sounded off, especially with louder songs. I'll look into it again later, but maybe a fixed decibel reduction could work better... but that's for a separate/future PR.