Shaku

Shaku JS

Back To Table of Content

Sound Mixer

SoundMixer

A utility class to mix between two sounds.

Kind: global class

new SoundMixer(sound1, sound2, allowOverlapping)

Create the sound mixer.

Param Type Description
sound1 SoundInstance Sound to mix from. Can be null to just fade in.
sound2 SoundInstance Sound to mix to. Can be null to just fade out.
allowOverlapping Boolean If true (default), will mix while overlapping sounds. If false, will first finish first sound before begining next.

soundMixer.fromSound ⇒ SoundInstance

Get first sound.

Kind: instance property of SoundMixer
Returns: SoundInstance - First sound instance.

soundMixer.toSound ⇒ SoundInstance

Get second sound.

Kind: instance property of SoundMixer
Returns: SoundInstance - Second sound instance.

soundMixer.progress ⇒ Number

Return current progress.

Kind: instance property of SoundMixer
Returns: Number - Mix progress from 0 to 1.

soundMixer.stop()

Stop both sounds.

Kind: instance method of SoundMixer

soundMixer.updateDelta(delta)

Update the mixer progress with time delta instead of absolute value.

Kind: instance method of SoundMixer

Param Type Description
delta Number Progress delta, in seconds.

soundMixer.update(progress)

Update the mixer progress.

Kind: instance method of SoundMixer

Param Type Description
progress Number Transition progress from sound1 to sound2. Values must be between 0.0 to 1.0.