Skip to content

Commit

Permalink
Start the node
Browse files Browse the repository at this point in the history
  • Loading branch information
fwcd committed Mar 6, 2024
1 parent 0110d97 commit 10c1608
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions src/hostapi/webaudio/pa_webaudio.c
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,11 @@ EM_JS(void, Js_Initialize, (), {
return node;
},

startNode: function(id) {
const node = this.getNode(id);
node.start();
},

connectNodeToDestination: function(id) {
const node = this.getNode(id);
const context = node.context;
Expand Down Expand Up @@ -209,6 +214,10 @@ EM_JS(int, Js_CreateScriptProcessorNode, (int contextId, int bufferSize, int out
return globalThis.__portaudio.createScriptProcessorNode(contextId, bufferSize, outputChannels);
});

EM_JS(void, Js_StartNode, (int id), {
globalThis.__portaudio.startNode(id);
});

EM_JS(void, Js_ConnectNodeToDestination, (int id), {
globalThis.__portaudio.connectNodeToDestination(id);
});
Expand Down Expand Up @@ -763,7 +772,9 @@ static PaError StartStream( PaStream *s )
PaWebAudioStream *stream = (PaWebAudioStream*)s;

PaUtil_ResetBufferProcessor( &stream->bufferProcessor );

Js_ConnectNodeToDestination(stream->nodeId);
Js_StartNode(stream->nodeId);

stream->isActive = 1;

Expand Down

0 comments on commit 10c1608

Please sign in to comment.