1

.wavファイルをロードするアプリケーションを作成しましたが、ロードは1回だけです。最初のトラックが終了した後にwavファイルをリロードできるようにしたいのですが、Javaでそれを作成するにはどうすればよいですか?また、トラックの終了後(選択したトラックがロードされている間)に2回再生を押すと、

IllegalThreadStateException.
 if (threadStatus != 0 || this != me)
            throw new IllegalThreadStateException();

ファイルのロードに使用するコードは次のとおりです。

OpenAL openal = new OpenAL();



source = openal.createSource(new File(Audioplayer.path));
System.out.println(source.toString());
source.play();
source.setGain(0.75f);      // 75% volume
source.setPitch(0.85f);     // 85% of the original pitch
source.setPosition(0, 0, 0); // -1 means 1 unit to the left
source.setLooping(false);    // Loop the sound effect
j=source.getBuffer();
System.out.println(j);
for (i=1;i<=10000;i++){
    Thread.sleep(1);        // Wait for 10 seconds
}
Thread.sleep(10000);        // Wait for 10 seconds
source.close();
openal.close();
4

1 に答える 1

0

領域をループで囲むだけで、完了するたびにそのコードのビットがリロードされます。

于 2013-03-20T17:54:14.790 に答える