spessasynth_lib 3.20.28 → 3.20.30

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.
@@ -12,10 +12,11 @@ import { SpessaSynthInfo } from '../../../utils/loggin.js'
12
12
 
13
13
  /**
14
14
  * @this {SpessaSynthProcessor}
15
+ * @param log {boolean}
15
16
  */
16
- export function resetAllControllers()
17
+ export function resetAllControllers(log= true)
17
18
  {
18
- SpessaSynthInfo("%cResetting all controllers!", consoleColors.info);
19
+ if (log) SpessaSynthInfo("%cResetting all controllers!", consoleColors.info);
19
20
  this.callEvent("allcontrollerreset", undefined);
20
21
  for (let channelNumber = 0; channelNumber < this.workletProcessorChannels.length; channelNumber++)
21
22
  {
@@ -279,13 +279,15 @@ export function systemExclusive(messageData, channelOffset = 0)
279
279
  if(messageValue === 0x00)
280
280
  {
281
281
  // this is a GS reset
282
- SpessaSynthInfo("%cGS system on", consoleColors.info);
282
+ SpessaSynthInfo("%cGS Reset received!", consoleColors.info);
283
+ this.resetAllControllers(false);
283
284
  this.system = "gs";
284
285
  }
285
286
  else if(messageValue === 0x7F)
286
287
  {
287
288
  // GS mode off
288
289
  SpessaSynthInfo("%cGS system off, switching to GM2", consoleColors.info);
290
+ this.resetAllControllers(false);
289
291
  this.system = "gm2";
290
292
  }
291
293
  return;
@@ -337,6 +339,27 @@ export function systemExclusive(messageData, channelOffset = 0)
337
339
  consoleColors.value);
338
340
  return;
339
341
 
342
+ // pan position
343
+ case 0x1C:
344
+ // 0 is random
345
+ let panpot = messageValue;
346
+ if(panpot === 0)
347
+ {
348
+ panpot = Math.floor(Math.random() * 128)
349
+ }
350
+ this.controllerChange(channel, midiControllers.pan, panpot);
351
+ break;
352
+
353
+ // chorus send
354
+ case 0x21:
355
+ this.controllerChange(channel, midiControllers.effects3Depth, messageValue);
356
+ break;
357
+
358
+ // reverb send
359
+ case 0x22:
360
+ this.controllerChange(channel, midiControllers.effects1Depth, messageValue);
361
+ break;
362
+
340
363
  case 0x40:
341
364
  case 0x41:
342
365
  case 0x42:
@@ -349,9 +372,17 @@ export function systemExclusive(messageData, channelOffset = 0)
349
372
  case 0x49:
350
373
  case 0x4A:
351
374
  case 0x4B:
352
- // scale tuning
375
+ // scale tuning: up to 12 bytes
376
+ const tuningBytes = messageData.length - 9; // data starts at 7 , minus checksum and f7
377
+ // read em bytes
378
+ const newTuning = new Int8Array(12);
379
+ for (let i = 0; i < tuningBytes; i++)
380
+ {
381
+ newTuning[i] = messageData[i + 7] - 64;
382
+ }
383
+ this.setOctaveTuning(channel, newTuning);
353
384
  const cents = messageValue - 64;
354
- SpessaSynthInfo(`%cChannel %c${channel}%c scale tuning. Cents %c${cents}%c, with %c${arrayToHexString(messageData)}`,
385
+ SpessaSynthInfo(`%cChannel %c${channel}%c octave scale tuning. Cents %c${newTuning.join(" ")}%c, with %c${arrayToHexString(messageData)}`,
355
386
  consoleColors.info,
356
387
  consoleColors.recognized,
357
388
  consoleColors.info,
@@ -459,6 +490,7 @@ export function systemExclusive(messageData, channelOffset = 0)
459
490
  // XG on
460
491
  case 0x7E:
461
492
  SpessaSynthInfo("%cXG system on", consoleColors.info);
493
+ this.resetAllControllers(false);
462
494
  this.system = "xg";
463
495
  break;
464
496
  }