how to improve file loading in a grunning game? for playing music...

Hello!

I’m using FPSAnimator, and i can’t play music with javasound.
The CPU usage is 100% with this Animator, so my music thread can’t run at all. ( 1 times in a minute :frowning: )

I tried to use the same Timer object to the music and FPSAnimator TimerTask object, but nothing changed.

The fps is set to 25, and I’m drawing nothing:
public void display(GLDrawable glDrawable) {
gl = glDrawable.getGL();
glu = glDrawable.getGLU();

    gl.glClear(GL.GL_COLOR_BUFFER_BIT | GL.GL_DEPTH_BUFFER_BIT );
    gl.glMatrixMode(GL.GL_MODELVIEW);
    gl.glLoadIdentity();
    glu.gluLookAt( eye[terrainInView].x, eye[terrainInView].y, eye[terrainInView].z, focus[terrainInView].x, focus[terrainInView].y, focus[terrainInView].z, up.x, up.y, up.z );

}

What could be the problem?

Thanks…

I found a bottleneck.
When I want to play a music file, i have to open it, and the java can’t open it without enoug process time.
Should I cache every music file to the memory? (about 30 music file). If a music file’s size is 5Megabyte, i alloc 150Megabyte?

Do you really need to load 150 megs of music at once? Are you really running things that fast for so long? How about loading things in between levels and such? Preloading is the way to go, but you shouldn’t have to preload that much at the start. Space it out at logical points throughout gameplay.