Skip to content

Commit 68cdb19

Browse files
committed
Tidy
1 parent 11751cf commit 68cdb19

File tree

2 files changed

+11
-39
lines changed

2 files changed

+11
-39
lines changed

test/webaudio/audioworklet_2x_in_out_stereo.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
#include "audioworklet_test_shared.inc"
1515

1616
// Callback to process and copy the audio tracks
17-
bool process(int numInputs, const AudioSampleFrame* inputs, int numOutputs, AudioSampleFrame* outputs, int numParams, const AudioParamFrame* params, void* data) {
17+
bool process(int numInputs, const AudioSampleFrame* inputs, int numOutputs, AudioSampleFrame* outputs, int __unused numParams, const AudioParamFrame* __unused params, void* __unused data) {
1818
audioProcessedCount++;
1919

2020
// Twin stereo in and out
@@ -33,7 +33,7 @@ bool process(int numInputs, const AudioSampleFrame* inputs, int numOutputs, Audi
3333
}
3434

3535
// Audio processor created, now register the audio callback
36-
void processorCreated(EMSCRIPTEN_WEBAUDIO_T context, bool success, void* data) {
36+
void processorCreated(EMSCRIPTEN_WEBAUDIO_T context, bool success, void* __unused data) {
3737
if (!success) {
3838
printf("Audio worklet node creation failed\n");
3939
return;

test/webaudio/audioworklet_test_shared.inc

Lines changed: 9 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,18 @@
55
// Helper for MEMORY64 to cast a void* to an audio context or type
66
#define VOIDP_2_WA(ptr) ((EMSCRIPTEN_WEBAUDIO_T) (intptr_t) ptr)
77

8+
// Attribute that marks a function, parameter, variable, etc., as unused
9+
// (silencing any -Wunused warnings).
10+
#ifndef __unused
11+
#define __unused __attribute__((unused))
12+
#endif
13+
814
// Count the audio callbacks and return after 375 frames (1 second with the default 128 size)
915
//
1016
// *** Remove this in your own code ***
1117
//
1218
volatile int audioProcessedCount = 0;
13-
bool playedAndMixed(double time, void* data) {
19+
bool playedAndMixed(double __unused time, void* __unused data) {
1420
if (audioProcessedCount >= 375) {
1521
emscripten_force_exit(0);
1622
return false;
@@ -57,7 +63,7 @@ EM_JS(void, toggleTrack, (EMSCRIPTEN_WEBAUDIO_T srcID), {
5763
});
5864

5965
// Registered click even to (1) enable audio playback and (2) toggle playing the tracks
60-
bool onClick(int type, const EmscriptenMouseEvent* e, void* data) {
66+
bool onClick(int __unused type, const EmscriptenMouseEvent* __unused e, void* data) {
6167
EMSCRIPTEN_WEBAUDIO_T ctx = VOIDP_2_WA(data);
6268
if (emscripten_audio_context_state(ctx) != AUDIO_CONTEXT_STATE_RUNNING) {
6369
printf("Resuming playback\n");
@@ -73,7 +79,7 @@ bool onClick(int type, const EmscriptenMouseEvent* e, void* data) {
7379
void processorCreated(EMSCRIPTEN_WEBAUDIO_T context, bool success, void* data);
7480

7581
// Worklet thread inited, now create the audio processor
76-
void initialised(EMSCRIPTEN_WEBAUDIO_T context, bool success, void* data) {
82+
void initialised(EMSCRIPTEN_WEBAUDIO_T context, bool success, void* __unused data) {
7783
if (!success) {
7884
printf("Audio worklet failed to initialise\n");
7985
return;
@@ -86,40 +92,6 @@ void initialised(EMSCRIPTEN_WEBAUDIO_T context, bool success, void* data) {
8692
emscripten_create_wasm_audio_worklet_processor_async(context, &opts, &processorCreated, NULL);
8793
}
8894

89-
// Common entry point for the mixer tests
90-
// stackSize - audio worklet stack size in bytes
91-
// return true if the requested memory could be allocated
92-
bool _main_(int stackSize) {
93-
// Optional empty space before the audio worklet's stack
94-
#if TEST_OFFSET_GB > 0
95-
char* const emptySpace = malloc(1073741824L * TEST_OFFSET_GB);
96-
if (emptySpace) {
97-
printf("Empty space allocated (%dGB)\n", TEST_OFFSET_GB);
98-
} else {
99-
printf("Failed to allocate the required memory offset\n");
100-
return false;
101-
}
102-
#endif
103-
104-
char* const workletStack = memalign(16, stackSize);
105-
if (!workletStack) {
106-
printf("Failed to allocate the required worklet stack\n");
107-
return false;
108-
}
109-
110-
#if TEST_OFFSET_GB > 0
111-
free(emptySpace);
112-
#endif
113-
114-
EMSCRIPTEN_WEBAUDIO_T context = emscripten_create_audio_context(NULL);
115-
emscripten_start_wasm_audio_worklet_thread_async(context, workletStack, stackSize, &initialised, NULL);
116-
#ifndef BROWSER_TEST
117-
// Special case: browser tests need to exit instantly, interactive tests need to wait
118-
emscripten_runtime_keepalive_push();
119-
#endif
120-
return true;
121-
}
122-
12395
// Common entry point for the mixer tests
12496
int main() {
12597
char* const workletStack = memalign(16, AUDIO_STACK_SIZE);

0 commit comments

Comments
 (0)