Skip to content

Instantly share code, notes, and snippets.

@hatsunea
Created January 13, 2021 10:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hatsunea/0579ff8a673980fd605985f5d9d5a5cb to your computer and use it in GitHub Desktop.
Save hatsunea/0579ff8a673980fd605985f5d9d5a5cb to your computer and use it in GitHub Desktop.
private void InitializeCaptureDevice(IAudioClient audioClientInterface)
{
var audioClient = new AudioClient((IAudioClient)audioClientInterface);
if (waveFormat == null)
{
var mix = audioClient.MixFormat;
if (mix is WaveFormatExtensible)
{
if (mix.BitsPerSample == 32)
{
waveFormat = WaveFormat.CreateIeeeFloatWaveFormat(mix.SampleRate, mix.Channels);
}
else
{
waveFormat = new WaveFormat(mix.SampleRate, mix.BitsPerSample, mix.Channels);
}
}
}
:
:
:
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment