Skip to content

Adjust sample store retrieval API to allow more flexibility - #6834

Merged
peppy merged 4 commits into
ppy:masterfrom
peppy:sample-store-changes
Oct 8, 2026
Merged

peppy merged 4 commits into
ppy:masterfrom
peppy:sample-store-changes

Conversation

@peppy

@peppy peppy commented Oct 8, 2026

Copy link
Copy Markdown
Member

This change is specifically made with the goal of adding localised volume adjustment for hitsounds during gameplay. It turns out the global "sample" or "effect" volume is added at a framework level via sample retrieval (not hierarchically, for historical reasons), which makes it hard to create a localised adjustment which isn't also affected by the sample volume.

The changes to this API allows:

  • Explicitly bypassing sample volume via the new bool applyGlobalSampleVolume parameter.
  • Getting a new instance of a sample store each call, even when not providing a backing (byte) store. This is specifically to allow correct usage of the above parameter even for default resource retrieval.

The latter of these changes may have potential to cause issues if someone happened to be calling the function expecting the default store every time, but I strongly doubt this was ever the case. At least is not the case for our own usages, so I don't think there's an issue with changing this API. Also, the new version makes more sense to me.

Comment thread osu.Framework/Audio/AudioManager.cs Outdated
/// <param name="applyGlobalSampleVolume">Whether the game-wide effect volume adjustment should be applied to samples retrieved from the resultant store.</param>
public ISampleStore GetSampleStore(IResourceStore<byte[]> store = null, AudioMixer mixer = null, bool applyGlobalSampleVolume = true)
{
if (store == null) return globalSampleStore.Value;

@bdach bdach Oct 8, 2026 •

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't know what this was about but it blames back to f3d0071 and I can not be bothered to blame this back further in game repository prior to the splitting out of framework. At least there don't look to be any usages either in framework or in game that pass null store.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it was likely just an "optimisation", like "don't create one when it's clear we don't need to". But now we kinda need to.

@peppy
peppy merged commit 158bd81 into ppy:master Oct 8, 2026
13 of 14 checks passed
bdach pushed a commit to ppy/osu that referenced this pull request Oct 13, 2026
)

- Builds off #28733
- Addresses #37901,
#38410,
#18654,
#25068,
#34798
- [x] Depends on ppy/osu-framework#6834

Caveats:

- Intentionally called "hitsound volume", not "gameplay volume" because
the intention is to specifically target hitsounds. Gameplay effects
should still be adjusted by the effect volume, as far as I'm concerned.
(alternative take: call this gameplay and include everything non-UI,
then rename "effect" to "UI sounds" or something)
- Affects everything in the playfield and overlay layers. This seems
like a pretty good separation point, which includes things like the
metronome from muted mod. It's about what players will expect from this.
- Does not affect storyboards. I'm sure we're going to get people
complaining about that meaning that "storyboarded hitsounds" are not
affected, but I'm not sure whether this is a correct take or not.
- The following now reads bad. It looks as if the "beatmap hitsounds"
would be a toggle turning them off, not enabling/disabling beatmap
skinned hitsounds. Open to suggestion:
<img width="726" height="456" alt="CleanShot 2026-10-06 at 21 48 33@2x"
src="https://github.com/user-attachments/assets/23cedcdf-fe2f-49c9-b3d6-b6204f1d9af0"
/>

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!

<img width="3428" height="2154" alt="CleanShot 2026-10-06 at 21 50
49@2x"
src="https://github.com/user-attachments/assets/72b714f3-f244-4987-b1bf-ca8e41d23ec9"
/>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants