本文整理汇总了Java中lejos.hardware.Audio.playSample方法的典型用法代码示例。如果您正苦于以下问题:Java Audio.playSample方法的具体用法?Java Audio.playSample怎么用?Java Audio.playSample使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类lejos.hardware.Audio
的用法示例。
在下文中一共展示了Audio.playSample方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: main
import lejos.hardware.Audio; //导入方法依赖的package包/类
public static void main(String[] args) {
EV3 ev3 = (EV3) BrickFinder.getLocal();
TextLCD lcd = ev3.getTextLCD();
Keys keys = ev3.getKeys();
// File root = new File(".");
// String[] files = root.list();
// for(int i = 0; i < files.length; i++)
// lcd.drawString(files[i], 0, i);
Audio audio = ev3.getAudio();
audio.playSample(new File("hackathon.wav"), 100);
LCD.drawString("Enter to Exit", 0, 2);
Button.ENTER.waitForPressAndRelease();
// audio.playNote(Audio.XYLOPHONE, 420, 500);
// audio.playNote(Audio.XYLOPHONE, 510, 500);
// audio.playNote(Audio.XYLOPHONE, 420, 500);
// audio.playNote(Audio.XYLOPHONE, 640, 500);
// audio.playNote(Audio.XYLOPHONE, 220, 500);
// keys.waitForAnyPress();
}
示例2: playMessage
import lejos.hardware.Audio; //导入方法依赖的package包/类
private static void playMessage(final Audio audio) {
Thread t = new Thread() {
@Override
public void run() {
audio.playSample(new File("pozdrav_01.wav"), 100);
}
};
t.setDaemon(true);
t.start();
Delay.msDelay(6000);
t.interrupt();
}
示例3: playMessage
import lejos.hardware.Audio; //导入方法依赖的package包/类
private void playMessage(final Audio audio) {
Thread t = new Thread() {
@Override
public void run() {
audio.playSample(new File("pozdrav_01.wav"), 100);
}
};
t.setDaemon(true);
t.start();
Delay.msDelay(6000);
t.interrupt();
}