Skip to content

Commit 5b023db

Browse files
committed
Used global structs instead of passing as a param
1 parent 7cab23a commit 5b023db

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

test/webaudio/audioworklet_emscripten_locks.c

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ bool process(int numInputs, const AudioSampleFrame* inputs, int numOutputs, Audi
112112
case TEST_RUNNING:
113113
case TEST_DONE_MAIN:
114114
if (howManyProc-- > 0) {
115-
runCalcs((Dummy*) data, PROCESS_CALCS);
115+
runCalcs(&testData, PROCESS_CALCS);
116116
} else {
117117
if (whichTest == TEST_DONE_MAIN) {
118118
emscripten_outf("Worklet done after %dms (expect: approx. 2s)", (int) (emscripten_get_now() - startTime));
@@ -135,7 +135,7 @@ bool mainLoop(double time, void* data) {
135135
break;
136136
case TEST_RUNNING:
137137
if (howManyMain-- > 0) {
138-
runCalcs((Dummy*) data, MAINLOOP_CALCS);
138+
runCalcs(&testData, MAINLOOP_CALCS);
139139
} else {
140140
emscripten_outf("Main thread done after %dms (expect: approx. 2s)", (int) (emscripten_get_now() - startTime));
141141
// Done here, so signal to process()
@@ -147,10 +147,10 @@ bool mainLoop(double time, void* data) {
147147
break;
148148
case TEST_DONE:
149149
emscripten_out("Multi-thread results:");
150-
printDummy((Dummy*) data);
151-
assert(((Dummy*) data)->val0 == trueData.val0
152-
&& ((Dummy*) data)->val1 == trueData.val1
153-
&& ((Dummy*) data)->val2 == trueData.val2);
150+
printDummy(&testData);
151+
assert(testData.val0 == trueData.val0
152+
&& testData.val1 == trueData.val1
153+
&& testData.val2 == trueData.val2);
154154
stopping();
155155
return false;
156156
}
@@ -223,9 +223,9 @@ int main() {
223223
// Audio processor callback setup
224224
context = emscripten_create_audio_context(NULL);
225225
assert(context);
226-
emscripten_start_wasm_audio_worklet_thread_async(context, workletStack, AUDIO_STACK_SIZE, initialised, &testData);
226+
emscripten_start_wasm_audio_worklet_thread_async(context, workletStack, AUDIO_STACK_SIZE, initialised, NULL);
227227

228-
emscripten_set_timeout_loop(mainLoop, 10, &testData);
228+
emscripten_set_timeout_loop(mainLoop, 10, NULL);
229229
addButton();
230230
startTest(); // <-- May need a manual click to start
231231

0 commit comments

Comments
 (0)