Hi, I posted this question in the java forums at java.sun.com and din’t seem to get many good responses.
http://forum.java.sun.com/thread.jsp?forum=406&thread=340391&tstart=0&trange=15
After searching through the forums, I realised the inaccuracy of the Thread.sleep(long millis, int nanos) method, which I used in my musical game.( Some other thread titled “try my musical game”)
This could be the main reason I’m getting of tempo midi music…
Is there a workaround to it? or should I say is there a way to do it within the JDK libraries (non JNI, non Java3D, etc) or any kind of custom code that makes use of the standard libraries to be able to get nanosecond precision?
I din’t really need 1 nanosec precision, but maybe in the 100 nanos… (0.1 microsec)
thanks in advance
PS: I’ve read about the sleep based timer hack, and I don’t think it’ll work in this case where I need 0.1 micro instead of 1 milli… and I’ve read elsewhere that the method sleeps to the System timer’s granularity of time. (i.e 50 ms for win ME, 1 ms for XP, etc etc)
~Jeffrey