2018-01-05 11:21:19 +00:00
|
|
|
|
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
|
2017-04-06 02:41:16 +00:00
|
|
|
|
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
|
|
|
|
|
2017-12-06 18:40:43 +00:00
|
|
|
|
using System;
|
2017-12-07 22:09:51 +00:00
|
|
|
|
using osu.Framework.Audio.Sample;
|
|
|
|
|
|
2017-04-06 02:41:16 +00:00
|
|
|
|
namespace osu.Game.Audio
|
|
|
|
|
{
|
2017-12-06 18:40:43 +00:00
|
|
|
|
[Serializable]
|
2017-04-06 02:41:16 +00:00
|
|
|
|
public class SampleInfo
|
|
|
|
|
{
|
2017-04-06 03:14:06 +00: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 10:55:56 +00:00
|
|
|
|
public SampleChannel GetChannel(SampleManager manager, string resourceNamespace = null)
|
2017-12-07 22:09:51 +00:00
|
|
|
|
{
|
2017-12-27 12:44:04 +00:00
|
|
|
|
SampleChannel channel = null;
|
|
|
|
|
|
|
|
|
|
if (resourceNamespace != null)
|
2017-12-27 16:00:01 +00:00
|
|
|
|
channel = manager.Get($"Gameplay/{resourceNamespace}/{Bank}-{Name}");
|
2017-12-27 12:44:04 +00:00
|
|
|
|
|
|
|
|
|
// try without namespace as a fallback.
|
|
|
|
|
if (channel == null)
|
2017-12-27 16:00:01 +00:00
|
|
|
|
channel = manager.Get($"Gameplay/{Bank}-{Name}");
|
2017-12-27 12:44:04 +00:00
|
|
|
|
|
|
|
|
|
if (channel != null)
|
|
|
|
|
channel.Volume.Value = Volume / 100.0;
|
|
|
|
|
|
2017-12-07 22:09:51 +00:00
|
|
|
|
return channel;
|
|
|
|
|
}
|
|
|
|
|
|
2017-04-06 02:41:16 +00: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;
|
|
|
|
|
}
|
|
|
|
|
}
|