1
0
mirror of https://github.com/ppy/osu.git synced 2025-03-10 18:57:20 +08:00

Merge pull request #32098 from bdach/dont-drop-green-line-sample-bank

Attempt to preserve sample control point bank when encoding beatmap
This commit is contained in:
Dean Herbert 2025-03-04 18:32:16 +09:00 committed by GitHub
commit d9162daac2
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -319,11 +319,13 @@ namespace osu.Game.Beatmaps.Formats
SampleControlPoint createSampleControlPointFor(double time, IList<HitSampleInfo> samples)
{
int volume = samples.Max(o => o.Volume);
string bank = samples.Where(s => s.Name == HitSampleInfo.HIT_NORMAL).Select(s => s.Bank).FirstOrDefault()
?? samples.Select(s => s.Bank).First();
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 };
return new LegacyBeatmapDecoder.LegacySampleControlPoint { Time = time, SampleVolume = volume, SampleBank = bank, CustomSampleBank = customIndex };
}
}