C# Class GAudio.GATSampleBank

Inheritance: UnityEngine.MonoBehaviour
Mostra file Open project: gregzo/G-Audio Class Usage Examples

Public Properties

Property Type Description
extraCapacity int

Protected Properties

Property Type Description
_allKeys string[]
_allSamples List
_samplesByName GATData>.Dictionary
_soundBank GATSoundBank
_totalCapacity int

Public Methods

Method Description
AddLoadedFile ( GATData channelsData, string fileName ) : void

Compatibility with GATAudioLoader.

AddSample ( GATData data, string sampleName ) : void

Adds a sample to the bank, which will retain it, and manage cache for it if GATActiveSamplebank.

ContainsSampleNamed ( string sampleName ) : bool

Is the specified sample loaded?

EditorUpdateSoundBank ( GATSoundBank bank = null ) : void
FillWithResampledData ( GATData data, int indexInBank, int fromIndex, int targetLength, double pitch ) : void
FillWithResampledData ( GATData data, string sampleName, int fromIndex, int targetLength, double pitch ) : void

Convenience method for copying a resampled chunk of a sample to a GATData container. Target length is the requested ouptut length.

FillWithSampleData ( GATData data, int indexInBank, int fromIndex, int length ) : void
FillWithSampleData ( GATData data, string sampleName, int fromIndex, int length ) : void

Convenience method for copying a chunk of a sample to a GATData container.

GetAudioData ( int indexInBank ) : GATData
GetAudioData ( string sampleName ) : GATData

Grabs a reference to the samples data. Note that changes to the data will be persistent until the bank is reloaded.

GetClosestSampleForMidiCode ( float midiCode, float &pitchShift ) : GATData

Returns the sample closest to the provided midicode and a pitch shift value to be applied to the sample

LoadAll ( ) : void

Loads all samples from the referenced SoundBank. Sync operation

LoadSamplesNamed ( List sampleNames ) : void

Loads specific samples from the referenced Sound Bank. Sync operation.

LoadStreamingAssetsAsync ( List sampleNames, OperationCompletedHandler onCompleted ) : void

Loads specific StreamingAssets samples from the referenced Sound Bank. Async operation.

OnEnable ( ) : void
RemoveSample ( string sampleName ) : void

Releases a specific sample and it's associated cache.

RemoveSamples ( List sampleNames ) : void

Releases specific samples and their associated cache.

UnloadAll ( ) : void

Releases all loaded samples.

UpdateSoundBank ( ) : void

Protected Methods

Method Description
Awake ( ) : void
FillWithResampledData ( GATData sourceData, GATData targetData, int fromIndex, int targetLength, double pitch ) : void
FillWithSampleData ( GATData sourceData, GATData targetData, int fromIndex, int length ) : void
InitCollections ( ) : void
OnDestroy ( ) : void

Method Details

AddLoadedFile() public method

Compatibility with GATAudioLoader.
public AddLoadedFile ( GATData channelsData, string fileName ) : void
channelsData GATData
fileName string
return void

AddSample() public method

Adds a sample to the bank, which will retain it, and manage cache for it if GATActiveSamplebank.
public AddSample ( GATData data, string sampleName ) : void
data GATData
sampleName string
return void

Awake() protected method

protected Awake ( ) : void
return void

ContainsSampleNamed() public method

Is the specified sample loaded?
public ContainsSampleNamed ( string sampleName ) : bool
sampleName string
return bool

EditorUpdateSoundBank() public method

public EditorUpdateSoundBank ( GATSoundBank bank = null ) : void
bank GATSoundBank
return void

FillWithResampledData() protected method

protected FillWithResampledData ( GATData sourceData, GATData targetData, int fromIndex, int targetLength, double pitch ) : void
sourceData GATData
targetData GATData
fromIndex int
targetLength int
pitch double
return void

FillWithResampledData() public method

public FillWithResampledData ( GATData data, int indexInBank, int fromIndex, int targetLength, double pitch ) : void
data GATData
indexInBank int
fromIndex int
targetLength int
pitch double
return void

FillWithResampledData() public method

Convenience method for copying a resampled chunk of a sample to a GATData container. Target length is the requested ouptut length.
public FillWithResampledData ( GATData data, string sampleName, int fromIndex, int targetLength, double pitch ) : void
data GATData
sampleName string
fromIndex int
targetLength int
pitch double
return void

FillWithSampleData() protected method

protected FillWithSampleData ( GATData sourceData, GATData targetData, int fromIndex, int length ) : void
sourceData GATData
targetData GATData
fromIndex int
length int
return void

FillWithSampleData() public method

public FillWithSampleData ( GATData data, int indexInBank, int fromIndex, int length ) : void
data GATData
indexInBank int
fromIndex int
length int
return void

FillWithSampleData() public method

Convenience method for copying a chunk of a sample to a GATData container.
public FillWithSampleData ( GATData data, string sampleName, int fromIndex, int length ) : void
data GATData
sampleName string
fromIndex int
length int
return void

GetAudioData() public method

public GetAudioData ( int indexInBank ) : GATData
indexInBank int
return GATData

GetAudioData() public method

Grabs a reference to the samples data. Note that changes to the data will be persistent until the bank is reloaded.
public GetAudioData ( string sampleName ) : GATData
sampleName string
return GATData

GetClosestSampleForMidiCode() public method

Returns the sample closest to the provided midicode and a pitch shift value to be applied to the sample
public GetClosestSampleForMidiCode ( float midiCode, float &pitchShift ) : GATData
midiCode float Midi code.
pitchShift float Pitch shift.
return GATData

InitCollections() protected method

protected InitCollections ( ) : void
return void

LoadAll() public method

Loads all samples from the referenced SoundBank. Sync operation
public LoadAll ( ) : void
return void

LoadSamplesNamed() public method

Loads specific samples from the referenced Sound Bank. Sync operation.
public LoadSamplesNamed ( List sampleNames ) : void
sampleNames List
return void

LoadStreamingAssetsAsync() public method

Loads specific StreamingAssets samples from the referenced Sound Bank. Async operation.
public LoadStreamingAssetsAsync ( List sampleNames, OperationCompletedHandler onCompleted ) : void
sampleNames List
onCompleted OperationCompletedHandler
return void

OnDestroy() protected method

protected OnDestroy ( ) : void
return void

OnEnable() public method

public OnEnable ( ) : void
return void

RemoveSample() public method

Releases a specific sample and it's associated cache.
public RemoveSample ( string sampleName ) : void
sampleName string
return void

RemoveSamples() public method

Releases specific samples and their associated cache.
public RemoveSamples ( List sampleNames ) : void
sampleNames List
return void

UnloadAll() public method

Releases all loaded samples.
public UnloadAll ( ) : void
return void

UpdateSoundBank() public method

public UpdateSoundBank ( ) : void
return void

Property Details

_allKeys protected_oe property

protected string[] _allKeys
return string[]

_allSamples protected_oe property

protected List _allSamples
return List

_samplesByName protected_oe property

protected Dictionary _samplesByName
return GATData>.Dictionary

_soundBank protected_oe property

protected GATSoundBank _soundBank
return GATSoundBank

_totalCapacity protected_oe property

protected int _totalCapacity
return int

extraCapacity public_oe property

The numer of samples which may be dynamically added to the bank. Not required, used for pooling cache objects at initialization.
public int extraCapacity
return int