mabe an isFirst
This commit is contained in:
parent
bf369ac3a5
commit
4642f14acd
1 changed files with 5 additions and 1 deletions
|
@ -28,6 +28,8 @@ public class MidiConverter implements Converter {
|
||||||
|
|
||||||
String songName = null;
|
String songName = null;
|
||||||
|
|
||||||
|
boolean isFirst = true;
|
||||||
|
|
||||||
ArrayList<MidiEvent> tempoEvents = new ArrayList<>();
|
ArrayList<MidiEvent> tempoEvents = new ArrayList<>();
|
||||||
for (Track track : sequence.getTracks()) {
|
for (Track track : sequence.getTracks()) {
|
||||||
final int trackSize = track.size();
|
final int trackSize = track.size();
|
||||||
|
@ -38,8 +40,10 @@ public class MidiConverter implements Converter {
|
||||||
if (message instanceof MetaMessage mm) {
|
if (message instanceof MetaMessage mm) {
|
||||||
if (mm.getType() == SET_TEMPO) {
|
if (mm.getType() == SET_TEMPO) {
|
||||||
tempoEvents.add(event);
|
tempoEvents.add(event);
|
||||||
} else if (mm.getType() == TRACK_NAME) {
|
} else if (mm.getType() == TRACK_NAME && isFirst) {
|
||||||
songName = new String(mm.getData()) + " (" + name + ")"; // i have put the ` (filename)` just in case the sequence is getting sus (like Track 2 for example)
|
songName = new String(mm.getData()) + " (" + name + ")"; // i have put the ` (filename)` just in case the sequence is getting sus (like Track 2 for example)
|
||||||
|
|
||||||
|
isFirst = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue