@Override protected void onPause() { super.onPause(); if (pdman != null) pdman.onPause(); if (wl != null && wl.isHeld()) wl.release(); if (frag != null) frag.onPause(); }
@Override protected Void doInBackground(final Void... params) { startingup = true; Log.v("PlasmaSoundSetup", "creating pd"); // PD Stuff pdman = new PDManager(PDActivity.this); Log.v("PlasmaSoundSetup", "launching pd"); pdready = false; pdman.onResume(); Log.v("PlasmaSoundSetup", "Starting instrument"); // Make the Instrument inst = new Instrument(pdman); Log.v("PlasmaSoundSetup", "setting instrument patch"); inst.setPatch(PATCH_PATH); inst.setMidiMin(70); inst.setMidiMax(87); Log.v("PlasmaSoundSetup", "Reading settings"); loadPresets(); // readSettings(); if (loadPresets()) { if (JSONPresets.getPresets().loadDefault(PDActivity.this, inst) == null) {} // if there is no defaults // readSettings(); } else { // readSettings(); } readSettings(); Log.v("PlasmaSoundSetup", "Done!"); return null; }
public void record() { String name; try { name = JSONPresets.getPresets().getCurrent().getString("name"); if (sequencer.isAdded()) { name += "_" + JSONSequencerPresets.getPresets().getCurrent().getString("name"); } } catch (Exception e) { e.printStackTrace(); name = "errorerrorerror"; } File outfolder = new File(Environment.getExternalStorageDirectory(), "Plasma Sound"); outfolder.mkdirs(); String filename = pdman.recordOnOff(outfolder, name, true); MiscDialogs.checkForSoundcloudAndDoThatOrNot(this, filename, name); }
public void run() { if (startingup == false) { pdready = false; if (pdman != null) { pdman.onResume(); pdready = true; Log.v("PlasmaSoundReadyRunnable", "Destroying popup!"); } runOnUiThread( new Runnable() { public void run() { loadingview.setVisibility(View.GONE); } }); } }
@Override protected void onResume() { super.onResume(); PowerManager pm = (PowerManager) getSystemService(Context.POWER_SERVICE); wl = pm.newWakeLock(PowerManager.SCREEN_DIM_WAKE_LOCK, "PlasmaSoundHDLock"); wl.acquire(); if (loadingview == null) loadingview = this.findViewById(com.rj.processing.plasmasound.R.id.loadingview); loadingview.setVisibility(View.VISIBLE); if (pdready == true) { pdready = false; if (pdman != null) pdman.onResume(readyrunnable); } readSettings(); checkAndRemindThemToGiveMeAGoodRating(); checkAndGiveThemATutorial(); if (frag != null) frag.onResume(); }
@Override public void onDestroy() { if (pdman != null) pdman.cleanup(); super.onDestroy(); if (wl != null && wl.isHeld()) wl.release(); }