I am creating a MIDI sequencer and to initialize the sequencer as far as I know, I need to use:
Sequencer sequencer = MidiSystem.getSequencer();
But this causes my program to start very, very slow up to 2 mins for this one method call!
Any ideas how to fix this? Thank you
looking at the code for MidiSystem.getSequencer() it looks like it tries to connect various things trying to connect the next one if the previous one fails. This means that if all connection attempts fail down to the last it could take a lot of time.
To test this theory try using
Sequencer sequencer = MidiSystem.getSequencer(false);
and see if that line executes any faster, if it does then the issue is the time taken to connect to the default synthesizer.
when calling getSequencer() the series of events are
This text is almost verbatim what is in the javadoc but as you can see there is enough attempting to create connections to make the call a bit slow.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With