I have a thread class (set to minimum priority) that I'm using to play midi music in 2d platformer. When the game runs without music and the music runs without a game, they both have a very tiny CPU usage (around 2% most of the time). But, when I use the MusicThread class in my game, the CPU usage shoots up to 50-60%.
Here is the MusicThread class:
public class MusicThread extends Thread
public MusicThread(String filename)
public void run()
Sequencer seqr = MidiSystem.getSequencer();
Sequence seq = MidiSystem.getSequence(new File(this.getName()));
does anyone have any suggestions to help me improve the performance?