From 34527007db38ac1fd4df351fa82d810ea5e5225c Mon Sep 17 00:00:00 2001 From: Marco Randazzo <marco.randazzo@iit.it> Date: Tue, 20 Jul 2021 18:54:56 +0200 Subject: [PATCH 1/2] fixed module audioFromFileDevice when channels are > 1 --- src/devices/audioFromFileDevice/audioFromFileDevice.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/devices/audioFromFileDevice/audioFromFileDevice.cpp b/src/devices/audioFromFileDevice/audioFromFileDevice.cpp index aad7a5ede34..967b1af573d 100644 --- a/src/devices/audioFromFileDevice/audioFromFileDevice.cpp +++ b/src/devices/audioFromFileDevice/audioFromFileDevice.cpp @@ -141,15 +141,16 @@ void audioFromFileDevice::run() //samples (m_samples_to_be_copied) in the buffer. This operation cannot be interrupted by stopping the device //with m_recording_enabled=false. When the pointer reaches the end of the sound (audioFile), //just restart from the beginning in an endless loop + size_t chan_num = m_audioFile.getChannels(); for (size_t i = 0; i < m_samples_to_be_copied; i++) { if (m_bpnt >= m_fsize_in_samples) { m_bpnt = 0; } - for (size_t c=0; c< m_audioFile.getChannels(); c++) + for (size_t c=0; c< chan_num; c++) { - m_inputBuffer->write((unsigned short)(m_datap.at(m_bpnt+c).get())); + m_inputBuffer->write((unsigned short)(m_datap.at(m_bpnt* chan_num +c).get())); } m_bpnt++; } From 896b8ccaa8891f2b469254436b4bf33e74474948 Mon Sep 17 00:00:00 2001 From: Marco Randazzo <marco.randazzo@iit.it> Date: Mon, 26 Jul 2021 11:44:02 +0200 Subject: [PATCH 2/2] added changelog --- doc/release/yarp_3_5/audioFromFile_fix.md | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 doc/release/yarp_3_5/audioFromFile_fix.md diff --git a/doc/release/yarp_3_5/audioFromFile_fix.md b/doc/release/yarp_3_5/audioFromFile_fix.md new file mode 100644 index 00000000000..99c8f6358fc --- /dev/null +++ b/doc/release/yarp_3_5/audioFromFile_fix.md @@ -0,0 +1,9 @@ +audioFromFile_fix {#yarp_3_5} +----------- + +Important Changes +----------------- + +### Devices + +* `audioFromFileDevice` fixed module when channels are > 1 \ No newline at end of file