Hello everybody:
I am using AudioSystem for the first time, and the only way I have been able to make it work is by calling the update method in the AudioSystem when the application is being updated. The actual way I did it was the following.
AudioTrack track = sys.createAudioTrack( file, false );
sys.getEnvironmentalPool().addTrack( track );
GameTaskQueueManager.getManager().getQueue( GameTaskQueue.UPDATE ).enqueue( new Callable<Object>()
{
public Object call() throws Exception
{
AudioSystem.getSystem().update();
GameTaskQueueManager.getManager().getQueue( GameTaskQueue.UPDATE ).enqueue( this );
//System.out.println( "
> Updating the audio system" );
return null;
}
} );
track.play();
I am aware that I could get rid of this overhead by simply incorporating the update call inside my main game loop, but this way is neat because I can do it from outside any example without messing with its internals... :wink:
Anyway, my question is if this is actually the right way to do it (updating every frame) or there is a better/preferred way around I am not aware of. An also, as a minor question, is this queuing scheme OK from the technical point of view, and only the performance might be a problem?
Thanks,