A class for sound and music files.
new gamvas.Actor(file);
file | a JavaScript Audio class |
myState = gamvas.State.extend({ init: function() { this.sound = this.addSound("introsound.wav"); }, onKeyDown: function() { this.sound.play(); } });
gamvas. | A class for sound and music files. |
Functions | |
play | Play the sound once, restarts the sound automatically |
loop | Play the sound looping (e.g. |
stop | Stops a playing sound |
resume | Resumes a stopped sound, without rewinding it |
setRate | Set the playback speed of the sound |
setVolume | Set the volume of the sound |
mute | Mute the sound |
unmute | Unmute the sound |
isReady | Test if the sound is ready to play |
Play the sound once, restarts the sound automatically
gamvas.Sound.prototype.play = function()
Play the sound looping (e.g.
gamvas.Sound.prototype.loop = function()
Stops a playing sound
gamvas.Sound.prototype.stop = function()
Resumes a stopped sound, without rewinding it
gamvas.Sound.prototype.resume = function()
Set the playback speed of the sound
gamvas.Sound.prototype.setRate = function( r )
Set the volume of the sound
gamvas.Sound.prototype.setVolume = function( v )
Mute the sound
gamvas.Sound.prototype.mute = function()
Unmute the sound
gamvas.Sound.prototype.unmute = function()
Test if the sound is ready to play
gamvas.Sound.prototype.isReady = function()
Add a gamvas.Sound to the state.
addSound: function( snd )