C# Class GAudio.GATData

A wrapper for audio data, with a suite of audio processing methods. Used throughout G-Audio. Note: When requesting GATData instances from GATManager.GetDataContainer( int size ), you will in fact be handed an instance of a managed subclass ( GATDataAllocator.GATManagedData ) which responds to Retain() and Release() calls. See the example scenes that comes with G-Audio for examples of typical use.
Inheritance: RetainableObject, IGATDataOwner
Afficher le fichier Open project: gregzo/G-Audio Class Usage Examples

Protected Properties

Свойство Type Description
_offset int
_parentArray float[]

Private Properties

Свойство Type Description

Méthodes publiques

Méthode Description
ApplyFilter ( AGATFilter filter, int fromIndex, int length, bool emptyData ) : void

Applies a filter to the instance's audio data.

CheckSampleBounds ( ) : bool

Checks that no data exceeds the -1f to 1f range.

Clear ( ) : void

Clears all audio data

Clear ( int fromIndex, int length ) : void

Clears audio data at specified range

ClearInterlaced ( int channelNb, int nbOfInterlacedChannels, int length ) : void

Clears a specific channel of interleaved data

ConvertAndSetInt16 ( System source, int sourceOffset, int targetOffset, int length ) : void

Converts an Int16 array and set it at targetOffset

CopyFrom ( float sourceArray, int destinationIndex, int sourceIndex, int length ) : void

Copies data from a float[] to a GATData instance.

CopyFromInterlaced ( float sourceArray, int targetLength, int channelNb, int nbOfChannels ) : void

Performs a copy of a single channel from an interlaced source array.

CopyFromInterlaced ( float sourceArray, int targetLength, int targetOffset, int channelNb, int nbOfChannels ) : void

Performs a copy of a single channel from an interlaced source array.

CopyFromInterlaced ( float sourceArray, int sourceOffset, int targetLength, int targetOffset, int channelNb, int nbOfChannels ) : void

Performs a copy of a single channel from an interlaced source array. sourceOffset is samples offset for channel 0.

CopyGainTo ( GATData destinationData, int sourceIndex, int destinationIndex, int length, float gain ) : void

Copies and multuplies by gain data from one GATData instance to another.

CopySmoothedGainFrom ( float sourceArray, int sourceIndex, int destinationIndex, int length, float fromGain, float toGain ) : void

Copies data from a float[] to a GATData instance and applies interpolated gain.

CopySmoothedGainTo ( int sourceIndex, GATData destination, int destinationIndex, int length, float fromGain, float toGain ) : void

Copies data from a GATData instance to another and applies interpolated gain.

CopyTo ( GATData destinationData, int destinationIndex, int sourceIndex, int length ) : void

Copies data from a GATData instance to another.

CopyTo ( float destinationArray, int destinationIndex, int sourceIndex, int length ) : void

Copies data from a GATData instance to a float array.

CopyToInterlaced ( float destinationArray, int destinationOffset, int sourceIndex, int length, int channelNb ) : void

Copy to an interleaved float[]

Fade ( float fromGain, float toGain, int fadeLength, int offset ) : void
FadeIn ( int fadeLength ) : void

In place fade-in from offset 0 to fadeLength

FadeInSquared ( int fadeLength ) : void
FadeOut ( int fadeLength ) : void

In-place fade-out from offset this.Count - fadeLength to this.Count - 1

FadeOut ( int offset, int fadeLength ) : void

In-place fade out with offset control

FadeOutSquared ( int fadeLength ) : void
GATData ( float parentArray ) : System

Initializes a new instance of the GATData class. If you need a managed data chunk, use GATManager.GetDataContainer instead

Gain ( int fromIndex, int length, float gain ) : void
GainCopyToInterlaced ( float destinationArray, int destinationOffset, int sourceIndex, int length, GATChannelGain channelGain ) : void

Copy and gain to an interleaved float[]

GainMixTo ( GATData destinationData, int sourceIndex, int destinationIndex, int length, float gain ) : void

Additive copy and gain to another GATData instance

GainMixToInterlaced ( float destinationArray, int destinationOffset, int sourceIndex, int length, GATChannelGain channelGain ) : void

Additive copy and gain to an interleaved float[]

GainMixToInterlaced ( float destinationArray, int destinationOffset, int sourceIndex, int length, GATChannelGain channelGain, float igain ) : void

Additive copy and gain to an interleaved float[] with extra gain parameter.

GetPointer ( ) : IntPtr

Gets an IntPtr pointer to the parent array. Only valid for GATData instances obtained through GATManager.GetDataContainer calls.

GlissCopyFrom ( GATData sourceData, int fromIndex, double fromPitch, double toPitch ) : void
GlissCopyFrom ( float sourceArray, int fromIndex, int targetLength, double fromPitch, double toPitch ) : void
MixFrom ( float sourceArray, int destinationIndex, int sourceIndex, int length ) : void

Additive copy from a float[]

MixFromInterlaced ( float sourceArray, int sourceFrameOffset, int targetLength, int targetOffset, int channelNb, int nbOfChannels ) : void

Performs a copy of a single channel from an interlaced source array.

MixSmoothedGainFrom ( float sourceArray, int sourceIndex, int destinationIndex, int length, float fromGain, float toGain ) : void

Additive copy and interpolated gain from a float[]

MixSmoothedGainTo ( int sourceIndex, GATData destination, int destinationIndex, int length, float fromGain, float toGain ) : void

Additive copy and interpolated gain to another GATData instance

MixTo ( GATData destination, int destinationIndex, int sourceIndex, int length ) : void

Additive copy to another GATData instance

MixTo ( float destinationArray, int destinationIndex, int sourceIndex, int length ) : void

Additive copy to a float[]

NextZeroCrossing ( int fromIndex, bool &positive ) : int

Finds the next zero crossing.

Normalize ( float normalizedMax ) : void

Applies gain to the instance's data so that the maximum value matches normalizedMax

ResampleCopyFrom ( float sourceArray, double trueInterpolatedIndex, int targetLength, int targetOffset, double resamplingFactor ) : double

Performs a resampled copy from an array to the GATData instance it is called on. The resampling algorithm performs naive linear interpolation.

ResampleCopyTo ( double trueInterpolatedIndex, GATData destinationSample, int targetLength, double resamplingFactor ) : double

Performs a resampled copy to another GATData instance. The resampling algorithm performs naive linear interpolation.

ResampleCopyTo ( int sourceIndex, GATData destinationSample, int targetLength, double resamplingFactor ) : void

Performs a resampled copy to another GATData instance The resampling algorithm performs naive linear interpolation. Warning: for resampling in chunks, use the method of the same name which returns a double interpolated index.

Reverse ( ) : void

Reverses the entire audio data.

Reverse ( int offset, int length ) : void
SmoothedGain ( int fromIndex, int length, float fromGain, float toGain ) : void

In-place Interpolated gain

SmoothedGainCopyToInterlaced ( float destinationArray, int destinationOffset, int sourceIndex, int length, GATDynamicChannelGain channelGain ) : void

Copy and interpolated gain to an interleaved float[]

SmoothedGainMixToInterlaced ( float destinationArray, int destinationOffset, int sourceIndex, int length, GATDynamicChannelGain channelGain ) : void

Additive copy and interpolated gain to an interleaved float[]

SmoothedGainMixToInterlaced ( float destinationArray, int destinationOffset, int sourceIndex, int length, GATDynamicChannelGain channelGain, float igain ) : void

Additive copy and interpolated gain to an interleaved float[] with extra gain parameter

this ( int index ) : float

Gets or sets the float in the parent array at the specified index. The indexer should only be used for quick prototyping, as it is roughly 30% slower than caching ParentArray for direct access in an extension method.

Méthodes protégées

Méthode Description
Discard ( ) : void

Method Details

ApplyFilter() public méthode

Applies a filter to the instance's audio data.
public ApplyFilter ( AGATFilter filter, int fromIndex, int length, bool emptyData ) : void
filter AGATFilter
fromIndex int
length int
emptyData bool
Résultat void

CheckSampleBounds() public méthode

Checks that no data exceeds the -1f to 1f range.
public CheckSampleBounds ( ) : bool
Résultat bool

Clear() public méthode

Clears all audio data
public Clear ( ) : void
Résultat void

Clear() public méthode

Clears audio data at specified range
public Clear ( int fromIndex, int length ) : void
fromIndex int
length int
Résultat void

ClearInterlaced() public méthode

Clears a specific channel of interleaved data
public ClearInterlaced ( int channelNb, int nbOfInterlacedChannels, int length ) : void
channelNb int
nbOfInterlacedChannels int
length int
Résultat void

ConvertAndSetInt16() public méthode

Converts an Int16 array and set it at targetOffset
public ConvertAndSetInt16 ( System source, int sourceOffset, int targetOffset, int length ) : void
source System
sourceOffset int
targetOffset int
length int
Résultat void

CopyFrom() public méthode

Copies data from a float[] to a GATData instance.
public CopyFrom ( float sourceArray, int destinationIndex, int sourceIndex, int length ) : void
sourceArray float
destinationIndex int
sourceIndex int
length int
Résultat void

CopyFromInterlaced() public méthode

Performs a copy of a single channel from an interlaced source array.
public CopyFromInterlaced ( float sourceArray, int targetLength, int channelNb, int nbOfChannels ) : void
sourceArray float
targetLength int
channelNb int
nbOfChannels int
Résultat void

CopyFromInterlaced() public méthode

Performs a copy of a single channel from an interlaced source array.
public CopyFromInterlaced ( float sourceArray, int targetLength, int targetOffset, int channelNb, int nbOfChannels ) : void
sourceArray float
targetLength int
targetOffset int
channelNb int
nbOfChannels int
Résultat void

CopyFromInterlaced() public méthode

Performs a copy of a single channel from an interlaced source array. sourceOffset is samples offset for channel 0.
public CopyFromInterlaced ( float sourceArray, int sourceOffset, int targetLength, int targetOffset, int channelNb, int nbOfChannels ) : void
sourceArray float
sourceOffset int
targetLength int
targetOffset int
channelNb int
nbOfChannels int
Résultat void

CopyGainTo() public méthode

Copies and multuplies by gain data from one GATData instance to another.
public CopyGainTo ( GATData destinationData, int sourceIndex, int destinationIndex, int length, float gain ) : void
destinationData GATData
sourceIndex int
destinationIndex int
length int
gain float
Résultat void

CopySmoothedGainFrom() public méthode

Copies data from a float[] to a GATData instance and applies interpolated gain.
public CopySmoothedGainFrom ( float sourceArray, int sourceIndex, int destinationIndex, int length, float fromGain, float toGain ) : void
sourceArray float
sourceIndex int
destinationIndex int
length int
fromGain float
toGain float
Résultat void

CopySmoothedGainTo() public méthode

Copies data from a GATData instance to another and applies interpolated gain.
public CopySmoothedGainTo ( int sourceIndex, GATData destination, int destinationIndex, int length, float fromGain, float toGain ) : void
sourceIndex int
destination GATData
destinationIndex int
length int
fromGain float
toGain float
Résultat void

CopyTo() public méthode

Copies data from a GATData instance to another.
public CopyTo ( GATData destinationData, int destinationIndex, int sourceIndex, int length ) : void
destinationData GATData
destinationIndex int
sourceIndex int
length int
Résultat void

CopyTo() public méthode

Copies data from a GATData instance to a float array.
public CopyTo ( float destinationArray, int destinationIndex, int sourceIndex, int length ) : void
destinationArray float
destinationIndex int
sourceIndex int
length int
Résultat void

CopyToInterlaced() public méthode

Copy to an interleaved float[]
public CopyToInterlaced ( float destinationArray, int destinationOffset, int sourceIndex, int length, int channelNb ) : void
destinationArray float
destinationOffset int
sourceIndex int
length int
channelNb int
Résultat void

Discard() protected méthode

protected Discard ( ) : void
Résultat void

Fade() public méthode

public Fade ( float fromGain, float toGain, int fadeLength, int offset ) : void
fromGain float
toGain float
fadeLength int
offset int
Résultat void

FadeIn() public méthode

In place fade-in from offset 0 to fadeLength
public FadeIn ( int fadeLength ) : void
fadeLength int
Résultat void

FadeInSquared() public méthode

public FadeInSquared ( int fadeLength ) : void
fadeLength int
Résultat void

FadeOut() public méthode

In-place fade-out from offset this.Count - fadeLength to this.Count - 1
public FadeOut ( int fadeLength ) : void
fadeLength int
Résultat void

FadeOut() public méthode

In-place fade out with offset control
public FadeOut ( int offset, int fadeLength ) : void
offset int
fadeLength int
Résultat void

FadeOutSquared() public méthode

public FadeOutSquared ( int fadeLength ) : void
fadeLength int
Résultat void

GATData() public méthode

Initializes a new instance of the GATData class. If you need a managed data chunk, use GATManager.GetDataContainer instead
public GATData ( float parentArray ) : System
parentArray float
Résultat System

Gain() public méthode

public Gain ( int fromIndex, int length, float gain ) : void
fromIndex int
length int
gain float
Résultat void

GainCopyToInterlaced() public méthode

Copy and gain to an interleaved float[]
public GainCopyToInterlaced ( float destinationArray, int destinationOffset, int sourceIndex, int length, GATChannelGain channelGain ) : void
destinationArray float
destinationOffset int
sourceIndex int
length int
channelGain GATChannelGain
Résultat void

GainMixTo() public méthode

Additive copy and gain to another GATData instance
public GainMixTo ( GATData destinationData, int sourceIndex, int destinationIndex, int length, float gain ) : void
destinationData GATData
sourceIndex int
destinationIndex int
length int
gain float
Résultat void

GainMixToInterlaced() public méthode

Additive copy and gain to an interleaved float[]
public GainMixToInterlaced ( float destinationArray, int destinationOffset, int sourceIndex, int length, GATChannelGain channelGain ) : void
destinationArray float
destinationOffset int
sourceIndex int
length int
channelGain GATChannelGain
Résultat void

GainMixToInterlaced() public méthode

Additive copy and gain to an interleaved float[] with extra gain parameter.
public GainMixToInterlaced ( float destinationArray, int destinationOffset, int sourceIndex, int length, GATChannelGain channelGain, float igain ) : void
destinationArray float
destinationOffset int
sourceIndex int
length int
channelGain GATChannelGain
igain float
Résultat void

GetPointer() public méthode

Gets an IntPtr pointer to the parent array. Only valid for GATData instances obtained through GATManager.GetDataContainer calls.
public GetPointer ( ) : IntPtr
Résultat System.IntPtr

GlissCopyFrom() public méthode

public GlissCopyFrom ( GATData sourceData, int fromIndex, double fromPitch, double toPitch ) : void
sourceData GATData
fromIndex int
fromPitch double
toPitch double
Résultat void

GlissCopyFrom() public méthode

public GlissCopyFrom ( float sourceArray, int fromIndex, int targetLength, double fromPitch, double toPitch ) : void
sourceArray float
fromIndex int
targetLength int
fromPitch double
toPitch double
Résultat void

MixFrom() public méthode

Additive copy from a float[]
public MixFrom ( float sourceArray, int destinationIndex, int sourceIndex, int length ) : void
sourceArray float
destinationIndex int
sourceIndex int
length int
Résultat void

MixFromInterlaced() public méthode

Performs a copy of a single channel from an interlaced source array.
public MixFromInterlaced ( float sourceArray, int sourceFrameOffset, int targetLength, int targetOffset, int channelNb, int nbOfChannels ) : void
sourceArray float
sourceFrameOffset int
targetLength int
targetOffset int
channelNb int
nbOfChannels int
Résultat void

MixSmoothedGainFrom() public méthode

Additive copy and interpolated gain from a float[]
public MixSmoothedGainFrom ( float sourceArray, int sourceIndex, int destinationIndex, int length, float fromGain, float toGain ) : void
sourceArray float
sourceIndex int
destinationIndex int
length int
fromGain float
toGain float
Résultat void

MixSmoothedGainTo() public méthode

Additive copy and interpolated gain to another GATData instance
public MixSmoothedGainTo ( int sourceIndex, GATData destination, int destinationIndex, int length, float fromGain, float toGain ) : void
sourceIndex int
destination GATData
destinationIndex int
length int
fromGain float
toGain float
Résultat void

MixTo() public méthode

Additive copy to another GATData instance
public MixTo ( GATData destination, int destinationIndex, int sourceIndex, int length ) : void
destination GATData
destinationIndex int
sourceIndex int
length int
Résultat void

MixTo() public méthode

Additive copy to a float[]
public MixTo ( float destinationArray, int destinationIndex, int sourceIndex, int length ) : void
destinationArray float
destinationIndex int
sourceIndex int
length int
Résultat void

NextZeroCrossing() public méthode

Finds the next zero crossing.
public NextZeroCrossing ( int fromIndex, bool &positive ) : int
fromIndex int
positive bool /// true if the crossing /// is from a negative to a positive value. ///
Résultat int

Normalize() public méthode

Applies gain to the instance's data so that the maximum value matches normalizedMax
public Normalize ( float normalizedMax ) : void
normalizedMax float
Résultat void

ResampleCopyFrom() public méthode

Performs a resampled copy from an array to the GATData instance it is called on. The resampling algorithm performs naive linear interpolation.
public ResampleCopyFrom ( float sourceArray, double trueInterpolatedIndex, int targetLength, int targetOffset, double resamplingFactor ) : double
sourceArray float
trueInterpolatedIndex double
targetLength int
targetOffset int
resamplingFactor double
Résultat double

ResampleCopyTo() public méthode

Performs a resampled copy to another GATData instance. The resampling algorithm performs naive linear interpolation.
public ResampleCopyTo ( double trueInterpolatedIndex, GATData destinationSample, int targetLength, double resamplingFactor ) : double
trueInterpolatedIndex double
destinationSample GATData
targetLength int
resamplingFactor double
Résultat double

ResampleCopyTo() public méthode

Performs a resampled copy to another GATData instance The resampling algorithm performs naive linear interpolation. Warning: for resampling in chunks, use the method of the same name which returns a double interpolated index.
public ResampleCopyTo ( int sourceIndex, GATData destinationSample, int targetLength, double resamplingFactor ) : void
sourceIndex int
destinationSample GATData
targetLength int
resamplingFactor double
Résultat void

Reverse() public méthode

Reverses the entire audio data.
public Reverse ( ) : void
Résultat void

Reverse() public méthode

public Reverse ( int offset, int length ) : void
offset int
length int
Résultat void

SmoothedGain() public méthode

In-place Interpolated gain
public SmoothedGain ( int fromIndex, int length, float fromGain, float toGain ) : void
fromIndex int
length int
fromGain float
toGain float
Résultat void

SmoothedGainCopyToInterlaced() public méthode

Copy and interpolated gain to an interleaved float[]
public SmoothedGainCopyToInterlaced ( float destinationArray, int destinationOffset, int sourceIndex, int length, GATDynamicChannelGain channelGain ) : void
destinationArray float
destinationOffset int
sourceIndex int
length int
channelGain GATDynamicChannelGain
Résultat void

SmoothedGainMixToInterlaced() public méthode

Additive copy and interpolated gain to an interleaved float[]
public SmoothedGainMixToInterlaced ( float destinationArray, int destinationOffset, int sourceIndex, int length, GATDynamicChannelGain channelGain ) : void
destinationArray float
destinationOffset int
sourceIndex int
length int
channelGain GATDynamicChannelGain
Résultat void

SmoothedGainMixToInterlaced() public méthode

Additive copy and interpolated gain to an interleaved float[] with extra gain parameter
public SmoothedGainMixToInterlaced ( float destinationArray, int destinationOffset, int sourceIndex, int length, GATDynamicChannelGain channelGain, float igain ) : void
destinationArray float
destinationOffset int
sourceIndex int
length int
channelGain GATDynamicChannelGain
igain float
Résultat void

this() public méthode

Gets or sets the float in the parent array at the specified index. The indexer should only be used for quick prototyping, as it is roughly 30% slower than caching ParentArray for direct access in an extension method.
public this ( int index ) : float
index int
Résultat float

Property Details

_offset protected_oe property

protected int _offset
Résultat int

_parentArray protected_oe property

protected float[] _parentArray
Résultat float[]