Difuse the onceEnded mechanism
This commit is contained in:
parent
e01621d0cc
commit
46291bf85c
3 changed files with 11 additions and 10 deletions
|
|
@ -1,4 +1,4 @@
|
|||
import { drywet } from './helpers.mjs';
|
||||
import { drywet, onceEnded } from './helpers.mjs';
|
||||
import { getAudioContext } from './audioContext.mjs';
|
||||
|
||||
let noiseCache = {};
|
||||
|
|
@ -65,7 +65,7 @@ export function getNoiseOscillator(type = 'white', t, density = 0.02) {
|
|||
export function getNoiseMix(inputNode, wet, t) {
|
||||
const noiseOscillator = getNoiseOscillator('pink', t);
|
||||
const noiseMix = drywet(inputNode, noiseOscillator.node, wet);
|
||||
noiseOscillator.node.onended = () => noiseMix.onended();
|
||||
onceEnded(noiseOscillator.node, () => noiseMix.onended());
|
||||
return {
|
||||
node: noiseMix.node,
|
||||
stop: (time) => noiseOscillator?.stop(time),
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue