Packagecom.noteflight.standingwave2.output
Classpublic class AudioPlayer
InheritanceAudioPlayer Inheritance flash.events.EventDispatcher

An AudioPlayer streams samples from an IAudioSource to a Sound object using a SampleDataEvent listener. It does so using a preset number of frames per callback, and continues streaming the output until it is stopped, or until there is no more audio output obtainable from the IAudioSource.



Public Properties
 PropertyDefined By
  channel : SoundChannel
[read-only] The SoundChannel currently employed for playback, or null if there is none.
AudioPlayer
  cpuPercentage : Number
[read-only] The estimated percentage of CPU resources being consumed by sound synthesis.
AudioPlayer
  latency : Number
[read-only] The estimated time between a SampleDataEvent and the actual production of the sound provided to that event, if known.
AudioPlayer
  position : Number
[read-only] The actual playback position in seconds, relative to the start of the current source.
AudioPlayer
  source : IAudioSource
[read-only] The source currently being played by this object, or null if there is none.
AudioPlayer
  volume : Number
AudioPlayer
Public Methods
 MethodDefined By
  
AudioPlayer(framesPerCallback:Number = 4096)
Construct a new AudioPlayer instance.
AudioPlayer
  
play(source:IAudioSource, volume:Number):void
Play an audio source through this output.
AudioPlayer
  
stop(source:IAudioSource = null):void
Stop a given source (if supplied), or stop any source that is playing (if no source parameter is supplied).
AudioPlayer
Events
 Event Summary Defined By
  AudioPlayer
Property Detail
channelproperty
channel:SoundChannel  [read-only]

The SoundChannel currently employed for playback, or null if there is none.


Implementation
    public function get channel():SoundChannel
cpuPercentageproperty 
cpuPercentage:Number  [read-only]

The estimated percentage of CPU resources being consumed by sound synthesis.

This property can be used as the source for data binding.


Implementation
    public function get cpuPercentage():Number
latencyproperty 
latency:Number  [read-only]

The estimated time between a SampleDataEvent and the actual production of the sound provided to that event, if known. The time is expressed in seconds.

This property can be used as the source for data binding.


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

The actual playback position in seconds, relative to the start of the current source.

This property can be used as the source for data binding.


Implementation
    public function get position():Number
sourceproperty 
source:IAudioSource  [read-only]

The source currently being played by this object, or null if there is none.


Implementation
    public function get source():IAudioSource
volumeproperty 
volume:Number


Implementation
    public function get volume():Number
    public function set volume(value:Number):void
Constructor Detail
AudioPlayer()Constructor
public function AudioPlayer(framesPerCallback:Number = 4096)

Construct a new AudioPlayer instance.

Parameters
framesPerCallback:Number (default = 4096) — the number of frames that this AudioPlayer will obtain for playback on each SampleDataEvent emitted by the playback Sound object.
Method Detail
play()method
public function play(source:IAudioSource, volume:Number):void

Play an audio source through this output. Only one source may be played at a time.

Parameters

source:IAudioSource — an IAudioSource instance
 
volume:Number

stop()method 
public function stop(source:IAudioSource = null):void

Stop a given source (if supplied), or stop any source that is playing (if no source parameter is supplied).

Parameters

source:IAudioSource (default = null) — an optional IAudioSource instance

Event Detail
complete Event
Event Object Type: flash.events.Event