本文整理汇总了Java中org.puredata.core.PdBase.closePatch方法的典型用法代码示例。如果您正苦于以下问题:Java PdBase.closePatch方法的具体用法?Java PdBase.closePatch怎么用?Java PdBase.closePatch使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.puredata.core.PdBase
的用法示例。
在下文中一共展示了PdBase.closePatch方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: stop
import org.puredata.core.PdBase; //导入方法依赖的package包/类
public void stop() {
PdBase.closePatch(mPatch);
myDispatcher.release();
stopAudio();
PdAudio.release();
PdBase.release();
}
示例3: bake
import org.puredata.core.PdBase; //导入方法依赖的package包/类
/**
* Bake a path to a wav file
* @param patch the patch to bake
* @param wav the wav file to write
* @param channels how many channels (1 for mono, 2 for stereo, can be more than 2 channels)
* @param sampleRate sample rate used by Pd
* @param time baking duration in seconds
* @throws IOException
*/
public static void bake(File patch, File wav, int channels, int sampleRate, float time) throws IOException {
// disable Pd : does nothing if Pd alreay initialized.
PdConfiguration.disabled = true;
// Pause audio.
// Does nothing in headless mode but required to
// have Pd static code executed (load library)
Pd.audio.pause();
int handle = PdBase.openPatch(patch);
PdBase.openAudio(0, channels, sampleRate);
PdBase.computeAudio(true);
int frames = (int)(time * sampleRate);
int samples = frames * channels;
short [] data = new short[samples];
int ticks = frames / PdBase.blockSize();
PdBase.process(ticks, new short[]{}, data);
PdBase.closePatch(handle);
// save
byte [] buf = new byte[data.length * 2];
for(int i=0 ; i<data.length ; i++){
buf[i*2+0] = (byte)(data[i] & 0xFF);
buf[i*2+1] = (byte)((data[i] >> 8) & 0xFF);
}
ByteArrayInputStream stream = new ByteArrayInputStream(buf);
AudioFormat format = new AudioFormat(sampleRate, 16, channels, true, false);
AudioInputStream audioStream = new AudioInputStream(stream, format, data.length);
AudioSystem.write(audioStream, Type.WAVE, wav);
// resume audio
Pd.audio.resume();
}
示例4: onDestroy
import org.puredata.core.PdBase; //导入方法依赖的package包/类
@Override
public void onDestroy() {
super.onDestroy();
// release all resources called by pdservice
dispatcher.release();
if (pd != 0) {
PdBase.closePatch((int) pd);
pd = 0;
}
pdService.stopAudio();
unbindService(pdConnection);
}
示例5: onDestroy
import org.puredata.core.PdBase; //导入方法依赖的package包/类
@Override
public void onDestroy() {
super.onDestroy();
// release all resources called by pdservice
dispatcher.release();
if (pd != 0) {
PdBase.closePatch((int) pd);
pd = 0;
}
pdService.stopAudio();
unbindService(pdConnection);
}
示例6: close
import org.puredata.core.PdBase; //导入方法依赖的package包/类
@Override
public void close(PdPatch patch) {
PdBase.closePatch(patch.getPdHandle());
}
示例7: closePatch
import org.puredata.core.PdBase; //导入方法依赖的package包/类
private void closePatch(PdPatch patch){
PdBase.closePatch(patch.getPdHandle());
}
示例8: close
import org.puredata.core.PdBase; //导入方法依赖的package包/类
public void close()
{
if (dollarzero != -1) {
PdBase.closePatch(dollarzero);
}
}