Skip to content

Commit

Permalink
fixup! Port XAudio to Silk.NET
Browse files Browse the repository at this point in the history
  • Loading branch information
Jklawreszuk committed Nov 8, 2024
1 parent c966dca commit d72cf78
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions sources/engine/Stride.Audio/Layers/XAudio/AudioProvider.cs
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ public unsafe void BufferFill(AudioBuffer buffer, nint pcm, int bufferSize, int
}

//this means opening the real audio device, which will be virtual actually so in the case of default device change Xaudio will deal with it for us.
result = device.xAudio->CreateMasteringVoice(ref device.masteringVoice, AUDIO_CHANNELS, 0, 0, deviceName, null, AudioStreamCategory.GameMedia);
result = device.xAudio->CreateMasteringVoice(ref device.masteringVoice, AUDIO_CHANNELS, 0, 0, deviceName, null, AudioStreamCategory.GameEffects);
if (HResult.IndicatesFailure(result))
{
return null;
Expand Down Expand Up @@ -441,8 +441,7 @@ public unsafe void SourceSetPan(Source source, float pan)
panning[0] = 1.0f - pan;
panning[1] = 1.0f;
}
var voice = (IXAudio2Voice)(*source.masteringVoice);
source.sourceVoice->SetOutputMatrix(&voice, 1, AUDIO_CHANNELS, panning, 0);
source.sourceVoice->SetOutputMatrix<IXAudio2MasteringVoice>(source.masteringVoice, 1, AUDIO_CHANNELS, panning, 0);

}
else
Expand All @@ -462,8 +461,7 @@ public unsafe void SourceSetPan(Source source, float pan)
panning[2] = 0.0f;
panning[3] = 1.0f;
}
var voice = (IXAudio2Voice)(*source.masteringVoice);
source.sourceVoice->SetOutputMatrix(&voice, 2, AUDIO_CHANNELS, panning, 0);
source.sourceVoice->SetOutputMatrix<IXAudio2MasteringVoice>(source.masteringVoice, 2, AUDIO_CHANNELS, panning, 0);
}
}

Expand Down

0 comments on commit d72cf78

Please sign in to comment.