2012-09-27 4 views
1

를 사용하여 wav 파일을 다시로드 할 수 있지만 한 번만로드합니다. 난 내가 자바 것을 만들 수있는 첫 번째 트랙의 ends.How 후 wav 파일을 다시로드 할 수 있도록하려면?어떻게 OpenAL에 내가 .wav 파일을로드하는 응용 프로그램을 만들어 (자바)

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(); 

답변

0

: 내가 (선택한 트랙이로드되는 동안) 트랙의 종료 후 두 번 재생 치면 는 또한, 내가 파일을로드하는 데 사용하는 코드는 다음과 인

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

발생 루프를 사용하여 영역을 둘러싸면 처리 할 때마다 코드가 다시로드됩니다.