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
Afficher le fichier Open project: ErraticUnicorn/MOSH

Méthodes publiques

Méthode 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

Méthode 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 méthode

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
Résultat void

BeginFadeOut() public méthode

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
Résultat void

FadeInOutSampleProviderAdapted() public méthode

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
Résultat System

Read() public méthode

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
Résultat int

isLooping() public méthode

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

setLooping() public méthode

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