@rnbo/js 0.1.0 → 1.0.0

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.
@@ -0,0 +1,1373 @@
1
+ /**
2
+ * The \@rnbo/js package is the main package for running RNBO Patchers within the Browser.
3
+ * Using the main entry point {@link createDevice}, RNBO Devices can be created from RNBO Patchers
4
+ * and integrated into the WebAudio graph of your application.
5
+ * @packageDocumentation
6
+ */
7
+
8
+ /* Excluded from this release type: AsyncEngine */
9
+
10
+ /* Excluded from this release type: BangParameter */
11
+
12
+ declare const BangParameter_base: ObjectConstructor & (new (...args: any[]) => CommonParameterMixin);
13
+
14
+ /* Excluded from this release type: BangValue */
15
+
16
+ /**
17
+ * RNBO BaseDevice class.
18
+ * @public
19
+ * */
20
+ export declare abstract class BaseDevice {
21
+ protected _hasPatcher: boolean;
22
+ protected _sourceType: IPatcherSrc["type"];
23
+ /* Excluded from this release type: _timeConverter */
24
+ /* Excluded from this release type: _parameterInterface */
25
+ /* Excluded from this release type: _engine */
26
+ protected readonly _context: AudioContext;
27
+ protected _node?: AudioNode;
28
+ protected _valid: boolean;
29
+ protected readonly _type: DeviceType;
30
+ /**
31
+ * The {@link EventSubject} for {@link MIDIEvent | MIDIEvents} going out of the RNBO Device
32
+ *
33
+ * @example
34
+ * ```ts
35
+ * device.midiEvent.subscribe((e: MIDIEvent) => {
36
+ * // Handle the MIDIEvent
37
+ * });
38
+ * ```
39
+ * @eventProperty
40
+ */
41
+ readonly midiEvent: EventSubject<MIDIEvent>;
42
+ /**
43
+ * The {@link EventSubject} for {@link MessageEvent | MessageEvents} going out of the RNBO Device
44
+ *
45
+ * @example
46
+ * ```ts
47
+ * device.messageEvent.subscribe((e: MessageEvent) => {
48
+ * // handle the message event
49
+ * });
50
+ * ```
51
+ * @eventProperty
52
+ */
53
+ readonly messageEvent: EventSubject<MessageEvent_2>;
54
+ /**
55
+ * The {@link EventSubject} for {@link Parameter} changes of the RNBO Device
56
+ *
57
+ * @example
58
+ * ```ts
59
+ * device.parameterChangeEvent.subscribe((param: Parameter) => {
60
+ * // Code to execute when the parameter assigned to param has changed
61
+ * });
62
+ * ```
63
+ * @eventProperty
64
+ */
65
+ readonly parameterChangeEvent: EventSubject<Parameter>;
66
+ /**
67
+ * The {@link EventSubject} for invalidation of a RNBO Device. This event is triggered when a call to
68
+ * {@link createDevice } is called with this device passed as its second argument.
69
+ *
70
+ * @example
71
+ * ```ts
72
+ * device.invalidateEvent.subscribe(() => {
73
+ * // Handle the invalidation
74
+ * });
75
+ * ```
76
+ * @eventProperty
77
+ */
78
+ readonly invalidateEvent: EventSubject<void>;
79
+ /**
80
+ * The {@link EventSubject} notification when a Preset-relevant value (e.g. parameter) is changed
81
+ *
82
+ * @example
83
+ * ```ts
84
+ * device.presetTouchedEvent.subscribe(() => {
85
+ * // Code to execute when a preset-relevant value has been changed
86
+ * });
87
+ * ```
88
+ * @eventProperty
89
+ */
90
+ readonly presetTouchedEvent: EventSubject<void>;
91
+ /* Excluded from this release type: __constructor */
92
+ protected _ensureNoPatcher(): void;
93
+ /* Excluded from this release type: _onEngineEvent */
94
+ protected _onParameterChangeEvent: (param: Parameter) => void;
95
+ protected _prepareToProcess(sampleRate: number, samplesPerBlock: number, force: boolean): void;
96
+ protected _ensureIsValid(): void;
97
+ protected _extractPatcherCode(src: IPatcherSrc): string;
98
+ /**
99
+ * The {@link https://developer.mozilla.org/en-US/docs/Web/API/AudioContext | AudioContext} used for creating the Device. For more information, visit the guide on {@link https://rnbo.cycling74.com/learn/working-with-web-audio-contexts | Working with Web Audio Contexts}
100
+ */
101
+ get context(): AudioContext;
102
+ /**
103
+ * Property indicating whether the device is valid. A Device will be invalidated when passed to {@link createDevice} as the second argument.
104
+ */
105
+ get isValid(): boolean;
106
+ /**
107
+ * Property indicating whether the device is invalid. A Device will be invalidated when passed to {@link createDevice} as the second argument.
108
+ */
109
+ get isInvalid(): boolean;
110
+ /**
111
+ * Number of input channels supported by the Device and available on its {@link BaseDevice.node}.
112
+ */
113
+ get numInputChannels(): number;
114
+ /**
115
+ * Number of output channels supported by the Device and available on its {@link BaseDevice.node}.
116
+ */
117
+ get numOutputChannels(): number;
118
+ /**
119
+ * Number of MIDI Input ports on the device. If no MIDI Input is enabled the number is zero
120
+ */
121
+ get numMIDIInputPorts(): number;
122
+ /**
123
+ * Number of MIDI Output ports on the device. If no MIDI Output is present the number is zero
124
+ */
125
+ get numMIDIOutputPorts(): number;
126
+ /**
127
+ * Parameter count describing the amount of parameters the device has.
128
+ * Refer to {@link BaseDevice.parameters} on how to access the parameters.
129
+ */
130
+ get numParameters(): number;
131
+ /**
132
+ * Access the Device parameters as an array. The length of the array equals {@link BaseDevice.numParameters}
133
+ */
134
+ get parameters(): Parameter[];
135
+ get messages(): MessageInfo[];
136
+ /**
137
+ * Helper property to get the Device parameters as a Map sorted by their unique id.
138
+ */
139
+ get parametersById(): Map<string, Parameter>;
140
+ /**
141
+ * Get or Set how the Device should emit {@link BaseDevice.parameterChangeEvent | ParameterChangeEvents}.
142
+ * See {@link ParameterNotificationSetting} for the available options and details.
143
+ */
144
+ get parameterNotificationSetting(): ParameterNotificationSetting;
145
+ set parameterNotificationSetting(level: ParameterNotificationSetting);
146
+ get sourceType(): IPatcherSrc["type"];
147
+ /**
148
+ * The {@link DeviceType} of the Device. An invalid Device will return {@link DeviceType.Invalid}.
149
+ */
150
+ get type(): DeviceType;
151
+ /**
152
+ * Retrieve a list of ids for data buffer sources within the patch. These ids can be used to set and retrieve DataBuffers
153
+ * from a {@link Device} using {@link BaseDevice.(setDataBuffer:1)}
154
+ *
155
+ * @deprecated use dataBufferDescriptions instead
156
+ */
157
+ get dataBufferIds(): ExternalDataId[];
158
+ /**
159
+ * Retrieve a list of descriptions for data buffer sources within the patch.
160
+ * These contain not only the IDs that can be used to set and retrieve DataBuffers,
161
+ * but also information about the files the patcher requests to be loaded and the
162
+ * type of the files (currently only 32 bit audio buffers supported)
163
+ *
164
+ * from a {@link Device} using {@link BaseDevice.(setDataBuffer:1)}
165
+ */
166
+ get dataBufferDescriptions(): ExternalDataInfo[];
167
+ /**
168
+ * Sets the contents of the DataBuffer referenced by the given id to the content of the given AudioBuffer.
169
+ * Note that a RNBO Device copies the buffer content in order to keep the original buffer fully intact.
170
+ *
171
+ * @param id - The id of the DataBuffer to set
172
+ * @param data - The AudioBuffer to use
173
+ */
174
+ setDataBuffer(id: ExternalDataId, data: AudioBuffer): Promise<void>;
175
+ /**
176
+ * Sets the contents of the DataBuffer referenced by the given id to the content of the given ArrayBuffer.
177
+ * The RNBO Device will interpret the data as an Float32Array.
178
+ * Note that a RNBO Device copies the buffer content in order to keep the original buffer fully intact
179
+ * and considers the data to be given in an interleaved format while considering the provided channel count
180
+ * and sample rate.
181
+ *
182
+ * @param id - The id of the DataBuffer to set
183
+ * @param data - The ArrayBuffer to use
184
+ */
185
+ setDataBuffer(id: ExternalDataId, data: ArrayBuffer, channelCount: number, sampleRate: number): Promise<void>;
186
+ /**
187
+ * Sets the contents of the DataBuffer referenced by the given id to the content of the ArrayBuffer of the provided Float32Array.
188
+ * Note that a RNBO Device copies the buffer content in order to keep the original buffer fully intact
189
+ * and considers the data to be given in an interleaved format while considering the provided channel count
190
+ * and sample rate.
191
+ *
192
+ * @param id - The id of the DataBuffer to set
193
+ * @param data - The Float32Array to use
194
+ */
195
+ setDataBuffer(id: ExternalDataId, data: Float32Array, channelCount: number, sampleRate: number): Promise<void>;
196
+ /**
197
+ * Releases (resets) the contents of a DataBuffer within the {@link Device} and
198
+ * returns its contents as a {@link DataBuffer}
199
+ * @param id - The id of the DataBuffer to release
200
+ */
201
+ releaseDataBuffer(id: ExternalDataId): Promise<DataBuffer>;
202
+ /**
203
+ * Fetch data from a url and decode it into an AudioBuffer
204
+ * @param url - The URL to load the data from
205
+ * @param context - The AudioContext to use
206
+ */
207
+ static fetchAudioData(url: string, context: AudioContext): Promise<AudioBuffer>;
208
+ /**
209
+ * Determines if buffer info has a remote URL part. For this to be true,
210
+ * it must either have a "url" key, or else the "file" key must point to
211
+ * a url with an http or https scheme.
212
+ * @param info - The buffer info to test
213
+ */
214
+ static bufferDescriptionHasRemoteURL(info: ExternalDataInfo): boolean;
215
+ /**
216
+ * Load dependencies for data references. For example, if the
217
+ * patch contained something like [buffer~ anton \@url http://fileplace.org/anton.aif],
218
+ * retrieve the data at that URL and load it into the appropriate data buffer.
219
+ *
220
+ * @example
221
+ * ```js
222
+ * // Get dependencies from the device. Note that file dependencies
223
+ * // stored in the device may not have the correct path.
224
+ * let bufferDescriptions = device.dataBufferDescriptions;
225
+ *
226
+ * // (optional) Filter out file dependencies
227
+ * bufferDescriptions = bufferDescriptions.filter(BaseDevice.bufferDescriptionHasRemoteURL)
228
+ *
229
+ * // load them
230
+ * device.loadDataBufferDependencies(bufferDescriptions);
231
+ * ```
232
+ *
233
+ * @example
234
+ * ```js
235
+ * // Load the exported dependencies.json file
236
+ * let dependencies = await fetch("dependencies.json");
237
+ * dependencies = await dependencies.json();
238
+ *
239
+ * // Load the dependencies into the device
240
+ * device.loadDataBufferDependencies(dependencies)
241
+ * ```
242
+ *
243
+ * @param dependencies - an array of {@link ExternalDataInfo} containing buffer ids and resource locations
244
+ */
245
+ loadDataBufferDependencies(dependencies: ExternalDataInfo[]): Promise<DependencyLoadDescription[]>;
246
+ /**
247
+ * Schedule Events on the device. Refer to Event for possible events.
248
+ *
249
+ * @param evt - The event to schedule
250
+ */
251
+ scheduleEvent(evt: Event_2): void;
252
+ /* Excluded from this release type: destroy */
253
+ /**
254
+ * Access the AudioNode of the device. Use this to integrate the Device into your WebAudio graph
255
+ * @example
256
+ * ```js
257
+ * const context = new AudioContext();
258
+ * device.node.connect(context.destination);
259
+ * ```
260
+ */
261
+ abstract get node(): AudioNode;
262
+ /* Excluded from this release type: setPatcher */
263
+ /**
264
+ * Get a {@link IPreset} from the enclosed RNBO patcher, based on its current state.
265
+ * @public
266
+ */
267
+ getPreset(): Promise<IPreset>;
268
+ /**
269
+ * Set the state of enclosed RNBO patcher using a {@link IPreset}.
270
+ * @example
271
+ * ```js
272
+ * const preset = await device.getPreset();
273
+ * device.parametersById("gain").value = -70;
274
+ * device.setPreset(preset); // return to the previous value
275
+ * ```
276
+ * @public
277
+ */
278
+ setPreset(preset: IPreset): void;
279
+ }
280
+
281
+ /* Excluded from this release type: BaseEngine */
282
+
283
+ /**
284
+ * Common Base Event class for all RNBO Events
285
+ * @public
286
+ */
287
+ export declare abstract class BaseEvent implements IBaseEvent {
288
+ /* Excluded from this release type: eventTarget */
289
+ /* Excluded from this release type: invalid */
290
+ /* Excluded from this release type: source */
291
+ /** The scheduled time of the event */
292
+ time: MillisecondTime;
293
+ /** The type of the event. See {@link EventType} */
294
+ readonly type: EventType;
295
+ /* Excluded from this release type: __constructor */
296
+ serialize(): IBaseEvent;
297
+ }
298
+
299
+ /**
300
+ * BeatTimeEvent class to send transport beattime changes into a RNBO {@link BaseDevice | Device }
301
+ * @remarks
302
+ * Refer to our guide on {@link https://rnbo.cycling74.com/learn/musical-time-events | Events related to Musical Time}.
303
+ *
304
+ * @public
305
+ */
306
+ export declare class BeatTimeEvent extends BaseEvent implements IBeatTimeEvent {
307
+ readonly beattime: number;
308
+ /** {@inheritDoc BaseEvent."type"} */
309
+ readonly type: EventType.BeatTimeEvent;
310
+ constructor(time: MillisecondTime, beattime: number);
311
+ serialize(): IBeatTimeEvent;
312
+ }
313
+
314
+ /**
315
+ * Mixin function for the CommonParameterMixin.
316
+ *
317
+ * @param baseClass - The base class to be extended
318
+ * @returns A child class that extends baseClass, adding the CommonParameterMixin functionality.
319
+ * @public
320
+ */
321
+ export declare function CommonParameterMixin<TBaseClass extends Constructor>(baseClass: TBaseClass): TBaseClass & (new (...args: any[]) => CommonParameterMixin);
322
+
323
+ /**
324
+ * The mixin base interface for all Parameters providing common functionality and attributes across
325
+ * all {@link ParameterType | types} of {@link Parameter | Parameters}.
326
+ * @public
327
+ */
328
+ export declare interface CommonParameterMixin {
329
+ /** The unique id of the parameter */
330
+ readonly id: ParameterId;
331
+ /** The index of the parameter */
332
+ readonly index: number;
333
+ /** The name of the parameter */
334
+ readonly name: string;
335
+ /** The displayName of the parameter */
336
+ readonly displayName: string;
337
+ /** The exponent of the parameter */
338
+ readonly exponent: number;
339
+ /** Minimum possible value of the parameter */
340
+ readonly min: number;
341
+ /** Maximum possible value of the parameter */
342
+ readonly max: number;
343
+ /**
344
+ * The normalized value of the parameter in a range from 0-1
345
+ *
346
+ * @example
347
+ * ```ts
348
+ * // Update the current parameter value with a normalized value by simply setting the property
349
+ * param.normalizedValue = 0.8;
350
+ * ```
351
+ */
352
+ normalizedValue: number;
353
+ /** The steps of the parameter */
354
+ readonly steps: number;
355
+ /** The type of the parameter see {@link ParameterType} */
356
+ readonly type: ParameterType;
357
+ /** The unit of the parameter */
358
+ readonly unit: string;
359
+ /**
360
+ * The notification setting of the parameter for its changeEvent, which will be the same as the {@link ParameterNotificationSetting} set on the {@link BaseDevice.parameterNotificationSetting | Device}.
361
+ */
362
+ readonly notificationSetting: ParameterNotificationSetting;
363
+ /**
364
+ * In addition to capturing the events emitted by the {@link BaseDevice.parameterChangeEvent | Device}, you can subscribe to a changeEvent on the Parameter itself, allowing additional, more granular event handling.
365
+ * The parameter uses the same {@link ParameterNotificationSetting} as set on the {@link BaseDevice.parameterNotificationSetting | Device}.
366
+ *
367
+ * @example
368
+ * ```ts
369
+ * param.changeEvent.subscribe((value: any) => {
370
+ * // the type of the value is dependent on the type of the parameter
371
+ * });
372
+ * ```
373
+ *
374
+ */
375
+ readonly changeEvent: EventSubject<any>;
376
+ /**
377
+ * Parameter specific conversion function to convert a normalized value to a real value
378
+ * see {@link ConvertFromNormalizedValueFunction}
379
+ *
380
+ * @example
381
+ * ```ts
382
+ * // this will convert someValue in the range of (0..1) to a real value according to param's specific conversion function
383
+ * param.convertFromNormalizedValue(someValue: number);
384
+ * ```
385
+ */
386
+ readonly convertFromNormalizedValue: ConvertFromNormalizedValueFunction;
387
+ /**
388
+ * Parameter specific conversion function to convert a real value to a normalized
389
+ * see {@link ConvertToNormalizedValueFunction}
390
+ *
391
+ * @example
392
+ * ```ts
393
+ * // this will convert someValue to a normalized value according to param's specific conversion function
394
+ * param.convertToNormalizedValue(someValue: number);
395
+ * ```
396
+ */
397
+ readonly convertToNormalizedValue: ConvertToNormalizedValueFunction;
398
+ /* Excluded from this release type: __set_value__ */
399
+ /* Excluded from this release type: __internalSetNotificationSetting */
400
+ /* Excluded from this release type: __internalUpdateParameterValue */
401
+ /* Excluded from this release type: __internalSetParameterValue */
402
+ }
403
+
404
+ /**
405
+ * constrain a parameter value to its range
406
+ * @param value - the real value to constrain
407
+ * @returns the constrained value
408
+ * @public
409
+ */
410
+ declare type ConstrainParameterValueFunction = (value: number) => number;
411
+
412
+ /**
413
+ * Mixin Constructor Helper
414
+ * @public
415
+ */
416
+ export declare type Constructor<T = {}> = new (...args: any[]) => T;
417
+
418
+ /**
419
+ * Conversion function to convert a normalized value to a real value
420
+ * @param normalizedValue - the normalized value to convert
421
+ * @returns the real value of the given normalized value
422
+ * @public
423
+ */
424
+ export declare type ConvertFromNormalizedValueFunction = (normalizedValue: number) => number;
425
+
426
+ /**
427
+ * Conversion function to convert a real value to a normalized value
428
+ * @param value - the real value to convert
429
+ * @returns the normalized value of the given real value
430
+ * @public
431
+ */
432
+ export declare type ConvertToNormalizedValueFunction = (value: number) => number;
433
+
434
+ /**
435
+ * The main entry point to \@rnbo/js. Use this createDevice factory function to create {@link Device | Devices} from your RNBO Patches.
436
+ * Refer to the guide on {@link https://rnbo.cycling74.com/learn/loading-a-rnbo-device-in-the-browser-js | Loading a RNBO Device in the Browser} for more details on how to use this function.
437
+ *
438
+ * @param parameters - The parameters used in creating a new RNBO Device (see {@link ICreateDeviceParameters})
439
+ * @param prevDevice - Optional previous device. Use this parameter to create a device from an existing one including state restoration. CAUTION: This makes the previous device invalid and therefore non-functional. This functionality is only useful for specific, advanced use-cases.
440
+ * @returns a Promise returning the created {@link Device}
441
+ * @public
442
+ */
443
+ export declare function createDevice(parameters: ICreateDeviceParameters, prevDevice?: Device): Promise<Device>;
444
+
445
+ /**
446
+ * Helper class for retrieved binary data from a RNBO Patcher using {@link BaseDevice.releaseDataBuffer}.
447
+ * @public
448
+ */
449
+ export declare class DataBuffer {
450
+ /**
451
+ * The raw binary data of the DataBuffer
452
+ */
453
+ readonly buffer: ArrayBuffer;
454
+ private readonly _typeDesc;
455
+ /* Excluded from this release type: __constructor */
456
+ /**
457
+ * Retrieve the data interpreted as a WebAudio AudioBuffer.
458
+ * @param context - The AudioContext to use for creating a new AudioBuffer
459
+ */
460
+ getAsAudioBuffer(context: AudioContext): AudioBuffer;
461
+ }
462
+
463
+ /**
464
+ * Calls to {@link BaseDevice."loadDataBufferDependencies"} will return an array of load descriptions,
465
+ * containing the id of the buffer being loaded, a status type, and--for failures--an error.
466
+ * @public
467
+ */
468
+ declare type DependencyLoadDescription = DependencyLoadFailedDescription | DependencyLoadSucceededDescription;
469
+
470
+ declare type DependencyLoadFailedDescription = {
471
+ type: "fail";
472
+ id: ExternalDataInfo["id"];
473
+ error: Error;
474
+ };
475
+
476
+ declare type DependencyLoadSucceededDescription = {
477
+ type: "success";
478
+ id: ExternalDataInfo["id"];
479
+ };
480
+
481
+ /**
482
+ * Union Device Type for handling {@link ScriptDevice} and {@link WorkletDevice}.
483
+ * @public
484
+ */
485
+ export declare type Device = ScriptDevice | WorkletDevice;
486
+
487
+ /**
488
+ * Enum to identify the type of a {@link Device} via {@link BaseDevice."type"}. Also used within {@link createDevice}
489
+ * @public
490
+ */
491
+ export declare enum DeviceType {
492
+ /** Used by {@link ScriptDevice} */
493
+ Script = "script",
494
+ /** Used by {@link WorkletDevice} */
495
+ Worklet = "worklet",
496
+ /** Invalid. A device becomes invalid after being reused by a call to {@link createDevice} */
497
+ Invalid = "invalid"
498
+ }
499
+
500
+ /* Excluded from this release type: Engine */
501
+
502
+ /**
503
+ * Parameter Class for describing and interacting with Enum Type Parameters in RNBO
504
+ * Uses the CommonParameterMixin
505
+ * @public
506
+ */
507
+ export declare class EnumParameter extends EnumParameter_base {
508
+ readonly type: ParameterType.Enum;
509
+ protected _enumValues: EnumValue[];
510
+ readonly changeEvent: EventSubject<number>;
511
+ readonly initialValue: number;
512
+ protected _value: number;
513
+ /* Excluded from this release type: __constructor */
514
+ /** Get an array of available enum values of the parameter */
515
+ get enumValues(): EnumValue[];
516
+ /**
517
+ * The actual enum value for the currently active index value.
518
+ * Use this to set the active index by enum value.
519
+ *
520
+ * @example
521
+ * ```ts
522
+ * console.log(param.enumValues); // => ["blue", "red", "green"]
523
+ * param.enumValue = "blue";
524
+ * console.log(param.value === 0); // => true
525
+ * ```
526
+ */
527
+ get enumValue(): EnumValue;
528
+ set enumValue(v: EnumValue);
529
+ /**
530
+ * The current selected index value of the parameter
531
+ *
532
+ * @example
533
+ * ```ts
534
+ * // Update the current index value
535
+ * param.value = 2
536
+ * ```
537
+ */
538
+ get value(): number;
539
+ set value(v: number);
540
+ }
541
+
542
+ declare const EnumParameter_base: ObjectConstructor & (new (...args: any[]) => CommonParameterMixin);
543
+
544
+ /**
545
+ * Possible value of an {@link EnumParameter}
546
+ * @public
547
+ */
548
+ export declare type EnumValue = number | string;
549
+
550
+ /**
551
+ * Union Type for RNBO Event Classes (see MessageEvent, {@link MIDIEvent})
552
+ * @public
553
+ */
554
+ declare type Event_2 = MessageEvent_2 | MIDIEvent | TransportEvent | TempoEvent | BeatTimeEvent | TimeSignatureEvent | PresetEvent;
555
+ export { Event_2 as Event }
556
+
557
+ /**
558
+ * The EventSubject class is used to enable the concept of listening and emitting evens while maintaining type safety for the
559
+ * subscribing listeners. The type Generic `T` hereby refers to the event parameter passed on the listeners when emitting events.
560
+ * @public
561
+ */
562
+ export declare class EventSubject<T> {
563
+ protected _subscriptions: IEventListener<T>[];
564
+ protected _oneTimeSubscriptions: IEventListener<T>[];
565
+ constructor();
566
+ get listenerCount(): number;
567
+ /**
568
+ * Emits an event on subject.
569
+ * @param event - The event to emit
570
+ */
571
+ emit(event: T): void;
572
+ /**
573
+ * Add a listener callback that gets only called once and then removed from the subject.
574
+ * @param listener - The listener callback to subscribe
575
+ */
576
+ once(listener: IEventListener<T>): IEventSubscription;
577
+ /**
578
+ * Subscribe a listener callback for all upcoming events on the subject
579
+ * @param listener - The listener callback to subscribe
580
+ * @returns a subscription that can later be used to unsubscribe the listener, see {@link IEventSubscription}
581
+ */
582
+ subscribe(listener: IEventListener<T>): IEventSubscription;
583
+ /**
584
+ * Unsubscribe a previously added listener callback from the event
585
+ * @param listener - The listener callback to unsubscribe
586
+ */
587
+ unsubscribe(listener: IEventListener<T>): void;
588
+ /**
589
+ * Remove all listeners that are currently subscribed to the event
590
+ */
591
+ removeAllSubscriptions(): void;
592
+ }
593
+
594
+ /**
595
+ * Used internally to route events based on their target.
596
+ * @public
597
+ */
598
+ declare type EventTarget_2 = any;
599
+ export { EventTarget_2 as EventTarget }
600
+
601
+ /**
602
+ * Enum used to distinguish the type of events. See {@link BaseEvent."type"}.
603
+ * @public
604
+ */
605
+ export declare enum EventType {
606
+ /* Excluded from this release type: BufferTransfer */
607
+ /* Excluded from this release type: ClockEvent */
608
+ /* Excluded from this release type: DataRefEvent */
609
+ /**
610
+ * Message Event sent in and out of a RNBO Device
611
+ * See MessageEvent
612
+ */
613
+ MessageEvent = 3,
614
+ /**
615
+ * MIDIEvents sent in and out of a RNBO Device.
616
+ * See {@link MIDIEvent}
617
+ */
618
+ MIDIEvent = 4,
619
+ /* Excluded from this release type: ParameterEvent */
620
+ /**
621
+ * PresetEvents received from a RNBO Device.
622
+ * See {@link PresetEvent}
623
+ */
624
+ PresetEvent = 6,
625
+ /* Excluded from this release type: StartupEvent */
626
+ /**
627
+ * TransportEvents sent into a RNBO Device.
628
+ * See {@link TransportEvent}
629
+ */
630
+ TransportEvent = 8,
631
+ /**
632
+ * TempoEvents sent into a RNBO Device.
633
+ * See {@link TempoEvent}
634
+ */
635
+ TempoEvent = 9,
636
+ /**
637
+ * BeatTimeEvents sent into a RNBO Device.
638
+ * See {@link BeatTimeEvent}
639
+ */
640
+ BeatTimeEvent = 10,
641
+ /**
642
+ * TimeSignatureEvents sent into a RNBO Device.
643
+ * See {@link TimeSignatureEvent}
644
+ */
645
+ TimeSignatureEvent = 11
646
+ }
647
+
648
+ /**
649
+ * @public
650
+ */
651
+ export declare type ExternalDataId = string;
652
+
653
+ declare type ExternalDataIndex = number;
654
+
655
+ /**
656
+ * @public
657
+ */
658
+ export declare type ExternalDataInfo = ExternalDataInfoURL | ExternalDataInfoFile;
659
+
660
+ /**
661
+ * @public
662
+ */
663
+ export declare interface ExternalDataInfoBase {
664
+ id: ExternalDataId;
665
+ type: string;
666
+ }
667
+
668
+ /**
669
+ * @public
670
+ */
671
+ export declare interface ExternalDataInfoFile extends ExternalDataInfoBase {
672
+ file: string;
673
+ }
674
+
675
+ /**
676
+ * @public
677
+ */
678
+ export declare interface ExternalDataInfoURL extends ExternalDataInfoBase {
679
+ url: string;
680
+ }
681
+
682
+ /* Excluded from this release type: FromProcessorMessage */
683
+
684
+ /* Excluded from this release type: FromProcessorMessageId */
685
+
686
+ /**
687
+ * Interface for the {@link BaseEvent} and the serialized version of it.
688
+ * @public
689
+ */
690
+ export declare interface IBaseEvent {
691
+ /* Excluded from this release type: eventTarget */
692
+ /* Excluded from this release type: invalid */
693
+ /* Excluded from this release type: source */
694
+ time: MillisecondTime;
695
+ }
696
+
697
+ /* Excluded from this release type: IBaseRNBODataDesc */
698
+
699
+ /* Excluded from this release type: IBaseSerializedRNBODataDesc */
700
+
701
+ /**
702
+ * Interface for the {@link BeatTimeEvent} and the serialized version of it.
703
+ * @public
704
+ */
705
+ export declare interface IBeatTimeEvent extends IBaseEvent {
706
+ beattime: number;
707
+ type: EventType.BeatTimeEvent;
708
+ }
709
+
710
+ /**
711
+ * Interface describing the parameters passed to {@link createDevice} when attempting to create a new {@link Device}
712
+ * @public
713
+ */
714
+ export declare interface ICreateDeviceParameters {
715
+ /** The AudioContext to be used by the {@link Device} */
716
+ context: AudioContext;
717
+ /** Optional options object to pass on to the {@link Device}, see {@link IDeviceOptions} */
718
+ options?: IDeviceOptions;
719
+ /** The exported patcher to use in creating the {@link Device} */
720
+ patcher: IPatcher;
721
+ /**
722
+ * Optional type defining the {@link DeviceType} (AudioWorklet or ScriptProcessor) to create. The default value `"auto"` lets `createDevice()` pick the correct type based on the support of the current environment.
723
+ */
724
+ type?: "auto" | DeviceType;
725
+ }
726
+
727
+ declare interface IDeserializedParamConversion {
728
+ applyStepsToNormalizedParameterValue: Function;
729
+ convertToNormalizedParameterValue: Function;
730
+ convertFromNormalizedParameterValue: Function;
731
+ getNumParameters: Function;
732
+ constrainParameterValue: Function;
733
+ isPolyphonic: boolean;
734
+ subpatches: IDeserializedParamConversion[];
735
+ }
736
+
737
+ declare type IDeserializedPatcherConversion = IDeserializedParamConversion & {
738
+ [key: string]: Function | IDeserializedParamConversion | IDeserializedParamConversion[];
739
+ };
740
+
741
+ /**
742
+ * Options for creating a RNBO {@link BaseDevice}
743
+ * @public
744
+ */
745
+ export declare interface IDeviceOptions {
746
+ /**
747
+ * Set the size of the buffer used for the Web Audio ScriptProcessorNode. Applies only to {@link ScriptDevice}.
748
+ * default: 1024
749
+ */
750
+ bufferSize?: number;
751
+ /**
752
+ * Adjust the way the device emits {@link BaseDevice.parameterChangeEvent | ParameterChangeEvents}, see {@link ParameterNotificationSetting}.
753
+ * By default, set to emit a `parameterChangeEvent` whenever the value changes: `ParameterNotificationSetting.All`
754
+ */
755
+ parameterNotificationSetting?: ParameterNotificationSetting;
756
+ }
757
+
758
+ /* Excluded from this release type: IEngineProcessorEventSubjects */
759
+
760
+ /* Excluded from this release type: IEnumParameterArgs */
761
+
762
+ /**
763
+ * Generic Interface used for ListenerCallbacks alongside the EventSubject class.
764
+ * The IEventListener is hereby used to safely type the callback and the passed on event parameter.
765
+ * @public
766
+ */
767
+ export declare interface IEventListener<T> {
768
+ (event: T): any;
769
+ }
770
+
771
+ /**
772
+ * Interface describing the return value of a call to {@link EventSubject.subscribe}.
773
+ * @public
774
+ */
775
+ export declare interface IEventSubscription {
776
+ /** Unsubscribe the listener callback from the event */
777
+ unsubscribe: () => void;
778
+ }
779
+
780
+ /* Excluded from this release type: IFromProcessorGetPresetResponse */
781
+
782
+ /* Excluded from this release type: IFromProcessorOutgoingEvent */
783
+
784
+ /* Excluded from this release type: IFromProcessorReleaseBuffer */
785
+
786
+ /* Excluded from this release type: IFromProcessorSetPatcher */
787
+
788
+ /* Excluded from this release type: IFromProcessorTransferBuffer */
789
+
790
+ /**
791
+ * Interface for the MessageEvent and the serialized version of it.
792
+ * @public
793
+ */
794
+ export declare interface IMessageEvent extends IBaseEvent {
795
+ objectId: MessageTag;
796
+ payload: MessagePayload;
797
+ tag: MessageTag;
798
+ type: EventType.MessageEvent;
799
+ }
800
+
801
+ /**
802
+ * Interface for the {@link MIDIEvent} and the serialized version of it.
803
+ * @public
804
+ */
805
+ export declare interface IMIDIEvent extends IBaseEvent {
806
+ channel: number;
807
+ data: MIDIData;
808
+ port: number;
809
+ type: EventType.MIDIEvent;
810
+ }
811
+
812
+ /* Excluded from this release type: INumberParameterArgs */
813
+
814
+ /* Excluded from this release type: IParameterArgs */
815
+
816
+ /**
817
+ * Parameter Description of a generated RNBO Patcher
818
+ * @public
819
+ */
820
+ export declare interface IParameterDescription {
821
+ type: string;
822
+ index: number;
823
+ name: string;
824
+ paramId: string;
825
+ minimum: number;
826
+ maximum: number;
827
+ exponent: number;
828
+ steps: number;
829
+ initialValue: number;
830
+ isEnum: boolean;
831
+ enumValues: string[];
832
+ displayName: string;
833
+ unit: string;
834
+ initialized: boolean;
835
+ debug: boolean;
836
+ saveable: boolean;
837
+ transmittable: boolean;
838
+ visible: boolean;
839
+ signalIndex: number;
840
+ ioType: string;
841
+ }
842
+
843
+ declare interface IParameterInfo {
844
+ displayName: string;
845
+ enumValues: string[] | number[];
846
+ exponent: number;
847
+ id: ParameterId;
848
+ index: number;
849
+ initialValue: any;
850
+ ioType: number;
851
+ isEnum: boolean;
852
+ min: number;
853
+ max: number;
854
+ name: string;
855
+ signalIndex: number;
856
+ steps: number;
857
+ type: number;
858
+ unit: string;
859
+ visible: boolean;
860
+ }
861
+
862
+ declare interface IParameterScalingInfo {
863
+ convertFromNormalized: ConvertFromNormalizedValueFunction;
864
+ convertToNormalized: ConvertToNormalizedValueFunction;
865
+ constrainParameterValue: ConstrainParameterValueFunction;
866
+ }
867
+
868
+ /**
869
+ * Interface describing the generated RNBO Patcher Object
870
+ * @public
871
+ */
872
+ export declare interface IPatcher {
873
+ /** Patcher Description */
874
+ desc: IPatcherDescription;
875
+ presets?: {
876
+ name: string;
877
+ preset: IPreset;
878
+ }[];
879
+ src: Array<IPatcherSrc>;
880
+ }
881
+
882
+ /**
883
+ * Patcher Description of a generated RNBO Patcher
884
+ * @public
885
+ * */
886
+ export declare interface IPatcherDescription {
887
+ /** number of input channels on the patcher */
888
+ numInputChannels: number;
889
+ /** number of output channels on the patcher */
890
+ numOutputChannels: number;
891
+ /** number of MIDI input ports on the patcher */
892
+ numMidiInputPorts: number;
893
+ /** number of MIDI output ports on the patcher */
894
+ numMidiOutputPorts: number;
895
+ /** number of parameters */
896
+ numParameters: number;
897
+ /** number of signal input parameters */
898
+ numSignalInParameters: number;
899
+ /** number of signal output parameters (aka. additional named audio outputs) */
900
+ numSignalOutParameters: number;
901
+ /** serial number pf patcher, used for state restoration */
902
+ patcherSerial: number;
903
+ /** Parameter description see {@link IParameterDescription} */
904
+ parameters: IParameterDescription[];
905
+ /* Excluded from this release type: paramConversion */
906
+ /** a list of external dataref ids */
907
+ externalDataRefs: ExternalDataInfo[];
908
+ /** a list of inports */
909
+ inports: MessagePort_2[];
910
+ /** a list of outports */
911
+ outports: MessagePort_2[];
912
+ /** Patcher Options */
913
+ options: IPatcherOptions;
914
+ meta: {
915
+ /** Version of Max the Patcher was exported with */
916
+ maxversion?: string;
917
+ /** Version of RNBO the Patcher was exported with */
918
+ rnboversion: string;
919
+ };
920
+ /**
921
+ * @deprecated since version 0.18.0, see meta.rnboversion
922
+ */
923
+ rnboVersion?: string;
924
+ }
925
+
926
+ /**
927
+ * Option Settings of a generated RNBO Patcher
928
+ * @public
929
+ * */
930
+ export declare interface IPatcherOptions {
931
+ classname: string;
932
+ minifyOutput: boolean;
933
+ }
934
+
935
+ /* Excluded from this release type: IPatcherParamConversion */
936
+
937
+ export declare interface IPatcherSrc {
938
+ code: string;
939
+ compression?: "zlib";
940
+ encoding?: "base64" | "utf8" | "utf-8";
941
+ type: "wasm" | "js";
942
+ }
943
+
944
+ /**
945
+ * Collection of parameter values as a RNBO Patcher Preset, mapping:
946
+ *
947
+ * - a parameter name to a numerical value
948
+ *
949
+ * - a parameter name to a list of numerical values
950
+ *
951
+ * - a subpatcher name to a sub preset (subpatcher or object state)
952
+ *
953
+ * - a subpatcher name a list of sub presets (for polyphonic subpatchers)
954
+ * @public
955
+ */
956
+ export declare interface IPreset {
957
+ [propName: string]: number | Array<number> | IPreset | Array<IPreset>;
958
+ }
959
+
960
+ /**
961
+ * Interface for the {@link PresetEvent} and the serialized version of it.
962
+ * @public
963
+ */
964
+ export declare interface IPresetEvent extends IBaseEvent {
965
+ action: RNBOPresetEventAction;
966
+ type: EventType.PresetEvent;
967
+ preset?: IPreset;
968
+ }
969
+
970
+ /* Excluded from this release type: IRNBOClockEvent */
971
+
972
+ /* Excluded from this release type: IRNBODataRefEvent */
973
+
974
+ /* Excluded from this release type: IRNBOFloat32AudioBuffer */
975
+
976
+ /* Excluded from this release type: IRNBOParameterEvent */
977
+
978
+ /* Excluded from this release type: IRNBOStartupEvent */
979
+
980
+ /* Excluded from this release type: IRNBOTypedArrayBuffer */
981
+
982
+ /**
983
+ * Interface for the {@link TempoEvent} and the serialized version of it.
984
+ * @public
985
+ */
986
+ export declare interface ITempoEvent extends IBaseEvent {
987
+ tempo: number;
988
+ type: EventType.TempoEvent;
989
+ }
990
+
991
+ /**
992
+ * Interface for the {@link TimeSignatureEvent} and the serialized version of it.
993
+ * @public
994
+ */
995
+ export declare interface ITimeSignatureEvent extends IBaseEvent {
996
+ numerator: number;
997
+ denominator: number;
998
+ type: EventType.TimeSignatureEvent;
999
+ }
1000
+
1001
+ /* Excluded from this release type: IToProcesserGetPreset */
1002
+
1003
+ /* Excluded from this release type: IToProcesserReleaseBuffer */
1004
+
1005
+ /* Excluded from this release type: IToProcesserSetPatcher */
1006
+
1007
+ /* Excluded from this release type: IToProcesserSetPreset */
1008
+
1009
+ /* Excluded from this release type: IToProcessorScheduleEvent */
1010
+
1011
+ /* Excluded from this release type: IToProcessorTransferBuffer */
1012
+
1013
+ /**
1014
+ * Interface for the {@link TransportEvent} and the serialized version of it.
1015
+ * @public
1016
+ */
1017
+ export declare interface ITransportEvent extends IBaseEvent {
1018
+ state: TransportState;
1019
+ type: EventType.TransportEvent;
1020
+ }
1021
+
1022
+ /**
1023
+ * WorkletNode of a {@link WorkletDevice} extending {@link https://developer.mozilla.org/en-US/docs/Web/API/AudioWorkletNode | AudioWorkletNode}
1024
+ * @public
1025
+ */
1026
+ export declare interface IWorkletNode extends AudioWorkletNode {
1027
+ /* Excluded from this release type: loadPatcher */
1028
+ }
1029
+
1030
+ /**
1031
+ * MessageEvent class to send Message Events into a RNBO {@link BaseDevice | Device } or receive events from a {@link BaseDevice | Device }.
1032
+ * @remarks
1033
+ * Refer to our article on {@link https://rnbo.cycling74.com/learn/sending-and-receiving-messages-inlets-outlets | Sending and Receiving Messages} to learn more.
1034
+ *
1035
+ * @public
1036
+ */
1037
+ declare class MessageEvent_2 extends BaseEvent implements IMessageEvent {
1038
+ /** The tag of the Message. See {@link MessageTag} */
1039
+ readonly tag: MessageTag;
1040
+ /** The optional id of the target object of the Message */
1041
+ readonly objectId: MessageTag;
1042
+ /** The payload data of the Message. See {@link MessagePayload} */
1043
+ readonly payload: MessagePayload;
1044
+ /** {@inheritDoc BaseEvent."type"} */
1045
+ readonly type: EventType.MessageEvent;
1046
+ constructor(time: MillisecondTime, tag: MessageTag, payload?: MessagePayload, objectId?: MessageTag, eventTarget?: EventTarget_2);
1047
+ serialize(): IMessageEvent;
1048
+ }
1049
+ export { MessageEvent_2 as MessageEvent }
1050
+
1051
+ /**
1052
+ * The description of a message endpoint
1053
+ * @public */
1054
+ export declare type MessageInfo = {
1055
+ tag: MessageTag;
1056
+ type: MessagePortType;
1057
+ meta?: any;
1058
+ };
1059
+
1060
+ /**
1061
+ * The payload of a MessageEvent
1062
+ * @public
1063
+ */
1064
+ export declare type MessagePayload = number | number[] | undefined;
1065
+
1066
+ declare type MessagePort_2 = {
1067
+ tag: MessageTag;
1068
+ meta?: any;
1069
+ };
1070
+
1071
+ /**
1072
+ * The type of a message endpoint
1073
+ * @public */
1074
+ export declare enum MessagePortType {
1075
+ Inport = 0,
1076
+ Outport = 1,
1077
+ Undefined = 2
1078
+ }
1079
+
1080
+ /**
1081
+ * The tag / identifier of a MessageEvent
1082
+ * @public */
1083
+ export declare type MessageTag = string;
1084
+
1085
+ /**
1086
+ * A single byte of {@link MIDIData}
1087
+ * @public
1088
+ */
1089
+ export declare type MIDIByte = number | undefined;
1090
+
1091
+ /**
1092
+ * The data of a {@link MIDIEvent} consisting out of 3 {@link MIDIByte | MIDIBytes }
1093
+ * @public
1094
+ */
1095
+ export declare type MIDIData = [MIDIByte] | [MIDIByte, MIDIByte] | [MIDIByte, MIDIByte, MIDIByte];
1096
+
1097
+ /**
1098
+ * MIDIEvent class to send MIDI Events into a RNBO {@link BaseDevice | Device } or receive events from a {@link BaseDevice | Device }.
1099
+ * @remarks
1100
+ * Refer to our article on {@link https://rnbo.cycling74.com/learn/sending-and-receiving-midi | Sending and Receiving MIDI} to learn more.
1101
+ *
1102
+ * @public
1103
+ */
1104
+ export declare class MIDIEvent extends BaseEvent implements IMIDIEvent {
1105
+ readonly status: number;
1106
+ /** The MIDI Channel */
1107
+ readonly channel: number;
1108
+ /** The MIDI Port */
1109
+ readonly port: number;
1110
+ /** The MIDI Data - see {@link MIDIData} */
1111
+ readonly data: MIDIData;
1112
+ /** The amount of actually set bytes in the {@link MIDIData} of the event */
1113
+ readonly length: number;
1114
+ /** {@inheritDoc BaseEvent."type"} */
1115
+ readonly type: EventType.MIDIEvent;
1116
+ constructor(time: MillisecondTime, port: number, data: MIDIData, eventTarget?: EventTarget_2);
1117
+ serialize(): IMIDIEvent;
1118
+ }
1119
+
1120
+ /**
1121
+ * All time is measured in milliseconds
1122
+ * @public
1123
+ */
1124
+ export declare type MillisecondTime = number;
1125
+
1126
+ /**
1127
+ * Parameter Class for describing and interacting with Number (Float) Type Parameters in RNBO
1128
+ * Uses the CommonParameterMixin
1129
+ * @public
1130
+ */
1131
+ export declare class NumberParameter extends NumberParameter_base {
1132
+ /** The type of the parameter see {@link ParameterType} */
1133
+ readonly type: ParameterType.Number;
1134
+ readonly changeEvent: EventSubject<number>;
1135
+ readonly initialValue: number;
1136
+ protected _value: number;
1137
+ /* Excluded from this release type: __constructor */
1138
+ /**
1139
+ * The current absolute value of the parameter
1140
+ *
1141
+ * @example
1142
+ * ```ts
1143
+ * // Update the current parameter value
1144
+ * param.value = 2
1145
+ * ```
1146
+ */
1147
+ get value(): number;
1148
+ set value(v: number);
1149
+ }
1150
+
1151
+ declare const NumberParameter_base: ObjectConstructor & (new (...args: any[]) => CommonParameterMixin);
1152
+
1153
+ /**
1154
+ * Union Type of all available Parameter Classes.
1155
+ * @public
1156
+ */
1157
+ export declare type Parameter = BangParameter | EnumParameter | NumberParameter;
1158
+
1159
+ /**
1160
+ * Type of the ID of a parameter
1161
+ * @public
1162
+ */
1163
+ export declare type ParameterId = string;
1164
+
1165
+ /* Excluded from this release type: ParameterInterface */
1166
+
1167
+ declare type ParameterInterfaceId = ReturnType<typeof uniqueId>;
1168
+
1169
+ declare type ParameterInterfaceOptions = {
1170
+ notificationSetting: ParameterNotificationSetting;
1171
+ };
1172
+
1173
+ /**
1174
+ * Enum defining the available options for the parameter change event setting of a {@link BaseDevice.parameterChangeEvent | Device}.
1175
+ * @public
1176
+ */
1177
+ export declare enum ParameterNotificationSetting {
1178
+ /**
1179
+ * Emits {@link BaseDevice.parameterChangeEvent | ParameterChangeEvents} whenever the value changes. This includes
1180
+ * values changes from the outside by setting the <a href="./CommonParameterMixin#value">param.value</a> of a parameter
1181
+ * and internal changes to the value of the parameter.
1182
+ */
1183
+ All = 0,
1184
+ /**
1185
+ * Emits {@link BaseDevice.parameterChangeEvent | ParameterChangeEvents} only when the value of the parameter
1186
+ * has been updated by the device itself. This means that setting <a href="./CommonParameterMixin#value">param.value</a> does not trigger an immediate event.
1187
+ */
1188
+ Internal = 1
1189
+ }
1190
+
1191
+ /**
1192
+ * Enum used to distinguish the type of a Parameter.
1193
+ * @public
1194
+ */
1195
+ export declare enum ParameterType {
1196
+ Number = 0,
1197
+ Bang = 1,
1198
+ /* Excluded from this release type: List */
1199
+ /* Excluded from this release type: Signal */
1200
+ /* Excluded from this release type: Count */
1201
+ Enum = 5
1202
+ }
1203
+
1204
+ /**
1205
+ * PresetEvent class to receive preset touched events from RNBO {@link BaseDevice | Device }
1206
+ *
1207
+ * @public
1208
+ */ export declare class PresetEvent extends BaseEvent implements IPresetEvent {
1209
+ readonly action: RNBOPresetEventAction;
1210
+ readonly type: EventType.PresetEvent;
1211
+ readonly preset: IPreset;
1212
+ /* Excluded from this release type: __constructor */
1213
+ serialize(): IPresetEvent;
1214
+ }
1215
+
1216
+ /* Excluded from this release type: RNBOClockEvent */
1217
+
1218
+ /* Excluded from this release type: RNBODataDesc */
1219
+
1220
+ /* Excluded from this release type: RNBODataRefEvent */
1221
+
1222
+ /* Excluded from this release type: RNBODataRefEventAction */
1223
+
1224
+ /* Excluded from this release type: RNBODataType */
1225
+
1226
+ /* Excluded from this release type: RNBOEvent */
1227
+
1228
+ /* Excluded from this release type: RNBOFloat32AudioBuffer */
1229
+
1230
+ /* Excluded from this release type: RNBOParameterEvent */
1231
+
1232
+ /**
1233
+ * @public
1234
+ */
1235
+ export declare enum RNBOPresetEventAction {
1236
+ /* Excluded from this release type: Set */
1237
+ Touched = 2
1238
+ }
1239
+
1240
+ /* Excluded from this release type: RNBOStartupEvent */
1241
+
1242
+ /* Excluded from this release type: RNBOTypedArrayBuffer */
1243
+
1244
+ /**
1245
+ * RNBO Device using a WebAudio ScriptProcessorNode for its processing.
1246
+ *
1247
+ * @remarks
1248
+ * ScriptDevices can be created using the {@link createDevice} factory function.
1249
+ * Please also refer to the article on {@link https://rnbo.cycling74.com/learn/loading-a-rnbo-device-in-the-browser-js | Loading a RNBO device in the Browser} for more information.
1250
+ *
1251
+ * @public
1252
+ * */
1253
+ export declare class ScriptDevice extends BaseDevice {
1254
+ /* Excluded from this release type: _engine */
1255
+ readonly bufferSize: number;
1256
+ protected _node?: ScriptProcessorNode;
1257
+ /* Excluded from this release type: __constructor */
1258
+ private _onAudioProcess;
1259
+ private _process;
1260
+ private _setCurrentTime;
1261
+ /**
1262
+ * The WebAudio {@link https://developer.mozilla.org/en-US/docs/Web/API/ScriptProcessorNode | ScriptProcessorNode of the device.}
1263
+ * See {@link BaseDevice.node} for more info
1264
+ */
1265
+ get node(): ScriptProcessorNode;
1266
+ /* Excluded from this release type: setPatcher */
1267
+ }
1268
+
1269
+ /* Excluded from this release type: SerializedRNBODataDesc */
1270
+
1271
+ /* Excluded from this release type: StartupPhase */
1272
+
1273
+ /* Excluded from this release type: SyncEngine */
1274
+
1275
+ /**
1276
+ * TempoEvent class to send tempo changes into a RNBO {@link BaseDevice | Device }
1277
+ * @remarks
1278
+ * Refer to our guide on {@link https://rnbo.cycling74.com/learn/musical-time-events | Events related to Musical Time}.
1279
+ * @public
1280
+ */
1281
+ export declare class TempoEvent extends BaseEvent implements ITempoEvent {
1282
+ readonly tempo: number;
1283
+ /** {@inheritDoc BaseEvent."type"} */
1284
+ readonly type: EventType.TempoEvent;
1285
+ constructor(time: MillisecondTime, tempo: number);
1286
+ serialize(): ITempoEvent;
1287
+ }
1288
+
1289
+ /**
1290
+ * Constant representing the time "Now"
1291
+ * @public
1292
+ */
1293
+ export declare const TimeNow: MillisecondTime;
1294
+
1295
+ /**
1296
+ * TimeSignatureEvent class to send time signature changes into a RNBO {@link BaseDevice | Device }
1297
+ * @remarks
1298
+ * Refer to our guide on {@link https://rnbo.cycling74.com/learn/musical-time-events | Events related to Musical Time}.
1299
+ */
1300
+ export declare class TimeSignatureEvent extends BaseEvent implements ITimeSignatureEvent {
1301
+ readonly numerator: number;
1302
+ readonly denominator: number;
1303
+ /** {@inheritDoc BaseEvent."type"} */
1304
+ readonly type: EventType.TimeSignatureEvent;
1305
+ constructor(time: MillisecondTime, numerator: number, denominator: number);
1306
+ serialize(): ITimeSignatureEvent;
1307
+ }
1308
+
1309
+ /* Excluded from this release type: ToProcessorMessage */
1310
+
1311
+ /* Excluded from this release type: ToProcessorMessageId */
1312
+
1313
+ /**
1314
+ * TransportEvent class to send transport state changes into a RNBO {@link BaseDevice | Device }
1315
+ * @remarks
1316
+ * Refer to our guide on {@link https://rnbo.cycling74.com/learn/musical-time-events | Events related to Musical Time}.
1317
+ * @public
1318
+ */
1319
+ export declare class TransportEvent extends BaseEvent implements ITransportEvent {
1320
+ readonly state: TransportState;
1321
+ /** {@inheritDoc BaseEvent."type"} */
1322
+ readonly type: EventType.TransportEvent;
1323
+ constructor(time: MillisecondTime, state: TransportState);
1324
+ serialize(): ITransportEvent;
1325
+ }
1326
+
1327
+ /**
1328
+ * The transport state
1329
+ * @public
1330
+ */
1331
+ export declare enum TransportState {
1332
+ STOPPED = 0,
1333
+ RUNNING = 1
1334
+ }
1335
+
1336
+ declare const uniqueId: () => number;
1337
+
1338
+ /**
1339
+ * The version of \@rnbo/js
1340
+ * @public
1341
+ */
1342
+ export declare const version: string;
1343
+
1344
+ /* Excluded from this release type: WASMEngine */
1345
+
1346
+ declare class WebAudioTimeConverter {
1347
+ fromRNBOtime(time: MillisecondTime): number;
1348
+ toRNBOtime(time: number): MillisecondTime;
1349
+ }
1350
+
1351
+ /**
1352
+ * RNBO Device using AudioWorklets for its processing.
1353
+ *
1354
+ * @remarks
1355
+ * WorkletDevices can be created using the {@link createDevice} factory function.
1356
+ * Please also refer to the article on {@link https://rnbo.cycling74.com/learn/loading-a-rnbo-device-in-the-browser-js | Loading a RNBO device in the Browser} for more information.
1357
+ *
1358
+ * @public
1359
+ * */
1360
+ export declare class WorkletDevice extends BaseDevice {
1361
+ /* Excluded from this release type: _engine */
1362
+ protected _node?: IWorkletNode;
1363
+ /* Excluded from this release type: __constructor */
1364
+ protected _buildParamDescriptor(): string;
1365
+ /**
1366
+ * The WebAudio WorkletNode of the device of type {@link IWorkletNode}.
1367
+ * See {@link BaseDevice.node} for more info
1368
+ */
1369
+ get node(): IWorkletNode;
1370
+ /* Excluded from this release type: setPatcher */
1371
+ }
1372
+
1373
+ export { }