Bela
Real-time, ultra-low-latency audio and sensor processing system for BeagleBone Black
Loading...
Searching...
No Matches
GuiSlider.h
1#pragma once
2
3#include <string>
4#include <JSON.h>
5
6class GuiSlider {
7 private:
8 int _index = -1;
9 float _value;
10 float _range[2];
11 float _step;
12 bool _changed = false;
13 std::string _name;
14 std::wstring _wname;
15
16 public:
17 GuiSlider() {};
18 GuiSlider(std::string name, float val = 0.5, float min = 0.0, float max = 0.1, float step = 0.001);
19 int setup(std::string name, float val, float min, float max, float step);
20 void cleanup() {};
21 ~GuiSlider();
22
23 /* Getters */
24 float getValue() {
25 _changed = false;
26 return _value;
27 };
28 float getStep() { return _step; };
29 std::string& getName() { return _name; };
30 std::wstring& getNameW() { return _wname; }
31 float getMin() { return _range[0]; };
32 float getMax() { return _range[1]; };
33 float getIndex() { return _index; };
34 bool hasChanged() { return _changed; };
35
36 /* Setters */
37 int setValue(float val);
38 int setStep(float step);
39 int setRange(float min, float max);
40 int setIndex(int index) { return (index < 0) ? -1 : _index=index; };
41
42 JSONObject getParametersAsJSON() const;
43};
static float max(float x, float y)
Returns the minimum of two numbers.
Definition Utilities.h:88
static float min(float x, float y)
Returns the maximum of two numbers.
Definition Utilities.h:92