我使用了WritetoFile()方法,因为我的单词数组使用了blockingPlay,但是,当我在文件系统中回放文件thisisatest_pause.wav ,它只会播放数组中的最后一个单词,即“测试”。完整的短语是“这是一个测试”,参数指定暂停。下面是代码写一个文件(WAV)只能说一个单词(最后一个单词)
public void play(int pause, String filename, String path) throws InterruptedException {
// play the words in order
for (int i = 0; i < numWords; i++) {
myWordArray[i].blockingPlay();
Thread.sleep(pause);
try {
myWordArray[i].writeToFile("C:\\Users\\Justin\\Desktop\\JavaMedia\\thisisatest_pause.wav\\");
} catch (SoundException e){
System.out.println("Error" +e);
}
}
}
什么类型的对象是'myWordArray [i]'? – selbie