0
我有一個簡單的libPd項目。現在,我已經下載了一個.wav文件,我想播放它,而不是我擁有的純數據文件。 它可以做到這一點嗎? 如果有,我該怎麼做?如何在libPd中播放wav文件
這是我的項目:
public class MainActivity extends AppCompatActivity {
private Button kickButton, bassButton;
private PdUiDispatcher dispatcher;
private boolean isClicked;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
kickButton = (Button) findViewById(R.id.kickButton);
bassButton = (Button) findViewById(R.id.bassButton);
int sampleRat = AudioParameters.suggestSampleRate();
try {
PdAudio.initAudio(sampleRat,0,2,8,true);
dispatcher = new PdUiDispatcher();
PdBase.setReceiver(dispatcher);
File dir = getFilesDir();
IoUtils.extractZipResource(getResources().openRawResource(R.raw.simplepatch),dir,true);
File pdPatch = new File(dir, "simplepatch.pd");
PdBase.openPatch(pdPatch.getAbsolutePath());
} catch (IOException e) {
e.printStackTrace();
}
kickButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
isClicked = !isClicked;
float val = (isClicked) ? 1.0f : 0.0f;
PdBase.sendFloat("onOff", val);
}
});
}
@Override
protected void onResume() {
super.onResume();
PdAudio.startAudio(this);
}
@Override
protected void onPause() {
super.onPause();
PdAudio.stopAudio();
}
}
Thaks!
嗯...我不能說奧潘中不包括PD補丁文件? – Roish