0

(60*1000*1000 microseconds)在音频剪辑中添加一分钟并启动它,我只在第一次达到预期的结果,即我到达音频文件中的正确点。下次我在Clip对象上调用 getMicrosecondPosition 时,我得到了微秒位置,就好像我没有添加任何东西一样。已附加此行为的示例片段和输出。不太明白我做错了什么。

clip.stop();
currentPlaybackTime=clip.getMicrosecondPosition()+60L*1000*1000;
System.out.println("Playing from "+currentPlaybackTime+" ms i.e "+currentPlaybackTime/1000000.0+" seconds");
clip.setMicrosecondPosition((currentPlaybackTime));
System.out.println("Verifying: currentPlaybackTime is "+clip.getMicrosecondPosition());
clip.start();
System.out.println("Verifying 2: currentPlaybackTime is "+clip.getMicrosecondPosition());

输出是

Playing from 63326000 ms i.e 63.326 seconds [Note:this is seeking to correct point in audio file!]
Verifying: currentPlaybackTime is 3326000 [Why not here?]
Verifying 2: currentPlaybackTime is 3326000 [and here?]
Play/Pause Clicked
Pausing at 5120000 ms 5.12 seconds
4

0 回答 0