Repository navigation
Add ability to adjust hitsound volume separate from game effects - #38990
Conversation
|
Thank you for reintroducing this! I think renaming the "beatmap hitsounds" toggle to something like "custom hitsounds" or "beatmap samples" would be adequate at clearing up that long-standing confusion. |
|
It would have to be "Custom beatmap hitsounds" at very least, which doesn't fit well in the UI. |
|
This diff is so quaint that it has me... suspicious? Like I'm wondering whether I should be measuring whether this isn't impacting hitsound latency weirdly due to the new mixer being present or something. I forgot or wasn't even aware that just plopping a mixer like this was even possible, so I'm shocked at this being such a simple implementation. One major thing in a quick run of this implementation of the feature that I'm not sure how to feel about, wasn't (explicitly?) signposted in the OP, and possibly explains why I didn't see this feature as simple to execute: the "effects" volume still affects hitsounds, and in fact the hitsounds volume seems to be the product (as in multiplication) of the effects volume and the hitsounds volume. Which feels weird because prior to this, aside from the master volume, the other gauges were mutually exclusive, but now they are not.
This doesn't sound doable due to the above.
Maybe literally just "use hitsounds from beatmap (skin)" or something along those lines. |
Given we are already using mixers at a top level (migrated as part of the other audio subsystem changes a while back) on most platforms, I don't think this is something which needs to be checked on. We aren't further nesting mixers, as they are still only added top level, so this biggest consideration may be the added CPU from running an extra mixer, but this does seem negligible in the grand scheme.
I thought I checked this multiple times but maybe my ears perceived me. This is a definite blocker, will check on what is causing this and figure out how badly this throws a cog in the works. |
When you mentioned wanting this feature to be prioritised in non-public spaces I looked into the current state of things a bit and can thus probably answer this one. The effects volume adjustment is implemented via As far as I can tell, there's little wiggle room except for doing the zig of e.g. using a completely separate sample store for gameplay sample retrieval so this adjustment never gets bound, or doing the zag of somehow rewriting effects volume adjustment such that it no longer works by attaching to the global sample store. Both looked not that simple to execute and therefore I passed on that task. |
|
One idea that maybe salvages this in a simple-enough manner is to leave The only downside would be that it would be a bit of a smell that the framework already exposes separated mixers for track and sample and this setup would almost completely stop using that setup. |
|
This is my alternative proposal: diff --git a/osu.Game/Skinning/Skin.cs b/osu.Game/Skinning/Skin.cs
index 9f5cc47d44..2391644997 100644
--- a/osu.Game/Skinning/Skin.cs
+++ b/osu.Game/Skinning/Skin.cs
@@ -155,7 +155,7 @@ public void RecycleSamples()
{
Samples?.Dispose();
- var samples = resources?.AudioManager?.GetSampleStore(store);
+ var samples = resources?.AudioManager?.GetSampleStore(store, applyGlobalSampleVolume: false);
if (samples != null)
{
diff --git a/osu.Framework/Audio/AudioManager.cs b/osu.Framework/Audio/AudioManager.cs
index 824e6c10d..38ab22ce5 100644
--- a/osu.Framework/Audio/AudioManager.cs
+++ b/osu.Framework/Audio/AudioManager.cs
@@ -317,12 +317,16 @@ public ITrackStore GetTrackStore(IResourceStore<byte[]> store = null, AudioMixer
/// </remarks>
/// <param name="store">The <see cref="IResourceStore{T}"/> of which to retrieve the <see cref="SampleStore"/>.</param>
/// <param name="mixer">The <see cref="AudioMixer"/> to use for samples created by this store. Defaults to the global <see cref="SampleMixer"/>.</param>
- public ISampleStore GetSampleStore(IResourceStore<byte[]> store = null, AudioMixer mixer = null)
+ public ISampleStore GetSampleStore(IResourceStore<byte[]> store = null, AudioMixer mixer = null, bool applyGlobalSampleVolume = true)
{
if (store == null) return globalSampleStore.Value;
SampleStore sm = new SampleStore(store, mixer ?? SampleMixer);
- globalSampleStore.Value.AddItem(sm);
+ if (applyGlobalSampleVolume)
+ globalSampleStore.Value.AddItem(sm);
+ else
+ AddItem(sm);
+
return sm;
}
Could you get behind it? I honestly think this should have been the default for this method, but there was probably valid reason for nesting it at the time. |
Doing things at |
|
Could make a method route specifically for hitsounds? |
|
Maybe you could, I'm not sure. Sample lookups are mired in several intermediate classes like |
I think it will be something like this, although probably in reverse (adding somethign specifically in I'm giving it a try and will report back. |
|
It looks to work... https://github.com/peppy/osu-framework/compare/sample-store-changes?expand=1 The sketchiest part is the API change framework side, but I don't think it's the end of the world. |
57b6166 to
2644896
Compare
d10e92e to
381f6b2
Compare
Caveats:
There may be exceptions that come up which we need to handle separately. I may do a 180 based on how this is received and adjust more than one of the caveats above. Tachyon feedback will be important here.
I also have started on a redesign of the volume overlay to better house this. Consider the one in this PR a temporary change.
This brings a long-sought feature online. I'm not 100% sure on what this should or shouldn't cover, so any feedback is appreciated on how this works for you!