LzAudio

Audio playback service.

The audio service manages the playback of sound. It maintains the notion of a current sound. You can set the current sound and start playing it using the LzAudio.playSound() API. See the audio example. Also see the <resource> tag for for details on audio resources and see the music example for streaming media.

<canvas height="20">
  <resource src="resources/poof.mp3" name="poof"/>
  <button text="Poof"
           onclick="LzAudio.playSound('poof');"/>
</canvas>

Methods

getPan()
LzAudio.getPan(t)

Get the global pan.

Parameters
Name Type Desc
t None
Returns
Type Desc
Number linear pan from -100 to +100 (left to right)


getVolume()
LzAudio.getVolume(t)

Get the global volume

Parameters
Name Type Desc
t Object MovieClip for sound to act upon
Returns
Type Desc
Number volume from 0 to 100 (0 is silent).


playSound()
LzAudio.playSound(snd, t)

Sets the current sound resource and starts playing it.

Parameters
Name Type Desc
snd String Name of a sound resource to play
t None


setPan()
LzAudio.setPan(p, t)

Set the global pan.

Parameters
Name Type Desc
p Number linear pan from -100 to +100 (left to right)
t None


setVolume()
LzAudio.setVolume(v, t)

Set the global volume.

Parameters
Name Type Desc
v Number linear volume from 0 to 100 (0 is silent).
t None


startSound()
LzAudio.startSound(t)

Start playing the current sound

Parameters
Name Type Desc
t None


stopSound()
LzAudio.stopSound(t)

Stop playing the current sound

Parameters
Name Type Desc
t None