Packagecom.noteflight.standingwave2.filters
Classpublic class CacheFilter
InheritanceCacheFilter Inheritance Object
Implements IAudioFilter, IRandomAccessSource

This audio filter does not transform its underlying source. It merely caches its audio data in a stored Sample object, which is expanded as needed to cover a range from the first frame up to the last frame requested via a call to getSample(). This is useful for performance reasons, and is also a way to turn any IAudioSource into an IRandomAccessSource.



Public Properties
 PropertyDefined By
  descriptor : AudioDescriptor
[read-only] Get the AudioDescriptor for this Sample.
CacheFilter
  frameCount : Number
[read-only] The number of sample frames in this source.
CacheFilter
  position : Number
[read-only] The position of the audio cursor in this source, as a frame index.
CacheFilter
  source : IAudioSource
The underlying audio source for this filter.
CacheFilter
Public Methods
 MethodDefined By
  
CacheFilter(source:IAudioSource = null)
CacheFilter
  
CacheFilter
  
fill(toOffset:Number = -1):void
Instruct this cache to fill itself up to the given frame offset from its source.
CacheFilter
  
getSample(numFrames:Number):Sample
Get the next run of audio by calling getSampleRange() based on the current cursor position.
CacheFilter
  
getSampleRange(fromOffset:Number, toOffset:Number):Sample
Get the concrete audio data from this source that occurs within a given time interval.
CacheFilter
  
CacheFilter
Property Detail
descriptorproperty
descriptor:AudioDescriptor  [read-only]

Get the AudioDescriptor for this Sample.


Implementation
    public function get descriptor():AudioDescriptor
frameCountproperty 
frameCount:Number  [read-only]

The number of sample frames in this source. An unbounded source may return Number.MAX_VALUE.


Implementation
    public function get frameCount():Number
positionproperty 
position:Number  [read-only]

The position of the audio cursor in this source, as a frame index.


Implementation
    public function get position():Number
sourceproperty 
source:IAudioSource

The underlying audio source for this filter.


Implementation
    public function get source():IAudioSource
    public function set source(value:IAudioSource):void
Constructor Detail
CacheFilter()Constructor
public function CacheFilter(source:IAudioSource = null)



Parameters
source:IAudioSource (default = null)
Method Detail
clone()method
public function clone():IAudioSource

Returns
IAudioSource
fill()method 
public function fill(toOffset:Number = -1):void

Instruct this cache to fill itself up to the given frame offset from its source.

Parameters

toOffset:Number (default = -1) — a sample frame index; if negative/omitted, reads the entire source.

getSample()method 
public function getSample(numFrames:Number):Sample

Get the next run of audio by calling getSampleRange() based on the current cursor position.

Parameters

numFrames:Number

Returns
Sample
getSampleRange()method 
public function getSampleRange(fromOffset:Number, toOffset:Number):Sample

Get the concrete audio data from this source that occurs within a given time interval. The interval must lie within the bounds of the length of the underlying source.

Parameters

fromOffset:Number — the inclusive start of the interval, in sample frames.
 
toOffset:Number — the exclusive end of the interval (that is, one past the last sample frame in the interval)

Returns
Sample — a Sample representing the data in the interval.
resetPosition()method 
public function resetPosition():void