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.

104 lines
2.5KB

  1. /* SpiralSound
  2. * Copyleft (C) 2001 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 "../SpiralPlugin.h"
  19. #include <FL/Fl_Pixmap.H>
  20. #ifndef MatrixPLUGIN
  21. #define MatrixPLUGIN
  22. static const int MATX = 64;
  23. static const int MATY = 32;
  24. static const int NUM_PATTERNS = 16;
  25. struct Pattern
  26. {
  27. int Length;
  28. float Speed;
  29. int Octave;
  30. float Volume[MATX][MATY];
  31. bool Matrix[MATX][MATY];
  32. };
  33. class MatrixPlugin : public SpiralPlugin
  34. {
  35. public:
  36. MatrixPlugin();
  37. virtual ~MatrixPlugin();
  38. virtual PluginInfo &Initialise(const HostInfo *Host);
  39. virtual SpiralGUIType *CreateGUI();
  40. virtual void Execute();
  41. virtual void ExecuteCommands();
  42. virtual void StreamOut(ostream &s);
  43. virtual void StreamIn(istream &s);
  44. bool GetNoteCut() { return m_NoteCut; }
  45. int GetCurrent() { return m_Current; }
  46. float GetStepTime() { return m_StepTime; }
  47. Pattern* GetPattern() { return &m_Matrix[m_Current]; }
  48. enum GUICommands{NONE,MAT_LENGTH,MAT_SPEED,MAT_ACTIVATE,MAT_DEACTIVATE,
  49. MAT_OCTAVE,COPY,PASTE,CLEAR,TUP,TDOWN,MAT_VOLUME,SET_CURRENT};
  50. struct GUIArgs
  51. {
  52. int Num;
  53. int Length;
  54. float Speed;
  55. int X,Y;
  56. int Octave;
  57. float Volume;
  58. };
  59. private:
  60. GUIArgs m_GUIArgs;
  61. void CopyPattern() { m_CopyPattern = m_Current; }
  62. void PastePattern();
  63. void ClearPattern();
  64. void TransposeUp();
  65. bool CanTransposeUp();
  66. void TransposeDown();
  67. bool CanTransposeDown();
  68. float m_TickTime;
  69. float m_StepTime;
  70. float m_Time;
  71. int m_Step;
  72. bool m_Loop;
  73. bool m_NoteCut;
  74. int m_Current;
  75. int m_GUICurrent;
  76. Pattern m_Matrix[NUM_PATTERNS];
  77. float m_TriggerLevel[MATY];
  78. float m_CurrentNoteCV;
  79. float m_CurrentTriggerCV;
  80. bool m_Triggered;
  81. bool m_ClockHigh;
  82. int m_CopyPattern;
  83. bool m_PatAdvance;
  84. bool m_PatReset;
  85. };
  86. #endif