/// <summary> /// Flushs all cached samples associated with the specified envelope. /// </summary> /// <param name="envelope">Envelope.</param> public void FlushCacheForEnvelope(GATEnvelope envelope) { if (_cache == null) { return; } _cache.FlushCacheForEnvelope(envelope); }
void OnEnable() { if (_pulse != null && _mapLengthToPulse) { _pulse.onWillPulse += OnWillPulse; } if (Envelope == null) { Envelope = new GATEnvelope(_length, _fadeIn, _fadeOut, _offset, _normalize, _normalizeValue); } }
public ProcessedAudioChunk(GATData sourcesample, GATEnvelope ienvelope, GATProcessedSamplesCache parentCache, double pitch = 1d) { sourceSample = sourcesample; envelope = ienvelope; _parentCache = parentCache; if (envelope == GATEnvelope.nullEnvelope) //_cachedLength will never change { _cachedLength = sourcesample.Count; } else { _cachedLength = envelope.Length; } SetPitch(pitch); }
/// <summary> /// Flushs all cached samples associated with the specified envelope. /// </summary> /// <param name="envelope">Envelope.</param> public void FlushCacheForEnvelope(GATEnvelope envelope) { List <ProcessedAudioChunk> chunks; List <ProcessedAudioChunk> chunksToRemove = new List <ProcessedAudioChunk>(); ProcessedAudioChunk chunk; int i; if (envelope == null) { envelope = GATEnvelope.nullEnvelope; } foreach (KeyValuePair <GATData, List <ProcessedAudioChunk> > chunksByName in _processedChunksInMemory) { chunks = chunksByName.Value; if (chunks.Count == 0) { continue; } for (i = 0; i < chunks.Count; i++) { chunk = chunks[i]; if (chunk.envelope == envelope) { chunk.CleanUp(); chunksToRemove.Add(chunk); } } if (chunksToRemove.Count > 0) { for (i = 0; i < chunksToRemove.Count; i++) { chunks.Remove(chunksToRemove[i]); } chunksToRemove.Clear(); } } }
/// <summary> /// Flushs all cached samples associated with the specified envelope. /// </summary> /// <param name="envelope">Envelope.</param> public void FlushCacheForEnvelope( GATEnvelope envelope ) { List< ProcessedAudioChunk > chunks; List< ProcessedAudioChunk > chunksToRemove = new List< ProcessedAudioChunk >(); ProcessedAudioChunk chunk; int i; if( envelope == null ) envelope = GATEnvelope.nullEnvelope; foreach( KeyValuePair< GATData, List< ProcessedAudioChunk > > chunksByName in _processedChunksInMemory ) { chunks = chunksByName.Value; if( chunks.Count == 0 ) continue; for( i = 0; i < chunks.Count; i++ ) { chunk = chunks[ i ]; if( chunk.envelope == envelope ) { chunk.CleanUp(); chunksToRemove.Add ( chunk ); } } if( chunksToRemove.Count > 0 ) { for( i = 0; i < chunksToRemove.Count; i++ ) { chunks.Remove( chunksToRemove[ i ] ); } chunksToRemove.Clear(); } } }
public IGATProcessedSample GetProcessedSample( GATData sourceSample, double pitch, GATEnvelope envelope ) { if( envelope == null ) envelope = GATEnvelope.nullEnvelope; int i; List<ProcessedAudioChunk> chunks = _processedChunksInMemory[ sourceSample ]; ProcessedAudioChunk sample; for( i = 0; i < chunks.Count; i++ ) { if( chunks[i].envelope == envelope && chunks[i].Pitch == pitch ) { sample = chunks[i]; return sample; } } sample = new ProcessedAudioChunk( sourceSample, envelope, this, pitch ); //Here is the main dif with base class chunks.Add( sample ); return sample; }
public ProcessedAudioChunk( GATData sourcesample, GATEnvelope ienvelope, GATProcessedSamplesCache parentCache, double pitch = 1d ) { sourceSample = sourcesample; envelope = ienvelope; _parentCache = parentCache; if( envelope == GATEnvelope.nullEnvelope ) //_cachedLength will never change { _cachedLength = sourcesample.Count; } else { _cachedLength = envelope.Length; } SetPitch( pitch ); }
void Awake() { Envelope = new GATEnvelope(_length, _fadeIn, _fadeOut, _offset, _normalize, _normalizeValue); }
public virtual IGATProcessedSample GetProcessedSample( int indexInBank, GATEnvelope envelope, double pitch = 1d ) { return _cache.GetProcessedSample( _allSamples[ indexInBank ], pitch, envelope ); }
/// <summary> /// Gets a processed sample container that will automatically update according to the envelope. /// Play it directly, not via GATPlayer : all envelope updates will be handled, even when overlapping sounds have their envelope changed. /// Note that the pitch parameter will only be taken into account by GATResamplingSampleBank instances. /// </summary> /// <returns> /// An interface to the processed sample container. /// </returns> /// <param name='sampleName'> /// The sample's name in the loaded SoundBank /// </param> /// <param name='envelope'> /// The envelope may be null if you need the whole, unprocessed sample. /// </param> public virtual IGATProcessedSample GetProcessedSample( string sampleName, GATEnvelope envelope, double pitch = 1d ) { return _cache.GetProcessedSample( _samplesByName[ sampleName ], pitch, envelope ); }
/// <summary> /// Flushs all cached samples associated with the specified envelope. /// </summary> /// <param name="envelope">Envelope.</param> public void FlushCacheForEnvelope( GATEnvelope envelope ) { if( _cache == null ) return; _cache.FlushCacheForEnvelope( envelope ); }
void OnEnable() { if( _pulse != null && _mapLengthToPulse ) { _pulse.onWillPulse += OnWillPulse; } if( Envelope == null ) Envelope = new GATEnvelope( _length, _fadeIn, _fadeOut, _offset, _normalize, _normalizeValue ); }
void Awake() { Envelope = new GATEnvelope( _length, _fadeIn, _fadeOut, _offset, _normalize, _normalizeValue ); }
public virtual IGATProcessedSample GetProcessedSample(int indexInBank, GATEnvelope envelope, double pitch = 1d) { return(_cache.GetProcessedSample(_allSamples[indexInBank], pitch, envelope)); }
/// <summary> /// Gets a processed sample container that will automatically update according to the envelope. /// Play it directly, not via GATPlayer : all envelope updates will be handled, even when overlapping sounds have their envelope changed. /// Note that the pitch parameter will only be taken into account by GATResamplingSampleBank instances. /// </summary> /// <returns> /// An interface to the processed sample container. /// </returns> /// <param name='sampleName'> /// The sample's name in the loaded SoundBank /// </param> /// <param name='envelope'> /// The envelope may be null if you need the whole, unprocessed sample. /// </param> public virtual IGATProcessedSample GetProcessedSample(string sampleName, GATEnvelope envelope, double pitch = 1d) { return(_cache.GetProcessedSample(_samplesByName[sampleName], pitch, envelope)); }
public IGATProcessedSample GetProcessedSample(GATData sourceSample, double pitch, GATEnvelope envelope) { if (envelope == null) { envelope = GATEnvelope.nullEnvelope; } int i; List <ProcessedAudioChunk> chunks = _processedChunksInMemory[sourceSample]; ProcessedAudioChunk sample; for (i = 0; i < chunks.Count; i++) { if (chunks[i].envelope == envelope && chunks[i].Pitch == pitch) { sample = chunks[i]; return(sample); } } sample = new ProcessedAudioChunk(sourceSample, envelope, this, pitch); //Here is the main dif with base class chunks.Add(sample); return(sample); }