private static void playres(Resource res) {
   Collection<Resource.Audio> clips = res.layers(Resource.audio);
   int s = (int) (Math.random() * clips.size());
   Resource.Audio clip = null;
   for (Resource.Audio cp : clips) {
     clip = cp;
     if (--s < 0) break;
   }
   if (clip != null) {
     play(clip.clip);
   }
 }
 public static void main(String[] args) throws Exception {
   Collection<DataClip> clips = new LinkedList<DataClip>();
   for (int i = 0; i < args.length; i++) {
     if (args[i].equals("-b")) {
       bufsize = Integer.parseInt(args[++i]);
     } else {
       DataClip c = new DataClip(new java.io.FileInputStream(args[i]));
       clips.add(c);
     }
   }
   for (DataClip c : clips) play(c);
   for (DataClip c : clips) c.finwait();
 }
 public static void play(byte[] clip) {
   play(clip, CustomConfig.getSFXVolume(), 1.0);
 }
 public static void play(byte[] clip, double vol, double sp) {
   play(new DataClip(new java.io.ByteArrayInputStream(clip), vol, sp));
 }
 public static void play(final InputStream clip, final double vol, final double sp) {
   play(new DataClip(clip, vol, sp));
 }
Exemple #6
0
 public void notify(Channel chan, Channel.Message msg) {
   synchronized (notifs) {
     notifs.addFirst(new Notification(chan, msg));
   }
   Audio.play(notifsfx);
 }