mirror of
https://github.com/SK-la/osu-framework.git
synced 2026-03-15 03:20:30 +00:00
Fix mixer visualiser stealing audio output from global mixer
This commit is contained in:
@@ -4,7 +4,9 @@
|
||||
using System;
|
||||
using ManagedBass;
|
||||
using ManagedBass.Mix;
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Audio;
|
||||
using osu.Framework.Bindables;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
using osu.Framework.Graphics.Shapes;
|
||||
using osu.Framework.Graphics.Sprites;
|
||||
@@ -28,6 +30,7 @@ namespace osu.Framework.Graphics.Visualisation.Audio
|
||||
private float maxPeak = float.MinValue;
|
||||
private double lastMaxPeakTime;
|
||||
private readonly bool isOutputChannel;
|
||||
private IBindable<bool> usingGlobalMixer = null!;
|
||||
|
||||
public AudioChannelDisplay(int channelHandle, bool isOutputChannel = false)
|
||||
{
|
||||
@@ -100,13 +103,19 @@ namespace osu.Framework.Graphics.Visualisation.Audio
|
||||
};
|
||||
}
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(AudioManager audioManager)
|
||||
{
|
||||
usingGlobalMixer = audioManager.UsingGlobalMixer.GetBoundCopy();
|
||||
}
|
||||
|
||||
protected override void Update()
|
||||
{
|
||||
base.Update();
|
||||
|
||||
float[] levels = new float[2];
|
||||
|
||||
if (isOutputChannel)
|
||||
if (isOutputChannel && !usingGlobalMixer.Value)
|
||||
Bass.ChannelGetLevel(ChannelHandle, levels, 1 / 1000f * sample_window, LevelRetrievalFlags.Stereo);
|
||||
else
|
||||
BassMix.ChannelGetLevel(ChannelHandle, levels, 1 / 1000f * sample_window, LevelRetrievalFlags.Stereo);
|
||||
|
||||
Reference in New Issue
Block a user