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.

99 lines
2.4KB

  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. bool Matrix[MATX][MATY];
  31. };
  32. class MatrixPlugin : public SpiralPlugin
  33. {
  34. public:
  35. MatrixPlugin();
  36. virtual ~MatrixPlugin();
  37. virtual PluginInfo &Initialise(const HostInfo *Host);
  38. virtual SpiralGUIType *CreateGUI();
  39. virtual void Execute();
  40. virtual void ExecuteCommands();
  41. virtual void StreamOut(ostream &s);
  42. virtual void StreamIn(istream &s);
  43. bool GetNoteCut() { return m_NoteCut; }
  44. int GetCurrent() { return m_Current; }
  45. float GetStepTime() { return m_StepTime; }
  46. Pattern* GetPattern() { return &m_Matrix[m_Current]; }
  47. enum GUICommands{NONE,MAT_LENGTH,MAT_SPEED,MAT_ACTIVATE,MAT_DEACTIVATE,
  48. MAT_OCTAVE,COPY,PASTE,CLEAR,TUP,TDOWN};
  49. struct GUIArgs
  50. {
  51. int Num;
  52. int Length;
  53. float Speed;
  54. int X,Y;
  55. int Octave;
  56. };
  57. private:
  58. GUIArgs m_GUIArgs;
  59. void CopyPattern() { m_CopyPattern = m_Current; }
  60. void PastePattern();
  61. void ClearPattern();
  62. void TransposeUp();
  63. bool CanTransposeUp();
  64. void TransposeDown();
  65. bool CanTransposeDown();
  66. float m_TickTime;
  67. float m_StepTime;
  68. float m_Time;
  69. int m_Step;
  70. bool m_Loop;
  71. bool m_NoteCut;
  72. int m_Current;
  73. Pattern m_Matrix[NUM_PATTERNS];
  74. float m_TriggerLevel[NUM_PATTERNS];
  75. float m_CurrentNoteCV;
  76. float m_CurrentTriggerCV;
  77. bool m_Triggered;
  78. bool m_ClockHigh;
  79. int m_CopyPattern;
  80. };
  81. #endif