Package | com.noteflight.standingwave2.elements |
Class | public class Sample |
Inheritance | Sample ![]() |
Implements | IAudioSource, IRandomAccessSource |
channelData
property is an Array of channel buffers, whose length is the number of channels
specified by the descriptor. Each channel buffer is a Vector of Numbers, whose elements
are the individual samples for that channel, ranging between -1 and +1.
Property | Defined By | ||
---|---|---|---|
channelData : Array Array of Vectors of data samples as Numbers, one Vector per channel. | Sample | ||
channels : Number [read-only]
The number of channels in this sample
| Sample | ||
descriptor : AudioDescriptor [read-only]
The AudioDescriptor describing the audio characteristics of this source. | Sample | ||
duration : Number [read-only]
Return duration in seconds
| Sample | ||
frameCount : Number
The number of sample frames in this source. | Sample | ||
position : Number
The position of the audio cursor in this source, as a frame index. | Sample |
Method | Defined By | ||
---|---|---|---|
Sample(descriptor:AudioDescriptor, frames:Number = -1)
Construct a new, empty Sample with some specified audio format. | Sample | ||
clear():void
Clear this sample. | Sample | ||
Clone this Sample. | Sample | ||
getChannelSample(channel:Number, index:Number):Number
Return a sample for the given channel and frame index
| Sample | ||
getInterpolatedSample(channel:Number, pos:Number):Number
Return an interpolated sample for a non-integral sample position. | Sample | ||
Retrieve a number of sample frames from this source as a Sample object,
starting from the audio cursor position. | Sample | ||
getSampleRange(fromOffset:Number, toOffset:Number):Sample
Return a Sample representing a concrete subrange of this source. | Sample | ||
resetPosition():void
Resets the audio cursor to the beginning of the source, and causes any
cursor-dependent state in the source to be initialized. | Sample |
channelData | property |
public var channelData:Array
Array of Vectors of data samples as Numbers, one Vector per channel.
channels | property |
channels:Number
[read-only] The number of channels in this sample
public function get channels():Number
descriptor | property |
descriptor:AudioDescriptor
[read-only] The AudioDescriptor describing the audio characteristics of this source.
public function get descriptor():AudioDescriptor
duration | property |
duration:Number
[read-only] Return duration in seconds
public function get duration():Number
frameCount | property |
frameCount:Number
The number of sample frames in this source. An unbounded source may return Number.MAX_VALUE.
public function get frameCount():Number
public function set frameCount(value:Number):void
position | property |
position:Number
The position of the audio cursor in this source, as a frame index.
public function get position():Number
public function set position(value:Number):void
Sample | () | Constructor |
public function Sample(descriptor:AudioDescriptor, frames:Number = -1)
Construct a new, empty Sample with some specified audio format.
Parametersdescriptor:AudioDescriptor — an AudioDescriptor specifying the audio format of this sample.
| |
frames:Number (default = -1 ) — the number of frames in this Sample. If omitted or negative, no channel
data vectors are created. If zero, then zero-length vectors are created and may be
grown in size. If positive, then fixed-size vectors are created, and will contain zeroes.
|
clear | () | method |
public function clear():void
Clear this sample.
clone | () | method |
public function clone():IAudioSource
Clone this Sample. Note that the channel data is shared between the original and the clone, since channel data inside a Sample should never be mutated except for temporary Samples used inside a filter pipeline.
ReturnsIAudioSource |
getChannelSample | () | method |
public function getChannelSample(channel:Number, index:Number):Number
Return a sample for the given channel and frame index
Parameters
channel:Number — the channel index of the sample
| |
index:Number — the frame index of the sample within that channel
|
Number |
getInterpolatedSample | () | method |
public function getInterpolatedSample(channel:Number, pos:Number):Number
Return an interpolated sample for a non-integral sample position. Interpolation is always done within the same channel.
Parameters
channel:Number | |
pos:Number |
Number |
getSample | () | method |
public function getSample(numFrames:Number):Sample
Retrieve a number of sample frames from this source as a Sample object,
starting from the audio cursor position. It is not legal to request frames
beyond the maximum index indicated by the frameCount
property.
Parameters
numFrames:Number — an integral number of frames.
|
Sample — a Sample object containing the requested sample frames.
|
getSampleRange | () | method |
public function getSampleRange(fromOffset:Number, toOffset:Number):Sample
Return a Sample representing a concrete subrange of this source.
Parameters
fromOffset:Number — the starting point of the range (inclusive)
| |
toOffset:Number — the endpoint of the range (exclusive)
|
Sample |
resetPosition | () | method |
public function resetPosition():void
Resets the audio cursor to the beginning of the source, and causes any cursor-dependent state in the source to be initialized.