diff --git a/src/cpp/DSP_IO.cpp b/src/cpp/DSP_IO.cpp index 99fbbee523a308a831774fdc9508561db1da7764..f59f4583e4645b19dc95c07bbcbec42728873245 100644 --- a/src/cpp/DSP_IO.cpp +++ b/src/cpp/DSP_IO.cpp @@ -4475,12 +4475,15 @@ bool DSP::u::AudioInput::OutputExecute(OUTPUT_EXECUTE_ARGS) // If there are free buffers check whether the sound card has any audio data already available if (DSP_THIS->snd_object.get_input_callback_object() == NULL) { // callbacks are not used thus audio data has to be obtained directly from snd_object - if (DSP_THIS->GetNoOfFreeBuffers() > 0) { + while (DSP_THIS->GetNoOfFreeBuffers() > 0) { DSP::e::SampleType InSampleType; std::vector<char> wave_in_raw_buffer; if (DSP_THIS->snd_object.get_wave_in_raw_buffer(InSampleType, wave_in_raw_buffer)) { DSP_THIS->SOUND_object_callback(InSampleType, wave_in_raw_buffer); } + else { + break; + } } } diff --git a/src/cpp/WMM_support.cpp b/src/cpp/WMM_support.cpp index 5fadc6647b320c3525d187d4103e092174138a73..44042e5b953d4ee6a1b301d757602056286ecbd1 100644 --- a/src/cpp/WMM_support.cpp +++ b/src/cpp/WMM_support.cpp @@ -139,7 +139,7 @@ unsigned int DSP::WMM_object_t::select_input_device_by_number(const unsigned int bool DSP::WMM_object_t::stop_playback(void) { StopPlayback = true; - + // if there are still buffers that haven't been yet sent to sound card then do it now if (IsPlayingNow == false) { @@ -269,7 +269,7 @@ long DSP::WMM_object_t::open_PCM_device_4_input(const int &no_of_channels, int n IsRecordingNow = false; NextBufferInInd = 0; - return 1; //! \TODO check this also for output + return sampling_rate; } // error creating audio object @@ -353,6 +353,8 @@ long DSP::WMM_object_t::open_PCM_device_4_output(const int &no_of_channels, int DSP::f::AudioCheckError(result); waveHeaderOut[ind].dwFlags= WHDR_DONE; // WHDR_BEGINLOOP | WHDR_ENDLOOP; } + + return sampling_rate; } else { //error while creating audio output @@ -361,7 +363,7 @@ long DSP::WMM_object_t::open_PCM_device_4_output(const int &no_of_channels, int WaveOutBufferLen = 0; } - return sampling_rate; + return -1; } bool DSP::WMM_object_t::close_PCM_device_input(void) { @@ -614,7 +616,7 @@ long DSP::WMM_object_t::append_playback_buffer(DSP::Float_vector &float_buffer) if (IsPlayingNow == false) { if (NextBufferOutInd == DSP::NoOfAudioOutputBuffers - 2) //all but one spare buffer are filled up - { + { // send all data from buffers to soundcard to start playback for (ind=0; ind < DSP::NoOfAudioOutputBuffers-1; ind++) //one spare buffer { // send all data from buffers to soundcard to start playback result=waveOutWrite(hWaveOut, diff --git a/src/include/DSP_lib.h b/src/include/DSP_lib.h index 53fc9bbc42038a5da1a66e0796d0bc5a6ddc3887..48ec8cfc45844691ef0cb4705529a0e75d43c3e7 100644 --- a/src/include/DSP_lib.h +++ b/src/include/DSP_lib.h @@ -857,7 +857,6 @@ string DSP::lib_version_string(); * -# DSP::f::BER4BPSK() * -# DSP::f::SER4QPSK() * -# DSP::f::PSK_SNR_estimator() - * -# DSP::f::PSK_SNR_estimator2() * . * */ diff --git a/src/include/DSP_types.h b/src/include/DSP_types.h index 29519d398863f95eb32a30d5b9df88cd5a15ba2b..5f2cb5e2ef4b7fb2ae75a27d02fc0fae46b964bd 100644 --- a/src/include/DSP_types.h +++ b/src/include/DSP_types.h @@ -642,7 +642,7 @@ namespace DSP { * * The callback function will be called by the SOUND_object when new sound card's output buffer can processed. * The callback function has to return true when it filled the buffer with samples or false when there is not enought data. - * On false the SOUND_object most probably will discard the buffer. Nevertheless it can try to call the callback again. + * On false the SOUND_object most probably will discard the buffer. Nevertheless it can try (actually it should) to call the callback again. * \TODO revise the concept when the there will be a SOUND_object_t derivative that uses this approach. * \note Needs addaptation of DSP::u::AudioOutput class. */