fix: some nbs songs not loading (layers issue)

This commit is contained in:
ChomeNS
2025-04-18 11:41:35 +07:00
parent 2cc5e6dc9c
commit d639fa7f6b
2 changed files with 12 additions and 3 deletions

View File

@@ -185,7 +185,16 @@ public class NBSConverter implements Converter {
final String stringLayerNames = layerNames.toString();
final Song song = new Song(!songName.isBlank() ? songName : fileName, bot, songName, songAuthor, songOriginalAuthor, songDescription, stringLayerNames.substring(0, stringLayerNames.length() - 1), true);
final Song song = new Song(
!songName.isBlank() ? songName : fileName,
bot,
songName,
songAuthor,
songOriginalAuthor,
songDescription,
stringLayerNames.substring(0, Math.max(0, stringLayerNames.length() - 1)),
true
);
if (loop > 0) {
song.loopPosition = getMilliTime(loopStartTick, tempo);
// song.loopCount = maxLoopCount;
@@ -255,7 +264,7 @@ public class NBSConverter implements Converter {
(float) note.velocity * (float) layerVolume / 10000f,
getMilliTime(note.tick, tempo),
Byte.toUnsignedInt(note.panning),
Byte.toUnsignedInt(nbsLayers.get(note.layer).stereo),
nbsLayers.isEmpty() ? 100 : Byte.toUnsignedInt(nbsLayers.get(note.layer).stereo),
isRainbowToggle
)
);