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.

184 lines
6.0KB

  1. /* LADSPAPluginGUI.h
  2. * Copyleft (C) 2000 David Griffiths <dave@pawfal.org>
  3. * LADSPA Plugin by Nicolas Noble <nicolas@nobis-crew.org>
  4. * Modified by Mike Rawes <myk@waxfrenzy.org>
  5. *
  6. * This program is free software; you can redistribute it and/or modify
  7. * it under the terms of the GNU General Public License as published by
  8. * the Free Software Foundation; either version 2 of the License, or
  9. * (at your option) any later version.
  10. *
  11. * This program is distributed in the hope that it will be useful,
  12. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  14. * GNU General Public License for more details.
  15. *
  16. * You should have received a copy of the GNU General Public License
  17. * along with this program; if not, write to the Free Software
  18. * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
  19. */
  20. #ifndef __ladspa_plugin_gui_h__
  21. #define __ladspa_plugin_gui_h__
  22. #include <FL/Fl.H>
  23. #include <FL/Fl_Window.H>
  24. #include <FL/Fl_Group.H>
  25. #include <FL/Fl_Pack.H>
  26. #include <FL/Fl_Choice.H>
  27. #include <FL/Fl_Tabs.H>
  28. #include <FL/Fl_Scroll.H>
  29. #include <FL/Fl_Input.H>
  30. #include <FL/Fl_Button.H>
  31. #include <FL/Fl_Check_Button.H>
  32. #include <FL/Fl_Box.H>
  33. #include <FL/Fl_Output.H>
  34. #include "../Widgets/Fl_Knob.H"
  35. #include "../Widgets/Fl_LED_Button.H"
  36. #include <vector>
  37. #include <string>
  38. #include <cstdio>
  39. #include <cmath>
  40. #include <dlfcn.h>
  41. #include "LADSPAPlugin.h"
  42. #include "LADSPAInfo.h"
  43. #include "../SpiralPluginGUI.h"
  44. class LADSPAPluginGUI : public SpiralPluginGUI
  45. {
  46. public:
  47. LADSPAPluginGUI(int w, int h,
  48. LADSPAPlugin *o,
  49. ChannelHandler *ch,
  50. const HostInfo *Info,
  51. const std::vector<LADSPAInfo::PluginEntry> &PVec);
  52. ~LADSPAPluginGUI(void);
  53. virtual void UpdateValues(SpiralPlugin *o);
  54. virtual void Update(void);
  55. protected:
  56. const string GetHelpText(const string &loc);
  57. private:
  58. void ClearPlugin(void);
  59. void SelectPlugin(void);
  60. void SetPage(int index);
  61. void SetUniqueID(unsigned long n);
  62. void SetName(const char *s);
  63. void SetMaker(const char *s);
  64. void SetPortSettings(unsigned long p);
  65. void SetUpdateInputs(bool state);
  66. void AddPortInfo(unsigned long p);
  67. void HandleResize(void);
  68. // For SetControlValue
  69. enum WhichControl
  70. {
  71. KNOB,
  72. SLIDER,
  73. BOTH
  74. };
  75. void UpdateKnobs(void);
  76. void UpdateSliders(void);
  77. void SetControlValue(unsigned long p, WhichControl wc);
  78. void SetControlRange(unsigned long p, float min, float max);
  79. void SetPortValue(unsigned long p, float value, int frompage);
  80. float ConvertControlValue(unsigned long p, float value);
  81. Fl_Color m_GUIColour;
  82. // Buttons
  83. Fl_Button *m_BKnob;
  84. Fl_Button *m_BSlider;
  85. Fl_Button *m_BSetup;
  86. // Knobs
  87. Fl_Group *m_KnobGroup;
  88. std::vector<Fl_Knob *> m_Knobs;
  89. std::vector<Fl_Input *> m_KnobDefaults;
  90. std::vector<Fl_Box *> m_KnobLabels;
  91. std::vector<char *> m_KnobLabelBuffers;
  92. // Sliders
  93. Fl_Group *m_SliderGroup;
  94. std::vector<Fl_Slider *> m_Sliders;
  95. std::vector<Fl_Input *> m_SliderDefaults;
  96. std::vector<Fl_Box *> m_SliderLabels;
  97. std::vector<char *> m_SliderLabelBuffers;
  98. // Setup stuff
  99. Fl_Group *m_SetupGroup;
  100. Fl_Choice *m_Browser;
  101. Fl_Box *m_NameLabel;
  102. Fl_Box *m_MakerLabel;
  103. Fl_Box *m_ValueLabel;
  104. Fl_Box *m_DefaultLabel;
  105. Fl_Box *m_MinLabel;
  106. Fl_Box *m_MaxLabel;
  107. Fl_Box *m_ClampLabel;
  108. Fl_Box *m_PortLabel;
  109. std::vector<Fl_Output*> m_PortValue;
  110. std::vector<Fl_Input*> m_PortMin;
  111. std::vector<Fl_Input*> m_PortMax;
  112. std::vector<Fl_Check_Button*> m_PortClamp;
  113. std::vector<Fl_Input*> m_PortDefault;
  114. Fl_Scroll *m_InputScroll;
  115. Fl_Pack *m_InputPack;
  116. Fl_LED_Button *m_UpdateInputs;
  117. unsigned long m_UnconnectedInputs;
  118. std::vector<LADSPAInfo::PluginEntry> m_PluginList;
  119. std::vector<unsigned long> m_PluginIDLookup;
  120. unsigned long m_PortIndex;
  121. float m_Default;
  122. float m_Min;
  123. float m_Max;
  124. bool m_Clamp;
  125. unsigned long m_UniqueID;
  126. int m_Page;
  127. bool m_UpdateInputState;
  128. char m_Name[256];
  129. char m_Maker[256];
  130. unsigned long m_MaxInputPortCount;
  131. unsigned long m_InputPortCount;
  132. char *m_InputPortNames;
  133. PortSetting *m_InputPortSettings;
  134. PortValue *m_InputPortValues;
  135. float *m_InputPortDefaults;
  136. inline void cb_BKnob_i(Fl_Button* o);
  137. static void cb_BKnob(Fl_Button* o);
  138. inline void cb_BSlider_i(Fl_Button* o);
  139. static void cb_BSlider(Fl_Button* o);
  140. inline void cb_BSetup_i(Fl_Button* o);
  141. static void cb_BSetup(Fl_Button* o);
  142. inline void cb_Select_i(Fl_Choice* o);
  143. static void cb_Select(Fl_Choice* o);
  144. inline void cb_UpdateInputs_i(Fl_LED_Button* o);
  145. static void cb_UpdateInputs(Fl_LED_Button* o);
  146. inline void cb_Default_i(Fl_Input* o);
  147. static void cb_Default(Fl_Input* o);
  148. inline void cb_Min_i(Fl_Input* o);
  149. static void cb_Min(Fl_Input* o);
  150. inline void cb_Max_i(Fl_Input* o);
  151. static void cb_Max(Fl_Input* o);
  152. inline void cb_Clamp_i(Fl_Check_Button* o);
  153. static void cb_Clamp(Fl_Check_Button* o);
  154. inline void cb_Knob_i(Fl_Knob *o);
  155. static void cb_Knob(Fl_Knob *o);
  156. inline void cb_KnobValue_i(Fl_Input *o);
  157. static void cb_KnobValue(Fl_Input *o);
  158. inline void cb_Slider_i(Fl_Slider *o);
  159. static void cb_Slider(Fl_Slider *o);
  160. inline void cb_SliderValue_i(Fl_Input *o);
  161. static void cb_SliderValue(Fl_Input *o);
  162. };
  163. #endif // __ladspa_plugin_gui_h__