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:

  • SimplePanVolumeDriver

Constructor

@:value({ scale : 1000, volume : 1, driver : null })new(sound:Sound, reference:ObjectContainer3D, ?driver:ISound3DDriver, volume:Float = 1, scale:Float = 1000)

Create a Sound3D object, representing the sound source used for playback of a flash Sound object.

Parameters:

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

The reference, or "listener" object, typically a camera.

driver

Sound3D driver to use when applying simulation effects. Defaults to SimplePanVolumeDriver.

init

[optional] An initialisation object for specifying default instance properties.

Variables

read onlypaused:Bool

read onlyplaying:Bool

volume:Float

Methods

pause():Void

Pause playback. Resume using play().

play():Void

Start (or resume, if paused) playback.

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:

  • pause()

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.

Inherited Variables

Defined by ObjectContainer3D

read onlyassetType:String

read onlyinverseSceneTransform:Matrix3D

read onlymaxX:Float

read onlymaxY:Float

read onlymaxZ:Float

read onlyminX:Float

read onlyminY:Float

read onlyminZ:Float

read onlynumChildren:Int

read onlyscenePosition:Vector3D

read onlysceneTransform:Matrix3D

visible:Bool

Defined by Object3D

read onlybackVector:Vector3D

read onlydownVector:Vector3D

eulers:Vector3D

extra:Dynamic

An object that can contain any extra data.

read onlyforwardVector:Vector3D

read onlyleftVector:Vector3D

pivotPoint:Vector3D

position:Vector3D

read onlyrightVector:Vector3D

rotationX:Float

rotationY:Float

rotationZ:Float

scaleX:Float

scaleY:Float

scaleZ:Float

transform:Matrix3D

read onlyupVector:Vector3D

x:Float

y:Float

z:Float

Defined by NamedAssetBase

read onlyassetFullPath:Array<Dynamic>

read onlyassetNamespace:String

id:String

name:String

read onlyoriginalName:String

Inherited Methods

Defined by ObjectContainer3D

addChild(child:ObjectContainer3D):ObjectContainer3D

Adds a child ObjectContainer3D to the current object. The child's transformation will become relative to the current object's transformation.

Parameters:

child

The object to be added as a child.

Returns:

A reference to the added child object.

addChildren(childarray:Vector<ObjectContainer3D>):Void

Adds an array of 3d objects to the scene as children of the container

Parameters:

...childarray

An array of 3d objects to be added

clone():Object3D

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.)

dispatchEvent(event:Event):Bool

@inheritDoc

dispose():Void

@inheritDoc

disposeWithChildren():Void

Disposes the current ObjectContainer3D including all of its children. This is a merely a convenience method.

getChildAt(index:Int):ObjectContainer3D

Retrieves the child object at the given index.

Parameters:

index

The index of the object to be retrieved.

Returns:

The child object at the given index.

@:value({ upAxis : null })lookAt(target:Vector3D, ?upAxis:Vector3D):Void

@inheritDoc

removeChild(child:ObjectContainer3D):Void

Removes a 3d object from the child array of the container

Parameters:

child

The 3d object to be removed

Throws:

Error

ObjectContainer3D.removeChild(null)

removeChildAt(index:Int):Void

Removes a 3d object from the child array of the container

Parameters:

index

Index of 3d object to be removed

Defined by Object3D

disposeAsset():Void

@inheritDoc

@:value({ v : null })getPosition(?v:Vector3D):Vector3D

Defines the position of the 3d object, relative to the local coordinates of the parent ObjectContainer3D. @return

Parameters:

v

the destination Vector3D

moveBackward(distance:Float):Void

Moves the 3d object backwards along it's local z axis

Parameters:

distance

The length of the movement

moveDown(distance:Float):Void

Moves the 3d object backwards along it's local y axis

Parameters:

distance

The length of the movement

moveForward(distance:Float):Void

Moves the 3d object forwards along it's local z axis

Parameters:

distance

The length of the movement

moveLeft(distance:Float):Void

Moves the 3d object backwards along it's local x axis

Parameters:

distance

The length of the movement

movePivot(dx:Float, dy:Float, dz:Float):Void

Moves the local point around which the object rotates.

Parameters:

dx

The amount of movement along the local x axis.

dy

The amount of movement along the local y axis.

dz

The amount of movement along the local z axis.

moveRight(distance:Float):Void

Moves the 3d object forwards along it's local x axis

Parameters:

distance

The length of the movement

moveTo(dx:Float, dy:Float, dz:Float):Void

Moves the 3d object directly to a point in space

Parameters:

dx

The amount of movement along the local x axis.

dy

The amount of movement along the local y axis.

dz

The amount of movement along the local z axis.

moveUp(distance:Float):Void

Moves the 3d object forwards along it's local y axis

Parameters:

distance

The length of the movement

pitch(angle:Float):Void

Rotates the 3d object around it's local x-axis

Parameters:

angle

The amount of rotation in degrees

roll(angle:Float):Void

Rotates the 3d object around it's local z-axis

Parameters:

angle

The amount of rotation in degrees

rotateTo(ax:Float, ay:Float, az:Float):Void

Rotates the 3d object directly to a euler angle

Parameters:

ax

The angle in degrees of the rotation around the x axis.

ay

The angle in degrees of the rotation around the y axis.

az

The angle in degrees of the rotation around the z axis.

scale(value:Float):Void

Appends a uniform scale to the current transformation.

Parameters:

value

The amount by which to scale.

translate(axis:Vector3D, distance:Float):Void

Moves the 3d object along a vector by a defined length

Parameters:

axis

The vector defining the axis of movement

distance

The length of the movement

yaw(angle:Float):Void

Rotates the 3d object around it's local y-axis

Parameters:

angle

The amount of rotation in degrees

Defined by NamedAssetBase

assetPathEquals(name:String, ns:String):Bool

@:value({ overrideOriginal : true, ns : null })resetAssetPath(name:String, ?ns:String, overrideOriginal:Bool = true):Void