gearmulator

Emulation of classic VA synths of the late 90s/2000s that are based on Motorola 56300 family DSPs
Log | Files | Refs | Submodules | README | LICENSE

commit 998e884a86903d86a6ec678341c45ecfe04dda19
parent ddce56ac3430fcdcfe9c637805f08910738c6112
Author: dsp56300 <dsp56300@users.noreply.github.com>
Date:   Fri,  2 Aug 2024 17:39:47 +0200

refactor

Diffstat:
Msource/nord/n2x/n2xLib/n2xstate.cpp | 16+++-------------
Msource/nord/n2x/n2xLib/n2xstate.h | 10++++++++++
2 files changed, 13 insertions(+), 13 deletions(-)

diff --git a/source/nord/n2x/n2xLib/n2xstate.cpp b/source/nord/n2x/n2xLib/n2xstate.cpp @@ -317,26 +317,16 @@ namespace n2x } } - bool State::changeSingleParameter(const uint8_t _part, const SingleParam _parameter, uint8_t _value) + bool State::changeSingleParameter(const uint8_t _part, const SingleParam _parameter, const uint8_t _value) { if(_part >= m_singles.size()) return false; - const auto off = getOffsetInSingleDump(_parameter); - const auto current = unpackNibbles(m_singles[_part], off); - if(current == _value) - return false; - packNibbles(m_singles[_part], off, _value); - return true; + return changeDumpParameter(m_singles[_part], getOffsetInSingleDump(_parameter), _value); } bool State::changeMultiParameter(const MultiParam _parameter, const uint8_t _value) { - const auto off = getOffsetInMultiDump(_parameter); - const auto current = unpackNibbles(m_multi, off); - if(current == _value) - return false; - packNibbles(m_multi, off, _value); - return true; + return changeDumpParameter(m_multi, getOffsetInMultiDump(_parameter), _value); } void State::updateMultiFromSingles() diff --git a/source/nord/n2x/n2xLib/n2xstate.h b/source/nord/n2x/n2xLib/n2xstate.h @@ -31,6 +31,16 @@ namespace n2x bool changeSingleParameter(uint8_t _part, SingleParam _parameter, uint8_t _value); bool changeMultiParameter(MultiParam _parameter, uint8_t _value); + template<typename TDump> + bool changeDumpParameter(TDump& _dump, uint32_t _offset, uint8_t _value) + { + const auto current = unpackNibbles(_dump, _offset); + if(current == _value) + return false; + packNibbles(_dump, _offset, _value); + return true; + } + void updateMultiFromSingles(); const auto& getMulti() const { return m_multi; }