Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Custom sound banks don't save to beatmap #29312

Open
kstefanowicz opened this issue Aug 6, 2024 · 0 comments · May be fixed by #29566
Open

Custom sound banks don't save to beatmap #29312

kstefanowicz opened this issue Aug 6, 2024 · 0 comments · May be fixed by #29566
Labels
area:beatmap-parsing .osu file format parsing area:editor priority:1 Very important. Feels bad without fix. Affects the majority of users.

Comments

@kstefanowicz
Copy link
Contributor

kstefanowicz commented Aug 6, 2024

Type

Game behaviour

Bug description

When using a custom soundbank (i.e. not "normal", "soft", or "drum"), the custom hitsound plays in Editor preview, but not in Test. After exiting and re-entering the editor, the HitObjects revert their soundbank back to Normal.

When the map is saved, LegacyBeatmapEncoder handles the hit object by writing the normalBank and addBank to the .osu file through getSampleBank()

private string getSampleBank(IList<HitSampleInfo> samples, bool banksOnly = false)
{
    LegacySampleBank normalBank = toLegacySampleBank(samples.SingleOrDefault(s => s.Name == HitSampleInfo.HIT_NORMAL)?.Bank);
    LegacySampleBank addBank = toLegacySampleBank(samples.FirstOrDefault(s => !string.IsNullOrEmpty(s.Name) && s.Name != HitSampleInfo.HIT_NORMAL)?.Bank);

    StringBuilder sb = new StringBuilder();

    sb.Append(FormattableString.Invariant($"{(int)normalBank}:"));
    sb.Append(FormattableString.Invariant($"{(int)addBank}"));

If the sample bank doesn't match "normal", "soft", or "drum", toLegacySampleBank() falls back to 0:

private LegacySampleBank toLegacySampleBank(string? sampleBank)
{
    switch (sampleBank?.ToLowerInvariant())
    {
        case HitSampleInfo.BANK_NORMAL:
            return LegacySampleBank.Normal;

        case HitSampleInfo.BANK_SOFT:
            return LegacySampleBank.Soft;

        case HitSampleInfo.BANK_DRUM:
            return LegacySampleBank.Drum;

        default:
            return LegacySampleBank.None;
    }
}

For a custom sample bank to save to the .osu file, presumably it'd need to save as something other than 0/1/2/3. I don't know if Stable has a fallback for that?

Screenshots or videos

custom-samplebanks-dont-save.webm

Version

2024.731.0-lazer

Logs

compressed-logs.zip

@smoogipoo smoogipoo added the area:beatmap-parsing .osu file format parsing label Aug 7, 2024
@kstefanowicz kstefanowicz linked a pull request Aug 22, 2024 that will close this issue
@peppy peppy added priority:1 Very important. Feels bad without fix. Affects the majority of users. area:editor labels Sep 30, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area:beatmap-parsing .osu file format parsing area:editor priority:1 Very important. Feels bad without fix. Affects the majority of users.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants