Packagede.popforge.audio.output
Classpublic class AudioBuffer

The class AudioBuffer creates an endless AudioStream as long as the buffer is updated with new samples



Public Properties
 PropertyDefined by
  isInit : Boolean
[read-only] Returns true, if the AudioBuffer is inited
AudioBuffer
  leftPeak : Number
[read-only] Returns current peak(left)
AudioBuffer
  millisEachBuffer : Number
[read-only] Returns number of milliseconds of each buffer
AudioBuffer
  numSamples : uint
[read-only] Returns number of samples
AudioBuffer
  onComplete : Function
Stores a delegate function called, when the AudioBuffer has complete its cycle.
AudioBuffer
  onInit : Function
Stores a delegate function called, when the AudioBuffer is inited.
AudioBuffer
  onStart : Function
Stores a delegate function called, when the AudioBuffer is started.
AudioBuffer
  onStop : Function
Stores a delegate function called, when the AudioBuffer is stopped.
AudioBuffer
  rightPeak : Number
[read-only] Returns current peak(right)
AudioBuffer
Public Methods
 MethodDefined by
  
AudioBuffer(multiple:uint, channels:uint, bits:uint, rate:uint)
Creates an AudioBuffer instance.
AudioBuffer
  
getBits():uint
Returns number of bits.
AudioBuffer
  
getChannels():uint
Returns number of channels.
AudioBuffer
  
getMultiple():uint
Returns length of the buffer (sampleNum / UNIT_SAMPLES_NUM)
AudioBuffer
  
getRate():uint
Returns samplingRate in Hz
AudioBuffer
  
getSamples():Array
Returns samples for overriding with new amplitudes
AudioBuffer
  
isPlaying():Boolean
Returns true, if the AudioBuffer is playing
AudioBuffer
  
setBits(bits:uint):void
Sets the number of bits.
AudioBuffer
  
setChannels(channels:uint):void
Sets the number of channels.
AudioBuffer
  
setMultiple(multiple:uint):void
Sets the length of the buffer.
AudioBuffer
  
setRate(rate:uint):void
Sets the samplingRate.
AudioBuffer
  
start():Boolean
Starts the AudioBuffer playback
AudioBuffer
  
stop():Boolean
Stops the AudioBuffer playback
AudioBuffer
  
update():ByteArray
Updates the AudioBuffer samples for the next playback cycle Must be called after the new samples are computed
AudioBuffer
Public Constants
 ConstantDefined by
  UNIT_SAMPLES_NUM : uint = 2048
[static] The internal minimal sound buffer length in samples(PC)
AudioBuffer
Property detail
isInitproperty
isInit:Boolean  [read-only]

Returns true, if the AudioBuffer is inited

Implementation
    public function get isInit():Boolean
leftPeakproperty 
leftPeak:Number  [read-only]

Returns current peak(left)

Implementation
    public function get leftPeak():Number
millisEachBufferproperty 
millisEachBuffer:Number  [read-only]

Returns number of milliseconds of each buffer

Implementation
    public function get millisEachBuffer():Number
numSamplesproperty 
numSamples:uint  [read-only]

Returns number of samples

Implementation
    public function get numSamples():uint
onCompleteproperty 
public var onComplete:Function

Stores a delegate function called, when the AudioBuffer has complete its cycle.

onInitproperty 
public var onInit:Function

Stores a delegate function called, when the AudioBuffer is inited.

onStartproperty 
public var onStart:Function

Stores a delegate function called, when the AudioBuffer is started.

onStopproperty 
public var onStop:Function

Stores a delegate function called, when the AudioBuffer is stopped.

rightPeakproperty 
rightPeak:Number  [read-only]

Returns current peak(right)

Implementation
    public function get rightPeak():Number
Constructor detail
AudioBuffer()constructor
public function AudioBuffer(multiple:uint, channels:uint, bits:uint, rate:uint)

Creates an AudioBuffer instance.

Parameters
multiple:uint — Defines the buffer length (4times recommended)
 
channels:uint — Mono(1) or Stereo(2)
 
bits:uint — 8bit(8) or 16bit(16)
 
rate:uint — SamplingRate 5512Hz, 11025Hz, 22050Hz, 44100Hz
Method detail
getBits()method
public function getBits():uint

Returns number of bits.

Returns
uint
getChannels()method 
public function getChannels():uint

Returns number of channels.

Returns
uint
getMultiple()method 
public function getMultiple():uint

Returns length of the buffer (sampleNum / UNIT_SAMPLES_NUM)

Returns
uint
getRate()method 
public function getRate():uint

Returns samplingRate in Hz

Returns
uint
getSamples()method 
public function getSamples():Array

Returns samples for overriding with new amplitudes

Returns
Array
isPlaying()method 
public function isPlaying():Boolean

Returns true, if the AudioBuffer is playing

Returns
Boolean
setBits()method 
public function setBits(bits:uint):void

Sets the number of bits. Stops AudioBuffer playback for new a init phase

Parameters
bits:uint
setChannels()method 
public function setChannels(channels:uint):void

Sets the number of channels. Stops AudioBuffer playback for new a init phase

Parameters
channels:uint
setMultiple()method 
public function setMultiple(multiple:uint):void

Sets the length of the buffer. Stops AudioBuffer playback for new a init phase

Parameters
multiple:uint
setRate()method 
public function setRate(rate:uint):void

Sets the samplingRate. Stops AudioBuffer playback for new a init phase

Parameters
rate:uint
start()method 
public function start():Boolean

Starts the AudioBuffer playback

Returns
Boolean
stop()method 
public function stop():Boolean

Stops the AudioBuffer playback

Returns
Boolean
update()method 
public function update():ByteArray

Updates the AudioBuffer samples for the next playback cycle Must be called after the new samples are computed

Returns
ByteArray
Constant detail
UNIT_SAMPLES_NUMconstant
public static const UNIT_SAMPLES_NUM:uint = 2048

The internal minimal sound buffer length in samples(PC)