Rename placeholder param-info classes
This commit is contained in:
parent
64c739b4fc
commit
bfb88d6fe1
@ -519,13 +519,13 @@ struct Plugin : public clap_plugin {
|
|||||||
return v;
|
return v;
|
||||||
}
|
}
|
||||||
template<class RP>
|
template<class RP>
|
||||||
PInfoPlaceholder range(const char *key, RP ¶m) {
|
RangeParamIgnore range(const char *key, RP ¶m) {
|
||||||
double v = param;
|
double v = param;
|
||||||
(*this)(key, v);
|
(*this)(key, v);
|
||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
template<class SP>
|
template<class SP>
|
||||||
PInfoPlaceholder stepped(const char *key, SP ¶m) {
|
SteppedParamIgnore stepped(const char *key, SP ¶m) {
|
||||||
int v = param;
|
int v = param;
|
||||||
(*this)(key, v);
|
(*this)(key, v);
|
||||||
return {};
|
return {};
|
||||||
@ -540,14 +540,14 @@ struct Plugin : public clap_plugin {
|
|||||||
return v;
|
return v;
|
||||||
}
|
}
|
||||||
template<class RP>
|
template<class RP>
|
||||||
PInfoPlaceholder range(const char *key, RP ¶m) {
|
RangeParamIgnore range(const char *key, RP ¶m) {
|
||||||
double v = param;
|
double v = param;
|
||||||
(*this)(key, v);
|
(*this)(key, v);
|
||||||
param = v;
|
param = v;
|
||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
template<class SP>
|
template<class SP>
|
||||||
PInfoPlaceholder stepped(const char *key, SP ¶m) {
|
SteppedParamIgnore stepped(const char *key, SP ¶m) {
|
||||||
int v = param;
|
int v = param;
|
||||||
(*this)(key, v);
|
(*this)(key, v);
|
||||||
param = v;
|
param = v;
|
||||||
|
|||||||
@ -95,30 +95,44 @@ namespace stfx {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// When we want to ignore parameter info (covers both range and stepped)
|
// When we want to ignore parameter info (covers both range and stepped)
|
||||||
struct PInfoPlaceholder {
|
struct RangeParamIgnore {
|
||||||
PInfoPlaceholder & info(const char*, const char*) {
|
RangeParamIgnore & info(const char*, const char*) {
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
PInfoPlaceholder & info(std::string, std::string) {
|
RangeParamIgnore & range(double low, double high) {
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
template<typename V1, typename V2>
|
RangeParamIgnore & range(double low, double mid, double high) {
|
||||||
PInfoPlaceholder & range(V1, V2) {
|
|
||||||
return *this;
|
|
||||||
}
|
|
||||||
template<typename V1, typename V2, typename V3>
|
|
||||||
PInfoPlaceholder & range(V1, V2, V3) {
|
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
/* Always takes a suffix. Units registered first are preferred when formatting values
|
||||||
|
Optional arguments (any can be omitted if the order is correct):
|
||||||
|
precision:
|
||||||
|
int: decimalDigits
|
||||||
|
display mapping (e.g. for value in Hz, display in kHz):
|
||||||
|
double displayToValue(double)
|
||||||
|
double valueToDisplay(double)
|
||||||
|
valid range:
|
||||||
|
double low
|
||||||
|
double high
|
||||||
|
*/
|
||||||
template<class ...Args>
|
template<class ...Args>
|
||||||
PInfoPlaceholder & unit(Args...) {
|
RangeParamIgnore & unit(const char *suffix, Args...) {
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
PInfoPlaceholder & exact(double, const char *) {
|
RangeParamIgnore & exact(double, const char *) {
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
struct SteppedParamIgnore {
|
||||||
|
SteppedParamIgnore & info(const char*, const char*) {
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
|
SteppedParamIgnore & range(int low, int high) {
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
template<typename ...Args>
|
template<typename ...Args>
|
||||||
PInfoPlaceholder & label(Args ...) {
|
SteppedParamIgnore & label(Args ...) {
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@ -353,12 +367,12 @@ namespace stfx {
|
|||||||
std::vector<LibraryParam<int> *> stepParams;
|
std::vector<LibraryParam<int> *> stepParams;
|
||||||
|
|
||||||
// Add registered parameters to the list
|
// Add registered parameters to the list
|
||||||
PInfoPlaceholder range(const char *, LibraryParam<double> ¶m, const char *codeExpr=nullptr) {
|
RangeParamIgnore range(const char *, LibraryParam<double> ¶m, const char *codeExpr=nullptr) {
|
||||||
(void)codeExpr;
|
(void)codeExpr;
|
||||||
rangeParams.push_back(¶m);
|
rangeParams.push_back(¶m);
|
||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
PInfoPlaceholder stepped(const char *, LibraryParam<int> ¶m, const char *codeExpr=nullptr) {
|
SteppedParamIgnore stepped(const char *, LibraryParam<int> ¶m, const char *codeExpr=nullptr) {
|
||||||
(void)codeExpr;
|
(void)codeExpr;
|
||||||
stepParams.push_back(¶m);
|
stepParams.push_back(¶m);
|
||||||
return {};
|
return {};
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user