2019-06-30 20:58:30 +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.
|
|
|
|
|
|
|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
|
|
|
|
|
namespace osu.Game.Audio
|
|
|
|
|
{
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Describes a gameplay hit sample.
|
|
|
|
|
/// </summary>
|
|
|
|
|
[Serializable]
|
|
|
|
|
public class HitSampleInfo : ISampleInfo
|
|
|
|
|
{
|
|
|
|
|
public const string HIT_WHISTLE = @"hitwhistle";
|
|
|
|
|
public const string HIT_FINISH = @"hitfinish";
|
|
|
|
|
public const string HIT_NORMAL = @"hitnormal";
|
|
|
|
|
public const string HIT_CLAP = @"hitclap";
|
|
|
|
|
|
2020-09-25 16:30:31 +08:00
|
|
|
|
/// <summary>
|
|
|
|
|
/// All valid sample addition constants.
|
|
|
|
|
/// </summary>
|
|
|
|
|
public static IEnumerable<string> AllAdditions => new[] { HIT_WHISTLE, HIT_CLAP, HIT_FINISH };
|
|
|
|
|
|
2019-06-30 20:58:30 +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>
|
|
|
|
|
/// An optional suffix to provide priority lookup. Falls back to non-suffixed <see cref="Name"/>.
|
|
|
|
|
/// </summary>
|
|
|
|
|
public string Suffix;
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// The sample volume.
|
|
|
|
|
/// </summary>
|
|
|
|
|
public int Volume { get; set; }
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Retrieve all possible filenames that can be used as a source, returned in order of preference (highest first).
|
|
|
|
|
/// </summary>
|
|
|
|
|
public virtual IEnumerable<string> LookupNames
|
|
|
|
|
{
|
|
|
|
|
get
|
|
|
|
|
{
|
|
|
|
|
if (!string.IsNullOrEmpty(Suffix))
|
2020-10-29 15:32:20 +08:00
|
|
|
|
yield return $"Gameplay/{Bank}-{Name}{Suffix}";
|
2019-06-30 20:58:30 +08:00
|
|
|
|
|
2020-10-29 15:32:20 +08:00
|
|
|
|
yield return $"Gameplay/{Bank}-{Name}";
|
2019-06-30 20:58:30 +08:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public HitSampleInfo Clone() => (HitSampleInfo)MemberwiseClone();
|
|
|
|
|
}
|
|
|
|
|
}
|