follower_base.cpp (742B)
1 2 #include "follower_base.hpp" 3 4 float FollowerBase::sensitivity(Param& dampParam, Input* dampInput, int c) { 5 float response = clamp(dampParam.getValue(), 0.0f, 1.0f); 6 if (dampInput && dampInput->isConnected()) { 7 response *= clamp(dampInput->getPolyVoltage(c) / 10.f, 0.0f, 1.0f); 8 } 9 response = 1.0f - response; 10 response *= response; 11 response *= response; 12 return response; 13 } 14 15 float FollowerBase::gain(Param& gainParam, Input* gainInput, int c) { 16 float db = clamp(gainParam.getValue(), -1.0f, 1.0f); 17 if (gainInput && gainInput->isConnected()) { 18 db *= clamp(gainInput->getPolyVoltage(c) / 5.0f, -1.0f, 1.0f); 19 } 20 if (db < 0.0f) { 21 db = -db * efGainMinDecibels; 22 } 23 else { 24 db *= std::min(12.0f, efGainMaxDecibels); 25 } 26 return db; 27 }