81f2727264ca48a0c783d2a3fbf00aff7f8b4fd2
[ardour.git] / libs / surfaces / control_protocol / basic_ui.h
1 /*
2     Copyright (C) 2006 Paul Davis 
3
4     This program is free software; you can redistribute it
5     and/or modify it under the terms of the GNU Lesser
6     General Public License as published by the Free Software
7     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,
11     but WITHOUT ANY WARRANTY; without even the implied warranty of
12     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13     GNU General Public License for more details.
14
15     You should have received a copy of the GNU General Public License
16     along with this program; if not, write to the Free Software
17     Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
18
19     $Id$
20 */
21
22 #ifndef __ardour_basic_ui_h__
23 #define __ardour_basic_ui_h__
24
25 #include <string>
26
27 #include <jack/types.h>
28
29 namespace ARDOUR {
30         class Session;
31 }
32
33 class BasicUI {
34   public:
35         BasicUI (ARDOUR::Session&);
36         virtual ~BasicUI ();
37         
38         void add_marker ();
39
40         void register_thread (std::string name);
41
42         /* transport control */
43
44         void loop_toggle ();
45         void goto_start ();
46         void goto_end ();
47         void rewind ();
48         void ffwd ();
49         void transport_stop ();
50         void transport_play (bool jump_back = true);
51         void set_transport_speed (float speed);
52         float get_transport_speed ();
53
54         jack_nframes_t transport_frame ();
55         void locate (jack_nframes_t frame, bool play = false);
56         bool locating ();
57         bool locked ();
58
59         void save_state ();
60         void prev_marker ();
61         void next_marker ();
62         void undo ();
63         void redo ();
64         void toggle_punch_in ();
65         void toggle_punch_out ();
66
67         void set_record_enable (bool yn);
68         bool get_record_enabled ();
69
70         void rec_enable_toggle ();
71         void toggle_all_rec_enables ();
72
73         jack_nframes_t smpte_frames_per_hour ();
74
75         struct SMPTE_t {
76                 bool negative;
77                 uint32_t hours;
78                 uint32_t minutes;
79                 uint32_t seconds;
80                 uint32_t frames;
81                 uint32_t subframes; // mostly not used
82
83                 SMPTE_t () {
84                         negative = false;
85                         hours = 0;
86                         minutes = 0;
87                         seconds = 0;
88                         frames = 0;
89                         subframes = 0;
90                 }
91         };
92
93         void smpte_time (jack_nframes_t where, SMPTE_t&);
94         void smpte_to_sample (SMPTE_t& smpte, jack_nframes_t& sample, bool use_offset, bool use_subframes) const;
95         void sample_to_smpte (jack_nframes_t sample, SMPTE_t& smpte, bool use_offset, bool use_subframes) const;
96
97   protected:
98         BasicUI ();
99         ARDOUR::Session* session;
100 };
101
102 #endif /* __ardour_basic_ui_h__ */