spessasynth_lib 3.25.2 → 3.25.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/midi_parser/midi_editor.js +5 -5
- package/midi_parser/rmidi_writer.js +11 -6
- package/midi_parser/used_keys_loaded.js +3 -3
- package/package.json +1 -1
- package/synthetizer/worklet_processor.min.js +10 -10
- package/synthetizer/worklet_system/worklet_methods/controller_control/reset_controllers.js +2 -1
- package/synthetizer/worklet_system/worklet_methods/soundfont_management/get_preset.js +4 -2
- package/synthetizer/worklet_system/worklet_methods/system_exclusive.js +5 -4
- package/synthetizer/worklet_system/worklet_utilities/worklet_processor_channel.js +2 -2
- package/synthetizer/worklet_system/worklet_utilities/worklet_voice.js +2 -1
- package/utils/sysex_detector.js +13 -1
- package/utils/xg_hacks.js +32 -15
|
@@ -5,8 +5,8 @@ import { consoleColors } from "../utils/other.js";
|
|
|
5
5
|
|
|
6
6
|
import { customControllers } from "../synthetizer/worklet_system/worklet_utilities/controller_tables.js";
|
|
7
7
|
import { DEFAULT_PERCUSSION } from "../synthetizer/synth_constants.js";
|
|
8
|
-
import { isGMOn, isGSOn, isXGOn } from "../utils/sysex_detector.js";
|
|
9
|
-
import { isXGDrums, XG_SFX_VOICE } from "../utils/xg_hacks.js";
|
|
8
|
+
import { isGM2On, isGMOn, isGSOn, isXGOn } from "../utils/sysex_detector.js";
|
|
9
|
+
import { isSystemXG, isXGDrums, XG_SFX_VOICE } from "../utils/xg_hacks.js";
|
|
10
10
|
|
|
11
11
|
/**
|
|
12
12
|
* @param ticks {number}
|
|
@@ -380,7 +380,7 @@ export function modifyMIDI(
|
|
|
380
380
|
};
|
|
381
381
|
|
|
382
382
|
// on xg, add lsb
|
|
383
|
-
if (system
|
|
383
|
+
if (isSystemXG(system))
|
|
384
384
|
{
|
|
385
385
|
// xg drums: msb can be 120, 126 or 127
|
|
386
386
|
if (change.isDrum)
|
|
@@ -504,9 +504,9 @@ export function modifyMIDI(
|
|
|
504
504
|
}
|
|
505
505
|
else
|
|
506
506
|
// check for GM/2 on
|
|
507
|
-
if (isGMOn(e))
|
|
507
|
+
if (isGMOn(e) || isGM2On(e))
|
|
508
508
|
{
|
|
509
|
-
// that's a
|
|
509
|
+
// that's a GM1 system change, remove it!
|
|
510
510
|
SpessaSynthInfo(
|
|
511
511
|
"%cGM/2 on detected, removing!",
|
|
512
512
|
consoleColors.info
|
|
@@ -7,8 +7,8 @@ import { SpessaSynthGroup, SpessaSynthGroupEnd, SpessaSynthInfo } from "../utils
|
|
|
7
7
|
import { consoleColors } from "../utils/other.js";
|
|
8
8
|
import { writeLittleEndian } from "../utils/byte_functions/little_endian.js";
|
|
9
9
|
import { DEFAULT_PERCUSSION } from "../synthetizer/synth_constants.js";
|
|
10
|
-
import { chooseBank, parseBankSelect } from "../utils/xg_hacks.js";
|
|
11
|
-
import { isGMOn, isGSDrumsOn, isGSOn, isXGOn } from "../utils/sysex_detector.js";
|
|
10
|
+
import { chooseBank, isSystemXG, parseBankSelect } from "../utils/xg_hacks.js";
|
|
11
|
+
import { isGM2On, isGMOn, isGSDrumsOn, isGSOn, isXGOn } from "../utils/sysex_detector.js";
|
|
12
12
|
|
|
13
13
|
/**
|
|
14
14
|
* @enum {string}
|
|
@@ -183,12 +183,17 @@ export function writeRMIDI(
|
|
|
183
183
|
}
|
|
184
184
|
else if (isGMOn(e))
|
|
185
185
|
{
|
|
186
|
+
// we do not want gm1
|
|
186
187
|
system = "gm";
|
|
187
188
|
unwantedSystems.push({
|
|
188
189
|
tNum: trackNum,
|
|
189
190
|
e: e
|
|
190
191
|
});
|
|
191
192
|
}
|
|
193
|
+
else if (isGM2On(e))
|
|
194
|
+
{
|
|
195
|
+
system = "gm2";
|
|
196
|
+
}
|
|
192
197
|
continue;
|
|
193
198
|
}
|
|
194
199
|
const sysexChannel = [9, 0, 1, 2, 3, 4, 5, 6, 7, 8, 10, 11, 12, 13, 14, 15][e.messageData[5] & 0x0F] + portOffset;
|
|
@@ -204,7 +209,7 @@ export function writeRMIDI(
|
|
|
204
209
|
const channel = channelsInfo[chNum];
|
|
205
210
|
if (status === messageTypes.programChange)
|
|
206
211
|
{
|
|
207
|
-
const isXG = system
|
|
212
|
+
const isXG = isSystemXG(system);
|
|
208
213
|
// check if the preset for this program exists
|
|
209
214
|
const initialProgram = e.messageData[0];
|
|
210
215
|
if (channel.drums)
|
|
@@ -274,7 +279,7 @@ export function writeRMIDI(
|
|
|
274
279
|
{
|
|
275
280
|
// There is a preset with this bank. Add offset. For drums add the normal offset.
|
|
276
281
|
let drumBank = bank;
|
|
277
|
-
if (system
|
|
282
|
+
if (isSystemXG(system) && bank === 128)
|
|
278
283
|
{
|
|
279
284
|
bank = 127;
|
|
280
285
|
}
|
|
@@ -384,7 +389,7 @@ export function writeRMIDI(
|
|
|
384
389
|
const targetBank = (soundfont.getPreset(
|
|
385
390
|
0,
|
|
386
391
|
has.program,
|
|
387
|
-
system
|
|
392
|
+
isSystemXG(system)
|
|
388
393
|
)?.bank + bankOffset) || bankOffset;
|
|
389
394
|
track.splice(indexToAdd, 0, new MIDIMessage(
|
|
390
395
|
ticks,
|
|
@@ -394,7 +399,7 @@ export function writeRMIDI(
|
|
|
394
399
|
});
|
|
395
400
|
|
|
396
401
|
// make sure to put xg if gm
|
|
397
|
-
if (system !== "gs" && system
|
|
402
|
+
if (system !== "gs" && !isSystemXG(system))
|
|
398
403
|
{
|
|
399
404
|
for (const m of unwantedSystems)
|
|
400
405
|
{
|
|
@@ -2,7 +2,7 @@ import { SpessaSynthGroupCollapsed, SpessaSynthGroupEnd, SpessaSynthInfo } from
|
|
|
2
2
|
import { consoleColors } from "../utils/other.js";
|
|
3
3
|
import { messageTypes, midiControllers } from "./midi_message.js";
|
|
4
4
|
import { DEFAULT_PERCUSSION } from "../synthetizer/synth_constants.js";
|
|
5
|
-
import { chooseBank, parseBankSelect } from "../utils/xg_hacks.js";
|
|
5
|
+
import { chooseBank, isSystemXG, parseBankSelect } from "../utils/xg_hacks.js";
|
|
6
6
|
import { isGSDrumsOn, isXGOn } from "../utils/sysex_detector.js";
|
|
7
7
|
|
|
8
8
|
/**
|
|
@@ -42,9 +42,9 @@ export function getUsedProgramsAndKeys(soundfont)
|
|
|
42
42
|
|
|
43
43
|
function updateString(ch)
|
|
44
44
|
{
|
|
45
|
-
const bank = chooseBank(ch.bank, ch.bankLSB, ch.drums, system
|
|
45
|
+
const bank = chooseBank(ch.bank, ch.bankLSB, ch.drums, isSystemXG(system));
|
|
46
46
|
// check if this exists in the soundfont
|
|
47
|
-
let exists = soundfont.getPreset(bank, ch.program, system
|
|
47
|
+
let exists = soundfont.getPreset(bank, ch.program, isSystemXG(system));
|
|
48
48
|
ch.actualBank = exists.bank;
|
|
49
49
|
ch.program = exists.program;
|
|
50
50
|
ch.string = ch.actualBank + ":" + ch.program;
|