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.

123 lines
3.3KB

  1. /* SpiralPlugin
  2. * Copyleft (C) 2000 David Griffiths <dave@pawfal.org>
  3. *
  4. * This program is free software; you can redistribute it and/or modify
  5. * it under the terms of the GNU General Public License as published by
  6. * the Free Software Foundation; either version 2 of the License, or
  7. * (at your option) any later version.
  8. *
  9. * This program is distributed in the hope that it will be useful,
  10. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. * GNU General Public License for more details.
  13. *
  14. * You should have received a copy of the GNU General Public License
  15. * along with this program; if not, write to the Free Software
  16. * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
  17. */
  18. #include <FL/Fl.H>
  19. #include <FL/Fl_Window.H>
  20. #include <FL/Fl_Group.H>
  21. #include <FL/Fl_Pack.H>
  22. #include <FL/Fl_Choice.H>
  23. #include <FL/Fl_Input.H>
  24. #include <FL/Fl_Button.H>
  25. #include <FL/Fl_Check_Button.H>
  26. #include <FL/Fl_Box.H>
  27. #include <FL/Fl_Hold_Browser.H>
  28. #include <FL/Fl_Output.H>
  29. #include <FL/Fl_Scroll.H>
  30. #include "../Widgets/Fl_Knob.H"
  31. #include <vector>
  32. #include <string>
  33. #include "LADSPAPlugin.h"
  34. #include "../SpiralPluginGUI.h"
  35. #ifndef LADSPAGUI
  36. #define LADSPAGUI
  37. #include <cstdio>
  38. #include <cmath>
  39. #include <dlfcn.h>
  40. #include <vector>
  41. class LADSPAPluginGUI : public SpiralPluginGUI
  42. {
  43. public:
  44. LADSPAPluginGUI(int w, int h, LADSPAPlugin *o, ChannelHandler *ch, const HostInfo *Info, const vector<LPluginInfo> &PVec);
  45. ~LADSPAPluginGUI();
  46. virtual void UpdateValues(SpiralPlugin *o);
  47. void SetName(const char *s);
  48. void SetMaker(const char *s);
  49. void ClearPortInfo();
  50. void AddPortInfo(const char *Info);
  51. void UpdatePortDisplay(int n, float v);
  52. void SetMinMax(int n, float min, float max, bool clamp);
  53. void GetMinMax(int n, float &min, float &max, bool &clamp);
  54. string GetFilename() { return m_Filename; }
  55. string GetLabel() { return m_Label; }
  56. void SetFilename(string s) { m_Filename=s; }
  57. void SetLabel(string s) { m_Label=s; }
  58. private:
  59. LPluginInfo m_CurrentPlugin;
  60. Fl_Scroll *m_InputScroll;
  61. Fl_Pack *m_InputPack;
  62. Fl_Hold_Browser *m_Browser;
  63. Fl_Knob *m_OutputGain;
  64. Fl_Box *m_Name;
  65. Fl_Box *m_Maker;
  66. Fl_Button *m_UpdateInputs;
  67. Fl_Button *m_UpdateMinMax;
  68. Fl_Button *m_PowerAmp;
  69. vector<Fl_Output*> m_PortOutput;
  70. vector<Fl_Input*> m_PortMin;
  71. vector<Fl_Input*> m_PortMax;
  72. vector<Fl_Check_Button*> m_PortClamp;
  73. vector<LPluginInfo> PluginList;
  74. // this is needed as fltk seems to crash if you delete
  75. // the pack, is won't delete the children properly???
  76. vector<Fl_Group*> m_PackVec;
  77. int inited;
  78. string m_Filename;
  79. string m_Label;
  80. inline void cb_Select_i(Fl_Hold_Browser* o);
  81. static void cb_Select(Fl_Hold_Browser* o);
  82. inline void cb_Gain_i(Fl_Knob* o, void* v);
  83. static void cb_Gain(Fl_Knob* o, void* v);
  84. inline void cb_MinMax_i(Fl_Button* o, void* v);
  85. static void cb_MinMax(Fl_Button* o, void* v);
  86. inline void cb_PowerAmp_i(Fl_Button* o, void* v);
  87. static void cb_PowerAmp(Fl_Button* o, void* v);
  88. struct InChannelData
  89. {
  90. float Gain;
  91. char Name[256];
  92. char Maker[256];
  93. unsigned long MaxInputPorts;
  94. unsigned long InputPorts;
  95. char *InputPortNames;
  96. PortRange *InputPortRanges;
  97. };
  98. InChannelData m_InData;
  99. };
  100. #endif