*blog... kind of... *rss 



Inspire08 demo log, day 30
Status:
-2 days left until Inspire08
Back to the system code


... Ok, porting this to LWJGL ended up being a waste of time. The main porting was very quick, like, in 30min I had it done and working. Doing the applet version took more time, about 4 hours or so. And in the end there were some weird bugs with the timer, and after all the time spent trying to understand how to do the Applet version is the last thing I wanted to see. So, back to JOGL.

I also spent more time again on getting the position of the tune. I managed to get something this time. SourceDataLine.getFramePosition() return the amount of samples played, but they numbers aren't as smooth as a normal Timer, like the same number may repeat 5 times, which means that the animation is jumping. I had to do a crap fix for that:

public static long getPosition()
{
	/*
	 * For some reason the SourceDataLine.getFramePosition()
	 * doesn't give back smooth sequence of numbers, here it's
	 * a crap fix for it.
	 */
	
	if (lastSampleInfo != tune.getPosition())
	{
		lastSampleInfo = tune.getPosition();
		lastTimerInfo = System.currentTimeMillis();
	}
	
	return lastSampleInfo + (System.currentTimeMillis() - lastTimerInfo);
}

Am I the only one that thinks that it's weird that I have to do this? Still, it kind of works, but sometimes jumps back a tiny bit, I may come back to this code in a few days to try other things, but at least it uses the audio timer (somehow).

I was now starting doing the font system, it will take a bit still as I need to find the best/most dynamic approach.

I felt that closing the previews was a bad idea, so as soon as I have some text on top of the screen working I'll put a new version online so you can see where the thing is going.
0 comments written so far...


Have your say!



Name:

Website:

Comment: