From 14be2bd394ed18e3567db0f04f256231a67f2785 Mon Sep 17 00:00:00 2001 From: David Reid Date: Mon, 22 May 2023 18:20:21 +1000 Subject: [PATCH] Fix some long out of date tests. --- .../ma_test_automated_data_converter.c | 22 +++++-------------- tests/test_filtering/ma_test_filtering.c | 2 +- tests/test_filtering/ma_test_filtering_bpf.c | 12 +++++----- .../ma_test_filtering_dithering.c | 6 ++--- .../ma_test_filtering_hishelf.c | 6 ++--- tests/test_filtering/ma_test_filtering_hpf.c | 18 +++++++-------- .../ma_test_filtering_loshelf.c | 6 ++--- tests/test_filtering/ma_test_filtering_lpf.c | 18 +++++++-------- .../test_filtering/ma_test_filtering_notch.c | 6 ++--- tests/test_filtering/ma_test_filtering_peak.c | 6 ++--- 10 files changed, 45 insertions(+), 57 deletions(-) diff --git a/tests/test_automated/ma_test_automated_data_converter.c b/tests/test_automated/ma_test_automated_data_converter.c index 5d661486..26a59f52 100644 --- a/tests/test_automated/ma_test_automated_data_converter.c +++ b/tests/test_automated/ma_test_automated_data_converter.c @@ -7,7 +7,7 @@ ma_result init_data_converter(ma_uint32 rateIn, ma_uint32 rateOut, ma_resample_a config = ma_data_converter_config_init(ma_format_s16, ma_format_s16, 1, 1, rateIn, rateOut); config.resampling.algorithm = algorithm; - result = ma_data_converter_init(&config, pDataConverter); + result = ma_data_converter_init(&config, NULL, pDataConverter); if (result != MA_SUCCESS) { return result; } @@ -52,7 +52,7 @@ ma_result test_data_converter__resampling_expected_output_fixed_interval(ma_data ma_uint64 expectedOutputFrameCount; /* We retrieve the required number of input frames for the specified number of output frames, and then compare with what we actually get when reading. */ - expectedOutputFrameCount = ma_data_converter_get_expected_output_frame_count(pDataConverter, frameCountPerIteration); + ma_data_converter_get_expected_output_frame_count(pDataConverter, frameCountPerIteration, &expectedOutputFrameCount); outputFrameCount = ma_countof(output); inputFrameCount = frameCountPerIteration; @@ -90,7 +90,7 @@ ma_result test_data_converter__resampling_expected_output_by_algorithm_and_rate_ result = test_data_converter__resampling_expected_output_fixed_interval(&converter, frameCountPerIteration); - ma_data_converter_uninit(&converter); + ma_data_converter_uninit(&converter, NULL); if (hasError) { return MA_ERROR; @@ -170,12 +170,6 @@ ma_result test_data_converter__resampling_expected_output() hasError = MA_TRUE; } - printf("Speex\n"); - result = test_data_converter__resampling_expected_output_by_algorithm(ma_resample_algorithm_speex); - if (result != 0) { - hasError = MA_TRUE; - } - if (hasError) { return MA_ERROR; } else { @@ -205,7 +199,7 @@ ma_result test_data_converter__resampling_required_input_fixed_interval(ma_data_ ma_uint64 requiredInputFrameCount; /* We retrieve the required number of input frames for the specified number of output frames, and then compare with what we actually get when reading. */ - requiredInputFrameCount = ma_data_converter_get_required_input_frame_count(pDataConverter, frameCountPerIteration); + ma_data_converter_get_required_input_frame_count(pDataConverter, frameCountPerIteration, &requiredInputFrameCount); outputFrameCount = frameCountPerIteration; inputFrameCount = ma_countof(input); @@ -243,7 +237,7 @@ ma_result test_data_converter__resampling_required_input_by_algorithm_and_rate_f result = test_data_converter__resampling_required_input_fixed_interval(&converter, frameCountPerIteration); - ma_data_converter_uninit(&converter); + ma_data_converter_uninit(&converter, NULL); if (hasError) { return MA_ERROR; @@ -323,12 +317,6 @@ ma_result test_data_converter__resampling_required_input() hasError = MA_TRUE; } - printf("Speex\n"); - result = test_data_converter__resampling_required_input_by_algorithm(ma_resample_algorithm_speex); - if (result != MA_SUCCESS) { - hasError = MA_TRUE; - } - if (hasError) { return MA_ERROR; } else { diff --git a/tests/test_filtering/ma_test_filtering.c b/tests/test_filtering/ma_test_filtering.c index 9b804b97..8f36560f 100644 --- a/tests/test_filtering/ma_test_filtering.c +++ b/tests/test_filtering/ma_test_filtering.c @@ -12,7 +12,7 @@ ma_result filtering_init_decoder_and_encoder(const char* pInputFilePath, const c return result; } - encoderConfig = ma_encoder_config_init(ma_resource_format_wav, pDecoder->outputFormat, pDecoder->outputChannels, pDecoder->outputSampleRate); + encoderConfig = ma_encoder_config_init(ma_encoding_format_wav, pDecoder->outputFormat, pDecoder->outputChannels, pDecoder->outputSampleRate); result = ma_encoder_init_file(pOutputFilePath, &encoderConfig, pEncoder); if (result != MA_SUCCESS) { ma_decoder_uninit(pDecoder); diff --git a/tests/test_filtering/ma_test_filtering_bpf.c b/tests/test_filtering/ma_test_filtering_bpf.c index 77ffc858..50b05927 100644 --- a/tests/test_filtering/ma_test_filtering_bpf.c +++ b/tests/test_filtering/ma_test_filtering_bpf.c @@ -20,7 +20,7 @@ ma_result test_bpf2__by_format(const char* pInputFilePath, const char* pOutputFi } bpfConfig = ma_bpf2_config_init(decoder.outputFormat, decoder.outputChannels, decoder.outputSampleRate, 2000, 0); - result = ma_bpf2_init(&bpfConfig, &bpf); + result = ma_bpf2_init(&bpfConfig, NULL, &bpf); if (result != MA_SUCCESS) { ma_decoder_uninit(&decoder); ma_encoder_uninit(&encoder); @@ -36,13 +36,13 @@ ma_result test_bpf2__by_format(const char* pInputFilePath, const char* pOutputFi ma_uint64 framesJustRead; framesToRead = ma_min(tempCapIn, tempCapOut); - framesJustRead = ma_decoder_read_pcm_frames(&decoder, tempIn, framesToRead); + ma_decoder_read_pcm_frames(&decoder, tempIn, framesToRead, &framesJustRead); /* Filter */ ma_bpf2_process_pcm_frames(&bpf, tempOut, tempIn, framesJustRead); /* Write to the WAV file. */ - ma_encoder_write_pcm_frames(&encoder, tempOut, framesJustRead); + ma_encoder_write_pcm_frames(&encoder, tempOut, framesJustRead, NULL); if (framesJustRead < framesToRead) { break; @@ -81,7 +81,7 @@ ma_result test_bpf4__by_format(const char* pInputFilePath, const char* pOutputFi } bpfConfig = ma_bpf_config_init(decoder.outputFormat, decoder.outputChannels, decoder.outputSampleRate, 2000, 4); - result = ma_bpf_init(&bpfConfig, &bpf); + result = ma_bpf_init(&bpfConfig, NULL, &bpf); if (result != MA_SUCCESS) { ma_decoder_uninit(&decoder); ma_encoder_uninit(&encoder); @@ -97,13 +97,13 @@ ma_result test_bpf4__by_format(const char* pInputFilePath, const char* pOutputFi ma_uint64 framesJustRead; framesToRead = ma_min(tempCapIn, tempCapOut); - framesJustRead = ma_decoder_read_pcm_frames(&decoder, tempIn, framesToRead); + ma_decoder_read_pcm_frames(&decoder, tempIn, framesToRead, &framesJustRead); /* Filter */ ma_bpf_process_pcm_frames(&bpf, tempOut, tempIn, framesJustRead); /* Write to the WAV file. */ - ma_encoder_write_pcm_frames(&encoder, tempOut, framesJustRead); + ma_encoder_write_pcm_frames(&encoder, tempOut, framesJustRead, NULL); if (framesJustRead < framesToRead) { break; diff --git a/tests/test_filtering/ma_test_filtering_dithering.c b/tests/test_filtering/ma_test_filtering_dithering.c index 9fd579e2..a262664f 100644 --- a/tests/test_filtering/ma_test_filtering_dithering.c +++ b/tests/test_filtering/ma_test_filtering_dithering.c @@ -14,7 +14,7 @@ ma_result test_dithering__u8(const char* pInputFilePath) return result; } - encoderConfig = ma_encoder_config_init(ma_resource_format_wav, ma_format_u8, decoder.outputChannels, decoder.outputSampleRate); + encoderConfig = ma_encoder_config_init(ma_encoding_format_wav, ma_format_u8, decoder.outputChannels, decoder.outputSampleRate); result = ma_encoder_init_file(pOutputFilePath, &encoderConfig, &encoder); if (result != MA_SUCCESS) { ma_decoder_uninit(&decoder); @@ -30,13 +30,13 @@ ma_result test_dithering__u8(const char* pInputFilePath) ma_uint64 framesJustRead; framesToRead = ma_min(tempCapIn, tempCapOut); - framesJustRead = ma_decoder_read_pcm_frames(&decoder, tempIn, framesToRead); + ma_decoder_read_pcm_frames(&decoder, tempIn, framesToRead, &framesJustRead); /* Convert, with dithering. */ ma_convert_pcm_frames_format(tempOut, ma_format_u8, tempIn, decoder.outputFormat, framesJustRead, decoder.outputChannels, ma_dither_mode_triangle); /* Write to the WAV file. */ - ma_encoder_write_pcm_frames(&encoder, tempOut, framesJustRead); + ma_encoder_write_pcm_frames(&encoder, tempOut, framesJustRead, NULL); if (framesJustRead < framesToRead) { break; diff --git a/tests/test_filtering/ma_test_filtering_hishelf.c b/tests/test_filtering/ma_test_filtering_hishelf.c index d1d81133..39fd966f 100644 --- a/tests/test_filtering/ma_test_filtering_hishelf.c +++ b/tests/test_filtering/ma_test_filtering_hishelf.c @@ -20,7 +20,7 @@ ma_result test_hishelf2__by_format(const char* pInputFilePath, const char* pOutp } hishelfConfig = ma_hishelf2_config_init(decoder.outputFormat, decoder.outputChannels, decoder.outputSampleRate, 18, 1, 16000); - result = ma_hishelf2_init(&hishelfConfig, &hishelf); + result = ma_hishelf2_init(&hishelfConfig, NULL, &hishelf); if (result != MA_SUCCESS) { ma_decoder_uninit(&decoder); ma_encoder_uninit(&encoder); @@ -36,13 +36,13 @@ ma_result test_hishelf2__by_format(const char* pInputFilePath, const char* pOutp ma_uint64 framesJustRead; framesToRead = ma_min(tempCapIn, tempCapOut); - framesJustRead = ma_decoder_read_pcm_frames(&decoder, tempIn, framesToRead); + ma_decoder_read_pcm_frames(&decoder, tempIn, framesToRead, &framesJustRead); /* Filter */ ma_hishelf2_process_pcm_frames(&hishelf, tempOut, tempIn, framesJustRead); /* Write to the WAV file. */ - ma_encoder_write_pcm_frames(&encoder, tempOut, framesJustRead); + ma_encoder_write_pcm_frames(&encoder, tempOut, framesJustRead, NULL); if (framesJustRead < framesToRead) { break; diff --git a/tests/test_filtering/ma_test_filtering_hpf.c b/tests/test_filtering/ma_test_filtering_hpf.c index 39f5a2bf..addb9e3e 100644 --- a/tests/test_filtering/ma_test_filtering_hpf.c +++ b/tests/test_filtering/ma_test_filtering_hpf.c @@ -20,7 +20,7 @@ ma_result test_hpf1__by_format(const char* pInputFilePath, const char* pOutputFi } hpfConfig = ma_hpf1_config_init(decoder.outputFormat, decoder.outputChannels, decoder.outputSampleRate, 2000); - result = ma_hpf1_init(&hpfConfig, &hpf); + result = ma_hpf1_init(&hpfConfig, NULL, &hpf); if (result != MA_SUCCESS) { ma_decoder_uninit(&decoder); ma_encoder_uninit(&encoder); @@ -36,13 +36,13 @@ ma_result test_hpf1__by_format(const char* pInputFilePath, const char* pOutputFi ma_uint64 framesJustRead; framesToRead = ma_min(tempCapIn, tempCapOut); - framesJustRead = ma_decoder_read_pcm_frames(&decoder, tempIn, framesToRead); + ma_decoder_read_pcm_frames(&decoder, tempIn, framesToRead, &framesJustRead); /* Filter */ ma_hpf1_process_pcm_frames(&hpf, tempOut, tempIn, framesJustRead); /* Write to the WAV file. */ - ma_encoder_write_pcm_frames(&encoder, tempOut, framesJustRead); + ma_encoder_write_pcm_frames(&encoder, tempOut, framesJustRead, NULL); if (framesJustRead < framesToRead) { break; @@ -81,7 +81,7 @@ ma_result test_hpf2__by_format(const char* pInputFilePath, const char* pOutputFi } hpfConfig = ma_hpf2_config_init(decoder.outputFormat, decoder.outputChannels, decoder.outputSampleRate, 2000, 0); - result = ma_hpf2_init(&hpfConfig, &hpf); + result = ma_hpf2_init(&hpfConfig, NULL, &hpf); if (result != MA_SUCCESS) { ma_decoder_uninit(&decoder); ma_encoder_uninit(&encoder); @@ -97,13 +97,13 @@ ma_result test_hpf2__by_format(const char* pInputFilePath, const char* pOutputFi ma_uint64 framesJustRead; framesToRead = ma_min(tempCapIn, tempCapOut); - framesJustRead = ma_decoder_read_pcm_frames(&decoder, tempIn, framesToRead); + ma_decoder_read_pcm_frames(&decoder, tempIn, framesToRead, &framesJustRead); /* Filter */ ma_hpf2_process_pcm_frames(&hpf, tempOut, tempIn, framesJustRead); /* Write to the WAV file. */ - ma_encoder_write_pcm_frames(&encoder, tempOut, framesJustRead); + ma_encoder_write_pcm_frames(&encoder, tempOut, framesJustRead, NULL); if (framesJustRead < framesToRead) { break; @@ -142,7 +142,7 @@ ma_result test_hpf3__by_format(const char* pInputFilePath, const char* pOutputFi } hpfConfig = ma_hpf_config_init(decoder.outputFormat, decoder.outputChannels, decoder.outputSampleRate, 2000, 3); - result = ma_hpf_init(&hpfConfig, &hpf); + result = ma_hpf_init(&hpfConfig, NULL, &hpf); if (result != MA_SUCCESS) { ma_decoder_uninit(&decoder); ma_encoder_uninit(&encoder); @@ -158,13 +158,13 @@ ma_result test_hpf3__by_format(const char* pInputFilePath, const char* pOutputFi ma_uint64 framesJustRead; framesToRead = ma_min(tempCapIn, tempCapOut); - framesJustRead = ma_decoder_read_pcm_frames(&decoder, tempIn, framesToRead); + ma_decoder_read_pcm_frames(&decoder, tempIn, framesToRead, &framesJustRead); /* Filter */ ma_hpf_process_pcm_frames(&hpf, tempOut, tempIn, framesJustRead); /* Write to the WAV file. */ - ma_encoder_write_pcm_frames(&encoder, tempOut, framesJustRead); + ma_encoder_write_pcm_frames(&encoder, tempOut, framesJustRead, NULL); if (framesJustRead < framesToRead) { break; diff --git a/tests/test_filtering/ma_test_filtering_loshelf.c b/tests/test_filtering/ma_test_filtering_loshelf.c index 6d8dd455..37d18d31 100644 --- a/tests/test_filtering/ma_test_filtering_loshelf.c +++ b/tests/test_filtering/ma_test_filtering_loshelf.c @@ -20,7 +20,7 @@ ma_result test_loshelf2__by_format(const char* pInputFilePath, const char* pOutp } loshelfConfig = ma_loshelf2_config_init(decoder.outputFormat, decoder.outputChannels, decoder.outputSampleRate, 6, 1, 200); - result = ma_loshelf2_init(&loshelfConfig, &loshelf); + result = ma_loshelf2_init(&loshelfConfig, NULL, &loshelf); if (result != MA_SUCCESS) { ma_decoder_uninit(&decoder); ma_encoder_uninit(&encoder); @@ -36,13 +36,13 @@ ma_result test_loshelf2__by_format(const char* pInputFilePath, const char* pOutp ma_uint64 framesJustRead; framesToRead = ma_min(tempCapIn, tempCapOut); - framesJustRead = ma_decoder_read_pcm_frames(&decoder, tempIn, framesToRead); + ma_decoder_read_pcm_frames(&decoder, tempIn, framesToRead, &framesJustRead); /* Filter */ ma_loshelf2_process_pcm_frames(&loshelf, tempOut, tempIn, framesJustRead); /* Write to the WAV file. */ - ma_encoder_write_pcm_frames(&encoder, tempOut, framesJustRead); + ma_encoder_write_pcm_frames(&encoder, tempOut, framesJustRead, NULL); if (framesJustRead < framesToRead) { break; diff --git a/tests/test_filtering/ma_test_filtering_lpf.c b/tests/test_filtering/ma_test_filtering_lpf.c index 6fe5c2a4..182e4216 100644 --- a/tests/test_filtering/ma_test_filtering_lpf.c +++ b/tests/test_filtering/ma_test_filtering_lpf.c @@ -20,7 +20,7 @@ ma_result test_lpf1__by_format(const char* pInputFilePath, const char* pOutputFi } lpfConfig = ma_lpf1_config_init(decoder.outputFormat, decoder.outputChannels, decoder.outputSampleRate, 2000); - result = ma_lpf1_init(&lpfConfig, &lpf); + result = ma_lpf1_init(&lpfConfig, NULL, &lpf); if (result != MA_SUCCESS) { ma_decoder_uninit(&decoder); ma_encoder_uninit(&encoder); @@ -36,13 +36,13 @@ ma_result test_lpf1__by_format(const char* pInputFilePath, const char* pOutputFi ma_uint64 framesJustRead; framesToRead = ma_min(tempCapIn, tempCapOut); - framesJustRead = ma_decoder_read_pcm_frames(&decoder, tempIn, framesToRead); + ma_decoder_read_pcm_frames(&decoder, tempIn, framesToRead, &framesJustRead); /* Filter */ ma_lpf1_process_pcm_frames(&lpf, tempOut, tempIn, framesJustRead); /* Write to the WAV file. */ - ma_encoder_write_pcm_frames(&encoder, tempOut, framesJustRead); + ma_encoder_write_pcm_frames(&encoder, tempOut, framesJustRead, NULL); if (framesJustRead < framesToRead) { break; @@ -81,7 +81,7 @@ ma_result test_lpf2__by_format(const char* pInputFilePath, const char* pOutputFi } lpfConfig = ma_lpf2_config_init(decoder.outputFormat, decoder.outputChannels, decoder.outputSampleRate, 2000, 0); - result = ma_lpf2_init(&lpfConfig, &lpf); + result = ma_lpf2_init(&lpfConfig, NULL, &lpf); if (result != MA_SUCCESS) { ma_decoder_uninit(&decoder); ma_encoder_uninit(&encoder); @@ -97,13 +97,13 @@ ma_result test_lpf2__by_format(const char* pInputFilePath, const char* pOutputFi ma_uint64 framesJustRead; framesToRead = ma_min(tempCapIn, tempCapOut); - framesJustRead = ma_decoder_read_pcm_frames(&decoder, tempIn, framesToRead); + ma_decoder_read_pcm_frames(&decoder, tempIn, framesToRead, &framesJustRead); /* Filter */ ma_lpf2_process_pcm_frames(&lpf, tempOut, tempIn, framesJustRead); /* Write to the WAV file. */ - ma_encoder_write_pcm_frames(&encoder, tempOut, framesJustRead); + ma_encoder_write_pcm_frames(&encoder, tempOut, framesJustRead, NULL); if (framesJustRead < framesToRead) { break; @@ -143,7 +143,7 @@ ma_result test_lpf3__by_format(const char* pInputFilePath, const char* pOutputFi } lpfConfig = ma_lpf_config_init(decoder.outputFormat, decoder.outputChannels, decoder.outputSampleRate, 2000, /*poles*/3); - result = ma_lpf_init(&lpfConfig, &lpf); + result = ma_lpf_init(&lpfConfig, NULL, &lpf); if (result != MA_SUCCESS) { ma_decoder_uninit(&decoder); ma_encoder_uninit(&encoder); @@ -159,13 +159,13 @@ ma_result test_lpf3__by_format(const char* pInputFilePath, const char* pOutputFi ma_uint64 framesJustRead; framesToRead = ma_min(tempCapIn, tempCapOut); - framesJustRead = ma_decoder_read_pcm_frames(&decoder, tempIn, framesToRead); + ma_decoder_read_pcm_frames(&decoder, tempIn, framesToRead, &framesJustRead); /* Filter */ ma_lpf_process_pcm_frames(&lpf, tempOut, tempIn, framesJustRead); /* Write to the WAV file. */ - ma_encoder_write_pcm_frames(&encoder, tempOut, framesJustRead); + ma_encoder_write_pcm_frames(&encoder, tempOut, framesJustRead, NULL); if (framesJustRead < framesToRead) { break; diff --git a/tests/test_filtering/ma_test_filtering_notch.c b/tests/test_filtering/ma_test_filtering_notch.c index af80422c..c5963b42 100644 --- a/tests/test_filtering/ma_test_filtering_notch.c +++ b/tests/test_filtering/ma_test_filtering_notch.c @@ -20,7 +20,7 @@ ma_result test_notch2__by_format(const char* pInputFilePath, const char* pOutput } notchConfig = ma_notch2_config_init(decoder.outputFormat, decoder.outputChannels, decoder.outputSampleRate, 1, 60); - result = ma_notch2_init(¬chConfig, ¬ch); + result = ma_notch2_init(¬chConfig, NULL, ¬ch); if (result != MA_SUCCESS) { ma_decoder_uninit(&decoder); ma_encoder_uninit(&encoder); @@ -36,13 +36,13 @@ ma_result test_notch2__by_format(const char* pInputFilePath, const char* pOutput ma_uint64 framesJustRead; framesToRead = ma_min(tempCapIn, tempCapOut); - framesJustRead = ma_decoder_read_pcm_frames(&decoder, tempIn, framesToRead); + ma_decoder_read_pcm_frames(&decoder, tempIn, framesToRead, &framesJustRead); /* Filter */ ma_notch2_process_pcm_frames(¬ch, tempOut, tempIn, framesJustRead); /* Write to the WAV file. */ - ma_encoder_write_pcm_frames(&encoder, tempOut, framesJustRead); + ma_encoder_write_pcm_frames(&encoder, tempOut, framesJustRead, NULL); if (framesJustRead < framesToRead) { break; diff --git a/tests/test_filtering/ma_test_filtering_peak.c b/tests/test_filtering/ma_test_filtering_peak.c index bd50da26..d29f68d5 100644 --- a/tests/test_filtering/ma_test_filtering_peak.c +++ b/tests/test_filtering/ma_test_filtering_peak.c @@ -20,7 +20,7 @@ ma_result test_peak2__by_format(const char* pInputFilePath, const char* pOutputF } peakConfig = ma_peak2_config_init(decoder.outputFormat, decoder.outputChannels, decoder.outputSampleRate, 24, 0, 16000); - result = ma_peak2_init(&peakConfig, &peak); + result = ma_peak2_init(&peakConfig, NULL, &peak); if (result != MA_SUCCESS) { ma_decoder_uninit(&decoder); ma_encoder_uninit(&encoder); @@ -36,13 +36,13 @@ ma_result test_peak2__by_format(const char* pInputFilePath, const char* pOutputF ma_uint64 framesJustRead; framesToRead = ma_min(tempCapIn, tempCapOut); - framesJustRead = ma_decoder_read_pcm_frames(&decoder, tempIn, framesToRead); + ma_decoder_read_pcm_frames(&decoder, tempIn, framesToRead, &framesJustRead); /* Filter */ ma_peak2_process_pcm_frames(&peak, tempOut, tempIn, framesJustRead); /* Write to the WAV file. */ - ma_encoder_write_pcm_frames(&encoder, tempOut, framesJustRead); + ma_encoder_write_pcm_frames(&encoder, tempOut, framesJustRead, NULL); if (framesJustRead < framesToRead) { break;