fix "Invalid song format" on some NBS songs with the pitch

This commit is contained in:
Chayapak 2023-08-28 17:12:33 +07:00
parent 623c569c99
commit 44db9f75b0

View file

@ -153,13 +153,13 @@ public class NBSConverter {
layerVolume = nbsLayers.get(note.layer).volume; layerVolume = nbsLayers.get(note.layer).volume;
} }
int key = note.key; int key = note.key + SongHandler.getInstance().pitch;
while (key < 33) key += 12; while (key < 33) key += 12;
while (key > 57) key -= 12; while (key > 57) key -= 12;
int pitch = key-33; int pitch = key-33;
int noteId = (pitch + instrument.instrumentId*25) + SongHandler.getInstance().pitch; int noteId = pitch + instrument.instrumentId*25;
song.add(new Note(noteId, getMilliTime(note.tick, tempo))); song.add(new Note(noteId, getMilliTime(note.tick, tempo)));
} }