Assists music production by grouping standalone programs into sessions. Community version of "Non Session Manager".
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.

116 lines
3.3KB

  1. /*******************************************************************************/
  2. /* Copyright (C) 2007-2008 Jonathan Moore Liles */
  3. /* */
  4. /* This program is free software; you can redistribute it and/or modify it */
  5. /* under the terms of the GNU General Public License as published by the */
  6. /* Free Software Foundation; either version 2 of the License, or (at your */
  7. /* option) any later version. */
  8. /* */
  9. /* This program is distributed in the hope that it will be useful, but WITHOUT */
  10. /* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or */
  11. /* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for */
  12. /* more details. */
  13. /* */
  14. /* You should have received a copy of the GNU General Public License along */
  15. /* with This program; see the file COPYING. If not,write to the Free Software */
  16. /* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
  17. /*******************************************************************************/
  18. #pragma once
  19. #include "grid.H"
  20. #include "canvas.H"
  21. #include "mapping.H"
  22. // #include "event.H"
  23. typedef unsigned long tick_t;
  24. #include <vector>
  25. using std::vector;
  26. class pattern : public Grid
  27. {
  28. static event_list _recorded_events;
  29. static vector <pattern *> _patterns;
  30. static int _solo;
  31. static int _pattern_recording;
  32. static int solo ( void );
  33. int _channel, _port;
  34. bool _recording;
  35. mutable volatile bool _cleared;
  36. volatile bool _triggered;
  37. // int _key;
  38. int _note;
  39. void _add ( void );
  40. public:
  41. static signal <void> signal_create_destroy;
  42. Mapping mapping;
  43. pattern ( void );
  44. ~pattern ( void );
  45. pattern ( const pattern &rhs );
  46. static int patterns ( void );
  47. static pattern * pattern_by_number ( int n );
  48. static void reset ( void );
  49. static pattern * import ( smf *f, int track );
  50. static pattern * recording ( void );
  51. static void record_event ( const midievent *e );
  52. pattern * create ( void );
  53. pattern * by_number ( int n ) const;
  54. pattern * clone ( void );
  55. void put ( int x, int y, tick_t l );
  56. const char * row_name ( int r ) const;
  57. void draw_row_names ( Canvas *c ) const;
  58. void trigger ( tick_t start, tick_t end );
  59. void stop ( void ) const;
  60. void play ( tick_t start, tick_t end ) const;
  61. void load ( smf *f );
  62. void record( int mode );
  63. void record_stop ( void );
  64. void toggle_trigger ( void );
  65. bool triggered ( void ) const;
  66. void randomize_row ( int y, int feel, float probability );
  67. int port ( void ) const;
  68. void port ( int p );
  69. int channel ( void ) const;
  70. void channel ( int c );
  71. int note ( void ) const;
  72. void note ( int n );
  73. void mode ( int n );
  74. int mode ( void ) const;
  75. int key ( void ) const;
  76. void key ( int k );
  77. int load ( const char *name );
  78. void save ( const char *name ) const;
  79. void dump ( smf *f ) const;
  80. int ppqn ( void ) const;
  81. void ppqn ( int n );
  82. };