From f82be831206404d3cd43e86f6ddb03e9e51a3f57 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Damian=20Kara=C5=9B?= <s176030@student.pg.edu.pl> Date: Mon, 22 Nov 2021 23:00:44 +0100 Subject: [PATCH] ALSA_support: corrected stop playback MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Damian KaraĹ <s176030@student.pg.edu.pl> --- src/cpp/ALSA_support.cpp | 5 +++-- src/include/ALSA_support.h | 4 ++-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/src/cpp/ALSA_support.cpp b/src/cpp/ALSA_support.cpp index b4d55b1..1b3d7e7 100644 --- a/src/cpp/ALSA_support.cpp +++ b/src/cpp/ALSA_support.cpp @@ -859,7 +859,7 @@ bool DSP::ALSA_object_t::stop_playback(void) StopPlayback = true; snd_pcm_sframes_t rc; - snd_pcm_sframes_t buffer_size_in_frames = (snd_pcm_sframes_t) pcm_buffer.size(); // M.B. wrong value + snd_pcm_sframes_t buffer_size_in_frames; // if there are still buffers that haven't been yet sent to sound card then do it now if (IsPlayingNow == false) @@ -873,7 +873,8 @@ bool DSP::ALSA_object_t::stop_playback(void) // send all data from buffers to soundcard to start playback for (unsigned int ind = 0; ind < NextBufferOutInd; ind++) //one spare buffer { - rc = DSP::ALSA_object_t::pcm_writei(pcm_buffer[ind], buffer_size_in_frames); + buffer_size_in_frames = pcm_buffer_size_in_frames[ind]; + rc = DSP::ALSA_object_t::pcm_writei(pcm_buffer[ind], buffer_size_in_frames); } if (rc > 0) IsPlayingNow = true; diff --git a/src/include/ALSA_support.h b/src/include/ALSA_support.h index 683421b..2c5c734 100644 --- a/src/include/ALSA_support.h +++ b/src/include/ALSA_support.h @@ -65,9 +65,9 @@ namespace DSP { //! CPU architecture - endianness bool IsLittleEndian; - //! Is PCM device openned for recording? + //! Is the PCM device opened for recording? bool IsDeviceInputOpen; - //! Is PCM device openned for playback? + //! Is the PCM device opened for playback? bool IsDeviceOutputOpen; //! Has playback already started? -- GitLab