Skip to content

Commit d218d23

Browse files
committed
Added ability to insert extra code in tests
Added ahead of WebAudioParamDescriptor test
1 parent 568a86f commit d218d23

File tree

5 files changed

+28
-1
lines changed

5 files changed

+28
-1
lines changed

test/webaudio/audioworklet_2x_in_hard_pan.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,3 +68,8 @@ void processorCreated(EMSCRIPTEN_WEBAUDIO_T context, bool success, void* data) {
6868
// Register the counter that exits the test after one second of mixing
6969
emscripten_set_timeout_loop(&playedAndMixed, 16, NULL);
7070
}
71+
72+
// This implementation has no custom start-up requirements
73+
EmscriptenStartWebAudioWorkletCallback getStartCallback() {
74+
return &initialised;
75+
}

test/webaudio/audioworklet_2x_in_out_stereo.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,3 +70,8 @@ void processorCreated(EMSCRIPTEN_WEBAUDIO_T context, bool success, void* __unuse
7070
// Register the counter that exits the test after one second of mixing
7171
emscripten_set_timeout_loop(&playedAndMixed, 16, NULL);
7272
}
73+
74+
// This implementation has no custom start-up requirements
75+
EmscriptenStartWebAudioWorkletCallback getStartCallback() {
76+
return &initialised;
77+
}

test/webaudio/audioworklet_in_out_mono.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,3 +80,9 @@ void processorCreated(EMSCRIPTEN_WEBAUDIO_T context, bool success, void* data) {
8080
// Register the counter that exits the test after one second of mixing
8181
emscripten_set_timeout_loop(&playedAndMixed, 16, NULL);
8282
}
83+
84+
// This implementation has no custom start-up requirements
85+
EmscriptenStartWebAudioWorkletCallback getStartCallback() {
86+
return &initialised;
87+
}
88+

test/webaudio/audioworklet_in_out_stereo.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,3 +80,8 @@ void processorCreated(EMSCRIPTEN_WEBAUDIO_T context, bool success, void* data) {
8080
// Register the counter that exits the test after one second of mixing
8181
emscripten_set_timeout_loop(&playedAndMixed, 16, NULL);
8282
}
83+
84+
// This implementation has no custom start-up requirements
85+
EmscriptenStartWebAudioWorkletCallback getStartCallback() {
86+
return &initialised;
87+
}

test/webaudio/audioworklet_test_shared.inc

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,16 +92,22 @@ void initialised(EMSCRIPTEN_WEBAUDIO_T context, bool success, void* __unused dat
9292
emscripten_create_wasm_audio_worklet_processor_async(context, &opts, &processorCreated, NULL);
9393
}
9494

95+
// To be implemented by the test code, allowing initialised() to be changed.
96+
EmscriptenStartWebAudioWorkletCallback getStartCallback();
97+
9598
// Common entry point for the mixer tests
9699
int main() {
97100
char* const workletStack = memalign(16, AUDIO_STACK_SIZE);
98101
printf("Audio worklet stack at 0x%p\n", workletStack);
99102
assert(workletStack);
103+
100104
EMSCRIPTEN_WEBAUDIO_T context = emscripten_create_audio_context(NULL);
101-
emscripten_start_wasm_audio_worklet_thread_async(context, workletStack, AUDIO_STACK_SIZE, &initialised, NULL);
105+
emscripten_start_wasm_audio_worklet_thread_async(context, workletStack, AUDIO_STACK_SIZE, getStartCallback(), NULL);
106+
102107
#ifndef BROWSER_TEST
103108
// Special case: browser tests need to exit instantly, interactive tests need to wait
104109
emscripten_runtime_keepalive_push();
105110
#endif
111+
106112
return EXIT_SUCCESS;
107113
}

0 commit comments

Comments
 (0)