2018-01-05 19:21:19 +08:00
|
|
|
|
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
|
2017-04-06 10:41:16 +08:00
|
|
|
|
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
|
|
|
|
|
2017-12-07 02:40:43 +08:00
|
|
|
|
using System;
|
2017-12-08 06:09:51 +08:00
|
|
|
|
using osu.Framework.Audio.Sample;
|
|
|
|
|
|
2017-04-06 10:41:16 +08:00
|
|
|
|
namespace osu.Game.Audio
|
|
|
|
|
{
|
2017-12-07 02:40:43 +08:00
|
|
|
|
[Serializable]
|
2017-04-06 10:41:16 +08:00
|
|
|
|
public class SampleInfo
|
|
|
|
|
{
|
2017-04-06 11:14:06 +08:00
|
|
|
|
public const string HIT_WHISTLE = @"hitwhistle";
|
|
|
|
|
public const string HIT_FINISH = @"hitfinish";
|
|
|
|
|
public const string HIT_NORMAL = @"hitnormal";
|
|
|
|
|
public const string HIT_CLAP = @"hitclap";
|
|
|
|
|
|
2017-12-26 18:55:56 +08:00
|
|
|
|
public SampleChannel GetChannel(SampleManager manager, string resourceNamespace = null)
|
2017-12-08 06:09:51 +08:00
|
|
|
|
{
|
2017-12-27 20:44:04 +08:00
|
|
|
|
SampleChannel channel = null;
|
|
|
|
|
|
|
|
|
|
if (resourceNamespace != null)
|
2017-12-28 00:00:01 +08:00
|
|
|
|
channel = manager.Get($"Gameplay/{resourceNamespace}/{Bank}-{Name}");
|
2017-12-27 20:44:04 +08:00
|
|
|
|
|
|
|
|
|
// try without namespace as a fallback.
|
|
|
|
|
if (channel == null)
|
2017-12-28 00:00:01 +08:00
|
|
|
|
channel = manager.Get($"Gameplay/{Bank}-{Name}");
|
2017-12-27 20:44:04 +08:00
|
|
|
|
|
|
|
|
|
if (channel != null)
|
|
|
|
|
channel.Volume.Value = Volume / 100.0;
|
|
|
|
|
|
2017-12-08 06:09:51 +08:00
|
|
|
|
return channel;
|
|
|
|
|
}
|
|
|
|
|
|
2017-04-06 10:41:16 +08:00
|
|
|
|
/// <summary>
|
|
|
|
|
/// The bank to load the sample from.
|
|
|
|
|
/// </summary>
|
|
|
|
|
public string Bank;
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// The name of the sample to load.
|
|
|
|
|
/// </summary>
|
|
|
|
|
public string Name;
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// The sample volume.
|
|
|
|
|
/// </summary>
|
|
|
|
|
public int Volume;
|
|
|
|
|
}
|
|
|
|
|
}
|