diff options
author | Robin Gareus <robin@gareus.org> | 2016-07-08 18:18:34 +0200 |
---|---|---|
committer | Robin Gareus <robin@gareus.org> | 2016-07-08 18:19:31 +0200 |
commit | db564a03c77e8271534810e2e3a60fd3506ec0b0 (patch) | |
tree | 943271cb92db5dc057cc44947df9fcd5ff8be91c /libs | |
parent | 77e50f56f9f9107c122bf8785978eb6bd7e49a36 (diff) |
add an plugin API to query generic-gui grid-layout
Diffstat (limited to 'libs')
-rw-r--r-- | libs/ardour/ardour/lv2_plugin.h | 1 | ||||
-rw-r--r-- | libs/ardour/ardour/plugin.h | 12 | ||||
-rw-r--r-- | libs/ardour/lv2_plugin.cc | 47 |
3 files changed, 60 insertions, 0 deletions
diff --git a/libs/ardour/ardour/lv2_plugin.h b/libs/ardour/ardour/lv2_plugin.h index cbd7a7abc2..efd4903e07 100644 --- a/libs/ardour/ardour/lv2_plugin.h +++ b/libs/ardour/ardour/lv2_plugin.h @@ -79,6 +79,7 @@ class LIBARDOUR_API LV2Plugin : public ARDOUR::Plugin, public ARDOUR::Workee std::string get_parameter_docs(uint32_t which) const; int get_parameter_descriptor (uint32_t which, ParameterDescriptor&) const; uint32_t nth_parameter (uint32_t port, bool& ok) const; + bool get_layout (uint32_t which, UILayoutHint&) const; IOPortDescription describe_io_port (DataType dt, bool input, uint32_t id) const; diff --git a/libs/ardour/ardour/plugin.h b/libs/ardour/ardour/plugin.h index dcb6577e7a..bc32d7c3e6 100644 --- a/libs/ardour/ardour/plugin.h +++ b/libs/ardour/ardour/plugin.h @@ -88,6 +88,18 @@ class LIBARDOUR_API Plugin : public PBD::StatefulDestructible, public Latent virtual std::string get_docs () const { return ""; } virtual std::string get_parameter_docs (uint32_t /*which*/) const { return ""; } + struct UILayoutHint { + UILayoutHint () + : x0(-1), x1(-1), y0(-1), y1(-1), knob(false) {} + int x0; + int x1; + int y0; + int y1; + bool knob; + }; + + virtual bool get_layout (uint32_t which, UILayoutHint&) const { return false; } + virtual int get_parameter_descriptor (uint32_t which, ParameterDescriptor&) const = 0; virtual uint32_t nth_parameter (uint32_t which, bool& ok) const = 0; virtual void activate () = 0; diff --git a/libs/ardour/lv2_plugin.cc b/libs/ardour/lv2_plugin.cc index 228fd74117..d27c045750 100644 --- a/libs/ardour/lv2_plugin.cc +++ b/libs/ardour/lv2_plugin.cc @@ -1054,6 +1054,53 @@ LV2Plugin::get_parameter_docs(uint32_t which) const return ""; } +bool +LV2Plugin::get_layout (uint32_t which, UILayoutHint& h) const +{ + /// TODO lookup port-properties + if (unique_id () != "urn:ardour:a-eq") { + return false; + } + h.knob = true; + switch (which) { + case 0: h.x0 = 0; h.x1 = 1; h.y0 = 4; h.y1 = 5; break; // Shelf toggle L + case 1: h.x0 = 0; h.x1 = 1; h.y0 = 2; h.y1 = 3; break; // Frequency L + case 2: h.x0 = 0; h.x1 = 1; h.y0 = 0; h.y1 = 1; break; // Gain L + case 19: h.x0 = 0; h.x1 = 1; h.y0 = 5; h.y1 = 6; break; // enable L + + case 3: h.x0 = 1; h.x1 = 3; h.y0 = 2; h.y1 = 3; break; // Frequency 1 + case 4: h.x0 = 1; h.x1 = 3; h.y0 = 0; h.y1 = 1; break; // Gain 1 + case 5: h.x0 = 2; h.x1 = 4; h.y0 = 1; h.y1 = 2; break; // Bandwidth 1 + case 20: h.x0 = 1; h.x1 = 4; h.y0 = 5; h.y1 = 6; break; // enable 1 + + case 6: h.x0 = 4; h.x1 = 6; h.y0 = 2; h.y1 = 3; break; // Frequency 2 + case 7: h.x0 = 4; h.x1 = 6; h.y0 = 0; h.y1 = 1; break; // Gain 2 + case 8: h.x0 = 5; h.x1 = 7; h.y0 = 1; h.y1 = 2; break; // Bandwidth 2 + case 21: h.x0 = 4; h.x1 = 7; h.y0 = 5; h.y1 = 6; break; // enable 2 + + case 9: h.x0 = 7; h.x1 = 9; h.y0 = 2; h.y1 = 3; break; // Frequency 3 + case 10: h.x0 = 7; h.x1 = 9; h.y0 = 0; h.y1 = 1; break; // Gain 3 + case 11: h.x0 = 8; h.x1 = 10; h.y0 = 1; h.y1 = 2; break; // Bandwidth 3 + case 22: h.x0 = 7; h.x1 = 10; h.y0 = 5; h.y1 = 6; break; // enable 3 + + case 12: h.x0 = 10; h.x1 = 12; h.y0 = 2; h.y1 = 3; break; // Frequency 4 + case 13: h.x0 = 10; h.x1 = 12; h.y0 = 0; h.y1 = 1; break; // Gain 4 + case 14: h.x0 = 11; h.x1 = 13; h.y0 = 1; h.y1 = 2; break; // Bandwidth 4 + case 23: h.x0 = 10; h.x1 = 13; h.y0 = 5; h.y1 = 6; break; // enable 4 + + case 15: h.x0 = 13; h.x1 = 14; h.y0 = 4; h.y1 = 5; break; // Shelf toggle H + case 16: h.x0 = 13; h.x1 = 14; h.y0 = 2; h.y1 = 3; break; // Frequency H + case 17: h.x0 = 13; h.x1 = 14; h.y0 = 0; h.y1 = 1; break; // Gain H + case 24: h.x0 = 13; h.x1 = 14; h.y0 = 5; h.y1 = 6; break; // enable H + + + case 18: h.x0 = 14; h.x1 = 15; h.y0 = 4; h.y1 = 6; break; // Master Gain + default: + return false; + } + return true; +} + uint32_t LV2Plugin::nth_parameter(uint32_t n, bool& ok) const { |