Browse Source

Improve documentation for Module.

tags/v2.0.0
Andrew Belt 4 years ago
parent
commit
97c03ea464
3 changed files with 24 additions and 3 deletions
  1. +1
    -1
      docs/Makefile
  2. +14
    -1
      include/engine/Module.hpp
  3. +9
    -1
      include/engine/ParamQuantity.hpp

+ 1
- 1
docs/Makefile View File

@@ -8,7 +8,7 @@ run: doxygen
http-server html http-server html


upload: doxygen upload: doxygen
rsync html/ vcvrack.com:vcvrack.com/docs/ -ruz --info=progress2 --delete
rsync html/ vcvrack.com:vcvrack.com/docs-v2/ -ruz --info=progress2 --delete


clean: clean:
rm -rfv html rm -rfv html

+ 14
- 1
include/engine/Module.hpp View File

@@ -97,6 +97,9 @@ struct Module {
/** Configures the number of Params, Outputs, Inputs, and Lights. */ /** Configures the number of Params, Outputs, Inputs, and Lights. */
void config(int numParams, int numInputs, int numOutputs, int numLights = 0); void config(int numParams, int numInputs, int numOutputs, int numLights = 0);


/** Helper for creating a ParamQuantity and setting its properties.
See ParamQuantity for documentation of arguments.
*/
template <class TParamQuantity = ParamQuantity> template <class TParamQuantity = ParamQuantity>
TParamQuantity* configParam(int paramId, float minValue, float maxValue, float defaultValue, std::string name = "", std::string unit = "", float displayBase = 0.f, float displayMultiplier = 1.f, float displayOffset = 0.f) { TParamQuantity* configParam(int paramId, float minValue, float maxValue, float defaultValue, std::string name = "", std::string unit = "", float displayBase = 0.f, float displayMultiplier = 1.f, float displayOffset = 0.f) {
assert(paramId < (int) params.size() && paramId < (int) paramQuantities.size()); assert(paramId < (int) params.size() && paramId < (int) paramQuantities.size());
@@ -121,6 +124,9 @@ struct Module {
return q; return q;
} }


/** Helper for creating a SwitchQuantity and setting its label strings.
See ParamQuantity and SwitchQuantity for documentation of arguments.
*/
template <class TSwitchQuantity = SwitchQuantity> template <class TSwitchQuantity = SwitchQuantity>
TSwitchQuantity* configSwitch(int paramId, float minValue, float maxValue, float defaultValue, std::string name = "", std::vector<std::string> labels = {}) { TSwitchQuantity* configSwitch(int paramId, float minValue, float maxValue, float defaultValue, std::string name = "", std::vector<std::string> labels = {}) {
TSwitchQuantity* sq = configParam<TSwitchQuantity>(paramId, minValue, maxValue, defaultValue, name); TSwitchQuantity* sq = configParam<TSwitchQuantity>(paramId, minValue, maxValue, defaultValue, name);
@@ -128,6 +134,9 @@ struct Module {
return sq; return sq;
} }


/** Helper for creating a PortInfo for an input port and setting its properties.
See PortInfo for documentation of arguments.
*/
template <class TPortInfo = PortInfo> template <class TPortInfo = PortInfo>
TPortInfo* configInput(int portId, std::string name = "") { TPortInfo* configInput(int portId, std::string name = "") {
assert(portId < (int) inputs.size() && portId < (int) inputInfos.size()); assert(portId < (int) inputs.size() && portId < (int) inputInfos.size());
@@ -143,6 +152,9 @@ struct Module {
return p; return p;
} }


/** Helper for creating a PortInfo for an output port and setting its properties.
See PortInfo for documentation of arguments.
*/
template <class TPortInfo = PortInfo> template <class TPortInfo = PortInfo>
TPortInfo* configOutput(int portId, std::string name = "") { TPortInfo* configOutput(int portId, std::string name = "") {
assert(portId < (int) outputs.size() && portId < (int) outputInfos.size()); assert(portId < (int) outputs.size() && portId < (int) outputInfos.size());
@@ -158,7 +170,8 @@ struct Module {
return p; return p;
} }


/** Adds a direct route from an input to an output when the module is bypassed. */
/** Adds a direct route from an input to an output when the module is bypassed.
*/
void configBypass(int inputId, int outputId) { void configBypass(int inputId, int outputId) {
assert(inputId < (int) inputs.size()); assert(inputId < (int) inputs.size());
assert(outputId < (int) outputs.size()); assert(outputId < (int) outputs.size());


+ 9
- 1
include/engine/ParamQuantity.hpp View File

@@ -33,10 +33,18 @@ struct ParamQuantity : Quantity {
Unit symbols should have no space (e.g. "%", "º"). Unit symbols should have no space (e.g. "%", "º").
*/ */
std::string unit; std::string unit;
/** Set to 0 for linear, positive for exponential, negative for logarithmic. */
/** Set to 0 for linear, positive for exponential, negative for logarithmic.
The formula is $displayValue = f(value) * displayMultiplier + displayOffset$ where $f(value)$ is
- $value$ for $displayBase = 0$.
- $log_{-displayBase}(value)$ for $displayBase < 0$.
- $displayBase^value$ for $displayBase > 0$.
*/
float displayBase = 0.f; float displayBase = 0.f;
float displayMultiplier = 1.f; float displayMultiplier = 1.f;
float displayOffset = 0.f; float displayOffset = 0.f;
/** Number of digits of precision to display.
With displayPrecision = 5 for example, numbers will print as 12.345, 0.12345, 1.2345e6, or 1.2345e-6.
*/
int displayPrecision = 5; int displayPrecision = 5;
/** An optional one-sentence description of the parameter. */ /** An optional one-sentence description of the parameter. */
std::string description; std::string description;


Loading…
Cancel
Save