diff options
author | Ladislav Zezula <zezula@volny.cz> | 2025-08-18 21:08:37 +0200 |
---|---|---|
committer | Ladislav Zezula <zezula@volny.cz> | 2025-08-18 21:08:37 +0200 |
commit | 519927d280f75b80223986c615f4383a36255b7c (patch) | |
tree | 2c62f77b32dcf955e88bd49387a2580343c7f225 /test | |
parent | 36d76cddbfa02624617bb112da0b72e919f0cf33 (diff) |
Suppress the default error messages from AlsaLib
Diffstat (limited to 'test')
-rwxr-xr-x | test/StormTest.cpp | 11 | ||||
-rw-r--r-- | test/TLogHelper.cpp | 6 |
2 files changed, 12 insertions, 5 deletions
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
|