Class SampleChannel
- Namespace
- NAudio.Wave.SampleProviders
- Assembly
- NAudio.Core.dll
Utility class that takes an IWaveProvider input at any bit depth and exposes it as an ISampleProvider. Can turn mono inputs into stereo, and allows adjusting of volume. (The eventual successor to WaveChannel32) This class also serves as an example of how you can link together several simple sample sources to form a more useful class.
public class SampleChannel : ISampleProvider
- Inheritance
-
SampleChannel
- Implements
- Inherited Members
- Extension Methods
Constructors
SampleChannel(IWaveProvider)
Initialises a new instance of SampleChannel
public SampleChannel(IWaveProvider waveProvider)
Parameters
waveProviderIWaveProviderSource audio, must be PCM or IEEE
SampleChannel(IWaveProvider, bool)
Initialises a new instance of SampleChannel
public SampleChannel(IWaveProvider waveProvider, bool forceStereo)
Parameters
waveProviderIWaveProviderSource audio, must be PCM or IEEE
forceStereoboolforce mono inputs to become stereo
Properties
Volume
Allows adjusting the volume, 1.0f = full volume
public float Volume { get; set; }
Property Value
WaveFormat
The WaveFormat of this Sample Source
public WaveFormat WaveFormat { get; }
Property Value
Methods
Read(Span<float>)
Reads samples from this sample source
public int Read(Span<float> buffer)
Parameters
Returns
Events
PreVolumeMeter
Raised periodically to inform the user of the max volume (before the volume meter)
public event EventHandler<StreamVolumeEventArgs> PreVolumeMeter