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.

121 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_Output.H>
  28. #include <FL/Fl_Scroll.H>
  29. #include "../Widgets/Fl_Knob.H"
  30. #include <vector>
  31. #include <string>
  32. #include "LADSPAPlugin.h"
  33. #include "LADSPAInfo.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,
  45. LADSPAPlugin *o,
  46. ChannelHandler *ch,
  47. const HostInfo *Info,
  48. const std::vector<LADSPAInfo::PluginEntry> &PVec);
  49. ~LADSPAPluginGUI();
  50. virtual void UpdateValues(SpiralPlugin *o);
  51. virtual void Update(void);
  52. void SetName(const char *s);
  53. void SetMaker(const char *s);
  54. void ClearPortInfo();
  55. void AddPortInfo(const char *Info);
  56. void UpdatePortDisplay(int n, float v);
  57. void SetPortSettings(unsigned long n, float min, float max, bool clamp, float defolt);
  58. // void SetMinMax(int n, float min, float max, bool clamp);
  59. // void GetMinMax(int n, float &min, float &max, bool &clamp);
  60. private:
  61. Fl_Scroll *m_InputScroll;
  62. Fl_Pack *m_InputPack;
  63. Fl_Choice *m_Browser;
  64. Fl_Knob *m_OutputGain;
  65. Fl_Box *m_Name;
  66. Fl_Box *m_Maker;
  67. Fl_Button *m_UpdateInputs;
  68. Fl_Button *m_UpdateMinMax;
  69. Fl_Button *m_PowerAmp;
  70. std::vector<Fl_Output*> m_PortOutput;
  71. std::vector<Fl_Input*> m_PortMin;
  72. std::vector<Fl_Input*> m_PortMax;
  73. std::vector<Fl_Check_Button*> m_PortClamp;
  74. std::vector<Fl_Input*> m_PortDefault;
  75. std::vector<LADSPAInfo::PluginEntry> PluginList;
  76. // this is needed as fltk seems to crash if you delete
  77. // the pack, is won't delete the children properly???
  78. std::vector<Fl_Group*> m_PackVec;
  79. int inited;
  80. inline void cb_Select_i(Fl_Choice* o);
  81. static void cb_Select(Fl_Choice* 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 MaxInputPortCount;
  94. unsigned long InputPortCount;
  95. char *InputPortNames;
  96. PortSettings *InputPortSettings;
  97. float *InputPortValues;
  98. };
  99. InChannelData m_InData;
  100. };
  101. #endif