Mercurial > hg > Game > WebGL
view Vacuum/resources/music.js @ 0:718974a1a32b
Vacuum
author | <e085737> |
---|---|
date | Tue, 07 Dec 2010 17:31:15 +0900 |
parents | |
children |
line wrap: on
line source
/**音を鳴らす為の関数**/ //usage ////var sample = MusicLoad("./sound/sample.wav"); ////BgmPlay(sample,"on"); ////---------------------------------------------- ////MusicLoad load a music file ////BgmPlay play music with loop ////SoundPlay play sound onetime // // //// prototype ////readonly attribute MediaError error; ////void play(); ////void pause(); ////interface HTMLAudioElement : HTMLMediaElement {}; ////Audio ////attribute DOMString src; ////attribute DOMString preload; ////attribute boolean autoplay; ////attribute boolean loop; ////attribute boolean controls; function MusicLoad(src){ var audio =new Audio(src) return(audio) } function MusicReLoad(src){ var audio = new Audio(src) return(audio) } function BgmPlay(audio,sta){ if(sta =="on"){ audio.play() audio.loop=true }else if( sta =="off" ){ audio.pause() } } function SoundPlay(audio){ audio.play() }