jLayer 1.0.1 getPosition does not always return ms

548 views Asked by At

I have implemented a simple usage of jLayer on my program (play/stop,display progress) which works fine.

I however have an issue with the getPosition() which returns value in ms on my Windows XP machine (as documented), but in SECONDS on my Ubuntu machine.

Does anyone have an idea why such a difference?

1

There are 1 answers

0
Durandal On

Take a look at the source code! I presume you are talking abut the Player class.

Its getPosition() calls directly into AudioDevice.getPosition(), and the JavaAudioDevice implementation returns SourceDataLine.getMicroSecondPostion() / 1000. The latter class is part or the JRE, so I would assume that the particular JRE version is bugged or the OS does not provide a higher resolution. Might be also the particular audio driver of the hardware platform that causes this.

There isn't much you can do except to update JRE and OS. If that doesn't help you can only file a bug report.

Edit: With bug report I mean the vendor of the VM, since the JLayer guys can't do anything about the JRE returning bogus values.