Update NTK.
[nondaw.git] / sequencer / src / pattern.H
blob3e4aaf5489b6f482ec3b8bb09a1ebb18d5b0bcd7
2 /*******************************************************************************/
3 /* Copyright (C) 2007-2008 Jonathan Moore Liles                                */
4 /*                                                                             */
5 /* This program is free software; you can redistribute it and/or modify it     */
6 /* under the terms of the GNU General Public License as published by the       */
7 /* Free Software Foundation; either version 2 of the License, or (at your      */
8 /* option) any later version.                                                  */
9 /*                                                                             */
10 /* This program is distributed in the hope that it will be useful, but WITHOUT */
11 /* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or       */
12 /* FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for   */
13 /* more details.                                                               */
14 /*                                                                             */
15 /* You should have received a copy of the GNU General Public License along     */
16 /* with This program; see the file COPYING.  If not,write to the Free Software */
17 /* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
18 /*******************************************************************************/
20 #pragma once
22 #include "grid.H"
23 #include "canvas.H"
24 #include "mapping.H"
25 // #include "event.H"
26 #include "common.h"
28 #include <vector>
29 using std::vector;
31 class pattern : public Grid
33     static event_list _recorded_events;
34     static vector <pattern *> _patterns;
35     static int _solo;
36     static int _pattern_recording;
39     static int solo ( void );
41     int _channel, _port;
43     bool _recording;
44     mutable volatile bool _cleared;
46     mutable volatile int _queued;
48 //    int _key;
50     int _note;
52     void _add ( void );
55 public:
57     static int note_shape;
59     int draw_shape ( void ) const { return pattern::note_shape; }
61     static signal <void> signal_create_destroy;
63     Mapping mapping;
65     pattern ( void );
66     ~pattern ( void );
67     pattern ( const pattern &rhs );
69     static int patterns ( void );
70     static pattern * pattern_by_number ( int n );
71     static void reset ( void );
72     static pattern * import ( smf *f, int track );
74     static pattern * recording ( void );
75     static void record_event ( const midievent *e );
77     pattern * create ( void );
78     pattern * by_number ( int n ) const;
80     pattern * clone ( void );
81     void put ( int x, int y, tick_t l );
82     const char * row_name ( int r ) const;
83     void draw_row_names ( Canvas *c ) const;
84     void trigger ( tick_t start, tick_t end );
85     void trigger ( void );
86     void stop ( void ) const;
87     void play ( tick_t start, tick_t end ) const;
89     void load ( smf *f );
91     void record( int mode );
92     void record_stop ( void );
94     void queue ( int mode );
95     int queue ( void ) const;
97     void randomize_row ( int y, int feel, float probability );
99     int port ( void ) const;
100     void port ( int p );
101     int channel ( void ) const;
102     void channel ( int c );
103     int note ( void ) const;
104     void note ( int n );
106     void mode ( int n );
107     int mode ( void ) const;
109     int key ( void ) const;
110     void key ( int k );
112     int load ( const char *name );
113     void save ( const char *name ) const;
114     void dump ( smf *f ) const;
116     int ppqn ( void ) const;
117     void ppqn ( int n );