Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,8 @@ ReaComp: # This is optional and overrides the FX name reported to users.
--- # Page break. The remaining knobs on this page will be unassigned.
[mix] # This is a section name for the following knobs.
6 # Parameter 6 will be mapped to the first knob on the second page.
10 /8 dry dB # Adjustments will be 8 times smaller than usual for this parameter.
11 *8 # Adjustments will be 8 times larger than usual for this parameter.
```

ReaKontrol can help you create these maps.
Expand Down
21 changes: 18 additions & 3 deletions src/fxMap.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,9 @@
static const std::regex RE_STRIP(R"(^\s+|\s*#.*$|\s+$)");
// The map name, ending with a colon.
static const std::regex RE_MAP_NAME("(.*):");
// A parameter number, optionally followed by space and a name.
static const std::regex RE_PARAM(R"((\d+)(?:\s+(.+))?)");
// A parameter number, optionally followed by space and a scaling factor (/n or
// *n), optionally followed by space and a name.
static const std::regex RE_PARAM(R"((\d+)(?:\s+([/*])(\d+))?(?:\s+(.+))?)");
// A section name in square brackets.
static const std::regex RE_SECTION(R"(\[(.+)\])");

Expand Down Expand Up @@ -101,7 +102,13 @@ FxMap::FxMap(MediaTrack* track, int fx) : _track(track), _fx(fx) {
const int mp = this->_reaperParams.size();
this->_reaperParams.push_back(rp);
this->_mapParams.insert({rp, mp});
const std::string paramName = m.str(2);
const std::string scaleType = m.str(2);
if (!scaleType.empty()) {
const int factor = std::atoi(m.str(3).c_str());
this->_paramMultipliers.insert({mp,
scaleType == "/" ? (1.0 / factor) : factor});
}
const std::string paramName = m.str(4);
if (!paramName.empty()) {
this->_paramNames.insert({mp, paramName});
}
Expand Down Expand Up @@ -170,6 +177,14 @@ std::string FxMap::getParamName(int mapParam) const {
return it->second;
}

double FxMap::getParamMultiplier(int mapParam) const {
auto it = this->_paramMultipliers.find(mapParam);
if (it == this->_paramMultipliers.end()) {
return 1.0;
}
return it->second;
}

std::string FxMap::getSection(int mapParam) const {
auto it = this->_sections.find(mapParam);
if (it == this->_sections.end()) {
Expand Down
2 changes: 2 additions & 0 deletions src/fxMap.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ class FxMap {
int getReaperParam(int mapParam) const;
int getMapParam(int reaperParam) const;
std::string getParamName(int mapParam) const;
double getParamMultiplier(int mapParam) const;
std::string getSection(int mapParam) const;
std::string getSectionsForPage(int mapParam) const;

Expand All @@ -35,6 +36,7 @@ class FxMap {
int _fx = -1;
std::vector<int> _reaperParams;
std::map<int, std::string> _paramNames;
std::map<int, double> _paramMultipliers;
std::map<int, int> _mapParams;
std::map<int, std::string> _sections;
};
2 changes: 1 addition & 1 deletion src/niMidi.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -978,7 +978,7 @@ class NiMidiSurface: public BaseSurface {
val = TrackFX_GetParamNormalized(this->_lastSelectedTrack,
this->_selectedFx, param);
}
val += change;
val += change * this->_fxMap.getParamMultiplier(mp);
val = clamp(val, 0.0, 1.0);
TrackFX_SetParamNormalized(this->_lastSelectedTrack, this->_selectedFx, param,
val);
Expand Down