1. import beads.*;
  2. AudioContext ac;
  3. SamplePlayer musique_menu, son_tir1, son_tir2;
  4. Gain musiqueGain, sonGain;
  5. void setup()
  6. {
  7. ac = new AudioContext();
  8. try {
  9. musique_menu = new SamplePlayer(ac, new Sample(sketchPath("data/son/musique/menu.mp3")));
  10. son_tir1 = new SamplePlayer(ac, new Sample(sketchPath("data/son/bruitage/Laser-Shot-1.mp3")));
  11. son_tir2 = new SamplePlayer(ac, new Sample(sketchPath("data/son/bruitage/Laser-Shot-2.mp3")));
  12. }
  13. catch(Exception e)
  14. {
  15. //
  16. }
  17. son_tir1.setKillOnEnd(false);
  18. son_tir2.setKillOnEnd(false);
  19. musique_menu.setKillOnEnd(false);
  20. musiqueGain = new Gain(ac, 1, 1/1000); //0.05)
  21. sonGain = new Gain(ac, 1, 1/1000); //0)
  22. musique_menu.setLoopType(SamplePlayer.LoopType.LOOP_FORWARDS);
  23. musiqueGain.addInput(musique_menu);
  24. sonGain.addInput(son_tir1);
  25. sonGain.addInput(son_tir2);
  26. ac.out.addInput(musiqueGain);
  27. ac.out.addInput(sonGain);
  28. ac.start();
  29. musique_menu.reTrigger();
  30. }
  31. void draw()
  32. {
  33. }
Comments powered by Disqus