문제

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