当前位置: 首页>>代码示例>>Java>>正文


Java PdBase.closePatch方法代码示例

本文整理汇总了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;
        }
    }
}
 
开发者ID:victordiaz,项目名称:phonk,代码行数:20,代码来源:PPureDataBackupNewer.java

示例2: stop

import org.puredata.core.PdBase; //导入方法依赖的package包/类
public void stop() {
    PdBase.closePatch(mPatch);
    myDispatcher.release();
    stopAudio();
    PdAudio.release();
    PdBase.release();
}
 
开发者ID:victordiaz,项目名称:phonk,代码行数:8,代码来源:PPureData.java

示例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();
}
 
开发者ID:mgsx-dev,项目名称:gdx-pd,代码行数:47,代码来源:PdOffline.java

示例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);
}
 
开发者ID:zhagan,项目名称:dotMatrix-Android,代码行数:16,代码来源:Dm_beatbox.java

示例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);
}
 
开发者ID:twobigears,项目名称:Pd-Processing-Template,代码行数:14,代码来源:MainActivity.java

示例6: close

import org.puredata.core.PdBase; //导入方法依赖的package包/类
@Override
public void close(PdPatch patch) {
	PdBase.closePatch(patch.getPdHandle());
}
 
开发者ID:mgsx-dev,项目名称:gdx-pd,代码行数:5,代码来源:PdAudioBase.java

示例7: closePatch

import org.puredata.core.PdBase; //导入方法依赖的package包/类
private void closePatch(PdPatch patch){
	PdBase.closePatch(patch.getPdHandle());
}
 
开发者ID:mgsx-dev,项目名称:gdx-pd,代码行数:4,代码来源:PdAudioBakery.java

示例8: close

import org.puredata.core.PdBase; //导入方法依赖的package包/类
public void close() 
{
	if (dollarzero != -1) {
		PdBase.closePatch(dollarzero);
	}
}
 
开发者ID:b2renger,项目名称:PdDroidPublisher,代码行数:7,代码来源:PdPatch.java


注:本文中的org.puredata.core.PdBase.closePatch方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。