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.

150 lines
4.8KB

  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_Counter.H>
  22. #include "PoshSamplerPlugin.h"
  23. #include "../SpiralPluginGUI.h"
  24. #include "../Widgets/Fl_Knob.H"
  25. #ifndef MixerGUI
  26. #define MixerGUI
  27. class Fl_WaveDisplay : public Fl_Widget
  28. {
  29. public:
  30. Fl_WaveDisplay(int x,int y,int w,int h, char* Name);
  31. ~Fl_WaveDisplay();
  32. virtual void draw();
  33. virtual int handle(int event);
  34. void SetSample(Sample* s) { m_Sample=s; }
  35. long GetRangeStart() { return m_StartPos; }
  36. long GetRangeEnd() { return m_EndPos; }
  37. long GetViewStart() { return m_ViewStart; }
  38. void SetViewStart(long s) { m_ViewStart=s; }
  39. long GetViewEnd() { return m_ViewEnd; }
  40. void SetViewEnd(long s) { m_ViewEnd=s; }
  41. void SetPlayPos(long s) { m_PlayPos=s; if(m_PosMarker) redraw(); }
  42. void SetPlayStart(long s) { m_PlayStart=s; }
  43. long GetPlayStart() { return m_PlayStart; }
  44. void SetLoopStart(long s) { m_LoopStart=s; }
  45. long GetLoopStart() { return m_LoopStart; }
  46. void SetLoopEnd(long s) { m_LoopEnd=s; }
  47. long GetLoopEnd() { return m_LoopEnd; }
  48. void SetPosMarker(bool s) { m_PosMarker=s; }
  49. private:
  50. Sample *m_Sample;
  51. long m_StartPos;
  52. long m_EndPos;
  53. long m_ViewStart;
  54. long m_ViewEnd;
  55. long m_PlayPos;
  56. long m_PlayStart;
  57. long m_LoopStart;
  58. long m_LoopEnd;
  59. bool m_PosMarker;
  60. };
  61. class PoshSamplerPluginGUI : public SpiralPluginGUI
  62. {
  63. public:
  64. PoshSamplerPluginGUI(int w, int h, PoshSamplerPlugin *o,const HostInfo *Info);
  65. virtual void UpdateValues();
  66. virtual SpiralPlugin* GetPlugin() { return m_Plugin; }
  67. void SetPlayPos(long s) { m_Display->SetPlayPos(s); }
  68. int GetCurrentSample() { return (int)m_SampleNum->value(); }
  69. PoshSamplerPlugin *m_Plugin;
  70. private:
  71. int Numbers[NUM_SAMPLES];
  72. Fl_Button* m_Load;
  73. Fl_Button* m_Save;
  74. Fl_Button* m_PosMarker;
  75. Fl_Knob* m_Volume;
  76. Fl_Knob* m_Pitch;
  77. Fl_Knob* m_Octave;
  78. Fl_Button* m_Loop;
  79. Fl_Button* m_PingPong;
  80. Fl_Button* m_Record;
  81. Fl_Counter* m_Note;
  82. Fl_WaveDisplay* m_Display;
  83. Fl_Counter* m_SampleNum;
  84. Fl_Button* m_Cut;
  85. Fl_Button* m_Copy;
  86. Fl_Button* m_Paste;
  87. Fl_Button* m_Mix;
  88. Fl_Button* m_Crop;
  89. Fl_Button* m_Reverse;
  90. Fl_Button* m_Amp;
  91. //// Callbacks ////
  92. inline void cb_Load_i(Fl_Button* o, void* v);
  93. static void cb_Load(Fl_Button* o, void* v);
  94. inline void cb_Save_i(Fl_Button* o, void* v);
  95. static void cb_Save(Fl_Button* o, void* v);
  96. inline void cb_PosMarker_i(Fl_Button* o, void* v);
  97. static void cb_PosMarker(Fl_Button* o, void* v);
  98. inline void cb_Record_i(Fl_Button* o, void* v);
  99. static void cb_Record(Fl_Button* o, void* v);
  100. inline void cb_Volume_i(Fl_Knob* o, void* v);
  101. static void cb_Volume(Fl_Knob* o, void* v);
  102. inline void cb_Pitch_i(Fl_Knob* o, void* v);
  103. static void cb_Pitch(Fl_Knob* o, void* v);
  104. inline void cb_Octave_i(Fl_Knob* o, void* v);
  105. static void cb_Octave(Fl_Knob* o, void* v);
  106. inline void cb_Loop_i(Fl_Button* o, void* v);
  107. static void cb_Loop(Fl_Button* o, void* v);
  108. inline void cb_PingPong_i(Fl_Button* o, void* v);
  109. static void cb_PingPong(Fl_Button* o, void* v);
  110. inline void cb_Note_i(Fl_Counter* o, void* v);
  111. static void cb_Note(Fl_Counter* o, void* v);
  112. inline void cb_SampleNum_i(Fl_Counter* o, void* v);
  113. static void cb_SampleNum(Fl_Counter* o, void* v);
  114. inline void cb_Cut_i(Fl_Button* o, void* v);
  115. static void cb_Cut(Fl_Button* o, void* v);
  116. inline void cb_Copy_i(Fl_Button* o, void* v);
  117. static void cb_Copy(Fl_Button* o, void* v);
  118. inline void cb_Paste_i(Fl_Button* o, void* v);
  119. static void cb_Paste(Fl_Button* o, void* v);
  120. inline void cb_Mix_i(Fl_Button* o, void* v);
  121. static void cb_Mix(Fl_Button* o, void* v);
  122. inline void cb_Crop_i(Fl_Button* o, void* v);
  123. static void cb_Crop(Fl_Button* o, void* v);
  124. inline void cb_Reverse_i(Fl_Button* o, void* v);
  125. static void cb_Reverse(Fl_Button* o, void* v);
  126. inline void cb_Amp_i(Fl_Button* o, void* v);
  127. static void cb_Amp(Fl_Button* o, void* v);
  128. inline void cb_WaveDisplay_i(Fl_WaveDisplay* o, void* v);
  129. static void cb_WaveDisplay(Fl_WaveDisplay* o, void* v);
  130. };
  131. #endif