fix click
This commit is contained in:
parent
5336569c25
commit
5129fa6677
2 changed files with 10 additions and 8 deletions
|
|
@ -1,6 +1,5 @@
|
|||
import { Pattern } from '@strudel/core';
|
||||
import { connectToDestination, destroyAudioWorkletNode, getAudioContext } from 'superdough';
|
||||
|
||||
import { connectToDestination, destroyAudioWorkletNode, getAudioContext, webAudioTimeout } from 'superdough';
|
||||
Pattern.prototype.supradough = function () {
|
||||
return this.onTrigger((_, hap, __, cps, begin) => {
|
||||
const { value } = hap;
|
||||
|
|
@ -14,10 +13,11 @@ Pattern.prototype.supradough = function () {
|
|||
)[3];
|
||||
|
||||
const duration = hap.duration / cps;
|
||||
const holdend = begin + duration;
|
||||
const end = holdend + release + 0.01;
|
||||
const holdEnd = begin + duration;
|
||||
const end = holdEnd + release + 0.01;
|
||||
value._begin = begin; // these are needed for the gate signal
|
||||
value._end = end;
|
||||
value._holdEnd = holdEnd
|
||||
|
||||
let o = getWorklet(
|
||||
ac,
|
||||
|
|
@ -29,8 +29,7 @@ Pattern.prototype.supradough = function () {
|
|||
);
|
||||
|
||||
o.port.postMessage(value); // send value to worklet
|
||||
let timeoutNode = webAudioTimeout(ac, () => destroyAudioWorkletNode(o), begin, end);
|
||||
timeoutNode.stop(end + 0.125);
|
||||
webAudioTimeout(ac, () => destroyAudioWorkletNode(o), begin, end);
|
||||
connectToDestination(o); // channels?
|
||||
}, 1);
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue