我最近创建了一个基本上是 MIDI 控制器的应用程序。你按下一个按钮,它就会发出声音。该应用程序在 Eclipse 上运行良好,并且运行良好。我们将 jellybean 刷到 Beaglebone LCD3 cape 触摸屏上,然后将应用程序下载到 beaglebone。它加载并且您可以单击按钮但没有声音输出。即使我连接了扬声器,也没有任何输出。提前感谢您的宝贵时间。
final MediaPlayer ButtonSound1 = MediaPlayer.create(MainActivity.this, R.raw.button_sound);
final MediaPlayer ButtonSound2 = MediaPlayer.create(MainActivity.this, R.raw.airplane);
final MediaPlayer ButtonSound3 = MediaPlayer.create(MainActivity.this, R.raw.chainsaw);
final MediaPlayer ButtonSound4 = MediaPlayer.create(MainActivity.this, R.raw.midnight);
final MediaPlayer ButtonSound5 = MediaPlayer.create(MainActivity.this, R.raw.jungle);
final MediaPlayer ButtonSound6 = MediaPlayer.create(MainActivity.this, R.raw.river);
final MediaPlayer ButtonSound7 = MediaPlayer.create(MainActivity.this, R.raw.jingle_bell);
final MediaPlayer ButtonSound8 = MediaPlayer.create(MainActivity.this, R.raw.crunch);
final MediaPlayer ButtonSound9 = MediaPlayer.create(MainActivity.this, R.raw.bomb);
derp = (Button) findViewById(R.id.button1);
derp2= (Button) findViewById(R.id.button2);
derp3= (Button) findViewById(R.id.button3);
derp4= (Button) findViewById(R.id.button4);
derp5= (Button) findViewById(R.id.button5);
derp6= (Button) findViewById(R.id.button6);
derp7= (Button) findViewById(R.id.button7);
derp8= (Button) findViewById(R.id.button8);
derp9= (Button) findViewById(R.id.button9);
derp.setOnClickListener (new View.OnClickListener() {
@Override
public void onClick(View v) {
ButtonSound1.start();
}
});