From 19895a850041b12b5bb2ccf0506ddba42db872b9 Mon Sep 17 00:00:00 2001 From: Marek Blok <marek.blok@pg.edu.pl> Date: Wed, 22 Sep 2021 08:41:53 +0200 Subject: [PATCH] Small log fixes --- .vscode/c_cpp_properties.json | 3 ++- CHANGELOG | 3 ++- src/Makefile.linux | 2 +- src/cpp/ALSA_support.cpp | 23 +++++++++-------------- 4 files changed, 14 insertions(+), 17 deletions(-) diff --git a/.vscode/c_cpp_properties.json b/.vscode/c_cpp_properties.json index acfe4b8..7ec2fc7 100644 --- a/.vscode/c_cpp_properties.json +++ b/.vscode/c_cpp_properties.json @@ -108,7 +108,8 @@ "defines": [ "LINUX", "__DEBUG__=1", - "INCLUDE_DSPE_EXAMPLES" + "INCLUDE_DSPE_EXAMPLES", + "AUDIO_DEBUG_MESSAGES_ON" ], "compilerPath": "/usr/bin/gcc", "cStandard": "c11", diff --git a/CHANGELOG b/CHANGELOG index cadb94a..7d8878a 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,4 +1,5 @@ -TODO:: +TODO: + - test socket support on Linux (test examples as there are have been noticed some problems with bind) ? DSP::Clock_ptr => migrate to std::shared_ptr !!! Add TELEsound and PiAPS_sound projects to GitLab and start addaptation to new library version diff --git a/src/Makefile.linux b/src/Makefile.linux index 2443d6c..695337d 100644 --- a/src/Makefile.linux +++ b/src/Makefile.linux @@ -24,7 +24,7 @@ INCLUDES_RLS := -I./src/include -I./src/include/rls LIBS := -lasound # \TODO is DEVCPP ok or is it unnecessary -DFLAGS = -DLINUX -DDEVCPP -DINCLUDE_DSPE_EXAMPLES +DFLAGS = -DLINUX -DDEVCPP -DINCLUDE_DSPE_EXAMPLES -DAUDIO_DEBUG_MESSAGES_ON CFLAGS_release = $(comflag) -std=c++0x -O3 -Wall -c -fmessage-length=0 -fno-strict-aliasing CFLAGS_debug = $(comflag) -std=c++0x -O0 -g3 -Wall -c -fmessage-length=0 -W -Wshadow -Wconversion -fstrict-aliasing -fmax-errors=5 # -U__STRICT_ANSI__ jest potrzebne do kompilacji debug_new.cpp, je�eli pomin�� ten plik to mo�na r�wnie� wyrzuci� t� opcj� diff --git a/src/cpp/ALSA_support.cpp b/src/cpp/ALSA_support.cpp index 5ec5291..73cf407 100644 --- a/src/cpp/ALSA_support.cpp +++ b/src/cpp/ALSA_support.cpp @@ -174,9 +174,7 @@ int DSP::ALSA_object_t::open_alsa_device(snd_pcm_stream_t stream_type) if (rc < 0) { - #ifdef AUDIO_DEBUG_MESSAGES_ON - DSP::log << "Unable to open pcm device: " << snd_strerror(rc) << endl; - #endif // AUDIO_DEBUG_MESSAGES_ON + DSP::log << "Unable to open pcm device: " << snd_strerror(rc) << endl; return -1; } @@ -210,19 +208,19 @@ int DSP::ALSA_object_t::open_alsa_device(snd_pcm_stream_t stream_type) rc = snd_pcm_hw_params_set_buffer_size(alsa_handle, params, DSP::NoOfAudioOutputBuffers*audio_inbuffer_size_in_frames); - snd_pcm_uframes_t tmp_frames = audio_inbuffer_size_in_frames; + snd_pcm_uframes_t requested_audio_inbuffer_size_in_frames = audio_inbuffer_size_in_frames; - #ifdef AUDIO_DEBUG_MESSAGES_ON + if (rc < 0) { DSP::log << "Buffer size set with error code: " << rc << endl; - #endif // AUDIO_DEBUG_MESSAGES_ON + } /*! Set period size to desired number of frames. */ snd_pcm_hw_params_set_period_size_near(alsa_handle, params, &audio_inbuffer_size_in_frames, &dir); #ifdef AUDIO_DEBUG_MESSAGES_ON - if (audio_inbuffer_size_in_frames != tmp_frames) + if (audio_inbuffer_size_in_frames != requested_audio_inbuffer_size_in_frames) { - DSP::log << "Current frames value should be equal: " << tmp_frames << endl; + DSP::log << "Current frames value should be equal: " << requested_audio_inbuffer_size_in_frames << endl; DSP::log << "Frames is not equal to tmp_frames! Frames: " << audio_inbuffer_size_in_frames << endl; } @@ -235,9 +233,8 @@ int DSP::ALSA_object_t::open_alsa_device(snd_pcm_stream_t stream_type) if (rc < 0) { - #ifdef AUDIO_DEBUG_MESSAGES_ON - DSP::log << "Unable to set hw parameters: " << snd_strerror(rc) << endl; - #endif // AUDIO_DEBUG_MESSAGES_ON + DSP::log << "Unable to set hw parameters: " << snd_strerror(rc) << endl; + DSP::log << "Closing ALSA device" << endl; close_alsa_device(); @@ -419,9 +416,7 @@ int DSP::ALSA_object_t::open_alsa_device(snd_pcm_stream_t stream_type) break; default: - #ifdef AUDIO_DEBUG_MESSAGES_ON - DSP::log << "Unsupported no of bytes in channel" << endl; - #endif // AUDIO_DEBUG_MESSAGES_ON + DSP::log << "Unsupported no of bytes in channel" << endl; return -1; break; -- GitLab