feat(superdough/audiocontext): make AudioContext injection optional
- Modify `setDefaultAudioContext()` to accept an optional `existingAudioCtx` parameter. - If provided, it will use the existing context; otherwise, it creates a new one. - This allows for better integration with external audio systems that manage their own AudioContext.
This commit is contained in:
parent
f4df4f679f
commit
c8b2e1ac9e
1 changed files with 2 additions and 2 deletions
|
|
@ -1,7 +1,7 @@
|
|||
let audioContext;
|
||||
|
||||
export const setDefaultAudioContext = () => {
|
||||
audioContext = new AudioContext();
|
||||
export const setDefaultAudioContext = (existingAudioCtx) => {
|
||||
audioContext = existingAudioCtx ?? new AudioContext();
|
||||
return audioContext;
|
||||
};
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue