Static methods

staticfromSamplesBuffer(buffer:Float32Array, samples:Int, channels:Int, sampleRate:Float, interleaved:Bool):Sound

Create a new sound from the given samples buffer

Parameters:

buffer

Float32Array containing the raw PCM samples

samples

Number of sample frames (samples per channel)

channels

Number of audio channels (1 = mono, 2 = stereo, etc.)

sampleRate

Sample rate in Hz (e.g., 44100)

interleaved

Whether the PCM data is interleaved (LRLRLR...) or planar (LLL...RRR...)

Constructor

new(backendItem:AudioResource)

Variables

@:value(0)bus:Int = 0

Default bus to play this sound on (0-based)

@:value(0)group:Int = 0

@:value(0.5)volume:Float = 0.5

Default volume when playing this sound.

@:value(0)pan:Float = 0

Default pan when playing this sound.

@:value(1)pitch:Float = 1

Default pitch when playing this sound.

read onlyduration:Float

Sound duration.

Methods

@:value({ loop : false, position : 0 })play(position:Float = 0, loop:Bool = false, ?volume:Float, ?pan:Float, ?pitch:Float, ?bus:Int):SoundPlayer

Play the sound at requested position. If volume/pan/pitch are not provided, sound instance properties will be used instead.

Parameters:

position

Start position in seconds

loop

Whether to loop the sound

volume

Volume (0-1)

pan

Pan (-1 to 1)

pitch

Pitch multiplier

bus

Bus to play on (defaults to sound's bus property)

Inherited Events

Defined by Entity

@:dox(show)dispose(entity:Entity):Void

@:dox(show)destroy(entity:Entity):Void

Inherited Variables

Defined by Entity

@:value(null)id:String = null

read onlydestroyed:Bool

read onlydisposed:Bool

@:value(null)read onlyautoruns:Array<Autorun> = null

components:ReadOnlyMap<String, Component>

Public components mapping. Contain components created separately with component() or macro-based components as well.

scriptContent:ScriptContent

Available with script plugin

script:Script

Available with script plugin

Inherited Methods

Defined by Entity

dispose():Void

Schedules destroy, at the end of the current frame.

unbindEvents():Void

Remove all events handlers from this entity.

autorun(run:() ‑> Void, ?afterRun:() ‑> Void):Autorun

Creates a new Autorun instance with the given callback associated with the current entity.

Parameters:

run

The run callback

Returns:

The autorun instance

tween(?easing:Easing, duration:Float, fromValue:Float, toValue:Float, update:(Float, Float) ‑> Void):Tween

Start a tween associated with this entity.

Parameters:

easing

The easing to use

duration

The duration of the tween

fromValue

The start value of the tween

toValue

The end value of the tween

update

An update function called at each iteration of the tween

Returns:

The instance of the created Tween object

eagerTween(?easing:Easing, duration:Float, fromValue:Float, toValue:Float, update:(Float, Float) ‑> Void):Tween

Start an eager tween associated with this entity. This is the same as a regular tween, except that it will start updating itself using current frame's delta time instead of next frame like in a regular tween.

Parameters:

easing

The easing to use

duration

The duration of the tween

fromValue

The start value of the tween

toValue

The end value of the tween

update

An update function called at each iteration of the tween

Returns:

The instance of the created Tween object

@:value({ hasField : false })component<C>(?name:String, ?component:Null<C>, hasField:Bool = false):C