Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
peppy committed Dec 25, 2023
1 parent f060449 commit 973400c
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions osu.Framework/Threading/AudioThread.cs
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ internal sealed override void MakeCurrent()

private static WasapiProcedure? wasapiProcedure;

public static int WasapiMixer { get; private set; }
public static int GlobalMixer { get; private set; }

private void onNewFrame()
{
Expand Down Expand Up @@ -167,21 +167,21 @@ private static void attemptWasapiInitialisation()

// To keep things in a sane state let's only keep one device initialised via wasapi.
// TODO: The mixer probably doesn't need to be recycled. Just keeping things sane for now.
if (WasapiMixer != 0)
if (GlobalMixer != 0)
{
Bass.StreamFree(WasapiMixer);
Bass.StreamFree(GlobalMixer);
BassWasapi.Free();
WasapiMixer = 0;
GlobalMixer = 0;
}

// This is intentionally initialised inline and stored to a field.
// If we don't do this, it gets GC'd away.
wasapiProcedure = (buffer, length, _) => Bass.ChannelGetData(WasapiMixer, buffer, length);
wasapiProcedure = (buffer, length, _) => Bass.ChannelGetData(GlobalMixer, buffer, length);

if (BassWasapi.Init(wasapiDevice, Procedure: wasapiProcedure, Buffer: 0.02f, Period: 0.005f))
{
BassWasapi.GetInfo(out var wasapiInfo);
WasapiMixer = BassMix.CreateMixerStream(wasapiInfo.Frequency, wasapiInfo.Channels, BassFlags.MixerNonStop | BassFlags.Decode | BassFlags.Float);
GlobalMixer = BassMix.CreateMixerStream(wasapiInfo.Frequency, wasapiInfo.Channels, BassFlags.MixerNonStop | BassFlags.Decode | BassFlags.Float);
BassWasapi.Start();
}
}
Expand Down

0 comments on commit 973400c

Please sign in to comment.