// Copyright (c) 2007-2018 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using System; using System.Collections.Generic; 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"; /// /// An optional ruleset namespace. /// public string Namespace; /// /// The bank to load the sample from. /// public string Bank; /// /// The name of the sample to load. /// public string Name; /// /// An optional suffix to provide priority lookup. Falls back to non-suffixed . /// public string Suffix; /// /// The sample volume. /// public int Volume; /// /// Retrieve all possible filenames that can be used as a source, returned in order of preference (highest first). /// public virtual IEnumerable LookupNames { get { if (!string.IsNullOrEmpty(Namespace)) { if (!string.IsNullOrEmpty(Suffix)) yield return $"{Namespace}/{Bank}-{Name}{Suffix}"; yield return $"{Namespace}/{Bank}-{Name}"; } // check non-namespace as a fallback even when we have a namespace if (!string.IsNullOrEmpty(Suffix)) yield return $"{Bank}-{Name}{Suffix}"; yield return $"{Bank}-{Name}"; } } public SampleInfo Clone() => (SampleInfo)MemberwiseClone(); } }