From 3f0556b9eb66a0893b43e38a3ee889e13d3a6667 Mon Sep 17 00:00:00 2001 From: Aria Minaei Date: Mon, 27 Sep 2021 16:36:06 +0200 Subject: [PATCH] `sequence.attachAudio()` now accepts any `AudioNode` as destination --- theatre/core/src/sequences/TheatreSequence.ts | 10 +++++----- .../playbackControllers/AudioPlaybackController.ts | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/theatre/core/src/sequences/TheatreSequence.ts b/theatre/core/src/sequences/TheatreSequence.ts index a8b2d47..1a4ca1e 100644 --- a/theatre/core/src/sequences/TheatreSequence.ts +++ b/theatre/core/src/sequences/TheatreSequence.ts @@ -16,9 +16,9 @@ interface IAttachAudioArgs { */ audioContext?: AudioContext /** - * An AudioDestinationNode to feed the audio into. One will be created if not provided. + * An AudioNode to feed the audio into. Will use audioContext.destination if not provided. */ - destinationNode?: AudioDestinationNode + destinationNode?: AudioNode } export interface ISequence { @@ -129,7 +129,7 @@ export interface ISequence { attachAudio(args: IAttachAudioArgs): Promise<{ decodedBuffer: AudioBuffer audioContext: AudioContext - destinationNode: AudioDestinationNode + destinationNode: AudioNode }> } @@ -190,7 +190,7 @@ export default class TheatreSequence implements ISequence { async attachAudio(args: IAttachAudioArgs): Promise<{ decodedBuffer: AudioBuffer audioContext: AudioContext - destinationNode: AudioDestinationNode + destinationNode: AudioNode }> { const {audioContext, destinationNode, decodedBuffer} = await resolveAudioBuffer(args) @@ -211,7 +211,7 @@ export default class TheatreSequence implements ISequence { async function resolveAudioBuffer(args: IAttachAudioArgs): Promise<{ decodedBuffer: AudioBuffer audioContext: AudioContext - destinationNode: AudioDestinationNode + destinationNode: AudioNode }> { function getAudioContext(): Promise { if (args.audioContext) return Promise.resolve(args.audioContext) diff --git a/theatre/core/src/sequences/playbackControllers/AudioPlaybackController.ts b/theatre/core/src/sequences/playbackControllers/AudioPlaybackController.ts index e2882dd..3558284 100644 --- a/theatre/core/src/sequences/playbackControllers/AudioPlaybackController.ts +++ b/theatre/core/src/sequences/playbackControllers/AudioPlaybackController.ts @@ -23,7 +23,7 @@ export default class AudioPlaybackController implements IPlaybackController { private readonly _ticker: Ticker, private readonly _decodedBuffer: AudioBuffer, private readonly _audioContext: AudioContext, - private readonly _nodeDestination: AudioDestinationNode, + private readonly _nodeDestination: AudioNode, ) { this.statePointer = this._state.pointer