1
0
mirror of https://github.com/ppy/osu.git synced 2026-05-20 06:39:54 +08:00

Add better sample fallback logic

Also adds support for null channels at InputDrum level.
This commit is contained in:
Dean Herbert
2017-12-27 21:44:04 +09:00
Unverified
parent 46ef17354e
commit 3f73a9a693
2 changed files with 14 additions and 4 deletions
+2 -2
View File
@@ -152,14 +152,14 @@ namespace osu.Game.Rulesets.Taiko.UI
target = centreHit;
back = centre;
drumSample.Centre.Play();
drumSample.Centre?.Play();
}
else if (action == RimAction)
{
target = rimHit;
back = rim;
drumSample.Rim.Play();
drumSample.Rim?.Play();
}
if (target != null)
+12 -2
View File
@@ -17,8 +17,18 @@ namespace osu.Game.Audio
public SampleChannel GetChannel(SampleManager manager, string resourceNamespace = null)
{
SampleChannel channel = manager.Get(Path.Combine("Gameplay", resourceNamespace ?? string.Empty, $"{Bank}-{Name}"));
channel.Volume.Value = Volume / 100.0;
SampleChannel channel = null;
if (resourceNamespace != null)
channel = manager.Get(Path.Combine("Gameplay", resourceNamespace, $"{Bank}-{Name}"));
// try without namespace as a fallback.
if (channel == null)
channel = manager.Get(Path.Combine("Gameplay", $"{Bank}-{Name}"));
if (channel != null)
channel.Volume.Value = Volume / 100.0;
return channel;
}