computerscare-vcv-modules

computerscare modules for VCV Rack
Log | Files | Refs

commit dab766af6f2a3f8ce54d0ce27494bce191a30aea
parent a9925352ad075125618cf00c4d127e3ae68699d7
Author: Adam M <aemalone@gmail.com>
Date:   Tue,  6 Aug 2019 00:28:05 -0500

fix the common function problems in other modz

Diffstat:
Msrc/Computerscare.hpp | 12+-----------
Msrc/ComputerscareLaundrySoup.cpp | 11+++++------
Msrc/ComputerscareRolyPouter.cpp | 1+
Msrc/ComputerscareTolyPools.cpp | 1+
Msrc/dtpulse.cpp | 11+++++++++++
Msrc/dtpulse.hpp | 2++
6 files changed, 21 insertions(+), 17 deletions(-)

diff --git a/src/Computerscare.hpp b/src/Computerscare.hpp @@ -45,17 +45,7 @@ static const NVGcolor COLOR_COMPUTERSCARE_YELLOW = nvgRGB(0xE4, 0xC4, 0x21); static const NVGcolor COLOR_COMPUTERSCARE_BLUE = nvgRGB(0x24, 0x44, 0xC1); static const NVGcolor COLOR_COMPUTERSCARE_PINK = nvgRGB(0xAA, 0x18, 0x31); static const NVGcolor COLOR_COMPUTERSCARE_TRANSPARENT = nvgRGBA(0x00, 0x00, 0x00, 0x00); -float mapChannelCountToVoltage(int ch) { - return ( (float) ch ) / 1.6f; -} -int mapVoltageToChannelCount(float vv) { - float v = vv; - - if(v < 0) { - v = v + 10.f; - } - return (int) round(v * 1.6f); -} + namespace rack { namespace app { diff --git a/src/ComputerscareLaundrySoup.cpp b/src/ComputerscareLaundrySoup.cpp @@ -1,13 +1,12 @@ -#include "Computerscare.hpp" -#include "dsp/digital.hpp" -#include "dsp/filter.hpp" -#include "window.hpp" -#include "dtpulse.hpp" - #include <string> #include <sstream> #include <iomanip> +#include "plugin.hpp" +#include "Computerscare.hpp" +#include "dtpulse.hpp" + + struct ComputerscareLaundrySoup; struct LaundryTextField; struct LaundryTF2; diff --git a/src/ComputerscareRolyPouter.cpp b/src/ComputerscareRolyPouter.cpp @@ -1,4 +1,5 @@ #include "Computerscare.hpp" +#include "dtpulse.hpp" struct ComputerscareRolyPouter; diff --git a/src/ComputerscareTolyPools.cpp b/src/ComputerscareTolyPools.cpp @@ -1,4 +1,5 @@ #include "Computerscare.hpp" +#include "dtpulse.hpp" struct ComputerscareTolyPools; diff --git a/src/dtpulse.cpp b/src/dtpulse.cpp @@ -1285,3 +1285,14 @@ void replaceAll(std::string& str, const std::string& from, const std::string& to start_pos += to.length(); // In case 'to' contains 'from', like replacing 'x' with 'yx' } } +float mapChannelCountToVoltage(int ch) { + return ( (float) ch ) / 1.6f; +} +int mapVoltageToChannelCount(float vv) { + float v = vv; + + if(v < 0) { + v = v + 10.f; + } + return (int) round(v * 1.6f); +} diff --git a/src/dtpulse.hpp b/src/dtpulse.hpp @@ -181,3 +181,5 @@ std::vector<int> getIndicesFromTokenStack(std::vector<Token> tokens); std::vector<int> duplicateIntVector(std::vector<int> input); std::string getByteString(float f); void replaceAll(std::string& str, const std::string& from, const std::string& to); +float mapChannelCountToVoltage(int ch); +int mapVoltageToChannelCount(float vv);