diff --git a/src/cpp/ALSA_support.cpp b/src/cpp/ALSA_support.cpp index 1ad6b1ab2f18f0d13dd6497f7033e5680a7df68b..17bb1570cb6638049117cdae9de1a60cb7ba86e9 100644 --- a/src/cpp/ALSA_support.cpp +++ b/src/cpp/ALSA_support.cpp @@ -144,7 +144,6 @@ int DSP::ALSA_object_t::open_alsa_device(snd_pcm_stream_t stream_type) { //! Errors controller int rc; - //! Errors controller int errc; snd_pcm_hw_params_t *params; @@ -161,7 +160,6 @@ int DSP::ALSA_object_t::open_alsa_device(snd_pcm_stream_t stream_type) #ifdef AUDIO_DEBUG_MESSAGES_ON DSP::log << "Opening ALSA device" << endl; - //! \TODO Test mode: Open mode (see SND_PCM_NONBLOCK, SND_PCM_ASYNC) if (stream_type == SND_PCM_STREAM_PLAYBACK) @@ -200,6 +198,11 @@ int DSP::ALSA_object_t::open_alsa_device(snd_pcm_stream_t stream_type) errc = DSP::ALSA_object_t::set_snd_pcm_format(params); + if (errc < 0) + { + return -4; + } + snd_pcm_hw_params_set_channels(alsa_handle, params, no_of_channels_alsa); snd_pcm_hw_params_set_rate_near(alsa_handle, params, &sampling_rate_alsa, &dir); diff --git a/src/include/ALSA_support.h b/src/include/ALSA_support.h index 90d1e97832ddd011d67f6e81349b26e768711847..4984d653d8d007929ce1421be5c92bc8f9de9fe9 100644 --- a/src/include/ALSA_support.h +++ b/src/include/ALSA_support.h @@ -70,21 +70,13 @@ namespace DSP { //! just samples snd_pcm_uframes_t audio_inbuffer_size_in_frames; // M.B. more meaningful variable name - + //! We always use the non-blocking mode in DSPElib bool blocking_mode; //! buffer capacity int size_b; - /***************************************************/ - /****************AUDIO INPUT TEST*******************/ - //DSP::e::SampleType InSampleType; - //static void CALLBACK waveInProc(HWAVEIN hwi, UINT uMsg, uint32_t dwInstance, uint32_t dwParam1, uint32_t dwParam2); - //std::vector<std::vector<int8_t>> input_buffers; - /**********************END**************************/ - /***************************************************/ - /*! Open default PCM device and return 1 on success or negative error code stream_type = SND_PCM_STREAM_PLAYBACK or SND_PCM_STREAM_CAPTURE the rest of the parameters are set in the class