Bela
Real-time, ultra-low-latency audio and sensor processing system for BeagleBone Black
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups
GuiController.h
1 #pragma once
2 
3 #include <vector>
4 #include <string>
5 #include <libraries/Gui/Gui.h>
6 #include "GuiSlider.h"
7 #include <JSON.h>
8 
9 // Forward declarations
10 class Gui;
11 
13  private:
14  std::vector<GuiSlider> _sliders;
15  Gui *_gui;
16  std::string _name;
17  std::wstring _wname;
18 
19  int sendController();
20  int sendSlider(const GuiSlider& slider);
21  int sendSliderValue(int sliderIndex);
22 
23  public:
24  GuiController();
25  ~GuiController();
26 
27  GuiController(Gui *gui, std::string name);
28 
29  int setup(Gui *gui, std::string name);
30 
31  int setup();
32  void cleanup();
33  int addSlider(std::string name, float value = 0.5f, float min = 0.0f, float max = 1.0, float step = 0.001f);
34 
35  float getSliderValue(int sliderIndex);
36  int setSliderValue(int sliderIndex, float value);
37  GuiSlider& getSlider(int sliderIndex) { return _sliders.at(sliderIndex); };
38 
39  std::string getName() { return _name; };
40 
41  int getNumSliders() { return _sliders.size(); };
42 
43  static bool controlCallback(JSONObject &root, void* param);
44 };
Definition: Gui.h:14
Definition: GuiSlider.h:6
static float min(float x, float y)
Returns the maximum of two numbers.
Definition: Utilities.h:92
Definition: GuiController.h:12
static float max(float x, float y)
Returns the minimum of two numbers.
Definition: Utilities.h:88