spessasynth_core 4.4.1 → 4.4.2

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.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import { inflateSync } from "fflate";
2
2
  import { StbVorbis } from "stb-vorbis";
3
- //#region src/utils/byte_functions/big_endian.ts
3
+ // src/utils/byte_functions/big_endian.ts
4
4
  /**
5
5
  * Reads number as Big endian.
6
6
  * @param dataArray the array to read from.
@@ -38,8 +38,7 @@ function writeBigEndian(number, bytesAmount) {
38
38
  }
39
39
  return bytes;
40
40
  }
41
- //#endregion
42
- //#region src/utils/byte_functions/little_endian.ts
41
+ // src/utils/byte_functions/little_endian.ts
43
42
  /**
44
43
  * Reads the number as little endian from an IndexedByteArray. Uses BigInt to go above 32 bits.
45
44
  * @param dataArray the array to read from.
@@ -134,8 +133,7 @@ function signedInt8(byte) {
134
133
  if (byte > 127) return byte - 256;
135
134
  return byte;
136
135
  }
137
- //#endregion
138
- //#region src/utils/indexed_array.ts
136
+ // src/utils/indexed_array.ts
139
137
  /**
140
138
  * Indexed_array.ts
141
139
  * purpose: extends Uint8Array with a currentIndex property.
@@ -161,8 +159,7 @@ var IndexedByteArray = class extends Uint8Array {
161
159
  return a;
162
160
  }
163
161
  };
164
- //#endregion
165
- //#region src/utils/byte_functions/string.ts
162
+ // src/utils/byte_functions/string.ts
166
163
  /**
167
164
  * Reads bytes as an ASCII string. This version works with any numeric array.
168
165
  * @param dataArray the array to read from.
@@ -218,8 +215,7 @@ function writeBinaryStringIndexed(outArray, string, padLength = 0) {
218
215
  if (padLength > string.length) for (let i = 0; i < padLength - string.length; i++) outArray[outArray.currentIndex++] = 0;
219
216
  return outArray;
220
217
  }
221
- //#endregion
222
- //#region src/utils/byte_functions/variable_length_quantity.ts
218
+ // src/utils/byte_functions/variable_length_quantity.ts
223
219
  /**
224
220
  * Reads VLQ from a MIDI byte array.
225
221
  * @param midiByteArray the array to read from.
@@ -248,8 +244,7 @@ function writeVariableLengthQuantity(number) {
248
244
  }
249
245
  return bytes;
250
246
  }
251
- //#endregion
252
- //#region src/utils/other.ts
247
+ // src/utils/other.ts
253
248
  /**
254
249
  * Other.ts
255
250
  * purpose: contains some useful functions that don't belong in any specific category
@@ -299,8 +294,7 @@ const ConsoleColors = {
299
294
  recognized: "color: lime",
300
295
  value: "color: yellow; background-color: black;"
301
296
  };
302
- //#endregion
303
- //#region src/utils/fill_with_defaults.ts
297
+ // src/utils/fill_with_defaults.ts
304
298
  /**
305
299
  * Fills the object with default values.
306
300
  * @param obj object to fill.
@@ -312,8 +306,7 @@ function fillWithDefaults(obj, defObj) {
312
306
  ...obj
313
307
  };
314
308
  }
315
- //#endregion
316
- //#region src/utils/riff_chunk.ts
309
+ // src/utils/riff_chunk.ts
317
310
  /**
318
311
  * Riff_chunk.ts
319
312
  * reads a riff chunk and stores it as a class
@@ -420,7 +413,7 @@ var RIFFChunk = class RIFFChunk {
420
413
  const parts = [getStringBytes(headerWritten), sizeBytes];
421
414
  if (isList) parts.push(getStringBytes(header));
422
415
  parts.push(...chunks);
423
- if (totalSize % 2 !== 0) parts.push(new Uint8Array(1));
416
+ if (totalSize % 2 !== 0) parts.push(/* @__PURE__ */ new Uint8Array(1));
424
417
  return parts;
425
418
  }
426
419
  /**
@@ -468,8 +461,7 @@ var RIFFChunk = class RIFFChunk {
468
461
  });
469
462
  }
470
463
  };
471
- //#endregion
472
- //#region src/utils/write_wav.ts
464
+ // src/utils/write_wav.ts
473
465
  const DEFAULT_WAV_WRITE_OPTIONS = {
474
466
  normalizeAudio: true,
475
467
  loop: void 0,
@@ -638,8 +630,7 @@ function audioToWav(audioData, sampleRate, options = DEFAULT_WAV_WRITE_OPTIONS)
638
630
  if (cueOn) wavData.set(cueChunk, offset);
639
631
  return wavData.buffer;
640
632
  }
641
- //#endregion
642
- //#region src/utils/loggin.ts
633
+ // src/utils/loggin.ts
643
634
  /**
644
635
  * SpessaSynth can print out additional info to the console or print nothing at all.
645
636
  *
@@ -776,8 +767,7 @@ var SpessaLog = class {
776
767
  else this.info(`%c${what}%c is now set to %c${value}%c.`, ConsoleColors.recognized, ConsoleColors.info, ConsoleColors.value, ConsoleColors.info);
777
768
  }
778
769
  };
779
- //#endregion
780
- //#region src/utils/exports.ts
770
+ // src/utils/exports.ts
781
771
  const SpessaSynthCoreUtils = {
782
772
  ConsoleColors,
783
773
  readBigEndian,
@@ -787,8 +777,7 @@ const SpessaSynthCoreUtils = {
787
777
  readBinaryStringIndexed,
788
778
  readVariableLengthQuantity
789
779
  };
790
- //#endregion
791
- //#region src/midi/enums.ts
780
+ // src/midi/enums.ts
792
781
  /**
793
782
  * All MIDI 1.0 defined status bytes
794
783
  *
@@ -1032,8 +1021,7 @@ const NonRegisteredParameterTypesLSB = {
1032
1021
  envelopeDecayTime: 100,
1033
1022
  envelopeReleaseTime: 102
1034
1023
  };
1035
- //#endregion
1036
- //#region src/midi/midi_message.ts
1024
+ // src/midi/midi_message.ts
1037
1025
  /**
1038
1026
  * Midi_message.ts
1039
1027
  * purpose: contains enums for midi events and controllers and functions to parse them
@@ -1156,12 +1144,11 @@ var MIDIMessage = class MIDIMessage {
1156
1144
  ];
1157
1145
  }
1158
1146
  };
1159
- //#endregion
1160
- //#region src/utils/date.ts
1147
+ // src/utils/date.ts
1161
1148
  function toISODateString(date) {
1162
1149
  return date.toISOString().split(".")[0] + "Z";
1163
1150
  }
1164
- const translations = [new Map([
1151
+ const translations = [/* @__PURE__ */ new Map([
1165
1152
  ["domingo", "Sunday"],
1166
1153
  ["segunda-feira", "Monday"],
1167
1154
  ["terça-feira", "Tuesday"],
@@ -1236,8 +1223,7 @@ function parseDateString(dateString) {
1236
1223
  }
1237
1224
  return date;
1238
1225
  }
1239
- //#endregion
1240
- //#region src/synthesizer/audio_engine/synth_constants.ts
1226
+ // src/synthesizer/audio_engine/synth_constants.ts
1241
1227
  /**
1242
1228
  * Synthesizer's default voice cap.
1243
1229
  *
@@ -1288,8 +1274,7 @@ const SPESSASYNTH_GAIN_FACTOR = .6;
1288
1274
  * @group Synthesizer.Constants
1289
1275
  */
1290
1276
  const SPESSA_BUFSIZE = 128;
1291
- //#endregion
1292
- //#region src/utils/midi_hacks.ts
1277
+ // src/utils/midi_hacks.ts
1293
1278
  const GM2_DEFAULT_BANK = 121;
1294
1279
  /**
1295
1280
  * A class for handling various ways of selecting patches (GS, XG, GM2)
@@ -1326,8 +1311,7 @@ var BankSelectHacks = class {
1326
1311
  return Math.max(0, bankMSB - bankOffset);
1327
1312
  }
1328
1313
  };
1329
- //#endregion
1330
- //#region src/soundbank/basic_soundbank/generator_types.ts
1314
+ // src/soundbank/basic_soundbank/generator_types.ts
1331
1315
  /**
1332
1316
  * All SoundFont2 Generator enumerations.
1333
1317
  *
@@ -1416,7 +1400,7 @@ const GENERATORS_AMOUNT = MAX_GENERATOR + 1;
1416
1400
  * SF2 2.04 section 8.1.2 says that they must be ignored in preset zones.
1417
1401
  * @internal
1418
1402
  */
1419
- const INSTRUMENT_ONLY_GENERATORS = new Set([
1403
+ const INSTRUMENT_ONLY_GENERATORS = /* @__PURE__ */ new Set([
1420
1404
  GeneratorTypes.startAddrsOffset,
1421
1405
  GeneratorTypes.endAddrOffset,
1422
1406
  GeneratorTypes.startloopAddrsOffset,
@@ -1804,8 +1788,7 @@ const GeneratorLimits = Object.freeze({
1804
1788
  nrpn: 1
1805
1789
  }
1806
1790
  });
1807
- //#endregion
1808
- //#region src/soundbank/enums.ts
1791
+ // src/soundbank/enums.ts
1809
1792
  /**
1810
1793
  * All SF2 Sample Types.
1811
1794
  *
@@ -1901,15 +1884,14 @@ const ModulatorTransformTypes = {
1901
1884
  */
1902
1885
  absolute: 2
1903
1886
  };
1904
- //#endregion
1905
- //#region src/synthesizer/audio_engine/channel/reset.ts
1887
+ // src/synthesizer/audio_engine/channel/reset.ts
1906
1888
  /**
1907
1889
  * An array with the default MIDI controller values.
1908
1890
  * Note that these are 14-bit, requiring a 7-bit shift to the right for 7-bit values!
1909
1891
  *
1910
1892
  * @group Synthesizer.Constants
1911
1893
  */
1912
- const DEFAULT_MIDI_CONTROLLERS = new Int16Array(128).fill(0);
1894
+ const DEFAULT_MIDI_CONTROLLERS = (/* @__PURE__ */ new Int16Array(128)).fill(0);
1913
1895
  const setResetValue = (index, v) => DEFAULT_MIDI_CONTROLLERS[index] = v << 7;
1914
1896
  setResetValue(MIDIControllers.mainVolume, 100);
1915
1897
  setResetValue(MIDIControllers.balance, 64);
@@ -1934,7 +1916,7 @@ setResetValue(MIDIControllers.nonRegisteredParameterMSB, 127);
1934
1916
  *
1935
1917
  * @group Synthesizer.Drum Sets
1936
1918
  */
1937
- const DEFAULT_DRUM_REVERB = new Int8Array(128).fill(127);
1919
+ const DEFAULT_DRUM_REVERB = (/* @__PURE__ */ new Int8Array(128)).fill(127);
1938
1920
  DEFAULT_DRUM_REVERB[35] = 0;
1939
1921
  DEFAULT_DRUM_REVERB[36] = 0;
1940
1922
  /**
@@ -2049,8 +2031,7 @@ function resetRP15() {
2049
2031
  this.polyPressures.fill(0);
2050
2032
  this.computeModulatorsAll(0, ModulatorControllerSources.polyPressure);
2051
2033
  }
2052
- //#endregion
2053
- //#region src/midi/drum_parameters.ts
2034
+ // src/midi/drum_parameters.ts
2054
2035
  /**
2055
2036
  * This class contains various utilities for manipulating {@link DrumParameter}s.
2056
2037
  *
@@ -2128,8 +2109,7 @@ var DrumParameterUtils = class {
2128
2109
  dest.program = source.program;
2129
2110
  }
2130
2111
  };
2131
- //#endregion
2132
- //#region src/midi/midi_tools/apply_snapshot.ts
2112
+ // src/midi/midi_tools/apply_snapshot.ts
2133
2113
  /**
2134
2114
  * Modifies the sequence *in-place* according to the locked presets and controllers in the given snapshot.
2135
2115
  *
@@ -2193,8 +2173,7 @@ function applySnapshotInternal(midi, snapshot) {
2193
2173
  midiParams
2194
2174
  });
2195
2175
  }
2196
- //#endregion
2197
- //#region src/midi/midi_tools/get_note_times.ts
2176
+ // src/midi/midi_tools/get_note_times.ts
2198
2177
  /**
2199
2178
  * Calculates all note times in seconds.
2200
2179
  * @param midi the midi to use
@@ -2260,8 +2239,7 @@ function getNoteTimesInternal(midi, minDrumLength = 0) {
2260
2239
  }
2261
2240
  return noteTimes;
2262
2241
  }
2263
- //#endregion
2264
- //#region src/soundbank/basic_soundbank/midi_patch.ts
2242
+ // src/soundbank/basic_soundbank/midi_patch.ts
2265
2243
  /**
2266
2244
  * A class containing useful functions for working with MIDI patches.
2267
2245
  *
@@ -2428,8 +2406,7 @@ var MIDIPatchTools = class MIDIPatchTools {
2428
2406
  return presets.find((p) => p.isDrum) ?? presets[0];
2429
2407
  }
2430
2408
  };
2431
- //#endregion
2432
- //#region src/midi/midi_tools/sysex_data.ts
2409
+ // src/midi/midi_tools/sysex_data.ts
2433
2410
  const GSUserDrumParamMap = {
2434
2411
  pitchCoarse: 1,
2435
2412
  pitchFine: 127,
@@ -2499,8 +2476,7 @@ const GSDelayAddressMap = {
2499
2476
  feedback: 89,
2500
2477
  sendLevelToReverb: 90
2501
2478
  };
2502
- //#endregion
2503
- //#region src/midi/midi_tools/midi_utils.ts
2479
+ // src/midi/midi_tools/midi_utils.ts
2504
2480
  const OTHER = Object.freeze({ type: "Other" });
2505
2481
  /**
2506
2482
  * This class contains useful utilities for manipulating and parsing System Exclusive and other MIDI 1.0 messages.
@@ -4040,9 +4016,7 @@ var MIDIUtils = class MIDIUtils {
4040
4016
  case 10:
4041
4017
  actualDrumParam = 12;
4042
4018
  break;
4043
- case 11:
4044
- actualDrumParam = 0;
4045
- break;
4019
+ case 11: actualDrumParam = 0;
4046
4020
  }
4047
4021
  const address2 = a2 & 240 | actualDrumParam;
4048
4022
  const analyzed = new Array();
@@ -4512,8 +4486,7 @@ var MIDIUtils = class MIDIUtils {
4512
4486
  return OTHER;
4513
4487
  }
4514
4488
  };
4515
- //#endregion
4516
- //#region src/midi/midi_tools/parameter_tracker.ts
4489
+ // src/midi/midi_tools/parameter_tracker.ts
4517
4490
  /**
4518
4491
  * A class for tracking RPN/NRPN messages
4519
4492
  */
@@ -4705,8 +4678,7 @@ var ParameterTracker = class {
4705
4678
  return this.isRegistered ? MIDIUtils.analyzeRPN(this.channel, this.rpnMSB.v << 7 | this.rpnLSB.v, v) : MIDIUtils.analyzeNRPN(this.channel, this.nrpnMSB.v << 7 | this.nrpnLSB.v, v);
4706
4679
  }
4707
4680
  };
4708
- //#endregion
4709
- //#region src/midi/midi_tools/midi_editor.ts
4681
+ // src/midi/midi_tools/midi_editor.ts
4710
4682
  /**
4711
4683
  * A single-use class for editing a MIDI file.
4712
4684
  * @internal
@@ -4858,7 +4830,7 @@ var MIDIEditor = class {
4858
4830
  relativeFineTune: this.channelChanges.get(i)?.fineTune ?? 0,
4859
4831
  currentFineTune: 0,
4860
4832
  currentKeyShift: 0,
4861
- noteShifts: new Int16Array(128),
4833
+ noteShifts: /* @__PURE__ */ new Int16Array(128),
4862
4834
  pendingParam: void 0
4863
4835
  });
4864
4836
  }
@@ -5297,9 +5269,7 @@ var MIDIEditor = class {
5297
5269
  case "Controller Change":
5298
5270
  this.handleControllerChange(data.controller, data.value, data.channel);
5299
5271
  break;
5300
- case "Channel MIDI Param":
5301
- this.handleChannelMIDIParam(channel, data, true);
5302
- break;
5272
+ case "Channel MIDI Param": this.handleChannelMIDIParam(channel, data, true);
5303
5273
  }
5304
5274
  const [msbCC, lsbCC] = channelStatus.param.paramControllers;
5305
5275
  channelStatus.clearedParams.selection[msbCC] = true;
@@ -5578,8 +5548,7 @@ var MIDIEditor = class {
5578
5548
  return output;
5579
5549
  }
5580
5550
  };
5581
- //#endregion
5582
- //#region src/midi/midi_tools/used_programs_and_keys.ts
5551
+ // src/midi/midi_tools/used_programs_and_keys.ts
5583
5552
  /**
5584
5553
  * Gets the used programs and keys for this MIDI file with a given sound bank.
5585
5554
  * @param mid The MIDI file to analyze.
@@ -5701,9 +5670,7 @@ function getUsedProgramsAndKeys(mid, soundBank) {
5701
5670
  case MIDIControllers.bankSelect:
5702
5671
  ch.bankMSB = value;
5703
5672
  break;
5704
- case MIDIControllers.bankSelectLSB:
5705
- ch.bankLSB = value;
5706
- break;
5673
+ case MIDIControllers.bankSelectLSB: ch.bankLSB = value;
5707
5674
  }
5708
5675
  break;
5709
5676
  }
@@ -5805,8 +5772,7 @@ function getUsedProgramsAndKeys(mid, soundBank) {
5805
5772
  SpessaLog.groupEnd();
5806
5773
  return usedProgramsAndKeys;
5807
5774
  }
5808
- //#endregion
5809
- //#region src/midi/midi_track.ts
5775
+ // src/midi/midi_track.ts
5810
5776
  /**
5811
5777
  * This class represents a single MIDI track in a {@link BasicMIDI} sequence.
5812
5778
  *
@@ -5874,8 +5840,7 @@ var MIDITrack = class MIDITrack {
5874
5840
  this.events.push(...events);
5875
5841
  }
5876
5842
  };
5877
- //#endregion
5878
- //#region src/midi/read/midi.ts
5843
+ // src/midi/read/midi.ts
5879
5844
  const DataBytesAmount = {
5880
5845
  8: 2,
5881
5846
  9: 2,
@@ -5969,8 +5934,7 @@ function parseSMFInternal(outputMIDI, smfFileBinary, fileName) {
5969
5934
  outputMIDI.flush(false);
5970
5935
  SpessaLog.groupEnd();
5971
5936
  }
5972
- //#endregion
5973
- //#region src/midi/read/rmidi.ts
5937
+ // src/midi/read/rmidi.ts
5974
5938
  /**
5975
5939
  * Loads a RIFF MIDI File (RMIDI) from given binary data
5976
5940
  * @param outputMIDI The BasicMIDI instance to populate with the parsed MIDI data.
@@ -6055,9 +6019,7 @@ function parseRMIDIInternal(outputMIDI, binaryData, fileName) {
6055
6019
  case "MENC":
6056
6020
  outputMIDI.rmidiInfo.midiEncoding = infoData;
6057
6021
  break;
6058
- case "DBNK":
6059
- dbnk = readLittleEndian(infoData, 2);
6060
- break;
6022
+ case "DBNK": dbnk = readLittleEndian(infoData, 2);
6061
6023
  }
6062
6024
  }
6063
6025
  }
@@ -6070,8 +6032,7 @@ function parseRMIDIInternal(outputMIDI, binaryData, fileName) {
6070
6032
  parseSMFInternal(outputMIDI, smfFileBinary, fileName);
6071
6033
  if (outputMIDI.embeddedSoundBank !== void 0 && dbnk !== void 0) outputMIDI.bankOffset = dbnk;
6072
6034
  }
6073
- //#endregion
6074
- //#region src/midi/read/xmf.ts
6035
+ // src/midi/read/xmf.ts
6075
6036
  const metadataTypes = {
6076
6037
  XMFFileType: 0,
6077
6038
  nodeName: 1,
@@ -6190,20 +6151,18 @@ var XMFNode = class XMFNode {
6190
6151
  case unpackerIDs.none:
6191
6152
  unpacker.standardID = readVariableLengthQuantity(unpackersData);
6192
6153
  break;
6193
- case unpackerIDs.MMAUnpacker:
6194
- {
6195
- let manufacturerID = unpackersData[unpackersData.currentIndex++];
6196
- if (manufacturerID === 0) {
6197
- manufacturerID <<= 8;
6198
- manufacturerID |= unpackersData[unpackersData.currentIndex++];
6199
- manufacturerID <<= 8;
6200
- manufacturerID |= unpackersData[unpackersData.currentIndex++];
6201
- }
6202
- const manufacturerInternalID = readVariableLengthQuantity(unpackersData);
6203
- unpacker.manufacturerID = manufacturerID;
6204
- unpacker.manufacturerInternalID = manufacturerInternalID;
6154
+ case unpackerIDs.MMAUnpacker: {
6155
+ let manufacturerID = unpackersData[unpackersData.currentIndex++];
6156
+ if (manufacturerID === 0) {
6157
+ manufacturerID <<= 8;
6158
+ manufacturerID |= unpackersData[unpackersData.currentIndex++];
6159
+ manufacturerID <<= 8;
6160
+ manufacturerID |= unpackersData[unpackersData.currentIndex++];
6205
6161
  }
6206
- break;
6162
+ const manufacturerInternalID = readVariableLengthQuantity(unpackersData);
6163
+ unpacker.manufacturerID = manufacturerID;
6164
+ unpacker.manufacturerInternalID = manufacturerInternalID;
6165
+ }
6207
6166
  }
6208
6167
  unpacker.decodedSize = readVariableLengthQuantity(unpackersData);
6209
6168
  this.nodeUnpackers.push(unpacker);
@@ -6314,7 +6273,6 @@ function loadXMF(midi, binaryData, fileName) {
6314
6273
  case "StandardMIDIFileType1":
6315
6274
  SpessaLog.info("%cFound embedded MIDI!", ConsoleColors.recognized);
6316
6275
  midiArray = node.nodeData;
6317
- break;
6318
6276
  }
6319
6277
  else for (const n of node.innerNodes) searchNode(n);
6320
6278
  };
@@ -6323,12 +6281,11 @@ function loadXMF(midi, binaryData, fileName) {
6323
6281
  if (!midiArray) throw new Error("No MIDI data in the XMF file!");
6324
6282
  parseSMFInternal(midi, midiArray, fileName);
6325
6283
  }
6326
- //#endregion
6327
- //#region src/midi/read/tracker/tracker_channel.ts
6284
+ // src/midi/read/tracker/tracker_channel.ts
6328
6285
  /**
6329
6286
  * The 64-step sine table shared by the vibrato and tremolo effects.
6330
6287
  */
6331
- const SINE_TABLE = new Int8Array(64);
6288
+ const SINE_TABLE = /* @__PURE__ */ new Int8Array(64);
6332
6289
  /**
6333
6290
  * The random waveform table,
6334
6291
  * Fixed so conversions are deterministic, and we can test them.
@@ -6657,9 +6614,7 @@ var TrackerChannel = class TrackerChannel {
6657
6614
  case 14:
6658
6615
  this.slideVolume(Math.floor(this.volume / 2));
6659
6616
  break;
6660
- case 15:
6661
- this.slideVolume(this.volume);
6662
- break;
6617
+ case 15: this.slideVolume(this.volume);
6663
6618
  }
6664
6619
  }
6665
6620
  /**
@@ -6672,8 +6627,7 @@ var TrackerChannel = class TrackerChannel {
6672
6627
  this.tremorCounter = 0;
6673
6628
  }
6674
6629
  };
6675
- //#endregion
6676
- //#region src/midi/read/tracker/tracker_midi_track.ts
6630
+ // src/midi/read/tracker/tracker_midi_track.ts
6677
6631
  /**
6678
6632
  * The controller that sets the sample offset in units of 256 sample points (low 7 bits).
6679
6633
  */
@@ -6708,7 +6662,7 @@ var TrackerMIDITrack = class {
6708
6662
  events = new Array();
6709
6663
  pitchEvents = new Array();
6710
6664
  pitchValues = new Array();
6711
- controllers = new Int16Array(128).fill(-1);
6665
+ controllers = (/* @__PURE__ */ new Int16Array(128)).fill(-1);
6712
6666
  program = -1;
6713
6667
  pitch = 0;
6714
6668
  maxPitch = 0;
@@ -6817,8 +6771,7 @@ var TrackerMIDITrack = class {
6817
6771
  return event;
6818
6772
  }
6819
6773
  };
6820
- //#endregion
6821
- //#region src/soundbank/soundfont/write/sdta.ts
6774
+ // src/soundbank/soundfont/write/sdta.ts
6822
6775
  function getSDTA(bank, smplStartOffsets, smplEndOffsets, rf64, progressFunction) {
6823
6776
  let writtenCount = 0;
6824
6777
  const sampleData = [];
@@ -6830,7 +6783,7 @@ function getSDTA(bank, smplStartOffsets, smplEndOffsets, rf64, progressFunction)
6830
6783
  SpessaLog.info(`%cWrote sample %c${writtenCount}. ${s.name}%c of %c${bank.samples.length}.`, ConsoleColors.info, ConsoleColors.recognized, ConsoleColors.info, ConsoleColors.recognized);
6831
6784
  sampleData.push(r);
6832
6785
  sampleSize.push(r.length);
6833
- if (!s.isCompressed) sampleData.push(new Uint8Array(92));
6786
+ if (!s.isCompressed) sampleData.push(/* @__PURE__ */ new Uint8Array(92));
6834
6787
  }
6835
6788
  const smpl = RIFFChunk.getParts("smpl", sampleData, rf64);
6836
6789
  const sdta = RIFFChunk.getParts("sdta", smpl, rf64, true);
@@ -6853,8 +6806,7 @@ function getSDTA(bank, smplStartOffsets, smplEndOffsets, rf64, progressFunction)
6853
6806
  }
6854
6807
  return sdta;
6855
6808
  }
6856
- //#endregion
6857
- //#region src/soundbank/basic_soundbank/basic_sample.ts
6809
+ // src/soundbank/basic_soundbank/basic_sample.ts
6858
6810
  const RESAMPLE_RATE = 48e3;
6859
6811
  /**
6860
6812
  * A basic sample represents a single audio sample with associated parameters.
@@ -7059,7 +7011,6 @@ var BasicSample = class {
7059
7011
  case SampleTypes.linkedSample:
7060
7012
  this.setSampleType(SampleTypes.linkedSample);
7061
7013
  sample.setSampleType(SampleTypes.linkedSample);
7062
- break;
7063
7014
  }
7064
7015
  }
7065
7016
  /**
@@ -7200,25 +7151,27 @@ var SoundFontSample = class extends BasicSample {
7200
7151
  this.endByteOffset = sampleEndIndex;
7201
7152
  this.sampleID = sampleIndex;
7202
7153
  const smplStart = sampleDataArray instanceof IndexedByteArray ? sampleDataArray.currentIndex : 0;
7203
- if (sampleDataArray instanceof IndexedByteArray) if (compressed) {
7204
- this.loopStart += this.startByteOffset / 2;
7205
- this.loopEnd += this.startByteOffset / 2;
7206
- this.setCompressedData(sampleDataArray.slice(this.startByteOffset / 2 + smplStart, this.endByteOffset / 2 + smplStart));
7207
- } else this.s16leData = sampleDataArray.slice(smplStart + this.startByteOffset, smplStart + this.endByteOffset);
7208
- else this.setAudioData(sampleDataArray.slice(this.startByteOffset / 2, this.endByteOffset / 2), sampleRate);
7154
+ if (sampleDataArray instanceof IndexedByteArray) {
7155
+ if (compressed) {
7156
+ this.loopStart += this.startByteOffset / 2;
7157
+ this.loopEnd += this.startByteOffset / 2;
7158
+ this.setCompressedData(sampleDataArray.slice(this.startByteOffset / 2 + smplStart, this.endByteOffset / 2 + smplStart));
7159
+ } else this.s16leData = sampleDataArray.slice(smplStart + this.startByteOffset, smplStart + this.endByteOffset);
7160
+ } else this.setAudioData(sampleDataArray.slice(this.startByteOffset / 2, this.endByteOffset / 2), sampleRate);
7209
7161
  this.linkedSampleIndex = linkedSampleIndex;
7210
7162
  }
7211
7163
  getLinkedSample(samplesArray) {
7212
7164
  if (this.linkedSample || !this.isLinked) return;
7213
7165
  const linked = samplesArray[this.linkedSampleIndex];
7214
- if (linked) if (linked.linkedSample) {
7215
- SpessaLog.info(`%cInvalid linked sample for ${this.name}: ${linked.name} is already linked to ${linked.linkedSample.name}`, ConsoleColors.warn);
7216
- this.unlinkSample();
7217
- } else if (linked === this) {
7218
- SpessaLog.info(`%cInvalid linked sample for ${this.name}: linked to itself.`, ConsoleColors.warn);
7219
- this.unlinkSample();
7220
- } else this.setLinkedSample(linked, this.sampleType);
7221
- else {
7166
+ if (linked) {
7167
+ if (linked.linkedSample) {
7168
+ SpessaLog.info(`%cInvalid linked sample for ${this.name}: ${linked.name} is already linked to ${linked.linkedSample.name}`, ConsoleColors.warn);
7169
+ this.unlinkSample();
7170
+ } else if (linked === this) {
7171
+ SpessaLog.info(`%cInvalid linked sample for ${this.name}: linked to itself.`, ConsoleColors.warn);
7172
+ this.unlinkSample();
7173
+ } else this.setLinkedSample(linked, this.sampleType);
7174
+ } else {
7222
7175
  SpessaLog.info(`%cInvalid linked sample for ${this.name}. Setting to mono.`, ConsoleColors.warn);
7223
7176
  this.unlinkSample();
7224
7177
  }
@@ -7234,7 +7187,7 @@ var SoundFontSample = class extends BasicSample {
7234
7187
  const byteLength = this.endByteOffset - this.startByteOffset;
7235
7188
  if (byteLength < 1) {
7236
7189
  SpessaLog.warn(`Invalid sample ${this.name}! Invalid length: ${byteLength}`);
7237
- return new Float32Array(1);
7190
+ return /* @__PURE__ */ new Float32Array(1);
7238
7191
  }
7239
7192
  const audioData = new Float32Array(byteLength / 2);
7240
7193
  const convertedSigned16 = new Int16Array(this.s16leData.buffer);
@@ -7245,7 +7198,7 @@ var SoundFontSample = class extends BasicSample {
7245
7198
  }
7246
7199
  getRawData(allowVorbis) {
7247
7200
  if (this.dataOverridden || this.compressedData) return super.getRawData(allowVorbis);
7248
- return this.s16leData ?? new Uint8Array(0);
7201
+ return this.s16leData ?? /* @__PURE__ */ new Uint8Array(0);
7249
7202
  }
7250
7203
  };
7251
7204
  /**
@@ -7280,8 +7233,7 @@ function readSample(index, sampleHeaderData, smplArrayData) {
7280
7233
  const sampleType = readLittleEndianIndexed(sampleHeaderData, 2);
7281
7234
  return new SoundFontSample(sampleName, sampleStartIndex, sampleEndIndex, sampleLoopStartIndex, sampleLoopEndIndex, sampleRate, samplePitch, samplePitchCorrection, sampleLink, sampleType, smplArrayData, index);
7282
7235
  }
7283
- //#endregion
7284
- //#region src/soundbank/soundfont/write/shdr.ts
7236
+ // src/soundbank/soundfont/write/shdr.ts
7285
7237
  function getSHDR(bank, smplStartOffsets, smplEndOffsets, rf64) {
7286
7238
  const sampleLength = 46;
7287
7239
  const shdrSize = sampleLength * (bank.samples.length + 1);
@@ -7323,8 +7275,7 @@ function getSHDR(bank, smplStartOffsets, smplEndOffsets, rf64) {
7323
7275
  xdta: RIFFChunk.write("shdr", xshdrData, rf64)
7324
7276
  };
7325
7277
  }
7326
- //#endregion
7327
- //#region src/utils/byte_functions/bit_mask.ts
7278
+ // src/utils/byte_functions/bit_mask.ts
7328
7279
  /**
7329
7280
  * Converts a given bit to boolean.
7330
7281
  * @param num The input number.
@@ -7336,16 +7287,15 @@ function bitMaskToBool(num, bit) {
7336
7287
  function toNumericBool(bool) {
7337
7288
  return bool ? 1 : 0;
7338
7289
  }
7339
- //#endregion
7340
- //#region src/soundbank/basic_soundbank/modulator_curves.ts
7290
+ // src/soundbank/basic_soundbank/modulator_curves.ts
7341
7291
  /**
7342
7292
  * Modulator_curves.ts
7343
7293
  * precomputes modulator concave and convex curves and calculates a curve value for a given polarity, direction and type
7344
7294
  */
7345
7295
  const MODULATOR_RESOLUTION = 16384;
7346
7296
  const MOD_CURVE_TYPES_AMOUNT = Object.keys(ModulatorCurveTypes).length;
7347
- const concave = new Float32Array(MODULATOR_RESOLUTION + 1);
7348
- const convex = new Float32Array(MODULATOR_RESOLUTION + 1);
7297
+ const concave = /* @__PURE__ */ new Float32Array(16385);
7298
+ const convex = /* @__PURE__ */ new Float32Array(16385);
7349
7299
  concave[0] = 0;
7350
7300
  concave[concave.length - 1] = 1;
7351
7301
  convex[0] = 0;
@@ -7376,21 +7326,20 @@ function getModulatorCurveValue(transformType, curveType, value) {
7376
7326
  case ModulatorCurveTypes.concave:
7377
7327
  if (isBipolar) {
7378
7328
  value = value * 2 - 1;
7379
- if (value < 0) return -concave[Math.trunc(value * -MODULATOR_RESOLUTION)];
7329
+ if (value < 0) return -concave[Math.trunc(value * -16384)];
7380
7330
  return concave[Math.trunc(value * MODULATOR_RESOLUTION)];
7381
7331
  }
7382
7332
  return concave[Math.trunc(value * MODULATOR_RESOLUTION)];
7383
7333
  case ModulatorCurveTypes.convex:
7384
7334
  if (isBipolar) {
7385
7335
  value = value * 2 - 1;
7386
- if (value < 0) return -convex[Math.trunc(value * -MODULATOR_RESOLUTION)];
7336
+ if (value < 0) return -convex[Math.trunc(value * -16384)];
7387
7337
  return convex[Math.trunc(value * MODULATOR_RESOLUTION)];
7388
7338
  }
7389
7339
  return convex[Math.trunc(value * MODULATOR_RESOLUTION)];
7390
7340
  }
7391
7341
  }
7392
- //#endregion
7393
- //#region src/soundbank/basic_soundbank/modulator_source.ts
7342
+ // src/soundbank/basic_soundbank/modulator_source.ts
7394
7343
  /**
7395
7344
  * Represents a single {@link Modulator} source.
7396
7345
  *
@@ -7454,7 +7403,9 @@ var ModulatorSource = class ModulatorSource {
7454
7403
  const isBipolar = bitMaskToBool(sourceEnum, 9);
7455
7404
  const isNegative = bitMaskToBool(sourceEnum, 8);
7456
7405
  const isCC = bitMaskToBool(sourceEnum, 7);
7457
- return new ModulatorSource(sourceEnum & 127, sourceEnum >> 10 & 3, isCC, isBipolar, isNegative);
7406
+ const index = sourceEnum & 127;
7407
+ const curveType = sourceEnum >> 10 & 3;
7408
+ return new ModulatorSource(index, curveType, isCC, isBipolar, isNegative);
7458
7409
  }
7459
7410
  /**
7460
7411
  * Copies the modulator source.
@@ -7526,8 +7477,7 @@ for (let curveType = 0; curveType < MOD_CURVE_TYPES_AMOUNT; curveType++) for (le
7526
7477
  const tableIndex = MODULATOR_RESOLUTION * (curveType * MOD_CURVE_TYPES_AMOUNT + transformType);
7527
7478
  for (let value = 0; value < MODULATOR_RESOLUTION; value++) MODULATOR_TRANSFORMS[tableIndex + value] = getModulatorCurveValue(transformType, curveType, value / MODULATOR_RESOLUTION);
7528
7479
  }
7529
- //#endregion
7530
- //#region src/soundbank/basic_soundbank/modulator.ts
7480
+ // src/soundbank/basic_soundbank/modulator.ts
7531
7481
  function getModSourceEnum(curveType, isBipolar, isNegative, isCC, index) {
7532
7482
  return new ModulatorSource(index, curveType, isCC, isBipolar, isNegative).toSourceEnum();
7533
7483
  }
@@ -7664,8 +7614,7 @@ const defaultSpessaSynthModulators = [
7664
7614
  new DecodedModulator(getModSourceEnum(ModulatorCurveTypes.switch, false, false, true, MIDIControllers.softPedal), 0, GeneratorTypes.initialFilterFc, -1200, 0)
7665
7615
  ];
7666
7616
  const SPESSASYNTH_DEFAULT_MODULATORS = [...defaultSoundFont2Modulators, ...defaultSpessaSynthModulators];
7667
- //#endregion
7668
- //#region src/soundbank/basic_soundbank/generator.ts
7617
+ // src/soundbank/basic_soundbank/generator.ts
7669
7618
  /**
7670
7619
  * Generator represents a single sound bank parameter.
7671
7620
  *
@@ -7706,8 +7655,7 @@ var Generator = class {
7706
7655
  return `${Object.keys(GeneratorTypes).find((k) => GeneratorTypes[k] === this.type)}: ${this.value}`;
7707
7656
  }
7708
7657
  };
7709
- //#endregion
7710
- //#region src/soundbank/basic_soundbank/basic_zone.ts
7658
+ // src/soundbank/basic_soundbank/basic_zone.ts
7711
7659
  /**
7712
7660
  * Represents a single zone with parameters, modulators and a specified key and velocity range.
7713
7661
  *
@@ -7862,8 +7810,7 @@ var BasicZone = class {
7862
7810
  return generators;
7863
7811
  }
7864
7812
  };
7865
- //#endregion
7866
- //#region src/soundbank/basic_soundbank/basic_instrument_zone.ts
7813
+ // src/soundbank/basic_soundbank/basic_instrument_zone.ts
7867
7814
  /**
7868
7815
  * Represents a single instrument zone with an associated {@link BasicSample}.
7869
7816
  *
@@ -7923,8 +7870,7 @@ var BasicInstrumentZone = class extends BasicZone {
7923
7870
  return gens;
7924
7871
  }
7925
7872
  };
7926
- //#endregion
7927
- //#region src/soundbank/basic_soundbank/basic_preset_zone.ts
7873
+ // src/soundbank/basic_soundbank/basic_preset_zone.ts
7928
7874
  /**
7929
7875
  * Represents a single preset zone with an associated {@link BasicInstrument}.
7930
7876
  *
@@ -7979,8 +7925,7 @@ var BasicPresetZone = class extends BasicZone {
7979
7925
  return gens;
7980
7926
  }
7981
7927
  };
7982
- //#endregion
7983
- //#region src/soundbank/basic_soundbank/basic_preset.ts
7928
+ // src/soundbank/basic_soundbank/basic_preset.ts
7984
7929
  const defaultGeneratorValues = new Int16Array(GENERATORS_AMOUNT);
7985
7930
  for (let i = 0; i < defaultGeneratorValues.length; i++) if (GeneratorLimits[i]) defaultGeneratorValues[i] = GeneratorLimits[i].def;
7986
7931
  /**
@@ -8277,9 +8222,8 @@ var BasicPreset = class BasicPreset {
8277
8222
  phdrData.xdta.currentIndex += 12;
8278
8223
  }
8279
8224
  };
8280
- //#endregion
8281
- //#region src/soundbank/basic_soundbank/basic_instrument.ts
8282
- const notGlobalizedTypes = new Set([
8225
+ // src/soundbank/basic_soundbank/basic_instrument.ts
8226
+ const notGlobalizedTypes = /* @__PURE__ */ new Set([
8283
8227
  GeneratorTypes.velRange,
8284
8228
  GeneratorTypes.keyRange,
8285
8229
  GeneratorTypes.instrument,
@@ -8489,8 +8433,7 @@ var BasicInstrument = class {
8489
8433
  writeWord(instData.xdta, index >>> 16);
8490
8434
  }
8491
8435
  };
8492
- //#endregion
8493
- //#region src/soundbank/soundfont/write/write_sf2_elements.ts
8436
+ // src/soundbank/soundfont/write/write_sf2_elements.ts
8494
8437
  function writeSF2Elements(bank, rf64, isPreset, writeBankLSB = false) {
8495
8438
  const elements = isPreset ? bank.presets : bank.instruments;
8496
8439
  const genHeader = isPreset ? "pgen" : "igen";
@@ -8584,8 +8527,7 @@ function writeSF2Elements(bank, rf64, isPreset, writeBankLSB = false) {
8584
8527
  }
8585
8528
  };
8586
8529
  }
8587
- //#endregion
8588
- //#region src/soundbank/soundfont/write/write.ts
8530
+ // src/soundbank/soundfont/write/write.ts
8589
8531
  const DEFAULT_SF2_WRITE_OPTIONS = {
8590
8532
  writeDefaultModulators: true,
8591
8533
  writeExtendedLimits: true,
@@ -8709,8 +8651,7 @@ function writeSF(bank, software, writeDefaultModulators, writeExtendedLimits, wr
8709
8651
  SpessaLog.groupEnd();
8710
8652
  return main.buffer;
8711
8653
  }
8712
- //#endregion
8713
- //#region src/soundbank/downloadable_sounds/dls_verifier.ts
8654
+ // src/soundbank/downloadable_sounds/dls_verifier.ts
8714
8655
  var DLSVerifier = class {
8715
8656
  /**
8716
8657
  * @param chunk The chunk to verify.
@@ -8747,8 +8688,7 @@ var DLSVerifier = class {
8747
8688
  return chunks;
8748
8689
  }
8749
8690
  };
8750
- //#endregion
8751
- //#region src/soundbank/downloadable_sounds/enums.ts
8691
+ // src/soundbank/downloadable_sounds/enums.ts
8752
8692
  const DLSSources = {
8753
8693
  none: 0,
8754
8694
  modLfo: 1,
@@ -8804,8 +8744,7 @@ const DLSLoopTypes = {
8804
8744
  forward: 0,
8805
8745
  loopAndRelease: 1
8806
8746
  };
8807
- //#endregion
8808
- //#region src/soundbank/downloadable_sounds/wave_sample.ts
8747
+ // src/soundbank/downloadable_sounds/wave_sample.ts
8809
8748
  const WSMP_SIZE = 20;
8810
8749
  const WSMP_LOOP_SIZE = 16;
8811
8750
  var WaveSample = class WaveSample extends DLSVerifier {
@@ -8954,8 +8893,7 @@ var WaveSample = class WaveSample extends DLSVerifier {
8954
8893
  return RIFFChunk.write("wsmp", wsmpData);
8955
8894
  }
8956
8895
  };
8957
- //#endregion
8958
- //#region src/soundbank/downloadable_sounds/dls_sample.ts
8896
+ // src/soundbank/downloadable_sounds/dls_sample.ts
8959
8897
  const W_FORMAT_TAG = {
8960
8898
  PCM: 1,
8961
8899
  ALAW: 6
@@ -8997,7 +8935,8 @@ function readALAW(data, bytesPerSample) {
8997
8935
  if (exponent > 0) mantissa += 16;
8998
8936
  mantissa = (mantissa << 4) + 8;
8999
8937
  if (exponent > 1) mantissa = mantissa << exponent - 1;
9000
- sampleData[i] = (input > 127 ? mantissa : -mantissa) / 32768;
8938
+ const s16sample = input > 127 ? mantissa : -mantissa;
8939
+ sampleData[i] = s16sample / 32768;
9001
8940
  }
9002
8941
  return sampleData;
9003
8942
  }
@@ -9027,7 +8966,7 @@ var DLSSample = class extends BasicSample {
9027
8966
  this.bytesPerSample = bytesPerSample;
9028
8967
  }
9029
8968
  getAudioData() {
9030
- if (!this.rawData) return new Float32Array(0);
8969
+ if (!this.rawData) return /* @__PURE__ */ new Float32Array(0);
9031
8970
  if (!this.audioData) {
9032
8971
  let sampleData;
9033
8972
  switch (this.wFormatTag) {
@@ -9038,13 +8977,11 @@ var DLSSample = class extends BasicSample {
9038
8977
  case W_FORMAT_TAG.PCM:
9039
8978
  sampleData = readPCM(this.rawData, this.bytesPerSample);
9040
8979
  break;
9041
- case W_FORMAT_TAG.ALAW:
9042
- sampleData = readALAW(this.rawData, this.bytesPerSample);
9043
- break;
8980
+ case W_FORMAT_TAG.ALAW: sampleData = readALAW(this.rawData, this.bytesPerSample);
9044
8981
  }
9045
8982
  this.setAudioData(sampleData, this.sampleRate);
9046
8983
  }
9047
- return this.audioData ?? new Float32Array(0);
8984
+ return this.audioData ?? /* @__PURE__ */ new Float32Array(0);
9048
8985
  }
9049
8986
  getRawData(allowVorbis) {
9050
8987
  if (this.dataOverridden || this.isCompressed) return super.getRawData(allowVorbis);
@@ -9052,8 +8989,7 @@ var DLSSample = class extends BasicSample {
9052
8989
  return this.encodeS16LE();
9053
8990
  }
9054
8991
  };
9055
- //#endregion
9056
- //#region src/soundbank/downloadable_sounds/sample.ts
8992
+ // src/soundbank/downloadable_sounds/sample.ts
9057
8993
  var DownloadableSoundsSample = class DownloadableSoundsSample extends DLSVerifier {
9058
8994
  waveSample = new WaveSample();
9059
8995
  wFormatTag;
@@ -9140,8 +9076,7 @@ var DownloadableSoundsSample = class DownloadableSoundsSample extends DLSVerifie
9140
9076
  return RIFFChunk.write("fmt ", fmtData);
9141
9077
  }
9142
9078
  };
9143
- //#endregion
9144
- //#region src/soundbank/downloadable_sounds/connection_source.ts
9079
+ // src/soundbank/downloadable_sounds/connection_source.ts
9145
9080
  var ConnectionSource = class ConnectionSource {
9146
9081
  source;
9147
9082
  transform;
@@ -9180,9 +9115,7 @@ var ConnectionSource = class ConnectionSource {
9180
9115
  case MIDIControllers.chorusDepth:
9181
9116
  sourceEnum = DLSSources.chorus;
9182
9117
  break;
9183
- case MIDIControllers.reverbDepth:
9184
- sourceEnum = DLSSources.reverb;
9185
- break;
9118
+ case MIDIControllers.reverbDepth: sourceEnum = DLSSources.reverb;
9186
9119
  }
9187
9120
  else switch (source.index) {
9188
9121
  case ModulatorControllerSources.noController:
@@ -9266,21 +9199,17 @@ var ConnectionSource = class ConnectionSource {
9266
9199
  case DLSSources.pitchWheel:
9267
9200
  sourceEnum = ModulatorControllerSources.pitchWheel;
9268
9201
  break;
9269
- case DLSSources.pitchWheelRange:
9270
- sourceEnum = ModulatorControllerSources.pitchWheelRange;
9271
- break;
9202
+ case DLSSources.pitchWheelRange: sourceEnum = ModulatorControllerSources.pitchWheelRange;
9272
9203
  }
9273
9204
  if (sourceEnum === void 0) return;
9274
9205
  return new ModulatorSource(sourceEnum, this.transform, isCC, this.bipolar, this.invert);
9275
9206
  }
9276
9207
  };
9277
- //#endregion
9278
- //#region src/soundbank/downloadable_sounds/default_dls_modulators.ts
9208
+ // src/soundbank/downloadable_sounds/default_dls_modulators.ts
9279
9209
  const DEFAULT_DLS_REVERB = new DecodedModulator(219, 0, GeneratorTypes.reverbEffectsSend, 1e3, 0);
9280
9210
  const DEFAULT_DLS_CHORUS = new DecodedModulator(221, 0, GeneratorTypes.chorusEffectsSend, 1e3, 0);
9281
- //#endregion
9282
- //#region src/soundbank/downloadable_sounds/connection_block.ts
9283
- const invalidGeneratorTypes = new Set([
9211
+ // src/soundbank/downloadable_sounds/connection_block.ts
9212
+ const invalidGeneratorTypes = /* @__PURE__ */ new Set([
9284
9213
  GeneratorTypes.sampleModes,
9285
9214
  GeneratorTypes.initialAttenuation,
9286
9215
  GeneratorTypes.keyRange,
@@ -9350,7 +9279,8 @@ var ConnectionBlock = class ConnectionBlock {
9350
9279
  const lScale = readLittleEndianIndexed(artData, 4) | 0;
9351
9280
  const transform = usTransform & 15;
9352
9281
  const control = new ConnectionSource(usControl, usTransform >> 4 & 15, bitMaskToBool(usTransform, 8), bitMaskToBool(usTransform, 9));
9353
- return new ConnectionBlock(new ConnectionSource(usSource, usTransform >> 10 & 15, bitMaskToBool(usTransform, 14), bitMaskToBool(usTransform, 15)), control, usDestination, transform, lScale);
9282
+ const source = new ConnectionSource(usSource, usTransform >> 10 & 15, bitMaskToBool(usTransform, 14), bitMaskToBool(usTransform, 15));
9283
+ return new ConnectionBlock(source, control, usDestination, transform, lScale);
9354
9284
  }
9355
9285
  static fromSFModulator(m, articulation) {
9356
9286
  const failed = (msg) => {
@@ -9623,9 +9553,7 @@ var ConnectionBlock = class ConnectionBlock {
9623
9553
  case DLSDestinations.chorusSend:
9624
9554
  zone.setGenerator(GeneratorTypes.chorusEffectsSend, value);
9625
9555
  break;
9626
- case DLSDestinations.pitch:
9627
- zone.fineTuning += value;
9628
- break;
9556
+ case DLSDestinations.pitch: zone.fineTuning += value;
9629
9557
  }
9630
9558
  }
9631
9559
  toSFModulator(zone) {
@@ -9736,8 +9664,7 @@ var ConnectionBlock = class ConnectionBlock {
9736
9664
  }
9737
9665
  }
9738
9666
  };
9739
- //#endregion
9740
- //#region src/soundbank/downloadable_sounds/articulation.ts
9667
+ // src/soundbank/downloadable_sounds/articulation.ts
9741
9668
  var DownloadableSoundsArticulation = class extends DLSVerifier {
9742
9669
  connectionBlocks = new Array();
9743
9670
  mode = "dls2";
@@ -9842,17 +9769,19 @@ var DownloadableSoundsArticulation = class extends DLSVerifier {
9842
9769
  connection.toSFGenerator(zone);
9843
9770
  continue;
9844
9771
  }
9845
- if (control === DLSSources.none) if (source === DLSSources.keyNum) {
9846
- if (destination === DLSDestinations.pitch) {
9847
- zone.setGenerator(GeneratorTypes.scaleTuning, amount / 128);
9848
- continue;
9849
- }
9850
- if (destination === DLSDestinations.modEnvHold || destination === DLSDestinations.modEnvDecay || destination === DLSDestinations.volEnvHold || destination === DLSDestinations.volEnvDecay) continue;
9851
- } else {
9852
- const specialGen = connection.toCombinedSFDestination();
9853
- if (specialGen) {
9854
- zone.setGenerator(specialGen, amount);
9855
- continue;
9772
+ if (control === DLSSources.none) {
9773
+ if (source === DLSSources.keyNum) {
9774
+ if (destination === DLSDestinations.pitch) {
9775
+ zone.setGenerator(GeneratorTypes.scaleTuning, amount / 128);
9776
+ continue;
9777
+ }
9778
+ if (destination === DLSDestinations.modEnvHold || destination === DLSDestinations.modEnvDecay || destination === DLSDestinations.volEnvHold || destination === DLSDestinations.volEnvDecay) continue;
9779
+ } else {
9780
+ const specialGen = connection.toCombinedSFDestination();
9781
+ if (specialGen) {
9782
+ zone.setGenerator(specialGen, amount);
9783
+ continue;
9784
+ }
9856
9785
  }
9857
9786
  }
9858
9787
  connection.toSFModulator(zone);
@@ -9871,9 +9800,7 @@ var DownloadableSoundsArticulation = class extends DLSVerifier {
9871
9800
  case DLSDestinations.modEnvHold:
9872
9801
  applyKeyToCorrection(generatorAmount, GeneratorTypes.keyNumToModEnvHold, GeneratorTypes.holdModEnv, DLSDestinations.modEnvHold);
9873
9802
  break;
9874
- case DLSDestinations.modEnvDecay:
9875
- applyKeyToCorrection(generatorAmount, GeneratorTypes.keyNumToModEnvDecay, GeneratorTypes.decayModEnv, DLSDestinations.modEnvDecay);
9876
- break;
9803
+ case DLSDestinations.modEnvDecay: applyKeyToCorrection(generatorAmount, GeneratorTypes.keyNumToModEnvDecay, GeneratorTypes.decayModEnv, DLSDestinations.modEnvDecay);
9877
9804
  }
9878
9805
  }
9879
9806
  if (this.mode === "dls1") {
@@ -9885,8 +9812,7 @@ var DownloadableSoundsArticulation = class extends DLSVerifier {
9885
9812
  }
9886
9813
  }
9887
9814
  };
9888
- //#endregion
9889
- //#region src/soundbank/downloadable_sounds/wave_link.ts
9815
+ // src/soundbank/downloadable_sounds/wave_link.ts
9890
9816
  var WaveLink = class WaveLink {
9891
9817
  /**
9892
9818
  * Specifies the channel placement of the sample. This is used to place mono sounds within a
@@ -9923,7 +9849,8 @@ var WaveLink = class WaveLink {
9923
9849
  const fusOptions = readLittleEndianIndexed(chunk.data, 2);
9924
9850
  const phaseGroup = readLittleEndianIndexed(chunk.data, 2);
9925
9851
  const ulChannel = readLittleEndianIndexed(chunk.data, 4);
9926
- const wlnk = new WaveLink(readLittleEndianIndexed(chunk.data, 4));
9852
+ const ulTableIndex = readLittleEndianIndexed(chunk.data, 4);
9853
+ const wlnk = new WaveLink(ulTableIndex);
9927
9854
  wlnk.channel = ulChannel;
9928
9855
  wlnk.fusOptions = fusOptions;
9929
9856
  wlnk.phaseGroup = phaseGroup;
@@ -9952,8 +9879,7 @@ var WaveLink = class WaveLink {
9952
9879
  return RIFFChunk.write("wlnk", wlnkData);
9953
9880
  }
9954
9881
  };
9955
- //#endregion
9956
- //#region src/soundbank/downloadable_sounds/region.ts
9882
+ // src/soundbank/downloadable_sounds/region.ts
9957
9883
  var DownloadableSoundsRegion = class DownloadableSoundsRegion extends DLSVerifier {
9958
9884
  articulation = new DownloadableSoundsArticulation();
9959
9885
  /**
@@ -10046,7 +9972,8 @@ var DownloadableSoundsRegion = class DownloadableSoundsRegion extends DLSVerifie
10046
9972
  }
10047
9973
  static fromSFZone(zone, samples) {
10048
9974
  const waveSample = WaveSample.fromSFZone(zone);
10049
- const region = new DownloadableSoundsRegion(WaveLink.fromSFZone(samples, zone), waveSample);
9975
+ const waveLink = WaveLink.fromSFZone(samples, zone);
9976
+ const region = new DownloadableSoundsRegion(waveLink, waveSample);
10050
9977
  region.keyRange.min = Math.max(zone.keyRange.min, 0);
10051
9978
  region.keyRange.max = zone.keyRange.max;
10052
9979
  region.velRange.min = Math.max(zone.velRange.min, 0);
@@ -10098,8 +10025,7 @@ var DownloadableSoundsRegion = class DownloadableSoundsRegion extends DLSVerifie
10098
10025
  return RIFFChunk.write("rgnh", rgnhData);
10099
10026
  }
10100
10027
  };
10101
- //#endregion
10102
- //#region src/soundbank/downloadable_sounds/instrument.ts
10028
+ // src/soundbank/downloadable_sounds/instrument.ts
10103
10029
  /**
10104
10030
  * Represents a proper DLS instrument, with regions and articulation.
10105
10031
  * DLS
@@ -10231,8 +10157,7 @@ var DownloadableSoundsInstrument = class DownloadableSoundsInstrument extends DL
10231
10157
  return RIFFChunk.write("insh", inshData);
10232
10158
  }
10233
10159
  };
10234
- //#endregion
10235
- //#region src/soundbank/downloadable_sounds/downloadable_sounds.ts
10160
+ // src/soundbank/downloadable_sounds/downloadable_sounds.ts
10236
10161
  const DEFAULT_DLS_OPTIONS = { software: "SpessaSynth" };
10237
10162
  var DownloadableSounds = class DownloadableSounds extends DLSVerifier {
10238
10163
  samples = new Array();
@@ -10471,8 +10396,7 @@ var DownloadableSounds = class DownloadableSounds extends DLSVerifier {
10471
10396
  return soundBank;
10472
10397
  }
10473
10398
  };
10474
- //#endregion
10475
- //#region src/soundbank/basic_soundbank/basic_soundbank.ts
10399
+ // src/soundbank/basic_soundbank/basic_soundbank.ts
10476
10400
  /**
10477
10401
  * This module handles parsing and writing SoundFont2 (`.sf2`, `.sf3` and `.sfogg`) files.
10478
10402
  * It represents a single sound bank.
@@ -10595,7 +10519,7 @@ var BasicSoundBank = class BasicSoundBank {
10595
10519
  */
10596
10520
  static getSampleSoundBankFile() {
10597
10521
  const font = new BasicSoundBank();
10598
- const sampleData = new Float32Array(128);
10522
+ const sampleData = /* @__PURE__ */ new Float32Array(128);
10599
10523
  for (let i = 0; i < 128; i++) sampleData[i] = i / 128 * 2 - 1;
10600
10524
  const sample = new EmptySample();
10601
10525
  sample.name = "Saw";
@@ -10985,7 +10909,7 @@ var BasicSoundBank = class BasicSoundBank {
10985
10909
  */
10986
10910
  parseInternal() {
10987
10911
  this._isXGBank = false;
10988
- const allowedPrograms = new Set([
10912
+ const allowedPrograms = /* @__PURE__ */ new Set([
10989
10913
  0,
10990
10914
  1,
10991
10915
  2,
@@ -11036,8 +10960,7 @@ var BasicSoundBank = class BasicSoundBank {
11036
10960
  } else SpessaLog.info(`%c${info}: %c${value.toLocaleString()}`, ConsoleColors.info, ConsoleColors.recognized);
11037
10961
  }
11038
10962
  };
11039
- //#endregion
11040
- //#region src/midi/read/tracker/types.ts
10963
+ // src/midi/read/tracker/types.ts
11041
10964
  /**
11042
10965
  * The loop modes of a tracker sample.
11043
10966
  */
@@ -11046,8 +10969,7 @@ const TrackerLoopTypes = {
11046
10969
  forward: 1,
11047
10970
  pingPong: 2
11048
10971
  };
11049
- //#endregion
11050
- //#region src/midi/read/tracker/tracker_sound_bank.ts
10972
+ // src/midi/read/tracker/tracker_sound_bank.ts
11051
10973
  /**
11052
10974
  * The volume envelope release (in timecents) of the sound bank instruments.
11053
10975
  * Short, as trackers cut the notes instantly.
@@ -11110,8 +11032,7 @@ function createTrackerSoundBank(samples, title, formatName, rootKey, attenuation
11110
11032
  bank.flush();
11111
11033
  return bank.writeSF2();
11112
11034
  }
11113
- //#endregion
11114
- //#region src/midi/read/tracker/tracker_pattern.ts
11035
+ // src/midi/read/tracker/tracker_pattern.ts
11115
11036
  /**
11116
11037
  * The number of bytes each pattern cell takes up.
11117
11038
  */
@@ -11172,8 +11093,7 @@ var TrackerPattern = class {
11172
11093
  return this.data[offset + 4];
11173
11094
  }
11174
11095
  };
11175
- //#endregion
11176
- //#region src/midi/read/tracker/tracker_module.ts
11096
+ // src/midi/read/tracker/tracker_module.ts
11177
11097
  /**
11178
11098
  * One MIDI tick is one tracker tick.
11179
11099
  * With 24 ticks per quarter note, the MIDI tempo in BPM equals the tracker tempo,
@@ -11218,7 +11138,7 @@ function emptyEnvelope() {
11218
11138
  function singleSampleInstrument(name, sampleIndex) {
11219
11139
  return {
11220
11140
  name,
11221
- sampleMap: new Int16Array(120).fill(sampleIndex),
11141
+ sampleMap: (/* @__PURE__ */ new Int16Array(120)).fill(sampleIndex),
11222
11142
  volumeEnvelope: emptyEnvelope(),
11223
11143
  panningEnvelope: emptyEnvelope(),
11224
11144
  fadeout: 0
@@ -11597,12 +11517,11 @@ var TrackerModule = class {
11597
11517
  output.controllerChange(ticks, MIDIControllers.pan, Math.min(127, Math.max(0, Math.round(64 + (angle - .5) * 128))));
11598
11518
  }
11599
11519
  };
11600
- //#endregion
11601
- //#region src/midi/read/tracker/protracker.ts
11520
+ // src/midi/read/tracker/protracker.ts
11602
11521
  /**
11603
11522
  * The Amiga PAL clock, multiplied by four as the periods are stored with four times the Amiga precision.
11604
11523
  */
11605
- const AMIGA_CLOCK = 3546895 * 4;
11524
+ const AMIGA_CLOCK = 14187580;
11606
11525
  /**
11607
11526
  * The ProTracker effects (also used by Fast Tracker).
11608
11527
  */
@@ -11711,7 +11630,7 @@ var ProTrackerModule = class ProTrackerModule extends TrackerModule {
11711
11630
  this.title = readBinaryString(binary, 20, 0).trim();
11712
11631
  this.setPreAmp(Math.min(128, Math.max(32, 256 / this.channelCount)));
11713
11632
  this.minPeriod = 452;
11714
- this.maxPeriod = 856 * 4;
11633
+ this.maxPeriod = 3424;
11715
11634
  for (let i = 0; i < this.channelCount; i++) this.channelPanning.push((i & 3) === 1 || (i & 3) === 2 ? 192 : 64);
11716
11635
  const sampleHeaders = new Array();
11717
11636
  const sampleNames = new Array();
@@ -11727,7 +11646,7 @@ var ProTrackerModule = class ProTrackerModule extends TrackerModule {
11727
11646
  });
11728
11647
  this.samples.push({
11729
11648
  name,
11730
- data: new Float32Array(0),
11649
+ data: /* @__PURE__ */ new Float32Array(0),
11731
11650
  loopType: TrackerLoopTypes.none,
11732
11651
  loopStart: 0,
11733
11652
  loopEnd: 0,
@@ -11869,9 +11788,7 @@ var ProTrackerModule = class ProTrackerModule extends TrackerModule {
11869
11788
  else if (param < 32) this.setSpeed(param);
11870
11789
  else this.setTempo(param);
11871
11790
  break;
11872
- case ProTrackerEffects.extended:
11873
- this.processExtendedEffect(channel, param >> 4, param & 15);
11874
- break;
11791
+ case ProTrackerEffects.extended: this.processExtendedEffect(channel, param >> 4, param & 15);
11875
11792
  }
11876
11793
  }
11877
11794
  /**
@@ -11913,9 +11830,7 @@ var ProTrackerModule = class ProTrackerModule extends TrackerModule {
11913
11830
  case ProTrackerExtendedEffects.noteDelay:
11914
11831
  channel.noteDelayTick = value;
11915
11832
  break;
11916
- case ProTrackerExtendedEffects.patternDelay:
11917
- this.setPatternDelay(value);
11918
- break;
11833
+ case ProTrackerExtendedEffects.patternDelay: this.setPatternDelay(value);
11919
11834
  }
11920
11835
  }
11921
11836
  /**
@@ -11966,9 +11881,7 @@ var ProTrackerModule = class ProTrackerModule extends TrackerModule {
11966
11881
  channel.sampleOffset = 0;
11967
11882
  }
11968
11883
  break;
11969
- case ProTrackerExtendedEffects.noteDelay:
11970
- if (this.tick === channel.noteDelayTick) this.playDelayedNote(channel);
11971
- break;
11884
+ case ProTrackerExtendedEffects.noteDelay: if (this.tick === channel.noteDelayTick) this.playDelayedNote(channel);
11972
11885
  }
11973
11886
  break;
11974
11887
  }
@@ -11991,8 +11904,7 @@ var ProTrackerModule = class ProTrackerModule extends TrackerModule {
11991
11904
  else channel.slideVolume(-(param & 15));
11992
11905
  }
11993
11906
  };
11994
- //#endregion
11995
- //#region src/midi/read/tracker/fasttracker.ts
11907
+ // src/midi/read/tracker/fasttracker.ts
11996
11908
  const XM_SIGNATURE = "Extended Module: ";
11997
11909
  /**
11998
11910
  * The reserved sample header byte that marks ModPlug ADPCM compressed samples.
@@ -12033,7 +11945,7 @@ const VolumeColumnCommands = {
12033
11945
  /**
12034
11946
  * The 256-step sine table of the automatic vibrato.
12035
11947
  */
12036
- const AUTO_VIBRATO_SINE = new Int8Array(256);
11948
+ const AUTO_VIBRATO_SINE = /* @__PURE__ */ new Int8Array(256);
12037
11949
  for (let i = 0; i < 256; i++) AUTO_VIBRATO_SINE[i] = Math.round(64 * Math.sin(i * Math.PI / 128));
12038
11950
  /**
12039
11951
  * Gets the value of an envelope at a position.
@@ -12218,7 +12130,7 @@ var FastTrackerModule = class extends ProTrackerModule {
12218
12130
  const sampleCount = readLittleEndian(binary, 2, offset + 27);
12219
12131
  const instrument = {
12220
12132
  name,
12221
- sampleMap: new Int16Array(120).fill(-1),
12133
+ sampleMap: (/* @__PURE__ */ new Int16Array(120)).fill(-1),
12222
12134
  volumeEnvelope: emptyEnvelope(),
12223
12135
  panningEnvelope: emptyEnvelope(),
12224
12136
  fadeout: 0
@@ -12265,7 +12177,7 @@ var FastTrackerModule = class extends ProTrackerModule {
12265
12177
  });
12266
12178
  this.samples.push({
12267
12179
  name: readBinaryString(binary, 22, offset + 18).trim() || (sampleCount > 1 && instrumentName ? `${instrumentName} ${s + 1}` : instrumentName),
12268
- data: new Float32Array(0),
12180
+ data: /* @__PURE__ */ new Float32Array(0),
12269
12181
  loopType: TrackerLoopTypes.none,
12270
12182
  loopStart: 0,
12271
12183
  loopEnd: 0,
@@ -12340,9 +12252,7 @@ var FastTrackerModule = class extends ProTrackerModule {
12340
12252
  case VolumeColumnCommands.panning:
12341
12253
  channel.panning = value << 4;
12342
12254
  break;
12343
- case VolumeColumnCommands.tonePortamento:
12344
- if (value) channel.tonePortamentoSpeed = (value << 4) * 4;
12345
- break;
12255
+ case VolumeColumnCommands.tonePortamento: if (value) channel.tonePortamentoSpeed = (value << 4) * 4;
12346
12256
  }
12347
12257
  const param = channel.rowParam = this.applyMemory(channel, effect, channel.rowParam);
12348
12258
  switch (effect) {
@@ -12359,10 +12269,8 @@ var FastTrackerModule = class extends ProTrackerModule {
12359
12269
  channel.volumeEnvelopeTick = param;
12360
12270
  channel.panningEnvelopeTick = param;
12361
12271
  break;
12362
- case FastTrackerEffects.extraFinePortamento:
12363
- if (param >> 4 === 1) this.slidePeriod(channel, -(param & 15));
12364
- else if (param >> 4 === 2) this.slidePeriod(channel, param & 15);
12365
- break;
12272
+ case FastTrackerEffects.extraFinePortamento: if (param >> 4 === 1) this.slidePeriod(channel, -(param & 15));
12273
+ else if (param >> 4 === 2) this.slidePeriod(channel, param & 15);
12366
12274
  }
12367
12275
  if (effect === ProTrackerEffects.vibrato || effect === ProTrackerEffects.vibratoVolumeSlide || volumeCommand === VolumeColumnCommands.vibrato) channel.vibrato(16, false);
12368
12276
  else channel.vibratoDelta = 0;
@@ -12386,9 +12294,7 @@ var FastTrackerModule = class extends ProTrackerModule {
12386
12294
  case VolumeColumnCommands.panningSlideRight:
12387
12295
  channel.slidePanning(value);
12388
12296
  break;
12389
- case VolumeColumnCommands.tonePortamento:
12390
- channel.tonePortamento();
12391
- break;
12297
+ case VolumeColumnCommands.tonePortamento: channel.tonePortamento();
12392
12298
  }
12393
12299
  const effect = channel.rowEffect;
12394
12300
  const param = channel.rowParam;
@@ -12414,9 +12320,7 @@ var FastTrackerModule = class extends ProTrackerModule {
12414
12320
  case FastTrackerEffects.multiRetrigger:
12415
12321
  channel.multiRetrigger(param);
12416
12322
  break;
12417
- case FastTrackerEffects.tremor:
12418
- channel.tremor(param);
12419
- break;
12323
+ case FastTrackerEffects.tremor: channel.tremor(param);
12420
12324
  }
12421
12325
  }
12422
12326
  playRowNote(channel) {
@@ -12425,14 +12329,16 @@ var FastTrackerModule = class extends ProTrackerModule {
12425
12329
  if (instrumentNumber) channel.instrument = this.instruments[instrumentNumber - 1];
12426
12330
  const isPortamento = channel.rowEffect === ProTrackerEffects.tonePortamento || channel.rowEffect === ProTrackerEffects.tonePortamentoVolumeSlide || channel.rowVolume >> 4 === VolumeColumnCommands.tonePortamento;
12427
12331
  if (note === 254) this.keyOff(channel);
12428
- else if (note !== 0) if (isPortamento && channel.sample) channel.targetPeriod = this.noteToPeriod(note, channel);
12429
- else {
12430
- const sample = this.selectSample(channel, note);
12431
- if (sample) {
12432
- const param = channel.rowParam;
12433
- channel.finetune = channel.rowEffect === ProTrackerEffects.extended && param >> 4 === ProTrackerExtendedEffects.finetune ? ((param & 15) - 8) * 16 : sample.finetune;
12434
- this.triggerNote(channel, note);
12435
- } else channel.stop = true;
12332
+ else if (note !== 0) {
12333
+ if (isPortamento && channel.sample) channel.targetPeriod = this.noteToPeriod(note, channel);
12334
+ else {
12335
+ const sample = this.selectSample(channel, note);
12336
+ if (sample) {
12337
+ const param = channel.rowParam;
12338
+ channel.finetune = channel.rowEffect === ProTrackerEffects.extended && param >> 4 === ProTrackerExtendedEffects.finetune ? ((param & 15) - 8) * 16 : sample.finetune;
12339
+ this.triggerNote(channel, note);
12340
+ } else channel.stop = true;
12341
+ }
12436
12342
  }
12437
12343
  if (instrumentNumber && channel.sample && note !== 254) {
12438
12344
  channel.volume = channel.sample.volume;
@@ -12477,9 +12383,7 @@ var FastTrackerModule = class extends ProTrackerModule {
12477
12383
  case 2:
12478
12384
  value = (64 - (position >> 1) & 127) - 64;
12479
12385
  break;
12480
- case 3:
12481
- value = (64 + (position >> 1) & 127) - 64;
12482
- break;
12386
+ case 3: value = (64 + (position >> 1) & 127) - 64;
12483
12387
  }
12484
12388
  channel.autoVibratoDelta = value * depth / 64;
12485
12389
  } else channel.autoVibratoDelta = 0;
@@ -12574,8 +12478,7 @@ var FastTrackerModule = class extends ProTrackerModule {
12574
12478
  }
12575
12479
  }
12576
12480
  };
12577
- //#endregion
12578
- //#region src/midi/read/tracker/screamtracker.ts
12481
+ // src/midi/read/tracker/screamtracker.ts
12579
12482
  /**
12580
12483
  * The Scream Tracker effects (letters converted to numbers, A = 1).
12581
12484
  */
@@ -12617,7 +12520,7 @@ const ScreamTrackerExtendedEffects = {
12617
12520
  /**
12618
12521
  * The effects that share a single parameter memory in Scream Tracker 3.
12619
12522
  */
12620
- const SHARED_MEMORY_EFFECTS = new Set([
12523
+ const SHARED_MEMORY_EFFECTS = /* @__PURE__ */ new Set([
12621
12524
  ScreamTrackerEffects.volumeSlide,
12622
12525
  ScreamTrackerEffects.portamentoDown,
12623
12526
  ScreamTrackerEffects.portamentoUp,
@@ -12707,7 +12610,7 @@ var ScreamTrackerModule = class extends TrackerModule {
12707
12610
  const parapointers = 96 + orderCount;
12708
12611
  const panningTable = parapointers + instrumentCount * 2 + patternCount * 2;
12709
12612
  const hasPanningTable = binary[53] === 252;
12710
- const channelMap = new Int8Array(32).fill(-1);
12613
+ const channelMap = (/* @__PURE__ */ new Int8Array(32)).fill(-1);
12711
12614
  for (let i = 0; i < 32; i++) {
12712
12615
  const setting = binary[64 + i];
12713
12616
  if (setting >= 16) continue;
@@ -12732,7 +12635,7 @@ var ScreamTrackerModule = class extends TrackerModule {
12732
12635
  const c2spd = readLittleEndian(binary, 4, offset + 32) || 8363;
12733
12636
  this.samples.push({
12734
12637
  name,
12735
- data: new Float32Array(0),
12638
+ data: /* @__PURE__ */ new Float32Array(0),
12736
12639
  loopType: TrackerLoopTypes.none,
12737
12640
  loopStart: 0,
12738
12641
  loopEnd: 0,
@@ -12820,8 +12723,10 @@ var ScreamTrackerModule = class extends TrackerModule {
12820
12723
  processRow(channel) {
12821
12724
  const effect = channel.rowEffect;
12822
12725
  channel.tremorMuted = false;
12823
- if (SHARED_MEMORY_EFFECTS.has(effect)) if (channel.rowParam) this.sharedMemory[channel.index] = channel.rowParam;
12824
- else channel.rowParam = this.sharedMemory[channel.index];
12726
+ if (SHARED_MEMORY_EFFECTS.has(effect)) {
12727
+ if (channel.rowParam) this.sharedMemory[channel.index] = channel.rowParam;
12728
+ else channel.rowParam = this.sharedMemory[channel.index];
12729
+ }
12825
12730
  const param = channel.rowParam;
12826
12731
  if (!(effect === ScreamTrackerEffects.extended && param >> 4 === ScreamTrackerExtendedEffects.noteDelay && (param & 15) > 0)) this.playRowNote(channel);
12827
12732
  switch (effect) {
@@ -12877,9 +12782,7 @@ var ScreamTrackerModule = class extends TrackerModule {
12877
12782
  case ScreamTrackerEffects.panning:
12878
12783
  if (param <= 128) channel.panning = Math.min(255, param * 2);
12879
12784
  break;
12880
- case ScreamTrackerEffects.extended:
12881
- this.processExtendedEffect(channel, param >> 4, param & 15);
12882
- break;
12785
+ case ScreamTrackerEffects.extended: this.processExtendedEffect(channel, param >> 4, param & 15);
12883
12786
  }
12884
12787
  if (effect !== ScreamTrackerEffects.vibrato && effect !== ScreamTrackerEffects.fineVibrato && effect !== ScreamTrackerEffects.vibratoVolumeSlide) channel.vibratoDelta = 0;
12885
12788
  }
@@ -12923,9 +12826,7 @@ var ScreamTrackerModule = class extends TrackerModule {
12923
12826
  case ScreamTrackerEffects.tremolo:
12924
12827
  channel.tremolo(64);
12925
12828
  break;
12926
- case ScreamTrackerEffects.extended:
12927
- if (param >> 4 === ScreamTrackerExtendedEffects.noteDelay && this.tick === channel.noteDelayTick) this.playRowNote(channel);
12928
- break;
12829
+ case ScreamTrackerEffects.extended: if (param >> 4 === ScreamTrackerExtendedEffects.noteDelay && this.tick === channel.noteDelayTick) this.playRowNote(channel);
12929
12830
  }
12930
12831
  }
12931
12832
  /**
@@ -12981,9 +12882,7 @@ var ScreamTrackerModule = class extends TrackerModule {
12981
12882
  case ScreamTrackerExtendedEffects.noteDelay:
12982
12883
  channel.noteDelayTick = value;
12983
12884
  break;
12984
- case ScreamTrackerExtendedEffects.patternDelay:
12985
- this.setPatternDelay(value);
12986
- break;
12885
+ case ScreamTrackerExtendedEffects.patternDelay: this.setPatternDelay(value);
12987
12886
  }
12988
12887
  }
12989
12888
  /**
@@ -13012,8 +12911,7 @@ var ScreamTrackerModule = class extends TrackerModule {
13012
12911
  } else if (!firstTick || this.fastVolumeSlides) channel.slideVolume(down ? -down : up);
13013
12912
  }
13014
12913
  };
13015
- //#endregion
13016
- //#region src/midi/read/tracker/load_tracker_module.ts
12914
+ // src/midi/read/tracker/load_tracker_module.ts
13017
12915
  /**
13018
12916
  * Detects a tracker module and converts it into the given MIDI.
13019
12917
  * @param outputMIDI The MIDI to populate.
@@ -13031,8 +12929,7 @@ function loadTrackerModule(outputMIDI, binary, fileName) {
13031
12929
  module.toMIDI(outputMIDI, fileName);
13032
12930
  return true;
13033
12931
  }
13034
- //#endregion
13035
- //#region src/midi/write/midi.ts
12932
+ // src/midi/write/midi.ts
13036
12933
  const writeText = (text, arr) => {
13037
12934
  for (let i = 0; i < text.length; i++) arr.push(text.charCodeAt(i));
13038
12935
  };
@@ -13091,8 +12988,7 @@ function writeMIDIInternal(midi) {
13091
12988
  }
13092
12989
  return new Uint8Array(binaryData).buffer;
13093
12990
  }
13094
- //#endregion
13095
- //#region src/midi/write/rmidi.ts
12991
+ // src/midi/write/rmidi.ts
13096
12992
  const DEFAULT_COPYRIGHT = "Created using SpessaSynth";
13097
12993
  /**
13098
12994
  * Add the offset to the bank.
@@ -13329,9 +13225,7 @@ function writeRMIDIInternal(mid, soundBankBinary, options) {
13329
13225
  case "subject":
13330
13226
  writeInfo("ISBJ", data);
13331
13227
  break;
13332
- case "midiEncoding":
13333
- writeInfo("MENC", data);
13334
- break;
13228
+ case "midiEncoding": writeInfo("MENC", data);
13335
13229
  }
13336
13230
  }
13337
13231
  const DBNK = new IndexedByteArray(2);
@@ -13346,8 +13240,7 @@ function writeRMIDIInternal(mid, soundBankBinary, options) {
13346
13240
  new IndexedByteArray(soundBankBinary)
13347
13241
  ]).buffer;
13348
13242
  }
13349
- //#endregion
13350
- //#region src/midi/basic_midi.ts
13243
+ // src/midi/basic_midi.ts
13351
13244
  /**
13352
13245
  * BasicMIDI is the base of a complete MIDI file.
13353
13246
  * It represents a single MIDI sequence, with an optional sound bank attached to it.
@@ -13575,7 +13468,6 @@ var BasicMIDI = class BasicMIDI {
13575
13468
  default:
13576
13469
  if (initialString !== "MThd" && loadTrackerModule(mid, binaryData, fileName)) break;
13577
13470
  parseSMFInternal(mid, binaryData, fileName);
13578
- break;
13579
13471
  }
13580
13472
  return mid;
13581
13473
  }
@@ -14151,13 +14043,14 @@ var BasicMIDI = class BasicMIDI {
14151
14043
  this.isKaraokeFile = true;
14152
14044
  SpessaLog.info("%cKaraoke MIDI detected!", ConsoleColors.recognized);
14153
14045
  } else if (this.isKaraokeFile) {
14154
- if (checkedText.startsWith("@T") || checkedText.startsWith("@A")) if (karaokeHasTitle) this.extraMetadata.push(e);
14155
- else {
14156
- this.binaryName = e.data.slice(2);
14157
- karaokeHasTitle = true;
14158
- nameDetected = true;
14159
- }
14160
- else if (!checkedText.startsWith("@")) this.lyrics.push(e);
14046
+ if (checkedText.startsWith("@T") || checkedText.startsWith("@A")) {
14047
+ if (karaokeHasTitle) this.extraMetadata.push(e);
14048
+ else {
14049
+ this.binaryName = e.data.slice(2);
14050
+ karaokeHasTitle = true;
14051
+ nameDetected = true;
14052
+ }
14053
+ } else if (!checkedText.startsWith("@")) this.lyrics.push(e);
14161
14054
  }
14162
14055
  break;
14163
14056
  }
@@ -14241,14 +14134,16 @@ var BasicMIDI = class BasicMIDI {
14241
14134
  this.isMultiPort = true;
14242
14135
  SpessaLog.info(`%cMIDI Ports detected!`, ConsoleColors.recognized);
14243
14136
  }
14244
- if (!nameDetected && this.tracks.length > 0) if (this.tracks.length > 1) {
14245
- if (!this.tracks[0].events.some((message) => message.statusByte >= MIDIMessageTypes.noteOn && message.statusByte < MIDIMessageTypes.polyPressure)) {
14137
+ if (!nameDetected && this.tracks.length > 0) {
14138
+ if (this.tracks.length > 1) {
14139
+ if (!this.tracks[0].events.some((message) => message.statusByte >= MIDIMessageTypes.noteOn && message.statusByte < MIDIMessageTypes.polyPressure)) {
14140
+ const name = this.tracks[0].events.find((message) => message.statusByte === MIDIMessageTypes.trackName);
14141
+ if (name) this.binaryName = name.data;
14142
+ }
14143
+ } else {
14246
14144
  const name = this.tracks[0].events.find((message) => message.statusByte === MIDIMessageTypes.trackName);
14247
14145
  if (name) this.binaryName = name.data;
14248
14146
  }
14249
- } else {
14250
- const name = this.tracks[0].events.find((message) => message.statusByte === MIDIMessageTypes.trackName);
14251
- if (name) this.binaryName = name.data;
14252
14147
  }
14253
14148
  this.extraMetadata = this.extraMetadata.filter((c) => c.data.length > 0);
14254
14149
  this.lyrics.sort((a, b) => a.ticks - b.ticks);
@@ -14266,8 +14161,7 @@ var BasicMIDI = class BasicMIDI {
14266
14161
  SpessaLog.groupEnd();
14267
14162
  }
14268
14163
  };
14269
- //#endregion
14270
- //#region src/midi/midi_tools/midi_builder.ts
14164
+ // src/midi/midi_tools/midi_builder.ts
14271
14165
  const DEFAULT_MIDI_BUILDER_OPTIONS = {
14272
14166
  name: "Untitled song",
14273
14167
  timeDivision: 480,
@@ -14472,8 +14366,7 @@ var MIDIBuilder = class extends BasicMIDI {
14472
14366
  this.controllerChange(ticks, track, channel, MIDIControllers.dataEntryLSB, value & 127);
14473
14367
  }
14474
14368
  };
14475
- //#endregion
14476
- //#region src/sequencer/process_event.ts
14369
+ // src/sequencer/process_event.ts
14477
14370
  /**
14478
14371
  * Processes a MIDI event.
14479
14372
  * @param event The MIDI event to process.
@@ -14572,17 +14465,14 @@ function processEventInternal(event, trackIndex) {
14572
14465
  case MIDIMessageTypes.reset:
14573
14466
  this.synth.reset();
14574
14467
  break;
14575
- default:
14576
- SpessaLog.info(`%cUnrecognized Event: %c${event.statusByte.toString(16)}`, ConsoleColors.warn, ConsoleColors.unrecognized);
14577
- break;
14468
+ default: SpessaLog.info(`%cUnrecognized Event: %c${event.statusByte.toString(16)}`, ConsoleColors.warn, ConsoleColors.unrecognized);
14578
14469
  }
14579
14470
  if (status >= 0 && status < 128) this.callEvent("metaEvent", {
14580
14471
  event,
14581
14472
  trackIndex
14582
14473
  });
14583
14474
  }
14584
- //#endregion
14585
- //#region src/sequencer/process_tick.ts
14475
+ // src/sequencer/process_tick.ts
14586
14476
  /**
14587
14477
  * Processes a single MIDI tick.
14588
14478
  * Call this every rendering quantum to process the sequencer events in real-time.
@@ -14617,8 +14507,7 @@ function processTick() {
14617
14507
  this.playedTime += this.oneTickToSeconds * (nextEvent.ticks - event.ticks);
14618
14508
  }
14619
14509
  }
14620
- //#endregion
14621
- //#region src/sequencer/load_new_sequence.ts
14510
+ // src/sequencer/load_new_sequence.ts
14622
14511
  /**
14623
14512
  * Assigns a MIDI port channel offset to a track.
14624
14513
  * @param trackNum The track number to assign the port to.
@@ -14670,9 +14559,8 @@ function loadNewSequenceInternal(parsedMIDI) {
14670
14559
  }
14671
14560
  this.currentTime = 0;
14672
14561
  }
14673
- //#endregion
14674
- //#region src/sequencer/set_time_to.ts
14675
- const nonSkippableCCs = new Set([
14562
+ // src/sequencer/set_time_to.ts
14563
+ const nonSkippableCCs = /* @__PURE__ */ new Set([
14676
14564
  MIDIControllers.dataDecrement,
14677
14565
  MIDIControllers.dataIncrement,
14678
14566
  MIDIControllers.dataEntryMSB,
@@ -14817,9 +14705,7 @@ function setTimeToInternal(time, ticks = void 0) {
14817
14705
  savedTempoTrack = trackIndex;
14818
14706
  break;
14819
14707
  }
14820
- default:
14821
- this.processEvent(event, trackIndex);
14822
- break;
14708
+ default: this.processEvent(event, trackIndex);
14823
14709
  }
14824
14710
  const nE = timeline[++this.index];
14825
14711
  if (nE === void 0) {
@@ -14833,8 +14719,10 @@ function setTimeToInternal(time, ticks = void 0) {
14833
14719
  for (let channel = 0; channel < channelsToRestore; channel++) {
14834
14720
  const ch = channels[channel] ?? createChannelStatus(channel);
14835
14721
  this.sendMIDIPitchWheel(channel, ch.pitchWheel);
14836
- if (ch.portamentoNote >= 0) if (this.externalMIDIPlayback) this.sendMIDICC(channel, MIDIControllers.portamentoControl, ch.portamentoNote);
14837
- else this.synth.midiChannels[channel].setLastNote(ch.portamentoNote);
14722
+ if (ch.portamentoNote >= 0) {
14723
+ if (this.externalMIDIPlayback) this.sendMIDICC(channel, MIDIControllers.portamentoControl, ch.portamentoNote);
14724
+ else this.synth.midiChannels[channel].setLastNote(ch.portamentoNote);
14725
+ }
14838
14726
  for (let i = 0; i < 128; i++) {
14839
14727
  const value = ch.controllers[i];
14840
14728
  if (value !== DEFAULT_MIDI_CONTROLLERS[i] && !nonSkippableCCs.has(i)) this.sendMIDICC(channel, i, value >> 7);
@@ -14847,8 +14735,7 @@ function setTimeToInternal(time, ticks = void 0) {
14847
14735
  if (this.paused) this.pausedTime = this.playedTime;
14848
14736
  return true;
14849
14737
  }
14850
- //#endregion
14851
- //#region src/sequencer/sequencer.ts
14738
+ // src/sequencer/sequencer.ts
14852
14739
  /**
14853
14740
  * This module is responsible for playing back {@link BasicMIDI} sequences to {@link SpessaSynthProcessor}.
14854
14741
  *
@@ -15089,9 +14976,10 @@ var SpessaSynthSequencer = class {
15089
14976
  set currentTime(time) {
15090
14977
  if (!this._midiData) return;
15091
14978
  if (this.paused) this.pausedTime = time;
15092
- if (time > this._midiData.duration || time < 0) if (this.skipToFirstNoteOn) this.setTimeTicks(this._midiData.firstNoteOn - 1);
15093
- else this.setTimeTicks(0);
15094
- else if (this.skipToFirstNoteOn && time < this.firstNoteTime) {
14979
+ if (time > this._midiData.duration || time < 0) {
14980
+ if (this.skipToFirstNoteOn) this.setTimeTicks(this._midiData.firstNoteOn - 1);
14981
+ else this.setTimeTicks(0);
14982
+ } else if (this.skipToFirstNoteOn && time < this.firstNoteTime) {
15095
14983
  this.setTimeTicks(this._midiData.firstNoteOn - 1);
15096
14984
  return;
15097
14985
  } else {
@@ -15366,8 +15254,7 @@ var SpessaSynthSequencer = class {
15366
15254
  ], channel - midiChannel);
15367
15255
  }
15368
15256
  };
15369
- //#endregion
15370
- //#region src/synthesizer/audio_engine/effects/xg/implementation/dsp/no_effect.ts
15257
+ // src/synthesizer/audio_engine/effects/xg/implementation/dsp/no_effect.ts
15371
15258
  /**
15372
15259
  * MU128 manual description:
15373
15260
  * Turn off the effect.
@@ -15382,11 +15269,10 @@ var XGNoEffect = class {
15382
15269
  }
15383
15270
  reset() {}
15384
15271
  getSnapshot() {
15385
- return new Int16Array(16);
15272
+ return /* @__PURE__ */ new Int16Array(16);
15386
15273
  }
15387
15274
  };
15388
- //#endregion
15389
- //#region src/synthesizer/audio_engine/effects/xg/implementation/dsp/xg_dsp_tables.ts
15275
+ // src/synthesizer/audio_engine/effects/xg/implementation/dsp/xg_dsp_tables.ts
15390
15276
  /**
15391
15277
  * Coefficient word format per variation category * 192 + coefficient index. -1 means unused.
15392
15278
  */
@@ -17373,8 +17259,7 @@ const DELAY_OFFSET = new Uint16Array([
17373
17259
  484,
17374
17260
  500
17375
17261
  ]);
17376
- //#endregion
17377
- //#region src/synthesizer/audio_engine/effects/xg/implementation/dsp/xg_dsp_program.ts
17262
+ // src/synthesizer/audio_engine/effects/xg/implementation/dsp/xg_dsp_program.ts
17378
17263
  /**
17379
17264
  * The sample rate the XG DSP programs are designed for.
17380
17265
  */
@@ -17447,7 +17332,7 @@ function getMemorySize(sampleRate, size) {
17447
17332
  while (powerOfTwo < length) powerOfTwo <<= 1;
17448
17333
  return powerOfTwo;
17449
17334
  }
17450
- const chopFloat = new Float32Array(1);
17335
+ const chopFloat = /* @__PURE__ */ new Float32Array(1);
17451
17336
  const chopBits = new Int32Array(chopFloat.buffer);
17452
17337
  /**
17453
17338
  * Rounds toward zero to float32.
@@ -17503,7 +17388,7 @@ var XGDSPProgram = class {
17503
17388
  /**
17504
17389
  * The raw XG parameter values.
17505
17390
  */
17506
- params = new Int16Array(16);
17391
+ params = /* @__PURE__ */ new Int16Array(16);
17507
17392
  /**
17508
17393
  * The coefficient word RAM.
17509
17394
  */
@@ -17555,7 +17440,7 @@ var XGDSPProgram = class {
17555
17440
  /**
17556
17441
  * The first-order filter designer output (b0, b1, a1).
17557
17442
  */
17558
- firstOrder = new Float64Array(3);
17443
+ firstOrder = /* @__PURE__ */ new Float64Array(3);
17559
17444
  addressScale;
17560
17445
  tickLength;
17561
17446
  tickCounter = 0;
@@ -17819,8 +17704,10 @@ var XGDSPProgram = class {
17819
17704
  const err1 = Math.trunc(r1) - e1;
17820
17705
  const sum = err0 + err1;
17821
17706
  if (sum >= -.5) {
17822
- if (sum > .5) if (err0 <= err1) r1--;
17823
- else r0--;
17707
+ if (sum > .5) {
17708
+ if (err0 <= err1) r1--;
17709
+ else r0--;
17710
+ }
17824
17711
  } else if (err0 > err1) r1++;
17825
17712
  else r0++;
17826
17713
  const a = biasedRound(Math.fround(a1 * 512));
@@ -17961,18 +17848,24 @@ var XGDSPProgram = class {
17961
17848
  const e0 = Math.trunc(r0) - x0, e1 = Math.trunc(r1) - x1, e2 = Math.trunc(r2) - x2, e3 = Math.trunc(r3) - x3, e4 = Math.trunc(r4) - x4;
17962
17849
  const sum = e1 + e0 + e2;
17963
17850
  if (sum >= -.5) {
17964
- if (sum > .5) if (e1 <= e2) if (e0 <= e2) r2--;
17965
- else r0--;
17966
- else if (e0 <= e1) r1--;
17967
- else r0--;
17968
- } else if (e1 > e2) if (e0 > e2) r2++;
17969
- else r0++;
17970
- else if (e0 > e1) r1++;
17851
+ if (sum > .5) {
17852
+ if (e1 <= e2) {
17853
+ if (e0 <= e2) r2--;
17854
+ else r0--;
17855
+ } else if (e0 <= e1) r1--;
17856
+ else r0--;
17857
+ }
17858
+ } else if (e1 > e2) {
17859
+ if (e0 > e2) r2++;
17860
+ else r0++;
17861
+ } else if (e0 > e1) r1++;
17971
17862
  else r0++;
17972
17863
  const poles = e3 + e4;
17973
17864
  if (poles >= -.5) {
17974
- if (poles > .5) if (e3 <= e4) r4--;
17975
- else r3--;
17865
+ if (poles > .5) {
17866
+ if (e3 <= e4) r4--;
17867
+ else r3--;
17868
+ }
17976
17869
  } else if (e3 > e4) r4++;
17977
17870
  else r3++;
17978
17871
  const w = this.coefficientWords;
@@ -17984,8 +17877,7 @@ var XGDSPProgram = class {
17984
17877
  this.pushCoefficients(list, 5);
17985
17878
  }
17986
17879
  };
17987
- //#endregion
17988
- //#region src/synthesizer/audio_engine/effects/xg/implementation/effect.ts
17880
+ // src/synthesizer/audio_engine/effects/xg/implementation/effect.ts
17989
17881
  /**
17990
17882
  * The default implementation for {@link XGEffectBlock}.
17991
17883
  *
@@ -18058,13 +17950,12 @@ var DefaultXGEffect = class {
18058
17950
  for (let i = 0; i < 16 && i < params.length; i++) this.setParameter(i, params[i]);
18059
17951
  }
18060
17952
  };
18061
- //#endregion
18062
- //#region src/synthesizer/audio_engine/effects/xg/implementation/system_effect.ts
17953
+ // src/synthesizer/audio_engine/effects/xg/implementation/system_effect.ts
18063
17954
  const MIN_PAN$2 = 1;
18064
17955
  const MAX_PAN$2 = 127;
18065
- const PAN_RESOLUTION$2 = MAX_PAN$2 - MIN_PAN$2;
18066
- const panTableLeft$1 = new Float32Array(PAN_RESOLUTION$2 + 1);
18067
- const panTableRight$1 = new Float32Array(PAN_RESOLUTION$2 + 1);
17956
+ const PAN_RESOLUTION$2 = 126;
17957
+ const panTableLeft$1 = /* @__PURE__ */ new Float32Array(127);
17958
+ const panTableRight$1 = /* @__PURE__ */ new Float32Array(127);
18068
17959
  for (let pan = MIN_PAN$2; pan <= MAX_PAN$2; pan++) {
18069
17960
  const realPan = (pan - MIN_PAN$2) / PAN_RESOLUTION$2;
18070
17961
  const tableIndex = pan - MIN_PAN$2;
@@ -18117,8 +18008,7 @@ var DefaultXGSystemEffect = class extends DefaultXGEffect {
18117
18008
  }
18118
18009
  }
18119
18010
  };
18120
- //#endregion
18121
- //#region src/synthesizer/audio_engine/effects/xg/implementation/dsp/reverb/reverb_tables.ts
18011
+ // src/synthesizer/audio_engine/effects/xg/implementation/dsp/reverb/reverb_tables.ts
18122
18012
  /**
18123
18013
  * Reverb time to damping table index.
18124
18014
  */
@@ -19181,8 +19071,7 @@ const ROOM_STEP = new Uint8Array([
19181
19071
  2,
19182
19072
  64
19183
19073
  ]);
19184
- //#endregion
19185
- //#region src/synthesizer/audio_engine/effects/xg/implementation/dsp/reverb/xg_reverb.ts
19074
+ // src/synthesizer/audio_engine/effects/xg/implementation/dsp/reverb/xg_reverb.ts
19186
19075
  const COEFFICIENT_LIST$2 = [
19187
19076
  27,
19188
19077
  28,
@@ -19553,7 +19442,6 @@ var XGReverb = class extends XGDSPProgram {
19553
19442
  case 14:
19554
19443
  this.coefficientWords[51] = this.feedbackWord(p[14]);
19555
19444
  this.pushCoefficients(LIST_FEEDBACK$1);
19556
- break;
19557
19445
  }
19558
19446
  }
19559
19447
  /**
@@ -19693,9 +19581,7 @@ var XGRoomReverb = class extends XGReverb {
19693
19581
  this.roomDimension(2, ROOM_STEP[this.preset.roomStep + 1], p[7], 2);
19694
19582
  if (this.preset.wall === "depth") this.wall();
19695
19583
  break;
19696
- case 8:
19697
- this.wall();
19698
- break;
19584
+ case 8: this.wall();
19699
19585
  }
19700
19586
  }
19701
19587
  /**
@@ -19782,8 +19668,7 @@ var XGRoomReverb = class extends XGReverb {
19782
19668
  this.pushCoefficients(LIST_TIME, 3, 9);
19783
19669
  }
19784
19670
  };
19785
- //#endregion
19786
- //#region src/synthesizer/audio_engine/effects/xg/implementation/dsp/reverb/basement.ts
19671
+ // src/synthesizer/audio_engine/effects/xg/implementation/dsp/reverb/basement.ts
19787
19672
  /**
19788
19673
  * BASEMENT (`13 00`) in the reverb block.
19789
19674
  */
@@ -19890,8 +19775,7 @@ var XGBasement = class extends XGRoomReverb {
19890
19775
  wall: "height"
19891
19776
  };
19892
19777
  };
19893
- //#endregion
19894
- //#region src/synthesizer/audio_engine/effects/xg/implementation/dsp/reverb/gm_plate.ts
19778
+ // src/synthesizer/audio_engine/effects/xg/implementation/dsp/reverb/gm_plate.ts
19895
19779
  /**
19896
19780
  * GM PLATE (`04 07`) in the reverb block.
19897
19781
  */
@@ -19995,8 +19879,7 @@ var XGGMPlate = class extends XGReverb {
19995
19879
  hpfGain: -2
19996
19880
  };
19997
19881
  };
19998
- //#endregion
19999
- //#region src/synthesizer/audio_engine/effects/xg/implementation/dsp/reverb/hall1.ts
19882
+ // src/synthesizer/audio_engine/effects/xg/implementation/dsp/reverb/hall1.ts
20000
19883
  /**
20001
19884
  * HALL 1 (`01 00`) in the reverb block.
20002
19885
  */
@@ -20100,8 +19983,7 @@ var XGHall1 = class extends XGReverb {
20100
19983
  hpfGain: 2
20101
19984
  };
20102
19985
  };
20103
- //#endregion
20104
- //#region src/synthesizer/audio_engine/effects/xg/implementation/dsp/reverb/hall2.ts
19986
+ // src/synthesizer/audio_engine/effects/xg/implementation/dsp/reverb/hall2.ts
20105
19987
  /**
20106
19988
  * HALL 2 (`01 01`) in the reverb block.
20107
19989
  */
@@ -20205,8 +20087,7 @@ var XGHall2 = class extends XGReverb {
20205
20087
  hpfGain: -1
20206
20088
  };
20207
20089
  };
20208
- //#endregion
20209
- //#region src/synthesizer/audio_engine/effects/xg/implementation/dsp/reverb/hall_l.ts
20090
+ // src/synthesizer/audio_engine/effects/xg/implementation/dsp/reverb/hall_l.ts
20210
20091
  /**
20211
20092
  * HALL L (`01 07`) in the reverb block.
20212
20093
  */
@@ -20310,8 +20191,7 @@ var XGHallL = class extends XGReverb {
20310
20191
  hpfGain: -1
20311
20192
  };
20312
20193
  };
20313
- //#endregion
20314
- //#region src/synthesizer/audio_engine/effects/xg/implementation/dsp/reverb/hall_m.ts
20194
+ // src/synthesizer/audio_engine/effects/xg/implementation/dsp/reverb/hall_m.ts
20315
20195
  /**
20316
20196
  * HALL M (`01 06`) in the reverb block.
20317
20197
  */
@@ -20415,8 +20295,7 @@ var XGHallM = class extends XGReverb {
20415
20295
  hpfGain: 2
20416
20296
  };
20417
20297
  };
20418
- //#endregion
20419
- //#region src/synthesizer/audio_engine/effects/xg/implementation/dsp/reverb/plate.ts
20298
+ // src/synthesizer/audio_engine/effects/xg/implementation/dsp/reverb/plate.ts
20420
20299
  /**
20421
20300
  * PLATE (`04 00`) in the reverb block.
20422
20301
  */
@@ -20520,8 +20399,7 @@ var XGPlate = class extends XGReverb {
20520
20399
  hpfGain: -2
20521
20400
  };
20522
20401
  };
20523
- //#endregion
20524
- //#region src/synthesizer/audio_engine/effects/xg/implementation/dsp/reverb/room1.ts
20402
+ // src/synthesizer/audio_engine/effects/xg/implementation/dsp/reverb/room1.ts
20525
20403
  /**
20526
20404
  * ROOM 1 (`02 00`) in the reverb block.
20527
20405
  */
@@ -20625,8 +20503,7 @@ var XGRoom1 = class extends XGReverb {
20625
20503
  hpfGain: -1
20626
20504
  };
20627
20505
  };
20628
- //#endregion
20629
- //#region src/synthesizer/audio_engine/effects/xg/implementation/dsp/reverb/room2.ts
20506
+ // src/synthesizer/audio_engine/effects/xg/implementation/dsp/reverb/room2.ts
20630
20507
  /**
20631
20508
  * ROOM 2 (`02 01`) in the reverb block.
20632
20509
  */
@@ -20730,8 +20607,7 @@ var XGRoom2 = class extends XGReverb {
20730
20607
  hpfGain: 0
20731
20608
  };
20732
20609
  };
20733
- //#endregion
20734
- //#region src/synthesizer/audio_engine/effects/xg/implementation/dsp/reverb/room3.ts
20610
+ // src/synthesizer/audio_engine/effects/xg/implementation/dsp/reverb/room3.ts
20735
20611
  /**
20736
20612
  * ROOM 3 (`02 02`) in the reverb block.
20737
20613
  */
@@ -20835,8 +20711,7 @@ var XGRoom3 = class extends XGReverb {
20835
20711
  hpfGain: 0
20836
20712
  };
20837
20713
  };
20838
- //#endregion
20839
- //#region src/synthesizer/audio_engine/effects/xg/implementation/dsp/reverb/room_l.ts
20714
+ // src/synthesizer/audio_engine/effects/xg/implementation/dsp/reverb/room_l.ts
20840
20715
  /**
20841
20716
  * ROOM L (`02 07`) in the reverb block.
20842
20717
  */
@@ -20940,8 +20815,7 @@ var XGRoomL = class extends XGReverb {
20940
20815
  hpfGain: 0
20941
20816
  };
20942
20817
  };
20943
- //#endregion
20944
- //#region src/synthesizer/audio_engine/effects/xg/implementation/dsp/reverb/room_m.ts
20818
+ // src/synthesizer/audio_engine/effects/xg/implementation/dsp/reverb/room_m.ts
20945
20819
  /**
20946
20820
  * ROOM M (`02 06`) in the reverb block.
20947
20821
  */
@@ -21045,8 +20919,7 @@ var XGRoomM = class extends XGReverb {
21045
20919
  hpfGain: -1
21046
20920
  };
21047
20921
  };
21048
- //#endregion
21049
- //#region src/synthesizer/audio_engine/effects/xg/implementation/dsp/reverb/room_s.ts
20922
+ // src/synthesizer/audio_engine/effects/xg/implementation/dsp/reverb/room_s.ts
21050
20923
  /**
21051
20924
  * ROOM S (`02 05`) in the reverb block.
21052
20925
  */
@@ -21150,8 +21023,7 @@ var XGRoomS = class extends XGReverb {
21150
21023
  hpfGain: 0
21151
21024
  };
21152
21025
  };
21153
- //#endregion
21154
- //#region src/synthesizer/audio_engine/effects/xg/implementation/dsp/reverb/stage1.ts
21026
+ // src/synthesizer/audio_engine/effects/xg/implementation/dsp/reverb/stage1.ts
21155
21027
  /**
21156
21028
  * STAGE 1 (`03 00`) in the reverb block.
21157
21029
  */
@@ -21255,8 +21127,7 @@ var XGStage1 = class extends XGReverb {
21255
21127
  hpfGain: -1
21256
21128
  };
21257
21129
  };
21258
- //#endregion
21259
- //#region src/synthesizer/audio_engine/effects/xg/implementation/dsp/reverb/stage2.ts
21130
+ // src/synthesizer/audio_engine/effects/xg/implementation/dsp/reverb/stage2.ts
21260
21131
  /**
21261
21132
  * STAGE 2 (`03 01`) in the reverb block.
21262
21133
  */
@@ -21360,8 +21231,7 @@ var XGStage2 = class extends XGReverb {
21360
21231
  hpfGain: -2
21361
21232
  };
21362
21233
  };
21363
- //#endregion
21364
- //#region src/synthesizer/audio_engine/effects/xg/implementation/dsp/reverb/tunnel.ts
21234
+ // src/synthesizer/audio_engine/effects/xg/implementation/dsp/reverb/tunnel.ts
21365
21235
  /**
21366
21236
  * TUNNEL (`11 00`) in the reverb block.
21367
21237
  */
@@ -21468,8 +21338,7 @@ var XGTunnel = class extends XGRoomReverb {
21468
21338
  wall: "depth"
21469
21339
  };
21470
21340
  };
21471
- //#endregion
21472
- //#region src/synthesizer/audio_engine/effects/xg/implementation/dsp/reverb/white_room.ts
21341
+ // src/synthesizer/audio_engine/effects/xg/implementation/dsp/reverb/white_room.ts
21473
21342
  /**
21474
21343
  * WHITE ROOM (`10 00`) in the reverb block.
21475
21344
  */
@@ -21576,9 +21445,8 @@ var XGWhiteRoom = class extends XGRoomReverb {
21576
21445
  wall: "height"
21577
21446
  };
21578
21447
  };
21579
- //#endregion
21580
- //#region src/synthesizer/audio_engine/effects/xg/implementation/reverb.ts
21581
- const REVERB_MAP = new Map([
21448
+ // src/synthesizer/audio_engine/effects/xg/implementation/reverb.ts
21449
+ const REVERB_MAP = /* @__PURE__ */ new Map([
21582
21450
  [0, XGNoEffect],
21583
21451
  [256, XGHall1],
21584
21452
  [257, XGHall2],
@@ -21619,8 +21487,7 @@ var DefaultXGReverb = class extends DefaultXGSystemEffect {
21619
21487
  this.mixSystemEffect(outputLeft, outputRight, startIndex, sampleCount);
21620
21488
  }
21621
21489
  };
21622
- //#endregion
21623
- //#region src/synthesizer/audio_engine/effects/xg/implementation/dsp/chorus/xg_chorus.ts
21490
+ // src/synthesizer/audio_engine/effects/xg/implementation/dsp/chorus/xg_chorus.ts
21624
21491
  const COEFFICIENT_LIST$1 = [
21625
21492
  9,
21626
21493
  10,
@@ -21796,7 +21663,7 @@ var XGChorusBase = class extends XGDSPProgram {
21796
21663
  */
21797
21664
  inputLeft;
21798
21665
  inputRight;
21799
- equalizerState = new Float64Array(6);
21666
+ equalizerState = /* @__PURE__ */ new Float64Array(6);
21800
21667
  constructor(sampleRate, maxBufferSize, memory, variation) {
21801
21668
  super(sampleRate, maxBufferSize, memory, 0);
21802
21669
  this.variation = variation;
@@ -21895,9 +21762,7 @@ var XGChorusBase = class extends XGDSPProgram {
21895
21762
  case 40:
21896
21763
  this.depthRight = Math.trunc(c[40] * depthScale);
21897
21764
  break;
21898
- case 55:
21899
- this.depthThird = Math.trunc(c[55] * depthScale);
21900
- break;
21765
+ case 55: this.depthThird = Math.trunc(c[55] * depthScale);
21901
21766
  }
21902
21767
  }
21903
21768
  convert(param) {
@@ -22037,8 +21902,7 @@ var XGFlanger = class extends XGChorusBase {
22037
21902
  return this.feedbackWord(this.params[2]);
22038
21903
  }
22039
21904
  };
22040
- //#endregion
22041
- //#region src/synthesizer/audio_engine/effects/xg/implementation/dsp/chorus/celeste1.ts
21905
+ // src/synthesizer/audio_engine/effects/xg/implementation/dsp/chorus/celeste1.ts
22042
21906
  /**
22043
21907
  * CELESTE 1 (`42 00`).
22044
21908
  */
@@ -22106,8 +21970,7 @@ var XGCeleste1 = class extends XGCeleste {
22106
21970
  variationGain: 48
22107
21971
  };
22108
21972
  };
22109
- //#endregion
22110
- //#region src/synthesizer/audio_engine/effects/xg/implementation/dsp/chorus/celeste2.ts
21973
+ // src/synthesizer/audio_engine/effects/xg/implementation/dsp/chorus/celeste2.ts
22111
21974
  /**
22112
21975
  * CELESTE 2 (`42 01`).
22113
21976
  */
@@ -22175,8 +22038,7 @@ var XGCeleste2 = class extends XGCeleste {
22175
22038
  variationGain: 48
22176
22039
  };
22177
22040
  };
22178
- //#endregion
22179
- //#region src/synthesizer/audio_engine/effects/xg/implementation/dsp/chorus/celeste3.ts
22041
+ // src/synthesizer/audio_engine/effects/xg/implementation/dsp/chorus/celeste3.ts
22180
22042
  /**
22181
22043
  * CELESTE 3 (`42 02`).
22182
22044
  */
@@ -22244,8 +22106,7 @@ var XGCeleste3 = class extends XGCeleste {
22244
22106
  variationGain: 48
22245
22107
  };
22246
22108
  };
22247
- //#endregion
22248
- //#region src/synthesizer/audio_engine/effects/xg/implementation/dsp/chorus/celeste4.ts
22109
+ // src/synthesizer/audio_engine/effects/xg/implementation/dsp/chorus/celeste4.ts
22249
22110
  /**
22250
22111
  * CELESTE 4 (`42 08`).
22251
22112
  */
@@ -22313,8 +22174,7 @@ var XGCeleste4 = class extends XGCeleste {
22313
22174
  variationGain: 48
22314
22175
  };
22315
22176
  };
22316
- //#endregion
22317
- //#region src/synthesizer/audio_engine/effects/xg/implementation/dsp/chorus/chorus1.ts
22177
+ // src/synthesizer/audio_engine/effects/xg/implementation/dsp/chorus/chorus1.ts
22318
22178
  /**
22319
22179
  * CHORUS 1 (`41 00`).
22320
22180
  */
@@ -22382,8 +22242,7 @@ var XGChorus1 = class extends XGChorus {
22382
22242
  variationGain: 63
22383
22243
  };
22384
22244
  };
22385
- //#endregion
22386
- //#region src/synthesizer/audio_engine/effects/xg/implementation/dsp/chorus/chorus2.ts
22245
+ // src/synthesizer/audio_engine/effects/xg/implementation/dsp/chorus/chorus2.ts
22387
22246
  /**
22388
22247
  * CHORUS 2 (`41 01`).
22389
22248
  */
@@ -22451,8 +22310,7 @@ var XGChorus2 = class extends XGChorus {
22451
22310
  variationGain: 63
22452
22311
  };
22453
22312
  };
22454
- //#endregion
22455
- //#region src/synthesizer/audio_engine/effects/xg/implementation/dsp/chorus/chorus3.ts
22313
+ // src/synthesizer/audio_engine/effects/xg/implementation/dsp/chorus/chorus3.ts
22456
22314
  /**
22457
22315
  * CHORUS 3 (`41 02`).
22458
22316
  */
@@ -22520,8 +22378,7 @@ var XGChorus3 = class extends XGChorus {
22520
22378
  variationGain: 63
22521
22379
  };
22522
22380
  };
22523
- //#endregion
22524
- //#region src/synthesizer/audio_engine/effects/xg/implementation/dsp/chorus/chorus4.ts
22381
+ // src/synthesizer/audio_engine/effects/xg/implementation/dsp/chorus/chorus4.ts
22525
22382
  /**
22526
22383
  * CHORUS 4 (`41 08`).
22527
22384
  */
@@ -22589,8 +22446,7 @@ var XGChorus4 = class extends XGChorus {
22589
22446
  variationGain: 63
22590
22447
  };
22591
22448
  };
22592
- //#endregion
22593
- //#region src/synthesizer/audio_engine/effects/xg/implementation/dsp/chorus/fb_chorus.ts
22449
+ // src/synthesizer/audio_engine/effects/xg/implementation/dsp/chorus/fb_chorus.ts
22594
22450
  /**
22595
22451
  * FB CHORUS (`41 07`).
22596
22452
  */
@@ -22658,8 +22514,7 @@ var XGFBChorus = class extends XGChorus {
22658
22514
  variationGain: 63
22659
22515
  };
22660
22516
  };
22661
- //#endregion
22662
- //#region src/synthesizer/audio_engine/effects/xg/implementation/dsp/chorus/flanger1.ts
22517
+ // src/synthesizer/audio_engine/effects/xg/implementation/dsp/chorus/flanger1.ts
22663
22518
  /**
22664
22519
  * FLANGER 1 (`43 00`).
22665
22520
  */
@@ -22727,8 +22582,7 @@ var XGFlanger1 = class extends XGFlanger {
22727
22582
  variationGain: 45
22728
22583
  };
22729
22584
  };
22730
- //#endregion
22731
- //#region src/synthesizer/audio_engine/effects/xg/implementation/dsp/chorus/flanger2.ts
22585
+ // src/synthesizer/audio_engine/effects/xg/implementation/dsp/chorus/flanger2.ts
22732
22586
  /**
22733
22587
  * FLANGER 2 (`43 01`).
22734
22588
  */
@@ -22796,8 +22650,7 @@ var XGFlanger2 = class extends XGFlanger {
22796
22650
  variationGain: 45
22797
22651
  };
22798
22652
  };
22799
- //#endregion
22800
- //#region src/synthesizer/audio_engine/effects/xg/implementation/dsp/chorus/flanger3.ts
22653
+ // src/synthesizer/audio_engine/effects/xg/implementation/dsp/chorus/flanger3.ts
22801
22654
  /**
22802
22655
  * FLANGER 3 (`43 08`).
22803
22656
  */
@@ -22865,8 +22718,7 @@ var XGFlanger3 = class extends XGFlanger {
22865
22718
  variationGain: 45
22866
22719
  };
22867
22720
  };
22868
- //#endregion
22869
- //#region src/synthesizer/audio_engine/effects/xg/implementation/dsp/chorus/gm_chorus1.ts
22721
+ // src/synthesizer/audio_engine/effects/xg/implementation/dsp/chorus/gm_chorus1.ts
22870
22722
  /**
22871
22723
  * GM CHORUS 1 (`41 03`).
22872
22724
  */
@@ -22934,8 +22786,7 @@ var XGGMChorus1 = class extends XGChorus {
22934
22786
  variationGain: 63
22935
22787
  };
22936
22788
  };
22937
- //#endregion
22938
- //#region src/synthesizer/audio_engine/effects/xg/implementation/dsp/chorus/gm_chorus2.ts
22789
+ // src/synthesizer/audio_engine/effects/xg/implementation/dsp/chorus/gm_chorus2.ts
22939
22790
  /**
22940
22791
  * GM CHORUS 2 (`41 04`).
22941
22792
  */
@@ -23003,8 +22854,7 @@ var XGGMChorus2 = class extends XGChorus {
23003
22854
  variationGain: 63
23004
22855
  };
23005
22856
  };
23006
- //#endregion
23007
- //#region src/synthesizer/audio_engine/effects/xg/implementation/dsp/chorus/gm_chorus3.ts
22857
+ // src/synthesizer/audio_engine/effects/xg/implementation/dsp/chorus/gm_chorus3.ts
23008
22858
  /**
23009
22859
  * GM CHORUS 3 (`41 05`).
23010
22860
  */
@@ -23072,8 +22922,7 @@ var XGGMChorus3 = class extends XGChorus {
23072
22922
  variationGain: 63
23073
22923
  };
23074
22924
  };
23075
- //#endregion
23076
- //#region src/synthesizer/audio_engine/effects/xg/implementation/dsp/chorus/gm_chorus4.ts
22925
+ // src/synthesizer/audio_engine/effects/xg/implementation/dsp/chorus/gm_chorus4.ts
23077
22926
  /**
23078
22927
  * GM CHORUS 4 (`41 06`).
23079
22928
  */
@@ -23141,8 +22990,7 @@ var XGGMChorus4 = class extends XGChorus {
23141
22990
  variationGain: 63
23142
22991
  };
23143
22992
  };
23144
- //#endregion
23145
- //#region src/synthesizer/audio_engine/effects/xg/implementation/dsp/chorus/gm_flanger.ts
22993
+ // src/synthesizer/audio_engine/effects/xg/implementation/dsp/chorus/gm_flanger.ts
23146
22994
  /**
23147
22995
  * GM FLANGER (`43 07`).
23148
22996
  */
@@ -23210,9 +23058,8 @@ var XGGMFlanger = class extends XGFlanger {
23210
23058
  variationGain: 63
23211
23059
  };
23212
23060
  };
23213
- //#endregion
23214
- //#region src/synthesizer/audio_engine/effects/xg/implementation/chorus.ts
23215
- const CHORUS_MAP = new Map([
23061
+ // src/synthesizer/audio_engine/effects/xg/implementation/chorus.ts
23062
+ const CHORUS_MAP = /* @__PURE__ */ new Map([
23216
23063
  [0, XGNoEffect],
23217
23064
  [16640, XGChorus1],
23218
23065
  [16641, XGChorus2],
@@ -23274,8 +23121,7 @@ var DefaultXGChorus = class extends DefaultXGSystemEffect {
23274
23121
  this.sendToReverb = snapshot.sendToReverb;
23275
23122
  }
23276
23123
  };
23277
- //#endregion
23278
- //#region src/synthesizer/audio_engine/effects/xg/implementation/dsp/thru.ts
23124
+ // src/synthesizer/audio_engine/effects/xg/implementation/dsp/thru.ts
23279
23125
  /**
23280
23126
  * MU128 manual description:
23281
23127
  * Bypass without applying an effect.
@@ -23296,11 +23142,10 @@ var XGThru = class {
23296
23142
  }
23297
23143
  reset() {}
23298
23144
  getSnapshot() {
23299
- return new Int16Array(16);
23145
+ return /* @__PURE__ */ new Int16Array(16);
23300
23146
  }
23301
23147
  };
23302
- //#endregion
23303
- //#region src/synthesizer/audio_engine/effects/xg/implementation/dsp/xg_variation_program.ts
23148
+ // src/synthesizer/audio_engine/effects/xg/implementation/dsp/xg_variation_program.ts
23304
23149
  const COEFFICIENT_LIST = Array.from({ length: 79 }, (_, i) => 109 + i);
23305
23150
  const ADDRESS_LIST = Array.from({ length: 27 }, (_, i) => 36 + i);
23306
23151
  /**
@@ -23385,8 +23230,7 @@ var XGVariationProgram = class extends XGDSPProgram {
23385
23230
  }
23386
23231
  }
23387
23232
  };
23388
- //#endregion
23389
- //#region src/synthesizer/audio_engine/effects/xg/implementation/dsp/xg_stereo_variation_program.ts
23233
+ // src/synthesizer/audio_engine/effects/xg/implementation/dsp/xg_stereo_variation_program.ts
23390
23234
  const LIST_LOW_LEFT$2 = [
23391
23235
  127,
23392
23236
  126,
@@ -23436,7 +23280,7 @@ var XGStereoVariationProgram = class extends XGVariationProgram {
23436
23280
  lfoOffset4 = 0;
23437
23281
  lfoOffset5 = 0;
23438
23282
  lfoOffset6 = 0;
23439
- equalizerState = new Float64Array(6);
23283
+ equalizerState = /* @__PURE__ */ new Float64Array(6);
23440
23284
  constructor(sampleRate, maxBufferSize, memory) {
23441
23285
  super(sampleRate, maxBufferSize, memory, 0);
23442
23286
  }
@@ -23497,9 +23341,7 @@ var XGStereoVariationProgram = class extends XGVariationProgram {
23497
23341
  case 136:
23498
23342
  this.lfoOffset5 = Math.trunc(raw * 4194304);
23499
23343
  break;
23500
- case 141:
23501
- this.lfoOffset6 = Math.trunc(raw * 4194304);
23502
- break;
23344
+ case 141: this.lfoOffset6 = Math.trunc(raw * 4194304);
23503
23345
  }
23504
23346
  }
23505
23347
  }
@@ -23579,8 +23421,7 @@ var XGStereoVariationProgram = class extends XGVariationProgram {
23579
23421
  this.designFirstOrder("highShelf", highFrequency, highGain, LIST_HIGH_RIGHT$2);
23580
23422
  }
23581
23423
  };
23582
- //#endregion
23583
- //#region src/synthesizer/audio_engine/effects/xg/implementation/dsp/tremolo/xg_tremolo.ts
23424
+ // src/synthesizer/audio_engine/effects/xg/implementation/dsp/tremolo/xg_tremolo.ts
23584
23425
  const LIST_SHAPE_LEFT = [
23585
23426
  114,
23586
23427
  113,
@@ -23656,8 +23497,8 @@ var XGTremoloBase = class extends XGStereoVariationProgram {
23656
23497
  k = tReadR + pointer + intRight & mask;
23657
23498
  const tapR = (memory[k + 1 & mask] - memory[k]) * fracRight + memory[k];
23658
23499
  const r = inR[i];
23659
- memory[tWriteL + pointer & mask] = rightToL * r + inL[i];
23660
23500
  memory[tWriteR + pointer & mask] = rightToR * r;
23501
+ memory[tWriteL + pointer & mask] = rightToL * r + inL[i];
23661
23502
  outputLeft[i] = tapL * ampLeft * outL;
23662
23503
  outputRight[i] = tapR * ampRight * outR;
23663
23504
  pointer = pointer - 1 & mask;
@@ -23694,8 +23535,7 @@ var XGTremoloBase = class extends XGStereoVariationProgram {
23694
23535
  return this.variationGain * level >> 6;
23695
23536
  }
23696
23537
  };
23697
- //#endregion
23698
- //#region src/synthesizer/audio_engine/effects/xg/implementation/dsp/tremolo/tremolo.ts
23538
+ // src/synthesizer/audio_engine/effects/xg/implementation/dsp/tremolo/tremolo.ts
23699
23539
  const PARAMETER_RANGES$15 = {
23700
23540
  5: [8, 40],
23701
23541
  6: [52, 76],
@@ -23908,8 +23748,7 @@ var XGTremolo = class extends XGTremoloBase {
23908
23748
  }
23909
23749
  }
23910
23750
  };
23911
- //#endregion
23912
- //#region src/synthesizer/audio_engine/effects/xg/implementation/dsp/tremolo/auto_pan.ts
23751
+ // src/synthesizer/audio_engine/effects/xg/implementation/dsp/tremolo/auto_pan.ts
23913
23752
  const PARAMETER_RANGES$14 = {
23914
23753
  3: [0, 5],
23915
23754
  5: [8, 40],
@@ -24120,12 +23959,10 @@ var XGAutoPan = class extends XGTremoloBase {
24120
23959
  case 9:
24121
23960
  w[185] = w[180] = this.outputWord(this.insertion ? 362 : 724);
24122
23961
  this.pushCoefficients([180, 185]);
24123
- break;
24124
23962
  }
24125
23963
  }
24126
23964
  };
24127
- //#endregion
24128
- //#region src/synthesizer/audio_engine/effects/xg/implementation/dsp/phaser/xg_phaser.ts
23965
+ // src/synthesizer/audio_engine/effects/xg/implementation/dsp/phaser/xg_phaser.ts
24129
23966
  const LIST_LOW_LEFT$1 = [
24130
23967
  110,
24131
23968
  109,
@@ -24198,8 +24035,8 @@ var XGPhaserBase = class extends XGVariationProgram {
24198
24035
  eqXR = 0;
24199
24036
  eqYR = 0;
24200
24037
  eqZR = 0;
24201
- chainA = new Float32Array(6);
24202
- chainB = new Float32Array(6);
24038
+ chainA = /* @__PURE__ */ new Float32Array(6);
24039
+ chainB = /* @__PURE__ */ new Float32Array(6);
24203
24040
  constructor(sampleRate, maxBufferSize, memory) {
24204
24041
  super(sampleRate, maxBufferSize, memory, 1);
24205
24042
  }
@@ -24292,9 +24129,7 @@ var XGPhaserBase = class extends XGVariationProgram {
24292
24129
  case 121:
24293
24130
  this.sweepStep = Math.trunc(this.rawCoefficient(121) * this.rateInverse * 4194304);
24294
24131
  break;
24295
- case 156:
24296
- this.sweepOffset = Math.trunc(this.rawCoefficient(156) * 4194304);
24297
- break;
24132
+ case 156: this.sweepOffset = Math.trunc(this.rawCoefficient(156) * 4194304);
24298
24133
  }
24299
24134
  }
24300
24135
  }
@@ -24338,8 +24173,7 @@ var XGPhaserBase = class extends XGVariationProgram {
24338
24173
  this.designFirstOrder("highShelf", p[7], p[8], LIST_HIGH_RIGHT$1);
24339
24174
  }
24340
24175
  };
24341
- //#endregion
24342
- //#region src/synthesizer/audio_engine/effects/xg/implementation/dsp/phaser/phaser1.ts
24176
+ // src/synthesizer/audio_engine/effects/xg/implementation/dsp/phaser/phaser1.ts
24343
24177
  const PARAMETER_RANGES$13 = {
24344
24178
  3: [1, 127],
24345
24179
  5: [8, 40],
@@ -24602,12 +24436,10 @@ var XGPhaser1 = class extends XGPhaserBase {
24602
24436
  case INPUT_MIX:
24603
24437
  w[132] = w[133] = this.insertion ? 256 : 512;
24604
24438
  this.pushCoefficients([132, 133]);
24605
- break;
24606
24439
  }
24607
24440
  }
24608
24441
  };
24609
- //#endregion
24610
- //#region src/synthesizer/audio_engine/effects/xg/implementation/dsp/phaser/phaser2.ts
24442
+ // src/synthesizer/audio_engine/effects/xg/implementation/dsp/phaser/phaser2.ts
24611
24443
  const PARAMETER_RANGES$12 = {
24612
24444
  3: [1, 127],
24613
24445
  5: [8, 40],
@@ -24811,12 +24643,10 @@ var XGPhaser2 = class extends XGPhaserBase {
24811
24643
  case 12:
24812
24644
  w[156] = this.phaseWord(p[12]);
24813
24645
  this.pushCoefficients([156]);
24814
- break;
24815
24646
  }
24816
24647
  }
24817
24648
  };
24818
- //#endregion
24819
- //#region src/synthesizer/audio_engine/effects/xg/implementation/dsp/equalizer/two_band_eq.ts
24649
+ // src/synthesizer/audio_engine/effects/xg/implementation/dsp/equalizer/two_band_eq.ts
24820
24650
  const PARAMETER_RANGES$11 = {
24821
24651
  0: [8, 40],
24822
24652
  1: [52, 76],
@@ -24977,14 +24807,11 @@ var XGTwoBandEQ = class extends XGStereoVariationProgram {
24977
24807
  this.designLowEqualizer(p[0], p[1]);
24978
24808
  break;
24979
24809
  case 2:
24980
- case 3:
24981
- this.designHighEqualizer(p[2], p[3]);
24982
- break;
24810
+ case 3: this.designHighEqualizer(p[2], p[3]);
24983
24811
  }
24984
24812
  }
24985
24813
  };
24986
- //#endregion
24987
- //#region src/synthesizer/audio_engine/effects/xg/implementation/dsp/xg_filter_variation_program.ts
24814
+ // src/synthesizer/audio_engine/effects/xg/implementation/dsp/xg_filter_variation_program.ts
24988
24815
  /**
24989
24816
  * The category 3 coefficients that the original never writes.
24990
24817
  */
@@ -25026,13 +24853,11 @@ var XGFilterVariationProgram = class extends XGVariationProgram {
25026
24853
  case 126:
25027
24854
  this.wahStep = Math.trunc(this.rawCoefficient(126) * this.rateInverse * 16777216);
25028
24855
  c[191] = Math.fround(this.rateInverse / 256);
25029
- break;
25030
24856
  }
25031
24857
  }
25032
24858
  }
25033
24859
  };
25034
- //#endregion
25035
- //#region src/synthesizer/audio_engine/effects/xg/implementation/dsp/auto_wah/auto_wah_tables.ts
24860
+ // src/synthesizer/audio_engine/effects/xg/implementation/dsp/auto_wah/auto_wah_tables.ts
25036
24861
  /**
25037
24862
  * Auto wah cutoff frequency offset words.
25038
24863
  */
@@ -25166,8 +24991,7 @@ const CUTOFF_OFFSET = new Uint16Array([
25166
24991
  515,
25167
24992
  513
25168
24993
  ]);
25169
- //#endregion
25170
- //#region src/synthesizer/audio_engine/effects/xg/implementation/dsp/auto_wah/auto_wah.ts
24994
+ // src/synthesizer/audio_engine/effects/xg/implementation/dsp/auto_wah/auto_wah.ts
25171
24995
  const PARAMETER_RANGES$10 = {
25172
24996
  3: [10, 120],
25173
24997
  5: [8, 40],
@@ -25455,8 +25279,7 @@ var XGAutoWah = class extends XGFilterVariationProgram {
25455
25279
  }
25456
25280
  }
25457
25281
  };
25458
- //#endregion
25459
- //#region src/synthesizer/audio_engine/effects/xg/implementation/dsp/xg_mono_variation_program.ts
25282
+ // src/synthesizer/audio_engine/effects/xg/implementation/dsp/xg_mono_variation_program.ts
25460
25283
  const LIST_LOW_A = [
25461
25284
  112,
25462
25285
  111,
@@ -25610,8 +25433,7 @@ var XGMonoVariationProgram = class extends XGVariationProgram {
25610
25433
  this.pushCoefficients([109, 110]);
25611
25434
  }
25612
25435
  };
25613
- //#endregion
25614
- //#region src/synthesizer/audio_engine/effects/xg/implementation/dsp/equalizer/three_band_eq.ts
25436
+ // src/synthesizer/audio_engine/effects/xg/implementation/dsp/equalizer/three_band_eq.ts
25615
25437
  const PARAMETER_RANGES$9 = {
25616
25438
  0: [52, 76],
25617
25439
  1: [28, 54],
@@ -25812,14 +25634,11 @@ var XGThreeBandEQ = class extends XGMonoVariationProgram {
25812
25634
  this.designFirstOrder("highShelf", p[6], p[4] - half, LIST_HIGH_B);
25813
25635
  break;
25814
25636
  }
25815
- case MONO_INPUT$2:
25816
- this.monoInputLevel();
25817
- break;
25637
+ case MONO_INPUT$2: this.monoInputLevel();
25818
25638
  }
25819
25639
  }
25820
25640
  };
25821
- //#endregion
25822
- //#region src/synthesizer/audio_engine/effects/xg/implementation/dsp/distortion/distortion_tables.ts
25641
+ // src/synthesizer/audio_engine/effects/xg/implementation/dsp/distortion/distortion_tables.ts
25823
25642
  /**
25824
25643
  * The distortion output level curve (1.0 at 127).
25825
25644
  */
@@ -25953,8 +25772,7 @@ const OUTPUT_LEVEL = new Float32Array([
25953
25772
  .98431396,
25954
25773
  1
25955
25774
  ]);
25956
- //#endregion
25957
- //#region src/synthesizer/audio_engine/effects/xg/implementation/dsp/distortion/xg_distortion.ts
25775
+ // src/synthesizer/audio_engine/effects/xg/implementation/dsp/distortion/xg_distortion.ts
25958
25776
  const LIST_LOW_PASS$1 = [
25959
25777
  163,
25960
25778
  162,
@@ -26008,7 +25826,8 @@ var XGDistortionBase = class extends XGMonoVariationProgram {
26008
25826
  const s3 = clip$1(s2 * gain3);
26009
25827
  const s4 = clip$1(s3 * gain4);
26010
25828
  const s5 = clip$1(s4 * gain5);
26011
- mono[i] = (clip$1(s5 * gain6) * mix6 + s5 * mix5 + s4 * mix4 + s3 * mix3 + s2 * mix2 + s1 * mix1) * level;
25829
+ const s6 = clip$1(s5 * gain6);
25830
+ mono[i] = (s6 * mix6 + s5 * mix5 + s4 * mix4 + s3 * mix3 + s2 * mix2 + s1 * mix1) * level;
26012
25831
  }
26013
25832
  this.filterOutput(mono, sampleCount);
26014
25833
  this.mixOutput(mono, outputLeft, outputRight, sampleCount, outputGain);
@@ -26072,8 +25891,7 @@ var XGDistortionBase = class extends XGMonoVariationProgram {
26072
25891
  ]);
26073
25892
  }
26074
25893
  };
26075
- //#endregion
26076
- //#region src/synthesizer/audio_engine/effects/xg/implementation/dsp/distortion/distortion.ts
25894
+ // src/synthesizer/audio_engine/effects/xg/implementation/dsp/distortion/distortion.ts
26077
25895
  const PARAMETER_RANGES$8 = {
26078
25896
  1: [8, 40],
26079
25897
  2: [52, 76],
@@ -26263,14 +26081,11 @@ var XGDistortion = class extends XGDistortionBase {
26263
26081
  case 9:
26264
26082
  this.dryWet();
26265
26083
  break;
26266
- case 10:
26267
- this.edge(p[10]);
26268
- break;
26084
+ case 10: this.edge(p[10]);
26269
26085
  }
26270
26086
  }
26271
26087
  };
26272
- //#endregion
26273
- //#region src/synthesizer/audio_engine/effects/xg/implementation/dsp/distortion/overdrive.ts
26088
+ // src/synthesizer/audio_engine/effects/xg/implementation/dsp/distortion/overdrive.ts
26274
26089
  /**
26275
26090
  * OVER DRIVE (`4A 00`): the distortion with softer defaults and a narrower input band.
26276
26091
  */
@@ -26407,8 +26222,7 @@ var XGOverdrive = class extends XGDistortion {
26407
26222
  highPassFrequency = 8;
26408
26223
  lowPassFrequency = 44;
26409
26224
  };
26410
- //#endregion
26411
- //#region src/synthesizer/audio_engine/effects/xg/implementation/dsp/distortion/amp_simulator.ts
26225
+ // src/synthesizer/audio_engine/effects/xg/implementation/dsp/distortion/amp_simulator.ts
26412
26226
  const PARAMETER_RANGES$7 = {
26413
26227
  1: [0, 3],
26414
26228
  2: [34, 60]
@@ -26676,14 +26490,11 @@ var XGAmpSimulator = class extends XGDistortionBase {
26676
26490
  case 9:
26677
26491
  this.dryWet();
26678
26492
  break;
26679
- case 10:
26680
- this.edge(p[10]);
26681
- break;
26493
+ case 10: this.edge(p[10]);
26682
26494
  }
26683
26495
  }
26684
26496
  };
26685
- //#endregion
26686
- //#region src/synthesizer/audio_engine/effects/xg/implementation/dsp/symphonic/symphonic.ts
26497
+ // src/synthesizer/audio_engine/effects/xg/implementation/dsp/symphonic/symphonic.ts
26687
26498
  const PARAMETER_RANGES$6 = {
26688
26499
  5: [8, 40],
26689
26500
  6: [52, 76],
@@ -26919,8 +26730,8 @@ var XGSymphonic = class extends XGStereoVariationProgram {
26919
26730
  const s = (memory[k + 1 & mask] - memory[k]) * fracC + memory[k];
26920
26731
  const l = inL[i];
26921
26732
  const r = inR[i];
26922
- memory[writeL + pointer & mask] = rightToL * r + l;
26923
26733
  memory[writeR + pointer & mask] = rightToR * r;
26734
+ memory[writeL + pointer & mask] = rightToL * r + l;
26924
26735
  outputLeft[i] = dryL * l + a * wetAL + s * wetCL;
26925
26736
  outputRight[i] = dryR * r + b * wetBR + s * wetCR;
26926
26737
  pointer = pointer - 1 & mask;
@@ -27004,8 +26815,7 @@ var XGSymphonic = class extends XGStereoVariationProgram {
27004
26815
  }
27005
26816
  }
27006
26817
  };
27007
- //#endregion
27008
- //#region src/synthesizer/audio_engine/effects/xg/implementation/dsp/rotary/rotary_speaker.ts
26818
+ // src/synthesizer/audio_engine/effects/xg/implementation/dsp/rotary/rotary_speaker.ts
27009
26819
  const PARAMETER_RANGES$5 = {
27010
26820
  5: [8, 40],
27011
26821
  6: [52, 76],
@@ -27260,8 +27070,8 @@ var XGRotarySpeaker = class extends XGStereoVariationProgram {
27260
27070
  const d = (memory[k + 1 & mask] - memory[k]) * fracD + memory[k];
27261
27071
  const l = inL[i];
27262
27072
  const r = inR[i];
27263
- memory[writeL + pointer & mask] = rightToL * r + l;
27264
27073
  memory[writeR + pointer & mask] = rightToR * r;
27074
+ memory[writeL + pointer & mask] = rightToL * r + l;
27265
27075
  outputLeft[i] = dryL * l + a * wetAL + s * wetCL + d * wetDL;
27266
27076
  outputRight[i] = dryR * r + b * wetBR + s * wetCR + d * wetDR;
27267
27077
  pointer = pointer - 1 & mask;
@@ -27342,8 +27152,7 @@ var XGRotarySpeaker = class extends XGStereoVariationProgram {
27342
27152
  }
27343
27153
  }
27344
27154
  };
27345
- //#endregion
27346
- //#region src/synthesizer/audio_engine/effects/xg/implementation/dsp/early_reflections/early_reflection_tables.ts
27155
+ // src/synthesizer/audio_engine/effects/xg/implementation/dsp/early_reflections/early_reflection_tables.ts
27347
27156
  /**
27348
27157
  * Reflection patterns, 14 (delay in 10 us, gain) pairs each: ER types 0-5, gate types 6-7, reverse gate types 8-9.
27349
27158
  */
@@ -27953,8 +27762,7 @@ const REFLECTION_GAIN = new Uint16Array([
27953
27762
  255,
27954
27763
  255
27955
27764
  ]);
27956
- //#endregion
27957
- //#region src/synthesizer/audio_engine/effects/xg/implementation/dsp/early_reflections/xg_early_reflections.ts
27765
+ // src/synthesizer/audio_engine/effects/xg/implementation/dsp/early_reflections/xg_early_reflections.ts
27958
27766
  const LIST_REFLECTION_ADDRESS = [
27959
27767
  59,
27960
27768
  50,
@@ -28158,9 +27966,7 @@ var XGEarlyReflectionsBase = class extends XGMonoVariationProgram {
28158
27966
  case 12:
28159
27967
  this.designFirstOrder("lowPass", HIGH_DAMP_FREQUENCY[p[12]], 64, LIST_HIGH_DAMP);
28160
27968
  break;
28161
- case MONO_INPUT$1:
28162
- this.monoInputLevel();
28163
- break;
27969
+ case MONO_INPUT$1: this.monoInputLevel();
28164
27970
  }
28165
27971
  }
28166
27972
  /**
@@ -28217,8 +28023,7 @@ const GATE_RANGES = {
28217
28023
  ...ER_RANGES,
28218
28024
  0: [0, 1]
28219
28025
  };
28220
- //#endregion
28221
- //#region src/synthesizer/audio_engine/effects/xg/implementation/dsp/early_reflections/early_reflection1.ts
28026
+ // src/synthesizer/audio_engine/effects/xg/implementation/dsp/early_reflections/early_reflection1.ts
28222
28027
  /**
28223
28028
  * EARLY REF 1 (`09 00`): early reflections without the reverb tail.
28224
28029
  */
@@ -28356,8 +28161,7 @@ var XGEarlyReflection1 = class extends XGEarlyReflectionsBase {
28356
28161
  densityBlock = 0;
28357
28162
  ranges = ER_RANGES;
28358
28163
  };
28359
- //#endregion
28360
- //#region src/synthesizer/audio_engine/effects/xg/implementation/dsp/early_reflections/early_reflection2.ts
28164
+ // src/synthesizer/audio_engine/effects/xg/implementation/dsp/early_reflections/early_reflection2.ts
28361
28165
  /**
28362
28166
  * EARLY REF 2 (`09 01`): early reflections with other defaults.
28363
28167
  */
@@ -28495,8 +28299,7 @@ var XGEarlyReflection2 = class extends XGEarlyReflectionsBase {
28495
28299
  densityBlock = 1;
28496
28300
  ranges = ER_RANGES;
28497
28301
  };
28498
- //#endregion
28499
- //#region src/synthesizer/audio_engine/effects/xg/implementation/dsp/early_reflections/gate_reverb.ts
28302
+ // src/synthesizer/audio_engine/effects/xg/implementation/dsp/early_reflections/gate_reverb.ts
28500
28303
  /**
28501
28304
  * GATE REVERB (`0A 00`): a dense burst of reflections that stops abruptly.
28502
28305
  */
@@ -28634,8 +28437,7 @@ var XGGateReverb = class extends XGEarlyReflectionsBase {
28634
28437
  densityBlock = 2;
28635
28438
  ranges = GATE_RANGES;
28636
28439
  };
28637
- //#endregion
28638
- //#region src/synthesizer/audio_engine/effects/xg/implementation/dsp/early_reflections/reverse_gate.ts
28440
+ // src/synthesizer/audio_engine/effects/xg/implementation/dsp/early_reflections/reverse_gate.ts
28639
28441
  /**
28640
28442
  * REVERSE GATE (`0B 00`): the gate reverb with rising reflections.
28641
28443
  */
@@ -28773,8 +28575,7 @@ var XGReverseGate = class extends XGEarlyReflectionsBase {
28773
28575
  densityBlock = 3;
28774
28576
  ranges = GATE_RANGES;
28775
28577
  };
28776
- //#endregion
28777
- //#region src/synthesizer/audio_engine/effects/xg/implementation/dsp/delay/delay_tables.ts
28578
+ // src/synthesizer/audio_engine/effects/xg/implementation/dsp/delay/delay_tables.ts
28778
28579
  /**
28779
28580
  * Delay tap level scale (C level, delay 2 level).
28780
28581
  */
@@ -28908,8 +28709,7 @@ const DELAY_LEVEL = new Float32Array([
28908
28709
  .98431396484375,
28909
28710
  1
28910
28711
  ]);
28911
- //#endregion
28912
- //#region src/synthesizer/audio_engine/effects/xg/implementation/dsp/delay/xg_delay.ts
28712
+ // src/synthesizer/audio_engine/effects/xg/implementation/dsp/delay/xg_delay.ts
28913
28713
  /**
28914
28714
  * The right line input position used by the two-line delays (in the upper half of the memory).
28915
28715
  */
@@ -28955,8 +28755,8 @@ var XGDelayBase = class extends XGStereoVariationProgram {
28955
28755
  dampB = b;
28956
28756
  const l = inL[i];
28957
28757
  const r = inR[i];
28958
- memory[tWriteA + pointer & mask] = rightToA * r + dampedA * aToA + dampedB * bToA + l;
28959
28758
  memory[tWriteB + pointer & mask] = rightToB * r + dampedA * aToB + dampedB * bToB;
28759
+ memory[tWriteA + pointer & mask] = rightToA * r + dampedA * aToA + dampedB * bToA + l;
28960
28760
  outputLeft[i] = rightToL * r + a * aToL + tapC * cToL + tapD * dToL + leftToL * l;
28961
28761
  outputRight[i] = leftToR * l + b * bToR + tapC * cToR + tapD * dToR + rightToR * r;
28962
28762
  pointer = pointer - 1 & mask;
@@ -28991,8 +28791,7 @@ var XGDelayBase = class extends XGStereoVariationProgram {
28991
28791
  this.pushCoefficients(list);
28992
28792
  }
28993
28793
  };
28994
- //#endregion
28995
- //#region src/synthesizer/audio_engine/effects/xg/implementation/dsp/delay/delay_lcr.ts
28794
+ // src/synthesizer/audio_engine/effects/xg/implementation/dsp/delay/delay_lcr.ts
28996
28795
  const PARAMETER_RANGES$4 = {
28997
28796
  0: [1, 7150],
28998
28797
  1: [1, 7150],
@@ -29197,14 +28996,11 @@ var XGDelayLCR = class extends XGDelayBase {
29197
28996
  this.designLowEqualizer(p[12], p[13]);
29198
28997
  break;
29199
28998
  case 14:
29200
- case 15:
29201
- this.designHighEqualizer(p[14], p[15]);
29202
- break;
28999
+ case 15: this.designHighEqualizer(p[14], p[15]);
29203
29000
  }
29204
29001
  }
29205
29002
  };
29206
- //#endregion
29207
- //#region src/synthesizer/audio_engine/effects/xg/implementation/dsp/delay/delay_lr.ts
29003
+ // src/synthesizer/audio_engine/effects/xg/implementation/dsp/delay/delay_lr.ts
29208
29004
  const PARAMETER_RANGES$3 = {
29209
29005
  0: [1, 7150],
29210
29006
  1: [1, 7150],
@@ -29406,14 +29202,11 @@ var XGDelayLR = class extends XGDelayBase {
29406
29202
  this.designLowEqualizer(p[12], p[13]);
29407
29203
  break;
29408
29204
  case 14:
29409
- case 15:
29410
- this.designHighEqualizer(p[14], p[15]);
29411
- break;
29205
+ case 15: this.designHighEqualizer(p[14], p[15]);
29412
29206
  }
29413
29207
  }
29414
29208
  };
29415
- //#endregion
29416
- //#region src/synthesizer/audio_engine/effects/xg/implementation/dsp/delay/echo.ts
29209
+ // src/synthesizer/audio_engine/effects/xg/implementation/dsp/delay/echo.ts
29417
29210
  const PARAMETER_RANGES$2 = {
29418
29211
  0: [1, 3550],
29419
29212
  1: [1, 127],
@@ -29624,14 +29417,11 @@ var XGEcho = class extends XGDelayBase {
29624
29417
  this.designLowEqualizer(p[12], p[13]);
29625
29418
  break;
29626
29419
  case 14:
29627
- case 15:
29628
- this.designHighEqualizer(p[14], p[15]);
29629
- break;
29420
+ case 15: this.designHighEqualizer(p[14], p[15]);
29630
29421
  }
29631
29422
  }
29632
29423
  };
29633
- //#endregion
29634
- //#region src/synthesizer/audio_engine/effects/xg/implementation/dsp/delay/cross_delay.ts
29424
+ // src/synthesizer/audio_engine/effects/xg/implementation/dsp/delay/cross_delay.ts
29635
29425
  const PARAMETER_RANGES$1 = {
29636
29426
  0: [1, 3550],
29637
29427
  1: [1, 3550],
@@ -29847,14 +29637,11 @@ var XGCrossDelay = class extends XGDelayBase {
29847
29637
  this.designLowEqualizer(p[12], p[13]);
29848
29638
  break;
29849
29639
  case 14:
29850
- case 15:
29851
- this.designHighEqualizer(p[14], p[15]);
29852
- break;
29640
+ case 15: this.designHighEqualizer(p[14], p[15]);
29853
29641
  }
29854
29642
  }
29855
29643
  };
29856
- //#endregion
29857
- //#region src/synthesizer/audio_engine/effects/xg/implementation/dsp/karaoke/karaoke_tables.ts
29644
+ // src/synthesizer/audio_engine/effects/xg/implementation/dsp/karaoke/karaoke_tables.ts
29858
29645
  /**
29859
29646
  * Karaoke delay time (0.1 ms units).
29860
29647
  */
@@ -29988,8 +29775,7 @@ const KARAOKE_DELAY = new Uint16Array([
29988
29775
  3969,
29989
29776
  4e3
29990
29777
  ]);
29991
- //#endregion
29992
- //#region src/synthesizer/audio_engine/effects/xg/implementation/dsp/karaoke/xg_karaoke.ts
29778
+ // src/synthesizer/audio_engine/effects/xg/implementation/dsp/karaoke/xg_karaoke.ts
29993
29779
  const PARAMETER_RANGES = {
29994
29780
  1: [1, 127],
29995
29781
  2: [0, 52],
@@ -30172,12 +29958,10 @@ var XGKaraokeBase = class extends XGFilterVariationProgram {
30172
29958
  case MONO_INPUT:
30173
29959
  w[109] = w[110] = this.insertion ? 181 : 362;
30174
29960
  this.pushCoefficients([109, 110]);
30175
- break;
30176
29961
  }
30177
29962
  }
30178
29963
  };
30179
- //#endregion
30180
- //#region src/synthesizer/audio_engine/effects/xg/implementation/dsp/karaoke/karaoke1.ts
29964
+ // src/synthesizer/audio_engine/effects/xg/implementation/dsp/karaoke/karaoke1.ts
30181
29965
  /**
30182
29966
  * KARAOKE 1 (`14 00`): a filtered echo for vocals.
30183
29967
  */
@@ -30312,8 +30096,7 @@ var XGKaraoke1 = class extends XGKaraokeBase {
30312
30096
  ]
30313
30097
  };
30314
30098
  };
30315
- //#endregion
30316
- //#region src/synthesizer/audio_engine/effects/xg/implementation/dsp/karaoke/karaoke2.ts
30099
+ // src/synthesizer/audio_engine/effects/xg/implementation/dsp/karaoke/karaoke2.ts
30317
30100
  /**
30318
30101
  * KARAOKE 2 (`14 01`): a filtered echo for vocals.
30319
30102
  */
@@ -30448,8 +30231,7 @@ var XGKaraoke2 = class extends XGKaraokeBase {
30448
30231
  ]
30449
30232
  };
30450
30233
  };
30451
- //#endregion
30452
- //#region src/synthesizer/audio_engine/effects/xg/implementation/dsp/karaoke/karaoke3.ts
30234
+ // src/synthesizer/audio_engine/effects/xg/implementation/dsp/karaoke/karaoke3.ts
30453
30235
  /**
30454
30236
  * KARAOKE 3 (`14 02`): a filtered echo for vocals.
30455
30237
  */
@@ -30584,9 +30366,8 @@ var XGKaraoke3 = class extends XGKaraokeBase {
30584
30366
  ]
30585
30367
  };
30586
30368
  };
30587
- //#endregion
30588
- //#region src/synthesizer/audio_engine/effects/xg/implementation/variation.ts
30589
- const VARIATION_MAP = new Map([
30369
+ // src/synthesizer/audio_engine/effects/xg/implementation/variation.ts
30370
+ const VARIATION_MAP = /* @__PURE__ */ new Map([
30590
30371
  [0, XGNoEffect],
30591
30372
  [256, XGHall1],
30592
30373
  [257, XGHall2],
@@ -30702,9 +30483,8 @@ var DefaultXGVariation = class extends DefaultXGSystemEffect {
30702
30483
  this.sendToChorus = snapshot.sendToChorus;
30703
30484
  }
30704
30485
  };
30705
- //#endregion
30706
- //#region src/synthesizer/audio_engine/effects/xg/implementation/insertion.ts
30707
- const INSERTION_MAP = new Map([
30486
+ // src/synthesizer/audio_engine/effects/xg/implementation/insertion.ts
30487
+ const INSERTION_MAP = /* @__PURE__ */ new Map([
30708
30488
  [0, XGThru],
30709
30489
  [256, XGHall1],
30710
30490
  [257, XGHall2],
@@ -30784,8 +30564,7 @@ var DefaultXGInsertion = class extends DefaultXGEffect {
30784
30564
  this.partNumber = snapshot.partNumber;
30785
30565
  }
30786
30566
  };
30787
- //#endregion
30788
- //#region src/synthesizer/enums.ts
30567
+ // src/synthesizer/enums.ts
30789
30568
  /**
30790
30569
  * The available interpolation types of the synthesizer.
30791
30570
  * Interpolation defines how sample points between the sample data are calculated.
@@ -30809,8 +30588,7 @@ const InterpolationTypes = {
30809
30588
  */
30810
30589
  hermite: 2
30811
30590
  };
30812
- //#endregion
30813
- //#region src/synthesizer/audio_engine/effects/implementation/dattorro.ts
30591
+ // src/synthesizer/audio_engine/effects/implementation/dattorro.ts
30814
30592
  /**
30815
30593
  * Dattorro Reverb Node
30816
30594
  * by khoin on GitHub, public domain.
@@ -30841,9 +30619,9 @@ var DattorroReverb = class {
30841
30619
  pDelay;
30842
30620
  pDMask;
30843
30621
  delayBuffers = new Array(12);
30844
- delayWrite = new Int32Array(12);
30845
- delayRead = new Int32Array(12);
30846
- delayMask = new Int32Array(12);
30622
+ delayWrite = /* @__PURE__ */ new Int32Array(12);
30623
+ delayRead = /* @__PURE__ */ new Int32Array(12);
30624
+ delayMask = /* @__PURE__ */ new Int32Array(12);
30847
30625
  constructor(sampleRate) {
30848
30626
  this.sampleRate = sampleRate;
30849
30627
  this.pDMask = 2 ** Math.ceil(Math.log2(sampleRate)) - 1;
@@ -31076,8 +30854,7 @@ var DattorroReverb = class {
31076
30854
  this.delayMask[index] = nextPow2 - 1;
31077
30855
  }
31078
30856
  };
31079
- //#endregion
31080
- //#region src/synthesizer/audio_engine/effects/implementation/delay_line.ts
30857
+ // src/synthesizer/audio_engine/effects/implementation/delay_line.ts
31081
30858
  var DelayLine = class {
31082
30859
  feedback = 0;
31083
30860
  gain = 1;
@@ -31126,8 +30903,7 @@ var DelayLine = class {
31126
30903
  this.writeIndex = writeIndex;
31127
30904
  }
31128
30905
  };
31129
- //#endregion
31130
- //#region src/synthesizer/audio_engine/effects/gs/implementation/reverb.ts
30906
+ // src/synthesizer/audio_engine/effects/gs/implementation/reverb.ts
31131
30907
  const DELAY_GAIN$1 = 1.5;
31132
30908
  /**
31133
30909
  * The default GS Reverb implementation for {@link SpessaSynthProcessor}.
@@ -31298,7 +31074,6 @@ var DefaultGSReverb = class {
31298
31074
  this.characterGainCoefficient = .75;
31299
31075
  this.dattorro.damping = .65;
31300
31076
  this.characterTimeCoefficient = .5;
31301
- break;
31302
31077
  }
31303
31078
  this.updateTime();
31304
31079
  this.updateGain();
@@ -31440,8 +31215,7 @@ var DefaultGSReverb = class {
31440
31215
  else this.delayLeft.time = timeSamples;
31441
31216
  }
31442
31217
  };
31443
- //#endregion
31444
- //#region src/synthesizer/audio_engine/effects/gs/implementation/chorus.ts
31218
+ // src/synthesizer/audio_engine/effects/gs/implementation/chorus.ts
31445
31219
  const CHORUS_GAIN = 1.3;
31446
31220
  /**
31447
31221
  * The default GS Chorus implementation for {@link SpessaSynthProcessor}.
@@ -31622,8 +31396,7 @@ var DefaultGSChorus = class {
31622
31396
  };
31623
31397
  }
31624
31398
  };
31625
- //#endregion
31626
- //#region src/synthesizer/audio_engine/effects/gs/implementation/delay.ts
31399
+ // src/synthesizer/audio_engine/effects/gs/implementation/delay.ts
31627
31400
  const delayTimeSegments = [
31628
31401
  {
31629
31402
  start: 1,
@@ -31910,8 +31683,7 @@ var DefaultGSDelay = class {
31910
31683
  this.gainRight = this._levelRight / 127;
31911
31684
  }
31912
31685
  };
31913
- //#endregion
31914
- //#region src/synthesizer/audio_engine/user_drum_set.ts
31686
+ // src/synthesizer/audio_engine/user_drum_set.ts
31915
31687
  const FALLBACK_PATCH = {
31916
31688
  bankMSB: 0,
31917
31689
  bankLSB: 0,
@@ -31994,8 +31766,7 @@ var UserDrumSet = class UserDrumSet {
31994
31766
  return params;
31995
31767
  }
31996
31768
  };
31997
- //#endregion
31998
- //#region src/synthesizer/audio_engine/sound_bank_manager.ts
31769
+ // src/synthesizer/audio_engine/sound_bank_manager.ts
31999
31770
  /**
32000
31771
  * A modified version of basic preset that seamlessly integrates bank offset.
32001
31772
  */
@@ -32175,11 +31946,10 @@ var SoundBankManager = class {
32175
31946
  this.presetListChangeCallback();
32176
31947
  }
32177
31948
  };
32178
- //#endregion
32179
- //#region src/synthesizer/audio_engine/voice/unit_converter.ts
31949
+ // src/synthesizer/audio_engine/voice/unit_converter.ts
32180
31950
  const MIN_TIMECENT = -15e3;
32181
31951
  const MAX_TIMECENT = 15e3;
32182
- const timecentLookupTable = new Float32Array(MAX_TIMECENT - MIN_TIMECENT + 1);
31952
+ const timecentLookupTable = /* @__PURE__ */ new Float32Array(30001);
32183
31953
  for (let i = 0; i < timecentLookupTable.length; i++) {
32184
31954
  const timecents = MIN_TIMECENT + i;
32185
31955
  timecentLookupTable[i] = Math.pow(2, timecents / 1200);
@@ -32196,7 +31966,7 @@ function timecentsToSeconds(timecents) {
32196
31966
  }
32197
31967
  const MIN_ABS_CENT = -2e4;
32198
31968
  const MAX_ABS_CENT = 16500;
32199
- const absoluteCentLookupTable = new Float32Array(MAX_ABS_CENT - MIN_ABS_CENT + 1);
31969
+ const absoluteCentLookupTable = /* @__PURE__ */ new Float32Array(36501);
32200
31970
  for (let i = 0; i < absoluteCentLookupTable.length; i++) {
32201
31971
  const absoluteCents = MIN_ABS_CENT + i;
32202
31972
  absoluteCentLookupTable[i] = 440 * Math.pow(2, (absoluteCents - 6900) / 1200);
@@ -32212,7 +31982,7 @@ function absCentsToHz(cents) {
32212
31982
  }
32213
31983
  const MIN_CENTIBELS = -16600;
32214
31984
  const MAX_CENTIBELS = 16e3;
32215
- const CENTIBEL_LOOKUP_TABLE = new Float32Array(MAX_CENTIBELS - MIN_CENTIBELS + 1);
31985
+ const CENTIBEL_LOOKUP_TABLE = /* @__PURE__ */ new Float32Array(32601);
32216
31986
  for (let i = 0; i < CENTIBEL_LOOKUP_TABLE.length; i++) {
32217
31987
  const centibels = MIN_CENTIBELS + i;
32218
31988
  CENTIBEL_LOOKUP_TABLE[i] = Math.pow(10, -centibels / 200);
@@ -32226,8 +31996,7 @@ function cbAttenuationToGain(centibels) {
32226
31996
  if (centibels >= -16600 && centibels <= MAX_CENTIBELS) return CENTIBEL_LOOKUP_TABLE[centibels - MIN_CENTIBELS | 0];
32227
31997
  return centibels < -16600 ? CENTIBEL_LOOKUP_TABLE[0] : 0;
32228
31998
  }
32229
- //#endregion
32230
- //#region src/synthesizer/audio_engine/channel/render_voice.ts
31999
+ // src/synthesizer/audio_engine/channel/render_voice.ts
32231
32000
  const TWO_PI = Math.PI * 2;
32232
32001
  const HALF_PI$1 = Math.PI / 2;
32233
32002
  /**
@@ -32237,9 +32006,9 @@ const HALF_PI$1 = Math.PI / 2;
32237
32006
  const MAX_VOICE_SEND_BUFFERS = 16;
32238
32007
  const MIN_PAN$1 = -500;
32239
32008
  const MAX_PAN$1 = 500;
32240
- const PAN_RESOLUTION$1 = MAX_PAN$1 - MIN_PAN$1;
32241
- const panTableLeft = new Float32Array(PAN_RESOLUTION$1 + 1);
32242
- const panTableRight = new Float32Array(PAN_RESOLUTION$1 + 1);
32009
+ const PAN_RESOLUTION$1 = 1e3;
32010
+ const panTableLeft = /* @__PURE__ */ new Float32Array(1001);
32011
+ const panTableRight = /* @__PURE__ */ new Float32Array(1001);
32243
32012
  for (let pan = MIN_PAN$1; pan <= MAX_PAN$1; pan++) {
32244
32013
  const realPan = (pan - MIN_PAN$1) / PAN_RESOLUTION$1;
32245
32014
  const tableIndex = pan - MIN_PAN$1;
@@ -32543,8 +32312,7 @@ function sendToStereo(input, outputLeft, outputRight, gainLeft, gainRight, sampl
32543
32312
  outputRight[i] += s * gainRight;
32544
32313
  }
32545
32314
  }
32546
- //#endregion
32547
- //#region src/synthesizer/audio_engine/channel/controller_change.ts
32315
+ // src/synthesizer/audio_engine/channel/controller_change.ts
32548
32316
  /**
32549
32317
  * Handles MIDI controller changes for a channel.
32550
32318
  * @param controller The MIDI controller number (0-127).
@@ -32649,9 +32417,7 @@ function controllerChange(controller, value, sendEvent = true) {
32649
32417
  this.lastPortamentoNote = value;
32650
32418
  this.portamentoForce = true;
32651
32419
  break;
32652
- default:
32653
- this.computeModulatorsAll(1, controller);
32654
- break;
32420
+ default: this.computeModulatorsAll(1, controller);
32655
32421
  }
32656
32422
  if (!sendEvent) return;
32657
32423
  this.synthCore.callEvent("controllerChange", {
@@ -32660,8 +32426,7 @@ function controllerChange(controller, value, sendEvent = true) {
32660
32426
  value
32661
32427
  });
32662
32428
  }
32663
- //#endregion
32664
- //#region src/synthesizer/audio_engine/channel/awe32_nrpn.ts
32429
+ // src/synthesizer/audio_engine/channel/awe32_nrpn.ts
32665
32430
  /**
32666
32431
  * SoundBlaster AWE32 NRPN generator mappings.
32667
32432
  * http://archive.gamedev.net/archive/reference/articles/article445.html
@@ -32790,13 +32555,10 @@ function handleAWE32NRPN(paramLSB, dataValue) {
32790
32555
  this.setGeneratorOverride(generator, cents);
32791
32556
  break;
32792
32557
  case GeneratorTypes.chorusEffectsSend:
32793
- case GeneratorTypes.reverbEffectsSend:
32794
- this.setGeneratorOverride(generator, clip(dataValue, 0, 255) * (1e3 / 255));
32795
- break;
32558
+ case GeneratorTypes.reverbEffectsSend: this.setGeneratorOverride(generator, clip(dataValue, 0, 255) * (1e3 / 255));
32796
32559
  }
32797
32560
  }
32798
- //#endregion
32799
- //#region src/synthesizer/audio_engine/channel/data_entry.ts
32561
+ // src/synthesizer/audio_engine/channel/data_entry.ts
32800
32562
  /**
32801
32563
  * Executes a data entry change for the current channel.
32802
32564
  */
@@ -32832,7 +32594,7 @@ function dataEntry() {
32832
32594
  SpessaLog.coolInfo(`Modulation depth for ${this.channel}`, Math.round(cents), "cents");
32833
32595
  break;
32834
32596
  }
32835
- case RegisteredParameterTypes.resetParameters: break;
32597
+ case RegisteredParameterTypes.resetParameters:
32836
32598
  }
32837
32599
  return;
32838
32600
  }
@@ -32899,7 +32661,6 @@ function dataEntry() {
32899
32661
  if (parameterLock) return;
32900
32662
  this.controllerChange(MIDIControllers.releaseTime, dataCoarse);
32901
32663
  SpessaLog.coolInfo(`EG release time for ${this.channel}`, dataCoarse.toString(), "");
32902
- break;
32903
32664
  }
32904
32665
  break;
32905
32666
  }
@@ -32952,124 +32713,145 @@ function dataEntry() {
32952
32713
  }
32953
32714
  }
32954
32715
  }
32955
- //#endregion
32956
- //#region src/synthesizer/audio_engine/channel/portamento_time.ts
32957
- const PORTA_DIVISION_CONSTANT = 40;
32958
- const SEGMENT_START = [
32959
- 1,
32960
- 2,
32961
- 4,
32962
- 8,
32963
- 16,
32964
- 32,
32965
- 64,
32966
- 80,
32967
- 96,
32716
+ // src/synthesizer/audio_engine/channel/portamento_time.ts
32717
+ /**
32718
+ * The Sound Canvas portamento rate table, indexed by CC 5.
32719
+ * The rate is in 1/16 semitones per second.
32720
+ * Measured on the SC-88Pro from CC 5 = 16 up. Below that, the glides are too short to measure precisely,
32721
+ * so the values are the SC-VA steps scaled to the hardware (0.8 times, which holds from CC 5 = 5 to 100).
32722
+ *
32723
+ * Thanks to the Tabula Sonora project for SC-VA research.
32724
+ */
32725
+ const PORTAMENTO_RATES = new Uint16Array([
32726
+ 0,
32727
+ 44640,
32728
+ 19840,
32729
+ 12753,
32730
+ 9920,
32731
+ 7761,
32732
+ 6376,
32733
+ 5578,
32734
+ 4823,
32735
+ 4250,
32736
+ 3880,
32737
+ 3498,
32738
+ 3187,
32739
+ 2976,
32740
+ 2746,
32741
+ 2548,
32742
+ 2383,
32743
+ 2263,
32744
+ 2127,
32745
+ 2008,
32746
+ 1922,
32747
+ 1824,
32748
+ 1734,
32749
+ 1670,
32750
+ 1596,
32751
+ 1528,
32752
+ 1476,
32753
+ 1418,
32754
+ 1364,
32755
+ 1323,
32756
+ 1276,
32757
+ 1232,
32758
+ 1191,
32759
+ 1123,
32760
+ 1063,
32761
+ 1003,
32762
+ 955,
32763
+ 911,
32764
+ 867,
32765
+ 831,
32766
+ 793,
32767
+ 763,
32768
+ 735,
32769
+ 705,
32770
+ 681,
32771
+ 659,
32772
+ 635,
32773
+ 615,
32774
+ 595,
32775
+ 561,
32776
+ 529,
32777
+ 501,
32778
+ 477,
32779
+ 455,
32780
+ 433,
32781
+ 414,
32782
+ 396,
32783
+ 380,
32784
+ 366,
32785
+ 352,
32786
+ 340,
32787
+ 328,
32788
+ 316,
32789
+ 306,
32790
+ 296,
32791
+ 280,
32792
+ 264,
32793
+ 250,
32794
+ 238,
32795
+ 226,
32796
+ 216,
32797
+ 206,
32798
+ 198,
32799
+ 190,
32800
+ 182,
32801
+ 176,
32802
+ 170,
32803
+ 164,
32804
+ 158,
32805
+ 152,
32806
+ 148,
32807
+ 140,
32808
+ 132,
32809
+ 124,
32810
+ 118,
32968
32811
  112,
32969
- 120,
32970
- 124
32971
- ];
32972
- const SEGMENT_INVERSE_LENGTH = [
32973
- 1,
32974
- .5,
32975
- .25,
32976
- .125,
32977
- .0625,
32978
- .03125,
32979
- .0625,
32980
- .0625,
32981
- .0625,
32982
- .125,
32983
- .25,
32984
- 1 / 3
32985
- ];
32986
- const COEFF_A = [
32987
- -.16653127382501215,
32988
- .11863875218299408,
32989
- .029479047361245264,
32990
- -.005442312089231738,
32991
- .1451520875973037,
32992
- -.005056281449558275,
32993
- -.005095486882876532,
32994
- .03334009551111544,
32995
- -.09361368678020432,
32996
- .14132569702451822,
32997
- -.15805565301011382,
32998
- -.09918856955881927
32999
- ];
33000
- const COEFF_B = [
33001
- .028212773333433472,
33002
- -.3388502064992847,
33003
- -.15839529890929713,
33004
- -.12398131766775483,
33005
- -.2874848552685111,
33006
- .012254866302537692,
33007
- .005957797193345771,
33008
- -.03745899330347374,
33009
- .12911781869810196,
33010
- -.15867193224162568,
33011
- .504406322732748,
33012
- .3786845131875458
33013
- ];
33014
- const COEFF_C = [
33015
- .7218950861255283,
33016
- .5574536226347168,
33017
- .47133893237025826,
33018
- .48597095327079914,
33019
- .44336276333518854,
33020
- .6076986311801551,
33021
- .30851975971827794,
33022
- .30514889345633955,
33023
- .3302511933827384,
33024
- .153822885219165,
33025
- .1302280559047337,
33026
- .49865530675491687
33027
- ];
33028
- const COEFF_D = [
33029
- -2.2218487496163566,
33030
- -1.6382721639824072,
33031
- -1.3010299956639813,
33032
- -.958607314841775,
33033
- -.6020599913279624,
33034
- -.3010299956639812,
33035
- .31386722036915343,
33036
- .6232492903979004,
33037
- .9242792860618817,
33038
- 1.290034611362518,
33039
- 1.4265112613645752,
33040
- 1.9030899869919435
33041
- ];
33042
- const SEGMENT_THRESHOLDS = [
33043
- 2,
33044
- 4,
33045
- 8,
33046
- 16,
32812
+ 108,
32813
+ 102,
32814
+ 98,
32815
+ 94,
32816
+ 90,
32817
+ 88,
32818
+ 84,
32819
+ 82,
32820
+ 78,
32821
+ 76,
32822
+ 74,
32823
+ 70,
32824
+ 66,
32825
+ 62,
32826
+ 58,
32827
+ 56,
32828
+ 54,
32829
+ 50,
32830
+ 48,
32831
+ 46,
32832
+ 44,
32833
+ 42,
32834
+ 40,
32835
+ 38,
32836
+ 36,
32837
+ 34,
33047
32838
  32,
33048
- 64,
33049
- 80,
33050
- 96,
33051
- 112,
33052
- 120,
33053
- 124
33054
- ];
33055
- /**
33056
- * @param cc the CC#5 value (should not be decimal)
33057
- * (PCHIP cubic spline - smooth & exact), optimized with fewer operations than full binary search and interpolation.
33058
- * Created by Benjamin Rosseaux.
33059
- */
33060
- function portaTimeToRate(cc) {
33061
- if (cc < 1) return 0;
33062
- else {
33063
- let s = -1;
33064
- for (let i = SEGMENT_THRESHOLDS.length - 1; i >= 0; i--) if (SEGMENT_THRESHOLDS[i] < cc) {
33065
- s = i;
33066
- break;
33067
- }
33068
- s += 1;
33069
- const t = (cc - SEGMENT_START[s]) * SEGMENT_INVERSE_LENGTH[s];
33070
- return Math.exp(2.302585092994046 * (((COEFF_A[s] * t + COEFF_B[s]) * t + COEFF_C[s]) * t + COEFF_D[s])) / PORTA_DIVISION_CONSTANT;
33071
- }
33072
- }
32839
+ 30,
32840
+ 28,
32841
+ 26,
32842
+ 24,
32843
+ 22,
32844
+ 20,
32845
+ 18,
32846
+ 16,
32847
+ 14,
32848
+ 12,
32849
+ 10,
32850
+ 8,
32851
+ 6,
32852
+ 4,
32853
+ 2
32854
+ ]);
33073
32855
  /**
33074
32856
  * Converts portamento time to seconds.
33075
32857
  * @param time MIDI portamento time (CC 5 value) (0-127)
@@ -33077,10 +32859,10 @@ function portaTimeToRate(cc) {
33077
32859
  * @returns The portamento time in seconds.
33078
32860
  */
33079
32861
  function portamentoTimeToSeconds(time, distance) {
33080
- return portaTimeToRate(time) * distance;
32862
+ if (time < 1) return 0;
32863
+ return distance * 16 / PORTAMENTO_RATES[time];
33081
32864
  }
33082
- //#endregion
33083
- //#region src/synthesizer/audio_engine/channel/note_on.ts
32865
+ // src/synthesizer/audio_engine/channel/note_on.ts
33084
32866
  const clamp = (num, min, max) => Math.max(min, Math.min(max, num));
33085
32867
  /**
33086
32868
  * Sends a "MIDI Note on" message and starts a note.
@@ -33135,10 +32917,12 @@ function noteOn(midiNote, velocity, emit = true) {
33135
32917
  if (this._drumChannel) {
33136
32918
  const p = this.drumParams[midiNote];
33137
32919
  const drumPan = p.pan - 64;
33138
- if (drumPan !== 0) if (drumPan === -64) panOverride = Math.round(randomGenerator() * 1e3 - 500);
33139
- else {
33140
- const channelPan = (this._midiControllers[MIDIControllers.pan] >> 7) - 64;
33141
- panOverride = Math.max(-63, Math.min(drumPan + channelPan, 63)) / 63 * 500 || 1;
32920
+ if (drumPan !== 0) {
32921
+ if (drumPan === -64) panOverride = Math.round(randomGenerator() * 1e3 - 500);
32922
+ else {
32923
+ const channelPan = (this._midiControllers[MIDIControllers.pan] >> 7) - 64;
32924
+ panOverride = Math.max(-63, Math.min(drumPan + channelPan, 63)) / 63 * 500 || 1;
32925
+ }
33142
32926
  }
33143
32927
  pitchOffset = p.pitchFine + p.pitchCoarse * 100;
33144
32928
  exclusiveOverride = p.assignGroup;
@@ -33232,8 +33016,7 @@ function noteOn(midiNote, velocity, emit = true) {
33232
33016
  velocity
33233
33017
  });
33234
33018
  }
33235
- //#endregion
33236
- //#region src/synthesizer/audio_engine/channel/note_off.ts
33019
+ // src/synthesizer/audio_engine/channel/note_off.ts
33237
33020
  /**
33238
33021
  * Releases a note by its MIDI note number.
33239
33022
  * If the note is in high performance mode and the channel is not a drum channel,
@@ -33274,8 +33057,7 @@ function noteOff(midiNote) {
33274
33057
  else if (this.lastMonoNote === midiNote) this.noteOn(highest, this.lastMonoVelocity, false);
33275
33058
  }
33276
33059
  }
33277
- //#endregion
33278
- //#region src/synthesizer/audio_engine/channel/program_change.ts
33060
+ // src/synthesizer/audio_engine/channel/program_change.ts
33279
33061
  /**
33280
33062
  * Changes the program (preset) of the channel.
33281
33063
  * @param program The program number (0-127) to change to.
@@ -33311,8 +33093,7 @@ function programChange(program) {
33311
33093
  isDrum: this.preset.isDrum
33312
33094
  });
33313
33095
  }
33314
- //#endregion
33315
- //#region src/synthesizer/audio_engine/voice/voice_modulator.ts
33096
+ // src/synthesizer/audio_engine/voice/voice_modulator.ts
33316
33097
  var VoiceModulator = class VoiceModulator extends Modulator {
33317
33098
  /**
33318
33099
  * Indicates if the given modulator is chorus or reverb effects modulator.
@@ -33342,14 +33123,16 @@ var VoiceModulator = class VoiceModulator extends Modulator {
33342
33123
  static fromData(s1, s2, destination, amount, transformType) {
33343
33124
  const s1Enum = s1.toSourceEnum();
33344
33125
  const s2Enum = s2.toSourceEnum();
33345
- return new VoiceModulator(s1, s2, destination, amount, transformType, (s1Enum === 219 || s1Enum === 221) && s2Enum === 0 && (destination === GeneratorTypes.reverbEffectsSend || destination === GeneratorTypes.chorusEffectsSend), s1Enum === DEFAULT_RESONANT_MOD_SOURCE && s2Enum === 0 && destination === GeneratorTypes.initialFilterQ, (s1.isCC && s1.index === MIDIControllers.modulationWheel || s2.isCC && s2.index === MIDIControllers.modulationWheel) && (destination === GeneratorTypes.modLfoToPitch || destination === GeneratorTypes.vibLfoToPitch));
33126
+ const isEffectModulator = (s1Enum === 219 || s1Enum === 221) && s2Enum === 0 && (destination === GeneratorTypes.reverbEffectsSend || destination === GeneratorTypes.chorusEffectsSend);
33127
+ const isDefaultResonantModulator = s1Enum === DEFAULT_RESONANT_MOD_SOURCE && s2Enum === 0 && destination === GeneratorTypes.initialFilterQ;
33128
+ const isModWheelModulator = (s1.isCC && s1.index === MIDIControllers.modulationWheel || s2.isCC && s2.index === MIDIControllers.modulationWheel) && (destination === GeneratorTypes.modLfoToPitch || destination === GeneratorTypes.vibLfoToPitch);
33129
+ return new VoiceModulator(s1, s2, destination, amount, transformType, isEffectModulator, isDefaultResonantModulator, isModWheelModulator);
33346
33130
  }
33347
33131
  static fromModulator(mod) {
33348
33132
  return this.fromData(mod.primarySource, mod.secondarySource, mod.destination, mod.transformAmount, mod.transformType);
33349
33133
  }
33350
33134
  };
33351
- //#endregion
33352
- //#region src/synthesizer/audio_engine/channel/dynamic_modulator_system.ts
33135
+ // src/synthesizer/audio_engine/channel/dynamic_modulator_system.ts
33353
33136
  const INITIAL_MODULATORS = [VoiceModulator.fromModulator(new DecodedModulator(getModSourceEnum(ModulatorCurveTypes.linear, true, false, true, MIDIControllers.vibratoRate), 0, GeneratorTypes.vibLfoRate, 1e3, 0))];
33354
33137
  /**
33355
33138
  * A class for dynamic modulators
@@ -33412,7 +33195,6 @@ var DynamicModulatorManager = class {
33412
33195
  this.setModulator(source, isCC, GeneratorTypes.vibLfoToVolume, normalizedNotCentered * 200, bipolar, false, true);
33413
33196
  this.setModulator(source, isCC, GeneratorTypes.initialAttenuation, normalizedNotCentered * 200, bipolar, false, true);
33414
33197
  SpessaLog.xgInfo(`Channel ${this.channel} ${sourceName} LFO amplitude depth control`, normalizedNotCentered * 200, "dB");
33415
- break;
33416
33198
  }
33417
33199
  }
33418
33200
  setupReceiverGS(addr3, data, source, isCC, sourceName, bipolar = false) {
@@ -33466,7 +33248,6 @@ var DynamicModulatorManager = class {
33466
33248
  case 10:
33467
33249
  this.setModulator(source, isCC, GeneratorTypes.modLfoAmplitudeDepth, normalizedNotCentered * 1e3, bipolar);
33468
33250
  SpessaLog.gsInfo(`Channel ${this.channel} ${sourceName} LFO2 amplitude depth control`, normalizedNotCentered * 100, "%");
33469
- break;
33470
33251
  }
33471
33252
  }
33472
33253
  /**
@@ -33502,9 +33283,8 @@ var DynamicModulatorManager = class {
33502
33283
  this.modulatorList = this.modulatorList.filter((m) => m.id !== id);
33503
33284
  }
33504
33285
  };
33505
- //#endregion
33506
- //#region src/synthesizer/audio_engine/voice/compute_modulator.ts
33507
- const EFFECT_MODULATOR_TRANSFORM_MULTIPLIER = 1e3 / 200;
33286
+ // src/synthesizer/audio_engine/voice/compute_modulator.ts
33287
+ const EFFECT_MODULATOR_TRANSFORM_MULTIPLIER = 5;
33508
33288
  /**
33509
33289
  * Buffer for the generators with the NRPN offsets applied,
33510
33290
  * To avoid allocating on the audio thread.
@@ -33580,8 +33360,7 @@ function computeModulators(voice, sourceUsesCC = -1, sourceIndex = 0) {
33580
33360
  }
33581
33361
  }
33582
33362
  }
33583
- //#endregion
33584
- //#region src/synthesizer/audio_engine/channel/channel_snapshot.ts
33363
+ // src/synthesizer/audio_engine/channel/channel_snapshot.ts
33585
33364
  function getChannelSnapshot() {
33586
33365
  return {
33587
33366
  patch: this.preset ? {
@@ -33638,8 +33417,7 @@ function applySnapshot$1(snapshot) {
33638
33417
  for (const [parameter, value] of Object.entries(snapshot.systemParameters)) this.setSystemParameter(parameter, value);
33639
33418
  this.computeModulatorsAll(-1, 0);
33640
33419
  }
33641
- //#endregion
33642
- //#region src/synthesizer/audio_engine/channel/parameters/midi.ts
33420
+ // src/synthesizer/audio_engine/channel/parameters/midi.ts
33643
33421
  /**
33644
33422
  * The default values for {@link ChannelMIDIParameter}s.
33645
33423
  *
@@ -33683,9 +33461,7 @@ function setMIDIParameterInternal$1(parameter, value) {
33683
33461
  case "pitchWheel":
33684
33462
  this.computeModulatorsAll(0, ModulatorControllerSources.pitchWheel);
33685
33463
  break;
33686
- case "pressure":
33687
- this.computeModulatorsAll(0, ModulatorControllerSources.channelPressure);
33688
- break;
33464
+ case "pressure": this.computeModulatorsAll(0, ModulatorControllerSources.channelPressure);
33689
33465
  }
33690
33466
  this.updateInternalParams();
33691
33467
  this.synthCore.callEvent("channelParamChange", {
@@ -33703,8 +33479,7 @@ function setMIDIParameterInternal$1(parameter, value) {
33703
33479
  function lockMIDIParameterInternal$1(parameter, isLocked) {
33704
33480
  this.lockedMIDIParameters[parameter] = isLocked;
33705
33481
  }
33706
- //#endregion
33707
- //#region src/synthesizer/audio_engine/channel/parameters/system.ts
33482
+ // src/synthesizer/audio_engine/channel/parameters/system.ts
33708
33483
  /**
33709
33484
  * Default values for {@link ChannelSystemParameter}s.
33710
33485
  *
@@ -33742,8 +33517,7 @@ function setSystemParameterInternal$1(parameter, value) {
33742
33517
  case "keyShift": if (!this._drumChannel && prev !== value) this.stopAllNotes(true);
33743
33518
  }
33744
33519
  }
33745
- //#endregion
33746
- //#region src/synthesizer/audio_engine/channel/midi_channel.ts
33520
+ // src/synthesizer/audio_engine/channel/midi_channel.ts
33747
33521
  /**
33748
33522
  * This class represents a single MIDI channel within a {@link SpessaSynthProcessor}.
33749
33523
  *
@@ -33756,13 +33530,13 @@ var MIDIChannel = class {
33756
33530
  * An array for the MIDI 2.0 Per-note pitch wheels.
33757
33531
  * @internal
33758
33532
  */
33759
- pitchWheels = new Int16Array(128).fill(8192);
33533
+ pitchWheels = (/* @__PURE__ */ new Int16Array(128)).fill(8192);
33760
33534
  /**
33761
33535
  * An array of poly pressure values for the channel.
33762
33536
  * Poly pressure persists across notes, much like per-note pitch wheels.
33763
33537
  * @internal
33764
33538
  */
33765
- polyPressures = new Uint8Array(128);
33539
+ polyPressures = /* @__PURE__ */ new Uint8Array(128);
33766
33540
  /**
33767
33541
  * Parameters for each drum instrument.
33768
33542
  * @internal
@@ -33886,14 +33660,14 @@ var MIDIChannel = class {
33886
33660
  * Data entries do store it!
33887
33661
  * @internal
33888
33662
  */
33889
- _midiControllers = new Int16Array(128);
33663
+ _midiControllers = /* @__PURE__ */ new Int16Array(128);
33890
33664
  /**
33891
33665
  * An array of octave tuning values for each note on the channel.
33892
33666
  * Each index corresponds to a note (0 = C, 1 = C#, ..., 11 = B).
33893
33667
  * Note: Repeated every 12 notes.
33894
33668
  * @internal
33895
33669
  */
33896
- octaveTuning = new Int8Array(128);
33670
+ octaveTuning = /* @__PURE__ */ new Int8Array(128);
33897
33671
  /**
33898
33672
  * https://amei.or.jp/midistandardcommittee/Recommended_Practice/e/rp15.pdf
33899
33673
  * Reset controllers according to RP-15 Recommended Practice.
@@ -34327,9 +34101,11 @@ var MIDIChannel = class {
34327
34101
  const channelSystem = this._systemParameters;
34328
34102
  const globalMIDI = this.synthCore.midiParameters;
34329
34103
  const channelMIDI = this._midiParameters;
34330
- const currentKeyShift = this._drumChannel ? channelSystem.keyShift : globalSystem.keyShift + globalMIDI.keyShift + channelSystem.keyShift + channelMIDI.keyShift;
34104
+ const midiKeyShift = globalMIDI.keyShift + channelMIDI.keyShift;
34105
+ const pitchBased = globalSystem.pitchBasedKeyShift;
34106
+ const currentKeyShift = this._drumChannel ? channelSystem.keyShift : globalSystem.keyShift + (pitchBased ? 0 : midiKeyShift) + channelSystem.keyShift;
34331
34107
  this.currentKeyShift = Math.trunc(currentKeyShift);
34332
- this.currentTuning = this._drumChannel ? channelSystem.fineTune : globalSystem.fineTune + globalMIDI.fineTune + channelSystem.fineTune + channelMIDI.fineTune;
34108
+ this.currentTuning = this._drumChannel ? channelSystem.fineTune : globalSystem.fineTune + globalMIDI.fineTune + channelSystem.fineTune + channelMIDI.fineTune + (pitchBased ? midiKeyShift * 100 : 0);
34333
34109
  const currentPanNormalized = globalSystem.pan + globalMIDI.pan + channelSystem.pan;
34334
34110
  this.currentPan = currentPanNormalized * 500;
34335
34111
  this.currentGain = SPESSASYNTH_GAIN_FACTOR * globalSystem.gain * Math.pow(globalMIDI.volume, 2) * channelSystem.gain;
@@ -34403,9 +34179,7 @@ var MIDIChannel = class {
34403
34179
  this.setMIDIParameter("drumMap", this.channel % 16 === 9 ? defaultMap : 0);
34404
34180
  break;
34405
34181
  }
34406
- case "pitchWheel":
34407
- this.pitchWheel(8192);
34408
- break;
34182
+ case "pitchWheel": this.pitchWheel(8192);
34409
34183
  }
34410
34184
  }
34411
34185
  /** @internal */
@@ -34510,8 +34284,7 @@ var MIDIChannel = class {
34510
34284
  this.updateInternalParams();
34511
34285
  }
34512
34286
  };
34513
- //#endregion
34514
- //#region src/synthesizer/audio_engine/parameters/system.ts
34287
+ // src/synthesizer/audio_engine/parameters/system.ts
34515
34288
  /**
34516
34289
  * Default values for {@link GlobalSystemParameter}s.
34517
34290
  *
@@ -34538,6 +34311,7 @@ const DEFAULT_GLOBAL_SYSTEM_PARAMETERS = {
34538
34311
  userDrumLock: false,
34539
34312
  blackMIDIMode: false,
34540
34313
  deviceID: -1,
34314
+ pitchBasedKeyShift: false,
34541
34315
  gain: 1,
34542
34316
  pan: 0,
34543
34317
  keyShift: 0,
@@ -34569,11 +34343,13 @@ function setSystemParameterInternal(parameter, value) {
34569
34343
  }
34570
34344
  break;
34571
34345
  }
34572
- case "keyShift": if (prev !== value) this.stopAll(true);
34346
+ case "keyShift":
34347
+ if (prev !== value) this.stopAll(true);
34348
+ break;
34349
+ case "pitchBasedKeyShift": this.stopAll(true);
34573
34350
  }
34574
34351
  }
34575
- //#endregion
34576
- //#region src/synthesizer/audio_engine/voice/lowpass_filter.ts
34352
+ // src/synthesizer/audio_engine/voice/lowpass_filter.ts
34577
34353
  /**
34578
34354
  * Applies a lowpass filter to a voice.
34579
34355
  * A lot of the tricks here come from FluidSynth.
@@ -34584,9 +34360,9 @@ function setSystemParameterInternal(parameter, value) {
34584
34360
  */
34585
34361
  const FILTER_SMOOTHING_FACTOR = .03;
34586
34362
  const CHUNK_BITS = 7;
34587
- const CHUNK_MASK = (1 << CHUNK_BITS) - 1;
34363
+ const CHUNK_MASK = 127;
34588
34364
  const CACHE_MAX_CENTS = 16384;
34589
- const CHUNKS_PER_RESONANCE = CACHE_MAX_CENTS >> CHUNK_BITS;
34365
+ const CHUNKS_PER_RESONANCE = 128;
34590
34366
  var LowpassFilter = class LowpassFilter {
34591
34367
  /**
34592
34368
  * Global coefficient caches, shared between all synthesizer instances.
@@ -34737,7 +34513,7 @@ var LowpassFilter = class LowpassFilter {
34737
34513
  const chunkIndex = cutoffCents >> CHUNK_BITS;
34738
34514
  let chunk = this.chunks[chunkIndex];
34739
34515
  if (chunk === void 0) {
34740
- chunk = new Float64Array(5 << CHUNK_BITS).fill(NaN);
34516
+ chunk = (/* @__PURE__ */ new Float64Array(640)).fill(NaN);
34741
34517
  this.chunks[chunkIndex] = chunk;
34742
34518
  }
34743
34519
  const offset = (cutoffCents & CHUNK_MASK) * 5;
@@ -34782,8 +34558,7 @@ var LowpassFilter = class LowpassFilter {
34782
34558
  this.a4 = a2 / a0;
34783
34559
  }
34784
34560
  };
34785
- //#endregion
34786
- //#region src/synthesizer/audio_engine/voice/volume_envelope.ts
34561
+ // src/synthesizer/audio_engine/voice/volume_envelope.ts
34787
34562
  /**
34788
34563
  * Volume_envelope.ts
34789
34564
  * purpose: applies a volume envelope for a given voice
@@ -34907,9 +34682,7 @@ var VolumeEnvelope = class {
34907
34682
  case 3:
34908
34683
  this.releaseStartCb = (1 - (this.decayEnd - this.releaseStartTimeSamples) / this.decayDuration) * sustainCb;
34909
34684
  break;
34910
- case 4:
34911
- this.releaseStartCb = sustainCb;
34912
- break;
34685
+ case 4: this.releaseStartCb = sustainCb;
34913
34686
  }
34914
34687
  this.releaseStartCb = Math.max(0, Math.min(this.releaseStartCb, CB_SILENCE));
34915
34688
  this.attenuationCb = this.releaseStartCb;
@@ -35007,14 +34780,13 @@ var VolumeEnvelope = class {
35007
34780
  return Math.max(0, Math.floor(timecentsToSeconds(tc) * this.sampleRate));
35008
34781
  }
35009
34782
  };
35010
- //#endregion
35011
- //#region src/synthesizer/audio_engine/voice/modulation_envelope.ts
34783
+ // src/synthesizer/audio_engine/voice/modulation_envelope.ts
35012
34784
  /**
35013
34785
  * Modulation_envelope.ts
35014
34786
  * purpose: calculates the modulation envelope for the given voice
35015
34787
  */
35016
34788
  const MODENV_PEAK = 1;
35017
- const CONVEX_ATTACK = new Float32Array(1e3);
34789
+ const CONVEX_ATTACK = /* @__PURE__ */ new Float32Array(1e3);
35018
34790
  for (let i = 0; i < CONVEX_ATTACK.length; i++) CONVEX_ATTACK[i] = getModulatorCurveValue(0, ModulatorCurveTypes.convex, i / 1e3);
35019
34791
  var ModulationEnvelope = class {
35020
34792
  /**
@@ -35116,8 +34888,7 @@ var ModulationEnvelope = class {
35116
34888
  return timecentsToSeconds(timecents);
35117
34889
  }
35118
34890
  };
35119
- //#endregion
35120
- //#region src/synthesizer/audio_engine/voice/wavetable_oscillator/wavetable_oscillator.ts
34891
+ // src/synthesizer/audio_engine/voice/wavetable_oscillator/wavetable_oscillator.ts
35121
34892
  /**
35122
34893
  * Wavetable_oscillator.ts
35123
34894
  * purpose: plays back raw audio data at an arbitrary playback rate
@@ -35168,8 +34939,7 @@ var WavetableOscillator = class {
35168
34939
  */
35169
34940
  hasLooped = false;
35170
34941
  };
35171
- //#endregion
35172
- //#region src/synthesizer/audio_engine/voice/wavetable_oscillator/linear.ts
34942
+ // src/synthesizer/audio_engine/voice/wavetable_oscillator/linear.ts
35173
34943
  var LinearOscillator = class extends WavetableOscillator {
35174
34944
  process(sampleCount, tuningRatio, outputBuffer) {
35175
34945
  const step = tuningRatio * this.playbackStep;
@@ -35216,8 +34986,7 @@ var LinearOscillator = class extends WavetableOscillator {
35216
34986
  return true;
35217
34987
  }
35218
34988
  };
35219
- //#endregion
35220
- //#region src/synthesizer/audio_engine/voice/wavetable_oscillator/nearest.ts
34989
+ // src/synthesizer/audio_engine/voice/wavetable_oscillator/nearest.ts
35221
34990
  var NearestOscillator = class extends WavetableOscillator {
35222
34991
  process(sampleCount, tuningRatio, outputBuffer) {
35223
34992
  const step = tuningRatio * this.playbackStep;
@@ -35241,8 +35010,7 @@ var NearestOscillator = class extends WavetableOscillator {
35241
35010
  return true;
35242
35011
  }
35243
35012
  };
35244
- //#endregion
35245
- //#region src/synthesizer/audio_engine/voice/wavetable_oscillator/hermite.ts
35013
+ // src/synthesizer/audio_engine/voice/wavetable_oscillator/hermite.ts
35246
35014
  var HermiteOscillator = class extends WavetableOscillator {
35247
35015
  process(sampleCount, tuningRatio, outputBuffer) {
35248
35016
  const step = tuningRatio * this.playbackStep;
@@ -35346,8 +35114,7 @@ var HermiteOscillator = class extends WavetableOscillator {
35346
35114
  return true;
35347
35115
  }
35348
35116
  };
35349
- //#endregion
35350
- //#region src/synthesizer/audio_engine/voice/voice.ts
35117
+ // src/synthesizer/audio_engine/voice/voice.ts
35351
35118
  /**
35352
35119
  * Voice.ts
35353
35120
  * purpose: prepares Voices from sample and generator data
@@ -35398,7 +35165,7 @@ var Voice = class {
35398
35165
  * The current values for the respective modulators.
35399
35166
  * If there are more modulators, the array must be resized.
35400
35167
  */
35401
- modulatorValues = new Int16Array(64);
35168
+ modulatorValues = /* @__PURE__ */ new Int16Array(64);
35402
35169
  /**
35403
35170
  * Modulation envelope.
35404
35171
  */
@@ -35580,8 +35347,7 @@ var Voice = class {
35580
35347
  this.noteID = noteID;
35581
35348
  }
35582
35349
  };
35583
- //#endregion
35584
- //#region src/synthesizer/audio_engine/voice/voice_cache.ts
35350
+ // src/synthesizer/audio_engine/voice/voice_cache.ts
35585
35351
  /**
35586
35352
  * Represents a cached voice
35587
35353
  */
@@ -35646,8 +35412,7 @@ var CachedVoice = class {
35646
35412
  this.loopingMode = generators[GeneratorTypes.sampleModes];
35647
35413
  }
35648
35414
  };
35649
- //#endregion
35650
- //#region src/synthesizer/audio_engine/effects/gs/implementation/insertion/thru.ts
35415
+ // src/synthesizer/audio_engine/effects/gs/implementation/insertion/thru.ts
35651
35416
  var ThruFX = class {
35652
35417
  sendLevelToReverb = 40 / 127 * 2;
35653
35418
  sendLevelToChorus = 0;
@@ -35670,8 +35435,7 @@ var ThruFX = class {
35670
35435
  }
35671
35436
  setParameter(parameter, value) {}
35672
35437
  };
35673
- //#endregion
35674
- //#region src/synthesizer/audio_engine/effects/gs/implementation/insertion/convert.ts
35438
+ // src/synthesizer/audio_engine/effects/gs/implementation/insertion/convert.ts
35675
35439
  var InsertionValueConverter = class {
35676
35440
  static data = [
35677
35441
  [
@@ -37766,14 +37530,13 @@ var InsertionValueConverter = class {
37766
37530
  return this.data[value][13];
37767
37531
  }
37768
37532
  };
37769
- //#endregion
37770
- //#region src/synthesizer/audio_engine/effects/gs/implementation/insertion/utils.ts
37533
+ // src/synthesizer/audio_engine/effects/gs/implementation/insertion/utils.ts
37771
37534
  const HALF_PI = Math.PI / 2;
37772
37535
  const MIN_PAN = -64;
37773
37536
  const MAX_PAN = 63;
37774
- const PAN_RESOLUTION = MAX_PAN - MIN_PAN;
37775
- const PAN_TABLE_LEFT = new Float32Array(PAN_RESOLUTION + 1);
37776
- const PAN_TABLE_RIGHT = new Float32Array(PAN_RESOLUTION + 1);
37537
+ const PAN_RESOLUTION = 127;
37538
+ const PAN_TABLE_LEFT = /* @__PURE__ */ new Float32Array(128);
37539
+ const PAN_TABLE_RIGHT = /* @__PURE__ */ new Float32Array(128);
37777
37540
  for (let pan = MIN_PAN; pan <= MAX_PAN; pan++) {
37778
37541
  const realPan = (pan - MIN_PAN) / PAN_RESOLUTION;
37779
37542
  const tableIndex = pan - MIN_PAN;
@@ -37825,7 +37588,7 @@ function computeShelfCoeffs(coeffs, dbGain, f0, fs, isLow) {
37825
37588
  const A = Math.pow(10, dbGain / 40);
37826
37589
  const w0 = 2 * Math.PI * f0 / fs;
37827
37590
  const cosw0 = Math.cos(w0);
37828
- const alpha = Math.sin(w0) / 2 * Math.sqrt((A + 1 / A) * (1 / 1 - 1) + 2);
37591
+ const alpha = Math.sin(w0) / 2 * Math.sqrt((A + 1 / A) * 0 + 2);
37829
37592
  let b0, b1, b2, a0, a1, a2;
37830
37593
  if (isLow) {
37831
37594
  b0 = A * (A + 1 - (A - 1) * cosw0 + 2 * Math.sqrt(A) * alpha);
@@ -37855,8 +37618,7 @@ const ZeroStateC = {
37855
37618
  y1: 0,
37856
37619
  y2: 0
37857
37620
  };
37858
- //#endregion
37859
- //#region src/synthesizer/audio_engine/effects/gs/implementation/insertion/stereo_eq.ts
37621
+ // src/synthesizer/audio_engine/effects/gs/implementation/insertion/stereo_eq.ts
37860
37622
  /**
37861
37623
  * Stereo-EQ
37862
37624
  * This is a four-band stereo equalizer (low, mid x 2, high).
@@ -38019,9 +37781,7 @@ var StereoEQFX = class {
38019
37781
  case 12:
38020
37782
  this.m2Gain = value - 64;
38021
37783
  break;
38022
- case 22:
38023
- this.level = value / 127;
38024
- break;
37784
+ case 22: this.level = value / 127;
38025
37785
  }
38026
37786
  this.updateCoefficients();
38027
37787
  }
@@ -38118,8 +37878,7 @@ function computeHighShelfCoeffs(coeffs, freq, gainDB, sampleRate) {
38118
37878
  coeffs.b1 = b1 / a0;
38119
37879
  coeffs.b2 = b2 / a0;
38120
37880
  }
38121
- //#endregion
38122
- //#region src/synthesizer/audio_engine/effects/gs/implementation/insertion/phaser.ts
37881
+ // src/synthesizer/audio_engine/effects/gs/implementation/insertion/phaser.ts
38123
37882
  const ALL_PASS_STAGES = 8;
38124
37883
  const DEPTH_DIV = 128;
38125
37884
  const MANUAL_MULTIPLIER = 4;
@@ -38316,9 +38075,7 @@ var PhaserFX = class {
38316
38075
  case 20:
38317
38076
  this.hiGain = value - 64;
38318
38077
  break;
38319
- case 22:
38320
- this.level = value / 127;
38321
- break;
38078
+ case 22: this.level = value / 127;
38322
38079
  }
38323
38080
  this.updateShelves();
38324
38081
  }
@@ -38346,8 +38103,7 @@ var PhaserFX = class {
38346
38103
  computeShelfCoeffs(this.highShelfCoef, this.hiGain, 4e3, this.sampleRate, false);
38347
38104
  }
38348
38105
  };
38349
- //#endregion
38350
- //#region src/synthesizer/audio_engine/effects/gs/implementation/insertion/auto_pan.ts
38106
+ // src/synthesizer/audio_engine/effects/gs/implementation/insertion/auto_pan.ts
38351
38107
  const PI_2$1 = Math.PI * 2;
38352
38108
  const GAIN_LVL = .935;
38353
38109
  const LEVEL_EXP = 2;
@@ -38458,9 +38214,7 @@ var AutoPanFX = class {
38458
38214
  case 3:
38459
38215
  lfo = 1 - 2 * phase;
38460
38216
  break;
38461
- case 4:
38462
- lfo = 2 * phase - 1;
38463
- break;
38217
+ case 4: lfo = 2 * phase - 1;
38464
38218
  }
38465
38219
  if ((phase += rateInc) >= 1) phase -= 1;
38466
38220
  currentPan += (lfo - currentPan) * PAN_SMOOTHING;
@@ -38498,9 +38252,7 @@ var AutoPanFX = class {
38498
38252
  case 20:
38499
38253
  this.hiGain = value - 64;
38500
38254
  break;
38501
- case 22:
38502
- this.level = value / 127;
38503
- break;
38255
+ case 22: this.level = value / 127;
38504
38256
  }
38505
38257
  this.updateShelves();
38506
38258
  }
@@ -38509,8 +38261,7 @@ var AutoPanFX = class {
38509
38261
  computeShelfCoeffs(this.hsCoeffs, this.hiGain, 4e3, this.sampleRate, false);
38510
38262
  }
38511
38263
  };
38512
- //#endregion
38513
- //#region src/synthesizer/audio_engine/effects/gs/implementation/insertion/auto_wah.ts
38264
+ // src/synthesizer/audio_engine/effects/gs/implementation/insertion/auto_wah.ts
38514
38265
  const DEFAULT_LEVEL$2 = 96;
38515
38266
  const attackTime = .1;
38516
38267
  const releaseTime = .1;
@@ -38729,9 +38480,7 @@ var AutoWahFX = class {
38729
38480
  case 21:
38730
38481
  this.pan = value - 64;
38731
38482
  break;
38732
- case 22:
38733
- this.level = value / 127;
38734
- break;
38483
+ case 22: this.level = value / 127;
38735
38484
  }
38736
38485
  this.updateShelves();
38737
38486
  }
@@ -38781,8 +38530,7 @@ function computeHighpassCoeffs(coeffs, freq, Q, sampleRate) {
38781
38530
  coeffs.b1 = b1 / a0;
38782
38531
  coeffs.b2 = b2 / a0;
38783
38532
  }
38784
- //#endregion
38785
- //#region src/synthesizer/audio_engine/effects/gs/implementation/insertion/ph_auto_wah.ts
38533
+ // src/synthesizer/audio_engine/effects/gs/implementation/insertion/ph_auto_wah.ts
38786
38534
  const DEFAULT_LEVEL$1 = 127;
38787
38535
  var PhAutoWahFX = class {
38788
38536
  sendLevelToReverb = 40 / 127 * 2;
@@ -38885,14 +38633,11 @@ var PhAutoWahFX = class {
38885
38633
  case 21:
38886
38634
  this.autoWah.setParameter(22, value);
38887
38635
  break;
38888
- case 22:
38889
- this.level = value / 127;
38890
- break;
38636
+ case 22: this.level = value / 127;
38891
38637
  }
38892
38638
  }
38893
38639
  };
38894
- //#endregion
38895
- //#region src/synthesizer/audio_engine/effects/gs/implementation/insertion/tremolo.ts
38640
+ // src/synthesizer/audio_engine/effects/gs/implementation/insertion/tremolo.ts
38896
38641
  const DEFAULT_LEVEL = 127;
38897
38642
  const PI_2 = Math.PI * 2;
38898
38643
  const GAIN_SMOOTHING = .01;
@@ -38999,9 +38744,7 @@ var TremoloFX = class {
38999
38744
  case 3:
39000
38745
  lfo = 1 - 2 * phase;
39001
38746
  break;
39002
- case 4:
39003
- lfo = 2 * phase - 1;
39004
- break;
38747
+ case 4: lfo = 2 * phase - 1;
39005
38748
  }
39006
38749
  if ((phase += rateInc) >= 1) phase -= 1;
39007
38750
  const tremoloLevel = 1 - (lfo / 2 + .5) * (modDepth / 127);
@@ -39037,9 +38780,7 @@ var TremoloFX = class {
39037
38780
  case 20:
39038
38781
  this.hiGain = value - 64;
39039
38782
  break;
39040
- case 22:
39041
- this.level = value / 127;
39042
- break;
38783
+ case 22: this.level = value / 127;
39043
38784
  }
39044
38785
  this.updateShelves();
39045
38786
  }
@@ -39048,8 +38789,7 @@ var TremoloFX = class {
39048
38789
  computeShelfCoeffs(this.hsCoeffs, this.hiGain, 4e3, this.sampleRate, false);
39049
38790
  }
39050
38791
  };
39051
- //#endregion
39052
- //#region src/synthesizer/audio_engine/effects/gs/implementation/insertion_list.ts
38792
+ // src/synthesizer/audio_engine/effects/gs/implementation/insertion_list.ts
39053
38793
  const GS_INSERTION_EFFECT_LIST = [
39054
38794
  ThruFX,
39055
38795
  StereoEQFX,
@@ -39059,8 +38799,7 @@ const GS_INSERTION_EFFECT_LIST = [
39059
38799
  PhAutoWahFX,
39060
38800
  TremoloFX
39061
38801
  ];
39062
- //#endregion
39063
- //#region src/synthesizer/audio_engine/parameters/midi.ts
38802
+ // src/synthesizer/audio_engine/parameters/midi.ts
39064
38803
  /**
39065
38804
  * Default values for {@link GlobalMIDIParameter}s.
39066
38805
  *
@@ -39096,8 +38835,7 @@ function setMIDIParameterInternal(parameter, value) {
39096
38835
  function lockMIDIParameterInternal(parameter, isLocked) {
39097
38836
  this.lockedMIDIParameters[parameter] = isLocked;
39098
38837
  }
39099
- //#endregion
39100
- //#region src/synthesizer/audio_engine/system_exclusive/universal.ts
38838
+ // src/synthesizer/audio_engine/system_exclusive/universal.ts
39101
38839
  /**
39102
38840
  * Calculates frequency for MIDI Tuning Standard.
39103
38841
  * @param byte1 The first byte (midi note).
@@ -39229,7 +38967,6 @@ function universalSystemExclusive(syx, channelOffset = 0) {
39229
38967
  parameter: "sendLevelToReverb",
39230
38968
  value
39231
38969
  });
39232
- break;
39233
38970
  }
39234
38971
  }
39235
38972
  }
@@ -39255,7 +38992,6 @@ function universalSystemExclusive(syx, channelOffset = 0) {
39255
38992
  case 3:
39256
38993
  SpessaLog.coolInfo("MIDI System", "General MIDI 2");
39257
38994
  this.reset("gm2");
39258
- break;
39259
38995
  }
39260
38996
  break;
39261
38997
  case 8: {
@@ -39295,7 +39031,7 @@ function universalSystemExclusive(syx, channelOffset = 0) {
39295
39031
  }
39296
39032
  case 9:
39297
39033
  case 8: {
39298
- const newOctaveTuning = new Int8Array(12);
39034
+ const newOctaveTuning = /* @__PURE__ */ new Int8Array(12);
39299
39035
  if (syx[3] === 8) for (let i = 0; i < 12; i++) newOctaveTuning[i] = syx[7 + i] - 64;
39300
39036
  else for (let i = 0; i < 24; i += 2) {
39301
39037
  const tuning = (syx[7 + i] << 7 | syx[8 + i]) - 8192;
@@ -39308,17 +39044,14 @@ function universalSystemExclusive(syx, channelOffset = 0) {
39308
39044
  SpessaLog.gmInfo("Octave Scale Tuning", newOctaveTuning.join(" "));
39309
39045
  break;
39310
39046
  }
39311
- default:
39312
- SpessaLog.gmFail("MIDI Tuning Standard", syx);
39313
- break;
39047
+ default: SpessaLog.gmFail("MIDI Tuning Standard", syx);
39314
39048
  }
39315
39049
  break;
39316
39050
  }
39317
39051
  default: SpessaLog.gmFail("Universal System Exclusive", syx);
39318
39052
  }
39319
39053
  }
39320
- //#endregion
39321
- //#region src/synthesizer/audio_engine/system_exclusive/roland.ts
39054
+ // src/synthesizer/audio_engine/system_exclusive/roland.ts
39322
39055
  function handleUserDrum(a2, a3, data, syx) {
39323
39056
  if (this.systemParameters.userDrumLock) return;
39324
39057
  const drumSet = a2 >> 4;
@@ -39431,9 +39164,7 @@ function rolandSystemExclusive(syx, channelOffset = 0) {
39431
39164
  this.reset("gm");
39432
39165
  }
39433
39166
  break;
39434
- default:
39435
- SpessaLog.gsFail("System Parameter", syx);
39436
- break;
39167
+ default: SpessaLog.gsFail("System Parameter", syx);
39437
39168
  }
39438
39169
  return;
39439
39170
  }
@@ -39683,7 +39414,6 @@ function rolandSystemExclusive(syx, channelOffset = 0) {
39683
39414
  parameter: "sendLevelToReverb",
39684
39415
  value: data
39685
39416
  });
39686
- break;
39687
39417
  }
39688
39418
  break;
39689
39419
  }
@@ -39871,7 +39601,7 @@ function rolandSystemExclusive(syx, channelOffset = 0) {
39871
39601
  break;
39872
39602
  case 64: {
39873
39603
  const tuningBytes = syx.length - 9;
39874
- const newTuning = new Int8Array(12);
39604
+ const newTuning = /* @__PURE__ */ new Int8Array(12);
39875
39605
  for (let i = 0; i < tuningBytes; i++) newTuning[i] = syx[i + 7] - 64;
39876
39606
  ch.setOctaveTuning(newTuning);
39877
39607
  SpessaLog.gsInfo(`Octave Scale Tuning for ${channel}`, newTuning.join(", "));
@@ -40028,7 +39758,6 @@ function rolandSystemExclusive(syx, channelOffset = 0) {
40028
39758
  ch.drumParams[drumKey].variationSend = data;
40029
39759
  }
40030
39760
  SpessaLog.gsInfo(`Drum Delay for MAP${map}, key ${drumKey}`, data);
40031
- break;
40032
39761
  }
40033
39762
  return;
40034
39763
  }
@@ -40083,9 +39812,7 @@ function rolandSystemExclusive(syx, channelOffset = 0) {
40083
39812
  case 10:
40084
39813
  actualDrumParam = 12;
40085
39814
  break;
40086
- case 11:
40087
- actualDrumParam = 0;
40088
- break;
39815
+ case 11: actualDrumParam = 0;
40089
39816
  }
40090
39817
  const address2 = a2 & 240 | actualDrumParam;
40091
39818
  for (let midiNote = 0; midiNote < dataLength; midiNote++) handleUserDrum.call(this, address2, midiNote, syx[midiNote + 7], syx);
@@ -40109,8 +39836,7 @@ function rolandSystemExclusive(syx, channelOffset = 0) {
40109
39836
  return;
40110
39837
  }
40111
39838
  }
40112
- //#endregion
40113
- //#region src/synthesizer/audio_engine/system_exclusive/yamaha.ts
39839
+ // src/synthesizer/audio_engine/system_exclusive/yamaha.ts
40114
39840
  /**
40115
39841
  * Handles a Yamaha XG system exclusive
40116
39842
  * http://www.studio4all.de/htmle/main91.html
@@ -40152,7 +39878,6 @@ function yamahaSystemExclusive(syx, channelOffset = 0) {
40152
39878
  case 126:
40153
39879
  SpessaLog.coolInfo("MIDI System", "Yamaha XG");
40154
39880
  this.reset("xg");
40155
- break;
40156
39881
  }
40157
39882
  return;
40158
39883
  }
@@ -40687,9 +40412,7 @@ function yamahaSystemExclusive(syx, channelOffset = 0) {
40687
40412
  case 103:
40688
40413
  ch.controllerChange(MIDIControllers.portamentoOnOff, data === 1 ? 127 : 0);
40689
40414
  break;
40690
- case 104:
40691
- ch.controllerChange(MIDIControllers.portamentoTime, data);
40692
- break;
40415
+ case 104: ch.controllerChange(MIDIControllers.portamentoTime, data);
40693
40416
  }
40694
40417
  return;
40695
40418
  }
@@ -40774,7 +40497,6 @@ function yamahaSystemExclusive(syx, channelOffset = 0) {
40774
40497
  ch.drumParams[drumKey].rxNoteOn = data === 1;
40775
40498
  }
40776
40499
  SpessaLog.xgInfo(`Drum Note On for key ${drumKey}`, data === 1 ? "ON" : "OFF");
40777
- break;
40778
40500
  }
40779
40501
  return;
40780
40502
  }
@@ -40785,16 +40507,14 @@ function yamahaSystemExclusive(syx, channelOffset = 0) {
40785
40507
  SpessaLog.xgFail("System Exclusive", syx, "Unknown address");
40786
40508
  } else SpessaLog.xgFail("System Exclusive", syx);
40787
40509
  }
40788
- //#endregion
40789
- //#region src/synthesizer/audio_engine/synth_processor_options.ts
40510
+ // src/synthesizer/audio_engine/synth_processor_options.ts
40790
40511
  const DEFAULT_SYNTH_OPTIONS = {
40791
40512
  effectsEnabled: true,
40792
40513
  maxBufferSize: 128,
40793
40514
  initialTime: 0,
40794
40515
  eventsEnabled: true
40795
40516
  };
40796
- //#endregion
40797
- //#region src/soundbank/soundfont/read/generators.ts
40517
+ // src/soundbank/soundfont/read/generators.ts
40798
40518
  var ReadGenerator = class extends Generator {
40799
40519
  /**
40800
40520
  * Creates a generator
@@ -40816,8 +40536,7 @@ function readGenerators(generatorChunk) {
40816
40536
  gens.pop();
40817
40537
  return gens;
40818
40538
  }
40819
- //#endregion
40820
- //#region src/soundbank/soundfont/read/preset_zones.ts
40539
+ // src/soundbank/soundfont/read/preset_zones.ts
40821
40540
  /**
40822
40541
  * Preset_zones.ts
40823
40542
  * purpose: reads preset zones from soundfont and gets their respective samples and generators and modulators
@@ -40844,8 +40563,7 @@ function applyPresetZones(indexes, presetGens, presetMods, instruments, presets)
40844
40563
  }
40845
40564
  }
40846
40565
  }
40847
- //#endregion
40848
- //#region src/soundbank/soundfont/read/presets.ts
40566
+ // src/soundbank/soundfont/read/presets.ts
40849
40567
  /**
40850
40568
  * Parses soundfont presets, also includes function for getting the generators and samples from midi note and velocity
40851
40569
  */
@@ -40897,8 +40615,7 @@ function readPresets(presetChunk, parent, keepTerminal = false) {
40897
40615
  if (!keepTerminal) presets.pop();
40898
40616
  return presets;
40899
40617
  }
40900
- //#endregion
40901
- //#region src/soundbank/soundfont/read/instruments.ts
40618
+ // src/soundbank/soundfont/read/instruments.ts
40902
40619
  /**
40903
40620
  * Instrument.ts
40904
40621
  * purpose: parses soundfont instrument and stores them as a class
@@ -40943,8 +40660,7 @@ function readInstruments(instrumentChunk, keepTerminal = false) {
40943
40660
  if (!keepTerminal) instruments.pop();
40944
40661
  return instruments;
40945
40662
  }
40946
- //#endregion
40947
- //#region src/soundbank/soundfont/read/modulators.ts
40663
+ // src/soundbank/soundfont/read/modulators.ts
40948
40664
  /**
40949
40665
  * Reads the modulator read
40950
40666
  */
@@ -40962,8 +40678,7 @@ function readModulators(modulatorChunk) {
40962
40678
  mods.pop();
40963
40679
  return mods;
40964
40680
  }
40965
- //#endregion
40966
- //#region src/soundbank/soundfont/read/instrument_zones.ts
40681
+ // src/soundbank/soundfont/read/instrument_zones.ts
40967
40682
  /**
40968
40683
  * Reads the given instrument zone
40969
40684
  */
@@ -40986,8 +40701,7 @@ function applyInstrumentZones(indexes, instrumentGenerators, instrumentModulator
40986
40701
  }
40987
40702
  }
40988
40703
  }
40989
- //#endregion
40990
- //#region src/soundbank/soundfont/read/zones.ts
40704
+ // src/soundbank/soundfont/read/zones.ts
40991
40705
  /**
40992
40706
  * @param zonesChunk both pbag and ibag work
40993
40707
  */
@@ -41003,8 +40717,7 @@ function readZoneIndexes(zonesChunk) {
41003
40717
  gen: genStartIndexes
41004
40718
  };
41005
40719
  }
41006
- //#endregion
41007
- //#region src/soundbank/soundfont/read/soundfont.ts
40720
+ // src/soundbank/soundfont/read/soundfont.ts
41008
40721
  /**
41009
40722
  * Soundfont.ts
41010
40723
  * purpose: parses a soundfont2 file
@@ -41162,7 +40875,7 @@ var SoundFont2 = class extends BasicSoundBank {
41162
40875
  mainFileArray.currentIndex = this.sampleDataStartIndex;
41163
40876
  const samples = readSamples(shdrChunk, sampleData, xdtaChunk === void 0);
41164
40877
  if (xdtaChunk && xChunks.shdr) {
41165
- const xSamples = readSamples(xChunks.shdr, new Float32Array(1), false);
40878
+ const xSamples = readSamples(xChunks.shdr, /* @__PURE__ */ new Float32Array(1), false);
41166
40879
  if (xSamples.length === samples.length) for (const [i, s] of samples.entries()) {
41167
40880
  s.name += xSamples[i].name;
41168
40881
  s.linkedSampleIndex |= xSamples[i].linkedSampleIndex << 16;
@@ -41245,8 +40958,7 @@ var SoundFont2 = class extends BasicSoundBank {
41245
40958
  }
41246
40959
  }
41247
40960
  };
41248
- //#endregion
41249
- //#region src/soundbank/sound_bank_loader.ts
40961
+ // src/soundbank/sound_bank_loader.ts
41250
40962
  /**
41251
40963
  * A helper class for loading sound bank files as {@link BasicSoundBank} instances.
41252
40964
  *
@@ -41266,8 +40978,7 @@ var SoundBankLoader = class {
41266
40978
  return new SoundFont2(buffer, id === "sfen");
41267
40979
  }
41268
40980
  };
41269
- //#endregion
41270
- //#region src/synthesizer/audio_engine/synthesizer_snapshot.ts
40981
+ // src/synthesizer/audio_engine/synthesizer_snapshot.ts
41271
40982
  function applySnapshot(snapshot) {
41272
40983
  while (this.midiChannels.length < snapshot.midiChannels.length) this.createMIDIChannel();
41273
40984
  for (let i = 0; i < snapshot.midiChannels.length; i++) this.midiChannels[i].applySnapshot(snapshot.midiChannels[i]);
@@ -41309,8 +41020,7 @@ function getSynthesizerSnapshot() {
41309
41020
  userDrumSets: this.soundBankManager.userDrumSets.map((d) => d.getSnapshot())
41310
41021
  };
41311
41022
  }
41312
- //#endregion
41313
- //#region src/synthesizer/processor.ts
41023
+ // src/synthesizer/processor.ts
41314
41024
  /**
41315
41025
  * Gain smoothing for rapid volume changes. Must be run EVERY SAMPLE
41316
41026
  */
@@ -41546,7 +41256,7 @@ var SpessaSynthProcessor = class {
41546
41256
  * -1 means no change.
41547
41257
  * @internal
41548
41258
  */
41549
- tunings = new Float32Array(16384).fill(-1);
41259
+ tunings = (/* @__PURE__ */ new Float32Array(16384)).fill(-1);
41550
41260
  /**
41551
41261
  * An object indicating if a Global MIDI parameter, at the equivalent key, is locked
41552
41262
  * (i.e., not allowed changing).
@@ -41694,7 +41404,7 @@ var SpessaSynthProcessor = class {
41694
41404
  * note: 255 means "no change"
41695
41405
  * @internal
41696
41406
  */
41697
- gsInsertionParams = new Uint8Array(23).fill(255);
41407
+ gsInsertionParams = (/* @__PURE__ */ new Uint8Array(23)).fill(255);
41698
41408
  /**
41699
41409
  * Left float32 buffer for processing XG insertion effects in-place.
41700
41410
  * (channel outputs are double precision)
@@ -41854,7 +41564,6 @@ var SpessaSynthProcessor = class {
41854
41564
  SpessaLog.info(`%cPort select, channel offset %c${this.portSelectChannelOffset}%c. Creating a new port!`, ConsoleColors.info, ConsoleColors.value, ConsoleColors.info);
41855
41565
  for (let i = 0; i < 16; i++) this.createMIDIChannel();
41856
41566
  }
41857
- break;
41858
41567
  }
41859
41568
  }
41860
41569
  /**
@@ -42924,10 +42633,7 @@ var SpessaSynthProcessor = class {
42924
42633
  case MIDIMessageTypes.systemExclusive:
42925
42634
  this.systemExclusive(new IndexedByteArray(message.slice(1)), channelOffset);
42926
42635
  break;
42927
- case MIDIMessageTypes.reset:
42928
- this.reset();
42929
- break;
42930
- default: break;
42636
+ case MIDIMessageTypes.reset: this.reset();
42931
42637
  }
42932
42638
  }
42933
42639
  /**
@@ -42988,7 +42694,6 @@ var SpessaSynthProcessor = class {
42988
42694
  return bankMSB + bankLSB * 129 + program * 16512 + 2113536 * midiNote + 270532608 * velocity;
42989
42695
  }
42990
42696
  };
42991
- //#endregion
42992
42697
  export { BasicInstrument, BasicInstrumentZone, BasicMIDI, BasicPreset, BasicPresetZone, BasicSample, BasicSoundBank, BasicZone, DEFAULT_CHANNEL_MIDI_PARAMETERS, DEFAULT_CHANNEL_SYSTEM_PARAMETERS, DEFAULT_DRUM_REVERB, DEFAULT_GLOBAL_MIDI_PARAMETERS, DEFAULT_GLOBAL_SYSTEM_PARAMETERS, DEFAULT_MIDI_CONTROLLERS, DEFAULT_SYNTH_MODE, DefaultGSChorus, DefaultGSDelay, DefaultGSReverb, DefaultXGChorus, DefaultXGEffect, DefaultXGInsertion, DefaultXGReverb, DefaultXGSystemEffect, DefaultXGVariation, DrumParameterUtils, EmptySample, GENERATORS_AMOUNT, Generator, GeneratorLimits, GeneratorTypes, INSTRUMENT_ONLY_GENERATORS, IndexedByteArray, InterpolationTypes, MAX_GENERATOR, MIDIBuilder, MIDIChannel, MIDIControllers, MIDIMessage, MIDIMessageTypes, MIDIPatchTools, MIDITrack, MIDIUtils, MIDI_DRUM_CHANNEL, Modulator, ModulatorControllerSources, ModulatorCurveTypes, ModulatorSource, ModulatorTransformTypes, NonRegisteredParameterTypesLSB, NonRegisteredParameterTypesMSB, RegisteredParameterTypes, SPESSASYNTH_GAIN_FACTOR, SPESSA_BUFSIZE, SampleTypes, SoundBankLoader, SoundBankManager, SpessaLog, SpessaSynthCoreUtils, SpessaSynthProcessor, SpessaSynthSequencer, VOICE_CAP, audioToWav };
42993
42698
 
42994
42699
  //# sourceMappingURL=index.js.map