mirror of
https://github.com/ppy/osu.git
synced 2025-01-18 14:03:07 +08:00
Use volume scaling
This commit is contained in:
parent
dfbc93c3dc
commit
1d8ca0f93d
@ -98,7 +98,7 @@ namespace osu.Game.Configuration
|
|||||||
SetDefault(OsuSetting.NotifyOnPrivateMessage, true);
|
SetDefault(OsuSetting.NotifyOnPrivateMessage, true);
|
||||||
|
|
||||||
// Audio
|
// Audio
|
||||||
SetDefault(OsuSetting.VolumeInactive, 0.25, 0, 1, 0.01);
|
SetDefault(OsuSetting.VolumeInactive, 0.25, 0, 1);
|
||||||
|
|
||||||
SetDefault(OsuSetting.MenuVoice, true);
|
SetDefault(OsuSetting.MenuVoice, true);
|
||||||
SetDefault(OsuSetting.MenuMusic, true);
|
SetDefault(OsuSetting.MenuMusic, true);
|
||||||
|
@ -81,7 +81,7 @@ namespace osu.Game.Overlays
|
|||||||
{
|
{
|
||||||
AddInternal(audioDuckFilter = new AudioFilter(audio.TrackMixer));
|
AddInternal(audioDuckFilter = new AudioFilter(audio.TrackMixer));
|
||||||
audio.Tracks.AddAdjustment(AdjustableProperty.Volume, audioDuckVolume);
|
audio.Tracks.AddAdjustment(AdjustableProperty.Volume, audioDuckVolume);
|
||||||
sampleVolume = audio.VolumeSample.GetBoundCopy();
|
sampleVolume = audio.VolumeSample.Scaled.GetBoundCopy();
|
||||||
|
|
||||||
configManager.BindWith(OsuSetting.RandomSelectAlgorithm, randomSelectAlgorithm);
|
configManager.BindWith(OsuSetting.RandomSelectAlgorithm, randomSelectAlgorithm);
|
||||||
}
|
}
|
||||||
|
@ -15,29 +15,34 @@ namespace osu.Game.Overlays.Settings.Sections.Audio
|
|||||||
{
|
{
|
||||||
protected override LocalisableString Header => AudioSettingsStrings.VolumeHeader;
|
protected override LocalisableString Header => AudioSettingsStrings.VolumeHeader;
|
||||||
|
|
||||||
|
private readonly VolumeScaler volumeInactive = new VolumeScaler();
|
||||||
|
|
||||||
[BackgroundDependencyLoader]
|
[BackgroundDependencyLoader]
|
||||||
private void load(AudioManager audio, OsuConfigManager config)
|
private void load(AudioManager audio, OsuConfigManager config)
|
||||||
{
|
{
|
||||||
|
config.BindWith(OsuSetting.VolumeInactive, volumeInactive.Real);
|
||||||
|
volumeInactive.Scale();
|
||||||
|
|
||||||
Children = new Drawable[]
|
Children = new Drawable[]
|
||||||
{
|
{
|
||||||
new VolumeAdjustSlider
|
new VolumeAdjustSlider
|
||||||
{
|
{
|
||||||
LabelText = AudioSettingsStrings.MasterVolume,
|
LabelText = AudioSettingsStrings.MasterVolume,
|
||||||
Current = audio.Volume,
|
Current = audio.Volume.Scaled,
|
||||||
KeyboardStep = 0.01f,
|
KeyboardStep = 0.01f,
|
||||||
DisplayAsPercentage = true
|
DisplayAsPercentage = true
|
||||||
},
|
},
|
||||||
new SettingsSlider<double>
|
new SettingsSlider<double>
|
||||||
{
|
{
|
||||||
LabelText = AudioSettingsStrings.MasterVolumeInactive,
|
LabelText = AudioSettingsStrings.MasterVolumeInactive,
|
||||||
Current = config.GetBindable<double>(OsuSetting.VolumeInactive),
|
Current = volumeInactive.Scaled,
|
||||||
KeyboardStep = 0.01f,
|
KeyboardStep = 0.01f,
|
||||||
DisplayAsPercentage = true
|
DisplayAsPercentage = true
|
||||||
},
|
},
|
||||||
new VolumeAdjustSlider
|
new VolumeAdjustSlider
|
||||||
{
|
{
|
||||||
LabelText = AudioSettingsStrings.EffectVolume,
|
LabelText = AudioSettingsStrings.EffectVolume,
|
||||||
Current = audio.VolumeSample,
|
Current = audio.VolumeSample.Scaled,
|
||||||
KeyboardStep = 0.01f,
|
KeyboardStep = 0.01f,
|
||||||
DisplayAsPercentage = true
|
DisplayAsPercentage = true
|
||||||
},
|
},
|
||||||
@ -45,7 +50,7 @@ namespace osu.Game.Overlays.Settings.Sections.Audio
|
|||||||
new VolumeAdjustSlider
|
new VolumeAdjustSlider
|
||||||
{
|
{
|
||||||
LabelText = AudioSettingsStrings.MusicVolume,
|
LabelText = AudioSettingsStrings.MusicVolume,
|
||||||
Current = audio.VolumeTrack,
|
Current = audio.VolumeTrack.Scaled,
|
||||||
KeyboardStep = 0.01f,
|
KeyboardStep = 0.01f,
|
||||||
DisplayAsPercentage = true
|
DisplayAsPercentage = true
|
||||||
},
|
},
|
||||||
|
@ -77,7 +77,7 @@ namespace osu.Game.Overlays.Toolbar
|
|||||||
{
|
{
|
||||||
base.LoadComplete();
|
base.LoadComplete();
|
||||||
|
|
||||||
globalVolume = audio.Volume.GetBoundCopy();
|
globalVolume = audio.Volume.Scaled.GetBoundCopy();
|
||||||
globalVolume.BindValueChanged(v => volumeBar.ResizeHeightTo((float)v.NewValue, 200, Easing.OutQuint), true);
|
globalVolume.BindValueChanged(v => volumeBar.ResizeHeightTo((float)v.NewValue, 200, Easing.OutQuint), true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -76,9 +76,9 @@ namespace osu.Game.Overlays
|
|||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
volumeMeterMaster.Bindable.BindTo(audio.Volume);
|
volumeMeterMaster.Bindable.BindTo(audio.Volume.Scaled);
|
||||||
volumeMeterEffect.Bindable.BindTo(audio.VolumeSample);
|
volumeMeterEffect.Bindable.BindTo(audio.VolumeSample.Scaled);
|
||||||
volumeMeterMusic.Bindable.BindTo(audio.VolumeTrack);
|
volumeMeterMusic.Bindable.BindTo(audio.VolumeTrack.Scaled);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void LoadComplete()
|
protected override void LoadComplete()
|
||||||
|
Loading…
Reference in New Issue
Block a user