C# Class SunsetHigh.BGMusic.FadeInOutSampleProviderAdapted

This helper class is lifted straight out of NAudio samples (with minor edits) to allow for fading/looping
Inheritance: ISampleProvider
Mostrar archivo Open project: ErraticUnicorn/MOSH

Public Methods

Method Description
BeginFadeIn ( double fadeDurationInMilliseconds ) : void

Requests that a fade-in begins (will start on the next call to Read)

BeginFadeOut ( double fadeDurationInMilliseconds ) : void

Requests that a fade-out begins (will start on the next call to Read)

FadeInOutSampleProviderAdapted ( AudioFileReader source, bool initiallySilent = false ) : System

Creates a new FadeInOutSampleProvider

Read ( float buffer, int offset, int count ) : int

Reads samples from this sample provider

isLooping ( ) : bool

Returns whether the current song is looping (true by default)

setLooping ( bool looping ) : void

Sets whether the current song should loop or not (true by default)

Private Methods

Method Description
ClearBuffer ( float buffer, int offset, int count ) : void
FadeIn ( float buffer, int offset, int sourceSamplesRead ) : void
FadeOut ( float buffer, int offset, int sourceSamplesRead ) : void

Method Details

BeginFadeIn() public method

Requests that a fade-in begins (will start on the next call to Read)
public BeginFadeIn ( double fadeDurationInMilliseconds ) : void
fadeDurationInMilliseconds double Duration of fade in milliseconds
return void

BeginFadeOut() public method

Requests that a fade-out begins (will start on the next call to Read)
public BeginFadeOut ( double fadeDurationInMilliseconds ) : void
fadeDurationInMilliseconds double Duration of fade in milliseconds
return void

FadeInOutSampleProviderAdapted() public method

Creates a new FadeInOutSampleProvider
public FadeInOutSampleProviderAdapted ( AudioFileReader source, bool initiallySilent = false ) : System
source NAudio.Wave.AudioFileReader The source stream with the audio to be faded in or out
initiallySilent bool If true, we start faded out
return System

Read() public method

Reads samples from this sample provider
public Read ( float buffer, int offset, int count ) : int
buffer float Buffer to read into
offset int Offset within buffer to write to
count int Number of samples desired
return int

isLooping() public method

Returns whether the current song is looping (true by default)
public isLooping ( ) : bool
return bool

setLooping() public method

Sets whether the current song should loop or not (true by default)
public setLooping ( bool looping ) : void
looping bool
return void