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?

有帮助吗?

解决方案

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.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top