half working samples
This commit is contained in:
parent
ac7ee376e5
commit
0f2aa9569b
4 changed files with 182 additions and 12 deletions
|
|
@ -6,7 +6,19 @@ class DoughProcessor extends AudioWorkletProcessor {
|
|||
constructor() {
|
||||
super();
|
||||
this.dough = new Dough(sampleRate, currentTime);
|
||||
this.port.onmessage = (event) => this.dough.scheduleSpawn(event.data);
|
||||
this.port.onmessage = (event) => {
|
||||
if (event.data.spawn) {
|
||||
this.dough.scheduleSpawn(event.data.spawn);
|
||||
} else if (event.data.sample) {
|
||||
this.dough.loadSample(event.data.sample, event.data.channels);
|
||||
} else if (event.data.samples) {
|
||||
event.data.samples.forEach(([name, channels]) => {
|
||||
this.dough.loadSample(name, channels);
|
||||
});
|
||||
} else {
|
||||
console.log('unrecognized event type', event.data);
|
||||
}
|
||||
};
|
||||
}
|
||||
process(inputs, outputs, params) {
|
||||
if (this.disconnected) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue