Fix sample silence being one level too low

4a7b011a53 inadvertently unearthed that
nested strong hits could play samples of their own accord, rather than
delegating to `DrumSampleTriggerSource` as they were supposed to. This
was an unfortunate omission due to how the inheritance structure of
`TaikoHitObject` looks like (some irrelevant classes omitted for
brevity):

	DrawableTaikoHitObject
		DrawableTaikoHitObject<TObject> <-- `GetSamples()` was overridden to empty here
			DrawableTaikoStrongableHitObject
				DrawableHit
				DrawableDrumRoll
				DrawableDrumRollTick
			DrawableSwell
			DrawableSwellTick
		DrawableStrongNestedHit <-- all strong nested hits are here => didn't receive `GetSamples()` override
			DrawableHit.StrongNestedHit
			DrawableDrumRoll.StrongNestedHit
			DrawableDrumRollTick.StrongNestedHit

To fix, move the `GetSamples()` override one level higher, to the
non-generic `DrawableTaikoHitObject`, to suppress the spurious sample
playbacks.

The stale reference in the comment was also updated to match current
code.
This commit is contained in:
Bartłomiej Dach 2023-05-21 18:31:26 +02:00
parent 4a7b011a53
commit 9915fac2c8
No known key found for this signature in database

View File

@ -118,6 +118,9 @@ namespace osu.Game.Rulesets.Taiko.Objects.Drawables
{
public override bool RemoveWhenNotAlive => false;
}
// Most osu!taiko hitsounds are managed by the drum (see DrumSampleTriggerSource).
public override IEnumerable<HitSampleInfo> GetSamples() => Enumerable.Empty<HitSampleInfo>();
}
public abstract partial class DrawableTaikoHitObject<TObject> : DrawableTaikoHitObject
@ -157,9 +160,6 @@ namespace osu.Game.Rulesets.Taiko.Objects.Drawables
Content.Add(MainPiece = CreateMainPiece());
}
// Most osu!taiko hitsounds are managed by the drum (see DrumSampleMapping).
public override IEnumerable<HitSampleInfo> GetSamples() => Enumerable.Empty<HitSampleInfo>();
protected abstract SkinnableDrawable CreateMainPiece();
}
}