From 04c7c64c9e5af790508948b8a35d2b7f6f534ffc Mon Sep 17 00:00:00 2001 From: ChomeNS <95471003+ChomeNS@users.noreply.github.com> Date: Sun, 2 Mar 2025 14:45:23 +0700 Subject: [PATCH] fix: FINALLY FIX THE PITCH ISSUE AFTER 2 YEARS !!!!!!! ISSUE RESOLVED 2025/02/03 2:40 PM WOWWWWWWWWWWWWW --- build-number.txt | 2 +- .../me/chayapak1/chomens_bot/song/NBSConverter.java | 12 ++++++------ 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/build-number.txt b/build-number.txt index fc68f3af..7f3589da 100644 --- a/build-number.txt +++ b/build-number.txt @@ -1 +1 @@ -1639 \ No newline at end of file +1651 \ No newline at end of file diff --git a/src/main/java/me/chayapak1/chomens_bot/song/NBSConverter.java b/src/main/java/me/chayapak1/chomens_bot/song/NBSConverter.java index b5b8155e..d72d8f25 100644 --- a/src/main/java/me/chayapak1/chomens_bot/song/NBSConverter.java +++ b/src/main/java/me/chayapak1/chomens_bot/song/NBSConverter.java @@ -115,13 +115,13 @@ public class NBSConverter implements Converter { while (true) { int tickJumps = buffer.getShort(); if (tickJumps == 0) break; - tick += tickJumps; + tick += (short) tickJumps; short layer = -1; while (true) { int layerJumps = buffer.getShort(); if (layerJumps == 0) break; - layer += layerJumps; + layer += (short) layerJumps; NBSNote note = new NBSNote(); note.tick = tick; note.layer = layer; @@ -181,11 +181,11 @@ public class NBSConverter implements Converter { } for (NBSNote note : nbsNotes) { Instrument instrument; - int key = note.key; + double key = note.key; if (note.instrument < instrumentIndex.length) { instrument = instrumentIndex[note.instrument]; - key = note.key + note.pitch / 100; + key = (double) ((note.key * 100) + note.pitch) / 100; } else { int index = note.instrument - instrumentIndex.length; @@ -239,7 +239,7 @@ public class NBSConverter implements Converter { instrument = Instrument.of(name); - key += (customInstrument.pitch + note.pitch) / 100; + key += (double) (customInstrument.pitch + note.pitch) / 100; } byte layerVolume = 100; @@ -247,7 +247,7 @@ public class NBSConverter implements Converter { layerVolume = nbsLayers.get(note.layer).volume; } - int pitch = key-33; + double pitch = key - 33; try { song.add(new Note(instrument, pitch, key, (float) note.velocity * (float) layerVolume / 10000f, getMilliTime(note.tick, tempo), Byte.toUnsignedInt(note.panning), Byte.toUnsignedInt(nbsLayers.get(note.layer).stereo)));