Frage

I am parsing a MIDI file using:

Sequence sequence = MidiSystem.getSequence(paFile);

How do I distinguish the SMF file type? I have not found any method returning it. Is it safe to assume, that sequence with only one track is type 0 and with multiple tracks type 1?

War es hilfreich?

Lösung

It is not possible to know how the tracks in a type 2 file are to be handled in the general case, and the only difference between type 0 and 1 files is the allowed number of tracks. Therefore, the Sequence does not bother to remember the file type.

If you really want to know the file type, you have to read it directly from the file with MidiSystem.getMidiFileFormat.

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top