-
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
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
Conversation
There was a problem hiding this 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)
@@ -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) |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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 LegacyHitSampleInfo
s, and LegacyHitSampleInfo
ctor still has 0 volume as a default, which makes the change of the default value in the base class largely irrelevant.
{ | ||
return legacy.With( | ||
newCustomSampleBank: legacy.CustomSampleBank > 0 ? legacy.CustomSampleBank : CustomSampleBank, | ||
newVolume: hitSampleInfo.Volume > 0 ? hitSampleInfo.Volume : SampleVolume, |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
There was a problem hiding this 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.
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).