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

Fix sample banks not transferring when adjusting via editor #23564

Merged
merged 9 commits into from
May 20, 2023

Conversation

peppy
Copy link
Sponsor Member

@peppy peppy commented May 16, 2023

This brings across a fix from 88d840a, but also aims to avoid anything like this in the future by making HitSampleInfo.Bank non-nullable.

In order to allow for the legacy flow, a bool has been added (to track the case where a hit object doesn't specify a sample inline, but needs to get one from the most relevant control point at the end of the decode process).

Copy link
Collaborator

@bdach bdach left a comment

Choose a reason for hiding this comment

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

Mostly passes the initial eye test, although I haven't read/tested very thoroughly (doesn't help that I didn't read the PR that broke this)

osu.Game/Audio/HitSampleInfo.cs Outdated Show resolved Hide resolved
osu.Game/Rulesets/Objects/HitObject.cs Outdated Show resolved Hide resolved
@pull-request-size pull-request-size bot added size/L and removed size/M labels May 17, 2023
@@ -44,7 +45,7 @@ public class HitSampleInfo : ISampleInfo, IEquatable<HitSampleInfo>
/// </summary>
public int Volume { get; }

public HitSampleInfo(string name, string? bank = null, string? suffix = null, int volume = 0)
public HitSampleInfo(string name, string bank = SampleControlPoint.DEFAULT_BANK, string? suffix = null, int volume = 100)
Copy link
Contributor

Choose a reason for hiding this comment

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

Now that the volume is 100 by default you also have to make sure that the legacy decoder properly overrides hit object volumes with volume from the control points. If the volume is 100 then it will not take the volume from the control points.

Copy link
Sponsor Member Author

Choose a reason for hiding this comment

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

Where's the code for this? Sounds flaky as hell, and untested.

Copy link
Contributor

Choose a reason for hiding this comment

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

Okay turns out my concerns were misplaced. The ConvertHitObjectParser which creates the LegacyHitSampleInfo always assigns the volume of the SampleBankInfo whose volume is still 0 by default, so it works out just fine. For a moment I thought there were occurances of LegacyHitSampleInfo being created while decoding without a volume argument given.

Copy link
Collaborator

Choose a reason for hiding this comment

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

And even if that wasn't the case, ConvertHitObjectParser only constructs LegacyHitSampleInfos, and LegacyHitSampleInfo ctor still has 0 volume as a default, which makes the change of the default value in the base class largely irrelevant.

osu.Game.Rulesets.Catch.Tests/TestSceneAutoJuiceStream.cs Outdated Show resolved Hide resolved
{
return legacy.With(
newCustomSampleBank: legacy.CustomSampleBank > 0 ? legacy.CustomSampleBank : CustomSampleBank,
newVolume: hitSampleInfo.Volume > 0 ? hitSampleInfo.Volume : SampleVolume,
Copy link
Contributor

Choose a reason for hiding this comment

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

Probably good to add a VolumeSpecified property as well and use that for the sample control point override instead of checking if its greater than zero.

Copy link
Sponsor Member Author

Choose a reason for hiding this comment

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

Hmm, given what you found above I don't think this is necessary as it's a strictly legacy flow.

osu.Game/Rulesets/Edit/PlacementBlueprint.cs Outdated Show resolved Hide resolved
Copy link
Collaborator

@bdach bdach left a comment

Choose a reason for hiding this comment

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

Seems okay, but I'm heavily leaning on our test coverage here. Hopefully it's good enough.

@bdach bdach merged commit 0e11ada into ppy:master May 20, 2023
@peppy peppy deleted the fix-missing-sample-additions branch May 22, 2023 05:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants