Skip to content

Commit cdb54bb

Browse files
committed
style: run clang-format-18
1 parent cf663cf commit cdb54bb

5 files changed

Lines changed: 73 additions & 74 deletions

File tree

src/cubeb.c

Lines changed: 35 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -214,55 +214,55 @@ cubeb_init(cubeb ** context, char const * context_name,
214214
}
215215

216216
int (*default_init[])(cubeb **, char const *) = {
217-
/*
218-
* init_oneshot must be at the top to allow user
219-
* to override all other choices
220-
*/
221-
init_oneshot,
217+
/*
218+
* init_oneshot must be at the top to allow user
219+
* to override all other choices
220+
*/
221+
init_oneshot,
222222
#if defined(USE_PULSE_RUST)
223-
pulse_rust_init,
223+
pulse_rust_init,
224224
#endif
225225
#if defined(USE_PULSE)
226-
pulse_init,
226+
pulse_init,
227227
#endif
228228
#if defined(USE_JACK)
229-
jack_init,
229+
jack_init,
230230
#endif
231231
#if defined(USE_SNDIO)
232-
sndio_init,
232+
sndio_init,
233233
#endif
234234
#if defined(USE_ALSA)
235-
alsa_init,
235+
alsa_init,
236236
#endif
237237
#if defined(USE_OSS)
238-
oss_init,
238+
oss_init,
239239
#endif
240240
#if defined(USE_AUDIOUNIT_RUST)
241-
audiounit_rust_init,
241+
audiounit_rust_init,
242242
#endif
243243
#if defined(USE_AUDIOUNIT)
244-
audiounit_init,
244+
audiounit_init,
245245
#endif
246246
#if defined(USE_WASAPI)
247-
wasapi_init,
247+
wasapi_init,
248248
#endif
249249
#if defined(USE_WINMM)
250-
winmm_init,
250+
winmm_init,
251251
#endif
252252
#if defined(USE_SUN)
253-
sun_init,
253+
sun_init,
254254
#endif
255255
#if defined(USE_AAUDIO)
256-
aaudio_init,
256+
aaudio_init,
257257
#endif
258258
#if defined(USE_OPENSL)
259-
opensl_init,
259+
opensl_init,
260260
#endif
261261
#if defined(USE_AUDIOTRACK)
262-
audiotrack_init,
262+
audiotrack_init,
263263
#endif
264264
#if defined(USE_KAI)
265-
kai_init,
265+
kai_init,
266266
#endif
267267
};
268268
int i;
@@ -303,49 +303,49 @@ cubeb_get_backend_names()
303303
{
304304
static const char * const backend_names[] = {
305305
#if defined(USE_PULSE)
306-
"pulse",
306+
"pulse",
307307
#endif
308308
#if defined(USE_PULSE_RUST)
309-
"pulse-rust",
309+
"pulse-rust",
310310
#endif
311311
#if defined(USE_JACK)
312-
"jack",
312+
"jack",
313313
#endif
314314
#if defined(USE_ALSA)
315-
"alsa",
315+
"alsa",
316316
#endif
317317
#if defined(USE_AUDIOUNIT)
318-
"audiounit",
318+
"audiounit",
319319
#endif
320320
#if defined(USE_AUDIOUNIT_RUST)
321-
"audiounit-rust",
321+
"audiounit-rust",
322322
#endif
323323
#if defined(USE_WASAPI)
324-
"wasapi",
324+
"wasapi",
325325
#endif
326326
#if defined(USE_WINMM)
327-
"winmm",
327+
"winmm",
328328
#endif
329329
#if defined(USE_SNDIO)
330-
"sndio",
330+
"sndio",
331331
#endif
332332
#if defined(USE_SUN)
333-
"sun",
333+
"sun",
334334
#endif
335335
#if defined(USE_OPENSL)
336-
"opensl",
336+
"opensl",
337337
#endif
338338
#if defined(USE_OSS)
339-
"oss",
339+
"oss",
340340
#endif
341341
#if defined(USE_AAUDIO)
342-
"aaudio",
342+
"aaudio",
343343
#endif
344344
#if defined(USE_AUDIOTRACK)
345-
"audiotrack",
345+
"audiotrack",
346346
#endif
347347
#if defined(USE_KAI)
348-
"kai",
348+
"kai",
349349
#endif
350350
};
351351

src/cubeb_mixer.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -591,7 +591,7 @@ struct cubeb_mixer {
591591
// Return false if any of the input or ouput layout were invalid.
592592
bool valid() const { return _context._valid; }
593593

594-
virtual ~cubeb_mixer(){};
594+
virtual ~cubeb_mixer() = default;
595595

596596
MixerContext _context;
597597
};

src/cubeb_resampler_internal.h

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,10 @@ struct cubeb_resampler {
5959
void * output_buffer, long frames_needed) = 0;
6060
virtual long latency() = 0;
6161
virtual long input_latency() { return 0; }
62-
virtual long input_needed_for_output(long output_frames) { return output_frames; }
62+
virtual long input_needed_for_output(long output_frames)
63+
{
64+
return output_frames;
65+
}
6366
virtual cubeb_resampler_stats stats() = 0;
6467
virtual ~cubeb_resampler() {}
6568
};
@@ -98,7 +101,8 @@ class passthrough_resampler : public cubeb_resampler, public processor {
98101
if (channels == 0) {
99102
return 0;
100103
}
101-
long queued = static_cast<long>(samples_to_frames(internal_input_buffer.length()));
104+
long queued =
105+
static_cast<long>(samples_to_frames(internal_input_buffer.length()));
102106
return std::max(0L, output_frames - queued);
103107
}
104108

src/cubeb_wasapi.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1490,8 +1490,7 @@ refill_callback_output(cubeb_stream * stm)
14901490
void
14911491
wasapi_stream_destroy(cubeb_stream * stm);
14921492

1493-
static unsigned int __stdcall
1494-
wasapi_stream_render_loop(LPVOID stream)
1493+
static unsigned int __stdcall wasapi_stream_render_loop(LPVOID stream)
14951494
{
14961495
AutoRegisterThread raii("cubeb rendering thread");
14971496
cubeb_stream * stm = static_cast<cubeb_stream *>(stream);

test/test_resampler.cpp

Lines changed: 30 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -380,12 +380,12 @@ test_resampler_duplex(uint32_t input_channels, uint32_t output_channels,
380380
dump("input.raw", state.input.data(), state.input.length());
381381
dump("output.raw", state.output.data(), state.output.length());
382382

383-
ASSERT_TRUE(array_fuzzy_equal(state.input, expected_resampled_input,
384-
epsilon<T>(static_cast<float>(input_rate) /
385-
target_rate)));
386-
ASSERT_TRUE(array_fuzzy_equal(state.output, expected_resampled_output,
387-
epsilon<T>(static_cast<float>(output_rate) /
388-
target_rate)));
383+
ASSERT_TRUE(array_fuzzy_equal(
384+
state.input, expected_resampled_input,
385+
epsilon<T>(static_cast<float>(input_rate) / target_rate)));
386+
ASSERT_TRUE(array_fuzzy_equal(
387+
state.output, expected_resampled_output,
388+
epsilon<T>(static_cast<float>(output_rate) / target_rate)));
389389

390390
cubeb_resampler_destroy(resampler);
391391
}
@@ -762,7 +762,8 @@ TEST(cubeb, resampler_passthrough_duplex_callback_reordering)
762762

763763
output_seq_idx += BUF_BASE_SIZE;
764764

765-
// prebuffer_frames holds all provided frames, even if some are in the internal buffer.
765+
// prebuffer_frames holds all provided frames, even if some are in the
766+
// internal buffer.
766767
ASSERT_EQ(prebuffer_frames, BUF_BASE_SIZE * 2);
767768
ASSERT_EQ(got, BUF_BASE_SIZE);
768769

@@ -863,7 +864,8 @@ TEST(cubeb, resampler_drift_drop_data)
863864

864865
output_seq_idx += BUF_BASE_SIZE;
865866

866-
// prebuffer_frames holds all provided frames, even if some are in the internal buffer.
867+
// prebuffer_frames holds all provided frames, even if some are in the
868+
// internal buffer.
867869
ASSERT_EQ(prebuffer_frames, BUF_BASE_SIZE * PREBUFFER_FACTOR);
868870
ASSERT_EQ(got, BUF_BASE_SIZE);
869871

@@ -1098,8 +1100,7 @@ struct input_queue_state {
10981100
};
10991101

11001102
static long
1101-
input_queue_cb(cubeb_stream *, void * ptr, const void * in, void * out,
1102-
long n)
1103+
input_queue_cb(cubeb_stream *, void * ptr, const void * in, void * out, long n)
11031104
{
11041105
if (in) {
11051106
static_cast<input_queue_state *>(ptr)->frames_seen += n;
@@ -1120,10 +1121,9 @@ TEST(cubeb, resampler_speex_input_queue)
11201121
in_p.prefs = out_p.prefs = CUBEB_STREAM_PREF_NONE;
11211122

11221123
input_queue_state state;
1123-
cubeb_resampler * r =
1124-
cubeb_resampler_create(nullptr, &in_p, &out_p, 44100, input_queue_cb,
1125-
&state, CUBEB_RESAMPLER_QUALITY_VOIP,
1126-
CUBEB_RESAMPLER_RECLOCK_NONE);
1124+
cubeb_resampler * r = cubeb_resampler_create(
1125+
nullptr, &in_p, &out_p, 44100, input_queue_cb, &state,
1126+
CUBEB_RESAMPLER_QUALITY_VOIP, CUBEB_RESAMPLER_RECLOCK_NONE);
11271127
ASSERT_NE(r, nullptr);
11281128

11291129
const long out_chunk = 480;
@@ -1139,8 +1139,8 @@ TEST(cubeb, resampler_speex_input_queue)
11391139
}
11401140
state.frames_provided += frames_to_provide;
11411141
long in_count = frames_to_provide;
1142-
long got =
1143-
cubeb_resampler_fill(r, in_buf.data(), &in_count, out_buf.data(), out_chunk);
1142+
long got = cubeb_resampler_fill(r, in_buf.data(), &in_count, out_buf.data(),
1143+
out_chunk);
11441144
ASSERT_EQ(got, out_chunk);
11451145
ASSERT_EQ(in_count, frames_to_provide);
11461146

@@ -1150,8 +1150,7 @@ TEST(cubeb, resampler_speex_input_queue)
11501150

11511151
EXPECT_LE(state.frames_seen, state.frames_provided);
11521152
EXPECT_GE(state.frames_seen,
1153-
state.frames_provided -
1154-
(long)min_buffered_audio_frame(in_p.rate));
1153+
state.frames_provided - (long)min_buffered_audio_frame(in_p.rate));
11551154

11561155
cubeb_resampler_destroy(r);
11571156
}
@@ -1416,10 +1415,10 @@ const int rates[] = {16000, 32000, 44100, 48000, 96000, 192000, 384000};
14161415
constexpr int WASAPI_MS_BLOCK = 10;
14171416
const int block_sizes[] = {WASAPI_MS_BLOCK, 96, 128, 192, 256, 512, 1024, 2048};
14181417
#ifdef THOROUGH_TESTING
1419-
const int input_duplex_rates[] = {16000, 32000, 44100, 48000,
1418+
const int input_duplex_rates[] = {16000, 32000, 44100, 48000,
14201419
96000, 192000, 384000};
1421-
const int input_duplex_block_sizes[] = {WASAPI_MS_BLOCK, 96, 128, 192,
1422-
256, 512, 1024, 2048};
1420+
const int input_duplex_block_sizes[] = {
1421+
WASAPI_MS_BLOCK, 96, 128, 192, 256, 512, 1024, 2048};
14231422
#else
14241423
const int input_duplex_rates[] = {16000, 44100, 48000, 96000, 384000};
14251424
const int input_duplex_block_sizes[] = {WASAPI_MS_BLOCK, 96, 128, 192, 512};
@@ -1604,7 +1603,8 @@ data_cb_ignore_input(cubeb_stream *, void * user_ptr, const void *,
16041603
}
16051604

16061605
static void
1607-
run_test_duplex(int input_rate, int output_rate, int target_rate, int block_size)
1606+
run_test_duplex(int input_rate, int output_rate, int target_rate,
1607+
int block_size)
16081608
{
16091609
int effective_block_size = block_size;
16101610
if (effective_block_size == WASAPI_MS_BLOCK) {
@@ -1623,11 +1623,9 @@ run_test_duplex(int input_rate, int output_rate, int target_rate, int block_size
16231623
out_params.rate = output_rate;
16241624
out_params.format = CUBEB_SAMPLE_FLOAT32NE;
16251625

1626-
cubeb_resampler * resampler =
1627-
cubeb_resampler_create(nullptr, &in_params, &out_params, target_rate,
1628-
data_cb_ignore_input, &state,
1629-
CUBEB_RESAMPLER_QUALITY_DEFAULT,
1630-
CUBEB_RESAMPLER_RECLOCK_NONE);
1626+
cubeb_resampler * resampler = cubeb_resampler_create(
1627+
nullptr, &in_params, &out_params, target_rate, data_cb_ignore_input,
1628+
&state, CUBEB_RESAMPLER_QUALITY_DEFAULT, CUBEB_RESAMPLER_RECLOCK_NONE);
16311629
ASSERT_NE(resampler, nullptr);
16321630

16331631
std::vector<float> in_data;
@@ -1643,8 +1641,8 @@ run_test_duplex(int input_rate, int output_rate, int target_rate, int block_size
16431641
effective_block_size);
16441642

16451643
for (int i = 0; i < ITERATION_COUNT; i++) {
1646-
long frames_needed =
1647-
cubeb_resampler_input_needed_for_output(resampler, effective_block_size);
1644+
long frames_needed = cubeb_resampler_input_needed_for_output(
1645+
resampler, effective_block_size);
16481646
ASSERT_GE(frames_needed, 0);
16491647
if ((long)in_data.size() < frames_needed) {
16501648
in_data.resize(frames_needed);
@@ -1684,11 +1682,9 @@ run_test_input(int input_rate, int target_rate, int block_size)
16841682
in_params.rate = input_rate;
16851683
in_params.format = CUBEB_SAMPLE_FLOAT32NE;
16861684

1687-
cubeb_resampler * resampler =
1688-
cubeb_resampler_create(nullptr, &in_params, nullptr, target_rate,
1689-
data_cb_input_only, nullptr,
1690-
CUBEB_RESAMPLER_QUALITY_DEFAULT,
1691-
CUBEB_RESAMPLER_RECLOCK_NONE);
1685+
cubeb_resampler * resampler = cubeb_resampler_create(
1686+
nullptr, &in_params, nullptr, target_rate, data_cb_input_only, nullptr,
1687+
CUBEB_RESAMPLER_QUALITY_DEFAULT, CUBEB_RESAMPLER_RECLOCK_NONE);
16921688
ASSERT_NE(resampler, nullptr);
16931689

16941690
std::vector<float> in_data(effective_block_size);

0 commit comments

Comments
 (0)