- void musique()
- {
- ac1 = new AudioContext();
- ac2 = new AudioContext();
- try {
- // initialize our SamplePlayer, loading the file
- // indicated by the sourceFile string
- musique_menu = new SamplePlayer(ac1, new Sample(sketchPath("data/son/musique/Musique_menu.mp3")));
- son_tir1 = new SamplePlayer(ac2, new Sample(sketchPath("data/son/bruitage/Laser-Shot-1.mp3")));
- son_tir2 = new SamplePlayer(ac2, new Sample(sketchPath("data/son/bruitage/Laser-Shot-2.mp3")));
- }
- catch(Exception e)
- {
- println("Exception while attempting to load sample!");
- e.printStackTrace();
- exit();
- }
- musique_menu.setKillOnEnd(false);
- g_musique = new Gain(ac1, 1, 0.05);
- g_son = new Gain(ac2, 1, 0.05);
- son_tir1.setLoopType(SamplePlayer.LoopType.LOOP_FORWARDS);
- g_musique.addInput(musique_menu);
- g_son.addInput(son_tir1);
- g_son.addInput(son_tir2);
- ac1.out.addInput(g_musique);
- ac2.out.addInput(son_tir1);
- ac2.out.addInput(son_tir2);
- ac1.start();
- ac2.start();
- }