1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-30 03:42:56 +08:00

Rename VolumeScaler to BindableVolume

This commit is contained in:
Mike Will 2025-01-13 07:20:52 -05:00
parent 6d8516aef8
commit d7d536ada1
3 changed files with 11 additions and 11 deletions

View File

@ -15,7 +15,7 @@ namespace osu.Game.Overlays.Settings.Sections.Audio
{
protected override LocalisableString Header => AudioSettingsStrings.VolumeHeader;
private readonly VolumeScaler volumeInactive = new VolumeScaler();
private readonly BindableVolume volumeInactive = new BindableVolume();
[BackgroundDependencyLoader]
private void load(AudioManager audio, OsuConfigManager config)
@ -29,34 +29,34 @@ namespace osu.Game.Overlays.Settings.Sections.Audio
{
LabelText = AudioSettingsStrings.MasterVolume,
Current = audio.Volume.Scaled,
KeyboardStep = (float)VolumeScaler.STEP,
KeyboardStep = (float)BindableVolume.STEP,
},
new VolumeAdjustSlider
{
LabelText = AudioSettingsStrings.MasterVolumeInactive,
Current = volumeInactive.Scaled,
KeyboardStep = (float)VolumeScaler.STEP,
KeyboardStep = (float)BindableVolume.STEP,
PlaySamplesOnAdjust = true,
},
new VolumeAdjustSlider
{
LabelText = AudioSettingsStrings.EffectVolume,
Current = audio.VolumeSample.Scaled,
KeyboardStep = (float)VolumeScaler.STEP,
KeyboardStep = (float)BindableVolume.STEP,
},
new VolumeAdjustSlider
{
LabelText = AudioSettingsStrings.MusicVolume,
Current = audio.VolumeTrack.Scaled,
KeyboardStep = (float)VolumeScaler.STEP,
KeyboardStep = (float)BindableVolume.STEP,
},
};
}
private partial class DecibelSliderBar : RoundedSliderBar<double>
{
public override LocalisableString TooltipText => (Current.Value <= VolumeScaler.MIN ? "-∞" : Current.Value.ToString("+#0.0;-#0.0;+0.0")) + " dB";
public override LocalisableString TooltipText => (Current.Value <= BindableVolume.MIN ? "-∞" : Current.Value.ToString("+#0.0;-#0.0;+0.0")) + " dB";
}
private partial class VolumeAdjustSlider : SettingsSlider<double>

View File

@ -78,7 +78,7 @@ namespace osu.Game.Overlays.Toolbar
base.LoadComplete();
globalVolume = audio.Volume.Scaled.GetBoundCopy();
globalVolume.BindValueChanged(v => volumeBar.ResizeHeightTo((float)(1 - (v.NewValue / VolumeScaler.MIN)), 200, Easing.OutQuint), true);
globalVolume.BindValueChanged(v => volumeBar.ResizeHeightTo((float)(1 - (v.NewValue / BindableVolume.MIN)), 200, Easing.OutQuint), true);
}
protected override bool OnKeyDown(KeyDownEvent e)

View File

@ -37,7 +37,7 @@ namespace osu.Game.Overlays.Volume
protected static readonly Vector2 LABEL_SIZE = new Vector2(120, 20);
public BindableDouble Bindable { get; } = new BindableDouble { MinValue = VolumeScaler.MIN, MaxValue = 0, Precision = adjust_step };
public BindableDouble Bindable { get; } = new BindableDouble { MinValue = BindableVolume.MIN, MaxValue = 0, Precision = adjust_step };
protected readonly float CircleSize;
@ -252,7 +252,7 @@ namespace osu.Game.Overlays.Volume
get => displayVolume;
set
{
percentage = 1 - (value / VolumeScaler.MIN);
percentage = 1 - (value / BindableVolume.MIN);
int step = (int)Math.Round(value / adjust_step);
bool stepChanged = step != currentStep;
@ -304,9 +304,9 @@ namespace osu.Game.Overlays.Volume
private set => Bindable.Value = value;
}
private const double adjust_step = VolumeScaler.STEP;
private const double adjust_step = BindableVolume.STEP;
private const int step_min = (int)(VolumeScaler.MIN / VolumeScaler.STEP);
private const int step_min = (int)(BindableVolume.MIN / BindableVolume.STEP);
private const int step_max = 0;
public void Increase(double amount = 1, bool isPrecise = false) => adjust(amount, isPrecise);