spessasynth_core 4.2.4 → 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
@@ -1088,7 +1088,7 @@ interface InsertionProcessorSnapshot {
1088
1088
  */
1089
1089
  channels: boolean[];
1090
1090
  }
1091
- type InsertionProcessorConstructor = new (sampleRate: number) => InsertionProcessor;
1091
+ type InsertionProcessorConstructor = new (sampleRate: number, maxBufferSize: number) => InsertionProcessor;
1092
1092
 
1093
1093
  type SynthSystem = "gm" | "gm2" | "gs" | "xg";
1094
1094
  interface NoteOnCallback {
@@ -1400,6 +1400,12 @@ interface ChannelProperty {
1400
1400
  transposition: number;
1401
1401
  }
1402
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;
1403
1409
  /**
1404
1410
  * Indicates if the event system is enabled. This can be changed later.
1405
1411
  */
@@ -1415,15 +1421,15 @@ interface SynthProcessorOptions {
1415
1421
  /**
1416
1422
  * Reverb processor for the synthesizer. Leave undefined to use the default.
1417
1423
  */
1418
- reverbProcessor: ReverbProcessor;
1424
+ reverbProcessor?: ReverbProcessor;
1419
1425
  /**
1420
1426
  * Chorus processor for the synthesizer. Leave undefined to use the default.
1421
1427
  */
1422
- chorusProcessor: ChorusProcessor;
1428
+ chorusProcessor?: ChorusProcessor;
1423
1429
  /**
1424
1430
  * Delay processor for the synthesizer. Leave undefined to use the default.
1425
1431
  */
1426
- delayProcessor: DelayProcessor;
1432
+ delayProcessor?: DelayProcessor;
1427
1433
  }
1428
1434
  /**
1429
1435
  * The master parameters of the synthesizer.
@@ -1642,11 +1648,6 @@ declare class Voice {
1642
1648
  * Volume envelope.
1643
1649
  */
1644
1650
  readonly volEnv: VolumeEnvelope;
1645
- /**
1646
- * The buffer to use when rendering the voice (to avoid memory allocations)
1647
- * If the user supplied a larger one, it must be resized.
1648
- */
1649
- buffer: Float32Array<ArrayBuffer>;
1650
1651
  /**
1651
1652
  * Resonance offset, it is affected by the default resonant modulator
1652
1653
  */
@@ -2869,26 +2870,34 @@ declare class SynthesizerCore {
2869
2870
  * All MIDI channels of the synthesizer.
2870
2871
  */
2871
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>;
2872
2881
  /**
2873
2882
  * The insertion processor's left input buffer.
2874
2883
  */
2875
- insertionInputL: Float32Array<ArrayBuffer>;
2884
+ readonly insertionInputL: Float32Array<ArrayBuffer>;
2876
2885
  /**
2877
2886
  * The insertion processor's right input buffer.
2878
2887
  */
2879
- insertionInputR: Float32Array<ArrayBuffer>;
2888
+ readonly insertionInputR: Float32Array<ArrayBuffer>;
2880
2889
  /**
2881
2890
  * The reverb processor's input buffer.
2882
2891
  */
2883
- reverbInput: Float32Array<ArrayBuffer>;
2892
+ readonly reverbInput: Float32Array<ArrayBuffer>;
2884
2893
  /**
2885
2894
  * The chorus processor's input buffer.
2886
2895
  */
2887
- chorusInput: Float32Array<ArrayBuffer>;
2896
+ readonly chorusInput: Float32Array<ArrayBuffer>;
2888
2897
  /**
2889
2898
  * The delay processor's input buffer.
2890
2899
  */
2891
- delayInput: Float32Array<ArrayBuffer>;
2900
+ readonly delayInput: Float32Array<ArrayBuffer>;
2892
2901
  /**
2893
2902
  * Delay is not used outside SC-88+ MIDIs, this is an optimization.
2894
2903
  */
@@ -3602,7 +3611,7 @@ declare class SpessaSynthProcessor {
3602
3611
  */
3603
3612
  onEventCall?: (event: SynthProcessorEvent) => unknown;
3604
3613
  /**
3605
- * 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`
3606
3615
  * All float arrays must have the same length.
3607
3616
  * @param left the left output channel.
3608
3617
  * @param right the right output channel.
@@ -3611,7 +3620,7 @@ declare class SpessaSynthProcessor {
3611
3620
  */
3612
3621
  readonly process: (left: Float32Array, right: Float32Array, startIndex?: number, sampleCount?: number) => void;
3613
3622
  /**
3614
- * 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
3615
3624
  * All float arrays must have the same length.
3616
3625
  * @param outputs any number stereo pairs (L, R) to render channels separately into.
3617
3626
  * @param effectsLeft the left stereo effect output buffer.