spessasynth_core 4.2.3 → 4.2.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.ts CHANGED
@@ -531,12 +531,39 @@ declare const dataEntryStates: {
531
531
  };
532
532
  type DataEntryState = (typeof dataEntryStates)[keyof typeof dataEntryStates];
533
533
  declare const customControllers: {
534
+ /**
535
+ * Cents, RPN for fine-tuning
536
+ */
534
537
  readonly channelTuning: 0;
538
+ /**
539
+ * Cents, only the decimal tuning, (e.g., transpose is 4.5,
540
+ * Then shift by 4 keys + tune by 50 cents)
541
+ */
535
542
  readonly channelTransposeFine: 1;
543
+ /**
544
+ * The MIDI specification assumes the default modulation depth is 50 cents,
545
+ * but it may vary for different sound banks.
546
+ * For example, if you want a modulation depth of 100 cents,
547
+ * the multiplier will be 2,
548
+ * which, for a preset with a depth of 50,
549
+ * will create a total modulation depth of 100 cents.
550
+ */
536
551
  readonly modulationMultiplier: 2;
552
+ /**
553
+ * Cents, set by system exclusive
554
+ */
537
555
  readonly masterTuning: 3;
556
+ /**
557
+ * Semitones, for RPN coarse tuning
558
+ */
538
559
  readonly channelTuningSemitones: 4;
560
+ /**
561
+ * Key shift: for system exclusive
562
+ */
539
563
  readonly channelKeyShift: 5;
564
+ /**
565
+ * Sf2 NPRN LSB for selecting a generator value
566
+ */
540
567
  readonly sf2NPRNGeneratorLSB: 6;
541
568
  };
542
569
  type CustomController = (typeof customControllers)[keyof typeof customControllers];
@@ -1061,7 +1088,7 @@ interface InsertionProcessorSnapshot {
1061
1088
  */
1062
1089
  channels: boolean[];
1063
1090
  }
1064
- type InsertionProcessorConstructor = new (sampleRate: number) => InsertionProcessor;
1091
+ type InsertionProcessorConstructor = new (sampleRate: number, maxBufferSize: number) => InsertionProcessor;
1065
1092
 
1066
1093
  type SynthSystem = "gm" | "gm2" | "gs" | "xg";
1067
1094
  interface NoteOnCallback {
@@ -1373,6 +1400,12 @@ interface ChannelProperty {
1373
1400
  transposition: number;
1374
1401
  }
1375
1402
  interface SynthProcessorOptions {
1403
+ /**
1404
+ * The maximum buffer size the synthesizer can render at once.
1405
+ * Attempting to `.process()` more samples than this will result in an error.
1406
+ * Defaults to 128.
1407
+ */
1408
+ maxBufferSize: number;
1376
1409
  /**
1377
1410
  * Indicates if the event system is enabled. This can be changed later.
1378
1411
  */
@@ -1388,15 +1421,15 @@ interface SynthProcessorOptions {
1388
1421
  /**
1389
1422
  * Reverb processor for the synthesizer. Leave undefined to use the default.
1390
1423
  */
1391
- reverbProcessor: ReverbProcessor;
1424
+ reverbProcessor?: ReverbProcessor;
1392
1425
  /**
1393
1426
  * Chorus processor for the synthesizer. Leave undefined to use the default.
1394
1427
  */
1395
- chorusProcessor: ChorusProcessor;
1428
+ chorusProcessor?: ChorusProcessor;
1396
1429
  /**
1397
1430
  * Delay processor for the synthesizer. Leave undefined to use the default.
1398
1431
  */
1399
- delayProcessor: DelayProcessor;
1432
+ delayProcessor?: DelayProcessor;
1400
1433
  }
1401
1434
  /**
1402
1435
  * The master parameters of the synthesizer.
@@ -1615,11 +1648,6 @@ declare class Voice {
1615
1648
  * Volume envelope.
1616
1649
  */
1617
1650
  readonly volEnv: VolumeEnvelope;
1618
- /**
1619
- * The buffer to use when rendering the voice (to avoid memory allocations)
1620
- * If the user supplied a larger one, it must be resized.
1621
- */
1622
- buffer: Float32Array<ArrayBuffer>;
1623
1651
  /**
1624
1652
  * Resonance offset, it is affected by the default resonant modulator
1625
1653
  */
@@ -2842,26 +2870,34 @@ declare class SynthesizerCore {
2842
2870
  * All MIDI channels of the synthesizer.
2843
2871
  */
2844
2872
  readonly midiChannels: MIDIChannel[];
2873
+ /**
2874
+ * The maximum allowed buffer size to render.
2875
+ */
2876
+ readonly maxBufferSize: number;
2877
+ /**
2878
+ * The buffer to use when rendering a voice.
2879
+ */
2880
+ readonly voiceBuffer: Float32Array<ArrayBuffer>;
2845
2881
  /**
2846
2882
  * The insertion processor's left input buffer.
2847
2883
  */
2848
- insertionInputL: Float32Array<ArrayBuffer>;
2884
+ readonly insertionInputL: Float32Array<ArrayBuffer>;
2849
2885
  /**
2850
2886
  * The insertion processor's right input buffer.
2851
2887
  */
2852
- insertionInputR: Float32Array<ArrayBuffer>;
2888
+ readonly insertionInputR: Float32Array<ArrayBuffer>;
2853
2889
  /**
2854
2890
  * The reverb processor's input buffer.
2855
2891
  */
2856
- reverbInput: Float32Array<ArrayBuffer>;
2892
+ readonly reverbInput: Float32Array<ArrayBuffer>;
2857
2893
  /**
2858
2894
  * The chorus processor's input buffer.
2859
2895
  */
2860
- chorusInput: Float32Array<ArrayBuffer>;
2896
+ readonly chorusInput: Float32Array<ArrayBuffer>;
2861
2897
  /**
2862
2898
  * The delay processor's input buffer.
2863
2899
  */
2864
- delayInput: Float32Array<ArrayBuffer>;
2900
+ readonly delayInput: Float32Array<ArrayBuffer>;
2865
2901
  /**
2866
2902
  * Delay is not used outside SC-88+ MIDIs, this is an optimization.
2867
2903
  */
@@ -3575,7 +3611,7 @@ declare class SpessaSynthProcessor {
3575
3611
  */
3576
3612
  onEventCall?: (event: SynthProcessorEvent) => unknown;
3577
3613
  /**
3578
- * Renders float32 audio data to stereo outputs; buffer size of 128 is recommended.
3614
+ * Renders float32 audio data to stereo outputs; buffer size must be equal or smaller than `maxBufferSize`
3579
3615
  * All float arrays must have the same length.
3580
3616
  * @param left the left output channel.
3581
3617
  * @param right the right output channel.
@@ -3584,7 +3620,7 @@ declare class SpessaSynthProcessor {
3584
3620
  */
3585
3621
  readonly process: (left: Float32Array, right: Float32Array, startIndex?: number, sampleCount?: number) => void;
3586
3622
  /**
3587
- * Renders float32 audio data to stereo outputs; buffer size of 128 is recommended.
3623
+ * Renders float32 audio data to stereo outputs; buffer size must be equal or smaller than `maxBufferSize
3588
3624
  * All float arrays must have the same length.
3589
3625
  * @param outputs any number stereo pairs (L, R) to render channels separately into.
3590
3626
  * @param effectsLeft the left stereo effect output buffer.