@waveform-playlist/playout 12.3.0 → 12.5.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.
- package/README.md +21 -0
- package/dist/index.d.mts +96 -6
- package/dist/index.d.ts +96 -6
- package/dist/index.js +308 -77
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +305 -77
- package/dist/index.mjs.map +1 -1
- package/package.json +6 -6
package/README.md
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
# @waveform-playlist/playout
|
|
2
|
+
|
|
3
|
+
Tone.js-based `PlayoutAdapter` for [`@waveform-playlist/engine`](https://www.npmjs.com/package/@waveform-playlist/engine) — drives playback, recording, and effects on a shared global audio context. Used by `@waveform-playlist/browser` (the React surface). For native Web Audio (no Tone.js), see `@dawcore/transport`.
|
|
4
|
+
|
|
5
|
+
## Audio context is a standardized-audio-context ponyfill
|
|
6
|
+
|
|
7
|
+
`getGlobalContext()` / `getGlobalAudioContext()` return Tone.js's global context, whose `rawContext` is **always** a [`standardized-audio-context`](https://github.com/chrisguttandin/standardized-audio-context) ponyfill — **not** a native `BaseAudioContext` / `AudioContext`. This is deliberate: the ponyfill normalizes cross-browser differences (e.g. Firefox `AudioWorkletNode` / `AudioParam`).
|
|
8
|
+
|
|
9
|
+
Consequences for integration:
|
|
10
|
+
|
|
11
|
+
- `getGlobalAudioContext() instanceof window.AudioContext` is `false`.
|
|
12
|
+
- The **native** `AudioWorkletNode` constructor rejects it — `new AudioWorkletNode(getGlobalAudioContext(), 'my-processor')` throws `TypeError: parameter 1 is not of type 'BaseAudioContext'` (same in Chrome and Firefox).
|
|
13
|
+
|
|
14
|
+
Third-party worklet code should not hardcode the native constructor. Inject the `AudioWorkletNode` constructor and the module loader (the dependency-injection pattern from [`chrisguttandin/limiter-audio-worklet`](https://github.com/chrisguttandin/limiter-audio-worklet) — paired with [`limiter-audio-worklet-processor`](https://github.com/chrisguttandin/limiter-audio-worklet-processor)), or import `AudioWorkletNode` from `standardized-audio-context`, so the code works on a native **or** ponyfilled context. `@waveform-playlist/worklets` follows this exact pattern:
|
|
15
|
+
|
|
16
|
+
```ts
|
|
17
|
+
// caller supplies addModule for whichever context type is in use
|
|
18
|
+
await addRecordingWorkletModule((url) => ctx.audioWorklet.addModule(url));
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
If you genuinely need a native `AudioContext`, own it yourself via the web-components adapter surface (`@dawcore/*`), which uses native Web Audio rather than Tone.
|
package/dist/index.d.mts
CHANGED
|
@@ -36,6 +36,9 @@ declare class ToneTrack {
|
|
|
36
36
|
private muteGain;
|
|
37
37
|
private track;
|
|
38
38
|
private effectsCleanup?;
|
|
39
|
+
private _destination;
|
|
40
|
+
private _hasClosureEffects;
|
|
41
|
+
private _effectsChainNode;
|
|
39
42
|
private _scheduleGuardOffset;
|
|
40
43
|
constructor(options: ToneTrackOptions);
|
|
41
44
|
/**
|
|
@@ -103,6 +106,15 @@ declare class ToneTrack {
|
|
|
103
106
|
setPan(pan: number): void;
|
|
104
107
|
setMute(muted: boolean): void;
|
|
105
108
|
setSolo(soloed: boolean): void;
|
|
109
|
+
/**
|
|
110
|
+
* Insert an external effects chain: reroute muteGain → node instead of
|
|
111
|
+
* muteGain → destination. The caller wires the chain's output onward
|
|
112
|
+
* (dawcore's EffectsManager connects it to the master bus input).
|
|
113
|
+
* Mutually exclusive with the TrackEffectsFunction closure model.
|
|
114
|
+
*/
|
|
115
|
+
connectEffects(node: AudioNode): void;
|
|
116
|
+
/** Restore the direct muteGain → destination connection. Safe when nothing is connected. */
|
|
117
|
+
disconnectEffects(): void;
|
|
106
118
|
dispose(): void;
|
|
107
119
|
get id(): string;
|
|
108
120
|
get duration(): number;
|
|
@@ -317,6 +329,16 @@ declare class SoundFontCache {
|
|
|
317
329
|
* construct before user interaction (avoids Firefox autoplay warnings).
|
|
318
330
|
*/
|
|
319
331
|
constructor(context?: BaseAudioContext);
|
|
332
|
+
/**
|
|
333
|
+
* Fetch and parse an SF2 file, resolving only once it's ready to play.
|
|
334
|
+
* Prefer this over `new SoundFontCache()` + `load()` — the returned cache
|
|
335
|
+
* is always loaded, so it can't hit the "unloaded cache → PolySynth
|
|
336
|
+
* fallback" path in createToneAdapter / setSoundFontCache.
|
|
337
|
+
*/
|
|
338
|
+
static fromUrl(url: string, options?: {
|
|
339
|
+
context?: BaseAudioContext;
|
|
340
|
+
signal?: AbortSignal;
|
|
341
|
+
}): Promise<SoundFontCache>;
|
|
320
342
|
/**
|
|
321
343
|
* Load and parse an SF2 file from a URL.
|
|
322
344
|
*/
|
|
@@ -436,6 +458,7 @@ declare class TonePlayout {
|
|
|
436
458
|
private _loopEnabled;
|
|
437
459
|
private _loopStart;
|
|
438
460
|
private _loopEnd;
|
|
461
|
+
private _masterChainNode;
|
|
439
462
|
constructor(options?: TonePlayoutOptions);
|
|
440
463
|
private clearCompletionEvent;
|
|
441
464
|
init(): Promise<void>;
|
|
@@ -469,6 +492,23 @@ declare class TonePlayout {
|
|
|
469
492
|
* Connect analyzers/effects/recorders here — parallel or serial.
|
|
470
493
|
* The tap's native GainNode is on the same standardized-audio-context as adapter.audioContext. */
|
|
471
494
|
get masterOutputNode(): GainNode;
|
|
495
|
+
/**
|
|
496
|
+
* Native GainNode behind masterVolume.input — the master-bus junction that
|
|
497
|
+
* per-track effect chains reconnect into (pre master volume). Distinct from
|
|
498
|
+
* masterOutputNode (the post-volume tap for analyzers).
|
|
499
|
+
*/
|
|
500
|
+
get masterBusInputNode(): GainNode;
|
|
501
|
+
/** Insert an external chain on a track: muteGain → node (caller wires node onward). */
|
|
502
|
+
connectTrackOutput(trackId: string, node: AudioNode): void;
|
|
503
|
+
/** Restore a track's direct connection. No-op for unknown or MIDI tracks. */
|
|
504
|
+
disconnectTrackOutput(trackId: string): void;
|
|
505
|
+
/**
|
|
506
|
+
* Insert an external master chain after the tap: masterVolume → [closure
|
|
507
|
+
* effects] → tap → node (caller wires node.output → ctx.destination).
|
|
508
|
+
*/
|
|
509
|
+
connectMasterOutput(node: AudioNode): void;
|
|
510
|
+
/** Restore tap → destination. Safe when no master chain is connected. */
|
|
511
|
+
disconnectMasterOutput(): void;
|
|
472
512
|
setSolo(trackId: string, soloed: boolean): void;
|
|
473
513
|
private updateSoloMuting;
|
|
474
514
|
setMute(trackId: string, muted: boolean): void;
|
|
@@ -487,27 +527,48 @@ declare class TonePlayout {
|
|
|
487
527
|
* Provides a single AudioContext shared across the entire application.
|
|
488
528
|
* This context is used by Tone.js for playback and by all recording/monitoring hooks.
|
|
489
529
|
*
|
|
490
|
-
*
|
|
491
|
-
*
|
|
530
|
+
* Supports both native AudioContext (WAM 2.0 plugin hosting, requires
|
|
531
|
+
* AudioListener AudioParams — Firefox fallback to standardized-audio-context)
|
|
532
|
+
* and standardized-audio-context wrapper for cross-browser compatibility.
|
|
492
533
|
*/
|
|
493
534
|
|
|
494
535
|
interface AudioContextOptions {
|
|
536
|
+
/**
|
|
537
|
+
* Create the global context around a NATIVE AudioContext instead of
|
|
538
|
+
* standardized-audio-context. Required for WAM 2.0 plugin hosting — WAM
|
|
539
|
+
* worklets subclass the native AudioWorkletNode and cannot join a
|
|
540
|
+
* standardized-audio-context graph. Falls back to the default context
|
|
541
|
+
* (with a console warning) on browsers missing AudioListener AudioParams
|
|
542
|
+
* (Firefox), where Tone.js Listener initialization would throw.
|
|
543
|
+
*/
|
|
544
|
+
nativeAudioContext?: boolean;
|
|
495
545
|
/** Desired sample rate. Creates a standardized-audio-context AudioContext
|
|
496
546
|
* at this rate, bypassing Tone.js 15.1.22's limitation. Cross-browser safe. */
|
|
497
547
|
sampleRate?: number;
|
|
498
548
|
/** Latency hint passed to the AudioContext constructor. */
|
|
499
549
|
latencyHint?: AudioContextLatencyCategory | number;
|
|
500
550
|
}
|
|
551
|
+
/**
|
|
552
|
+
* Whether this browser can run Tone.js on a raw native AudioContext.
|
|
553
|
+
* Firefox lacks the AudioListener AudioParams (positionX/…/upZ) that Tone's
|
|
554
|
+
* Listener wraps eagerly at context initialization (Tone.js #681) —
|
|
555
|
+
* standardized-audio-context polyfills them, native contexts cannot.
|
|
556
|
+
*/
|
|
557
|
+
declare function supportsNativeContextMode(): boolean;
|
|
558
|
+
/**
|
|
559
|
+
* True when the global context wraps a native AudioContext (WAM-capable).
|
|
560
|
+
*/
|
|
561
|
+
declare function isNativeGlobalContext(): boolean;
|
|
501
562
|
/**
|
|
502
563
|
* Configure the global AudioContext with sample rate and latency hints.
|
|
503
|
-
*
|
|
504
|
-
* Firefox AudioListener bug) and wraps it in Tone.js Context.
|
|
564
|
+
* Supports both native AudioContext (for WAM 2.0 hosting) and standardized-audio-context.
|
|
505
565
|
*
|
|
506
566
|
* Should be called BEFORE getGlobalContext(). If the context already exists
|
|
507
567
|
* (e.g., from resumeGlobalAudioContext), warns and returns the existing rate.
|
|
508
568
|
*
|
|
509
569
|
* ```ts
|
|
510
570
|
* configureGlobalContext({ sampleRate: 48000, latencyHint: 0 })
|
|
571
|
+
* configureGlobalContext({ nativeAudioContext: true, sampleRate: 48000 })
|
|
511
572
|
* ```
|
|
512
573
|
*/
|
|
513
574
|
declare function configureGlobalContext(options: AudioContextOptions): number;
|
|
@@ -610,6 +671,35 @@ interface ToneAdapterOptions {
|
|
|
610
671
|
/** Pulses per quarter note. Defaults to 192 (Tone.js native). */
|
|
611
672
|
ppqn?: number;
|
|
612
673
|
}
|
|
613
|
-
|
|
674
|
+
/**
|
|
675
|
+
* Effects wiring hooks consumed by dawcore's EffectsManager (structural match
|
|
676
|
+
* for its EffectsTransportLike). All hooks require native-context mode —
|
|
677
|
+
* effect chains carry native AudioNodes (incl. WAM worklets) that cannot join
|
|
678
|
+
* a standardized-audio-context graph.
|
|
679
|
+
*/
|
|
680
|
+
interface ToneEffectsTransport {
|
|
681
|
+
connectTrackOutput(trackId: string, node: AudioNode): void;
|
|
682
|
+
disconnectTrackOutput(trackId: string): void;
|
|
683
|
+
connectMasterOutput(node: AudioNode): void;
|
|
684
|
+
disconnectMasterOutput(): void;
|
|
685
|
+
readonly masterOutputNode: AudioNode;
|
|
686
|
+
}
|
|
687
|
+
interface ToneAdapter extends PlayoutAdapter {
|
|
688
|
+
/**
|
|
689
|
+
* Provide or swap the SoundFont after creation. Rebuilds only the MIDI
|
|
690
|
+
* tracks whose routing changes; audio tracks keep playing untouched.
|
|
691
|
+
* Pass undefined to revert MIDI tracks to PolySynth synthesis.
|
|
692
|
+
*/
|
|
693
|
+
setSoundFontCache(cache: SoundFontCache | undefined): void;
|
|
694
|
+
/** Effects wiring hooks (dawcore EffectsManager). Requires native-context mode. */
|
|
695
|
+
readonly transport: ToneEffectsTransport;
|
|
696
|
+
}
|
|
697
|
+
/**
|
|
698
|
+
* Capability check for Tone-specific adapter features. Structural, not
|
|
699
|
+
* instanceof — any adapter implementing setSoundFontCache passes. Narrows a
|
|
700
|
+
* generic PlayoutAdapter so soundfont calls typecheck without casts.
|
|
701
|
+
*/
|
|
702
|
+
declare function isToneAdapter(adapter: PlayoutAdapter | null | undefined): adapter is ToneAdapter;
|
|
703
|
+
declare function createToneAdapter(options?: ToneAdapterOptions): ToneAdapter;
|
|
614
704
|
|
|
615
|
-
export { type AudioContextOptions, type EffectsFunction, type LoopAndEnvelopeParams, type MidiClipInfo, MidiToneTrack, type MidiToneTrackOptions, type PlayableTrack, type PlaybackRateParams, SoundFontCache, type SoundFontSample, SoundFontToneTrack, type SoundFontToneTrackOptions, type ToneAdapterOptions, TonePlayout, type TonePlayoutOptions, ToneTrack, type ToneTrackOptions, type TrackEffectsFunction, calculatePlaybackRate, closeGlobalAudioContext, configureGlobalContext, createToneAdapter, extractLoopAndEnvelope, getGeneratorValue, getGlobalAudioContext, getGlobalAudioContextState, getGlobalContext, getGlobalToneContext, getMediaStreamSource, getUnderlyingAudioParam, hasMediaStreamSource, int16ToFloat32, releaseMediaStreamSource, resumeGlobalAudioContext, timecentsToSeconds };
|
|
705
|
+
export { type AudioContextOptions, type EffectsFunction, type LoopAndEnvelopeParams, type MidiClipInfo, MidiToneTrack, type MidiToneTrackOptions, type PlayableTrack, type PlaybackRateParams, SoundFontCache, type SoundFontSample, SoundFontToneTrack, type SoundFontToneTrackOptions, type ToneAdapter, type ToneAdapterOptions, type ToneEffectsTransport, TonePlayout, type TonePlayoutOptions, ToneTrack, type ToneTrackOptions, type TrackEffectsFunction, calculatePlaybackRate, closeGlobalAudioContext, configureGlobalContext, createToneAdapter, extractLoopAndEnvelope, getGeneratorValue, getGlobalAudioContext, getGlobalAudioContextState, getGlobalContext, getGlobalToneContext, getMediaStreamSource, getUnderlyingAudioParam, hasMediaStreamSource, int16ToFloat32, isNativeGlobalContext, isToneAdapter, releaseMediaStreamSource, resumeGlobalAudioContext, supportsNativeContextMode, timecentsToSeconds };
|
package/dist/index.d.ts
CHANGED
|
@@ -36,6 +36,9 @@ declare class ToneTrack {
|
|
|
36
36
|
private muteGain;
|
|
37
37
|
private track;
|
|
38
38
|
private effectsCleanup?;
|
|
39
|
+
private _destination;
|
|
40
|
+
private _hasClosureEffects;
|
|
41
|
+
private _effectsChainNode;
|
|
39
42
|
private _scheduleGuardOffset;
|
|
40
43
|
constructor(options: ToneTrackOptions);
|
|
41
44
|
/**
|
|
@@ -103,6 +106,15 @@ declare class ToneTrack {
|
|
|
103
106
|
setPan(pan: number): void;
|
|
104
107
|
setMute(muted: boolean): void;
|
|
105
108
|
setSolo(soloed: boolean): void;
|
|
109
|
+
/**
|
|
110
|
+
* Insert an external effects chain: reroute muteGain → node instead of
|
|
111
|
+
* muteGain → destination. The caller wires the chain's output onward
|
|
112
|
+
* (dawcore's EffectsManager connects it to the master bus input).
|
|
113
|
+
* Mutually exclusive with the TrackEffectsFunction closure model.
|
|
114
|
+
*/
|
|
115
|
+
connectEffects(node: AudioNode): void;
|
|
116
|
+
/** Restore the direct muteGain → destination connection. Safe when nothing is connected. */
|
|
117
|
+
disconnectEffects(): void;
|
|
106
118
|
dispose(): void;
|
|
107
119
|
get id(): string;
|
|
108
120
|
get duration(): number;
|
|
@@ -317,6 +329,16 @@ declare class SoundFontCache {
|
|
|
317
329
|
* construct before user interaction (avoids Firefox autoplay warnings).
|
|
318
330
|
*/
|
|
319
331
|
constructor(context?: BaseAudioContext);
|
|
332
|
+
/**
|
|
333
|
+
* Fetch and parse an SF2 file, resolving only once it's ready to play.
|
|
334
|
+
* Prefer this over `new SoundFontCache()` + `load()` — the returned cache
|
|
335
|
+
* is always loaded, so it can't hit the "unloaded cache → PolySynth
|
|
336
|
+
* fallback" path in createToneAdapter / setSoundFontCache.
|
|
337
|
+
*/
|
|
338
|
+
static fromUrl(url: string, options?: {
|
|
339
|
+
context?: BaseAudioContext;
|
|
340
|
+
signal?: AbortSignal;
|
|
341
|
+
}): Promise<SoundFontCache>;
|
|
320
342
|
/**
|
|
321
343
|
* Load and parse an SF2 file from a URL.
|
|
322
344
|
*/
|
|
@@ -436,6 +458,7 @@ declare class TonePlayout {
|
|
|
436
458
|
private _loopEnabled;
|
|
437
459
|
private _loopStart;
|
|
438
460
|
private _loopEnd;
|
|
461
|
+
private _masterChainNode;
|
|
439
462
|
constructor(options?: TonePlayoutOptions);
|
|
440
463
|
private clearCompletionEvent;
|
|
441
464
|
init(): Promise<void>;
|
|
@@ -469,6 +492,23 @@ declare class TonePlayout {
|
|
|
469
492
|
* Connect analyzers/effects/recorders here — parallel or serial.
|
|
470
493
|
* The tap's native GainNode is on the same standardized-audio-context as adapter.audioContext. */
|
|
471
494
|
get masterOutputNode(): GainNode;
|
|
495
|
+
/**
|
|
496
|
+
* Native GainNode behind masterVolume.input — the master-bus junction that
|
|
497
|
+
* per-track effect chains reconnect into (pre master volume). Distinct from
|
|
498
|
+
* masterOutputNode (the post-volume tap for analyzers).
|
|
499
|
+
*/
|
|
500
|
+
get masterBusInputNode(): GainNode;
|
|
501
|
+
/** Insert an external chain on a track: muteGain → node (caller wires node onward). */
|
|
502
|
+
connectTrackOutput(trackId: string, node: AudioNode): void;
|
|
503
|
+
/** Restore a track's direct connection. No-op for unknown or MIDI tracks. */
|
|
504
|
+
disconnectTrackOutput(trackId: string): void;
|
|
505
|
+
/**
|
|
506
|
+
* Insert an external master chain after the tap: masterVolume → [closure
|
|
507
|
+
* effects] → tap → node (caller wires node.output → ctx.destination).
|
|
508
|
+
*/
|
|
509
|
+
connectMasterOutput(node: AudioNode): void;
|
|
510
|
+
/** Restore tap → destination. Safe when no master chain is connected. */
|
|
511
|
+
disconnectMasterOutput(): void;
|
|
472
512
|
setSolo(trackId: string, soloed: boolean): void;
|
|
473
513
|
private updateSoloMuting;
|
|
474
514
|
setMute(trackId: string, muted: boolean): void;
|
|
@@ -487,27 +527,48 @@ declare class TonePlayout {
|
|
|
487
527
|
* Provides a single AudioContext shared across the entire application.
|
|
488
528
|
* This context is used by Tone.js for playback and by all recording/monitoring hooks.
|
|
489
529
|
*
|
|
490
|
-
*
|
|
491
|
-
*
|
|
530
|
+
* Supports both native AudioContext (WAM 2.0 plugin hosting, requires
|
|
531
|
+
* AudioListener AudioParams — Firefox fallback to standardized-audio-context)
|
|
532
|
+
* and standardized-audio-context wrapper for cross-browser compatibility.
|
|
492
533
|
*/
|
|
493
534
|
|
|
494
535
|
interface AudioContextOptions {
|
|
536
|
+
/**
|
|
537
|
+
* Create the global context around a NATIVE AudioContext instead of
|
|
538
|
+
* standardized-audio-context. Required for WAM 2.0 plugin hosting — WAM
|
|
539
|
+
* worklets subclass the native AudioWorkletNode and cannot join a
|
|
540
|
+
* standardized-audio-context graph. Falls back to the default context
|
|
541
|
+
* (with a console warning) on browsers missing AudioListener AudioParams
|
|
542
|
+
* (Firefox), where Tone.js Listener initialization would throw.
|
|
543
|
+
*/
|
|
544
|
+
nativeAudioContext?: boolean;
|
|
495
545
|
/** Desired sample rate. Creates a standardized-audio-context AudioContext
|
|
496
546
|
* at this rate, bypassing Tone.js 15.1.22's limitation. Cross-browser safe. */
|
|
497
547
|
sampleRate?: number;
|
|
498
548
|
/** Latency hint passed to the AudioContext constructor. */
|
|
499
549
|
latencyHint?: AudioContextLatencyCategory | number;
|
|
500
550
|
}
|
|
551
|
+
/**
|
|
552
|
+
* Whether this browser can run Tone.js on a raw native AudioContext.
|
|
553
|
+
* Firefox lacks the AudioListener AudioParams (positionX/…/upZ) that Tone's
|
|
554
|
+
* Listener wraps eagerly at context initialization (Tone.js #681) —
|
|
555
|
+
* standardized-audio-context polyfills them, native contexts cannot.
|
|
556
|
+
*/
|
|
557
|
+
declare function supportsNativeContextMode(): boolean;
|
|
558
|
+
/**
|
|
559
|
+
* True when the global context wraps a native AudioContext (WAM-capable).
|
|
560
|
+
*/
|
|
561
|
+
declare function isNativeGlobalContext(): boolean;
|
|
501
562
|
/**
|
|
502
563
|
* Configure the global AudioContext with sample rate and latency hints.
|
|
503
|
-
*
|
|
504
|
-
* Firefox AudioListener bug) and wraps it in Tone.js Context.
|
|
564
|
+
* Supports both native AudioContext (for WAM 2.0 hosting) and standardized-audio-context.
|
|
505
565
|
*
|
|
506
566
|
* Should be called BEFORE getGlobalContext(). If the context already exists
|
|
507
567
|
* (e.g., from resumeGlobalAudioContext), warns and returns the existing rate.
|
|
508
568
|
*
|
|
509
569
|
* ```ts
|
|
510
570
|
* configureGlobalContext({ sampleRate: 48000, latencyHint: 0 })
|
|
571
|
+
* configureGlobalContext({ nativeAudioContext: true, sampleRate: 48000 })
|
|
511
572
|
* ```
|
|
512
573
|
*/
|
|
513
574
|
declare function configureGlobalContext(options: AudioContextOptions): number;
|
|
@@ -610,6 +671,35 @@ interface ToneAdapterOptions {
|
|
|
610
671
|
/** Pulses per quarter note. Defaults to 192 (Tone.js native). */
|
|
611
672
|
ppqn?: number;
|
|
612
673
|
}
|
|
613
|
-
|
|
674
|
+
/**
|
|
675
|
+
* Effects wiring hooks consumed by dawcore's EffectsManager (structural match
|
|
676
|
+
* for its EffectsTransportLike). All hooks require native-context mode —
|
|
677
|
+
* effect chains carry native AudioNodes (incl. WAM worklets) that cannot join
|
|
678
|
+
* a standardized-audio-context graph.
|
|
679
|
+
*/
|
|
680
|
+
interface ToneEffectsTransport {
|
|
681
|
+
connectTrackOutput(trackId: string, node: AudioNode): void;
|
|
682
|
+
disconnectTrackOutput(trackId: string): void;
|
|
683
|
+
connectMasterOutput(node: AudioNode): void;
|
|
684
|
+
disconnectMasterOutput(): void;
|
|
685
|
+
readonly masterOutputNode: AudioNode;
|
|
686
|
+
}
|
|
687
|
+
interface ToneAdapter extends PlayoutAdapter {
|
|
688
|
+
/**
|
|
689
|
+
* Provide or swap the SoundFont after creation. Rebuilds only the MIDI
|
|
690
|
+
* tracks whose routing changes; audio tracks keep playing untouched.
|
|
691
|
+
* Pass undefined to revert MIDI tracks to PolySynth synthesis.
|
|
692
|
+
*/
|
|
693
|
+
setSoundFontCache(cache: SoundFontCache | undefined): void;
|
|
694
|
+
/** Effects wiring hooks (dawcore EffectsManager). Requires native-context mode. */
|
|
695
|
+
readonly transport: ToneEffectsTransport;
|
|
696
|
+
}
|
|
697
|
+
/**
|
|
698
|
+
* Capability check for Tone-specific adapter features. Structural, not
|
|
699
|
+
* instanceof — any adapter implementing setSoundFontCache passes. Narrows a
|
|
700
|
+
* generic PlayoutAdapter so soundfont calls typecheck without casts.
|
|
701
|
+
*/
|
|
702
|
+
declare function isToneAdapter(adapter: PlayoutAdapter | null | undefined): adapter is ToneAdapter;
|
|
703
|
+
declare function createToneAdapter(options?: ToneAdapterOptions): ToneAdapter;
|
|
614
704
|
|
|
615
|
-
export { type AudioContextOptions, type EffectsFunction, type LoopAndEnvelopeParams, type MidiClipInfo, MidiToneTrack, type MidiToneTrackOptions, type PlayableTrack, type PlaybackRateParams, SoundFontCache, type SoundFontSample, SoundFontToneTrack, type SoundFontToneTrackOptions, type ToneAdapterOptions, TonePlayout, type TonePlayoutOptions, ToneTrack, type ToneTrackOptions, type TrackEffectsFunction, calculatePlaybackRate, closeGlobalAudioContext, configureGlobalContext, createToneAdapter, extractLoopAndEnvelope, getGeneratorValue, getGlobalAudioContext, getGlobalAudioContextState, getGlobalContext, getGlobalToneContext, getMediaStreamSource, getUnderlyingAudioParam, hasMediaStreamSource, int16ToFloat32, releaseMediaStreamSource, resumeGlobalAudioContext, timecentsToSeconds };
|
|
705
|
+
export { type AudioContextOptions, type EffectsFunction, type LoopAndEnvelopeParams, type MidiClipInfo, MidiToneTrack, type MidiToneTrackOptions, type PlayableTrack, type PlaybackRateParams, SoundFontCache, type SoundFontSample, SoundFontToneTrack, type SoundFontToneTrackOptions, type ToneAdapter, type ToneAdapterOptions, type ToneEffectsTransport, TonePlayout, type TonePlayoutOptions, ToneTrack, type ToneTrackOptions, type TrackEffectsFunction, calculatePlaybackRate, closeGlobalAudioContext, configureGlobalContext, createToneAdapter, extractLoopAndEnvelope, getGeneratorValue, getGlobalAudioContext, getGlobalAudioContextState, getGlobalContext, getGlobalToneContext, getMediaStreamSource, getUnderlyingAudioParam, hasMediaStreamSource, int16ToFloat32, isNativeGlobalContext, isToneAdapter, releaseMediaStreamSource, resumeGlobalAudioContext, supportsNativeContextMode, timecentsToSeconds };
|