From 519927d280f75b80223986c615f4383a36255b7c Mon Sep 17 00:00:00 2001 From: Ladislav Zezula Date: Mon, 18 Aug 2025 21:08:37 +0200 Subject: Suppress the default error messages from AlsaLib --- test/StormTest.cpp | 11 +++++++++++ test/TLogHelper.cpp | 6 +----- 2 files changed, 12 insertions(+), 5 deletions(-) (limited to 'test') diff --git a/test/StormTest.cpp b/test/StormTest.cpp index 3cbd854..4e06e1a 100755 --- a/test/StormTest.cpp +++ b/test/StormTest.cpp @@ -355,6 +355,13 @@ const char * GetFileText(PFILE_DATA pFileData) return szFileText; } +#ifdef STORMLIB_LINUX +static void alsa_silent_error_handler(const char * file, int line, const char * function, int err, const char * fmt, ...) +{ + // Suppress ALSA error output, so do nothing +} +#endif + static void PlayWaveSound(PFILE_DATA pFileData) { #ifdef STORMLIB_WINDOWS @@ -367,6 +374,10 @@ static void PlayWaveSound(PFILE_DATA pFileData) snd_pcm_t *pcm_handle; unsigned int bitrate = pHeader->dwSamplesPerSec; + // Suppress ALSA error printing + snd_lib_error_set_handler(alsa_silent_error_handler); + + // Open the default sound device and play the sound if(snd_pcm_open(&pcm_handle, "default", SND_PCM_STREAM_PLAYBACK, 0) >= 0) { snd_pcm_format_t format = (pHeader->wBitsPerSample == 16) ? SND_PCM_FORMAT_S16_LE : SND_PCM_FORMAT_S8; diff --git a/test/TLogHelper.cpp b/test/TLogHelper.cpp index df1492a..dc8804b 100644 --- a/test/TLogHelper.cpp +++ b/test/TLogHelper.cpp @@ -108,11 +108,7 @@ inline DWORD TestInterlockedIncrement(DWORD * PtrValue) inline DWORD Test_GetLastError() { -#if defined(CASCLIB_PLATFORM_WINDOWS) - return GetCascError(); -#else - return GetLastError(); -#endif + return SErrGetLastError(); } #ifdef TEST_PLATFORM_WINDOWS -- cgit v1.2.3