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.

136 lines
3.7KB

  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 "ladspa.h"
  33. #include <string>
  34. #include "LADSPAPlugin.h"
  35. #include "../SpiralPluginGUI.h"
  36. #ifndef LADSPAGUI
  37. #define LADSPAGUI
  38. #include "ladspa.h"
  39. #include <stdio.h>
  40. #include <math.h>
  41. #include <dlfcn.h>
  42. #include <vector>
  43. #include "utils.h"
  44. class LPluginInfo {
  45. public:
  46. string Filename;
  47. string Label;
  48. string Name;
  49. bool operator<(const LPluginInfo & li) { return (Name < li.Name); }
  50. bool operator==(const LPluginInfo& li) { return (Name == li.Name); }
  51. };
  52. // For sorting vectors of LPluginInfo's
  53. struct LPluginInfoSortAsc
  54. {
  55. bool operator()(const LPluginInfo & begin, const LPluginInfo & end)
  56. {
  57. return begin.Name < end.Name;
  58. }
  59. };
  60. class LADSPAPluginGUI : public SpiralPluginGUI
  61. {
  62. public:
  63. LADSPAPluginGUI(int w, int h, LADSPAPlugin *o,const HostInfo *Info);
  64. ~LADSPAPluginGUI();
  65. virtual void UpdateValues();
  66. virtual SpiralPlugin* GetPlugin() { return m_Plugin; }
  67. void SetName(const char *s);
  68. void SetMaker(const char *s);
  69. void ClearPortInfo();
  70. void AddPortInfo(const char *Info);
  71. void UpdatePortDisplay(int n, float v);
  72. void SetMinMax(int n, float min, float max, bool clamp);
  73. void GetMinMax(int n, float &min, float &max, bool &clamp);
  74. string GetFilename() { return m_Filename; }
  75. string GetLabel() { return m_Label; }
  76. void SetFilename(string s) { m_Filename=s; }
  77. void SetLabel(string s) { m_Label=s; }
  78. LADSPAPlugin *m_Plugin;
  79. private:
  80. vector<LPluginInfo> PluginList;
  81. LPluginInfo CurrentPlugin;
  82. friend void describePluginLibrary(const char * pcFullFilename, void * pvPluginHandle, LADSPA_Descriptor_Function pfDescriptorFunction);
  83. void refreshPluginList(void);
  84. Fl_Scroll *m_InputScroll;
  85. Fl_Pack *m_InputPack;
  86. Fl_Hold_Browser *m_Browser;
  87. Fl_Knob *m_OutputGain;
  88. Fl_Box *m_Name;
  89. Fl_Box *m_Maker;
  90. Fl_Button *m_UpdateInputs;
  91. Fl_Button *m_UpdateMinMax;
  92. Fl_Button *m_PowerAmp;
  93. vector<Fl_Output*> m_PortOutput;
  94. vector<Fl_Input*> m_PortMin;
  95. vector<Fl_Input*> m_PortMax;
  96. vector<Fl_Check_Button*> m_PortClamp;
  97. // this is needed as fltk seems to crash if you delete
  98. // the pack, is won't delete the children properly???
  99. vector<Fl_Group*> m_PackVec;
  100. int inited;
  101. string m_Filename;
  102. string m_Label;
  103. inline void cb_Select_i(Fl_Hold_Browser* o);
  104. static void cb_Select(Fl_Hold_Browser* o);
  105. inline void cb_Gain_i(Fl_Knob* o, void* v);
  106. static void cb_Gain(Fl_Knob* o, void* v);
  107. inline void cb_MinMax_i(Fl_Button* o, void* v);
  108. static void cb_MinMax(Fl_Button* o, void* v);
  109. inline void cb_PowerAmp_i(Fl_Button* o, void* v);
  110. static void cb_PowerAmp(Fl_Button* o, void* v);
  111. };
  112. #endif