Mercurial > hg > Game > WebGL
comparison Vacuum/resources/music.js @ 0:718974a1a32b
Vacuum
author | <e085737> |
---|---|
date | Tue, 07 Dec 2010 17:31:15 +0900 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:718974a1a32b |
---|---|
1 /**音を鳴らす為の関数**/ | |
2 | |
3 //usage | |
4 ////var sample = MusicLoad("./sound/sample.wav"); | |
5 ////BgmPlay(sample,"on"); | |
6 ////---------------------------------------------- | |
7 ////MusicLoad load a music file | |
8 ////BgmPlay play music with loop | |
9 ////SoundPlay play sound onetime | |
10 // | |
11 // | |
12 //// prototype | |
13 ////readonly attribute MediaError error; | |
14 ////void play(); | |
15 ////void pause(); | |
16 ////interface HTMLAudioElement : HTMLMediaElement {}; | |
17 ////Audio | |
18 ////attribute DOMString src; | |
19 ////attribute DOMString preload; | |
20 ////attribute boolean autoplay; | |
21 ////attribute boolean loop; | |
22 ////attribute boolean controls; | |
23 | |
24 function MusicLoad(src){ | |
25 var audio =new Audio(src) | |
26 return(audio) | |
27 } | |
28 | |
29 function MusicReLoad(src){ | |
30 var audio = new Audio(src) | |
31 return(audio) | |
32 } | |
33 | |
34 function BgmPlay(audio,sta){ | |
35 if(sta =="on"){ | |
36 audio.play() | |
37 audio.loop=true | |
38 }else if( sta =="off" ){ | |
39 audio.pause() | |
40 } | |
41 } | |
42 | |
43 function SoundPlay(audio){ | |
44 audio.play() | |
45 } | |
46 |