本文整理汇总了Java中org.puredata.core.PdBase类的典型用法代码示例。如果您正苦于以下问题:Java PdBase类的具体用法?Java PdBase怎么用?Java PdBase使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
PdBase类属于org.puredata.core包,在下文中一共展示了PdBase类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: stop
import org.puredata.core.PdBase; //导入依赖的package包/类
public void stop() {
MLog.d(TAG, "stopping Pdaudio");
synchronized(lock) {
/* make sure to release all resources */
stopAudio();
if (patch != 0) {
PdBase.closePatch(patch);
patch = 0;
}
myDispatcher.release();
PdBase.release();
try {
getContext().unbindService(serviceConnection);
} catch (IllegalArgumentException e) {
// already unbound
pdService = null;
}
}
}
示例2: send
import org.puredata.core.PdBase; //导入依赖的package包/类
public static void send(int port, byte[] message)
{
if(message.length == 1)
{
int first = message[0] & 0xFF;
if(MidiCode.isRealtime(first))
{
PdBase.sendSysRealTime(port, first);
}
else
{
System.err.println("Unsupported non realtime one byte message : " + first);
}
}
else if(message.length == 3)
{
PdBase.sendList(PdClock.ClockMidiInputReceiver,
Integer.valueOf(message[0] & 0xFF),
Integer.valueOf(message[1] & 0xFF),
Integer.valueOf(message[2] & 0xFF));
}
else
{
System.err.println("Unsupported message length : " + message.length);
}
}
示例3: init
import org.puredata.core.PdBase; //导入依赖的package包/类
public static void init()
{
dispatcher = new PdDispatcher() {
@Override
public void print(String s) {
if(s.endsWith("\n"))
{
message.append(s.substring(0, s.length()-1));
Log.i("Pd [print]", message.toString());
message = new StringBuilder();
}
else
{
message.append(s);
}
}
};
PdBase.setReceiver(dispatcher);
}
示例4: send
import org.puredata.core.PdBase; //导入依赖的package包/类
/** send a Pd atom-string 's' to a particular receiver 'dest' */
public static void send(String dest, String s)
{
List<Object> list = new ArrayList<Object>();
String[] bits = s.split(" ");
for (int i=0; i < bits.length; i++) {
try {
list.add(Float.parseFloat(bits[i]));
} catch (NumberFormatException e) {
list.add(bits[i]);
}
}
Object[] ol = list.toArray();
PdBase.sendList(dest, ol);
}
示例5: onActivityResult
import org.puredata.core.PdBase; //导入依赖的package包/类
public void onActivityResult(int requestCode, int resultCode, Intent data) {
if (requestCode == 1) {
if (resultCode == RESULT_OK) {
audioTrackA = data.getData().toString();
PdBase.sendSymbol("caminho_A", audioTrackA);
desenhaOnda();
}
}
if (requestCode == 2) {
if (resultCode == RESULT_OK) {
audioTrackB = data.getData().toString();
PdBase.sendSymbol("caminho_B", audioTrackB);
desenhaOnda();
}
}
}
示例6: openPatch
import org.puredata.core.PdBase; //导入依赖的package包/类
/** Abre o Patch de PD, segundo o nome do patch e o caminho para obter o id do recurso raw no arquivo .zip
*
* @param nome do patch '<nome>.pd'
* @param PathToIdResourse
* @return
*/
public int openPatch(final String patch, int PathToIdResourse) {
final File dir = p5.getFilesDir();
final File patchFile = new File(dir, patch);
int out=-1;
try {
IoUtils.extractZipResource(p5.getResources().openRawResource(PathToIdResourse), dir, true);
out = PdBase.openPatch(patchFile.getAbsolutePath());
Log.d(TAG, "out" + out);
} catch (final IOException e) {
e.printStackTrace();
Log.e(TAG, e.toString() + "; exiting now");
finish();
}
return out;
}
示例7: prepareRecord
import org.puredata.core.PdBase; //导入依赖的package包/类
private void prepareRecord(String nomeArq) {
// p5.println ("Recording");
String root = Environment.getExternalStorageDirectory().toString();
// String state = Environment.getExternalStorageState();
// p5.println ("State: "+state + " root: " +root);
File myDir = new File(root + "/arvoritmo");
myDir.mkdirs();
SimpleDateFormat formatter = new SimpleDateFormat("MMddHHmm");
Date now = new Date();
String fileName = formatter.format(now);
String fname = "recording_" + fileName;
saveFilePath = myDir.getAbsolutePath();
// p5.println ("IN: " + myDir + "/" + fname);
PdBase.sendSymbol("pd_path", myDir + "/" + nomeArq);
Context context = p5.getApplicationContext();
CharSequence text = "Grabando em: " + myDir + "/" + nomeArq ;
int duration = Toast.LENGTH_LONG;
Toast toast = Toast.makeText(context, text, duration);
toast.show();
}
示例8: setPontoParaAtivo
import org.puredata.core.PdBase; //导入依赖的package包/类
public void setPontoParaAtivo(int index) {
int antIndex = indexEmSom;
indexEmSom = index;
if (antIndex != indexEmSom) {
if ( listaBangs.get(indexEmSom) != null ) {
if ( (String) listaBangs.get(indexEmSom).get(1) == "sin_efecto") {
PdBase.sendFloat("efecto"+(String) listaBangs.get(indexEmSom).get(0), 0);
// pontosNota.get(indexEmSom).conEfecto = false;
} else {
PdBase.sendFloat( (String) listaBangs.get(indexEmSom).get(1), 1);
// pontosNota.get(indexEmSom).conEfecto = true;
}
// Log.i("Galho", "efecto: " + (String) listaBangs.get(indexEmSom).get(1) );
PdBase.sendBang( (String) listaBangs.get(indexEmSom).get(0) );
}
}
}
示例9: initPd
import org.puredata.core.PdBase; //导入依赖的package包/类
private void initPd() {
Resources res = getResources();
File patchFile = null;
try {
PdBase.sendBang("trigger");
PdBase.setReceiver(receiver);
PdBase.subscribe("freq");
// PdBase.sendFloat("midinote", 64);
InputStream in = res.openRawResource(R.raw.pianotuner);
patchFile = IoUtils.extractResource(in, "pinaotuner.pd", getCacheDir());
PdBase.openPatch(patchFile);
PdBase.sendFloat("midinote", 69); //此处确保初始化时,按下按钮能听到标准音A发声
} catch (IOException e) {
Log.e(TAG, e.toString());
finish();
} finally {
if (patchFile != null) patchFile.delete();
}
}
示例10: onClick
import org.puredata.core.PdBase; //导入依赖的package包/类
@Override
public void onClick(View v) {
switch (v.getId()) {
case R.id.piano_button:
startAudio();
PdBase.sendBang("Bang");
// PdBase.sendFloat("midinote", 64);
break;
// if (pdService.isRunning()) {
// stopAudio();
// } else {
// startAudio();
// }
// default:
// stopAudio();
// break;
}
}
示例11: initPd
import org.puredata.core.PdBase; //导入依赖的package包/类
private void initPd() {
Resources res = getResources();
File patchFile = null;
try {
PdBase.sendBang("trigger");
// PdBase.sendFloat("midinote", 64);
InputStream in = res.openRawResource(R.raw.wnoise);
patchFile = IoUtils.extractResource(in, "wnoise.pd", getCacheDir());
PdBase.openPatch(patchFile);
} catch (IOException e) {
Log.e(TAG, e.toString());
finish();
} finally {
if (patchFile != null) patchFile.delete();
}
}
示例12: onClick
import org.puredata.core.PdBase; //导入依赖的package包/类
@Override
public void onClick(View v) {
switch (v.getId()) {
case R.id.wnoise_button:
startAudio();
PdBase.sendBang("trigger");
// PdBase.sendFloat("midinote", 64);
break;
// if (pdService.isRunning()) {
// stopAudio();
// } else {
// startAudio();
// }
// default:
// stopAudio();
// break;
}
}
示例13: initPd
import org.puredata.core.PdBase; //导入依赖的package包/类
private void initPd() {
Resources res = getResources();
File patchFile = null;
try {
PdBase.sendBang("trigger");
// PdBase.sendFloat("midinote", 64);
InputStream in = res.openRawResource(R.raw.sine);
patchFile = IoUtils.extractResource(in, "sine.pd", getCacheDir());
PdBase.openPatch(patchFile);
} catch (IOException e) {
Log.e(TAG, e.toString());
finish();
} finally {
if (patchFile != null) patchFile.delete();
}
}
示例14: onClick
import org.puredata.core.PdBase; //导入依赖的package包/类
@Override
public void onClick(View v) {
switch (v.getId()) {
case R.id.sine_button:
startAudio();
PdBase.sendBang("trigger");
// PdBase.sendFloat("midinote", 64);
break;
// if (pdService.isRunning()) {
// stopAudio();
// } else {
// startAudio();
// }
// default:
// stopAudio();
// break;
}
}
示例15: initPd
import org.puredata.core.PdBase; //导入依赖的package包/类
private void initPd() {
Resources res = getResources();
File patchFile = null;
try {
PdBase.sendBang("trigger");
// PdBase.sendFloat("midinote", 64);
InputStream in = res.openRawResource(R.raw.triangle);
patchFile = IoUtils.extractResource(in, "triangle.pd", getCacheDir());
PdBase.openPatch(patchFile);
} catch (IOException e) {
Log.e(TAG, e.toString());
finish();
} finally {
if (patchFile != null) patchFile.delete();
}
}