1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-18 14:43:22 +08:00

Use volume scaling

This commit is contained in:
Mike Will 2024-12-20 12:56:14 -05:00
parent dfbc93c3dc
commit 1d8ca0f93d
5 changed files with 15 additions and 10 deletions

View File

@ -98,7 +98,7 @@ namespace osu.Game.Configuration
SetDefault(OsuSetting.NotifyOnPrivateMessage, true);
// Audio
SetDefault(OsuSetting.VolumeInactive, 0.25, 0, 1, 0.01);
SetDefault(OsuSetting.VolumeInactive, 0.25, 0, 1);
SetDefault(OsuSetting.MenuVoice, true);
SetDefault(OsuSetting.MenuMusic, true);

View File

@ -81,7 +81,7 @@ namespace osu.Game.Overlays
{
AddInternal(audioDuckFilter = new AudioFilter(audio.TrackMixer));
audio.Tracks.AddAdjustment(AdjustableProperty.Volume, audioDuckVolume);
sampleVolume = audio.VolumeSample.GetBoundCopy();
sampleVolume = audio.VolumeSample.Scaled.GetBoundCopy();
configManager.BindWith(OsuSetting.RandomSelectAlgorithm, randomSelectAlgorithm);
}

View File

@ -15,29 +15,34 @@ namespace osu.Game.Overlays.Settings.Sections.Audio
{
protected override LocalisableString Header => AudioSettingsStrings.VolumeHeader;
private readonly VolumeScaler volumeInactive = new VolumeScaler();
[BackgroundDependencyLoader]
private void load(AudioManager audio, OsuConfigManager config)
{
config.BindWith(OsuSetting.VolumeInactive, volumeInactive.Real);
volumeInactive.Scale();
Children = new Drawable[]
{
new VolumeAdjustSlider
{
LabelText = AudioSettingsStrings.MasterVolume,
Current = audio.Volume,
Current = audio.Volume.Scaled,
KeyboardStep = 0.01f,
DisplayAsPercentage = true
},
new SettingsSlider<double>
{
LabelText = AudioSettingsStrings.MasterVolumeInactive,
Current = config.GetBindable<double>(OsuSetting.VolumeInactive),
Current = volumeInactive.Scaled,
KeyboardStep = 0.01f,
DisplayAsPercentage = true
},
new VolumeAdjustSlider
{
LabelText = AudioSettingsStrings.EffectVolume,
Current = audio.VolumeSample,
Current = audio.VolumeSample.Scaled,
KeyboardStep = 0.01f,
DisplayAsPercentage = true
},
@ -45,7 +50,7 @@ namespace osu.Game.Overlays.Settings.Sections.Audio
new VolumeAdjustSlider
{
LabelText = AudioSettingsStrings.MusicVolume,
Current = audio.VolumeTrack,
Current = audio.VolumeTrack.Scaled,
KeyboardStep = 0.01f,
DisplayAsPercentage = true
},

View File

@ -77,7 +77,7 @@ namespace osu.Game.Overlays.Toolbar
{
base.LoadComplete();
globalVolume = audio.Volume.GetBoundCopy();
globalVolume = audio.Volume.Scaled.GetBoundCopy();
globalVolume.BindValueChanged(v => volumeBar.ResizeHeightTo((float)v.NewValue, 200, Easing.OutQuint), true);
}

View File

@ -76,9 +76,9 @@ namespace osu.Game.Overlays
},
});
volumeMeterMaster.Bindable.BindTo(audio.Volume);
volumeMeterEffect.Bindable.BindTo(audio.VolumeSample);
volumeMeterMusic.Bindable.BindTo(audio.VolumeTrack);
volumeMeterMaster.Bindable.BindTo(audio.Volume.Scaled);
volumeMeterEffect.Bindable.BindTo(audio.VolumeSample.Scaled);
volumeMeterMusic.Bindable.BindTo(audio.VolumeTrack.Scaled);
}
protected override void LoadComplete()