1 #ifndef AL_ControlGUI_HPP
2 #define AL_ControlGUI_HPP
49 #include "al/io/al_ControlNav.hpp"
50 #include "al/io/al_Imgui.hpp"
51 #include "al/scene/al_DynamicScene.hpp"
52 #include "al/scene/al_SynthRecorder.hpp"
53 #include "al/scene/al_SynthSequencer.hpp"
54 #include "al/ui/al_Parameter.hpp"
55 #include "al/ui/al_ParameterBundle.hpp"
56 #include "al/ui/al_ParameterGUI.hpp"
57 #include "al/ui/al_ParameterMIDI.hpp"
58 #include "al/ui/al_PresetHandler.hpp"
59 #include "al/ui/al_PresetSequencer.hpp"
65 enum class MarkerType { GROUP_BEGIN, GROUP_END, SEPARATOR };
66 GUIMarker(MarkerType type,
const char *name =
nullptr) {
71 MarkerType getType() {
return mMarkerType; }
72 const char *getName() {
return mName; }
75 MarkerType mMarkerType;
91 return registerParameterMeta(newParam);
94 return registerParameterMeta(newParam);
99 return registerParameterMeta(*newParam);
102 return registerParameterMeta(*newParam);
105 ControlGUI ®isterParameterBundle(ParameterBundle &bundle);
109 return registerParameterBundle(newBundle);
112 return registerParameterBundle(newBundle);
117 return registerParameterBundle(*newBundle);
120 return registerParameterBundle(*newBundle);
123 ControlGUI ®isterNav(Nav &nav);
130 ControlGUI ®isterPresetHandler(PresetHandler &presetHandler,
131 int numRows = -1,
int numColumns = -1);
136 return registerPresetHandler(ph);
143 return registerPresetHandler(*ph);
147 ControlGUI ®isterPresetSequencer(PresetSequencer &presetSequencer);
152 return registerPresetSequencer(ps);
156 ControlGUI ®isterSequenceRecorder(SequenceRecorder &recorder);
161 return registerSequenceRecorder(ps);
165 ControlGUI ®isterSynthRecorder(SynthRecorder &recorder);
169 return registerSynthRecorder(recorder);
172 return registerSynthRecorder(recorder);
175 ControlGUI ®isterSynthSequencer(SynthSequencer &seq);
180 return registerSynthSequencer(seq);
184 ControlGUI ®isterDynamicScene(DynamicScene &scene);
189 return registerDynamicScene(scene);
193 ControlGUI ®isterMarker(GUIMarker &marker);
200 void setTitle(std::string title) { mName = title; }
202 void fixedPosition(
bool fixed =
true) { mFixed = fixed; }
228 void init(
int x = 5,
int y = 5,
bool manageImgui =
true);
259 if (mBundles.find(bundleName) != mBundles.end()) {
260 return mBundles[bundleName]->currentBundle();
270 if (mBundles.find(bundleName) != mBundles.end()) {
271 return mBundles[bundleName]->bundleGlobal();
290 static GUIMarker beginGroup(
const char *groupName =
nullptr) {
291 return GUIMarker(GUIMarker::MarkerType::GROUP_BEGIN, groupName);
293 static GUIMarker endGroup() {
294 return GUIMarker(GUIMarker::MarkerType::GROUP_END);
296 static GUIMarker separator() {
297 return GUIMarker(GUIMarker::MarkerType::SEPARATOR);
304 std::map<std::string, std::vector<ParameterVec3 *>> mParameterVec3s;
305 std::map<std::string, std::vector<ParameterVec4 *>> mParameterVec4s;
307 std::map<std::string, std::vector<ParameterMeta *>> mElements;
308 ParameterMeta *mLatestElement{
nullptr};
309 std::vector<ParameterMeta *>
312 std::vector<std::string> mGroupNames;
313 std::vector<ParameterMeta *>
316 std::vector<ParameterMeta *> mSeparatorAnchors;
320 PresetHandler *mPresetHandler{
nullptr};
321 int mPresetColumns, mPresetRows;
322 PresetSequencer *mPresetSequencer{
nullptr};
323 SequenceRecorder *mSequenceRecorder{
nullptr};
324 SynthRecorder *mSynthRecorder{
nullptr};
325 SynthSequencer *mSynthSequencer{
nullptr};
326 PolySynth *mPolySynth{
nullptr};
327 DynamicScene *mScene{
nullptr};
328 std::map<std::string, BundleGUIManager *> mBundles;
335 float mGUIBackgroundAlpha = 0;
337 bool mManageIMGUI{
true};
340 int mCurrentPresetSequencerItem{0};
342 char **mSequencerItems;
344 std::map<std::string, int> mCurrentBundle;
345 std::map<std::string, bool> mBundleGlobal;
ControlGUI & operator<<(Nav &nav)
void backgroundAlpha(float a)
Set background alpha value.
ControlGUI & operator<<(PresetSequencer &ps)
bool usingInput()
usingInput returns true if the mouse is within the imgui window
ControlGUI & operator<<(ParameterBundle *newBundle)
Register parameter using the streaming operator.
ControlGUI & operator<<(PresetHandler &ph)
int getBundleCurrent(std::string bundleName)
get currently active index for a parameter bundle registerd with the GUI
ControlGUI & operator<<(SynthRecorder &recorder)
Register a SynthRecorder. This will display GUI widgets to control it.
ControlGUI & operator<<(PresetHandler *ph)
ControlGUI & operator<<(SynthSequencer &seq)
void manageImGUI(bool manage)
Call to set if this GUI manages ImGUI.
bool getBundleIsGlobal(std::string bundleName)
Returns true if global controls is enabled for bundle.
ControlGUI & operator<<(SequenceRecorder &ps)
ControlGUI & operator<<(ParameterBundle &newBundle)
Register parameter using the streaming operator.
void init(int x=5, int y=5, bool manageImgui=true)
initialize ImGUI.
ControlGUI & operator<<(ParameterMeta *newParam)
Register parameter using the streaming operator.
void draw(Graphics &g)
draws the GUI
float backgroundAlpha() const
Get background alpha value.
ControlGUI & operator<<(GUIMarker marker)
ControlGUI & operator<<(ParameterMeta &newParam)
Register parameter using the streaming operator.
ControlGUI & operator<<(DynamicScene &scene)
Interface for loading fonts and rendering text.
The PresetHandler class handles sorting and recalling of presets.
The PresetSequencer class allows triggering presets from a PresetHandler over time.
The SequenceRecorder class records preset changes in a ".sequence" file.
The SynthRecorder class records the events arriving at a PolySynth.
Event Sequencer triggering audio visual "notes".