C# Class GAudio.GATRealTimeADSR

Wrapper that adds realtime ADSR controls to IGATDataOwner objects( GATData or IGATProcessedSample ). In addition, zero crossings are automatically found for the sustain loop, and a sustain loop crossfade can be adjusted.
Show file Open project: gregzo/G-Audio

Public Methods

Method Description
GATRealTimeADSR ( IGATDataOwner dataOwner ) : System.Collections

Wrap a GATData or a IGATProcessedSample object for ADSR playback.

PlayThroughTrack ( GATPlayer player, int trackNb, float gain = 1f ) : void

Starts playback through the user specified player.

PlayThroughTrack ( int trackNb, float gain = 1f ) : void

Starts playback through the default player.

Release ( ) : void

If playback is in the loop crossfade part of the envelope, the sample will loop one last time and release from the sustain index.

TrySetEnvelope ( int offset, int attack, int decay, int sustain, int release, int loopCrossfade = -1 ) : bool

Call TrySetEnvelope before playing. Processing of the sample occurs in real time, but the envelope parameters cannot be modified while the sample is playing. Note 1: a sustain of 0 is valid and will result in one shot playback. Note 2: if no loopCrossfade parameter is passed, loopCrossfade will equal sustain. Note 3: offset + attack + decay must be greater than loopCrossfade.

Private Methods

Method Description
PlayerWillMixSample ( IGATBufferedSample sample, int length, float audioBuffer ) : bool
UpdateZeroCrossings ( ) : void

Method Details

GATRealTimeADSR() public method

Wrap a GATData or a IGATProcessedSample object for ADSR playback.
public GATRealTimeADSR ( IGATDataOwner dataOwner ) : System.Collections
dataOwner IGATDataOwner
return System.Collections

PlayThroughTrack() public method

Starts playback through the user specified player.
public PlayThroughTrack ( GATPlayer player, int trackNb, float gain = 1f ) : void
player GATPlayer
trackNb int
gain float
return void

PlayThroughTrack() public method

Starts playback through the default player.
public PlayThroughTrack ( int trackNb, float gain = 1f ) : void
trackNb int
gain float
return void

Release() public method

If playback is in the loop crossfade part of the envelope, the sample will loop one last time and release from the sustain index.
public Release ( ) : void
return void

TrySetEnvelope() public method

Call TrySetEnvelope before playing. Processing of the sample occurs in real time, but the envelope parameters cannot be modified while the sample is playing. Note 1: a sustain of 0 is valid and will result in one shot playback. Note 2: if no loopCrossfade parameter is passed, loopCrossfade will equal sustain. Note 3: offset + attack + decay must be greater than loopCrossfade.
public TrySetEnvelope ( int offset, int attack, int decay, int sustain, int release, int loopCrossfade = -1 ) : bool
offset int
attack int
decay int
sustain int
release int
loopCrossfade int
return bool