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.

89 lines
2.3KB

  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 StreamOut(ostream &s);
  41. virtual void StreamIn(istream &s);
  42. // has to be defined in the plugin
  43. virtual void UpdateGUI() { Fl::check(); }
  44. void SetNoteCut(bool s) { m_NoteCut=s; }
  45. bool GetNoteCut() { return m_NoteCut; }
  46. void SetCurrent(int s) { m_Current=s; }
  47. int GetCurrent() { return m_Current; }
  48. void SetStepTime(float s) { m_StepTime=s; }
  49. float GetStepTime() { return m_StepTime; }
  50. Pattern* GetPattern() { return &m_Matrix[m_Current]; }
  51. void CopyPattern() { m_CopyPattern = m_Current; }
  52. void PastePattern();
  53. void ClearPattern();
  54. void TransposeUp();
  55. bool CanTransposeUp();
  56. void TransposeDown();
  57. bool CanTransposeDown();
  58. private:
  59. float m_TickTime;
  60. float m_StepTime;
  61. float m_Time;
  62. int m_Step;
  63. bool m_Loop;
  64. bool m_NoteCut;
  65. int m_Current;
  66. Pattern m_Matrix[NUM_PATTERNS];
  67. float m_TriggerLevel[NUM_PATTERNS];
  68. float m_CurrentNoteCV;
  69. float m_CurrentTriggerCV;
  70. bool m_Triggered;
  71. bool m_ClockHigh;
  72. int m_CopyPattern;
  73. };
  74. #endif