Exemplo n.º 1
0
 /** Stop all synths other than personal. */
 public void stopAllOutsideAudio() {
   Collection<GeoSynth> places = owner.getAuraManager().getDestinations().values();
   for (GeoSynth place : places) {
     if (place.play == true) {
       stopAudio(place.index);
       place.play = false;
     }
   }
 }
Exemplo n.º 2
0
 /**
  * put all of the compiled synth definitions from assets in the filesystem
  *
  * @param directory to place synths
  */
 public void deliverSynthDefs(String directory) { // "" defaults to assets folder
   try {
     String[] names = owner.getAssets().list(directory);
     for (String filename : names) {
       if (filename.contains(".scsyndef")) { // we only want .scsyndef files
         deliverSynthDef(filename);
         // Toast.makeText(this, filename, 3000).show();
       }
     }
   } catch (IOException e) {
     Toast.makeText(owner, e.getMessage(), 3000).show();
   }
 }
Exemplo n.º 3
0
 /**
  * Sets up the SC Manager - could not be called in constructor because this is a static instance.
  *
  * @param owner AuRal main activity
  */
 public void setOwner(AuRal owner) {
   this.owner = owner;
   // adding in all of the user's synthDefs
   deliverSynthDefs("");
   // start up the SC audio
   new Thread() {
     public void run() {
       setSc(new SCAudio(dllDirStr));
       getSc().start();
     }
   }.run();
   setSelectedSynth(owner.getPreferences().getString("listPref", "default"));
   if (owner.getPreferences().getBoolean("play_personal_audio", false) == true)
     getSc()
         .sendMessage(
             new OscMessage(
                 new Object[] {"s_new", getSelectedSynth().replace(".scsyndef", ""), 100, 0, 1}));
   else
     getSc()
         .sendMessage(
             new OscMessage(
                 new Object[] {"s_new", getSelectedSynth().replace(".scsyndef", ""), 100, 0, 0}));
 }
Exemplo n.º 4
0
 /**
  * put the new definition in the filesystem
  *
  * @param s synth to open
  */
 public void deliverSynthDef(String s) { // expecting s to be of form: *.scsyndef
   try {
     InputStream is = owner.getAssets().open(s);
     OutputStream os = new FileOutputStream("/sdcard/supercollider/synthdefs/" + s);
     byte[] buf = new byte[1024];
     int bytesRead = 0;
     while (-1 != (bytesRead = is.read(buf))) {
       os.write(buf, 0, bytesRead);
     }
     is.close();
     os.close();
   } catch (Exception e) {
     e.printStackTrace();
   }
 }