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

Change non-legacy control points to have CustomSampleBank 1 #29311

Open
wants to merge 6 commits into
base: master
Choose a base branch
from

Conversation

kstefanowicz
Copy link
Contributor

Passes test osu.Game.Tests.Beatmaps.Formats.LegacyBeatmapEncoderTest, which previous implementation #29084 failed (thanks @smoogipoo!)

See also #29280 regarding long-term implementation of custom samplesets - this PR implements the third option proposed.

@smoogipoo smoogipoo added the area:beatmap-parsing .osu file format parsing label Aug 7, 2024
@smoogipoo
Copy link
Contributor

Maybe @OliBomby or @peppy can provide feedback on whether this is the direction we want to go? From my reading of it this means any lazer-added sample bank will be CSS1 i.e. it will be overridden by whatever hitsample file exists in the beatmap.

@OliBomby
Copy link
Contributor

I do agree with the direction of allowing sample banks to be overriden this way. There is no need for custum sample set indices because you can use custom bank names instead (though these cant be saved yet).

However this implementation seems to still be somewhat broken. When I add a custom sample, I still need to cut and repaste the objects for the custom sound to play, and when I reload the editor or go in play the sounds are gone again.

@kstefanowicz
Copy link
Contributor Author

However this implementation seems to still be somewhat broken. When I add a custom sample, I still need to cut and repaste the objects for the custom sound to play, and when I reload the editor or go in play the sounds are gone again.

Are you testing on an existing beatmap? This change only affects creating new timing points, it will not change existing ones that are already saved as 0.

@OliBomby
Copy link
Contributor

Are you testing on an existing beatmap? This change only affects creating new timing points, it will not change existing ones that are already saved as 0.

I'm testing on a completely new beatmap. It's still very much broken.

osu._7SeQSSoGva.mp4
osu._FnCFBIoZsd.mp4

@kstefanowicz
Copy link
Contributor Author

I have changed this logic in getLegacyControlPointProperties to create LegacyHitSampleInfo with customSampleBank 1 if the sample point isn't already legacy. Still passes LegacyBeatmapEncoderTest.

This appears to work at first, but after placing a hit object the timing point reverts back to 0:

pr-29311-1.webm

Looking at debug, after the encoder is called as part of EditorChangeHandler, samplePoint is being passed with CustomSampleBank -1:
image

I was not able to determine why this is - I will continue investigating

@kstefanowicz
Copy link
Contributor Author

kstefanowicz commented Aug 19, 2024

Found it - the encoder goes through each HItObject to add a SampleControlPoint to it, which was defaulting to CustomSampleBank -1:

SampleControlPoint createSampleControlPointFor(double time, IList<HitSampleInfo> samples)
{
    int volume = samples.Max(o => o.Volume);
    int customIndex = samples.Any(o => o is ConvertHitObjectParser.LegacyHitSampleInfo)
        ? samples.OfType<ConvertHitObjectParser.LegacyHitSampleInfo>().Max(o => o.CustomSampleBank)
        : -1;

    return new LegacyBeatmapDecoder.LegacySampleControlPoint { Time = time, SampleVolume = volume, CustomSampleBank = customIndex };
}

After changing that fallback to 1, custom hit sounds appear to be persisting:

pr-29311-2.webm

@bdach
Copy link
Collaborator

bdach commented Sep 2, 2024

Before further review happens here I will link back #29280 here, and particularly #29280 (comment) which seems to indicate that this implementation is much more opinionated about what should happen than it probably should be.

Would be good to set some expectations in stone first before we go in any direction what is this. I'm not sure I have a valid opinion to give on that, though.

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 size/S
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Custom hitsounds do not persist using "Edit externally"
4 participants