TEXT !!
This commit is contained in:
parent
7d16d0aa3c
commit
6cb8248975
1 changed files with 10 additions and 1 deletions
|
@ -11,6 +11,7 @@ import java.util.HashMap;
|
|||
|
||||
// Author: hhhzzzsss
|
||||
public class MidiConverter implements Converter {
|
||||
public static final int TEXT = 0x01;
|
||||
public static final int TRACK_NAME = 0x03;
|
||||
public static final int SET_INSTRUMENT = 0xC0;
|
||||
public static final int SET_TEMPO = 0x51;
|
||||
|
@ -28,6 +29,8 @@ public class MidiConverter implements Converter {
|
|||
|
||||
String songName = null;
|
||||
|
||||
final StringBuilder text = new StringBuilder();
|
||||
|
||||
boolean isFirst = true;
|
||||
|
||||
ArrayList<MidiEvent> tempoEvents = new ArrayList<>();
|
||||
|
@ -48,12 +51,18 @@ public class MidiConverter implements Converter {
|
|||
|
||||
isFirst = false;
|
||||
}
|
||||
} else if (mm.getType() == TEXT) {
|
||||
text.append(new String(mm.getData()));
|
||||
text.append('\n');
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
final Song song = new Song(name, bot, songName, null, null, null, false);
|
||||
String stringText = text.toString();
|
||||
if (stringText.endsWith("\n")) stringText = stringText.substring(0, stringText.length() - 1);
|
||||
|
||||
final Song song = new Song(name, bot, songName, null, null, stringText, false);
|
||||
|
||||
tempoEvents.sort(Comparator.comparingLong(MidiEvent::getTick));
|
||||
|
||||
|
|
Loading…
Reference in a new issue