Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package com.eschere.usozo;
- import java.io.File;
- import java.io.IOException;
- import org.puredata.android.io.PdAudio;
- import org.puredata.core.PdBase;
- import org.puredata.core.utils.IoUtils;
- import android.util.Log;
- public class Sound {
- final Usozo u;
- public static final String TAG = "eschere usozo";
- public Sound(Usozo u) {
- this.u = u;
- initPd();
- }
- public void sendData(float centerX, float centerY) {
- PdBase.sendFloat("xCoor", centerX);
- PdBase.sendFloat("yCoor", centerY);
- }
- public void cleanup() {
- PdAudio.stopAudio();
- PdBase.release();
- }
- private void initPd() {
- File dir = u.getFilesDir();
- File patchFile = new File(dir, "usozoPatch.pd");
- try {
- IoUtils.extractZipResource(u.getResources().openRawResource(R.raw.patch), dir, true);
- PdBase.openPatch(patchFile.getAbsolutePath());
- } catch (IOException e) {
- Log.e(TAG, e.toString() + "; exiting now");
- u.finish();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement