mirror of
https://github.com/ppy/osu.git
synced 2025-03-05 12:23:21 +08:00
Added basic SampleInfo.FromSoundPoint and GetChannel methods
This commit is contained in:
parent
43c270ea49
commit
d2f3d5a807
@ -1,6 +1,11 @@
|
|||||||
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
|
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
|
||||||
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||||
|
|
||||||
|
using osu.Framework.Audio;
|
||||||
|
using osu.Framework.Audio.Sample;
|
||||||
|
using osu.Framework.Configuration;
|
||||||
|
using osu.Game.Beatmaps.ControlPoints;
|
||||||
|
|
||||||
namespace osu.Game.Audio
|
namespace osu.Game.Audio
|
||||||
{
|
{
|
||||||
public class SampleInfo
|
public class SampleInfo
|
||||||
@ -10,6 +15,24 @@ namespace osu.Game.Audio
|
|||||||
public const string HIT_NORMAL = @"hitnormal";
|
public const string HIT_NORMAL = @"hitnormal";
|
||||||
public const string HIT_CLAP = @"hitclap";
|
public const string HIT_CLAP = @"hitclap";
|
||||||
|
|
||||||
|
public static SampleInfo FromSoundPoint(SoundControlPoint soundPoint, string sampleName = SampleInfo.HIT_NORMAL)
|
||||||
|
{
|
||||||
|
return new SampleInfo()
|
||||||
|
{
|
||||||
|
Bank = soundPoint.SampleBank,
|
||||||
|
Name = sampleName,
|
||||||
|
Volume = soundPoint.SampleVolume,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
public SampleChannel GetChannel(SampleManager manager)
|
||||||
|
{
|
||||||
|
var channel = manager.Get($"{Bank}-{Name}");
|
||||||
|
|
||||||
|
channel.AddAdjustment(AdjustableProperty.Volume, new BindableDouble(Volume / 100.0));
|
||||||
|
return channel;
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The bank to load the sample from.
|
/// The bank to load the sample from.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
Loading…
Reference in New Issue
Block a user