From 3acb9502ae109a66c6ab3fef4912dad142a76781 Mon Sep 17 00:00:00 2001 From: Gary Scavone Date: Fri, 22 Apr 2022 16:28:12 -0400 Subject: [PATCH] Added missing Twang::setLoopFilter() and ModalBar::setModulationDepth() functions. --- include/ModalBar.h | 2 +- src/ModalBar.cpp | 9 +++++++++ src/Twang.cpp | 5 +++++ 3 files changed, 15 insertions(+), 1 deletion(-) diff --git a/include/ModalBar.h b/include/ModalBar.h index f70da38..e71b7a7 100644 --- a/include/ModalBar.h +++ b/include/ModalBar.h @@ -53,7 +53,7 @@ public: //! Select a bar preset (currently modulo 9). void setPreset( int preset ); - //! Set the modulation (vibrato) depth. + //! Set the modulation (vibrato) depth (0.0 - 1.0). void setModulationDepth( StkFloat mDepth ); //! Perform the control change specified by \e number and \e value (0.0 - 128.0). diff --git a/src/ModalBar.cpp b/src/ModalBar.cpp index 6274cb2..0f1361f 100644 --- a/src/ModalBar.cpp +++ b/src/ModalBar.cpp @@ -83,6 +83,15 @@ void ModalBar :: setStrikePosition( StkFloat position ) this->setModeGain(2, 0.11 * temp); } +void ModalBar :: setModulationDepth( StkFloat mDepth ) +{ + if ( mDepth < 0.0 || mDepth > 1.0 ) { + oStream_ << "ModalBar::setModulationDepth: parameter is out of range!"; + handleError( StkError::WARNING ); return; + } + vibratoGain_ = mDepth * 0.3; +} + void ModalBar :: setPreset( int preset ) { // Presets: diff --git a/src/Twang.cpp b/src/Twang.cpp index 17f0925..556b111 100644 --- a/src/Twang.cpp +++ b/src/Twang.cpp @@ -90,6 +90,11 @@ void Twang :: setLoopGain( StkFloat loopGain ) loopFilter_.setGain( gain ); } +void Twang :: setLoopFilter( std::vector coefficients ) +{ + loopFilter_.setCoefficients( coefficients, true ); +} + void Twang :: setPluckPosition( StkFloat position ) { if ( position < 0.0 || position > 1.0 ) {