From 470513d4978a57ee276edb425993602404b77f11 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lumi=C3=A8re=20=C3=89lev=C3=A9?= <88174309+PoneyClairDeLune@users.noreply.github.com> Date: Wed, 8 May 2024 19:25:38 +0000 Subject: [PATCH] Bug fixes for SC-8850 hardcoded performance. --- src/fakeSc8850/index.js | 23 +++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) diff --git a/src/fakeSc8850/index.js b/src/fakeSc8850/index.js index 341ff8b6..0a8292a6 100644 --- a/src/fakeSc8850/index.js +++ b/src/fakeSc8850/index.js @@ -22,11 +22,30 @@ let currentPerformance; demoModes[9] = "gm"; let useMidiBus = false; -let generateSwitch = function (ch = 0) { +let generateSwitch = function (ch = 0, min, max) { + if (min != undefined && max == undefined) { + console.warn(`Invalid bounds for channel switch generation.`); + return; + }; + let data = [67, 16, 73, 11, 0, 0, ch]; + if (min != undefined) { + data.push(Math.floor(Math.log2(max - min + 1)), min); + }; + return { + type: 15, + track: 0, + data + }; +}; +let generateString = function (text) { + let data = [67, 16, 76, 6, 0, 0]; + for (let c = 0; c < text.length; c ++) { + data.push(text.charCodeAt(c)); + }; return { type: 15, track: 0, - data: [67, 16, 73, 11, 0, 0, ch] + data }; };