Update NTK.
[nondaw.git] / sequencer / src / transport.H
blob86d3c7ec04ca591727fbab679b81c61088bc725b
2 /*******************************************************************************/
3 /* Copyright (C) 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 <sigc++/sigc++.h>
24 using namespace sigc;
26 #include "event.H" // just for tick_t
28 #include <jack/transport.h>
30 typedef double playhead_t;
32 class Transport : public trackable {
34     double _master_beats_per_minute;
35     unsigned _master_beats_per_bar;
36     unsigned _master_beat_type;
38 public:
40     signal <int, double> signal_tempo_change;
41     signal <int, double> signal_bpb_change;
42     signal <int, double> signal_beat_change;
44     bool master;                                                /* are we driving the transport? */
45     bool rolling;
46     bool valid;
47     volatile bool recording;
49     unsigned long bar;
50     unsigned beat;
51     unsigned tick;
53     playhead_t ticks;
55     unsigned beats_per_bar;
56     unsigned beat_type;
57     double ticks_per_beat;
58     double beats_per_minute;
60     double ticks_per_period;
61     double frames_per_tick;
63     double frame_rate;
65     double frame;
66     double nframes;
68     Transport ( void );
70     void poll ( void );
71     void start ( void );
72     void stop ( void );
73     void toggle ( void );
74     void locate ( tick_t ticks );
76     void set_beats_per_minute ( double n );
77     void set_beats_per_bar ( int n );
78     void set_beat_type ( int n );
80     static void timebase ( jack_transport_state_t state, jack_nframes_t nframes, jack_position_t *pos, int new_pos, void *arg );
84 extern Transport transport;