From 48521ea057bb8ad8acd823a0cabdcb6ad4803505 Mon Sep 17 00:00:00 2001 From: Marek Blok <Marek.Blok@pg.edu.pl> Date: Sat, 18 Mar 2023 22:05:20 +0100 Subject: [PATCH] added reset_buffer to WriteBuffer --- CHANGELOG | 2 ++ Doxydoc/run_doxygen_no_cpp.bat | 2 +- src/cpp/DSP_IO.cpp | 8 +++++++- src/include/DSP_IO.h | 4 ++-- src/include/DSP_lib.h | 18 +++++++++--------- 5 files changed, 21 insertions(+), 13 deletions(-) diff --git a/CHANGELOG b/CHANGELOG index ceb2994..ecfda11 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -8,6 +8,8 @@ TODO:: LAST DONE: CHANGES: +- ver. 0.20.015 - <b>2022.03.18</b> Changed: + - DSP::u::InputBuffer: added reset_buffer to WriteBuffer so buffer output will start from newly added data - ver. 0.20.014 - <b>2023.03.014/b> Changed: - DSP::M_Ef and simmilar constants changed to DSP::M_E_f and simmilar; because of conflitcs with defines when _GNU_SOURCE is defined - ver. 0.20.011 - <b>2022.03.01</b> Changed: diff --git a/Doxydoc/run_doxygen_no_cpp.bat b/Doxydoc/run_doxygen_no_cpp.bat index 0da0195..fb2cbeb 100644 --- a/Doxydoc/run_doxygen_no_cpp.bat +++ b/Doxydoc/run_doxygen_no_cpp.bat @@ -1,4 +1,4 @@ rem path = c:\Program Files\gs\gs8.63\bin\;c:\Program Files\Graphviz 2.21\bin\;%path% -path = c:\Program Files\gs\gs9.50\bin\;c:\Program Files (x86)\Graphviz 2.28\bin\;%path% +path = c:\Program Files\gs\gs9.50\bin\;d:\Program Files\Graphviz\bin\;%path% doxygen doxyfile_no_cpp \ No newline at end of file diff --git a/src/cpp/DSP_IO.cpp b/src/cpp/DSP_IO.cpp index 328255b..01e3a0e 100644 --- a/src/cpp/DSP_IO.cpp +++ b/src/cpp/DSP_IO.cpp @@ -4706,12 +4706,18 @@ void DSP::u::InputBuffer::Notify(DSP::Clock_ptr clock) // copies source_size bytes from the source buffer // to block's internal buffer (the rest is set to zero void DSP::u::InputBuffer::WriteBuffer(void *source, - long int source_size, DSP::e::SampleType source_DataType) + const long int &source_size, const bool &reset_buffer, const DSP::e::SampleType &source_DataType) { int InputSampleSize; long int NoOfSourceSamples; int ind; + if (reset_buffer == true) { + BufferIndex = 0; + } + + //! \TODO add option to append writen data at current position or add method AppendBuffer + switch (source_DataType) { case DSP::e::SampleType::ST_float: diff --git a/src/include/DSP_IO.h b/src/include/DSP_IO.h index b084891..d87e1ae 100644 --- a/src/include/DSP_IO.h +++ b/src/include/DSP_IO.h @@ -991,10 +991,10 @@ class DSP::u::InputBuffer : public DSP::Source unsigned int CallbackIdentifier=0); ~InputBuffer(void); - //! copies source_size bytes from the source buffer to block's internal buffer + //! copies source_size bytes from the source buffer to block's internal buffer (resets buffer position if reset_buffer == true) /*! Fixed <b>2005.03.17</b> Error in buffer size checking for multiple channels */ - void WriteBuffer(void *source, long int source_size, DSP::e::SampleType source_DataType=DSP::e::SampleType::ST_float); + void WriteBuffer(void *source, const long int &source_size, const bool &reset_buffer = true, const DSP::e::SampleType &source_DataType=DSP::e::SampleType::ST_float); }; //! Block providing output to the memory buffer diff --git a/src/include/DSP_lib.h b/src/include/DSP_lib.h index fa8114e..3f841eb 100644 --- a/src/include/DSP_lib.h +++ b/src/include/DSP_lib.h @@ -11,7 +11,7 @@ #define DSP_VER_MAJOR 0 #define DSP_VER_MINOR 20 -#define DSP_VER_BUILD 14 // !!! without zeroes before, else this will be treated as octal number +#define DSP_VER_BUILD 15 // !!! without zeroes before, else this will be treated as octal number #define DSP_VER_YEAR 2023 #define DSP_VER DSP_VER_MAJOR.DSP_VER_MINOR.DSP_VER_BUILD @@ -58,19 +58,19 @@ struct DSP::libver * for blocks like DSP::u::PCCC. Those should work like sources and have clock defined. * ConvertConst2Source <== checks whether all inputs are constant, * defines block clock and adds to list of constant input blocks for given clock. - * \todo <b>2008.04.06</b> DSP::u::RawDecimator, DSP::u::SampleRateConverter - zaimplementowaďż˝ w wersji bez + * \todo <b>2008.04.06</b> DSP::u::RawDecimator, DSP::u::SampleRateConverter - zaimplementowa w wersji bez * rejestracji jako ĹşrĂłdĹo (moĹźe nawet zaimplementowaÄ jako zwykĹy blok przetwarzania) * - moĹźe przyĹpieszyÄ przetwarzanie - mniej ĹşrĂłdeĹ do przeszukiwania * \todo <b>2008.04.06</b> DSP::Component::CheckInputsOfComponents(DSP_clock_ptr) - checking * only for components of given clock. Also implement version in DSP_clock like * DSP_clock::ListOfComponents - * \todo <b>2008.04.10</b> Przejrzeďż˝ bloczki wieloszybkosciowe i asynchroniczne. - * -# dla bloczkďż˝w multirate - * -# decymatory w stosunku wymiernym -> przerobiďż˝ na zwykďż˝e processing blocks, - * nie wymagajďż˝ obsďż˝ugi za pomocďż˝ zegara - * -# interpolatory w stosunku wymiernym -> muszďż˝ byďż˝ bloczkami typu mixed. - * Pytanie naleďż˝y korzystaďż˝ z Notifications czy lepiej kontrolďż˝ - * kompletnoďż˝ci prďż˝bek wejďż˝ciowych pozostawiďż˝ InputExecute i OutputExecute. + * \todo <b>2008.04.10</b> Przejrze bloczki wieloszybkosciowe i asynchroniczne. + * -# dla bloczk w multirate + * -# decymatory w stosunku wymiernym -> przerobi na zwyk e processing blocks, + * nie wymagaj obs ugi za pomoc zegara + * -# interpolatory w stosunku wymiernym -> musz by bloczkami typu mixed. + * Pytanie nale y korzysta z Notifications czy lepiej kontrol + * kompletno ci pr bek wej ciowych pozostawi InputExecute i OutputExecute. * \todo <b>2008.04.13</b> When wav file does not exist, something * more then "Unsupported input sampling rate" should be stated * for DSP::u::WaveInput -- GitLab