Class FadeInOutSampleProvider
- Namespace
- NAudio.Wave.SampleProviders
- Assembly
- NAudio.Core.dll
Sample Provider to allow fading in and out
public class FadeInOutSampleProvider : ISampleProvider
- Inheritance
-
FadeInOutSampleProvider
- Implements
- Inherited Members
- Extension Methods
Constructors
FadeInOutSampleProvider(ISampleProvider, bool)
Creates a new FadeInOutSampleProvider
public FadeInOutSampleProvider(ISampleProvider source, bool initiallySilent = false)
Parameters
sourceISampleProviderThe source stream with the audio to be faded in or out
initiallySilentboolIf true, we start faded out
Properties
WaveFormat
WaveFormat of this SampleProvider
public WaveFormat WaveFormat { get; }
Property Value
Methods
BeginFadeIn(double)
Requests that a fade-in begins (will start on the next call to Read)
public void BeginFadeIn(double fadeDurationInMilliseconds)
Parameters
fadeDurationInMillisecondsdoubleDuration of fade in milliseconds
BeginFadeOut(double)
Requests that a fade-out begins (will start on the next call to Read)
public void BeginFadeOut(double fadeDurationInMilliseconds)
Parameters
fadeDurationInMillisecondsdoubleDuration of fade in milliseconds
Read(Span<float>)
Reads samples from this sample provider into a span
public int Read(Span<float> buffer)
Parameters
Returns
Events
FadeInComplete
Raised once when a fade-in started via BeginFadeIn(double) reaches full volume. Fires from the Read(Span<float>) call on which the transition happens, after the internal lock has been released, so handlers may safely call back into BeginFadeIn(double) / BeginFadeOut(double) (e.g. to schedule a fade-out).
public event EventHandler FadeInComplete
Event Type
FadeOutComplete
Raised once when a fade-out started via BeginFadeOut(double) reaches silence. Fires from the Read(Span<float>) call on which the transition happens, after the internal lock has been released, so handlers may safely call back into BeginFadeIn(double) / BeginFadeOut(double) (e.g. to signal stop, or start a cross-fade into the next source).
public event EventHandler FadeOutComplete