spessasynth_core 4.4.0 → 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.
@@ -6977,7 +6929,6 @@ var BasicSample = class {
6977
6929
  * Get raw data for writing the file, either a compressed bit stream or signed 16-bit little endian PCM data.
6978
6930
  * @param allowVorbis if vorbis file data is allowed.
6979
6931
  * @return either s16le or vorbis data.
6980
- * @internal
6981
6932
  */
6982
6933
  getRawData(allowVorbis) {
6983
6934
  if (this.compressedData && allowVorbis && !this.dataOverridden) return this.compressedData;
@@ -7060,7 +7011,6 @@ var BasicSample = class {
7060
7011
  case SampleTypes.linkedSample:
7061
7012
  this.setSampleType(SampleTypes.linkedSample);
7062
7013
  sample.setSampleType(SampleTypes.linkedSample);
7063
- break;
7064
7014
  }
7065
7015
  }
7066
7016
  /**
@@ -7074,7 +7024,6 @@ var BasicSample = class {
7074
7024
  /**
7075
7025
  * Unlinks the sample from a given instrument
7076
7026
  * @param instrument the instrument to unlink from
7077
- * @internal
7078
7027
  */
7079
7028
  unlinkFrom(instrument) {
7080
7029
  const index = this.linkedTo.indexOf(instrument);
@@ -7202,25 +7151,27 @@ var SoundFontSample = class extends BasicSample {
7202
7151
  this.endByteOffset = sampleEndIndex;
7203
7152
  this.sampleID = sampleIndex;
7204
7153
  const smplStart = sampleDataArray instanceof IndexedByteArray ? sampleDataArray.currentIndex : 0;
7205
- if (sampleDataArray instanceof IndexedByteArray) if (compressed) {
7206
- this.loopStart += this.startByteOffset / 2;
7207
- this.loopEnd += this.startByteOffset / 2;
7208
- this.setCompressedData(sampleDataArray.slice(this.startByteOffset / 2 + smplStart, this.endByteOffset / 2 + smplStart));
7209
- } else this.s16leData = sampleDataArray.slice(smplStart + this.startByteOffset, smplStart + this.endByteOffset);
7210
- 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);
7211
7161
  this.linkedSampleIndex = linkedSampleIndex;
7212
7162
  }
7213
7163
  getLinkedSample(samplesArray) {
7214
7164
  if (this.linkedSample || !this.isLinked) return;
7215
7165
  const linked = samplesArray[this.linkedSampleIndex];
7216
- if (linked) if (linked.linkedSample) {
7217
- SpessaLog.info(`%cInvalid linked sample for ${this.name}: ${linked.name} is already linked to ${linked.linkedSample.name}`, ConsoleColors.warn);
7218
- this.unlinkSample();
7219
- } else if (linked === this) {
7220
- SpessaLog.info(`%cInvalid linked sample for ${this.name}: linked to itself.`, ConsoleColors.warn);
7221
- this.unlinkSample();
7222
- } else this.setLinkedSample(linked, this.sampleType);
7223
- 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 {
7224
7175
  SpessaLog.info(`%cInvalid linked sample for ${this.name}. Setting to mono.`, ConsoleColors.warn);
7225
7176
  this.unlinkSample();
7226
7177
  }
@@ -7236,7 +7187,7 @@ var SoundFontSample = class extends BasicSample {
7236
7187
  const byteLength = this.endByteOffset - this.startByteOffset;
7237
7188
  if (byteLength < 1) {
7238
7189
  SpessaLog.warn(`Invalid sample ${this.name}! Invalid length: ${byteLength}`);
7239
- return new Float32Array(1);
7190
+ return /* @__PURE__ */ new Float32Array(1);
7240
7191
  }
7241
7192
  const audioData = new Float32Array(byteLength / 2);
7242
7193
  const convertedSigned16 = new Int16Array(this.s16leData.buffer);
@@ -7247,7 +7198,7 @@ var SoundFontSample = class extends BasicSample {
7247
7198
  }
7248
7199
  getRawData(allowVorbis) {
7249
7200
  if (this.dataOverridden || this.compressedData) return super.getRawData(allowVorbis);
7250
- return this.s16leData ?? new Uint8Array(0);
7201
+ return this.s16leData ?? /* @__PURE__ */ new Uint8Array(0);
7251
7202
  }
7252
7203
  };
7253
7204
  /**
@@ -7282,8 +7233,7 @@ function readSample(index, sampleHeaderData, smplArrayData) {
7282
7233
  const sampleType = readLittleEndianIndexed(sampleHeaderData, 2);
7283
7234
  return new SoundFontSample(sampleName, sampleStartIndex, sampleEndIndex, sampleLoopStartIndex, sampleLoopEndIndex, sampleRate, samplePitch, samplePitchCorrection, sampleLink, sampleType, smplArrayData, index);
7284
7235
  }
7285
- //#endregion
7286
- //#region src/soundbank/soundfont/write/shdr.ts
7236
+ // src/soundbank/soundfont/write/shdr.ts
7287
7237
  function getSHDR(bank, smplStartOffsets, smplEndOffsets, rf64) {
7288
7238
  const sampleLength = 46;
7289
7239
  const shdrSize = sampleLength * (bank.samples.length + 1);
@@ -7325,8 +7275,7 @@ function getSHDR(bank, smplStartOffsets, smplEndOffsets, rf64) {
7325
7275
  xdta: RIFFChunk.write("shdr", xshdrData, rf64)
7326
7276
  };
7327
7277
  }
7328
- //#endregion
7329
- //#region src/utils/byte_functions/bit_mask.ts
7278
+ // src/utils/byte_functions/bit_mask.ts
7330
7279
  /**
7331
7280
  * Converts a given bit to boolean.
7332
7281
  * @param num The input number.
@@ -7338,16 +7287,15 @@ function bitMaskToBool(num, bit) {
7338
7287
  function toNumericBool(bool) {
7339
7288
  return bool ? 1 : 0;
7340
7289
  }
7341
- //#endregion
7342
- //#region src/soundbank/basic_soundbank/modulator_curves.ts
7290
+ // src/soundbank/basic_soundbank/modulator_curves.ts
7343
7291
  /**
7344
7292
  * Modulator_curves.ts
7345
7293
  * precomputes modulator concave and convex curves and calculates a curve value for a given polarity, direction and type
7346
7294
  */
7347
7295
  const MODULATOR_RESOLUTION = 16384;
7348
7296
  const MOD_CURVE_TYPES_AMOUNT = Object.keys(ModulatorCurveTypes).length;
7349
- const concave = new Float32Array(MODULATOR_RESOLUTION + 1);
7350
- const convex = new Float32Array(MODULATOR_RESOLUTION + 1);
7297
+ const concave = /* @__PURE__ */ new Float32Array(16385);
7298
+ const convex = /* @__PURE__ */ new Float32Array(16385);
7351
7299
  concave[0] = 0;
7352
7300
  concave[concave.length - 1] = 1;
7353
7301
  convex[0] = 0;
@@ -7378,21 +7326,20 @@ function getModulatorCurveValue(transformType, curveType, value) {
7378
7326
  case ModulatorCurveTypes.concave:
7379
7327
  if (isBipolar) {
7380
7328
  value = value * 2 - 1;
7381
- if (value < 0) return -concave[Math.trunc(value * -MODULATOR_RESOLUTION)];
7329
+ if (value < 0) return -concave[Math.trunc(value * -16384)];
7382
7330
  return concave[Math.trunc(value * MODULATOR_RESOLUTION)];
7383
7331
  }
7384
7332
  return concave[Math.trunc(value * MODULATOR_RESOLUTION)];
7385
7333
  case ModulatorCurveTypes.convex:
7386
7334
  if (isBipolar) {
7387
7335
  value = value * 2 - 1;
7388
- if (value < 0) return -convex[Math.trunc(value * -MODULATOR_RESOLUTION)];
7336
+ if (value < 0) return -convex[Math.trunc(value * -16384)];
7389
7337
  return convex[Math.trunc(value * MODULATOR_RESOLUTION)];
7390
7338
  }
7391
7339
  return convex[Math.trunc(value * MODULATOR_RESOLUTION)];
7392
7340
  }
7393
7341
  }
7394
- //#endregion
7395
- //#region src/soundbank/basic_soundbank/modulator_source.ts
7342
+ // src/soundbank/basic_soundbank/modulator_source.ts
7396
7343
  /**
7397
7344
  * Represents a single {@link Modulator} source.
7398
7345
  *
@@ -7456,7 +7403,9 @@ var ModulatorSource = class ModulatorSource {
7456
7403
  const isBipolar = bitMaskToBool(sourceEnum, 9);
7457
7404
  const isNegative = bitMaskToBool(sourceEnum, 8);
7458
7405
  const isCC = bitMaskToBool(sourceEnum, 7);
7459
- 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);
7460
7409
  }
7461
7410
  /**
7462
7411
  * Copies the modulator source.
@@ -7528,8 +7477,7 @@ for (let curveType = 0; curveType < MOD_CURVE_TYPES_AMOUNT; curveType++) for (le
7528
7477
  const tableIndex = MODULATOR_RESOLUTION * (curveType * MOD_CURVE_TYPES_AMOUNT + transformType);
7529
7478
  for (let value = 0; value < MODULATOR_RESOLUTION; value++) MODULATOR_TRANSFORMS[tableIndex + value] = getModulatorCurveValue(transformType, curveType, value / MODULATOR_RESOLUTION);
7530
7479
  }
7531
- //#endregion
7532
- //#region src/soundbank/basic_soundbank/modulator.ts
7480
+ // src/soundbank/basic_soundbank/modulator.ts
7533
7481
  function getModSourceEnum(curveType, isBipolar, isNegative, isCC, index) {
7534
7482
  return new ModulatorSource(index, curveType, isCC, isBipolar, isNegative).toSourceEnum();
7535
7483
  }
@@ -7666,8 +7614,7 @@ const defaultSpessaSynthModulators = [
7666
7614
  new DecodedModulator(getModSourceEnum(ModulatorCurveTypes.switch, false, false, true, MIDIControllers.softPedal), 0, GeneratorTypes.initialFilterFc, -1200, 0)
7667
7615
  ];
7668
7616
  const SPESSASYNTH_DEFAULT_MODULATORS = [...defaultSoundFont2Modulators, ...defaultSpessaSynthModulators];
7669
- //#endregion
7670
- //#region src/soundbank/basic_soundbank/generator.ts
7617
+ // src/soundbank/basic_soundbank/generator.ts
7671
7618
  /**
7672
7619
  * Generator represents a single sound bank parameter.
7673
7620
  *
@@ -7708,8 +7655,7 @@ var Generator = class {
7708
7655
  return `${Object.keys(GeneratorTypes).find((k) => GeneratorTypes[k] === this.type)}: ${this.value}`;
7709
7656
  }
7710
7657
  };
7711
- //#endregion
7712
- //#region src/soundbank/basic_soundbank/basic_zone.ts
7658
+ // src/soundbank/basic_soundbank/basic_zone.ts
7713
7659
  /**
7714
7660
  * Represents a single zone with parameters, modulators and a specified key and velocity range.
7715
7661
  *
@@ -7845,7 +7791,6 @@ var BasicZone = class {
7845
7791
  /**
7846
7792
  * Copies the parameters from another zone.
7847
7793
  * @param zone The zone to copy from.
7848
- * @internal
7849
7794
  */
7850
7795
  copyFrom(zone) {
7851
7796
  this.generators = zone.generators.map((g) => new Generator(g.type, g.value, false));
@@ -7865,8 +7810,7 @@ var BasicZone = class {
7865
7810
  return generators;
7866
7811
  }
7867
7812
  };
7868
- //#endregion
7869
- //#region src/soundbank/basic_soundbank/basic_instrument_zone.ts
7813
+ // src/soundbank/basic_soundbank/basic_instrument_zone.ts
7870
7814
  /**
7871
7815
  * Represents a single instrument zone with an associated {@link BasicSample}.
7872
7816
  *
@@ -7926,8 +7870,7 @@ var BasicInstrumentZone = class extends BasicZone {
7926
7870
  return gens;
7927
7871
  }
7928
7872
  };
7929
- //#endregion
7930
- //#region src/soundbank/basic_soundbank/basic_preset_zone.ts
7873
+ // src/soundbank/basic_soundbank/basic_preset_zone.ts
7931
7874
  /**
7932
7875
  * Represents a single preset zone with an associated {@link BasicInstrument}.
7933
7876
  *
@@ -7982,8 +7925,7 @@ var BasicPresetZone = class extends BasicZone {
7982
7925
  return gens;
7983
7926
  }
7984
7927
  };
7985
- //#endregion
7986
- //#region src/soundbank/basic_soundbank/basic_preset.ts
7928
+ // src/soundbank/basic_soundbank/basic_preset.ts
7987
7929
  const defaultGeneratorValues = new Int16Array(GENERATORS_AMOUNT);
7988
7930
  for (let i = 0; i < defaultGeneratorValues.length; i++) if (GeneratorLimits[i]) defaultGeneratorValues[i] = GeneratorLimits[i].def;
7989
7931
  /**
@@ -8107,7 +8049,6 @@ var BasicPreset = class BasicPreset {
8107
8049
  * @param midiNote The MIDI note number.
8108
8050
  * @param velocity The MIDI velocity.
8109
8051
  * @returns The returned sound data.
8110
- * @internal
8111
8052
  */
8112
8053
  getVoiceParameters(midiNote, velocity) {
8113
8054
  const voiceParameters = new Array();
@@ -8281,9 +8222,8 @@ var BasicPreset = class BasicPreset {
8281
8222
  phdrData.xdta.currentIndex += 12;
8282
8223
  }
8283
8224
  };
8284
- //#endregion
8285
- //#region src/soundbank/basic_soundbank/basic_instrument.ts
8286
- const notGlobalizedTypes = new Set([
8225
+ // src/soundbank/basic_soundbank/basic_instrument.ts
8226
+ const notGlobalizedTypes = /* @__PURE__ */ new Set([
8287
8227
  GeneratorTypes.velRange,
8288
8228
  GeneratorTypes.keyRange,
8289
8229
  GeneratorTypes.instrument,
@@ -8366,7 +8306,6 @@ var BasicInstrument = class {
8366
8306
  /**
8367
8307
  * Unlinks the instrument from a given preset.
8368
8308
  * @param preset The preset to unlink from.
8369
- * @internal
8370
8309
  */
8371
8310
  unlinkFrom(preset) {
8372
8311
  const index = this.linkedTo.indexOf(preset);
@@ -8494,8 +8433,7 @@ var BasicInstrument = class {
8494
8433
  writeWord(instData.xdta, index >>> 16);
8495
8434
  }
8496
8435
  };
8497
- //#endregion
8498
- //#region src/soundbank/soundfont/write/write_sf2_elements.ts
8436
+ // src/soundbank/soundfont/write/write_sf2_elements.ts
8499
8437
  function writeSF2Elements(bank, rf64, isPreset, writeBankLSB = false) {
8500
8438
  const elements = isPreset ? bank.presets : bank.instruments;
8501
8439
  const genHeader = isPreset ? "pgen" : "igen";
@@ -8589,8 +8527,7 @@ function writeSF2Elements(bank, rf64, isPreset, writeBankLSB = false) {
8589
8527
  }
8590
8528
  };
8591
8529
  }
8592
- //#endregion
8593
- //#region src/soundbank/soundfont/write/write.ts
8530
+ // src/soundbank/soundfont/write/write.ts
8594
8531
  const DEFAULT_SF2_WRITE_OPTIONS = {
8595
8532
  writeDefaultModulators: true,
8596
8533
  writeExtendedLimits: true,
@@ -8714,8 +8651,7 @@ function writeSF(bank, software, writeDefaultModulators, writeExtendedLimits, wr
8714
8651
  SpessaLog.groupEnd();
8715
8652
  return main.buffer;
8716
8653
  }
8717
- //#endregion
8718
- //#region src/soundbank/downloadable_sounds/dls_verifier.ts
8654
+ // src/soundbank/downloadable_sounds/dls_verifier.ts
8719
8655
  var DLSVerifier = class {
8720
8656
  /**
8721
8657
  * @param chunk The chunk to verify.
@@ -8752,8 +8688,7 @@ var DLSVerifier = class {
8752
8688
  return chunks;
8753
8689
  }
8754
8690
  };
8755
- //#endregion
8756
- //#region src/soundbank/downloadable_sounds/enums.ts
8691
+ // src/soundbank/downloadable_sounds/enums.ts
8757
8692
  const DLSSources = {
8758
8693
  none: 0,
8759
8694
  modLfo: 1,
@@ -8809,8 +8744,7 @@ const DLSLoopTypes = {
8809
8744
  forward: 0,
8810
8745
  loopAndRelease: 1
8811
8746
  };
8812
- //#endregion
8813
- //#region src/soundbank/downloadable_sounds/wave_sample.ts
8747
+ // src/soundbank/downloadable_sounds/wave_sample.ts
8814
8748
  const WSMP_SIZE = 20;
8815
8749
  const WSMP_LOOP_SIZE = 16;
8816
8750
  var WaveSample = class WaveSample extends DLSVerifier {
@@ -8959,8 +8893,7 @@ var WaveSample = class WaveSample extends DLSVerifier {
8959
8893
  return RIFFChunk.write("wsmp", wsmpData);
8960
8894
  }
8961
8895
  };
8962
- //#endregion
8963
- //#region src/soundbank/downloadable_sounds/dls_sample.ts
8896
+ // src/soundbank/downloadable_sounds/dls_sample.ts
8964
8897
  const W_FORMAT_TAG = {
8965
8898
  PCM: 1,
8966
8899
  ALAW: 6
@@ -9002,7 +8935,8 @@ function readALAW(data, bytesPerSample) {
9002
8935
  if (exponent > 0) mantissa += 16;
9003
8936
  mantissa = (mantissa << 4) + 8;
9004
8937
  if (exponent > 1) mantissa = mantissa << exponent - 1;
9005
- sampleData[i] = (input > 127 ? mantissa : -mantissa) / 32768;
8938
+ const s16sample = input > 127 ? mantissa : -mantissa;
8939
+ sampleData[i] = s16sample / 32768;
9006
8940
  }
9007
8941
  return sampleData;
9008
8942
  }
@@ -9032,7 +8966,7 @@ var DLSSample = class extends BasicSample {
9032
8966
  this.bytesPerSample = bytesPerSample;
9033
8967
  }
9034
8968
  getAudioData() {
9035
- if (!this.rawData) return new Float32Array(0);
8969
+ if (!this.rawData) return /* @__PURE__ */ new Float32Array(0);
9036
8970
  if (!this.audioData) {
9037
8971
  let sampleData;
9038
8972
  switch (this.wFormatTag) {
@@ -9043,13 +8977,11 @@ var DLSSample = class extends BasicSample {
9043
8977
  case W_FORMAT_TAG.PCM:
9044
8978
  sampleData = readPCM(this.rawData, this.bytesPerSample);
9045
8979
  break;
9046
- case W_FORMAT_TAG.ALAW:
9047
- sampleData = readALAW(this.rawData, this.bytesPerSample);
9048
- break;
8980
+ case W_FORMAT_TAG.ALAW: sampleData = readALAW(this.rawData, this.bytesPerSample);
9049
8981
  }
9050
8982
  this.setAudioData(sampleData, this.sampleRate);
9051
8983
  }
9052
- return this.audioData ?? new Float32Array(0);
8984
+ return this.audioData ?? /* @__PURE__ */ new Float32Array(0);
9053
8985
  }
9054
8986
  getRawData(allowVorbis) {
9055
8987
  if (this.dataOverridden || this.isCompressed) return super.getRawData(allowVorbis);
@@ -9057,8 +8989,7 @@ var DLSSample = class extends BasicSample {
9057
8989
  return this.encodeS16LE();
9058
8990
  }
9059
8991
  };
9060
- //#endregion
9061
- //#region src/soundbank/downloadable_sounds/sample.ts
8992
+ // src/soundbank/downloadable_sounds/sample.ts
9062
8993
  var DownloadableSoundsSample = class DownloadableSoundsSample extends DLSVerifier {
9063
8994
  waveSample = new WaveSample();
9064
8995
  wFormatTag;
@@ -9145,8 +9076,7 @@ var DownloadableSoundsSample = class DownloadableSoundsSample extends DLSVerifie
9145
9076
  return RIFFChunk.write("fmt ", fmtData);
9146
9077
  }
9147
9078
  };
9148
- //#endregion
9149
- //#region src/soundbank/downloadable_sounds/connection_source.ts
9079
+ // src/soundbank/downloadable_sounds/connection_source.ts
9150
9080
  var ConnectionSource = class ConnectionSource {
9151
9081
  source;
9152
9082
  transform;
@@ -9185,9 +9115,7 @@ var ConnectionSource = class ConnectionSource {
9185
9115
  case MIDIControllers.chorusDepth:
9186
9116
  sourceEnum = DLSSources.chorus;
9187
9117
  break;
9188
- case MIDIControllers.reverbDepth:
9189
- sourceEnum = DLSSources.reverb;
9190
- break;
9118
+ case MIDIControllers.reverbDepth: sourceEnum = DLSSources.reverb;
9191
9119
  }
9192
9120
  else switch (source.index) {
9193
9121
  case ModulatorControllerSources.noController:
@@ -9271,21 +9199,17 @@ var ConnectionSource = class ConnectionSource {
9271
9199
  case DLSSources.pitchWheel:
9272
9200
  sourceEnum = ModulatorControllerSources.pitchWheel;
9273
9201
  break;
9274
- case DLSSources.pitchWheelRange:
9275
- sourceEnum = ModulatorControllerSources.pitchWheelRange;
9276
- break;
9202
+ case DLSSources.pitchWheelRange: sourceEnum = ModulatorControllerSources.pitchWheelRange;
9277
9203
  }
9278
9204
  if (sourceEnum === void 0) return;
9279
9205
  return new ModulatorSource(sourceEnum, this.transform, isCC, this.bipolar, this.invert);
9280
9206
  }
9281
9207
  };
9282
- //#endregion
9283
- //#region src/soundbank/downloadable_sounds/default_dls_modulators.ts
9208
+ // src/soundbank/downloadable_sounds/default_dls_modulators.ts
9284
9209
  const DEFAULT_DLS_REVERB = new DecodedModulator(219, 0, GeneratorTypes.reverbEffectsSend, 1e3, 0);
9285
9210
  const DEFAULT_DLS_CHORUS = new DecodedModulator(221, 0, GeneratorTypes.chorusEffectsSend, 1e3, 0);
9286
- //#endregion
9287
- //#region src/soundbank/downloadable_sounds/connection_block.ts
9288
- const invalidGeneratorTypes = new Set([
9211
+ // src/soundbank/downloadable_sounds/connection_block.ts
9212
+ const invalidGeneratorTypes = /* @__PURE__ */ new Set([
9289
9213
  GeneratorTypes.sampleModes,
9290
9214
  GeneratorTypes.initialAttenuation,
9291
9215
  GeneratorTypes.keyRange,
@@ -9355,7 +9279,8 @@ var ConnectionBlock = class ConnectionBlock {
9355
9279
  const lScale = readLittleEndianIndexed(artData, 4) | 0;
9356
9280
  const transform = usTransform & 15;
9357
9281
  const control = new ConnectionSource(usControl, usTransform >> 4 & 15, bitMaskToBool(usTransform, 8), bitMaskToBool(usTransform, 9));
9358
- 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);
9359
9284
  }
9360
9285
  static fromSFModulator(m, articulation) {
9361
9286
  const failed = (msg) => {
@@ -9628,9 +9553,7 @@ var ConnectionBlock = class ConnectionBlock {
9628
9553
  case DLSDestinations.chorusSend:
9629
9554
  zone.setGenerator(GeneratorTypes.chorusEffectsSend, value);
9630
9555
  break;
9631
- case DLSDestinations.pitch:
9632
- zone.fineTuning += value;
9633
- break;
9556
+ case DLSDestinations.pitch: zone.fineTuning += value;
9634
9557
  }
9635
9558
  }
9636
9559
  toSFModulator(zone) {
@@ -9741,8 +9664,7 @@ var ConnectionBlock = class ConnectionBlock {
9741
9664
  }
9742
9665
  }
9743
9666
  };
9744
- //#endregion
9745
- //#region src/soundbank/downloadable_sounds/articulation.ts
9667
+ // src/soundbank/downloadable_sounds/articulation.ts
9746
9668
  var DownloadableSoundsArticulation = class extends DLSVerifier {
9747
9669
  connectionBlocks = new Array();
9748
9670
  mode = "dls2";
@@ -9847,17 +9769,19 @@ var DownloadableSoundsArticulation = class extends DLSVerifier {
9847
9769
  connection.toSFGenerator(zone);
9848
9770
  continue;
9849
9771
  }
9850
- if (control === DLSSources.none) if (source === DLSSources.keyNum) {
9851
- if (destination === DLSDestinations.pitch) {
9852
- zone.setGenerator(GeneratorTypes.scaleTuning, amount / 128);
9853
- continue;
9854
- }
9855
- if (destination === DLSDestinations.modEnvHold || destination === DLSDestinations.modEnvDecay || destination === DLSDestinations.volEnvHold || destination === DLSDestinations.volEnvDecay) continue;
9856
- } else {
9857
- const specialGen = connection.toCombinedSFDestination();
9858
- if (specialGen) {
9859
- zone.setGenerator(specialGen, amount);
9860
- 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
+ }
9861
9785
  }
9862
9786
  }
9863
9787
  connection.toSFModulator(zone);
@@ -9876,9 +9800,7 @@ var DownloadableSoundsArticulation = class extends DLSVerifier {
9876
9800
  case DLSDestinations.modEnvHold:
9877
9801
  applyKeyToCorrection(generatorAmount, GeneratorTypes.keyNumToModEnvHold, GeneratorTypes.holdModEnv, DLSDestinations.modEnvHold);
9878
9802
  break;
9879
- case DLSDestinations.modEnvDecay:
9880
- applyKeyToCorrection(generatorAmount, GeneratorTypes.keyNumToModEnvDecay, GeneratorTypes.decayModEnv, DLSDestinations.modEnvDecay);
9881
- break;
9803
+ case DLSDestinations.modEnvDecay: applyKeyToCorrection(generatorAmount, GeneratorTypes.keyNumToModEnvDecay, GeneratorTypes.decayModEnv, DLSDestinations.modEnvDecay);
9882
9804
  }
9883
9805
  }
9884
9806
  if (this.mode === "dls1") {
@@ -9890,8 +9812,7 @@ var DownloadableSoundsArticulation = class extends DLSVerifier {
9890
9812
  }
9891
9813
  }
9892
9814
  };
9893
- //#endregion
9894
- //#region src/soundbank/downloadable_sounds/wave_link.ts
9815
+ // src/soundbank/downloadable_sounds/wave_link.ts
9895
9816
  var WaveLink = class WaveLink {
9896
9817
  /**
9897
9818
  * Specifies the channel placement of the sample. This is used to place mono sounds within a
@@ -9928,7 +9849,8 @@ var WaveLink = class WaveLink {
9928
9849
  const fusOptions = readLittleEndianIndexed(chunk.data, 2);
9929
9850
  const phaseGroup = readLittleEndianIndexed(chunk.data, 2);
9930
9851
  const ulChannel = readLittleEndianIndexed(chunk.data, 4);
9931
- const wlnk = new WaveLink(readLittleEndianIndexed(chunk.data, 4));
9852
+ const ulTableIndex = readLittleEndianIndexed(chunk.data, 4);
9853
+ const wlnk = new WaveLink(ulTableIndex);
9932
9854
  wlnk.channel = ulChannel;
9933
9855
  wlnk.fusOptions = fusOptions;
9934
9856
  wlnk.phaseGroup = phaseGroup;
@@ -9957,8 +9879,7 @@ var WaveLink = class WaveLink {
9957
9879
  return RIFFChunk.write("wlnk", wlnkData);
9958
9880
  }
9959
9881
  };
9960
- //#endregion
9961
- //#region src/soundbank/downloadable_sounds/region.ts
9882
+ // src/soundbank/downloadable_sounds/region.ts
9962
9883
  var DownloadableSoundsRegion = class DownloadableSoundsRegion extends DLSVerifier {
9963
9884
  articulation = new DownloadableSoundsArticulation();
9964
9885
  /**
@@ -10051,7 +9972,8 @@ var DownloadableSoundsRegion = class DownloadableSoundsRegion extends DLSVerifie
10051
9972
  }
10052
9973
  static fromSFZone(zone, samples) {
10053
9974
  const waveSample = WaveSample.fromSFZone(zone);
10054
- const region = new DownloadableSoundsRegion(WaveLink.fromSFZone(samples, zone), waveSample);
9975
+ const waveLink = WaveLink.fromSFZone(samples, zone);
9976
+ const region = new DownloadableSoundsRegion(waveLink, waveSample);
10055
9977
  region.keyRange.min = Math.max(zone.keyRange.min, 0);
10056
9978
  region.keyRange.max = zone.keyRange.max;
10057
9979
  region.velRange.min = Math.max(zone.velRange.min, 0);
@@ -10103,8 +10025,7 @@ var DownloadableSoundsRegion = class DownloadableSoundsRegion extends DLSVerifie
10103
10025
  return RIFFChunk.write("rgnh", rgnhData);
10104
10026
  }
10105
10027
  };
10106
- //#endregion
10107
- //#region src/soundbank/downloadable_sounds/instrument.ts
10028
+ // src/soundbank/downloadable_sounds/instrument.ts
10108
10029
  /**
10109
10030
  * Represents a proper DLS instrument, with regions and articulation.
10110
10031
  * DLS
@@ -10236,8 +10157,7 @@ var DownloadableSoundsInstrument = class DownloadableSoundsInstrument extends DL
10236
10157
  return RIFFChunk.write("insh", inshData);
10237
10158
  }
10238
10159
  };
10239
- //#endregion
10240
- //#region src/soundbank/downloadable_sounds/downloadable_sounds.ts
10160
+ // src/soundbank/downloadable_sounds/downloadable_sounds.ts
10241
10161
  const DEFAULT_DLS_OPTIONS = { software: "SpessaSynth" };
10242
10162
  var DownloadableSounds = class DownloadableSounds extends DLSVerifier {
10243
10163
  samples = new Array();
@@ -10476,8 +10396,7 @@ var DownloadableSounds = class DownloadableSounds extends DLSVerifier {
10476
10396
  return soundBank;
10477
10397
  }
10478
10398
  };
10479
- //#endregion
10480
- //#region src/soundbank/basic_soundbank/basic_soundbank.ts
10399
+ // src/soundbank/basic_soundbank/basic_soundbank.ts
10481
10400
  /**
10482
10401
  * This module handles parsing and writing SoundFont2 (`.sf2`, `.sf3` and `.sfogg`) files.
10483
10402
  * It represents a single sound bank.
@@ -10600,7 +10519,7 @@ var BasicSoundBank = class BasicSoundBank {
10600
10519
  */
10601
10520
  static getSampleSoundBankFile() {
10602
10521
  const font = new BasicSoundBank();
10603
- const sampleData = new Float32Array(128);
10522
+ const sampleData = /* @__PURE__ */ new Float32Array(128);
10604
10523
  for (let i = 0; i < 128; i++) sampleData[i] = i / 128 * 2 - 1;
10605
10524
  const sample = new EmptySample();
10606
10525
  sample.name = "Saw";
@@ -10990,7 +10909,7 @@ var BasicSoundBank = class BasicSoundBank {
10990
10909
  */
10991
10910
  parseInternal() {
10992
10911
  this._isXGBank = false;
10993
- const allowedPrograms = new Set([
10912
+ const allowedPrograms = /* @__PURE__ */ new Set([
10994
10913
  0,
10995
10914
  1,
10996
10915
  2,
@@ -11041,8 +10960,7 @@ var BasicSoundBank = class BasicSoundBank {
11041
10960
  } else SpessaLog.info(`%c${info}: %c${value.toLocaleString()}`, ConsoleColors.info, ConsoleColors.recognized);
11042
10961
  }
11043
10962
  };
11044
- //#endregion
11045
- //#region src/midi/read/tracker/types.ts
10963
+ // src/midi/read/tracker/types.ts
11046
10964
  /**
11047
10965
  * The loop modes of a tracker sample.
11048
10966
  */
@@ -11051,8 +10969,7 @@ const TrackerLoopTypes = {
11051
10969
  forward: 1,
11052
10970
  pingPong: 2
11053
10971
  };
11054
- //#endregion
11055
- //#region src/midi/read/tracker/tracker_sound_bank.ts
10972
+ // src/midi/read/tracker/tracker_sound_bank.ts
11056
10973
  /**
11057
10974
  * The volume envelope release (in timecents) of the sound bank instruments.
11058
10975
  * Short, as trackers cut the notes instantly.
@@ -11115,8 +11032,7 @@ function createTrackerSoundBank(samples, title, formatName, rootKey, attenuation
11115
11032
  bank.flush();
11116
11033
  return bank.writeSF2();
11117
11034
  }
11118
- //#endregion
11119
- //#region src/midi/read/tracker/tracker_pattern.ts
11035
+ // src/midi/read/tracker/tracker_pattern.ts
11120
11036
  /**
11121
11037
  * The number of bytes each pattern cell takes up.
11122
11038
  */
@@ -11177,8 +11093,7 @@ var TrackerPattern = class {
11177
11093
  return this.data[offset + 4];
11178
11094
  }
11179
11095
  };
11180
- //#endregion
11181
- //#region src/midi/read/tracker/tracker_module.ts
11096
+ // src/midi/read/tracker/tracker_module.ts
11182
11097
  /**
11183
11098
  * One MIDI tick is one tracker tick.
11184
11099
  * With 24 ticks per quarter note, the MIDI tempo in BPM equals the tracker tempo,
@@ -11223,7 +11138,7 @@ function emptyEnvelope() {
11223
11138
  function singleSampleInstrument(name, sampleIndex) {
11224
11139
  return {
11225
11140
  name,
11226
- sampleMap: new Int16Array(120).fill(sampleIndex),
11141
+ sampleMap: (/* @__PURE__ */ new Int16Array(120)).fill(sampleIndex),
11227
11142
  volumeEnvelope: emptyEnvelope(),
11228
11143
  panningEnvelope: emptyEnvelope(),
11229
11144
  fadeout: 0
@@ -11602,12 +11517,11 @@ var TrackerModule = class {
11602
11517
  output.controllerChange(ticks, MIDIControllers.pan, Math.min(127, Math.max(0, Math.round(64 + (angle - .5) * 128))));
11603
11518
  }
11604
11519
  };
11605
- //#endregion
11606
- //#region src/midi/read/tracker/protracker.ts
11520
+ // src/midi/read/tracker/protracker.ts
11607
11521
  /**
11608
11522
  * The Amiga PAL clock, multiplied by four as the periods are stored with four times the Amiga precision.
11609
11523
  */
11610
- const AMIGA_CLOCK = 3546895 * 4;
11524
+ const AMIGA_CLOCK = 14187580;
11611
11525
  /**
11612
11526
  * The ProTracker effects (also used by Fast Tracker).
11613
11527
  */
@@ -11716,7 +11630,7 @@ var ProTrackerModule = class ProTrackerModule extends TrackerModule {
11716
11630
  this.title = readBinaryString(binary, 20, 0).trim();
11717
11631
  this.setPreAmp(Math.min(128, Math.max(32, 256 / this.channelCount)));
11718
11632
  this.minPeriod = 452;
11719
- this.maxPeriod = 856 * 4;
11633
+ this.maxPeriod = 3424;
11720
11634
  for (let i = 0; i < this.channelCount; i++) this.channelPanning.push((i & 3) === 1 || (i & 3) === 2 ? 192 : 64);
11721
11635
  const sampleHeaders = new Array();
11722
11636
  const sampleNames = new Array();
@@ -11732,7 +11646,7 @@ var ProTrackerModule = class ProTrackerModule extends TrackerModule {
11732
11646
  });
11733
11647
  this.samples.push({
11734
11648
  name,
11735
- data: new Float32Array(0),
11649
+ data: /* @__PURE__ */ new Float32Array(0),
11736
11650
  loopType: TrackerLoopTypes.none,
11737
11651
  loopStart: 0,
11738
11652
  loopEnd: 0,
@@ -11874,9 +11788,7 @@ var ProTrackerModule = class ProTrackerModule extends TrackerModule {
11874
11788
  else if (param < 32) this.setSpeed(param);
11875
11789
  else this.setTempo(param);
11876
11790
  break;
11877
- case ProTrackerEffects.extended:
11878
- this.processExtendedEffect(channel, param >> 4, param & 15);
11879
- break;
11791
+ case ProTrackerEffects.extended: this.processExtendedEffect(channel, param >> 4, param & 15);
11880
11792
  }
11881
11793
  }
11882
11794
  /**
@@ -11918,9 +11830,7 @@ var ProTrackerModule = class ProTrackerModule extends TrackerModule {
11918
11830
  case ProTrackerExtendedEffects.noteDelay:
11919
11831
  channel.noteDelayTick = value;
11920
11832
  break;
11921
- case ProTrackerExtendedEffects.patternDelay:
11922
- this.setPatternDelay(value);
11923
- break;
11833
+ case ProTrackerExtendedEffects.patternDelay: this.setPatternDelay(value);
11924
11834
  }
11925
11835
  }
11926
11836
  /**
@@ -11971,9 +11881,7 @@ var ProTrackerModule = class ProTrackerModule extends TrackerModule {
11971
11881
  channel.sampleOffset = 0;
11972
11882
  }
11973
11883
  break;
11974
- case ProTrackerExtendedEffects.noteDelay:
11975
- if (this.tick === channel.noteDelayTick) this.playDelayedNote(channel);
11976
- break;
11884
+ case ProTrackerExtendedEffects.noteDelay: if (this.tick === channel.noteDelayTick) this.playDelayedNote(channel);
11977
11885
  }
11978
11886
  break;
11979
11887
  }
@@ -11996,8 +11904,7 @@ var ProTrackerModule = class ProTrackerModule extends TrackerModule {
11996
11904
  else channel.slideVolume(-(param & 15));
11997
11905
  }
11998
11906
  };
11999
- //#endregion
12000
- //#region src/midi/read/tracker/fasttracker.ts
11907
+ // src/midi/read/tracker/fasttracker.ts
12001
11908
  const XM_SIGNATURE = "Extended Module: ";
12002
11909
  /**
12003
11910
  * The reserved sample header byte that marks ModPlug ADPCM compressed samples.
@@ -12038,7 +11945,7 @@ const VolumeColumnCommands = {
12038
11945
  /**
12039
11946
  * The 256-step sine table of the automatic vibrato.
12040
11947
  */
12041
- const AUTO_VIBRATO_SINE = new Int8Array(256);
11948
+ const AUTO_VIBRATO_SINE = /* @__PURE__ */ new Int8Array(256);
12042
11949
  for (let i = 0; i < 256; i++) AUTO_VIBRATO_SINE[i] = Math.round(64 * Math.sin(i * Math.PI / 128));
12043
11950
  /**
12044
11951
  * Gets the value of an envelope at a position.
@@ -12223,7 +12130,7 @@ var FastTrackerModule = class extends ProTrackerModule {
12223
12130
  const sampleCount = readLittleEndian(binary, 2, offset + 27);
12224
12131
  const instrument = {
12225
12132
  name,
12226
- sampleMap: new Int16Array(120).fill(-1),
12133
+ sampleMap: (/* @__PURE__ */ new Int16Array(120)).fill(-1),
12227
12134
  volumeEnvelope: emptyEnvelope(),
12228
12135
  panningEnvelope: emptyEnvelope(),
12229
12136
  fadeout: 0
@@ -12270,7 +12177,7 @@ var FastTrackerModule = class extends ProTrackerModule {
12270
12177
  });
12271
12178
  this.samples.push({
12272
12179
  name: readBinaryString(binary, 22, offset + 18).trim() || (sampleCount > 1 && instrumentName ? `${instrumentName} ${s + 1}` : instrumentName),
12273
- data: new Float32Array(0),
12180
+ data: /* @__PURE__ */ new Float32Array(0),
12274
12181
  loopType: TrackerLoopTypes.none,
12275
12182
  loopStart: 0,
12276
12183
  loopEnd: 0,
@@ -12345,9 +12252,7 @@ var FastTrackerModule = class extends ProTrackerModule {
12345
12252
  case VolumeColumnCommands.panning:
12346
12253
  channel.panning = value << 4;
12347
12254
  break;
12348
- case VolumeColumnCommands.tonePortamento:
12349
- if (value) channel.tonePortamentoSpeed = (value << 4) * 4;
12350
- break;
12255
+ case VolumeColumnCommands.tonePortamento: if (value) channel.tonePortamentoSpeed = (value << 4) * 4;
12351
12256
  }
12352
12257
  const param = channel.rowParam = this.applyMemory(channel, effect, channel.rowParam);
12353
12258
  switch (effect) {
@@ -12364,10 +12269,8 @@ var FastTrackerModule = class extends ProTrackerModule {
12364
12269
  channel.volumeEnvelopeTick = param;
12365
12270
  channel.panningEnvelopeTick = param;
12366
12271
  break;
12367
- case FastTrackerEffects.extraFinePortamento:
12368
- if (param >> 4 === 1) this.slidePeriod(channel, -(param & 15));
12369
- else if (param >> 4 === 2) this.slidePeriod(channel, param & 15);
12370
- 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);
12371
12274
  }
12372
12275
  if (effect === ProTrackerEffects.vibrato || effect === ProTrackerEffects.vibratoVolumeSlide || volumeCommand === VolumeColumnCommands.vibrato) channel.vibrato(16, false);
12373
12276
  else channel.vibratoDelta = 0;
@@ -12391,9 +12294,7 @@ var FastTrackerModule = class extends ProTrackerModule {
12391
12294
  case VolumeColumnCommands.panningSlideRight:
12392
12295
  channel.slidePanning(value);
12393
12296
  break;
12394
- case VolumeColumnCommands.tonePortamento:
12395
- channel.tonePortamento();
12396
- break;
12297
+ case VolumeColumnCommands.tonePortamento: channel.tonePortamento();
12397
12298
  }
12398
12299
  const effect = channel.rowEffect;
12399
12300
  const param = channel.rowParam;
@@ -12419,9 +12320,7 @@ var FastTrackerModule = class extends ProTrackerModule {
12419
12320
  case FastTrackerEffects.multiRetrigger:
12420
12321
  channel.multiRetrigger(param);
12421
12322
  break;
12422
- case FastTrackerEffects.tremor:
12423
- channel.tremor(param);
12424
- break;
12323
+ case FastTrackerEffects.tremor: channel.tremor(param);
12425
12324
  }
12426
12325
  }
12427
12326
  playRowNote(channel) {
@@ -12430,14 +12329,16 @@ var FastTrackerModule = class extends ProTrackerModule {
12430
12329
  if (instrumentNumber) channel.instrument = this.instruments[instrumentNumber - 1];
12431
12330
  const isPortamento = channel.rowEffect === ProTrackerEffects.tonePortamento || channel.rowEffect === ProTrackerEffects.tonePortamentoVolumeSlide || channel.rowVolume >> 4 === VolumeColumnCommands.tonePortamento;
12432
12331
  if (note === 254) this.keyOff(channel);
12433
- else if (note !== 0) if (isPortamento && channel.sample) channel.targetPeriod = this.noteToPeriod(note, channel);
12434
- else {
12435
- const sample = this.selectSample(channel, note);
12436
- if (sample) {
12437
- const param = channel.rowParam;
12438
- channel.finetune = channel.rowEffect === ProTrackerEffects.extended && param >> 4 === ProTrackerExtendedEffects.finetune ? ((param & 15) - 8) * 16 : sample.finetune;
12439
- this.triggerNote(channel, note);
12440
- } 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
+ }
12441
12342
  }
12442
12343
  if (instrumentNumber && channel.sample && note !== 254) {
12443
12344
  channel.volume = channel.sample.volume;
@@ -12482,9 +12383,7 @@ var FastTrackerModule = class extends ProTrackerModule {
12482
12383
  case 2:
12483
12384
  value = (64 - (position >> 1) & 127) - 64;
12484
12385
  break;
12485
- case 3:
12486
- value = (64 + (position >> 1) & 127) - 64;
12487
- break;
12386
+ case 3: value = (64 + (position >> 1) & 127) - 64;
12488
12387
  }
12489
12388
  channel.autoVibratoDelta = value * depth / 64;
12490
12389
  } else channel.autoVibratoDelta = 0;
@@ -12579,8 +12478,7 @@ var FastTrackerModule = class extends ProTrackerModule {
12579
12478
  }
12580
12479
  }
12581
12480
  };
12582
- //#endregion
12583
- //#region src/midi/read/tracker/screamtracker.ts
12481
+ // src/midi/read/tracker/screamtracker.ts
12584
12482
  /**
12585
12483
  * The Scream Tracker effects (letters converted to numbers, A = 1).
12586
12484
  */
@@ -12622,7 +12520,7 @@ const ScreamTrackerExtendedEffects = {
12622
12520
  /**
12623
12521
  * The effects that share a single parameter memory in Scream Tracker 3.
12624
12522
  */
12625
- const SHARED_MEMORY_EFFECTS = new Set([
12523
+ const SHARED_MEMORY_EFFECTS = /* @__PURE__ */ new Set([
12626
12524
  ScreamTrackerEffects.volumeSlide,
12627
12525
  ScreamTrackerEffects.portamentoDown,
12628
12526
  ScreamTrackerEffects.portamentoUp,
@@ -12712,7 +12610,7 @@ var ScreamTrackerModule = class extends TrackerModule {
12712
12610
  const parapointers = 96 + orderCount;
12713
12611
  const panningTable = parapointers + instrumentCount * 2 + patternCount * 2;
12714
12612
  const hasPanningTable = binary[53] === 252;
12715
- const channelMap = new Int8Array(32).fill(-1);
12613
+ const channelMap = (/* @__PURE__ */ new Int8Array(32)).fill(-1);
12716
12614
  for (let i = 0; i < 32; i++) {
12717
12615
  const setting = binary[64 + i];
12718
12616
  if (setting >= 16) continue;
@@ -12737,7 +12635,7 @@ var ScreamTrackerModule = class extends TrackerModule {
12737
12635
  const c2spd = readLittleEndian(binary, 4, offset + 32) || 8363;
12738
12636
  this.samples.push({
12739
12637
  name,
12740
- data: new Float32Array(0),
12638
+ data: /* @__PURE__ */ new Float32Array(0),
12741
12639
  loopType: TrackerLoopTypes.none,
12742
12640
  loopStart: 0,
12743
12641
  loopEnd: 0,
@@ -12825,8 +12723,10 @@ var ScreamTrackerModule = class extends TrackerModule {
12825
12723
  processRow(channel) {
12826
12724
  const effect = channel.rowEffect;
12827
12725
  channel.tremorMuted = false;
12828
- if (SHARED_MEMORY_EFFECTS.has(effect)) if (channel.rowParam) this.sharedMemory[channel.index] = channel.rowParam;
12829
- 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
+ }
12830
12730
  const param = channel.rowParam;
12831
12731
  if (!(effect === ScreamTrackerEffects.extended && param >> 4 === ScreamTrackerExtendedEffects.noteDelay && (param & 15) > 0)) this.playRowNote(channel);
12832
12732
  switch (effect) {
@@ -12882,9 +12782,7 @@ var ScreamTrackerModule = class extends TrackerModule {
12882
12782
  case ScreamTrackerEffects.panning:
12883
12783
  if (param <= 128) channel.panning = Math.min(255, param * 2);
12884
12784
  break;
12885
- case ScreamTrackerEffects.extended:
12886
- this.processExtendedEffect(channel, param >> 4, param & 15);
12887
- break;
12785
+ case ScreamTrackerEffects.extended: this.processExtendedEffect(channel, param >> 4, param & 15);
12888
12786
  }
12889
12787
  if (effect !== ScreamTrackerEffects.vibrato && effect !== ScreamTrackerEffects.fineVibrato && effect !== ScreamTrackerEffects.vibratoVolumeSlide) channel.vibratoDelta = 0;
12890
12788
  }
@@ -12928,9 +12826,7 @@ var ScreamTrackerModule = class extends TrackerModule {
12928
12826
  case ScreamTrackerEffects.tremolo:
12929
12827
  channel.tremolo(64);
12930
12828
  break;
12931
- case ScreamTrackerEffects.extended:
12932
- if (param >> 4 === ScreamTrackerExtendedEffects.noteDelay && this.tick === channel.noteDelayTick) this.playRowNote(channel);
12933
- break;
12829
+ case ScreamTrackerEffects.extended: if (param >> 4 === ScreamTrackerExtendedEffects.noteDelay && this.tick === channel.noteDelayTick) this.playRowNote(channel);
12934
12830
  }
12935
12831
  }
12936
12832
  /**
@@ -12986,9 +12882,7 @@ var ScreamTrackerModule = class extends TrackerModule {
12986
12882
  case ScreamTrackerExtendedEffects.noteDelay:
12987
12883
  channel.noteDelayTick = value;
12988
12884
  break;
12989
- case ScreamTrackerExtendedEffects.patternDelay:
12990
- this.setPatternDelay(value);
12991
- break;
12885
+ case ScreamTrackerExtendedEffects.patternDelay: this.setPatternDelay(value);
12992
12886
  }
12993
12887
  }
12994
12888
  /**
@@ -13017,8 +12911,7 @@ var ScreamTrackerModule = class extends TrackerModule {
13017
12911
  } else if (!firstTick || this.fastVolumeSlides) channel.slideVolume(down ? -down : up);
13018
12912
  }
13019
12913
  };
13020
- //#endregion
13021
- //#region src/midi/read/tracker/load_tracker_module.ts
12914
+ // src/midi/read/tracker/load_tracker_module.ts
13022
12915
  /**
13023
12916
  * Detects a tracker module and converts it into the given MIDI.
13024
12917
  * @param outputMIDI The MIDI to populate.
@@ -13036,8 +12929,7 @@ function loadTrackerModule(outputMIDI, binary, fileName) {
13036
12929
  module.toMIDI(outputMIDI, fileName);
13037
12930
  return true;
13038
12931
  }
13039
- //#endregion
13040
- //#region src/midi/write/midi.ts
12932
+ // src/midi/write/midi.ts
13041
12933
  const writeText = (text, arr) => {
13042
12934
  for (let i = 0; i < text.length; i++) arr.push(text.charCodeAt(i));
13043
12935
  };
@@ -13096,8 +12988,7 @@ function writeMIDIInternal(midi) {
13096
12988
  }
13097
12989
  return new Uint8Array(binaryData).buffer;
13098
12990
  }
13099
- //#endregion
13100
- //#region src/midi/write/rmidi.ts
12991
+ // src/midi/write/rmidi.ts
13101
12992
  const DEFAULT_COPYRIGHT = "Created using SpessaSynth";
13102
12993
  /**
13103
12994
  * Add the offset to the bank.
@@ -13334,9 +13225,7 @@ function writeRMIDIInternal(mid, soundBankBinary, options) {
13334
13225
  case "subject":
13335
13226
  writeInfo("ISBJ", data);
13336
13227
  break;
13337
- case "midiEncoding":
13338
- writeInfo("MENC", data);
13339
- break;
13228
+ case "midiEncoding": writeInfo("MENC", data);
13340
13229
  }
13341
13230
  }
13342
13231
  const DBNK = new IndexedByteArray(2);
@@ -13351,8 +13240,7 @@ function writeRMIDIInternal(mid, soundBankBinary, options) {
13351
13240
  new IndexedByteArray(soundBankBinary)
13352
13241
  ]).buffer;
13353
13242
  }
13354
- //#endregion
13355
- //#region src/midi/basic_midi.ts
13243
+ // src/midi/basic_midi.ts
13356
13244
  /**
13357
13245
  * BasicMIDI is the base of a complete MIDI file.
13358
13246
  * It represents a single MIDI sequence, with an optional sound bank attached to it.
@@ -13580,7 +13468,6 @@ var BasicMIDI = class BasicMIDI {
13580
13468
  default:
13581
13469
  if (initialString !== "MThd" && loadTrackerModule(mid, binaryData, fileName)) break;
13582
13470
  parseSMFInternal(mid, binaryData, fileName);
13583
- break;
13584
13471
  }
13585
13472
  return mid;
13586
13473
  }
@@ -14156,13 +14043,14 @@ var BasicMIDI = class BasicMIDI {
14156
14043
  this.isKaraokeFile = true;
14157
14044
  SpessaLog.info("%cKaraoke MIDI detected!", ConsoleColors.recognized);
14158
14045
  } else if (this.isKaraokeFile) {
14159
- if (checkedText.startsWith("@T") || checkedText.startsWith("@A")) if (karaokeHasTitle) this.extraMetadata.push(e);
14160
- else {
14161
- this.binaryName = e.data.slice(2);
14162
- karaokeHasTitle = true;
14163
- nameDetected = true;
14164
- }
14165
- 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);
14166
14054
  }
14167
14055
  break;
14168
14056
  }
@@ -14246,14 +14134,16 @@ var BasicMIDI = class BasicMIDI {
14246
14134
  this.isMultiPort = true;
14247
14135
  SpessaLog.info(`%cMIDI Ports detected!`, ConsoleColors.recognized);
14248
14136
  }
14249
- if (!nameDetected && this.tracks.length > 0) if (this.tracks.length > 1) {
14250
- 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 {
14251
14144
  const name = this.tracks[0].events.find((message) => message.statusByte === MIDIMessageTypes.trackName);
14252
14145
  if (name) this.binaryName = name.data;
14253
14146
  }
14254
- } else {
14255
- const name = this.tracks[0].events.find((message) => message.statusByte === MIDIMessageTypes.trackName);
14256
- if (name) this.binaryName = name.data;
14257
14147
  }
14258
14148
  this.extraMetadata = this.extraMetadata.filter((c) => c.data.length > 0);
14259
14149
  this.lyrics.sort((a, b) => a.ticks - b.ticks);
@@ -14271,8 +14161,7 @@ var BasicMIDI = class BasicMIDI {
14271
14161
  SpessaLog.groupEnd();
14272
14162
  }
14273
14163
  };
14274
- //#endregion
14275
- //#region src/midi/midi_tools/midi_builder.ts
14164
+ // src/midi/midi_tools/midi_builder.ts
14276
14165
  const DEFAULT_MIDI_BUILDER_OPTIONS = {
14277
14166
  name: "Untitled song",
14278
14167
  timeDivision: 480,
@@ -14477,8 +14366,7 @@ var MIDIBuilder = class extends BasicMIDI {
14477
14366
  this.controllerChange(ticks, track, channel, MIDIControllers.dataEntryLSB, value & 127);
14478
14367
  }
14479
14368
  };
14480
- //#endregion
14481
- //#region src/sequencer/process_event.ts
14369
+ // src/sequencer/process_event.ts
14482
14370
  /**
14483
14371
  * Processes a MIDI event.
14484
14372
  * @param event The MIDI event to process.
@@ -14577,17 +14465,14 @@ function processEventInternal(event, trackIndex) {
14577
14465
  case MIDIMessageTypes.reset:
14578
14466
  this.synth.reset();
14579
14467
  break;
14580
- default:
14581
- SpessaLog.info(`%cUnrecognized Event: %c${event.statusByte.toString(16)}`, ConsoleColors.warn, ConsoleColors.unrecognized);
14582
- break;
14468
+ default: SpessaLog.info(`%cUnrecognized Event: %c${event.statusByte.toString(16)}`, ConsoleColors.warn, ConsoleColors.unrecognized);
14583
14469
  }
14584
14470
  if (status >= 0 && status < 128) this.callEvent("metaEvent", {
14585
14471
  event,
14586
14472
  trackIndex
14587
14473
  });
14588
14474
  }
14589
- //#endregion
14590
- //#region src/sequencer/process_tick.ts
14475
+ // src/sequencer/process_tick.ts
14591
14476
  /**
14592
14477
  * Processes a single MIDI tick.
14593
14478
  * Call this every rendering quantum to process the sequencer events in real-time.
@@ -14622,8 +14507,7 @@ function processTick() {
14622
14507
  this.playedTime += this.oneTickToSeconds * (nextEvent.ticks - event.ticks);
14623
14508
  }
14624
14509
  }
14625
- //#endregion
14626
- //#region src/sequencer/load_new_sequence.ts
14510
+ // src/sequencer/load_new_sequence.ts
14627
14511
  /**
14628
14512
  * Assigns a MIDI port channel offset to a track.
14629
14513
  * @param trackNum The track number to assign the port to.
@@ -14675,9 +14559,8 @@ function loadNewSequenceInternal(parsedMIDI) {
14675
14559
  }
14676
14560
  this.currentTime = 0;
14677
14561
  }
14678
- //#endregion
14679
- //#region src/sequencer/set_time_to.ts
14680
- const nonSkippableCCs = new Set([
14562
+ // src/sequencer/set_time_to.ts
14563
+ const nonSkippableCCs = /* @__PURE__ */ new Set([
14681
14564
  MIDIControllers.dataDecrement,
14682
14565
  MIDIControllers.dataIncrement,
14683
14566
  MIDIControllers.dataEntryMSB,
@@ -14822,9 +14705,7 @@ function setTimeToInternal(time, ticks = void 0) {
14822
14705
  savedTempoTrack = trackIndex;
14823
14706
  break;
14824
14707
  }
14825
- default:
14826
- this.processEvent(event, trackIndex);
14827
- break;
14708
+ default: this.processEvent(event, trackIndex);
14828
14709
  }
14829
14710
  const nE = timeline[++this.index];
14830
14711
  if (nE === void 0) {
@@ -14838,8 +14719,10 @@ function setTimeToInternal(time, ticks = void 0) {
14838
14719
  for (let channel = 0; channel < channelsToRestore; channel++) {
14839
14720
  const ch = channels[channel] ?? createChannelStatus(channel);
14840
14721
  this.sendMIDIPitchWheel(channel, ch.pitchWheel);
14841
- if (ch.portamentoNote >= 0) if (this.externalMIDIPlayback) this.sendMIDICC(channel, MIDIControllers.portamentoControl, ch.portamentoNote);
14842
- 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
+ }
14843
14726
  for (let i = 0; i < 128; i++) {
14844
14727
  const value = ch.controllers[i];
14845
14728
  if (value !== DEFAULT_MIDI_CONTROLLERS[i] && !nonSkippableCCs.has(i)) this.sendMIDICC(channel, i, value >> 7);
@@ -14852,8 +14735,7 @@ function setTimeToInternal(time, ticks = void 0) {
14852
14735
  if (this.paused) this.pausedTime = this.playedTime;
14853
14736
  return true;
14854
14737
  }
14855
- //#endregion
14856
- //#region src/sequencer/sequencer.ts
14738
+ // src/sequencer/sequencer.ts
14857
14739
  /**
14858
14740
  * This module is responsible for playing back {@link BasicMIDI} sequences to {@link SpessaSynthProcessor}.
14859
14741
  *
@@ -15094,9 +14976,10 @@ var SpessaSynthSequencer = class {
15094
14976
  set currentTime(time) {
15095
14977
  if (!this._midiData) return;
15096
14978
  if (this.paused) this.pausedTime = time;
15097
- if (time > this._midiData.duration || time < 0) if (this.skipToFirstNoteOn) this.setTimeTicks(this._midiData.firstNoteOn - 1);
15098
- else this.setTimeTicks(0);
15099
- 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) {
15100
14983
  this.setTimeTicks(this._midiData.firstNoteOn - 1);
15101
14984
  return;
15102
14985
  } else {
@@ -15371,8 +15254,7 @@ var SpessaSynthSequencer = class {
15371
15254
  ], channel - midiChannel);
15372
15255
  }
15373
15256
  };
15374
- //#endregion
15375
- //#region src/synthesizer/audio_engine/effects/xg/implementation/dsp/no_effect.ts
15257
+ // src/synthesizer/audio_engine/effects/xg/implementation/dsp/no_effect.ts
15376
15258
  /**
15377
15259
  * MU128 manual description:
15378
15260
  * Turn off the effect.
@@ -15387,11 +15269,10 @@ var XGNoEffect = class {
15387
15269
  }
15388
15270
  reset() {}
15389
15271
  getSnapshot() {
15390
- return new Int16Array(16);
15272
+ return /* @__PURE__ */ new Int16Array(16);
15391
15273
  }
15392
15274
  };
15393
- //#endregion
15394
- //#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
15395
15276
  /**
15396
15277
  * Coefficient word format per variation category * 192 + coefficient index. -1 means unused.
15397
15278
  */
@@ -17378,8 +17259,7 @@ const DELAY_OFFSET = new Uint16Array([
17378
17259
  484,
17379
17260
  500
17380
17261
  ]);
17381
- //#endregion
17382
- //#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
17383
17263
  /**
17384
17264
  * The sample rate the XG DSP programs are designed for.
17385
17265
  */
@@ -17452,7 +17332,7 @@ function getMemorySize(sampleRate, size) {
17452
17332
  while (powerOfTwo < length) powerOfTwo <<= 1;
17453
17333
  return powerOfTwo;
17454
17334
  }
17455
- const chopFloat = new Float32Array(1);
17335
+ const chopFloat = /* @__PURE__ */ new Float32Array(1);
17456
17336
  const chopBits = new Int32Array(chopFloat.buffer);
17457
17337
  /**
17458
17338
  * Rounds toward zero to float32.
@@ -17508,7 +17388,7 @@ var XGDSPProgram = class {
17508
17388
  /**
17509
17389
  * The raw XG parameter values.
17510
17390
  */
17511
- params = new Int16Array(16);
17391
+ params = /* @__PURE__ */ new Int16Array(16);
17512
17392
  /**
17513
17393
  * The coefficient word RAM.
17514
17394
  */
@@ -17560,7 +17440,7 @@ var XGDSPProgram = class {
17560
17440
  /**
17561
17441
  * The first-order filter designer output (b0, b1, a1).
17562
17442
  */
17563
- firstOrder = new Float64Array(3);
17443
+ firstOrder = /* @__PURE__ */ new Float64Array(3);
17564
17444
  addressScale;
17565
17445
  tickLength;
17566
17446
  tickCounter = 0;
@@ -17824,8 +17704,10 @@ var XGDSPProgram = class {
17824
17704
  const err1 = Math.trunc(r1) - e1;
17825
17705
  const sum = err0 + err1;
17826
17706
  if (sum >= -.5) {
17827
- if (sum > .5) if (err0 <= err1) r1--;
17828
- else r0--;
17707
+ if (sum > .5) {
17708
+ if (err0 <= err1) r1--;
17709
+ else r0--;
17710
+ }
17829
17711
  } else if (err0 > err1) r1++;
17830
17712
  else r0++;
17831
17713
  const a = biasedRound(Math.fround(a1 * 512));
@@ -17966,18 +17848,24 @@ var XGDSPProgram = class {
17966
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;
17967
17849
  const sum = e1 + e0 + e2;
17968
17850
  if (sum >= -.5) {
17969
- if (sum > .5) if (e1 <= e2) if (e0 <= e2) r2--;
17970
- else r0--;
17971
- else if (e0 <= e1) r1--;
17972
- else r0--;
17973
- } else if (e1 > e2) if (e0 > e2) r2++;
17974
- else r0++;
17975
- 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++;
17976
17862
  else r0++;
17977
17863
  const poles = e3 + e4;
17978
17864
  if (poles >= -.5) {
17979
- if (poles > .5) if (e3 <= e4) r4--;
17980
- else r3--;
17865
+ if (poles > .5) {
17866
+ if (e3 <= e4) r4--;
17867
+ else r3--;
17868
+ }
17981
17869
  } else if (e3 > e4) r4++;
17982
17870
  else r3++;
17983
17871
  const w = this.coefficientWords;
@@ -17989,8 +17877,7 @@ var XGDSPProgram = class {
17989
17877
  this.pushCoefficients(list, 5);
17990
17878
  }
17991
17879
  };
17992
- //#endregion
17993
- //#region src/synthesizer/audio_engine/effects/xg/implementation/effect.ts
17880
+ // src/synthesizer/audio_engine/effects/xg/implementation/effect.ts
17994
17881
  /**
17995
17882
  * The default implementation for {@link XGEffectBlock}.
17996
17883
  *
@@ -18063,13 +17950,12 @@ var DefaultXGEffect = class {
18063
17950
  for (let i = 0; i < 16 && i < params.length; i++) this.setParameter(i, params[i]);
18064
17951
  }
18065
17952
  };
18066
- //#endregion
18067
- //#region src/synthesizer/audio_engine/effects/xg/implementation/system_effect.ts
17953
+ // src/synthesizer/audio_engine/effects/xg/implementation/system_effect.ts
18068
17954
  const MIN_PAN$2 = 1;
18069
17955
  const MAX_PAN$2 = 127;
18070
- const PAN_RESOLUTION$2 = MAX_PAN$2 - MIN_PAN$2;
18071
- const panTableLeft$1 = new Float32Array(PAN_RESOLUTION$2 + 1);
18072
- 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);
18073
17959
  for (let pan = MIN_PAN$2; pan <= MAX_PAN$2; pan++) {
18074
17960
  const realPan = (pan - MIN_PAN$2) / PAN_RESOLUTION$2;
18075
17961
  const tableIndex = pan - MIN_PAN$2;
@@ -18122,8 +18008,7 @@ var DefaultXGSystemEffect = class extends DefaultXGEffect {
18122
18008
  }
18123
18009
  }
18124
18010
  };
18125
- //#endregion
18126
- //#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
18127
18012
  /**
18128
18013
  * Reverb time to damping table index.
18129
18014
  */
@@ -19186,8 +19071,7 @@ const ROOM_STEP = new Uint8Array([
19186
19071
  2,
19187
19072
  64
19188
19073
  ]);
19189
- //#endregion
19190
- //#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
19191
19075
  const COEFFICIENT_LIST$2 = [
19192
19076
  27,
19193
19077
  28,
@@ -19558,7 +19442,6 @@ var XGReverb = class extends XGDSPProgram {
19558
19442
  case 14:
19559
19443
  this.coefficientWords[51] = this.feedbackWord(p[14]);
19560
19444
  this.pushCoefficients(LIST_FEEDBACK$1);
19561
- break;
19562
19445
  }
19563
19446
  }
19564
19447
  /**
@@ -19698,9 +19581,7 @@ var XGRoomReverb = class extends XGReverb {
19698
19581
  this.roomDimension(2, ROOM_STEP[this.preset.roomStep + 1], p[7], 2);
19699
19582
  if (this.preset.wall === "depth") this.wall();
19700
19583
  break;
19701
- case 8:
19702
- this.wall();
19703
- break;
19584
+ case 8: this.wall();
19704
19585
  }
19705
19586
  }
19706
19587
  /**
@@ -19787,8 +19668,7 @@ var XGRoomReverb = class extends XGReverb {
19787
19668
  this.pushCoefficients(LIST_TIME, 3, 9);
19788
19669
  }
19789
19670
  };
19790
- //#endregion
19791
- //#region src/synthesizer/audio_engine/effects/xg/implementation/dsp/reverb/basement.ts
19671
+ // src/synthesizer/audio_engine/effects/xg/implementation/dsp/reverb/basement.ts
19792
19672
  /**
19793
19673
  * BASEMENT (`13 00`) in the reverb block.
19794
19674
  */
@@ -19895,8 +19775,7 @@ var XGBasement = class extends XGRoomReverb {
19895
19775
  wall: "height"
19896
19776
  };
19897
19777
  };
19898
- //#endregion
19899
- //#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
19900
19779
  /**
19901
19780
  * GM PLATE (`04 07`) in the reverb block.
19902
19781
  */
@@ -20000,8 +19879,7 @@ var XGGMPlate = class extends XGReverb {
20000
19879
  hpfGain: -2
20001
19880
  };
20002
19881
  };
20003
- //#endregion
20004
- //#region src/synthesizer/audio_engine/effects/xg/implementation/dsp/reverb/hall1.ts
19882
+ // src/synthesizer/audio_engine/effects/xg/implementation/dsp/reverb/hall1.ts
20005
19883
  /**
20006
19884
  * HALL 1 (`01 00`) in the reverb block.
20007
19885
  */
@@ -20105,8 +19983,7 @@ var XGHall1 = class extends XGReverb {
20105
19983
  hpfGain: 2
20106
19984
  };
20107
19985
  };
20108
- //#endregion
20109
- //#region src/synthesizer/audio_engine/effects/xg/implementation/dsp/reverb/hall2.ts
19986
+ // src/synthesizer/audio_engine/effects/xg/implementation/dsp/reverb/hall2.ts
20110
19987
  /**
20111
19988
  * HALL 2 (`01 01`) in the reverb block.
20112
19989
  */
@@ -20210,8 +20087,7 @@ var XGHall2 = class extends XGReverb {
20210
20087
  hpfGain: -1
20211
20088
  };
20212
20089
  };
20213
- //#endregion
20214
- //#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
20215
20091
  /**
20216
20092
  * HALL L (`01 07`) in the reverb block.
20217
20093
  */
@@ -20315,8 +20191,7 @@ var XGHallL = class extends XGReverb {
20315
20191
  hpfGain: -1
20316
20192
  };
20317
20193
  };
20318
- //#endregion
20319
- //#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
20320
20195
  /**
20321
20196
  * HALL M (`01 06`) in the reverb block.
20322
20197
  */
@@ -20420,8 +20295,7 @@ var XGHallM = class extends XGReverb {
20420
20295
  hpfGain: 2
20421
20296
  };
20422
20297
  };
20423
- //#endregion
20424
- //#region src/synthesizer/audio_engine/effects/xg/implementation/dsp/reverb/plate.ts
20298
+ // src/synthesizer/audio_engine/effects/xg/implementation/dsp/reverb/plate.ts
20425
20299
  /**
20426
20300
  * PLATE (`04 00`) in the reverb block.
20427
20301
  */
@@ -20525,8 +20399,7 @@ var XGPlate = class extends XGReverb {
20525
20399
  hpfGain: -2
20526
20400
  };
20527
20401
  };
20528
- //#endregion
20529
- //#region src/synthesizer/audio_engine/effects/xg/implementation/dsp/reverb/room1.ts
20402
+ // src/synthesizer/audio_engine/effects/xg/implementation/dsp/reverb/room1.ts
20530
20403
  /**
20531
20404
  * ROOM 1 (`02 00`) in the reverb block.
20532
20405
  */
@@ -20630,8 +20503,7 @@ var XGRoom1 = class extends XGReverb {
20630
20503
  hpfGain: -1
20631
20504
  };
20632
20505
  };
20633
- //#endregion
20634
- //#region src/synthesizer/audio_engine/effects/xg/implementation/dsp/reverb/room2.ts
20506
+ // src/synthesizer/audio_engine/effects/xg/implementation/dsp/reverb/room2.ts
20635
20507
  /**
20636
20508
  * ROOM 2 (`02 01`) in the reverb block.
20637
20509
  */
@@ -20735,8 +20607,7 @@ var XGRoom2 = class extends XGReverb {
20735
20607
  hpfGain: 0
20736
20608
  };
20737
20609
  };
20738
- //#endregion
20739
- //#region src/synthesizer/audio_engine/effects/xg/implementation/dsp/reverb/room3.ts
20610
+ // src/synthesizer/audio_engine/effects/xg/implementation/dsp/reverb/room3.ts
20740
20611
  /**
20741
20612
  * ROOM 3 (`02 02`) in the reverb block.
20742
20613
  */
@@ -20840,8 +20711,7 @@ var XGRoom3 = class extends XGReverb {
20840
20711
  hpfGain: 0
20841
20712
  };
20842
20713
  };
20843
- //#endregion
20844
- //#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
20845
20715
  /**
20846
20716
  * ROOM L (`02 07`) in the reverb block.
20847
20717
  */
@@ -20945,8 +20815,7 @@ var XGRoomL = class extends XGReverb {
20945
20815
  hpfGain: 0
20946
20816
  };
20947
20817
  };
20948
- //#endregion
20949
- //#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
20950
20819
  /**
20951
20820
  * ROOM M (`02 06`) in the reverb block.
20952
20821
  */
@@ -21050,8 +20919,7 @@ var XGRoomM = class extends XGReverb {
21050
20919
  hpfGain: -1
21051
20920
  };
21052
20921
  };
21053
- //#endregion
21054
- //#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
21055
20923
  /**
21056
20924
  * ROOM S (`02 05`) in the reverb block.
21057
20925
  */
@@ -21155,8 +21023,7 @@ var XGRoomS = class extends XGReverb {
21155
21023
  hpfGain: 0
21156
21024
  };
21157
21025
  };
21158
- //#endregion
21159
- //#region src/synthesizer/audio_engine/effects/xg/implementation/dsp/reverb/stage1.ts
21026
+ // src/synthesizer/audio_engine/effects/xg/implementation/dsp/reverb/stage1.ts
21160
21027
  /**
21161
21028
  * STAGE 1 (`03 00`) in the reverb block.
21162
21029
  */
@@ -21260,8 +21127,7 @@ var XGStage1 = class extends XGReverb {
21260
21127
  hpfGain: -1
21261
21128
  };
21262
21129
  };
21263
- //#endregion
21264
- //#region src/synthesizer/audio_engine/effects/xg/implementation/dsp/reverb/stage2.ts
21130
+ // src/synthesizer/audio_engine/effects/xg/implementation/dsp/reverb/stage2.ts
21265
21131
  /**
21266
21132
  * STAGE 2 (`03 01`) in the reverb block.
21267
21133
  */
@@ -21365,8 +21231,7 @@ var XGStage2 = class extends XGReverb {
21365
21231
  hpfGain: -2
21366
21232
  };
21367
21233
  };
21368
- //#endregion
21369
- //#region src/synthesizer/audio_engine/effects/xg/implementation/dsp/reverb/tunnel.ts
21234
+ // src/synthesizer/audio_engine/effects/xg/implementation/dsp/reverb/tunnel.ts
21370
21235
  /**
21371
21236
  * TUNNEL (`11 00`) in the reverb block.
21372
21237
  */
@@ -21473,8 +21338,7 @@ var XGTunnel = class extends XGRoomReverb {
21473
21338
  wall: "depth"
21474
21339
  };
21475
21340
  };
21476
- //#endregion
21477
- //#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
21478
21342
  /**
21479
21343
  * WHITE ROOM (`10 00`) in the reverb block.
21480
21344
  */
@@ -21581,9 +21445,8 @@ var XGWhiteRoom = class extends XGRoomReverb {
21581
21445
  wall: "height"
21582
21446
  };
21583
21447
  };
21584
- //#endregion
21585
- //#region src/synthesizer/audio_engine/effects/xg/implementation/reverb.ts
21586
- const REVERB_MAP = new Map([
21448
+ // src/synthesizer/audio_engine/effects/xg/implementation/reverb.ts
21449
+ const REVERB_MAP = /* @__PURE__ */ new Map([
21587
21450
  [0, XGNoEffect],
21588
21451
  [256, XGHall1],
21589
21452
  [257, XGHall2],
@@ -21624,8 +21487,7 @@ var DefaultXGReverb = class extends DefaultXGSystemEffect {
21624
21487
  this.mixSystemEffect(outputLeft, outputRight, startIndex, sampleCount);
21625
21488
  }
21626
21489
  };
21627
- //#endregion
21628
- //#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
21629
21491
  const COEFFICIENT_LIST$1 = [
21630
21492
  9,
21631
21493
  10,
@@ -21801,7 +21663,7 @@ var XGChorusBase = class extends XGDSPProgram {
21801
21663
  */
21802
21664
  inputLeft;
21803
21665
  inputRight;
21804
- equalizerState = new Float64Array(6);
21666
+ equalizerState = /* @__PURE__ */ new Float64Array(6);
21805
21667
  constructor(sampleRate, maxBufferSize, memory, variation) {
21806
21668
  super(sampleRate, maxBufferSize, memory, 0);
21807
21669
  this.variation = variation;
@@ -21900,9 +21762,7 @@ var XGChorusBase = class extends XGDSPProgram {
21900
21762
  case 40:
21901
21763
  this.depthRight = Math.trunc(c[40] * depthScale);
21902
21764
  break;
21903
- case 55:
21904
- this.depthThird = Math.trunc(c[55] * depthScale);
21905
- break;
21765
+ case 55: this.depthThird = Math.trunc(c[55] * depthScale);
21906
21766
  }
21907
21767
  }
21908
21768
  convert(param) {
@@ -22042,8 +21902,7 @@ var XGFlanger = class extends XGChorusBase {
22042
21902
  return this.feedbackWord(this.params[2]);
22043
21903
  }
22044
21904
  };
22045
- //#endregion
22046
- //#region src/synthesizer/audio_engine/effects/xg/implementation/dsp/chorus/celeste1.ts
21905
+ // src/synthesizer/audio_engine/effects/xg/implementation/dsp/chorus/celeste1.ts
22047
21906
  /**
22048
21907
  * CELESTE 1 (`42 00`).
22049
21908
  */
@@ -22111,8 +21970,7 @@ var XGCeleste1 = class extends XGCeleste {
22111
21970
  variationGain: 48
22112
21971
  };
22113
21972
  };
22114
- //#endregion
22115
- //#region src/synthesizer/audio_engine/effects/xg/implementation/dsp/chorus/celeste2.ts
21973
+ // src/synthesizer/audio_engine/effects/xg/implementation/dsp/chorus/celeste2.ts
22116
21974
  /**
22117
21975
  * CELESTE 2 (`42 01`).
22118
21976
  */
@@ -22180,8 +22038,7 @@ var XGCeleste2 = class extends XGCeleste {
22180
22038
  variationGain: 48
22181
22039
  };
22182
22040
  };
22183
- //#endregion
22184
- //#region src/synthesizer/audio_engine/effects/xg/implementation/dsp/chorus/celeste3.ts
22041
+ // src/synthesizer/audio_engine/effects/xg/implementation/dsp/chorus/celeste3.ts
22185
22042
  /**
22186
22043
  * CELESTE 3 (`42 02`).
22187
22044
  */
@@ -22249,8 +22106,7 @@ var XGCeleste3 = class extends XGCeleste {
22249
22106
  variationGain: 48
22250
22107
  };
22251
22108
  };
22252
- //#endregion
22253
- //#region src/synthesizer/audio_engine/effects/xg/implementation/dsp/chorus/celeste4.ts
22109
+ // src/synthesizer/audio_engine/effects/xg/implementation/dsp/chorus/celeste4.ts
22254
22110
  /**
22255
22111
  * CELESTE 4 (`42 08`).
22256
22112
  */
@@ -22318,8 +22174,7 @@ var XGCeleste4 = class extends XGCeleste {
22318
22174
  variationGain: 48
22319
22175
  };
22320
22176
  };
22321
- //#endregion
22322
- //#region src/synthesizer/audio_engine/effects/xg/implementation/dsp/chorus/chorus1.ts
22177
+ // src/synthesizer/audio_engine/effects/xg/implementation/dsp/chorus/chorus1.ts
22323
22178
  /**
22324
22179
  * CHORUS 1 (`41 00`).
22325
22180
  */
@@ -22387,8 +22242,7 @@ var XGChorus1 = class extends XGChorus {
22387
22242
  variationGain: 63
22388
22243
  };
22389
22244
  };
22390
- //#endregion
22391
- //#region src/synthesizer/audio_engine/effects/xg/implementation/dsp/chorus/chorus2.ts
22245
+ // src/synthesizer/audio_engine/effects/xg/implementation/dsp/chorus/chorus2.ts
22392
22246
  /**
22393
22247
  * CHORUS 2 (`41 01`).
22394
22248
  */
@@ -22456,8 +22310,7 @@ var XGChorus2 = class extends XGChorus {
22456
22310
  variationGain: 63
22457
22311
  };
22458
22312
  };
22459
- //#endregion
22460
- //#region src/synthesizer/audio_engine/effects/xg/implementation/dsp/chorus/chorus3.ts
22313
+ // src/synthesizer/audio_engine/effects/xg/implementation/dsp/chorus/chorus3.ts
22461
22314
  /**
22462
22315
  * CHORUS 3 (`41 02`).
22463
22316
  */
@@ -22525,8 +22378,7 @@ var XGChorus3 = class extends XGChorus {
22525
22378
  variationGain: 63
22526
22379
  };
22527
22380
  };
22528
- //#endregion
22529
- //#region src/synthesizer/audio_engine/effects/xg/implementation/dsp/chorus/chorus4.ts
22381
+ // src/synthesizer/audio_engine/effects/xg/implementation/dsp/chorus/chorus4.ts
22530
22382
  /**
22531
22383
  * CHORUS 4 (`41 08`).
22532
22384
  */
@@ -22594,8 +22446,7 @@ var XGChorus4 = class extends XGChorus {
22594
22446
  variationGain: 63
22595
22447
  };
22596
22448
  };
22597
- //#endregion
22598
- //#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
22599
22450
  /**
22600
22451
  * FB CHORUS (`41 07`).
22601
22452
  */
@@ -22663,8 +22514,7 @@ var XGFBChorus = class extends XGChorus {
22663
22514
  variationGain: 63
22664
22515
  };
22665
22516
  };
22666
- //#endregion
22667
- //#region src/synthesizer/audio_engine/effects/xg/implementation/dsp/chorus/flanger1.ts
22517
+ // src/synthesizer/audio_engine/effects/xg/implementation/dsp/chorus/flanger1.ts
22668
22518
  /**
22669
22519
  * FLANGER 1 (`43 00`).
22670
22520
  */
@@ -22732,8 +22582,7 @@ var XGFlanger1 = class extends XGFlanger {
22732
22582
  variationGain: 45
22733
22583
  };
22734
22584
  };
22735
- //#endregion
22736
- //#region src/synthesizer/audio_engine/effects/xg/implementation/dsp/chorus/flanger2.ts
22585
+ // src/synthesizer/audio_engine/effects/xg/implementation/dsp/chorus/flanger2.ts
22737
22586
  /**
22738
22587
  * FLANGER 2 (`43 01`).
22739
22588
  */
@@ -22801,8 +22650,7 @@ var XGFlanger2 = class extends XGFlanger {
22801
22650
  variationGain: 45
22802
22651
  };
22803
22652
  };
22804
- //#endregion
22805
- //#region src/synthesizer/audio_engine/effects/xg/implementation/dsp/chorus/flanger3.ts
22653
+ // src/synthesizer/audio_engine/effects/xg/implementation/dsp/chorus/flanger3.ts
22806
22654
  /**
22807
22655
  * FLANGER 3 (`43 08`).
22808
22656
  */
@@ -22870,8 +22718,7 @@ var XGFlanger3 = class extends XGFlanger {
22870
22718
  variationGain: 45
22871
22719
  };
22872
22720
  };
22873
- //#endregion
22874
- //#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
22875
22722
  /**
22876
22723
  * GM CHORUS 1 (`41 03`).
22877
22724
  */
@@ -22939,8 +22786,7 @@ var XGGMChorus1 = class extends XGChorus {
22939
22786
  variationGain: 63
22940
22787
  };
22941
22788
  };
22942
- //#endregion
22943
- //#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
22944
22790
  /**
22945
22791
  * GM CHORUS 2 (`41 04`).
22946
22792
  */
@@ -23008,8 +22854,7 @@ var XGGMChorus2 = class extends XGChorus {
23008
22854
  variationGain: 63
23009
22855
  };
23010
22856
  };
23011
- //#endregion
23012
- //#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
23013
22858
  /**
23014
22859
  * GM CHORUS 3 (`41 05`).
23015
22860
  */
@@ -23077,8 +22922,7 @@ var XGGMChorus3 = class extends XGChorus {
23077
22922
  variationGain: 63
23078
22923
  };
23079
22924
  };
23080
- //#endregion
23081
- //#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
23082
22926
  /**
23083
22927
  * GM CHORUS 4 (`41 06`).
23084
22928
  */
@@ -23146,8 +22990,7 @@ var XGGMChorus4 = class extends XGChorus {
23146
22990
  variationGain: 63
23147
22991
  };
23148
22992
  };
23149
- //#endregion
23150
- //#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
23151
22994
  /**
23152
22995
  * GM FLANGER (`43 07`).
23153
22996
  */
@@ -23215,9 +23058,8 @@ var XGGMFlanger = class extends XGFlanger {
23215
23058
  variationGain: 63
23216
23059
  };
23217
23060
  };
23218
- //#endregion
23219
- //#region src/synthesizer/audio_engine/effects/xg/implementation/chorus.ts
23220
- const CHORUS_MAP = new Map([
23061
+ // src/synthesizer/audio_engine/effects/xg/implementation/chorus.ts
23062
+ const CHORUS_MAP = /* @__PURE__ */ new Map([
23221
23063
  [0, XGNoEffect],
23222
23064
  [16640, XGChorus1],
23223
23065
  [16641, XGChorus2],
@@ -23279,8 +23121,7 @@ var DefaultXGChorus = class extends DefaultXGSystemEffect {
23279
23121
  this.sendToReverb = snapshot.sendToReverb;
23280
23122
  }
23281
23123
  };
23282
- //#endregion
23283
- //#region src/synthesizer/audio_engine/effects/xg/implementation/dsp/thru.ts
23124
+ // src/synthesizer/audio_engine/effects/xg/implementation/dsp/thru.ts
23284
23125
  /**
23285
23126
  * MU128 manual description:
23286
23127
  * Bypass without applying an effect.
@@ -23301,11 +23142,10 @@ var XGThru = class {
23301
23142
  }
23302
23143
  reset() {}
23303
23144
  getSnapshot() {
23304
- return new Int16Array(16);
23145
+ return /* @__PURE__ */ new Int16Array(16);
23305
23146
  }
23306
23147
  };
23307
- //#endregion
23308
- //#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
23309
23149
  const COEFFICIENT_LIST = Array.from({ length: 79 }, (_, i) => 109 + i);
23310
23150
  const ADDRESS_LIST = Array.from({ length: 27 }, (_, i) => 36 + i);
23311
23151
  /**
@@ -23390,8 +23230,7 @@ var XGVariationProgram = class extends XGDSPProgram {
23390
23230
  }
23391
23231
  }
23392
23232
  };
23393
- //#endregion
23394
- //#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
23395
23234
  const LIST_LOW_LEFT$2 = [
23396
23235
  127,
23397
23236
  126,
@@ -23441,7 +23280,7 @@ var XGStereoVariationProgram = class extends XGVariationProgram {
23441
23280
  lfoOffset4 = 0;
23442
23281
  lfoOffset5 = 0;
23443
23282
  lfoOffset6 = 0;
23444
- equalizerState = new Float64Array(6);
23283
+ equalizerState = /* @__PURE__ */ new Float64Array(6);
23445
23284
  constructor(sampleRate, maxBufferSize, memory) {
23446
23285
  super(sampleRate, maxBufferSize, memory, 0);
23447
23286
  }
@@ -23502,9 +23341,7 @@ var XGStereoVariationProgram = class extends XGVariationProgram {
23502
23341
  case 136:
23503
23342
  this.lfoOffset5 = Math.trunc(raw * 4194304);
23504
23343
  break;
23505
- case 141:
23506
- this.lfoOffset6 = Math.trunc(raw * 4194304);
23507
- break;
23344
+ case 141: this.lfoOffset6 = Math.trunc(raw * 4194304);
23508
23345
  }
23509
23346
  }
23510
23347
  }
@@ -23584,8 +23421,7 @@ var XGStereoVariationProgram = class extends XGVariationProgram {
23584
23421
  this.designFirstOrder("highShelf", highFrequency, highGain, LIST_HIGH_RIGHT$2);
23585
23422
  }
23586
23423
  };
23587
- //#endregion
23588
- //#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
23589
23425
  const LIST_SHAPE_LEFT = [
23590
23426
  114,
23591
23427
  113,
@@ -23661,8 +23497,8 @@ var XGTremoloBase = class extends XGStereoVariationProgram {
23661
23497
  k = tReadR + pointer + intRight & mask;
23662
23498
  const tapR = (memory[k + 1 & mask] - memory[k]) * fracRight + memory[k];
23663
23499
  const r = inR[i];
23664
- memory[tWriteL + pointer & mask] = rightToL * r + inL[i];
23665
23500
  memory[tWriteR + pointer & mask] = rightToR * r;
23501
+ memory[tWriteL + pointer & mask] = rightToL * r + inL[i];
23666
23502
  outputLeft[i] = tapL * ampLeft * outL;
23667
23503
  outputRight[i] = tapR * ampRight * outR;
23668
23504
  pointer = pointer - 1 & mask;
@@ -23699,8 +23535,7 @@ var XGTremoloBase = class extends XGStereoVariationProgram {
23699
23535
  return this.variationGain * level >> 6;
23700
23536
  }
23701
23537
  };
23702
- //#endregion
23703
- //#region src/synthesizer/audio_engine/effects/xg/implementation/dsp/tremolo/tremolo.ts
23538
+ // src/synthesizer/audio_engine/effects/xg/implementation/dsp/tremolo/tremolo.ts
23704
23539
  const PARAMETER_RANGES$15 = {
23705
23540
  5: [8, 40],
23706
23541
  6: [52, 76],
@@ -23913,8 +23748,7 @@ var XGTremolo = class extends XGTremoloBase {
23913
23748
  }
23914
23749
  }
23915
23750
  };
23916
- //#endregion
23917
- //#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
23918
23752
  const PARAMETER_RANGES$14 = {
23919
23753
  3: [0, 5],
23920
23754
  5: [8, 40],
@@ -24125,12 +23959,10 @@ var XGAutoPan = class extends XGTremoloBase {
24125
23959
  case 9:
24126
23960
  w[185] = w[180] = this.outputWord(this.insertion ? 362 : 724);
24127
23961
  this.pushCoefficients([180, 185]);
24128
- break;
24129
23962
  }
24130
23963
  }
24131
23964
  };
24132
- //#endregion
24133
- //#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
24134
23966
  const LIST_LOW_LEFT$1 = [
24135
23967
  110,
24136
23968
  109,
@@ -24203,8 +24035,8 @@ var XGPhaserBase = class extends XGVariationProgram {
24203
24035
  eqXR = 0;
24204
24036
  eqYR = 0;
24205
24037
  eqZR = 0;
24206
- chainA = new Float32Array(6);
24207
- chainB = new Float32Array(6);
24038
+ chainA = /* @__PURE__ */ new Float32Array(6);
24039
+ chainB = /* @__PURE__ */ new Float32Array(6);
24208
24040
  constructor(sampleRate, maxBufferSize, memory) {
24209
24041
  super(sampleRate, maxBufferSize, memory, 1);
24210
24042
  }
@@ -24297,9 +24129,7 @@ var XGPhaserBase = class extends XGVariationProgram {
24297
24129
  case 121:
24298
24130
  this.sweepStep = Math.trunc(this.rawCoefficient(121) * this.rateInverse * 4194304);
24299
24131
  break;
24300
- case 156:
24301
- this.sweepOffset = Math.trunc(this.rawCoefficient(156) * 4194304);
24302
- break;
24132
+ case 156: this.sweepOffset = Math.trunc(this.rawCoefficient(156) * 4194304);
24303
24133
  }
24304
24134
  }
24305
24135
  }
@@ -24343,8 +24173,7 @@ var XGPhaserBase = class extends XGVariationProgram {
24343
24173
  this.designFirstOrder("highShelf", p[7], p[8], LIST_HIGH_RIGHT$1);
24344
24174
  }
24345
24175
  };
24346
- //#endregion
24347
- //#region src/synthesizer/audio_engine/effects/xg/implementation/dsp/phaser/phaser1.ts
24176
+ // src/synthesizer/audio_engine/effects/xg/implementation/dsp/phaser/phaser1.ts
24348
24177
  const PARAMETER_RANGES$13 = {
24349
24178
  3: [1, 127],
24350
24179
  5: [8, 40],
@@ -24607,12 +24436,10 @@ var XGPhaser1 = class extends XGPhaserBase {
24607
24436
  case INPUT_MIX:
24608
24437
  w[132] = w[133] = this.insertion ? 256 : 512;
24609
24438
  this.pushCoefficients([132, 133]);
24610
- break;
24611
24439
  }
24612
24440
  }
24613
24441
  };
24614
- //#endregion
24615
- //#region src/synthesizer/audio_engine/effects/xg/implementation/dsp/phaser/phaser2.ts
24442
+ // src/synthesizer/audio_engine/effects/xg/implementation/dsp/phaser/phaser2.ts
24616
24443
  const PARAMETER_RANGES$12 = {
24617
24444
  3: [1, 127],
24618
24445
  5: [8, 40],
@@ -24816,12 +24643,10 @@ var XGPhaser2 = class extends XGPhaserBase {
24816
24643
  case 12:
24817
24644
  w[156] = this.phaseWord(p[12]);
24818
24645
  this.pushCoefficients([156]);
24819
- break;
24820
24646
  }
24821
24647
  }
24822
24648
  };
24823
- //#endregion
24824
- //#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
24825
24650
  const PARAMETER_RANGES$11 = {
24826
24651
  0: [8, 40],
24827
24652
  1: [52, 76],
@@ -24982,14 +24807,11 @@ var XGTwoBandEQ = class extends XGStereoVariationProgram {
24982
24807
  this.designLowEqualizer(p[0], p[1]);
24983
24808
  break;
24984
24809
  case 2:
24985
- case 3:
24986
- this.designHighEqualizer(p[2], p[3]);
24987
- break;
24810
+ case 3: this.designHighEqualizer(p[2], p[3]);
24988
24811
  }
24989
24812
  }
24990
24813
  };
24991
- //#endregion
24992
- //#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
24993
24815
  /**
24994
24816
  * The category 3 coefficients that the original never writes.
24995
24817
  */
@@ -25031,13 +24853,11 @@ var XGFilterVariationProgram = class extends XGVariationProgram {
25031
24853
  case 126:
25032
24854
  this.wahStep = Math.trunc(this.rawCoefficient(126) * this.rateInverse * 16777216);
25033
24855
  c[191] = Math.fround(this.rateInverse / 256);
25034
- break;
25035
24856
  }
25036
24857
  }
25037
24858
  }
25038
24859
  };
25039
- //#endregion
25040
- //#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
25041
24861
  /**
25042
24862
  * Auto wah cutoff frequency offset words.
25043
24863
  */
@@ -25171,8 +24991,7 @@ const CUTOFF_OFFSET = new Uint16Array([
25171
24991
  515,
25172
24992
  513
25173
24993
  ]);
25174
- //#endregion
25175
- //#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
25176
24995
  const PARAMETER_RANGES$10 = {
25177
24996
  3: [10, 120],
25178
24997
  5: [8, 40],
@@ -25460,8 +25279,7 @@ var XGAutoWah = class extends XGFilterVariationProgram {
25460
25279
  }
25461
25280
  }
25462
25281
  };
25463
- //#endregion
25464
- //#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
25465
25283
  const LIST_LOW_A = [
25466
25284
  112,
25467
25285
  111,
@@ -25615,8 +25433,7 @@ var XGMonoVariationProgram = class extends XGVariationProgram {
25615
25433
  this.pushCoefficients([109, 110]);
25616
25434
  }
25617
25435
  };
25618
- //#endregion
25619
- //#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
25620
25437
  const PARAMETER_RANGES$9 = {
25621
25438
  0: [52, 76],
25622
25439
  1: [28, 54],
@@ -25817,14 +25634,11 @@ var XGThreeBandEQ = class extends XGMonoVariationProgram {
25817
25634
  this.designFirstOrder("highShelf", p[6], p[4] - half, LIST_HIGH_B);
25818
25635
  break;
25819
25636
  }
25820
- case MONO_INPUT$2:
25821
- this.monoInputLevel();
25822
- break;
25637
+ case MONO_INPUT$2: this.monoInputLevel();
25823
25638
  }
25824
25639
  }
25825
25640
  };
25826
- //#endregion
25827
- //#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
25828
25642
  /**
25829
25643
  * The distortion output level curve (1.0 at 127).
25830
25644
  */
@@ -25958,8 +25772,7 @@ const OUTPUT_LEVEL = new Float32Array([
25958
25772
  .98431396,
25959
25773
  1
25960
25774
  ]);
25961
- //#endregion
25962
- //#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
25963
25776
  const LIST_LOW_PASS$1 = [
25964
25777
  163,
25965
25778
  162,
@@ -26013,7 +25826,8 @@ var XGDistortionBase = class extends XGMonoVariationProgram {
26013
25826
  const s3 = clip$1(s2 * gain3);
26014
25827
  const s4 = clip$1(s3 * gain4);
26015
25828
  const s5 = clip$1(s4 * gain5);
26016
- 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;
26017
25831
  }
26018
25832
  this.filterOutput(mono, sampleCount);
26019
25833
  this.mixOutput(mono, outputLeft, outputRight, sampleCount, outputGain);
@@ -26077,8 +25891,7 @@ var XGDistortionBase = class extends XGMonoVariationProgram {
26077
25891
  ]);
26078
25892
  }
26079
25893
  };
26080
- //#endregion
26081
- //#region src/synthesizer/audio_engine/effects/xg/implementation/dsp/distortion/distortion.ts
25894
+ // src/synthesizer/audio_engine/effects/xg/implementation/dsp/distortion/distortion.ts
26082
25895
  const PARAMETER_RANGES$8 = {
26083
25896
  1: [8, 40],
26084
25897
  2: [52, 76],
@@ -26268,14 +26081,11 @@ var XGDistortion = class extends XGDistortionBase {
26268
26081
  case 9:
26269
26082
  this.dryWet();
26270
26083
  break;
26271
- case 10:
26272
- this.edge(p[10]);
26273
- break;
26084
+ case 10: this.edge(p[10]);
26274
26085
  }
26275
26086
  }
26276
26087
  };
26277
- //#endregion
26278
- //#region src/synthesizer/audio_engine/effects/xg/implementation/dsp/distortion/overdrive.ts
26088
+ // src/synthesizer/audio_engine/effects/xg/implementation/dsp/distortion/overdrive.ts
26279
26089
  /**
26280
26090
  * OVER DRIVE (`4A 00`): the distortion with softer defaults and a narrower input band.
26281
26091
  */
@@ -26412,8 +26222,7 @@ var XGOverdrive = class extends XGDistortion {
26412
26222
  highPassFrequency = 8;
26413
26223
  lowPassFrequency = 44;
26414
26224
  };
26415
- //#endregion
26416
- //#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
26417
26226
  const PARAMETER_RANGES$7 = {
26418
26227
  1: [0, 3],
26419
26228
  2: [34, 60]
@@ -26681,14 +26490,11 @@ var XGAmpSimulator = class extends XGDistortionBase {
26681
26490
  case 9:
26682
26491
  this.dryWet();
26683
26492
  break;
26684
- case 10:
26685
- this.edge(p[10]);
26686
- break;
26493
+ case 10: this.edge(p[10]);
26687
26494
  }
26688
26495
  }
26689
26496
  };
26690
- //#endregion
26691
- //#region src/synthesizer/audio_engine/effects/xg/implementation/dsp/symphonic/symphonic.ts
26497
+ // src/synthesizer/audio_engine/effects/xg/implementation/dsp/symphonic/symphonic.ts
26692
26498
  const PARAMETER_RANGES$6 = {
26693
26499
  5: [8, 40],
26694
26500
  6: [52, 76],
@@ -26924,8 +26730,8 @@ var XGSymphonic = class extends XGStereoVariationProgram {
26924
26730
  const s = (memory[k + 1 & mask] - memory[k]) * fracC + memory[k];
26925
26731
  const l = inL[i];
26926
26732
  const r = inR[i];
26927
- memory[writeL + pointer & mask] = rightToL * r + l;
26928
26733
  memory[writeR + pointer & mask] = rightToR * r;
26734
+ memory[writeL + pointer & mask] = rightToL * r + l;
26929
26735
  outputLeft[i] = dryL * l + a * wetAL + s * wetCL;
26930
26736
  outputRight[i] = dryR * r + b * wetBR + s * wetCR;
26931
26737
  pointer = pointer - 1 & mask;
@@ -27009,8 +26815,7 @@ var XGSymphonic = class extends XGStereoVariationProgram {
27009
26815
  }
27010
26816
  }
27011
26817
  };
27012
- //#endregion
27013
- //#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
27014
26819
  const PARAMETER_RANGES$5 = {
27015
26820
  5: [8, 40],
27016
26821
  6: [52, 76],
@@ -27265,8 +27070,8 @@ var XGRotarySpeaker = class extends XGStereoVariationProgram {
27265
27070
  const d = (memory[k + 1 & mask] - memory[k]) * fracD + memory[k];
27266
27071
  const l = inL[i];
27267
27072
  const r = inR[i];
27268
- memory[writeL + pointer & mask] = rightToL * r + l;
27269
27073
  memory[writeR + pointer & mask] = rightToR * r;
27074
+ memory[writeL + pointer & mask] = rightToL * r + l;
27270
27075
  outputLeft[i] = dryL * l + a * wetAL + s * wetCL + d * wetDL;
27271
27076
  outputRight[i] = dryR * r + b * wetBR + s * wetCR + d * wetDR;
27272
27077
  pointer = pointer - 1 & mask;
@@ -27347,8 +27152,7 @@ var XGRotarySpeaker = class extends XGStereoVariationProgram {
27347
27152
  }
27348
27153
  }
27349
27154
  };
27350
- //#endregion
27351
- //#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
27352
27156
  /**
27353
27157
  * Reflection patterns, 14 (delay in 10 us, gain) pairs each: ER types 0-5, gate types 6-7, reverse gate types 8-9.
27354
27158
  */
@@ -27958,8 +27762,7 @@ const REFLECTION_GAIN = new Uint16Array([
27958
27762
  255,
27959
27763
  255
27960
27764
  ]);
27961
- //#endregion
27962
- //#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
27963
27766
  const LIST_REFLECTION_ADDRESS = [
27964
27767
  59,
27965
27768
  50,
@@ -28163,9 +27966,7 @@ var XGEarlyReflectionsBase = class extends XGMonoVariationProgram {
28163
27966
  case 12:
28164
27967
  this.designFirstOrder("lowPass", HIGH_DAMP_FREQUENCY[p[12]], 64, LIST_HIGH_DAMP);
28165
27968
  break;
28166
- case MONO_INPUT$1:
28167
- this.monoInputLevel();
28168
- break;
27969
+ case MONO_INPUT$1: this.monoInputLevel();
28169
27970
  }
28170
27971
  }
28171
27972
  /**
@@ -28222,8 +28023,7 @@ const GATE_RANGES = {
28222
28023
  ...ER_RANGES,
28223
28024
  0: [0, 1]
28224
28025
  };
28225
- //#endregion
28226
- //#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
28227
28027
  /**
28228
28028
  * EARLY REF 1 (`09 00`): early reflections without the reverb tail.
28229
28029
  */
@@ -28361,8 +28161,7 @@ var XGEarlyReflection1 = class extends XGEarlyReflectionsBase {
28361
28161
  densityBlock = 0;
28362
28162
  ranges = ER_RANGES;
28363
28163
  };
28364
- //#endregion
28365
- //#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
28366
28165
  /**
28367
28166
  * EARLY REF 2 (`09 01`): early reflections with other defaults.
28368
28167
  */
@@ -28500,8 +28299,7 @@ var XGEarlyReflection2 = class extends XGEarlyReflectionsBase {
28500
28299
  densityBlock = 1;
28501
28300
  ranges = ER_RANGES;
28502
28301
  };
28503
- //#endregion
28504
- //#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
28505
28303
  /**
28506
28304
  * GATE REVERB (`0A 00`): a dense burst of reflections that stops abruptly.
28507
28305
  */
@@ -28639,8 +28437,7 @@ var XGGateReverb = class extends XGEarlyReflectionsBase {
28639
28437
  densityBlock = 2;
28640
28438
  ranges = GATE_RANGES;
28641
28439
  };
28642
- //#endregion
28643
- //#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
28644
28441
  /**
28645
28442
  * REVERSE GATE (`0B 00`): the gate reverb with rising reflections.
28646
28443
  */
@@ -28778,8 +28575,7 @@ var XGReverseGate = class extends XGEarlyReflectionsBase {
28778
28575
  densityBlock = 3;
28779
28576
  ranges = GATE_RANGES;
28780
28577
  };
28781
- //#endregion
28782
- //#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
28783
28579
  /**
28784
28580
  * Delay tap level scale (C level, delay 2 level).
28785
28581
  */
@@ -28913,8 +28709,7 @@ const DELAY_LEVEL = new Float32Array([
28913
28709
  .98431396484375,
28914
28710
  1
28915
28711
  ]);
28916
- //#endregion
28917
- //#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
28918
28713
  /**
28919
28714
  * The right line input position used by the two-line delays (in the upper half of the memory).
28920
28715
  */
@@ -28960,8 +28755,8 @@ var XGDelayBase = class extends XGStereoVariationProgram {
28960
28755
  dampB = b;
28961
28756
  const l = inL[i];
28962
28757
  const r = inR[i];
28963
- memory[tWriteA + pointer & mask] = rightToA * r + dampedA * aToA + dampedB * bToA + l;
28964
28758
  memory[tWriteB + pointer & mask] = rightToB * r + dampedA * aToB + dampedB * bToB;
28759
+ memory[tWriteA + pointer & mask] = rightToA * r + dampedA * aToA + dampedB * bToA + l;
28965
28760
  outputLeft[i] = rightToL * r + a * aToL + tapC * cToL + tapD * dToL + leftToL * l;
28966
28761
  outputRight[i] = leftToR * l + b * bToR + tapC * cToR + tapD * dToR + rightToR * r;
28967
28762
  pointer = pointer - 1 & mask;
@@ -28996,8 +28791,7 @@ var XGDelayBase = class extends XGStereoVariationProgram {
28996
28791
  this.pushCoefficients(list);
28997
28792
  }
28998
28793
  };
28999
- //#endregion
29000
- //#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
29001
28795
  const PARAMETER_RANGES$4 = {
29002
28796
  0: [1, 7150],
29003
28797
  1: [1, 7150],
@@ -29202,14 +28996,11 @@ var XGDelayLCR = class extends XGDelayBase {
29202
28996
  this.designLowEqualizer(p[12], p[13]);
29203
28997
  break;
29204
28998
  case 14:
29205
- case 15:
29206
- this.designHighEqualizer(p[14], p[15]);
29207
- break;
28999
+ case 15: this.designHighEqualizer(p[14], p[15]);
29208
29000
  }
29209
29001
  }
29210
29002
  };
29211
- //#endregion
29212
- //#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
29213
29004
  const PARAMETER_RANGES$3 = {
29214
29005
  0: [1, 7150],
29215
29006
  1: [1, 7150],
@@ -29411,14 +29202,11 @@ var XGDelayLR = class extends XGDelayBase {
29411
29202
  this.designLowEqualizer(p[12], p[13]);
29412
29203
  break;
29413
29204
  case 14:
29414
- case 15:
29415
- this.designHighEqualizer(p[14], p[15]);
29416
- break;
29205
+ case 15: this.designHighEqualizer(p[14], p[15]);
29417
29206
  }
29418
29207
  }
29419
29208
  };
29420
- //#endregion
29421
- //#region src/synthesizer/audio_engine/effects/xg/implementation/dsp/delay/echo.ts
29209
+ // src/synthesizer/audio_engine/effects/xg/implementation/dsp/delay/echo.ts
29422
29210
  const PARAMETER_RANGES$2 = {
29423
29211
  0: [1, 3550],
29424
29212
  1: [1, 127],
@@ -29629,14 +29417,11 @@ var XGEcho = class extends XGDelayBase {
29629
29417
  this.designLowEqualizer(p[12], p[13]);
29630
29418
  break;
29631
29419
  case 14:
29632
- case 15:
29633
- this.designHighEqualizer(p[14], p[15]);
29634
- break;
29420
+ case 15: this.designHighEqualizer(p[14], p[15]);
29635
29421
  }
29636
29422
  }
29637
29423
  };
29638
- //#endregion
29639
- //#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
29640
29425
  const PARAMETER_RANGES$1 = {
29641
29426
  0: [1, 3550],
29642
29427
  1: [1, 3550],
@@ -29852,14 +29637,11 @@ var XGCrossDelay = class extends XGDelayBase {
29852
29637
  this.designLowEqualizer(p[12], p[13]);
29853
29638
  break;
29854
29639
  case 14:
29855
- case 15:
29856
- this.designHighEqualizer(p[14], p[15]);
29857
- break;
29640
+ case 15: this.designHighEqualizer(p[14], p[15]);
29858
29641
  }
29859
29642
  }
29860
29643
  };
29861
- //#endregion
29862
- //#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
29863
29645
  /**
29864
29646
  * Karaoke delay time (0.1 ms units).
29865
29647
  */
@@ -29993,8 +29775,7 @@ const KARAOKE_DELAY = new Uint16Array([
29993
29775
  3969,
29994
29776
  4e3
29995
29777
  ]);
29996
- //#endregion
29997
- //#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
29998
29779
  const PARAMETER_RANGES = {
29999
29780
  1: [1, 127],
30000
29781
  2: [0, 52],
@@ -30177,12 +29958,10 @@ var XGKaraokeBase = class extends XGFilterVariationProgram {
30177
29958
  case MONO_INPUT:
30178
29959
  w[109] = w[110] = this.insertion ? 181 : 362;
30179
29960
  this.pushCoefficients([109, 110]);
30180
- break;
30181
29961
  }
30182
29962
  }
30183
29963
  };
30184
- //#endregion
30185
- //#region src/synthesizer/audio_engine/effects/xg/implementation/dsp/karaoke/karaoke1.ts
29964
+ // src/synthesizer/audio_engine/effects/xg/implementation/dsp/karaoke/karaoke1.ts
30186
29965
  /**
30187
29966
  * KARAOKE 1 (`14 00`): a filtered echo for vocals.
30188
29967
  */
@@ -30317,8 +30096,7 @@ var XGKaraoke1 = class extends XGKaraokeBase {
30317
30096
  ]
30318
30097
  };
30319
30098
  };
30320
- //#endregion
30321
- //#region src/synthesizer/audio_engine/effects/xg/implementation/dsp/karaoke/karaoke2.ts
30099
+ // src/synthesizer/audio_engine/effects/xg/implementation/dsp/karaoke/karaoke2.ts
30322
30100
  /**
30323
30101
  * KARAOKE 2 (`14 01`): a filtered echo for vocals.
30324
30102
  */
@@ -30453,8 +30231,7 @@ var XGKaraoke2 = class extends XGKaraokeBase {
30453
30231
  ]
30454
30232
  };
30455
30233
  };
30456
- //#endregion
30457
- //#region src/synthesizer/audio_engine/effects/xg/implementation/dsp/karaoke/karaoke3.ts
30234
+ // src/synthesizer/audio_engine/effects/xg/implementation/dsp/karaoke/karaoke3.ts
30458
30235
  /**
30459
30236
  * KARAOKE 3 (`14 02`): a filtered echo for vocals.
30460
30237
  */
@@ -30589,9 +30366,8 @@ var XGKaraoke3 = class extends XGKaraokeBase {
30589
30366
  ]
30590
30367
  };
30591
30368
  };
30592
- //#endregion
30593
- //#region src/synthesizer/audio_engine/effects/xg/implementation/variation.ts
30594
- const VARIATION_MAP = new Map([
30369
+ // src/synthesizer/audio_engine/effects/xg/implementation/variation.ts
30370
+ const VARIATION_MAP = /* @__PURE__ */ new Map([
30595
30371
  [0, XGNoEffect],
30596
30372
  [256, XGHall1],
30597
30373
  [257, XGHall2],
@@ -30707,9 +30483,8 @@ var DefaultXGVariation = class extends DefaultXGSystemEffect {
30707
30483
  this.sendToChorus = snapshot.sendToChorus;
30708
30484
  }
30709
30485
  };
30710
- //#endregion
30711
- //#region src/synthesizer/audio_engine/effects/xg/implementation/insertion.ts
30712
- const INSERTION_MAP = new Map([
30486
+ // src/synthesizer/audio_engine/effects/xg/implementation/insertion.ts
30487
+ const INSERTION_MAP = /* @__PURE__ */ new Map([
30713
30488
  [0, XGThru],
30714
30489
  [256, XGHall1],
30715
30490
  [257, XGHall2],
@@ -30789,8 +30564,7 @@ var DefaultXGInsertion = class extends DefaultXGEffect {
30789
30564
  this.partNumber = snapshot.partNumber;
30790
30565
  }
30791
30566
  };
30792
- //#endregion
30793
- //#region src/synthesizer/enums.ts
30567
+ // src/synthesizer/enums.ts
30794
30568
  /**
30795
30569
  * The available interpolation types of the synthesizer.
30796
30570
  * Interpolation defines how sample points between the sample data are calculated.
@@ -30814,8 +30588,7 @@ const InterpolationTypes = {
30814
30588
  */
30815
30589
  hermite: 2
30816
30590
  };
30817
- //#endregion
30818
- //#region src/synthesizer/audio_engine/effects/implementation/dattorro.ts
30591
+ // src/synthesizer/audio_engine/effects/implementation/dattorro.ts
30819
30592
  /**
30820
30593
  * Dattorro Reverb Node
30821
30594
  * by khoin on GitHub, public domain.
@@ -30846,9 +30619,9 @@ var DattorroReverb = class {
30846
30619
  pDelay;
30847
30620
  pDMask;
30848
30621
  delayBuffers = new Array(12);
30849
- delayWrite = new Int32Array(12);
30850
- delayRead = new Int32Array(12);
30851
- delayMask = new Int32Array(12);
30622
+ delayWrite = /* @__PURE__ */ new Int32Array(12);
30623
+ delayRead = /* @__PURE__ */ new Int32Array(12);
30624
+ delayMask = /* @__PURE__ */ new Int32Array(12);
30852
30625
  constructor(sampleRate) {
30853
30626
  this.sampleRate = sampleRate;
30854
30627
  this.pDMask = 2 ** Math.ceil(Math.log2(sampleRate)) - 1;
@@ -31081,8 +30854,7 @@ var DattorroReverb = class {
31081
30854
  this.delayMask[index] = nextPow2 - 1;
31082
30855
  }
31083
30856
  };
31084
- //#endregion
31085
- //#region src/synthesizer/audio_engine/effects/implementation/delay_line.ts
30857
+ // src/synthesizer/audio_engine/effects/implementation/delay_line.ts
31086
30858
  var DelayLine = class {
31087
30859
  feedback = 0;
31088
30860
  gain = 1;
@@ -31131,8 +30903,7 @@ var DelayLine = class {
31131
30903
  this.writeIndex = writeIndex;
31132
30904
  }
31133
30905
  };
31134
- //#endregion
31135
- //#region src/synthesizer/audio_engine/effects/gs/implementation/reverb.ts
30906
+ // src/synthesizer/audio_engine/effects/gs/implementation/reverb.ts
31136
30907
  const DELAY_GAIN$1 = 1.5;
31137
30908
  /**
31138
30909
  * The default GS Reverb implementation for {@link SpessaSynthProcessor}.
@@ -31303,7 +31074,6 @@ var DefaultGSReverb = class {
31303
31074
  this.characterGainCoefficient = .75;
31304
31075
  this.dattorro.damping = .65;
31305
31076
  this.characterTimeCoefficient = .5;
31306
- break;
31307
31077
  }
31308
31078
  this.updateTime();
31309
31079
  this.updateGain();
@@ -31445,8 +31215,7 @@ var DefaultGSReverb = class {
31445
31215
  else this.delayLeft.time = timeSamples;
31446
31216
  }
31447
31217
  };
31448
- //#endregion
31449
- //#region src/synthesizer/audio_engine/effects/gs/implementation/chorus.ts
31218
+ // src/synthesizer/audio_engine/effects/gs/implementation/chorus.ts
31450
31219
  const CHORUS_GAIN = 1.3;
31451
31220
  /**
31452
31221
  * The default GS Chorus implementation for {@link SpessaSynthProcessor}.
@@ -31627,8 +31396,7 @@ var DefaultGSChorus = class {
31627
31396
  };
31628
31397
  }
31629
31398
  };
31630
- //#endregion
31631
- //#region src/synthesizer/audio_engine/effects/gs/implementation/delay.ts
31399
+ // src/synthesizer/audio_engine/effects/gs/implementation/delay.ts
31632
31400
  const delayTimeSegments = [
31633
31401
  {
31634
31402
  start: 1,
@@ -31915,8 +31683,7 @@ var DefaultGSDelay = class {
31915
31683
  this.gainRight = this._levelRight / 127;
31916
31684
  }
31917
31685
  };
31918
- //#endregion
31919
- //#region src/synthesizer/audio_engine/user_drum_set.ts
31686
+ // src/synthesizer/audio_engine/user_drum_set.ts
31920
31687
  const FALLBACK_PATCH = {
31921
31688
  bankMSB: 0,
31922
31689
  bankLSB: 0,
@@ -31999,8 +31766,7 @@ var UserDrumSet = class UserDrumSet {
31999
31766
  return params;
32000
31767
  }
32001
31768
  };
32002
- //#endregion
32003
- //#region src/synthesizer/audio_engine/sound_bank_manager.ts
31769
+ // src/synthesizer/audio_engine/sound_bank_manager.ts
32004
31770
  /**
32005
31771
  * A modified version of basic preset that seamlessly integrates bank offset.
32006
31772
  */
@@ -32180,11 +31946,10 @@ var SoundBankManager = class {
32180
31946
  this.presetListChangeCallback();
32181
31947
  }
32182
31948
  };
32183
- //#endregion
32184
- //#region src/synthesizer/audio_engine/voice/unit_converter.ts
31949
+ // src/synthesizer/audio_engine/voice/unit_converter.ts
32185
31950
  const MIN_TIMECENT = -15e3;
32186
31951
  const MAX_TIMECENT = 15e3;
32187
- const timecentLookupTable = new Float32Array(MAX_TIMECENT - MIN_TIMECENT + 1);
31952
+ const timecentLookupTable = /* @__PURE__ */ new Float32Array(30001);
32188
31953
  for (let i = 0; i < timecentLookupTable.length; i++) {
32189
31954
  const timecents = MIN_TIMECENT + i;
32190
31955
  timecentLookupTable[i] = Math.pow(2, timecents / 1200);
@@ -32201,7 +31966,7 @@ function timecentsToSeconds(timecents) {
32201
31966
  }
32202
31967
  const MIN_ABS_CENT = -2e4;
32203
31968
  const MAX_ABS_CENT = 16500;
32204
- const absoluteCentLookupTable = new Float32Array(MAX_ABS_CENT - MIN_ABS_CENT + 1);
31969
+ const absoluteCentLookupTable = /* @__PURE__ */ new Float32Array(36501);
32205
31970
  for (let i = 0; i < absoluteCentLookupTable.length; i++) {
32206
31971
  const absoluteCents = MIN_ABS_CENT + i;
32207
31972
  absoluteCentLookupTable[i] = 440 * Math.pow(2, (absoluteCents - 6900) / 1200);
@@ -32217,7 +31982,7 @@ function absCentsToHz(cents) {
32217
31982
  }
32218
31983
  const MIN_CENTIBELS = -16600;
32219
31984
  const MAX_CENTIBELS = 16e3;
32220
- const CENTIBEL_LOOKUP_TABLE = new Float32Array(MAX_CENTIBELS - MIN_CENTIBELS + 1);
31985
+ const CENTIBEL_LOOKUP_TABLE = /* @__PURE__ */ new Float32Array(32601);
32221
31986
  for (let i = 0; i < CENTIBEL_LOOKUP_TABLE.length; i++) {
32222
31987
  const centibels = MIN_CENTIBELS + i;
32223
31988
  CENTIBEL_LOOKUP_TABLE[i] = Math.pow(10, -centibels / 200);
@@ -32231,8 +31996,7 @@ function cbAttenuationToGain(centibels) {
32231
31996
  if (centibels >= -16600 && centibels <= MAX_CENTIBELS) return CENTIBEL_LOOKUP_TABLE[centibels - MIN_CENTIBELS | 0];
32232
31997
  return centibels < -16600 ? CENTIBEL_LOOKUP_TABLE[0] : 0;
32233
31998
  }
32234
- //#endregion
32235
- //#region src/synthesizer/audio_engine/channel/render_voice.ts
31999
+ // src/synthesizer/audio_engine/channel/render_voice.ts
32236
32000
  const TWO_PI = Math.PI * 2;
32237
32001
  const HALF_PI$1 = Math.PI / 2;
32238
32002
  /**
@@ -32242,9 +32006,9 @@ const HALF_PI$1 = Math.PI / 2;
32242
32006
  const MAX_VOICE_SEND_BUFFERS = 16;
32243
32007
  const MIN_PAN$1 = -500;
32244
32008
  const MAX_PAN$1 = 500;
32245
- const PAN_RESOLUTION$1 = MAX_PAN$1 - MIN_PAN$1;
32246
- const panTableLeft = new Float32Array(PAN_RESOLUTION$1 + 1);
32247
- 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);
32248
32012
  for (let pan = MIN_PAN$1; pan <= MAX_PAN$1; pan++) {
32249
32013
  const realPan = (pan - MIN_PAN$1) / PAN_RESOLUTION$1;
32250
32014
  const tableIndex = pan - MIN_PAN$1;
@@ -32548,8 +32312,7 @@ function sendToStereo(input, outputLeft, outputRight, gainLeft, gainRight, sampl
32548
32312
  outputRight[i] += s * gainRight;
32549
32313
  }
32550
32314
  }
32551
- //#endregion
32552
- //#region src/synthesizer/audio_engine/channel/controller_change.ts
32315
+ // src/synthesizer/audio_engine/channel/controller_change.ts
32553
32316
  /**
32554
32317
  * Handles MIDI controller changes for a channel.
32555
32318
  * @param controller The MIDI controller number (0-127).
@@ -32654,9 +32417,7 @@ function controllerChange(controller, value, sendEvent = true) {
32654
32417
  this.lastPortamentoNote = value;
32655
32418
  this.portamentoForce = true;
32656
32419
  break;
32657
- default:
32658
- this.computeModulatorsAll(1, controller);
32659
- break;
32420
+ default: this.computeModulatorsAll(1, controller);
32660
32421
  }
32661
32422
  if (!sendEvent) return;
32662
32423
  this.synthCore.callEvent("controllerChange", {
@@ -32665,8 +32426,7 @@ function controllerChange(controller, value, sendEvent = true) {
32665
32426
  value
32666
32427
  });
32667
32428
  }
32668
- //#endregion
32669
- //#region src/synthesizer/audio_engine/channel/awe32_nrpn.ts
32429
+ // src/synthesizer/audio_engine/channel/awe32_nrpn.ts
32670
32430
  /**
32671
32431
  * SoundBlaster AWE32 NRPN generator mappings.
32672
32432
  * http://archive.gamedev.net/archive/reference/articles/article445.html
@@ -32795,13 +32555,10 @@ function handleAWE32NRPN(paramLSB, dataValue) {
32795
32555
  this.setGeneratorOverride(generator, cents);
32796
32556
  break;
32797
32557
  case GeneratorTypes.chorusEffectsSend:
32798
- case GeneratorTypes.reverbEffectsSend:
32799
- this.setGeneratorOverride(generator, clip(dataValue, 0, 255) * (1e3 / 255));
32800
- break;
32558
+ case GeneratorTypes.reverbEffectsSend: this.setGeneratorOverride(generator, clip(dataValue, 0, 255) * (1e3 / 255));
32801
32559
  }
32802
32560
  }
32803
- //#endregion
32804
- //#region src/synthesizer/audio_engine/channel/data_entry.ts
32561
+ // src/synthesizer/audio_engine/channel/data_entry.ts
32805
32562
  /**
32806
32563
  * Executes a data entry change for the current channel.
32807
32564
  */
@@ -32837,7 +32594,7 @@ function dataEntry() {
32837
32594
  SpessaLog.coolInfo(`Modulation depth for ${this.channel}`, Math.round(cents), "cents");
32838
32595
  break;
32839
32596
  }
32840
- case RegisteredParameterTypes.resetParameters: break;
32597
+ case RegisteredParameterTypes.resetParameters:
32841
32598
  }
32842
32599
  return;
32843
32600
  }
@@ -32904,7 +32661,6 @@ function dataEntry() {
32904
32661
  if (parameterLock) return;
32905
32662
  this.controllerChange(MIDIControllers.releaseTime, dataCoarse);
32906
32663
  SpessaLog.coolInfo(`EG release time for ${this.channel}`, dataCoarse.toString(), "");
32907
- break;
32908
32664
  }
32909
32665
  break;
32910
32666
  }
@@ -32957,124 +32713,145 @@ function dataEntry() {
32957
32713
  }
32958
32714
  }
32959
32715
  }
32960
- //#endregion
32961
- //#region src/synthesizer/audio_engine/channel/portamento_time.ts
32962
- const PORTA_DIVISION_CONSTANT = 40;
32963
- const SEGMENT_START = [
32964
- 1,
32965
- 2,
32966
- 4,
32967
- 8,
32968
- 16,
32969
- 32,
32970
- 64,
32971
- 80,
32972
- 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,
32973
32811
  112,
32974
- 120,
32975
- 124
32976
- ];
32977
- const SEGMENT_INVERSE_LENGTH = [
32978
- 1,
32979
- .5,
32980
- .25,
32981
- .125,
32982
- .0625,
32983
- .03125,
32984
- .0625,
32985
- .0625,
32986
- .0625,
32987
- .125,
32988
- .25,
32989
- 1 / 3
32990
- ];
32991
- const COEFF_A = [
32992
- -.16653127382501215,
32993
- .11863875218299408,
32994
- .029479047361245264,
32995
- -.005442312089231738,
32996
- .1451520875973037,
32997
- -.005056281449558275,
32998
- -.005095486882876532,
32999
- .03334009551111544,
33000
- -.09361368678020432,
33001
- .14132569702451822,
33002
- -.15805565301011382,
33003
- -.09918856955881927
33004
- ];
33005
- const COEFF_B = [
33006
- .028212773333433472,
33007
- -.3388502064992847,
33008
- -.15839529890929713,
33009
- -.12398131766775483,
33010
- -.2874848552685111,
33011
- .012254866302537692,
33012
- .005957797193345771,
33013
- -.03745899330347374,
33014
- .12911781869810196,
33015
- -.15867193224162568,
33016
- .504406322732748,
33017
- .3786845131875458
33018
- ];
33019
- const COEFF_C = [
33020
- .7218950861255283,
33021
- .5574536226347168,
33022
- .47133893237025826,
33023
- .48597095327079914,
33024
- .44336276333518854,
33025
- .6076986311801551,
33026
- .30851975971827794,
33027
- .30514889345633955,
33028
- .3302511933827384,
33029
- .153822885219165,
33030
- .1302280559047337,
33031
- .49865530675491687
33032
- ];
33033
- const COEFF_D = [
33034
- -2.2218487496163566,
33035
- -1.6382721639824072,
33036
- -1.3010299956639813,
33037
- -.958607314841775,
33038
- -.6020599913279624,
33039
- -.3010299956639812,
33040
- .31386722036915343,
33041
- .6232492903979004,
33042
- .9242792860618817,
33043
- 1.290034611362518,
33044
- 1.4265112613645752,
33045
- 1.9030899869919435
33046
- ];
33047
- const SEGMENT_THRESHOLDS = [
33048
- 2,
33049
- 4,
33050
- 8,
33051
- 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,
33052
32838
  32,
33053
- 64,
33054
- 80,
33055
- 96,
33056
- 112,
33057
- 120,
33058
- 124
33059
- ];
33060
- /**
33061
- * @param cc the CC#5 value (should not be decimal)
33062
- * (PCHIP cubic spline - smooth & exact), optimized with fewer operations than full binary search and interpolation.
33063
- * Created by Benjamin Rosseaux.
33064
- */
33065
- function portaTimeToRate(cc) {
33066
- if (cc < 1) return 0;
33067
- else {
33068
- let s = -1;
33069
- for (let i = SEGMENT_THRESHOLDS.length - 1; i >= 0; i--) if (SEGMENT_THRESHOLDS[i] < cc) {
33070
- s = i;
33071
- break;
33072
- }
33073
- s += 1;
33074
- const t = (cc - SEGMENT_START[s]) * SEGMENT_INVERSE_LENGTH[s];
33075
- return Math.exp(2.302585092994046 * (((COEFF_A[s] * t + COEFF_B[s]) * t + COEFF_C[s]) * t + COEFF_D[s])) / PORTA_DIVISION_CONSTANT;
33076
- }
33077
- }
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
+ ]);
33078
32855
  /**
33079
32856
  * Converts portamento time to seconds.
33080
32857
  * @param time MIDI portamento time (CC 5 value) (0-127)
@@ -33082,10 +32859,10 @@ function portaTimeToRate(cc) {
33082
32859
  * @returns The portamento time in seconds.
33083
32860
  */
33084
32861
  function portamentoTimeToSeconds(time, distance) {
33085
- return portaTimeToRate(time) * distance;
32862
+ if (time < 1) return 0;
32863
+ return distance * 16 / PORTAMENTO_RATES[time];
33086
32864
  }
33087
- //#endregion
33088
- //#region src/synthesizer/audio_engine/channel/note_on.ts
32865
+ // src/synthesizer/audio_engine/channel/note_on.ts
33089
32866
  const clamp = (num, min, max) => Math.max(min, Math.min(max, num));
33090
32867
  /**
33091
32868
  * Sends a "MIDI Note on" message and starts a note.
@@ -33140,10 +32917,12 @@ function noteOn(midiNote, velocity, emit = true) {
33140
32917
  if (this._drumChannel) {
33141
32918
  const p = this.drumParams[midiNote];
33142
32919
  const drumPan = p.pan - 64;
33143
- if (drumPan !== 0) if (drumPan === -64) panOverride = Math.round(randomGenerator() * 1e3 - 500);
33144
- else {
33145
- const channelPan = (this._midiControllers[MIDIControllers.pan] >> 7) - 64;
33146
- 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
+ }
33147
32926
  }
33148
32927
  pitchOffset = p.pitchFine + p.pitchCoarse * 100;
33149
32928
  exclusiveOverride = p.assignGroup;
@@ -33237,8 +33016,7 @@ function noteOn(midiNote, velocity, emit = true) {
33237
33016
  velocity
33238
33017
  });
33239
33018
  }
33240
- //#endregion
33241
- //#region src/synthesizer/audio_engine/channel/note_off.ts
33019
+ // src/synthesizer/audio_engine/channel/note_off.ts
33242
33020
  /**
33243
33021
  * Releases a note by its MIDI note number.
33244
33022
  * If the note is in high performance mode and the channel is not a drum channel,
@@ -33279,8 +33057,7 @@ function noteOff(midiNote) {
33279
33057
  else if (this.lastMonoNote === midiNote) this.noteOn(highest, this.lastMonoVelocity, false);
33280
33058
  }
33281
33059
  }
33282
- //#endregion
33283
- //#region src/synthesizer/audio_engine/channel/program_change.ts
33060
+ // src/synthesizer/audio_engine/channel/program_change.ts
33284
33061
  /**
33285
33062
  * Changes the program (preset) of the channel.
33286
33063
  * @param program The program number (0-127) to change to.
@@ -33316,8 +33093,7 @@ function programChange(program) {
33316
33093
  isDrum: this.preset.isDrum
33317
33094
  });
33318
33095
  }
33319
- //#endregion
33320
- //#region src/synthesizer/audio_engine/voice/voice_modulator.ts
33096
+ // src/synthesizer/audio_engine/voice/voice_modulator.ts
33321
33097
  var VoiceModulator = class VoiceModulator extends Modulator {
33322
33098
  /**
33323
33099
  * Indicates if the given modulator is chorus or reverb effects modulator.
@@ -33347,14 +33123,16 @@ var VoiceModulator = class VoiceModulator extends Modulator {
33347
33123
  static fromData(s1, s2, destination, amount, transformType) {
33348
33124
  const s1Enum = s1.toSourceEnum();
33349
33125
  const s2Enum = s2.toSourceEnum();
33350
- 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);
33351
33130
  }
33352
33131
  static fromModulator(mod) {
33353
33132
  return this.fromData(mod.primarySource, mod.secondarySource, mod.destination, mod.transformAmount, mod.transformType);
33354
33133
  }
33355
33134
  };
33356
- //#endregion
33357
- //#region src/synthesizer/audio_engine/channel/dynamic_modulator_system.ts
33135
+ // src/synthesizer/audio_engine/channel/dynamic_modulator_system.ts
33358
33136
  const INITIAL_MODULATORS = [VoiceModulator.fromModulator(new DecodedModulator(getModSourceEnum(ModulatorCurveTypes.linear, true, false, true, MIDIControllers.vibratoRate), 0, GeneratorTypes.vibLfoRate, 1e3, 0))];
33359
33137
  /**
33360
33138
  * A class for dynamic modulators
@@ -33417,7 +33195,6 @@ var DynamicModulatorManager = class {
33417
33195
  this.setModulator(source, isCC, GeneratorTypes.vibLfoToVolume, normalizedNotCentered * 200, bipolar, false, true);
33418
33196
  this.setModulator(source, isCC, GeneratorTypes.initialAttenuation, normalizedNotCentered * 200, bipolar, false, true);
33419
33197
  SpessaLog.xgInfo(`Channel ${this.channel} ${sourceName} LFO amplitude depth control`, normalizedNotCentered * 200, "dB");
33420
- break;
33421
33198
  }
33422
33199
  }
33423
33200
  setupReceiverGS(addr3, data, source, isCC, sourceName, bipolar = false) {
@@ -33471,7 +33248,6 @@ var DynamicModulatorManager = class {
33471
33248
  case 10:
33472
33249
  this.setModulator(source, isCC, GeneratorTypes.modLfoAmplitudeDepth, normalizedNotCentered * 1e3, bipolar);
33473
33250
  SpessaLog.gsInfo(`Channel ${this.channel} ${sourceName} LFO2 amplitude depth control`, normalizedNotCentered * 100, "%");
33474
- break;
33475
33251
  }
33476
33252
  }
33477
33253
  /**
@@ -33507,9 +33283,8 @@ var DynamicModulatorManager = class {
33507
33283
  this.modulatorList = this.modulatorList.filter((m) => m.id !== id);
33508
33284
  }
33509
33285
  };
33510
- //#endregion
33511
- //#region src/synthesizer/audio_engine/voice/compute_modulator.ts
33512
- const EFFECT_MODULATOR_TRANSFORM_MULTIPLIER = 1e3 / 200;
33286
+ // src/synthesizer/audio_engine/voice/compute_modulator.ts
33287
+ const EFFECT_MODULATOR_TRANSFORM_MULTIPLIER = 5;
33513
33288
  /**
33514
33289
  * Buffer for the generators with the NRPN offsets applied,
33515
33290
  * To avoid allocating on the audio thread.
@@ -33585,8 +33360,7 @@ function computeModulators(voice, sourceUsesCC = -1, sourceIndex = 0) {
33585
33360
  }
33586
33361
  }
33587
33362
  }
33588
- //#endregion
33589
- //#region src/synthesizer/audio_engine/channel/channel_snapshot.ts
33363
+ // src/synthesizer/audio_engine/channel/channel_snapshot.ts
33590
33364
  function getChannelSnapshot() {
33591
33365
  return {
33592
33366
  patch: this.preset ? {
@@ -33643,8 +33417,7 @@ function applySnapshot$1(snapshot) {
33643
33417
  for (const [parameter, value] of Object.entries(snapshot.systemParameters)) this.setSystemParameter(parameter, value);
33644
33418
  this.computeModulatorsAll(-1, 0);
33645
33419
  }
33646
- //#endregion
33647
- //#region src/synthesizer/audio_engine/channel/parameters/midi.ts
33420
+ // src/synthesizer/audio_engine/channel/parameters/midi.ts
33648
33421
  /**
33649
33422
  * The default values for {@link ChannelMIDIParameter}s.
33650
33423
  *
@@ -33688,9 +33461,7 @@ function setMIDIParameterInternal$1(parameter, value) {
33688
33461
  case "pitchWheel":
33689
33462
  this.computeModulatorsAll(0, ModulatorControllerSources.pitchWheel);
33690
33463
  break;
33691
- case "pressure":
33692
- this.computeModulatorsAll(0, ModulatorControllerSources.channelPressure);
33693
- break;
33464
+ case "pressure": this.computeModulatorsAll(0, ModulatorControllerSources.channelPressure);
33694
33465
  }
33695
33466
  this.updateInternalParams();
33696
33467
  this.synthCore.callEvent("channelParamChange", {
@@ -33708,8 +33479,7 @@ function setMIDIParameterInternal$1(parameter, value) {
33708
33479
  function lockMIDIParameterInternal$1(parameter, isLocked) {
33709
33480
  this.lockedMIDIParameters[parameter] = isLocked;
33710
33481
  }
33711
- //#endregion
33712
- //#region src/synthesizer/audio_engine/channel/parameters/system.ts
33482
+ // src/synthesizer/audio_engine/channel/parameters/system.ts
33713
33483
  /**
33714
33484
  * Default values for {@link ChannelSystemParameter}s.
33715
33485
  *
@@ -33747,8 +33517,7 @@ function setSystemParameterInternal$1(parameter, value) {
33747
33517
  case "keyShift": if (!this._drumChannel && prev !== value) this.stopAllNotes(true);
33748
33518
  }
33749
33519
  }
33750
- //#endregion
33751
- //#region src/synthesizer/audio_engine/channel/midi_channel.ts
33520
+ // src/synthesizer/audio_engine/channel/midi_channel.ts
33752
33521
  /**
33753
33522
  * This class represents a single MIDI channel within a {@link SpessaSynthProcessor}.
33754
33523
  *
@@ -33761,13 +33530,13 @@ var MIDIChannel = class {
33761
33530
  * An array for the MIDI 2.0 Per-note pitch wheels.
33762
33531
  * @internal
33763
33532
  */
33764
- pitchWheels = new Int16Array(128).fill(8192);
33533
+ pitchWheels = (/* @__PURE__ */ new Int16Array(128)).fill(8192);
33765
33534
  /**
33766
33535
  * An array of poly pressure values for the channel.
33767
33536
  * Poly pressure persists across notes, much like per-note pitch wheels.
33768
33537
  * @internal
33769
33538
  */
33770
- polyPressures = new Uint8Array(128);
33539
+ polyPressures = /* @__PURE__ */ new Uint8Array(128);
33771
33540
  /**
33772
33541
  * Parameters for each drum instrument.
33773
33542
  * @internal
@@ -33891,14 +33660,14 @@ var MIDIChannel = class {
33891
33660
  * Data entries do store it!
33892
33661
  * @internal
33893
33662
  */
33894
- _midiControllers = new Int16Array(128);
33663
+ _midiControllers = /* @__PURE__ */ new Int16Array(128);
33895
33664
  /**
33896
33665
  * An array of octave tuning values for each note on the channel.
33897
33666
  * Each index corresponds to a note (0 = C, 1 = C#, ..., 11 = B).
33898
33667
  * Note: Repeated every 12 notes.
33899
33668
  * @internal
33900
33669
  */
33901
- octaveTuning = new Int8Array(128);
33670
+ octaveTuning = /* @__PURE__ */ new Int8Array(128);
33902
33671
  /**
33903
33672
  * https://amei.or.jp/midistandardcommittee/Recommended_Practice/e/rp15.pdf
33904
33673
  * Reset controllers according to RP-15 Recommended Practice.
@@ -34332,9 +34101,11 @@ var MIDIChannel = class {
34332
34101
  const channelSystem = this._systemParameters;
34333
34102
  const globalMIDI = this.synthCore.midiParameters;
34334
34103
  const channelMIDI = this._midiParameters;
34335
- 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;
34336
34107
  this.currentKeyShift = Math.trunc(currentKeyShift);
34337
- 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);
34338
34109
  const currentPanNormalized = globalSystem.pan + globalMIDI.pan + channelSystem.pan;
34339
34110
  this.currentPan = currentPanNormalized * 500;
34340
34111
  this.currentGain = SPESSASYNTH_GAIN_FACTOR * globalSystem.gain * Math.pow(globalMIDI.volume, 2) * channelSystem.gain;
@@ -34408,9 +34179,7 @@ var MIDIChannel = class {
34408
34179
  this.setMIDIParameter("drumMap", this.channel % 16 === 9 ? defaultMap : 0);
34409
34180
  break;
34410
34181
  }
34411
- case "pitchWheel":
34412
- this.pitchWheel(8192);
34413
- break;
34182
+ case "pitchWheel": this.pitchWheel(8192);
34414
34183
  }
34415
34184
  }
34416
34185
  /** @internal */
@@ -34515,8 +34284,7 @@ var MIDIChannel = class {
34515
34284
  this.updateInternalParams();
34516
34285
  }
34517
34286
  };
34518
- //#endregion
34519
- //#region src/synthesizer/audio_engine/parameters/system.ts
34287
+ // src/synthesizer/audio_engine/parameters/system.ts
34520
34288
  /**
34521
34289
  * Default values for {@link GlobalSystemParameter}s.
34522
34290
  *
@@ -34543,6 +34311,7 @@ const DEFAULT_GLOBAL_SYSTEM_PARAMETERS = {
34543
34311
  userDrumLock: false,
34544
34312
  blackMIDIMode: false,
34545
34313
  deviceID: -1,
34314
+ pitchBasedKeyShift: false,
34546
34315
  gain: 1,
34547
34316
  pan: 0,
34548
34317
  keyShift: 0,
@@ -34574,11 +34343,13 @@ function setSystemParameterInternal(parameter, value) {
34574
34343
  }
34575
34344
  break;
34576
34345
  }
34577
- 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);
34578
34350
  }
34579
34351
  }
34580
- //#endregion
34581
- //#region src/synthesizer/audio_engine/voice/lowpass_filter.ts
34352
+ // src/synthesizer/audio_engine/voice/lowpass_filter.ts
34582
34353
  /**
34583
34354
  * Applies a lowpass filter to a voice.
34584
34355
  * A lot of the tricks here come from FluidSynth.
@@ -34589,9 +34360,9 @@ function setSystemParameterInternal(parameter, value) {
34589
34360
  */
34590
34361
  const FILTER_SMOOTHING_FACTOR = .03;
34591
34362
  const CHUNK_BITS = 7;
34592
- const CHUNK_MASK = (1 << CHUNK_BITS) - 1;
34363
+ const CHUNK_MASK = 127;
34593
34364
  const CACHE_MAX_CENTS = 16384;
34594
- const CHUNKS_PER_RESONANCE = CACHE_MAX_CENTS >> CHUNK_BITS;
34365
+ const CHUNKS_PER_RESONANCE = 128;
34595
34366
  var LowpassFilter = class LowpassFilter {
34596
34367
  /**
34597
34368
  * Global coefficient caches, shared between all synthesizer instances.
@@ -34742,7 +34513,7 @@ var LowpassFilter = class LowpassFilter {
34742
34513
  const chunkIndex = cutoffCents >> CHUNK_BITS;
34743
34514
  let chunk = this.chunks[chunkIndex];
34744
34515
  if (chunk === void 0) {
34745
- chunk = new Float64Array(5 << CHUNK_BITS).fill(NaN);
34516
+ chunk = (/* @__PURE__ */ new Float64Array(640)).fill(NaN);
34746
34517
  this.chunks[chunkIndex] = chunk;
34747
34518
  }
34748
34519
  const offset = (cutoffCents & CHUNK_MASK) * 5;
@@ -34787,8 +34558,7 @@ var LowpassFilter = class LowpassFilter {
34787
34558
  this.a4 = a2 / a0;
34788
34559
  }
34789
34560
  };
34790
- //#endregion
34791
- //#region src/synthesizer/audio_engine/voice/volume_envelope.ts
34561
+ // src/synthesizer/audio_engine/voice/volume_envelope.ts
34792
34562
  /**
34793
34563
  * Volume_envelope.ts
34794
34564
  * purpose: applies a volume envelope for a given voice
@@ -34912,9 +34682,7 @@ var VolumeEnvelope = class {
34912
34682
  case 3:
34913
34683
  this.releaseStartCb = (1 - (this.decayEnd - this.releaseStartTimeSamples) / this.decayDuration) * sustainCb;
34914
34684
  break;
34915
- case 4:
34916
- this.releaseStartCb = sustainCb;
34917
- break;
34685
+ case 4: this.releaseStartCb = sustainCb;
34918
34686
  }
34919
34687
  this.releaseStartCb = Math.max(0, Math.min(this.releaseStartCb, CB_SILENCE));
34920
34688
  this.attenuationCb = this.releaseStartCb;
@@ -35012,14 +34780,13 @@ var VolumeEnvelope = class {
35012
34780
  return Math.max(0, Math.floor(timecentsToSeconds(tc) * this.sampleRate));
35013
34781
  }
35014
34782
  };
35015
- //#endregion
35016
- //#region src/synthesizer/audio_engine/voice/modulation_envelope.ts
34783
+ // src/synthesizer/audio_engine/voice/modulation_envelope.ts
35017
34784
  /**
35018
34785
  * Modulation_envelope.ts
35019
34786
  * purpose: calculates the modulation envelope for the given voice
35020
34787
  */
35021
34788
  const MODENV_PEAK = 1;
35022
- const CONVEX_ATTACK = new Float32Array(1e3);
34789
+ const CONVEX_ATTACK = /* @__PURE__ */ new Float32Array(1e3);
35023
34790
  for (let i = 0; i < CONVEX_ATTACK.length; i++) CONVEX_ATTACK[i] = getModulatorCurveValue(0, ModulatorCurveTypes.convex, i / 1e3);
35024
34791
  var ModulationEnvelope = class {
35025
34792
  /**
@@ -35121,8 +34888,7 @@ var ModulationEnvelope = class {
35121
34888
  return timecentsToSeconds(timecents);
35122
34889
  }
35123
34890
  };
35124
- //#endregion
35125
- //#region src/synthesizer/audio_engine/voice/wavetable_oscillator/wavetable_oscillator.ts
34891
+ // src/synthesizer/audio_engine/voice/wavetable_oscillator/wavetable_oscillator.ts
35126
34892
  /**
35127
34893
  * Wavetable_oscillator.ts
35128
34894
  * purpose: plays back raw audio data at an arbitrary playback rate
@@ -35173,8 +34939,7 @@ var WavetableOscillator = class {
35173
34939
  */
35174
34940
  hasLooped = false;
35175
34941
  };
35176
- //#endregion
35177
- //#region src/synthesizer/audio_engine/voice/wavetable_oscillator/linear.ts
34942
+ // src/synthesizer/audio_engine/voice/wavetable_oscillator/linear.ts
35178
34943
  var LinearOscillator = class extends WavetableOscillator {
35179
34944
  process(sampleCount, tuningRatio, outputBuffer) {
35180
34945
  const step = tuningRatio * this.playbackStep;
@@ -35221,8 +34986,7 @@ var LinearOscillator = class extends WavetableOscillator {
35221
34986
  return true;
35222
34987
  }
35223
34988
  };
35224
- //#endregion
35225
- //#region src/synthesizer/audio_engine/voice/wavetable_oscillator/nearest.ts
34989
+ // src/synthesizer/audio_engine/voice/wavetable_oscillator/nearest.ts
35226
34990
  var NearestOscillator = class extends WavetableOscillator {
35227
34991
  process(sampleCount, tuningRatio, outputBuffer) {
35228
34992
  const step = tuningRatio * this.playbackStep;
@@ -35246,8 +35010,7 @@ var NearestOscillator = class extends WavetableOscillator {
35246
35010
  return true;
35247
35011
  }
35248
35012
  };
35249
- //#endregion
35250
- //#region src/synthesizer/audio_engine/voice/wavetable_oscillator/hermite.ts
35013
+ // src/synthesizer/audio_engine/voice/wavetable_oscillator/hermite.ts
35251
35014
  var HermiteOscillator = class extends WavetableOscillator {
35252
35015
  process(sampleCount, tuningRatio, outputBuffer) {
35253
35016
  const step = tuningRatio * this.playbackStep;
@@ -35351,8 +35114,7 @@ var HermiteOscillator = class extends WavetableOscillator {
35351
35114
  return true;
35352
35115
  }
35353
35116
  };
35354
- //#endregion
35355
- //#region src/synthesizer/audio_engine/voice/voice.ts
35117
+ // src/synthesizer/audio_engine/voice/voice.ts
35356
35118
  /**
35357
35119
  * Voice.ts
35358
35120
  * purpose: prepares Voices from sample and generator data
@@ -35403,7 +35165,7 @@ var Voice = class {
35403
35165
  * The current values for the respective modulators.
35404
35166
  * If there are more modulators, the array must be resized.
35405
35167
  */
35406
- modulatorValues = new Int16Array(64);
35168
+ modulatorValues = /* @__PURE__ */ new Int16Array(64);
35407
35169
  /**
35408
35170
  * Modulation envelope.
35409
35171
  */
@@ -35585,8 +35347,7 @@ var Voice = class {
35585
35347
  this.noteID = noteID;
35586
35348
  }
35587
35349
  };
35588
- //#endregion
35589
- //#region src/synthesizer/audio_engine/voice/voice_cache.ts
35350
+ // src/synthesizer/audio_engine/voice/voice_cache.ts
35590
35351
  /**
35591
35352
  * Represents a cached voice
35592
35353
  */
@@ -35651,8 +35412,7 @@ var CachedVoice = class {
35651
35412
  this.loopingMode = generators[GeneratorTypes.sampleModes];
35652
35413
  }
35653
35414
  };
35654
- //#endregion
35655
- //#region src/synthesizer/audio_engine/effects/gs/implementation/insertion/thru.ts
35415
+ // src/synthesizer/audio_engine/effects/gs/implementation/insertion/thru.ts
35656
35416
  var ThruFX = class {
35657
35417
  sendLevelToReverb = 40 / 127 * 2;
35658
35418
  sendLevelToChorus = 0;
@@ -35675,8 +35435,7 @@ var ThruFX = class {
35675
35435
  }
35676
35436
  setParameter(parameter, value) {}
35677
35437
  };
35678
- //#endregion
35679
- //#region src/synthesizer/audio_engine/effects/gs/implementation/insertion/convert.ts
35438
+ // src/synthesizer/audio_engine/effects/gs/implementation/insertion/convert.ts
35680
35439
  var InsertionValueConverter = class {
35681
35440
  static data = [
35682
35441
  [
@@ -37771,14 +37530,13 @@ var InsertionValueConverter = class {
37771
37530
  return this.data[value][13];
37772
37531
  }
37773
37532
  };
37774
- //#endregion
37775
- //#region src/synthesizer/audio_engine/effects/gs/implementation/insertion/utils.ts
37533
+ // src/synthesizer/audio_engine/effects/gs/implementation/insertion/utils.ts
37776
37534
  const HALF_PI = Math.PI / 2;
37777
37535
  const MIN_PAN = -64;
37778
37536
  const MAX_PAN = 63;
37779
- const PAN_RESOLUTION = MAX_PAN - MIN_PAN;
37780
- const PAN_TABLE_LEFT = new Float32Array(PAN_RESOLUTION + 1);
37781
- 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);
37782
37540
  for (let pan = MIN_PAN; pan <= MAX_PAN; pan++) {
37783
37541
  const realPan = (pan - MIN_PAN) / PAN_RESOLUTION;
37784
37542
  const tableIndex = pan - MIN_PAN;
@@ -37830,7 +37588,7 @@ function computeShelfCoeffs(coeffs, dbGain, f0, fs, isLow) {
37830
37588
  const A = Math.pow(10, dbGain / 40);
37831
37589
  const w0 = 2 * Math.PI * f0 / fs;
37832
37590
  const cosw0 = Math.cos(w0);
37833
- 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);
37834
37592
  let b0, b1, b2, a0, a1, a2;
37835
37593
  if (isLow) {
37836
37594
  b0 = A * (A + 1 - (A - 1) * cosw0 + 2 * Math.sqrt(A) * alpha);
@@ -37860,8 +37618,7 @@ const ZeroStateC = {
37860
37618
  y1: 0,
37861
37619
  y2: 0
37862
37620
  };
37863
- //#endregion
37864
- //#region src/synthesizer/audio_engine/effects/gs/implementation/insertion/stereo_eq.ts
37621
+ // src/synthesizer/audio_engine/effects/gs/implementation/insertion/stereo_eq.ts
37865
37622
  /**
37866
37623
  * Stereo-EQ
37867
37624
  * This is a four-band stereo equalizer (low, mid x 2, high).
@@ -38024,9 +37781,7 @@ var StereoEQFX = class {
38024
37781
  case 12:
38025
37782
  this.m2Gain = value - 64;
38026
37783
  break;
38027
- case 22:
38028
- this.level = value / 127;
38029
- break;
37784
+ case 22: this.level = value / 127;
38030
37785
  }
38031
37786
  this.updateCoefficients();
38032
37787
  }
@@ -38123,8 +37878,7 @@ function computeHighShelfCoeffs(coeffs, freq, gainDB, sampleRate) {
38123
37878
  coeffs.b1 = b1 / a0;
38124
37879
  coeffs.b2 = b2 / a0;
38125
37880
  }
38126
- //#endregion
38127
- //#region src/synthesizer/audio_engine/effects/gs/implementation/insertion/phaser.ts
37881
+ // src/synthesizer/audio_engine/effects/gs/implementation/insertion/phaser.ts
38128
37882
  const ALL_PASS_STAGES = 8;
38129
37883
  const DEPTH_DIV = 128;
38130
37884
  const MANUAL_MULTIPLIER = 4;
@@ -38321,9 +38075,7 @@ var PhaserFX = class {
38321
38075
  case 20:
38322
38076
  this.hiGain = value - 64;
38323
38077
  break;
38324
- case 22:
38325
- this.level = value / 127;
38326
- break;
38078
+ case 22: this.level = value / 127;
38327
38079
  }
38328
38080
  this.updateShelves();
38329
38081
  }
@@ -38351,8 +38103,7 @@ var PhaserFX = class {
38351
38103
  computeShelfCoeffs(this.highShelfCoef, this.hiGain, 4e3, this.sampleRate, false);
38352
38104
  }
38353
38105
  };
38354
- //#endregion
38355
- //#region src/synthesizer/audio_engine/effects/gs/implementation/insertion/auto_pan.ts
38106
+ // src/synthesizer/audio_engine/effects/gs/implementation/insertion/auto_pan.ts
38356
38107
  const PI_2$1 = Math.PI * 2;
38357
38108
  const GAIN_LVL = .935;
38358
38109
  const LEVEL_EXP = 2;
@@ -38463,9 +38214,7 @@ var AutoPanFX = class {
38463
38214
  case 3:
38464
38215
  lfo = 1 - 2 * phase;
38465
38216
  break;
38466
- case 4:
38467
- lfo = 2 * phase - 1;
38468
- break;
38217
+ case 4: lfo = 2 * phase - 1;
38469
38218
  }
38470
38219
  if ((phase += rateInc) >= 1) phase -= 1;
38471
38220
  currentPan += (lfo - currentPan) * PAN_SMOOTHING;
@@ -38503,9 +38252,7 @@ var AutoPanFX = class {
38503
38252
  case 20:
38504
38253
  this.hiGain = value - 64;
38505
38254
  break;
38506
- case 22:
38507
- this.level = value / 127;
38508
- break;
38255
+ case 22: this.level = value / 127;
38509
38256
  }
38510
38257
  this.updateShelves();
38511
38258
  }
@@ -38514,8 +38261,7 @@ var AutoPanFX = class {
38514
38261
  computeShelfCoeffs(this.hsCoeffs, this.hiGain, 4e3, this.sampleRate, false);
38515
38262
  }
38516
38263
  };
38517
- //#endregion
38518
- //#region src/synthesizer/audio_engine/effects/gs/implementation/insertion/auto_wah.ts
38264
+ // src/synthesizer/audio_engine/effects/gs/implementation/insertion/auto_wah.ts
38519
38265
  const DEFAULT_LEVEL$2 = 96;
38520
38266
  const attackTime = .1;
38521
38267
  const releaseTime = .1;
@@ -38734,9 +38480,7 @@ var AutoWahFX = class {
38734
38480
  case 21:
38735
38481
  this.pan = value - 64;
38736
38482
  break;
38737
- case 22:
38738
- this.level = value / 127;
38739
- break;
38483
+ case 22: this.level = value / 127;
38740
38484
  }
38741
38485
  this.updateShelves();
38742
38486
  }
@@ -38786,8 +38530,7 @@ function computeHighpassCoeffs(coeffs, freq, Q, sampleRate) {
38786
38530
  coeffs.b1 = b1 / a0;
38787
38531
  coeffs.b2 = b2 / a0;
38788
38532
  }
38789
- //#endregion
38790
- //#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
38791
38534
  const DEFAULT_LEVEL$1 = 127;
38792
38535
  var PhAutoWahFX = class {
38793
38536
  sendLevelToReverb = 40 / 127 * 2;
@@ -38890,14 +38633,11 @@ var PhAutoWahFX = class {
38890
38633
  case 21:
38891
38634
  this.autoWah.setParameter(22, value);
38892
38635
  break;
38893
- case 22:
38894
- this.level = value / 127;
38895
- break;
38636
+ case 22: this.level = value / 127;
38896
38637
  }
38897
38638
  }
38898
38639
  };
38899
- //#endregion
38900
- //#region src/synthesizer/audio_engine/effects/gs/implementation/insertion/tremolo.ts
38640
+ // src/synthesizer/audio_engine/effects/gs/implementation/insertion/tremolo.ts
38901
38641
  const DEFAULT_LEVEL = 127;
38902
38642
  const PI_2 = Math.PI * 2;
38903
38643
  const GAIN_SMOOTHING = .01;
@@ -39004,9 +38744,7 @@ var TremoloFX = class {
39004
38744
  case 3:
39005
38745
  lfo = 1 - 2 * phase;
39006
38746
  break;
39007
- case 4:
39008
- lfo = 2 * phase - 1;
39009
- break;
38747
+ case 4: lfo = 2 * phase - 1;
39010
38748
  }
39011
38749
  if ((phase += rateInc) >= 1) phase -= 1;
39012
38750
  const tremoloLevel = 1 - (lfo / 2 + .5) * (modDepth / 127);
@@ -39042,9 +38780,7 @@ var TremoloFX = class {
39042
38780
  case 20:
39043
38781
  this.hiGain = value - 64;
39044
38782
  break;
39045
- case 22:
39046
- this.level = value / 127;
39047
- break;
38783
+ case 22: this.level = value / 127;
39048
38784
  }
39049
38785
  this.updateShelves();
39050
38786
  }
@@ -39053,8 +38789,7 @@ var TremoloFX = class {
39053
38789
  computeShelfCoeffs(this.hsCoeffs, this.hiGain, 4e3, this.sampleRate, false);
39054
38790
  }
39055
38791
  };
39056
- //#endregion
39057
- //#region src/synthesizer/audio_engine/effects/gs/implementation/insertion_list.ts
38792
+ // src/synthesizer/audio_engine/effects/gs/implementation/insertion_list.ts
39058
38793
  const GS_INSERTION_EFFECT_LIST = [
39059
38794
  ThruFX,
39060
38795
  StereoEQFX,
@@ -39064,8 +38799,7 @@ const GS_INSERTION_EFFECT_LIST = [
39064
38799
  PhAutoWahFX,
39065
38800
  TremoloFX
39066
38801
  ];
39067
- //#endregion
39068
- //#region src/synthesizer/audio_engine/parameters/midi.ts
38802
+ // src/synthesizer/audio_engine/parameters/midi.ts
39069
38803
  /**
39070
38804
  * Default values for {@link GlobalMIDIParameter}s.
39071
38805
  *
@@ -39101,8 +38835,7 @@ function setMIDIParameterInternal(parameter, value) {
39101
38835
  function lockMIDIParameterInternal(parameter, isLocked) {
39102
38836
  this.lockedMIDIParameters[parameter] = isLocked;
39103
38837
  }
39104
- //#endregion
39105
- //#region src/synthesizer/audio_engine/system_exclusive/universal.ts
38838
+ // src/synthesizer/audio_engine/system_exclusive/universal.ts
39106
38839
  /**
39107
38840
  * Calculates frequency for MIDI Tuning Standard.
39108
38841
  * @param byte1 The first byte (midi note).
@@ -39234,7 +38967,6 @@ function universalSystemExclusive(syx, channelOffset = 0) {
39234
38967
  parameter: "sendLevelToReverb",
39235
38968
  value
39236
38969
  });
39237
- break;
39238
38970
  }
39239
38971
  }
39240
38972
  }
@@ -39260,7 +38992,6 @@ function universalSystemExclusive(syx, channelOffset = 0) {
39260
38992
  case 3:
39261
38993
  SpessaLog.coolInfo("MIDI System", "General MIDI 2");
39262
38994
  this.reset("gm2");
39263
- break;
39264
38995
  }
39265
38996
  break;
39266
38997
  case 8: {
@@ -39300,7 +39031,7 @@ function universalSystemExclusive(syx, channelOffset = 0) {
39300
39031
  }
39301
39032
  case 9:
39302
39033
  case 8: {
39303
- const newOctaveTuning = new Int8Array(12);
39034
+ const newOctaveTuning = /* @__PURE__ */ new Int8Array(12);
39304
39035
  if (syx[3] === 8) for (let i = 0; i < 12; i++) newOctaveTuning[i] = syx[7 + i] - 64;
39305
39036
  else for (let i = 0; i < 24; i += 2) {
39306
39037
  const tuning = (syx[7 + i] << 7 | syx[8 + i]) - 8192;
@@ -39313,17 +39044,14 @@ function universalSystemExclusive(syx, channelOffset = 0) {
39313
39044
  SpessaLog.gmInfo("Octave Scale Tuning", newOctaveTuning.join(" "));
39314
39045
  break;
39315
39046
  }
39316
- default:
39317
- SpessaLog.gmFail("MIDI Tuning Standard", syx);
39318
- break;
39047
+ default: SpessaLog.gmFail("MIDI Tuning Standard", syx);
39319
39048
  }
39320
39049
  break;
39321
39050
  }
39322
39051
  default: SpessaLog.gmFail("Universal System Exclusive", syx);
39323
39052
  }
39324
39053
  }
39325
- //#endregion
39326
- //#region src/synthesizer/audio_engine/system_exclusive/roland.ts
39054
+ // src/synthesizer/audio_engine/system_exclusive/roland.ts
39327
39055
  function handleUserDrum(a2, a3, data, syx) {
39328
39056
  if (this.systemParameters.userDrumLock) return;
39329
39057
  const drumSet = a2 >> 4;
@@ -39436,9 +39164,7 @@ function rolandSystemExclusive(syx, channelOffset = 0) {
39436
39164
  this.reset("gm");
39437
39165
  }
39438
39166
  break;
39439
- default:
39440
- SpessaLog.gsFail("System Parameter", syx);
39441
- break;
39167
+ default: SpessaLog.gsFail("System Parameter", syx);
39442
39168
  }
39443
39169
  return;
39444
39170
  }
@@ -39688,7 +39414,6 @@ function rolandSystemExclusive(syx, channelOffset = 0) {
39688
39414
  parameter: "sendLevelToReverb",
39689
39415
  value: data
39690
39416
  });
39691
- break;
39692
39417
  }
39693
39418
  break;
39694
39419
  }
@@ -39876,7 +39601,7 @@ function rolandSystemExclusive(syx, channelOffset = 0) {
39876
39601
  break;
39877
39602
  case 64: {
39878
39603
  const tuningBytes = syx.length - 9;
39879
- const newTuning = new Int8Array(12);
39604
+ const newTuning = /* @__PURE__ */ new Int8Array(12);
39880
39605
  for (let i = 0; i < tuningBytes; i++) newTuning[i] = syx[i + 7] - 64;
39881
39606
  ch.setOctaveTuning(newTuning);
39882
39607
  SpessaLog.gsInfo(`Octave Scale Tuning for ${channel}`, newTuning.join(", "));
@@ -40033,7 +39758,6 @@ function rolandSystemExclusive(syx, channelOffset = 0) {
40033
39758
  ch.drumParams[drumKey].variationSend = data;
40034
39759
  }
40035
39760
  SpessaLog.gsInfo(`Drum Delay for MAP${map}, key ${drumKey}`, data);
40036
- break;
40037
39761
  }
40038
39762
  return;
40039
39763
  }
@@ -40088,9 +39812,7 @@ function rolandSystemExclusive(syx, channelOffset = 0) {
40088
39812
  case 10:
40089
39813
  actualDrumParam = 12;
40090
39814
  break;
40091
- case 11:
40092
- actualDrumParam = 0;
40093
- break;
39815
+ case 11: actualDrumParam = 0;
40094
39816
  }
40095
39817
  const address2 = a2 & 240 | actualDrumParam;
40096
39818
  for (let midiNote = 0; midiNote < dataLength; midiNote++) handleUserDrum.call(this, address2, midiNote, syx[midiNote + 7], syx);
@@ -40114,8 +39836,7 @@ function rolandSystemExclusive(syx, channelOffset = 0) {
40114
39836
  return;
40115
39837
  }
40116
39838
  }
40117
- //#endregion
40118
- //#region src/synthesizer/audio_engine/system_exclusive/yamaha.ts
39839
+ // src/synthesizer/audio_engine/system_exclusive/yamaha.ts
40119
39840
  /**
40120
39841
  * Handles a Yamaha XG system exclusive
40121
39842
  * http://www.studio4all.de/htmle/main91.html
@@ -40157,7 +39878,6 @@ function yamahaSystemExclusive(syx, channelOffset = 0) {
40157
39878
  case 126:
40158
39879
  SpessaLog.coolInfo("MIDI System", "Yamaha XG");
40159
39880
  this.reset("xg");
40160
- break;
40161
39881
  }
40162
39882
  return;
40163
39883
  }
@@ -40692,9 +40412,7 @@ function yamahaSystemExclusive(syx, channelOffset = 0) {
40692
40412
  case 103:
40693
40413
  ch.controllerChange(MIDIControllers.portamentoOnOff, data === 1 ? 127 : 0);
40694
40414
  break;
40695
- case 104:
40696
- ch.controllerChange(MIDIControllers.portamentoTime, data);
40697
- break;
40415
+ case 104: ch.controllerChange(MIDIControllers.portamentoTime, data);
40698
40416
  }
40699
40417
  return;
40700
40418
  }
@@ -40779,7 +40497,6 @@ function yamahaSystemExclusive(syx, channelOffset = 0) {
40779
40497
  ch.drumParams[drumKey].rxNoteOn = data === 1;
40780
40498
  }
40781
40499
  SpessaLog.xgInfo(`Drum Note On for key ${drumKey}`, data === 1 ? "ON" : "OFF");
40782
- break;
40783
40500
  }
40784
40501
  return;
40785
40502
  }
@@ -40790,16 +40507,14 @@ function yamahaSystemExclusive(syx, channelOffset = 0) {
40790
40507
  SpessaLog.xgFail("System Exclusive", syx, "Unknown address");
40791
40508
  } else SpessaLog.xgFail("System Exclusive", syx);
40792
40509
  }
40793
- //#endregion
40794
- //#region src/synthesizer/audio_engine/synth_processor_options.ts
40510
+ // src/synthesizer/audio_engine/synth_processor_options.ts
40795
40511
  const DEFAULT_SYNTH_OPTIONS = {
40796
40512
  effectsEnabled: true,
40797
40513
  maxBufferSize: 128,
40798
40514
  initialTime: 0,
40799
40515
  eventsEnabled: true
40800
40516
  };
40801
- //#endregion
40802
- //#region src/soundbank/soundfont/read/generators.ts
40517
+ // src/soundbank/soundfont/read/generators.ts
40803
40518
  var ReadGenerator = class extends Generator {
40804
40519
  /**
40805
40520
  * Creates a generator
@@ -40821,8 +40536,7 @@ function readGenerators(generatorChunk) {
40821
40536
  gens.pop();
40822
40537
  return gens;
40823
40538
  }
40824
- //#endregion
40825
- //#region src/soundbank/soundfont/read/preset_zones.ts
40539
+ // src/soundbank/soundfont/read/preset_zones.ts
40826
40540
  /**
40827
40541
  * Preset_zones.ts
40828
40542
  * purpose: reads preset zones from soundfont and gets their respective samples and generators and modulators
@@ -40849,8 +40563,7 @@ function applyPresetZones(indexes, presetGens, presetMods, instruments, presets)
40849
40563
  }
40850
40564
  }
40851
40565
  }
40852
- //#endregion
40853
- //#region src/soundbank/soundfont/read/presets.ts
40566
+ // src/soundbank/soundfont/read/presets.ts
40854
40567
  /**
40855
40568
  * Parses soundfont presets, also includes function for getting the generators and samples from midi note and velocity
40856
40569
  */
@@ -40902,8 +40615,7 @@ function readPresets(presetChunk, parent, keepTerminal = false) {
40902
40615
  if (!keepTerminal) presets.pop();
40903
40616
  return presets;
40904
40617
  }
40905
- //#endregion
40906
- //#region src/soundbank/soundfont/read/instruments.ts
40618
+ // src/soundbank/soundfont/read/instruments.ts
40907
40619
  /**
40908
40620
  * Instrument.ts
40909
40621
  * purpose: parses soundfont instrument and stores them as a class
@@ -40948,8 +40660,7 @@ function readInstruments(instrumentChunk, keepTerminal = false) {
40948
40660
  if (!keepTerminal) instruments.pop();
40949
40661
  return instruments;
40950
40662
  }
40951
- //#endregion
40952
- //#region src/soundbank/soundfont/read/modulators.ts
40663
+ // src/soundbank/soundfont/read/modulators.ts
40953
40664
  /**
40954
40665
  * Reads the modulator read
40955
40666
  */
@@ -40967,8 +40678,7 @@ function readModulators(modulatorChunk) {
40967
40678
  mods.pop();
40968
40679
  return mods;
40969
40680
  }
40970
- //#endregion
40971
- //#region src/soundbank/soundfont/read/instrument_zones.ts
40681
+ // src/soundbank/soundfont/read/instrument_zones.ts
40972
40682
  /**
40973
40683
  * Reads the given instrument zone
40974
40684
  */
@@ -40991,8 +40701,7 @@ function applyInstrumentZones(indexes, instrumentGenerators, instrumentModulator
40991
40701
  }
40992
40702
  }
40993
40703
  }
40994
- //#endregion
40995
- //#region src/soundbank/soundfont/read/zones.ts
40704
+ // src/soundbank/soundfont/read/zones.ts
40996
40705
  /**
40997
40706
  * @param zonesChunk both pbag and ibag work
40998
40707
  */
@@ -41008,8 +40717,7 @@ function readZoneIndexes(zonesChunk) {
41008
40717
  gen: genStartIndexes
41009
40718
  };
41010
40719
  }
41011
- //#endregion
41012
- //#region src/soundbank/soundfont/read/soundfont.ts
40720
+ // src/soundbank/soundfont/read/soundfont.ts
41013
40721
  /**
41014
40722
  * Soundfont.ts
41015
40723
  * purpose: parses a soundfont2 file
@@ -41167,7 +40875,7 @@ var SoundFont2 = class extends BasicSoundBank {
41167
40875
  mainFileArray.currentIndex = this.sampleDataStartIndex;
41168
40876
  const samples = readSamples(shdrChunk, sampleData, xdtaChunk === void 0);
41169
40877
  if (xdtaChunk && xChunks.shdr) {
41170
- const xSamples = readSamples(xChunks.shdr, new Float32Array(1), false);
40878
+ const xSamples = readSamples(xChunks.shdr, /* @__PURE__ */ new Float32Array(1), false);
41171
40879
  if (xSamples.length === samples.length) for (const [i, s] of samples.entries()) {
41172
40880
  s.name += xSamples[i].name;
41173
40881
  s.linkedSampleIndex |= xSamples[i].linkedSampleIndex << 16;
@@ -41250,8 +40958,7 @@ var SoundFont2 = class extends BasicSoundBank {
41250
40958
  }
41251
40959
  }
41252
40960
  };
41253
- //#endregion
41254
- //#region src/soundbank/sound_bank_loader.ts
40961
+ // src/soundbank/sound_bank_loader.ts
41255
40962
  /**
41256
40963
  * A helper class for loading sound bank files as {@link BasicSoundBank} instances.
41257
40964
  *
@@ -41271,8 +40978,7 @@ var SoundBankLoader = class {
41271
40978
  return new SoundFont2(buffer, id === "sfen");
41272
40979
  }
41273
40980
  };
41274
- //#endregion
41275
- //#region src/synthesizer/audio_engine/synthesizer_snapshot.ts
40981
+ // src/synthesizer/audio_engine/synthesizer_snapshot.ts
41276
40982
  function applySnapshot(snapshot) {
41277
40983
  while (this.midiChannels.length < snapshot.midiChannels.length) this.createMIDIChannel();
41278
40984
  for (let i = 0; i < snapshot.midiChannels.length; i++) this.midiChannels[i].applySnapshot(snapshot.midiChannels[i]);
@@ -41314,8 +41020,7 @@ function getSynthesizerSnapshot() {
41314
41020
  userDrumSets: this.soundBankManager.userDrumSets.map((d) => d.getSnapshot())
41315
41021
  };
41316
41022
  }
41317
- //#endregion
41318
- //#region src/synthesizer/processor.ts
41023
+ // src/synthesizer/processor.ts
41319
41024
  /**
41320
41025
  * Gain smoothing for rapid volume changes. Must be run EVERY SAMPLE
41321
41026
  */
@@ -41551,7 +41256,7 @@ var SpessaSynthProcessor = class {
41551
41256
  * -1 means no change.
41552
41257
  * @internal
41553
41258
  */
41554
- tunings = new Float32Array(16384).fill(-1);
41259
+ tunings = (/* @__PURE__ */ new Float32Array(16384)).fill(-1);
41555
41260
  /**
41556
41261
  * An object indicating if a Global MIDI parameter, at the equivalent key, is locked
41557
41262
  * (i.e., not allowed changing).
@@ -41699,7 +41404,7 @@ var SpessaSynthProcessor = class {
41699
41404
  * note: 255 means "no change"
41700
41405
  * @internal
41701
41406
  */
41702
- gsInsertionParams = new Uint8Array(23).fill(255);
41407
+ gsInsertionParams = (/* @__PURE__ */ new Uint8Array(23)).fill(255);
41703
41408
  /**
41704
41409
  * Left float32 buffer for processing XG insertion effects in-place.
41705
41410
  * (channel outputs are double precision)
@@ -41859,7 +41564,6 @@ var SpessaSynthProcessor = class {
41859
41564
  SpessaLog.info(`%cPort select, channel offset %c${this.portSelectChannelOffset}%c. Creating a new port!`, ConsoleColors.info, ConsoleColors.value, ConsoleColors.info);
41860
41565
  for (let i = 0; i < 16; i++) this.createMIDIChannel();
41861
41566
  }
41862
- break;
41863
41567
  }
41864
41568
  }
41865
41569
  /**
@@ -42929,10 +42633,7 @@ var SpessaSynthProcessor = class {
42929
42633
  case MIDIMessageTypes.systemExclusive:
42930
42634
  this.systemExclusive(new IndexedByteArray(message.slice(1)), channelOffset);
42931
42635
  break;
42932
- case MIDIMessageTypes.reset:
42933
- this.reset();
42934
- break;
42935
- default: break;
42636
+ case MIDIMessageTypes.reset: this.reset();
42936
42637
  }
42937
42638
  }
42938
42639
  /**
@@ -42993,7 +42694,6 @@ var SpessaSynthProcessor = class {
42993
42694
  return bankMSB + bankLSB * 129 + program * 16512 + 2113536 * midiNote + 270532608 * velocity;
42994
42695
  }
42995
42696
  };
42996
- //#endregion
42997
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 };
42998
42698
 
42999
42699
  //# sourceMappingURL=index.js.map