Skip to main content

LVC audio output

The LVCAudioOutput class is used to add audio outputs to the LVC pipeline. You can start and stop the output pipeline independently from the main pipeline.

Usage

When creating an LVCAudioOutput object, you must specify the MediaBlock to be used as the audio data output.

Sample code

Add an audio renderer

Add an audio renderer to the LVC pipeline. You need to create an AudioRendererBlock object and then create an LVCAudioOutput object. Finally, add the output to the compositor.

The first device is used as an audio output.

var audioRenderer = new AudioRendererBlock((await DeviceEnumerator.Shared.AudioOutputsAsync())[0]); 
var audioRendererOutput = new LVCAudioOutput("Audio renderer", _compositor, audioRenderer, true);
await _compositor.Output_AddAsync(audioRendererOutput, true);

Add an MP3 output

Add an MP3 output to the LVC pipeline. You need to create an MP3OutputBlock object and then create an LVCAudioOutput object. Finally, add the output to the compositor.

 var mp3Output = new MP3OutputBlock(outputFile, new MP3EncoderSettings());
var output = new LVCAudioOutput(outputFile, _compositor, mp3Output, false);

if (await _compositor.Output_AddAsync(output))
{
// added successfully
}
else
{
output.Dispose();
}

Sample application on GitHub