From 871617ad6c8db1720731e9cc24915b95b9bcb109 Mon Sep 17 00:00:00 2001 From: Andrew Belt Date: Sat, 18 May 2019 18:37:52 -0400 Subject: [PATCH] Fix docstrings. Add createParamCentered to rack0.hpp. --- include/app/Switch.hpp | 6 +++++- include/engine/Light.hpp | 2 +- include/rack0.hpp | 15 +++++++++++++++ 3 files changed, 21 insertions(+), 2 deletions(-) diff --git a/include/app/Switch.hpp b/include/app/Switch.hpp index ff5a94d4..55c7db59 100644 --- a/include/app/Switch.hpp +++ b/include/app/Switch.hpp @@ -7,7 +7,11 @@ namespace rack { namespace app { -/** A ParamWidget that controls */ +/** A ParamWidget that represents an integer. +Increases by 1 each time it is clicked. +When maxValue is reached, the next click resets to minValue. +In momentary mode, the value is instead set to maxValue when the mouse is held and minValue when released. +*/ struct Switch : ParamWidget { /** Return to original position when released */ bool momentary = false; diff --git a/include/engine/Light.hpp b/include/engine/Light.hpp index 2a2ba504..4bc385ad 100644 --- a/include/engine/Light.hpp +++ b/include/engine/Light.hpp @@ -35,7 +35,7 @@ struct Light { } } - /** Use `setSmoothBrightness(brightness, APP->engine->getSampleTime())` instead. */ + /** Use `setSmoothBrightness(brightness, sampleTime * frames)` instead. */ DEPRECATED void setBrightnessSmooth(float brightness, float frames = 1.f) { setSmoothBrightness(brightness, frames / 44100.f); } diff --git a/include/rack0.hpp b/include/rack0.hpp index 64f2c4a1..d90d7caf 100644 --- a/include/rack0.hpp +++ b/include/rack0.hpp @@ -47,6 +47,12 @@ DEPRECATED inline float interpf(const float *p, float x) {return interpolateLine DEPRECATED inline void complexMult(float *cr, float *ci, float ar, float ai, float br, float bi) {complexMult(ar, ai, br, bi, cr, ci);} DEPRECATED inline void cmultf(float *cr, float *ci, float ar, float ai, float br, float bi) {return complexMult(ar, ai, br, bi, cr, ci);} +//////////////////// +// string +//////////////////// + +#define stringf string::f + //////////////////// // random //////////////////// @@ -126,6 +132,15 @@ DEPRECATED TParamWidget *createParam(math::Vec pos, Module *module, int paramId, return o; } +template +DEPRECATED TParamWidget *createParamCentered(math::Vec pos, Module *module, int paramId, float minValue, float maxValue, float defaultValue) { + TParamWidget *o = createParamCentered(pos, module, paramId); + if (module) { + module->configParam(paramId, minValue, maxValue, defaultValue); + } + return o; +} + /** Use createInput() and createOutput() without the `type` variable */ template DEPRECATED TPortWidget *createPort(math::Vec pos, PortWidget::Type type, Module *module, int inputId) {