Package | away3d.audio |
Class | public class Sound3D |
Inheritance | Sound3D ObjectContainer3D Object3D NamedAssetBase flash.events.EventDispatcher |
A sound source/emitter object that can be positioned in 3D space, and from which all audio playback will be transformed to simulate orientation.
The Sound3D object works much in the same fashion as primitives, lights and cameras, in that it can be added to a scene and positioned therein. It is the main object, in the 3D sound API, which the programmer will interact with.
Actual sound transformation is performed by a driver object, which is defined at the time of creation by the driver ini variable, the default being a simple pan/volume driver.
See also
Property | Defined By | ||
---|---|---|---|
assetFullPath : Array [read-only] | NamedAssetBase | ||
assetNamespace : String [read-only] | NamedAssetBase | ||
assetType : String [read-only] | ObjectContainer3D | ||
backVector : Vector3D [read-only]
| Object3D | ||
downVector : Vector3D [read-only]
| Object3D | ||
eulers : Vector3D
Defines the rotation of the 3d object as a Vector3D object containing euler angles for rotation around x, y and z axis. | Object3D | ||
extra : Object
An object that can contain any extra data. | Object3D | ||
forwardVector : Vector3D [read-only]
| Object3D | ||
inverseSceneTransform : Matrix3D [read-only]
The inverse scene transform object that transforms from world to model space. | ObjectContainer3D | ||
leftVector : Vector3D [read-only]
| Object3D | ||
maxX : Number [read-only]
The maximum extremum of the object along the X-axis. | ObjectContainer3D | ||
maxY : Number [read-only]
The maximum extremum of the object along the Y-axis. | ObjectContainer3D | ||
maxZ : Number [read-only]
The maximum extremum of the object along the Z-axis. | ObjectContainer3D | ||
minX : Number [read-only]
The minimum extremum of the object along the X-axis. | ObjectContainer3D | ||
minY : Number [read-only]
The minimum extremum of the object along the Y-axis. | ObjectContainer3D | ||
minZ : Number [read-only]
The minimum extremum of the object along the Z-axis. | ObjectContainer3D | ||
mouseChildren : Boolean | ObjectContainer3D | ||
mouseEnabled : Boolean
Indicates whether the IRenderable should trigger mouse events, and hence should be rendered for hit testing. | ObjectContainer3D | ||
name : String | NamedAssetBase | ||
numChildren : uint [read-only]
The amount of child objects of the ObjectContainer3D. | ObjectContainer3D | ||
originalName : String [read-only]
The original name used for this asset in the resource (e.g. | NamedAssetBase | ||
parent : ObjectContainer3D [read-only]
The parent ObjectContainer3D to which this object's transformation is relative. | ObjectContainer3D | ||
partition : Partition3D
The space partition to be used by the object container and all its recursive children, unless it has its own
space partition assigned. | ObjectContainer3D | ||
paused : Boolean [read-only]
Returns a boolean indicating whether or not playback is currently
paused. | Sound3D | ||
pivotPoint : Vector3D
Defines the local point around which the object rotates. | Object3D | ||
playing : Boolean [read-only]
Returns a boolean indicating whether or not the sound is currently
playing. | Sound3D | ||
position : Vector3D
Defines the position of the 3d object, relative to the local coordinates of the parent ObjectContainer3D. | Object3D | ||
rightVector : Vector3D [read-only]
| Object3D | ||
rotationX : Number
Defines the euler angle of rotation of the 3d object around the x-axis, relative to the local coordinates of the parent ObjectContainer3D. | Object3D | ||
rotationY : Number
Defines the euler angle of rotation of the 3d object around the y-axis, relative to the local coordinates of the parent ObjectContainer3D. | Object3D | ||
rotationZ : Number
Defines the euler angle of rotation of the 3d object around the z-axis, relative to the local coordinates of the parent ObjectContainer3D. | Object3D | ||
scaleDistance : Number
Defines a scale value used by the driver when adjusting sound
intensity to simulate distance. | Sound3D | ||
scaleX : Number
Defines the scale of the 3d object along the x-axis, relative to local coordinates. | Object3D | ||
scaleY : Number
Defines the scale of the 3d object along the y-axis, relative to local coordinates. | Object3D | ||
scaleZ : Number
Defines the scale of the 3d object along the z-axis, relative to local coordinates. | Object3D | ||
scene : Scene3D
A reference to the Scene3D object to which this object belongs. | ObjectContainer3D | ||
scenePosition : Vector3D [read-only]
The global position of the ObjectContainer3D in the scene. | ObjectContainer3D | ||
sceneTransform : Matrix3D [read-only]
The transformation matrix that transforms from model to world space. | ObjectContainer3D | ||
transform : Matrix3D
The transformation of the 3d object, relative to the local coordinates of the parent ObjectContainer3D. | Object3D | ||
upVector : Vector3D [read-only]
| Object3D | ||
visible : Boolean | ObjectContainer3D | ||
volume : Number
Defines the overall (master) volume of the 3D sound, after any
positional adjustments to volume have been applied. | Sound3D | ||
x : Number
Defines the x coordinate of the 3d object relative to the local coordinates of the parent ObjectContainer3D. | Object3D | ||
y : Number
Defines the y coordinate of the 3d object relative to the local coordinates of the parent ObjectContainer3D. | Object3D | ||
z : Number
Defines the z coordinate of the 3d object relative to the local coordinates of the parent ObjectContainer3D. | Object3D |
Method | Defined By | ||
---|---|---|---|
Sound3D(sound:Sound, reference:ObjectContainer3D, driver:ISound3DDriver = null, volume:Number = 1, scale:Number = 1000)
Create a Sound3D object, representing the sound source used for playback of a flash Sound object. | Sound3D | ||
Adds a child ObjectContainer3D to the current object. | ObjectContainer3D | ||
addChildren(... childarray):void
Adds an array of 3d objects to the scene as children of the container
| ObjectContainer3D | ||
addEventListener(type:String, listener:Function, useCapture:Boolean = false, priority:int = 0, useWeakReference:Boolean = false):void [override] | ObjectContainer3D | ||
assetPathEquals(name:String, ns:String):Boolean | NamedAssetBase | ||
[override]
Clones this ObjectContainer3D instance along with all it's children, and
returns the result (which will be a copy of this container, containing copies
of all it's children.)
| ObjectContainer3D | ||
contains(child:ObjectContainer3D):Boolean | ObjectContainer3D | ||
dispatchEvent(event:Event):Boolean [override]
| ObjectContainer3D | ||
dispose():void [override]
Cleans up resources used by this asset. | ObjectContainer3D | ||
disposeAsset():void | Object3D | ||
getChildAt(index:uint):ObjectContainer3D
Retrieves the child object at the given index. | ObjectContainer3D | ||
lookAt(target:Vector3D, upAxis:Vector3D = null):void [override]
Rotates the 3d object around to face a point defined relative to the local coordinates of the parent ObjectContainer3D. | ObjectContainer3D | ||
moveBackward(distance:Number):void
Moves the 3d object backwards along it's local z axis
| Object3D | ||
moveDown(distance:Number):void
Moves the 3d object backwards along it's local y axis
| Object3D | ||
moveForward(distance:Number):void
Moves the 3d object forwards along it's local z axis
| Object3D | ||
moveLeft(distance:Number):void
Moves the 3d object backwards along it's local x axis
| Object3D | ||
movePivot(dx:Number, dy:Number, dz:Number):void
Moves the local point around which the object rotates. | Object3D | ||
moveRight(distance:Number):void
Moves the 3d object forwards along it's local x axis
| Object3D | ||
moveTo(dx:Number, dy:Number, dz:Number):void
Moves the 3d object directly to a point in space
| Object3D | ||
moveUp(distance:Number):void
Moves the 3d object forwards along it's local y axis
| Object3D | ||
pause():void
Pause playback. | Sound3D | ||
pitch(angle:Number):void
Rotates the 3d object around it's local x-axis
| Object3D | ||
play():void
Start (or resume, if paused) playback. | Sound3D | ||
removeChild(child:ObjectContainer3D):void
Removes a 3d object from the child array of the container
| ObjectContainer3D | ||
removeEventListener(type:String, listener:Function, useCapture:Boolean = false):void [override] | ObjectContainer3D | ||
resetAssetPath(name:String, ns:String = null, overrideOriginal:Boolean = true):void | NamedAssetBase | ||
roll(angle:Number):void
Rotates the 3d object around it's local z-axis
| Object3D | ||
rotate(axis:Vector3D, angle:Number):void [override] | ObjectContainer3D | ||
rotateTo(ax:Number, ay:Number, az:Number):void
Rotates the 3d object directly to a euler angle
| Object3D | ||
scale(value:Number):void
Appends a uniform scale to the current transformation. | Object3D | ||
stop():void
Stop and rewind sound file. | Sound3D | ||
togglePlayPause():void
Alternate between pausing and resuming playback of this sound. | Sound3D | ||
translate(axis:Vector3D, distance:Number):void
Moves the 3d object along a vector by a defined length
| Object3D | ||
translateLocal(axis:Vector3D, distance:Number):void [override] | ObjectContainer3D | ||
updateImplicitVisibility():void | ObjectContainer3D | ||
yaw(angle:Number):void
Rotates the 3d object around it's local y-axis
| Object3D |
Event | Summary | Defined By | ||
---|---|---|---|---|
Dispatched when a user presses the left hand mouse button while the cursor is over the 3d object. | ObjectContainer3D | |||
Dispatched when a user moves the cursor while it is over the 3d object. | ObjectContainer3D | |||
Dispatched when a user moves the cursor away from the 3d object. | ObjectContainer3D | |||
Dispatched when a user moves the cursor over the 3d object. | ObjectContainer3D | |||
Dispatched when a user releases the left hand mouse button while the cursor is over the 3d object. | ObjectContainer3D | |||
Dispatched when the position of the 3d object changes. | Object3D | |||
Dispatched when the rotation of the 3d object changes. | Object3D | |||
Dispatched when the scale of the 3d object changes. | Object3D | |||
Dispatched when the parent scene of the 3d object changes. | ObjectContainer3D | |||
Dispatched when the scene transform matrix of the 3d object changes. | ObjectContainer3D | |||
Dispatched when end of sound stream is reached (bubbled from the internal sound object). | Sound3D |
paused | property |
paused:Boolean
[read-only] Returns a boolean indicating whether or not playback is currently paused.
public function get paused():Boolean
playing | property |
playing:Boolean
[read-only] Returns a boolean indicating whether or not the sound is currently playing.
public function get playing():Boolean
scaleDistance | property |
scaleDistance:Number
Defines a scale value used by the driver when adjusting sound intensity to simulate distance. The default number of 1000 means that sound volume will near the hearing threshold as the distance between listener and sound source approaches 1000 Away3D units.
public function get scaleDistance():Number
public function set scaleDistance(value:Number):void
See also
volume | property |
volume:Number
Defines the overall (master) volume of the 3D sound, after any positional adjustments to volume have been applied. This value can equally well be cotrolled by modifying the volume property on the driver used by this Sound3D instance.
public function get volume():Number
public function set volume(value:Number):void
See also
Sound3D | () | Constructor |
public function Sound3D(sound:Sound, reference:ObjectContainer3D, driver:ISound3DDriver = null, volume:Number = 1, scale:Number = 1000)
Create a Sound3D object, representing the sound source used for playback of a flash Sound object.
Parameterssound:Sound — The flash Sound object that is played back from this Sound3D object's position.
For realistic results, this should be a mono (single-channel, non-stereo) sound stream.
| |
reference:ObjectContainer3D — The reference, or "listener" object, typically a camera.
| |
driver:ISound3DDriver (default = null ) — Sound3D driver to use when applying simulation effects. Defaults to SimplePanVolumeDriver.
| |
volume:Number (default = 1 ) — [optional] An initialisation object for specifying default instance properties.
| |
scale:Number (default = 1000 )
|
pause | () | method |
public function pause():void
Pause playback. Resume using play().
play | () | method |
public function play():void
Start (or resume, if paused) playback.
stop | () | method |
public function stop():void
Stop and rewind sound file. Replay (from the beginning) using play(). To temporarily pause playback, allowing you to resume from the same point, use pause() instead.
See also
togglePlayPause | () | method |
public function togglePlayPause():void
Alternate between pausing and resuming playback of this sound. If called while sound is paused (or stopped), this will resume playback. When called during playback, it will pause it.
soundComplete | Event |
flash.events.Event
Dispatched when end of sound stream is reached (bubbled from the internal sound object).