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.

72 lines
1.7KB

  1. #include "rcm.h"
  2. #include "GVerbWidget.hpp"
  3. #include <algorithm>
  4. namespace rack_plugin_rcm {
  5. struct LoadCounterModule : Module {
  6. enum ParamIds {
  7. NUM_PARAMS
  8. };
  9. enum InputIds {
  10. NUM_INPUTS
  11. };
  12. enum OutputIds {
  13. NUM_OUTPUTS
  14. };
  15. enum LightIds {
  16. NUM_LIGHTS
  17. };
  18. LoadCounterModule() : Module(NUM_PARAMS, NUM_INPUTS, NUM_OUTPUTS, NUM_LIGHTS) {
  19. }
  20. void step() override;
  21. int counter = 0;
  22. // For more advanced Module features, read Rack's engine.hpp header file
  23. // - toJson, fromJson: serialization of internal data
  24. // - onSampleRateChange: event triggered by a change of sample rate
  25. // - onReset, onRandomize, onCreate, onDelete: implements special behavior when user clicks these from the context menu
  26. };
  27. void LoadCounterModule::step() {
  28. int n = 8;
  29. for (int i = 1; i <= n; ++i)
  30. {
  31. std::vector<int> x;
  32. x.resize(50);
  33. int m = 500;
  34. for (auto &v : x)
  35. {
  36. v = 500 - m++; //rand();
  37. }
  38. std::sort(x.begin(), x.end());
  39. }
  40. }
  41. struct CKSSWhite : SVGSwitch, ToggleSwitch {
  42. CKSSWhite() {
  43. addFrame(SVG::load(assetPlugin(plugin, "res/CKSS_0_White.svg")));
  44. addFrame(SVG::load(assetPlugin(plugin, "res/CKSS_1_White.svg")));
  45. }
  46. };
  47. struct LoadCounterModuleWidget : ModuleWidget {
  48. TextField *textField;
  49. LoadCounterModuleWidget(LoadCounterModule *module) : ModuleWidget(module) {
  50. setPanel(SVG::load(assetPlugin(plugin, "res/CVTgl.svg")));
  51. }
  52. };
  53. } // namespace rack_plugin_rcm
  54. using namespace rack_plugin_rcm;
  55. RACK_PLUGIN_MODEL_INIT(rcm, LoadCounterModule) {
  56. Model *modelLoadCounterModule = Model::create<LoadCounterModule, LoadCounterModuleWidget>("rcm", "rcm-counter", "Load Counter", ENVELOPE_FOLLOWER_TAG);
  57. return modelLoadCounterModule;
  58. }