2019-01-24 16:43:03 +08:00
|
|
|
|
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
|
|
|
|
// See the LICENCE file in the repository root for full licence text.
|
2018-04-13 17:19:50 +08:00
|
|
|
|
|
|
|
|
|
using System;
|
2018-07-02 13:18:41 +08:00
|
|
|
|
using System.Collections.Generic;
|
2018-04-13 17:19:50 +08:00
|
|
|
|
|
|
|
|
|
namespace osu.Game.Audio
|
|
|
|
|
{
|
|
|
|
|
[Serializable]
|
|
|
|
|
public class SampleInfo
|
|
|
|
|
{
|
|
|
|
|
public const string HIT_WHISTLE = @"hitwhistle";
|
|
|
|
|
public const string HIT_FINISH = @"hitfinish";
|
|
|
|
|
public const string HIT_NORMAL = @"hitnormal";
|
|
|
|
|
public const string HIT_CLAP = @"hitclap";
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// An optional ruleset namespace.
|
|
|
|
|
/// </summary>
|
|
|
|
|
public string Namespace;
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// The bank to load the sample from.
|
|
|
|
|
/// </summary>
|
|
|
|
|
public string Bank;
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// The name of the sample to load.
|
|
|
|
|
/// </summary>
|
|
|
|
|
public string Name;
|
|
|
|
|
|
2018-07-10 01:56:00 +08:00
|
|
|
|
/// <summary>
|
|
|
|
|
/// An optional suffix to provide priority lookup. Falls back to non-suffixed <see cref="Name"/>.
|
|
|
|
|
/// </summary>
|
|
|
|
|
public string Suffix;
|
|
|
|
|
|
2018-04-13 17:19:50 +08:00
|
|
|
|
/// <summary>
|
|
|
|
|
/// The sample volume.
|
|
|
|
|
/// </summary>
|
|
|
|
|
public int Volume;
|
2018-07-02 13:17:19 +08:00
|
|
|
|
|
2018-07-05 19:16:55 +08:00
|
|
|
|
/// <summary>
|
|
|
|
|
/// Retrieve all possible filenames that can be used as a source, returned in order of preference (highest first).
|
|
|
|
|
/// </summary>
|
2018-07-02 13:35:03 +08:00
|
|
|
|
public virtual IEnumerable<string> LookupNames
|
2018-07-02 13:18:41 +08:00
|
|
|
|
{
|
2018-07-02 13:35:03 +08:00
|
|
|
|
get
|
|
|
|
|
{
|
2018-07-10 14:23:47 +08:00
|
|
|
|
if (!string.IsNullOrEmpty(Namespace))
|
2018-07-10 01:56:00 +08:00
|
|
|
|
{
|
2018-07-10 14:23:47 +08:00
|
|
|
|
if (!string.IsNullOrEmpty(Suffix))
|
2018-07-10 01:56:00 +08:00
|
|
|
|
yield return $"{Namespace}/{Bank}-{Name}{Suffix}";
|
2019-02-28 12:31:40 +08:00
|
|
|
|
|
2018-07-10 14:23:47 +08:00
|
|
|
|
yield return $"{Namespace}/{Bank}-{Name}";
|
2018-07-10 01:56:00 +08:00
|
|
|
|
}
|
|
|
|
|
|
2018-07-10 14:23:47 +08:00
|
|
|
|
// check non-namespace as a fallback even when we have a namespace
|
|
|
|
|
if (!string.IsNullOrEmpty(Suffix))
|
|
|
|
|
yield return $"{Bank}-{Name}{Suffix}";
|
2019-02-28 12:31:40 +08:00
|
|
|
|
|
2018-07-10 14:23:47 +08:00
|
|
|
|
yield return $"{Bank}-{Name}";
|
2018-07-02 13:35:03 +08:00
|
|
|
|
}
|
|
|
|
|
}
|
2018-07-02 13:18:41 +08:00
|
|
|
|
|
2018-07-02 13:17:19 +08:00
|
|
|
|
public SampleInfo Clone() => (SampleInfo)MemberwiseClone();
|
2018-04-13 17:19:50 +08:00
|
|
|
|
}
|
|
|
|
|
}
|