From: Giovanni Mascellani <gmascellani@codeweavers.com> --- dlls/mmdevapi/tests/capture.c | 8 ++-- dlls/mmdevapi/tests/mmdevapi_tests_private.h | 45 ++++++++++++++++++++ dlls/mmdevapi/tests/render.c | 8 ++-- 3 files changed, 51 insertions(+), 10 deletions(-) create mode 100644 dlls/mmdevapi/tests/mmdevapi_tests_private.h diff --git a/dlls/mmdevapi/tests/capture.c b/dlls/mmdevapi/tests/capture.c index a2cdc0a6af8..7683d1ce155 100644 --- a/dlls/mmdevapi/tests/capture.c +++ b/dlls/mmdevapi/tests/capture.c @@ -37,6 +37,8 @@ #include "mmdeviceapi.h" #include "audioclient.h" +#include "mmdevapi_tests_private.h" + static const unsigned int sampling_rates[] = { 8000, 16000, 22050, 44100, 48000, 96000 }; static const unsigned int channel_counts[] = { 1, 2, 8 }; static const unsigned int sample_formats[][2] = { {WAVE_FORMAT_PCM, 8}, {WAVE_FORMAT_PCM, 16}, @@ -714,12 +716,8 @@ static void test_formats(AUDCLNT_SHAREMODE mode, BOOL extensible) KSDATAFORMAT_SUBTYPE_PCM : KSDATAFORMAT_SUBTYPE_IEEE_FLOAT; } - winetest_push_context("%c%s%lux%ux%u", sample_formats[k][0] == WAVE_FORMAT_PCM ? 'P' : 'F', - extensible ? "X" : "", fmt.Format.nSamplesPerSec, fmt.Format.wBitsPerSample, - fmt.Format.nChannels); - + push_format_context(&fmt); test_format(mode, &fmt); - winetest_pop_context(); } } diff --git a/dlls/mmdevapi/tests/mmdevapi_tests_private.h b/dlls/mmdevapi/tests/mmdevapi_tests_private.h new file mode 100644 index 00000000000..5cef994184b --- /dev/null +++ b/dlls/mmdevapi/tests/mmdevapi_tests_private.h @@ -0,0 +1,45 @@ +/* + * Copyright 2025 Giovanni Mascellani for CodeWeavers + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA + */ + +#include "wine/test.h" + +#include "audioclient.h" + +inline static void push_format_context(const WAVEFORMATEXTENSIBLE *fmt) +{ + static const char *format_str[] = + { + [WAVE_FORMAT_PCM] = "P", + [WAVE_FORMAT_IEEE_FLOAT] = "F", + [WAVE_FORMAT_ALAW] = "A", + [WAVE_FORMAT_MULAW] = "MU", + }; + + if (fmt->Format.wFormatTag == WAVE_FORMAT_EXTENSIBLE) + { + winetest_push_context("%sX%u(%u)x%lux%u:%lx", format_str[fmt->SubFormat.Data1], + fmt->Format.wBitsPerSample, fmt->Samples.wValidBitsPerSample, + fmt->Format.nSamplesPerSec, fmt->Format.nChannels, fmt->dwChannelMask); + } + else + { + winetest_push_context("%s%ux%lux%u", format_str[fmt->Format.wFormatTag], + fmt->Format.wBitsPerSample, fmt->Format.nSamplesPerSec, fmt->Format.nChannels); + } + +} diff --git a/dlls/mmdevapi/tests/render.c b/dlls/mmdevapi/tests/render.c index f6f7545e43b..209a3757f11 100644 --- a/dlls/mmdevapi/tests/render.c +++ b/dlls/mmdevapi/tests/render.c @@ -41,6 +41,8 @@ #include "audiopolicy.h" #include "endpointvolume.h" +#include "mmdevapi_tests_private.h" + static const unsigned int sampling_rates[] = { 8000, 16000, 22050, 44100, 48000, 96000 }; static const unsigned int channel_counts[] = { 1, 2, 8 }; static const unsigned int sample_formats[][2] = { {WAVE_FORMAT_PCM, 8}, {WAVE_FORMAT_PCM, 16}, @@ -675,12 +677,8 @@ static void test_formats(AUDCLNT_SHAREMODE mode, BOOL extensible) KSDATAFORMAT_SUBTYPE_PCM : KSDATAFORMAT_SUBTYPE_IEEE_FLOAT; } - winetest_push_context("%c%s%lux%ux%u", sample_formats[k][0] == WAVE_FORMAT_PCM ? 'P' : 'F', - extensible ? "X" : "", fmt.Format.nSamplesPerSec, fmt.Format.wBitsPerSample, - fmt.Format.nChannels); - + push_format_context(&fmt); test_format(mode, &fmt); - winetest_pop_context(); } } -- GitLab https://gitlab.winehq.org/wine/wine/-/merge_requests/10109