@waveform-playlist/browser 14.0.0 → 15.1.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/dist/tone.d.mts CHANGED
@@ -1,8 +1,10 @@
1
- import { TrackEffectsFunction as TrackEffectsFunction$1, Fade, WaveformDataObject, RenderMode, SpectrogramConfig, ColorMapValue, ClipTrack } from '@waveform-playlist/core';
1
+ import { TrackEffectsFunction, Fade, WaveformDataObject, RenderMode, SpectrogramConfig, ColorMapValue, ClipTrack } from '@waveform-playlist/core';
2
2
  import * as React$1 from 'react';
3
3
  import React__default from 'react';
4
- import { EffectsFunction, TrackEffectsFunction as TrackEffectsFunction$2 } from '@waveform-playlist/playout';
5
- import { Analyser, ToneAudioNode, InputNode } from 'tone';
4
+ import { EffectsFunction, TrackEffectsFunction as TrackEffectsFunction$1 } from '@waveform-playlist/playout';
5
+ import { Analyser, Volume, ToneAudioNode, Gain, InputNode } from 'tone';
6
+ import * as _dawcore_wam from '@dawcore/wam';
7
+ import { WamPluginInstance } from '@dawcore/wam';
6
8
 
7
9
  /**
8
10
  * Configuration for a single audio track to load
@@ -26,7 +28,7 @@ interface AudioTrackConfig {
26
28
  volume?: number;
27
29
  pan?: number;
28
30
  color?: string;
29
- effects?: TrackEffectsFunction$1;
31
+ effects?: TrackEffectsFunction;
30
32
  startTime?: number;
31
33
  duration?: number;
32
34
  offset?: number;
@@ -142,7 +144,7 @@ interface EffectParameter {
142
144
  interface EffectDefinition {
143
145
  id: string;
144
146
  name: string;
145
- category: 'delay' | 'reverb' | 'modulation' | 'distortion' | 'filter' | 'dynamics' | 'spatial';
147
+ category: 'delay' | 'reverb' | 'modulation' | 'distortion' | 'filter' | 'dynamics' | 'spatial' | 'wam';
146
148
  description: string;
147
149
  parameters: EffectParameter[];
148
150
  }
@@ -154,66 +156,6 @@ declare const effectCategories: {
154
156
  name: string;
155
157
  }[];
156
158
 
157
- interface ActiveEffect {
158
- instanceId: string;
159
- effectId: string;
160
- definition: EffectDefinition;
161
- params: Record<string, number | string | boolean>;
162
- bypassed: boolean;
163
- }
164
- interface UseDynamicEffectsReturn {
165
- activeEffects: ActiveEffect[];
166
- availableEffects: EffectDefinition[];
167
- addEffect: (effectId: string) => void;
168
- removeEffect: (instanceId: string) => void;
169
- updateParameter: (instanceId: string, paramName: string, value: number | string | boolean) => void;
170
- toggleBypass: (instanceId: string) => void;
171
- reorderEffects: (fromIndex: number, toIndex: number) => void;
172
- clearAllEffects: () => void;
173
- masterEffects: EffectsFunction;
174
- /**
175
- * Creates a fresh effects function for offline rendering.
176
- * This creates new effect instances that work in the offline AudioContext.
177
- */
178
- createOfflineEffectsFunction: () => EffectsFunction | undefined;
179
- analyserRef: React.RefObject<Analyser | null>;
180
- }
181
- /**
182
- * Hook for managing a dynamic chain of audio effects with real-time parameter updates
183
- */
184
- declare function useDynamicEffects(fftSize?: number): UseDynamicEffectsReturn;
185
-
186
- interface TrackActiveEffect {
187
- instanceId: string;
188
- effectId: string;
189
- definition: EffectDefinition;
190
- params: Record<string, number | string | boolean>;
191
- bypassed: boolean;
192
- }
193
- interface TrackEffectsState {
194
- trackId: string;
195
- activeEffects: TrackActiveEffect[];
196
- }
197
- interface UseTrackDynamicEffectsReturn {
198
- trackEffectsState: Map<string, TrackActiveEffect[]>;
199
- addEffectToTrack: (trackId: string, effectId: string) => void;
200
- removeEffectFromTrack: (trackId: string, instanceId: string) => void;
201
- updateTrackEffectParameter: (trackId: string, instanceId: string, paramName: string, value: number | string | boolean) => void;
202
- toggleBypass: (trackId: string, instanceId: string) => void;
203
- clearTrackEffects: (trackId: string) => void;
204
- getTrackEffectsFunction: (trackId: string) => TrackEffectsFunction$2 | undefined;
205
- /**
206
- * Creates a fresh effects function for a track for offline rendering.
207
- * This creates new effect instances that work in the offline AudioContext.
208
- */
209
- createOfflineTrackEffectsFunction: (trackId: string) => TrackEffectsFunction$2 | undefined;
210
- availableEffects: EffectDefinition[];
211
- }
212
- /**
213
- * Hook for managing dynamic effects per track with real-time parameter updates
214
- */
215
- declare function useTrackDynamicEffects(): UseTrackDynamicEffectsReturn;
216
-
217
159
  /**
218
160
  * WAV file encoder
219
161
  * Converts AudioBuffer to WAV format Blob
@@ -223,8 +165,16 @@ interface WavEncoderOptions {
223
165
  bitDepth?: 16 | 32;
224
166
  }
225
167
 
226
- /** Function type for per-track effects (same as in @waveform-playlist/core) */
227
- type TrackEffectsFunction = (graphEnd: unknown, destination: unknown, isOffline: boolean) => void | (() => void);
168
+ /** Cleanup returned by an offline effects function (disposes offline instances / WAM clones). */
169
+ type OfflineEffectsCleanup = void | (() => void);
170
+ /**
171
+ * Master-chain effects function for offline rendering. May return a Promise —
172
+ * WAM entries are re-instantiated asynchronously on the offline context.
173
+ * Every live EffectsFunction is assignable to this type.
174
+ */
175
+ type OfflineEffectsFunction = (masterVolume: Volume, destination: ToneAudioNode, isOffline: boolean) => OfflineEffectsCleanup | Promise<OfflineEffectsCleanup>;
176
+ /** Per-track variant of OfflineEffectsFunction. */
177
+ type OfflineTrackEffectsFunction = (graphEnd: Gain, masterGainNode: ToneAudioNode, isOffline: boolean) => OfflineEffectsCleanup | Promise<OfflineEffectsCleanup>;
228
178
  interface ExportOptions extends WavEncoderOptions {
229
179
  /** Filename for download (without extension) */
230
180
  filename?: string;
@@ -237,16 +187,17 @@ interface ExportOptions extends WavEncoderOptions {
237
187
  /** Whether to apply effects (fades, etc.) - defaults to true */
238
188
  applyEffects?: boolean;
239
189
  /**
240
- * Optional Tone.js effects function for master effects. When provided, export renders
241
- * through the effects chain. The function receives isOffline=true.
190
+ * Optional effects function for master effects. When provided, export renders
191
+ * through the effects chain (WAM entries included — re-instantiated on the
192
+ * offline context). The function receives isOffline=true and may be async.
242
193
  */
243
- effectsFunction?: EffectsFunction;
194
+ effectsFunction?: OfflineEffectsFunction;
244
195
  /**
245
196
  * Optional function to create offline track effects.
246
- * Takes a trackId and returns a TrackEffectsFunction for offline rendering.
197
+ * Takes a trackId and returns an offline effects function for that track.
247
198
  * This is used instead of track.effects to avoid AudioContext mismatch issues.
248
199
  */
249
- createOfflineTrackEffects?: (trackId: string) => TrackEffectsFunction | undefined;
200
+ createOfflineTrackEffects?: (trackId: string) => OfflineTrackEffectsFunction | undefined;
250
201
  /** Progress callback (0-1) */
251
202
  onProgress?: (progress: number) => void;
252
203
  }
@@ -276,10 +227,104 @@ interface TrackState {
276
227
  }
277
228
  /**
278
229
  * Hook for exporting the waveform playlist to WAV format.
279
- * Uses Tone.Offline for non-real-time rendering, mirroring the live playback graph.
230
+ * Uses a Tone offline render (native OfflineAudioContext in native-context mode),
231
+ * mirroring the live playback graph.
280
232
  */
281
233
  declare function useExportWav(): UseExportWavReturn;
282
234
 
235
+ interface ActiveEffect {
236
+ instanceId: string;
237
+ effectId: string;
238
+ /** 'native' = built-in Tone effect; 'wam' = hosted WAM plugin. */
239
+ kind: 'native' | 'wam';
240
+ /** Module URL for wam entries. */
241
+ url?: string;
242
+ definition: EffectDefinition;
243
+ params: Record<string, number | string | boolean>;
244
+ bypassed: boolean;
245
+ }
246
+ interface UseDynamicEffectsReturn {
247
+ activeEffects: ActiveEffect[];
248
+ availableEffects: EffectDefinition[];
249
+ addEffect: (effectId: string) => void;
250
+ /**
251
+ * Hosts a WAM plugin from a module URL and appends it to the master chain.
252
+ * Requires native-context mode — call configureGlobalContext({ nativeAudioContext: true })
253
+ * from @waveform-playlist/playout before any audio initialization.
254
+ * WAM entries render in offline WAV export (re-instantiated on the offline context).
255
+ * Resolves with the new entry's instanceId.
256
+ */
257
+ addWamEffect: (url: string, initialState?: unknown) => Promise<string>;
258
+ /** Live plugin handle for a hosted WAM entry (for GUI mounting via WamEffectGui). */
259
+ getWamPlugin: (instanceId: string) => WamPluginInstance | undefined;
260
+ removeEffect: (instanceId: string) => void;
261
+ updateParameter: (instanceId: string, paramName: string, value: number | string | boolean) => void;
262
+ toggleBypass: (instanceId: string) => void;
263
+ reorderEffects: (fromIndex: number, toIndex: number) => void;
264
+ clearAllEffects: () => void;
265
+ masterEffects: EffectsFunction;
266
+ /**
267
+ * Creates a fresh effects function for offline rendering. Native effects are
268
+ * re-created on the offline context; WAM entries are re-instantiated from
269
+ * their URL-cached factories with the live instance's state transferred.
270
+ * The returned function may be async and may reject — a WAV export never
271
+ * silently renders without an effect the live chain has.
272
+ */
273
+ createOfflineEffectsFunction: () => OfflineEffectsFunction | undefined;
274
+ analyserRef: React.RefObject<Analyser | null>;
275
+ }
276
+ /**
277
+ * Hook for managing a dynamic chain of audio effects with real-time parameter updates
278
+ */
279
+ declare function useDynamicEffects(fftSize?: number): UseDynamicEffectsReturn;
280
+
281
+ interface TrackActiveEffect {
282
+ instanceId: string;
283
+ effectId: string;
284
+ /** 'native' = built-in Tone effect; 'wam' = hosted WAM plugin. */
285
+ kind: 'native' | 'wam';
286
+ /** Module URL for wam entries. */
287
+ url?: string;
288
+ definition: EffectDefinition;
289
+ params: Record<string, number | string | boolean>;
290
+ bypassed: boolean;
291
+ }
292
+ interface TrackEffectsState {
293
+ trackId: string;
294
+ activeEffects: TrackActiveEffect[];
295
+ }
296
+ interface UseTrackDynamicEffectsReturn {
297
+ trackEffectsState: Map<string, TrackActiveEffect[]>;
298
+ addEffectToTrack: (trackId: string, effectId: string) => void;
299
+ /**
300
+ * Hosts a WAM plugin from a module URL and appends it to a track's effect chain.
301
+ * Requires native-context mode — call configureGlobalContext({ nativeAudioContext: true })
302
+ * from @waveform-playlist/playout before any audio initialization.
303
+ * WAM entries render in offline WAV export (re-instantiated on the offline context).
304
+ * Resolves with the new entry's instanceId.
305
+ */
306
+ addWamEffectToTrack: (trackId: string, url: string, initialState?: unknown) => Promise<string>;
307
+ /** Live plugin handle for a hosted WAM entry on a track (for GUI mounting via WamEffectGui). */
308
+ getTrackWamPlugin: (trackId: string, instanceId: string) => WamPluginInstance | undefined;
309
+ removeEffectFromTrack: (trackId: string, instanceId: string) => void;
310
+ updateTrackEffectParameter: (trackId: string, instanceId: string, paramName: string, value: number | string | boolean) => void;
311
+ toggleBypass: (trackId: string, instanceId: string) => void;
312
+ clearTrackEffects: (trackId: string) => void;
313
+ getTrackEffectsFunction: (trackId: string) => TrackEffectsFunction$1 | undefined;
314
+ /**
315
+ * Creates a fresh effects function for a track for offline rendering.
316
+ * Native effects are re-created on the offline context; WAM entries are
317
+ * re-instantiated with the live instance's state transferred. May reject —
318
+ * a WAV export never silently renders without an effect the live chain has.
319
+ */
320
+ createOfflineTrackEffectsFunction: (trackId: string) => OfflineTrackEffectsFunction | undefined;
321
+ availableEffects: EffectDefinition[];
322
+ }
323
+ /**
324
+ * Hook for managing dynamic effects per track with real-time parameter updates
325
+ */
326
+ declare function useTrackDynamicEffects(): UseTrackDynamicEffectsReturn;
327
+
283
328
  /**
284
329
  * useDynamicTracks — imperative hook for runtime track additions.
285
330
  *
@@ -372,7 +417,7 @@ declare function useOutputMeter(options?: UseOutputMeterOptions): UseOutputMeter
372
417
  */
373
418
 
374
419
  interface EffectInstance {
375
- effect: ToneAudioNode;
420
+ effect: ToneAudioNode | AudioNode;
376
421
  id: string;
377
422
  instanceId: string;
378
423
  dispose: () => void;
@@ -389,8 +434,8 @@ declare function createEffectInstance(definition: EffectDefinition, initialParam
389
434
  * Create a chain of effects connected in series
390
435
  */
391
436
  declare function createEffectChain(effects: EffectInstance[]): {
392
- input: ToneAudioNode;
393
- output: ToneAudioNode;
437
+ input: ToneAudioNode | AudioNode;
438
+ output: ToneAudioNode | AudioNode;
394
439
  dispose: () => void;
395
440
  };
396
441
 
@@ -408,15 +453,15 @@ interface ExportWavButtonProps {
408
453
  /** Whether to apply effects (fades, etc.) - defaults to true */
409
454
  applyEffects?: boolean;
410
455
  /**
411
- * Optional Tone.js effects function for master effects. When provided, export will use Tone.Offline
412
- * to render through the effects chain. The function receives isOffline=true.
456
+ * Optional effects function for master effects. When provided, export renders
457
+ * through the effects chain (WAM entries included). May be async.
413
458
  */
414
- effectsFunction?: EffectsFunction;
459
+ effectsFunction?: OfflineEffectsFunction;
415
460
  /**
416
461
  * Optional function to create offline track effects.
417
- * Takes a trackId and returns a TrackEffectsFunction for offline rendering.
462
+ * Takes a trackId and returns an offline effects function for that track.
418
463
  */
419
- createOfflineTrackEffects?: (trackId: string) => TrackEffectsFunction | undefined;
464
+ createOfflineTrackEffects?: (trackId: string) => OfflineTrackEffectsFunction | undefined;
420
465
  /** CSS class name */
421
466
  className?: string;
422
467
  /** Callback when export completes */
@@ -426,4 +471,33 @@ interface ExportWavButtonProps {
426
471
  }
427
472
  declare const ExportWavButton: React__default.FC<ExportWavButtonProps>;
428
473
 
429
- export { type ActiveEffect, type AudioTrackConfig, type EffectDefinition, type EffectInstance, type EffectParameter, type ExportOptions, type ExportResult, ExportWavButton, type ExportWavButtonProps, type ParameterType, type TrackActiveEffect, type TrackEffectsState, type TrackLoadError, type TrackSource, type UseDynamicEffectsReturn, type UseDynamicTracksReturn, type UseExportWavReturn, type UseOutputMeterOptions, type UseOutputMeterReturn, type UseTrackDynamicEffectsReturn, createEffectChain, createEffectInstance, effectCategories, effectDefinitions, getEffectDefinition, getEffectsByCategory, useAudioTracks, useDynamicEffects, useDynamicTracks, useExportWav, useMasterAnalyser, useOutputMeter, useTrackDynamicEffects };
474
+ interface WamEffectGuiProps {
475
+ /** Live plugin handle from getWamPlugin/getTrackWamPlugin. */
476
+ plugin: WamPluginInstance | undefined;
477
+ className?: string;
478
+ }
479
+ /**
480
+ * Mounts a WAM plugin's own GUI (plugin.createGui), falling back to the
481
+ * generic parameter panel from @dawcore/wam for headless plugins. The GUI is
482
+ * destroyed on unmount — GUI and audio lifecycles are independent, so this
483
+ * never interrupts sound.
484
+ */
485
+ declare const WamEffectGui: React__default.FC<WamEffectGuiProps>;
486
+
487
+ /**
488
+ * Dynamic loader for the optional '@dawcore/wam' peer (the @dawcore/midi
489
+ * loadMidiImpl pattern). Keeps WAM hosting out of the bundle for consumers
490
+ * that never use it; `import type` from '@dawcore/wam' elsewhere is fine
491
+ * (erased at runtime).
492
+ */
493
+ type WamModule = typeof _dawcore_wam;
494
+ declare function loadWamModule(): Promise<WamModule>;
495
+
496
+ interface WamEffectInstance extends EffectInstance {
497
+ kind: 'wam';
498
+ plugin: WamPluginInstance;
499
+ url?: string;
500
+ }
501
+ declare function createWamEffectInstance(plugin: WamPluginInstance): WamEffectInstance;
502
+
503
+ export { type ActiveEffect, type AudioTrackConfig, type EffectDefinition, type EffectInstance, type EffectParameter, type ExportOptions, type ExportResult, ExportWavButton, type ExportWavButtonProps, type OfflineEffectsCleanup, type OfflineEffectsFunction, type OfflineTrackEffectsFunction, type ParameterType, type TrackActiveEffect, type TrackEffectsState, type TrackLoadError, type TrackSource, type UseDynamicEffectsReturn, type UseDynamicTracksReturn, type UseExportWavReturn, type UseOutputMeterOptions, type UseOutputMeterReturn, type UseTrackDynamicEffectsReturn, WamEffectGui, type WamEffectGuiProps, type WamEffectInstance, createEffectChain, createEffectInstance, createWamEffectInstance, effectCategories, effectDefinitions, getEffectDefinition, getEffectsByCategory, loadWamModule, useAudioTracks, useDynamicEffects, useDynamicTracks, useExportWav, useMasterAnalyser, useOutputMeter, useTrackDynamicEffects };
package/dist/tone.d.ts CHANGED
@@ -1,8 +1,10 @@
1
- import { TrackEffectsFunction as TrackEffectsFunction$1, Fade, WaveformDataObject, RenderMode, SpectrogramConfig, ColorMapValue, ClipTrack } from '@waveform-playlist/core';
1
+ import { TrackEffectsFunction, Fade, WaveformDataObject, RenderMode, SpectrogramConfig, ColorMapValue, ClipTrack } from '@waveform-playlist/core';
2
2
  import * as React$1 from 'react';
3
3
  import React__default from 'react';
4
- import { EffectsFunction, TrackEffectsFunction as TrackEffectsFunction$2 } from '@waveform-playlist/playout';
5
- import { Analyser, ToneAudioNode, InputNode } from 'tone';
4
+ import { EffectsFunction, TrackEffectsFunction as TrackEffectsFunction$1 } from '@waveform-playlist/playout';
5
+ import { Analyser, Volume, ToneAudioNode, Gain, InputNode } from 'tone';
6
+ import * as _dawcore_wam from '@dawcore/wam';
7
+ import { WamPluginInstance } from '@dawcore/wam';
6
8
 
7
9
  /**
8
10
  * Configuration for a single audio track to load
@@ -26,7 +28,7 @@ interface AudioTrackConfig {
26
28
  volume?: number;
27
29
  pan?: number;
28
30
  color?: string;
29
- effects?: TrackEffectsFunction$1;
31
+ effects?: TrackEffectsFunction;
30
32
  startTime?: number;
31
33
  duration?: number;
32
34
  offset?: number;
@@ -142,7 +144,7 @@ interface EffectParameter {
142
144
  interface EffectDefinition {
143
145
  id: string;
144
146
  name: string;
145
- category: 'delay' | 'reverb' | 'modulation' | 'distortion' | 'filter' | 'dynamics' | 'spatial';
147
+ category: 'delay' | 'reverb' | 'modulation' | 'distortion' | 'filter' | 'dynamics' | 'spatial' | 'wam';
146
148
  description: string;
147
149
  parameters: EffectParameter[];
148
150
  }
@@ -154,66 +156,6 @@ declare const effectCategories: {
154
156
  name: string;
155
157
  }[];
156
158
 
157
- interface ActiveEffect {
158
- instanceId: string;
159
- effectId: string;
160
- definition: EffectDefinition;
161
- params: Record<string, number | string | boolean>;
162
- bypassed: boolean;
163
- }
164
- interface UseDynamicEffectsReturn {
165
- activeEffects: ActiveEffect[];
166
- availableEffects: EffectDefinition[];
167
- addEffect: (effectId: string) => void;
168
- removeEffect: (instanceId: string) => void;
169
- updateParameter: (instanceId: string, paramName: string, value: number | string | boolean) => void;
170
- toggleBypass: (instanceId: string) => void;
171
- reorderEffects: (fromIndex: number, toIndex: number) => void;
172
- clearAllEffects: () => void;
173
- masterEffects: EffectsFunction;
174
- /**
175
- * Creates a fresh effects function for offline rendering.
176
- * This creates new effect instances that work in the offline AudioContext.
177
- */
178
- createOfflineEffectsFunction: () => EffectsFunction | undefined;
179
- analyserRef: React.RefObject<Analyser | null>;
180
- }
181
- /**
182
- * Hook for managing a dynamic chain of audio effects with real-time parameter updates
183
- */
184
- declare function useDynamicEffects(fftSize?: number): UseDynamicEffectsReturn;
185
-
186
- interface TrackActiveEffect {
187
- instanceId: string;
188
- effectId: string;
189
- definition: EffectDefinition;
190
- params: Record<string, number | string | boolean>;
191
- bypassed: boolean;
192
- }
193
- interface TrackEffectsState {
194
- trackId: string;
195
- activeEffects: TrackActiveEffect[];
196
- }
197
- interface UseTrackDynamicEffectsReturn {
198
- trackEffectsState: Map<string, TrackActiveEffect[]>;
199
- addEffectToTrack: (trackId: string, effectId: string) => void;
200
- removeEffectFromTrack: (trackId: string, instanceId: string) => void;
201
- updateTrackEffectParameter: (trackId: string, instanceId: string, paramName: string, value: number | string | boolean) => void;
202
- toggleBypass: (trackId: string, instanceId: string) => void;
203
- clearTrackEffects: (trackId: string) => void;
204
- getTrackEffectsFunction: (trackId: string) => TrackEffectsFunction$2 | undefined;
205
- /**
206
- * Creates a fresh effects function for a track for offline rendering.
207
- * This creates new effect instances that work in the offline AudioContext.
208
- */
209
- createOfflineTrackEffectsFunction: (trackId: string) => TrackEffectsFunction$2 | undefined;
210
- availableEffects: EffectDefinition[];
211
- }
212
- /**
213
- * Hook for managing dynamic effects per track with real-time parameter updates
214
- */
215
- declare function useTrackDynamicEffects(): UseTrackDynamicEffectsReturn;
216
-
217
159
  /**
218
160
  * WAV file encoder
219
161
  * Converts AudioBuffer to WAV format Blob
@@ -223,8 +165,16 @@ interface WavEncoderOptions {
223
165
  bitDepth?: 16 | 32;
224
166
  }
225
167
 
226
- /** Function type for per-track effects (same as in @waveform-playlist/core) */
227
- type TrackEffectsFunction = (graphEnd: unknown, destination: unknown, isOffline: boolean) => void | (() => void);
168
+ /** Cleanup returned by an offline effects function (disposes offline instances / WAM clones). */
169
+ type OfflineEffectsCleanup = void | (() => void);
170
+ /**
171
+ * Master-chain effects function for offline rendering. May return a Promise —
172
+ * WAM entries are re-instantiated asynchronously on the offline context.
173
+ * Every live EffectsFunction is assignable to this type.
174
+ */
175
+ type OfflineEffectsFunction = (masterVolume: Volume, destination: ToneAudioNode, isOffline: boolean) => OfflineEffectsCleanup | Promise<OfflineEffectsCleanup>;
176
+ /** Per-track variant of OfflineEffectsFunction. */
177
+ type OfflineTrackEffectsFunction = (graphEnd: Gain, masterGainNode: ToneAudioNode, isOffline: boolean) => OfflineEffectsCleanup | Promise<OfflineEffectsCleanup>;
228
178
  interface ExportOptions extends WavEncoderOptions {
229
179
  /** Filename for download (without extension) */
230
180
  filename?: string;
@@ -237,16 +187,17 @@ interface ExportOptions extends WavEncoderOptions {
237
187
  /** Whether to apply effects (fades, etc.) - defaults to true */
238
188
  applyEffects?: boolean;
239
189
  /**
240
- * Optional Tone.js effects function for master effects. When provided, export renders
241
- * through the effects chain. The function receives isOffline=true.
190
+ * Optional effects function for master effects. When provided, export renders
191
+ * through the effects chain (WAM entries included — re-instantiated on the
192
+ * offline context). The function receives isOffline=true and may be async.
242
193
  */
243
- effectsFunction?: EffectsFunction;
194
+ effectsFunction?: OfflineEffectsFunction;
244
195
  /**
245
196
  * Optional function to create offline track effects.
246
- * Takes a trackId and returns a TrackEffectsFunction for offline rendering.
197
+ * Takes a trackId and returns an offline effects function for that track.
247
198
  * This is used instead of track.effects to avoid AudioContext mismatch issues.
248
199
  */
249
- createOfflineTrackEffects?: (trackId: string) => TrackEffectsFunction | undefined;
200
+ createOfflineTrackEffects?: (trackId: string) => OfflineTrackEffectsFunction | undefined;
250
201
  /** Progress callback (0-1) */
251
202
  onProgress?: (progress: number) => void;
252
203
  }
@@ -276,10 +227,104 @@ interface TrackState {
276
227
  }
277
228
  /**
278
229
  * Hook for exporting the waveform playlist to WAV format.
279
- * Uses Tone.Offline for non-real-time rendering, mirroring the live playback graph.
230
+ * Uses a Tone offline render (native OfflineAudioContext in native-context mode),
231
+ * mirroring the live playback graph.
280
232
  */
281
233
  declare function useExportWav(): UseExportWavReturn;
282
234
 
235
+ interface ActiveEffect {
236
+ instanceId: string;
237
+ effectId: string;
238
+ /** 'native' = built-in Tone effect; 'wam' = hosted WAM plugin. */
239
+ kind: 'native' | 'wam';
240
+ /** Module URL for wam entries. */
241
+ url?: string;
242
+ definition: EffectDefinition;
243
+ params: Record<string, number | string | boolean>;
244
+ bypassed: boolean;
245
+ }
246
+ interface UseDynamicEffectsReturn {
247
+ activeEffects: ActiveEffect[];
248
+ availableEffects: EffectDefinition[];
249
+ addEffect: (effectId: string) => void;
250
+ /**
251
+ * Hosts a WAM plugin from a module URL and appends it to the master chain.
252
+ * Requires native-context mode — call configureGlobalContext({ nativeAudioContext: true })
253
+ * from @waveform-playlist/playout before any audio initialization.
254
+ * WAM entries render in offline WAV export (re-instantiated on the offline context).
255
+ * Resolves with the new entry's instanceId.
256
+ */
257
+ addWamEffect: (url: string, initialState?: unknown) => Promise<string>;
258
+ /** Live plugin handle for a hosted WAM entry (for GUI mounting via WamEffectGui). */
259
+ getWamPlugin: (instanceId: string) => WamPluginInstance | undefined;
260
+ removeEffect: (instanceId: string) => void;
261
+ updateParameter: (instanceId: string, paramName: string, value: number | string | boolean) => void;
262
+ toggleBypass: (instanceId: string) => void;
263
+ reorderEffects: (fromIndex: number, toIndex: number) => void;
264
+ clearAllEffects: () => void;
265
+ masterEffects: EffectsFunction;
266
+ /**
267
+ * Creates a fresh effects function for offline rendering. Native effects are
268
+ * re-created on the offline context; WAM entries are re-instantiated from
269
+ * their URL-cached factories with the live instance's state transferred.
270
+ * The returned function may be async and may reject — a WAV export never
271
+ * silently renders without an effect the live chain has.
272
+ */
273
+ createOfflineEffectsFunction: () => OfflineEffectsFunction | undefined;
274
+ analyserRef: React.RefObject<Analyser | null>;
275
+ }
276
+ /**
277
+ * Hook for managing a dynamic chain of audio effects with real-time parameter updates
278
+ */
279
+ declare function useDynamicEffects(fftSize?: number): UseDynamicEffectsReturn;
280
+
281
+ interface TrackActiveEffect {
282
+ instanceId: string;
283
+ effectId: string;
284
+ /** 'native' = built-in Tone effect; 'wam' = hosted WAM plugin. */
285
+ kind: 'native' | 'wam';
286
+ /** Module URL for wam entries. */
287
+ url?: string;
288
+ definition: EffectDefinition;
289
+ params: Record<string, number | string | boolean>;
290
+ bypassed: boolean;
291
+ }
292
+ interface TrackEffectsState {
293
+ trackId: string;
294
+ activeEffects: TrackActiveEffect[];
295
+ }
296
+ interface UseTrackDynamicEffectsReturn {
297
+ trackEffectsState: Map<string, TrackActiveEffect[]>;
298
+ addEffectToTrack: (trackId: string, effectId: string) => void;
299
+ /**
300
+ * Hosts a WAM plugin from a module URL and appends it to a track's effect chain.
301
+ * Requires native-context mode — call configureGlobalContext({ nativeAudioContext: true })
302
+ * from @waveform-playlist/playout before any audio initialization.
303
+ * WAM entries render in offline WAV export (re-instantiated on the offline context).
304
+ * Resolves with the new entry's instanceId.
305
+ */
306
+ addWamEffectToTrack: (trackId: string, url: string, initialState?: unknown) => Promise<string>;
307
+ /** Live plugin handle for a hosted WAM entry on a track (for GUI mounting via WamEffectGui). */
308
+ getTrackWamPlugin: (trackId: string, instanceId: string) => WamPluginInstance | undefined;
309
+ removeEffectFromTrack: (trackId: string, instanceId: string) => void;
310
+ updateTrackEffectParameter: (trackId: string, instanceId: string, paramName: string, value: number | string | boolean) => void;
311
+ toggleBypass: (trackId: string, instanceId: string) => void;
312
+ clearTrackEffects: (trackId: string) => void;
313
+ getTrackEffectsFunction: (trackId: string) => TrackEffectsFunction$1 | undefined;
314
+ /**
315
+ * Creates a fresh effects function for a track for offline rendering.
316
+ * Native effects are re-created on the offline context; WAM entries are
317
+ * re-instantiated with the live instance's state transferred. May reject —
318
+ * a WAV export never silently renders without an effect the live chain has.
319
+ */
320
+ createOfflineTrackEffectsFunction: (trackId: string) => OfflineTrackEffectsFunction | undefined;
321
+ availableEffects: EffectDefinition[];
322
+ }
323
+ /**
324
+ * Hook for managing dynamic effects per track with real-time parameter updates
325
+ */
326
+ declare function useTrackDynamicEffects(): UseTrackDynamicEffectsReturn;
327
+
283
328
  /**
284
329
  * useDynamicTracks — imperative hook for runtime track additions.
285
330
  *
@@ -372,7 +417,7 @@ declare function useOutputMeter(options?: UseOutputMeterOptions): UseOutputMeter
372
417
  */
373
418
 
374
419
  interface EffectInstance {
375
- effect: ToneAudioNode;
420
+ effect: ToneAudioNode | AudioNode;
376
421
  id: string;
377
422
  instanceId: string;
378
423
  dispose: () => void;
@@ -389,8 +434,8 @@ declare function createEffectInstance(definition: EffectDefinition, initialParam
389
434
  * Create a chain of effects connected in series
390
435
  */
391
436
  declare function createEffectChain(effects: EffectInstance[]): {
392
- input: ToneAudioNode;
393
- output: ToneAudioNode;
437
+ input: ToneAudioNode | AudioNode;
438
+ output: ToneAudioNode | AudioNode;
394
439
  dispose: () => void;
395
440
  };
396
441
 
@@ -408,15 +453,15 @@ interface ExportWavButtonProps {
408
453
  /** Whether to apply effects (fades, etc.) - defaults to true */
409
454
  applyEffects?: boolean;
410
455
  /**
411
- * Optional Tone.js effects function for master effects. When provided, export will use Tone.Offline
412
- * to render through the effects chain. The function receives isOffline=true.
456
+ * Optional effects function for master effects. When provided, export renders
457
+ * through the effects chain (WAM entries included). May be async.
413
458
  */
414
- effectsFunction?: EffectsFunction;
459
+ effectsFunction?: OfflineEffectsFunction;
415
460
  /**
416
461
  * Optional function to create offline track effects.
417
- * Takes a trackId and returns a TrackEffectsFunction for offline rendering.
462
+ * Takes a trackId and returns an offline effects function for that track.
418
463
  */
419
- createOfflineTrackEffects?: (trackId: string) => TrackEffectsFunction | undefined;
464
+ createOfflineTrackEffects?: (trackId: string) => OfflineTrackEffectsFunction | undefined;
420
465
  /** CSS class name */
421
466
  className?: string;
422
467
  /** Callback when export completes */
@@ -426,4 +471,33 @@ interface ExportWavButtonProps {
426
471
  }
427
472
  declare const ExportWavButton: React__default.FC<ExportWavButtonProps>;
428
473
 
429
- export { type ActiveEffect, type AudioTrackConfig, type EffectDefinition, type EffectInstance, type EffectParameter, type ExportOptions, type ExportResult, ExportWavButton, type ExportWavButtonProps, type ParameterType, type TrackActiveEffect, type TrackEffectsState, type TrackLoadError, type TrackSource, type UseDynamicEffectsReturn, type UseDynamicTracksReturn, type UseExportWavReturn, type UseOutputMeterOptions, type UseOutputMeterReturn, type UseTrackDynamicEffectsReturn, createEffectChain, createEffectInstance, effectCategories, effectDefinitions, getEffectDefinition, getEffectsByCategory, useAudioTracks, useDynamicEffects, useDynamicTracks, useExportWav, useMasterAnalyser, useOutputMeter, useTrackDynamicEffects };
474
+ interface WamEffectGuiProps {
475
+ /** Live plugin handle from getWamPlugin/getTrackWamPlugin. */
476
+ plugin: WamPluginInstance | undefined;
477
+ className?: string;
478
+ }
479
+ /**
480
+ * Mounts a WAM plugin's own GUI (plugin.createGui), falling back to the
481
+ * generic parameter panel from @dawcore/wam for headless plugins. The GUI is
482
+ * destroyed on unmount — GUI and audio lifecycles are independent, so this
483
+ * never interrupts sound.
484
+ */
485
+ declare const WamEffectGui: React__default.FC<WamEffectGuiProps>;
486
+
487
+ /**
488
+ * Dynamic loader for the optional '@dawcore/wam' peer (the @dawcore/midi
489
+ * loadMidiImpl pattern). Keeps WAM hosting out of the bundle for consumers
490
+ * that never use it; `import type` from '@dawcore/wam' elsewhere is fine
491
+ * (erased at runtime).
492
+ */
493
+ type WamModule = typeof _dawcore_wam;
494
+ declare function loadWamModule(): Promise<WamModule>;
495
+
496
+ interface WamEffectInstance extends EffectInstance {
497
+ kind: 'wam';
498
+ plugin: WamPluginInstance;
499
+ url?: string;
500
+ }
501
+ declare function createWamEffectInstance(plugin: WamPluginInstance): WamEffectInstance;
502
+
503
+ export { type ActiveEffect, type AudioTrackConfig, type EffectDefinition, type EffectInstance, type EffectParameter, type ExportOptions, type ExportResult, ExportWavButton, type ExportWavButtonProps, type OfflineEffectsCleanup, type OfflineEffectsFunction, type OfflineTrackEffectsFunction, type ParameterType, type TrackActiveEffect, type TrackEffectsState, type TrackLoadError, type TrackSource, type UseDynamicEffectsReturn, type UseDynamicTracksReturn, type UseExportWavReturn, type UseOutputMeterOptions, type UseOutputMeterReturn, type UseTrackDynamicEffectsReturn, WamEffectGui, type WamEffectGuiProps, type WamEffectInstance, createEffectChain, createEffectInstance, createWamEffectInstance, effectCategories, effectDefinitions, getEffectDefinition, getEffectsByCategory, loadWamModule, useAudioTracks, useDynamicEffects, useDynamicTracks, useExportWav, useMasterAnalyser, useOutputMeter, useTrackDynamicEffects };