本文整理汇总了Java中org.puredata.android.io.AudioParameters类的典型用法代码示例。如果您正苦于以下问题:Java AudioParameters类的具体用法?Java AudioParameters怎么用?Java AudioParameters使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
AudioParameters类属于org.puredata.android.io包,在下文中一共展示了AudioParameters类的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onCreate
import org.puredata.android.io.AudioParameters; //导入依赖的package包/类
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
audio = new GdxPDAndroid(this,
AudioParameters.suggestSampleRate(),
0,
2,
8,
true);
((GdxPDAndroid)audio).addAndroidListener("light", this);
((GdxPDAndroid)audio).addAndroidListener("dark", this);
game = new PianoTest(audio);
AndroidApplicationConfiguration cfg = new AndroidApplicationConfiguration();
initialize(game, cfg);
}
示例2: onResume
import org.puredata.android.io.AudioParameters; //导入依赖的package包/类
public void onResume() {
super.onResume();
//Log.d(TAG, "Starting LibPD");
if (AudioParameters.suggestSampleRate() < SAMPLE_RATE) {
toast("required sample rate not available; exiting");
finish();
return;
}
final int nOut = Math.min(AudioParameters.suggestOutputChannels(), 2);
if (nOut == 0) {
toast("audio output not available; exiting");
finish();
return;
}
try {
PdAudio.initAudio(SAMPLE_RATE, 0, nOut, 1, true);
PdAudio.startAudio(this);
} catch (final IOException e) {
//Log.e(TAG, e.toString());
}
}
示例3: initAudio
import org.puredata.android.io.AudioParameters; //导入依赖的package包/类
private boolean initAudio(int nIn, int nOut) {
try {
pdService.initAudio(AudioParameters.suggestSampleRate(), nIn, nOut, -1); // negative values default to PdService preferences
} catch (IOException e) {
MLog.e(TAG, e.toString());
return false;
}
return true;
}
示例4: onResume
import org.puredata.android.io.AudioParameters; //导入依赖的package包/类
public void onResume() {
final int nIn = chanelsIn;
Log.d(TAG, "Starting LibPD");
if (AudioParameters.suggestSampleRate() < SAMPLE_RATE) {
Log.d(TAG,"required sample rate not available; exiting");
finish();
return;
}
final int nOut = Math.min(AudioParameters.suggestOutputChannels(), 2);
if (nOut == 0) {
Log.d(TAG,"audio output not available; exiting");
finish();
return;
}
try {
PdAudio.initAudio(SAMPLE_RATE, nIn, nOut, ticksPerBuffer, true);
PdAudio.startAudio(p5);
PdBase.setReceiver(dispatcher);
for (int i = 0 ; i < keyFloats.size() ; i ++) {
recividorMensagensPd(keyFloats.get(i));
}
} catch (final IOException e) {
Log.e(TAG, e.toString());
}
}
示例5: onCreate
import org.puredata.android.io.AudioParameters; //导入依赖的package包/类
@Override
protected void onCreate(android.os.Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
this.requestWindowFeature(Window.FEATURE_NO_TITLE); // 设置Activity标题不显示
AudioParameters.init(this);
PdPreferences.initPreferences(getApplicationContext());
PreferenceManager.getDefaultSharedPreferences(getApplicationContext());
initGui();
bindService(new Intent(this, PdService.class), pdConnection, BIND_AUTO_CREATE);
}
示例6: onCreate
import org.puredata.android.io.AudioParameters; //导入依赖的package包/类
@Override
protected void onCreate(android.os.Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
this.requestWindowFeature(Window.FEATURE_NO_TITLE); // 设置Activity标题不显示
AudioParameters.init(this);
PdPreferences.initPreferences(getApplicationContext());
PreferenceManager.getDefaultSharedPreferences(getApplicationContext());
initGui();
bindService(new Intent(this, PdService.class), pdConnection, BIND_AUTO_CREATE);
}
示例7: onCreate
import org.puredata.android.io.AudioParameters; //导入依赖的package包/类
@Override
protected void onCreate(android.os.Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
this.requestWindowFeature(Window.FEATURE_NO_TITLE); // 设置Activity标题不显示
AudioParameters.init(this);
PdPreferences.initPreferences(getApplicationContext());
PreferenceManager.getDefaultSharedPreferences(getApplicationContext());
initGui();
bindService(new Intent(this, PdService.class), pdConnection, BIND_AUTO_CREATE);
}
示例8: GdxPDAndroid
import org.puredata.android.io.AudioParameters; //导入依赖的package包/类
public GdxPDAndroid(final Context ctx) {
context = ctx;
sampleRate = AudioParameters.suggestSampleRate();
inChannels = 0;
outChannels = 2;
ticksPerBuffer = 8;
restart = true;
dispatcher = new PdUiDispatcher();
PdBase.setReceiver(dispatcher);
}
示例9: initializePd
import org.puredata.android.io.AudioParameters; //导入依赖的package包/类
private void initializePd() throws IOException {
AudioParameters.init(context);
int sampleRate = Math.max(MIN_SAMPLE_RATE, AudioParameters.suggestSampleRate());
int outChannels = AudioParameters.suggestOutputChannels();
PdAudio.initAudio(sampleRate, 0, outChannels, 1, true);
File dir = context.getFilesDir();
File patchFile = new File(dir, "game_sounds.pd");
InputStream patchStream = context.getResources().openRawResource(R.raw.patches);
IoUtils.extractZipResource(patchStream, dir, true);
PdBase.openPatch(patchFile.getAbsolutePath());
}
示例10: initializePd
import org.puredata.android.io.AudioParameters; //导入依赖的package包/类
private void initializePd() throws IOException {
AudioParameters.init(context);
int sampleRate = Math.max(MIN_SAMPLE_RATE, AudioParameters.suggestSampleRate());
int outChannels = AudioParameters.suggestOutputChannels();
PdAudio.initAudio(sampleRate, 0, outChannels, 1, true);
File dir = context.getFilesDir();
File patchFile = new File(dir, "Keyboard.pd");
InputStream patchStream = context.getResources().openRawResource(R.raw.patches);
IoUtils.extractZipResource(patchStream, dir, true);
PdBase.openPatch(patchFile.getAbsolutePath());
}
示例11: initPd
import org.puredata.android.io.AudioParameters; //导入依赖的package包/类
private void initPd() throws IOException {
// Configure the audio glue
int sampleRate = AudioParameters.suggestSampleRate();
pdService.initAudio(sampleRate, 1, 2, 10.0f);
pdService.startAudio();
start();
// Create and install the dispatcher
dispatcher = new PdUiDispatcher();
PdBase.setReceiver(dispatcher);
}
示例12: initPd
import org.puredata.android.io.AudioParameters; //导入依赖的package包/类
protected void initPd() throws IOException {
// Configure the audio glue
int sampleRate = AudioParameters.suggestSampleRate();
// reducing sample rate based on no. of cores
if (getNumCores() == 1)
sampleRate = sampleRate / 4;
else
sampleRate = sampleRate / 2;
pdService.initAudio(sampleRate, 0, 2, 10.0f);
pdService.startAudio(new Intent(this, SynthCircle.class),
R.drawable.notif_icon, "CircleSynth", "Return to Circle Synth");
dispatcher = new PdUiDispatcher();
PdBase.setReceiver(dispatcher);
dispatcher.addListener("scan", new PdListener.Adapter() {
@Override
public void receiveFloat(String source, final float x) {
scanline = x;
detect();
sendPdValue();
}
});
}
示例13: initPd
import org.puredata.android.io.AudioParameters; //导入依赖的package包/类
private static void initPd() throws IOException {
// configure audio glue
if (settingsSampleRate == -1) ;
settingsSampleRate = AudioParameters.suggestSampleRate();
if (settingsMicChannels == -1) settingsMicChannels = AudioParameters.suggestInputChannels();
if (settingsOutputChannels == -1) settingsOutputChannels = 2;
if (settingsBuffer == -1) settingsBuffer = 8;
MLog.d(TAG, "mic channels" + settingsMicChannels);
pdService.initAudio(settingsSampleRate, settingsMicChannels, settingsOutputChannels, settingsBuffer);
start();
}
示例14: initPd
import org.puredata.android.io.AudioParameters; //导入依赖的package包/类
protected void initPd() throws IOException {
// Configure the audio glue
int sampleRate = AudioParameters.suggestSampleRate();
pdService.initAudio(sampleRate, 0, 2, 10.0f);
pdService.startAudio(new Intent(this, MainActivity.class),
R.drawable.icon, "Sample", "Return to Processing");
dispatcher = new PdUiDispatcher();
PdBase.setReceiver(dispatcher);
}