You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

36 lines
917B

  1. #ifndef TROWASOFT_MODULE_TSMODULEWIDGETBASE_HPP
  2. #define TROWASOFT_MODULE_TSMODULEWIDGETBASE_HPP
  3. #include "rack.hpp"
  4. using namespace rack;
  5. //-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-
  6. // TSSModuleWidgetBase
  7. // Base Module Widget. Remove randomize of parameters.
  8. //-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-
  9. struct TSSModuleWidgetBase : ModuleWidget {
  10. bool randomizeParameters = false;
  11. TSSModuleWidgetBase(Module* tsModule) : ModuleWidget(tsModule) {
  12. return;
  13. }
  14. TSSModuleWidgetBase(Module* tsModule, bool randomizeParams) : TSSModuleWidgetBase(tsModule)
  15. {
  16. randomizeParameters = randomizeParams;
  17. return;
  18. }
  19. void randomize() override
  20. {
  21. if (randomizeParameters)
  22. {
  23. for (ParamWidget *param : params) {
  24. param->randomize();
  25. }
  26. }
  27. if (module) {
  28. module->randomize();
  29. }
  30. return;
  31. }
  32. };
  33. #endif // end if not defined