spessasynth_lib 4.3.9 → 4.3.10

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/dist/index.d.ts CHANGED
@@ -596,6 +596,7 @@ declare class LibMIDIChannel {
596
596
  private readonly channel;
597
597
  private readonly synth;
598
598
  private readonly _systemParameters;
599
+ private readonly lockedMIDIParameters;
599
600
  private _patch;
600
601
  /**
601
602
  * The currently selected MIDI patch of the channel.
@@ -682,6 +683,7 @@ declare abstract class BasicSynthesizer {
682
683
  */
683
684
  protected readonly _outputCount = 16;
684
685
  protected readonly _systemParameters: GlobalSystemParameter;
686
+ protected readonly lockedMIDIParameters: Record<keyof GlobalMIDIParameter, boolean>;
685
687
  protected resolveMap: Map<keyof SynthesizerReturn, (data: SynthesizerReturn[keyof SynthesizerReturn]) => unknown>;
686
688
  protected renderingProgressTracker: Map<keyof SynthesizerProgress, ((args: number) => unknown) | ((args: number) => unknown)>;
687
689
  /**
package/dist/index.js CHANGED
@@ -256,6 +256,7 @@ var LibMIDIChannel = class {
256
256
  channel;
257
257
  synth;
258
258
  _systemParameters = { ...DEFAULT_CHANNEL_SYSTEM_PARAMETERS };
259
+ lockedMIDIParameters = Object.fromEntries(Object.keys(DEFAULT_CHANNEL_MIDI_PARAMETERS).map((k) => [k, false]));
259
260
  /**
260
261
  * @internal
261
262
  * @param channel
@@ -323,6 +324,7 @@ var LibMIDIChannel = class {
323
324
  * @param isLocked If the parameter should be locked.
324
325
  */
325
326
  lockMIDIParameter(parameter, isLocked) {
327
+ this.lockedMIDIParameters[parameter] = isLocked;
326
328
  this.synth.post({
327
329
  type: "lockChannelMIDIParameter",
328
330
  channelNumber: this.channel,
@@ -386,7 +388,7 @@ var LibMIDIChannel = class {
386
388
  * @internal
387
389
  */
388
390
  reset() {
389
- this._midiParameters = { ...DEFAULT_CHANNEL_MIDI_PARAMETERS };
391
+ for (const [key, value] of Object.entries(DEFAULT_CHANNEL_MIDI_PARAMETERS)) if (!this.lockedMIDIParameters[key]) this._midiParameters[key] = value;
390
392
  }
391
393
  };
392
394
  //#endregion
@@ -441,6 +443,7 @@ var BasicSynthesizer = class {
441
443
  */
442
444
  _outputCount = 16;
443
445
  _systemParameters = { ...DEFAULT_GLOBAL_SYSTEM_PARAMETERS };
446
+ lockedMIDIParameters = Object.fromEntries(Object.keys(DEFAULT_GLOBAL_MIDI_PARAMETERS).map((k) => [k, false]));
444
447
  resolveMap = /* @__PURE__ */ new Map();
445
448
  renderingProgressTracker = /* @__PURE__ */ new Map();
446
449
  /**
@@ -466,7 +469,7 @@ var BasicSynthesizer = class {
466
469
  this.registerInternalEvent("programChange", (e) => this.midiChannels[e.channel].patch = { ...e });
467
470
  this.registerInternalEvent("reset", () => {
468
471
  for (const c of this.midiChannels) c.reset();
469
- this._midiParameters = { ...DEFAULT_GLOBAL_MIDI_PARAMETERS };
472
+ for (const [key, value] of Object.entries(DEFAULT_GLOBAL_MIDI_PARAMETERS)) if (!this.lockedMIDIParameters[key]) this._midiParameters[key] = value;
470
473
  });
471
474
  }
472
475
  _midiParameters = { ...DEFAULT_GLOBAL_MIDI_PARAMETERS };
@@ -558,6 +561,7 @@ var BasicSynthesizer = class {
558
561
  },
559
562
  channelNumber: -1
560
563
  });
564
+ this.lockedMIDIParameters[parameter] = isLocked;
561
565
  }
562
566
  /**
563
567
  * Sets a system parameter to a given value.