52ff549af3eca2352643a2e4d698cfb5cfc2691b
[ardour.git] / libs / surfaces / control_protocol / 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 */
20
21 #ifndef __ardour_basic_ui_h__
22 #define __ardour_basic_ui_h__
23
24 #include <string>
25 #include <stdint.h>
26
27 #include "pbd/signals.h"
28
29 #include <jack/types.h>
30
31 #include "control_protocol/timecode.h"
32
33 namespace ARDOUR {
34         class Session;
35         class SessionEvent;
36 }
37
38 class BasicUI {
39   public:
40         BasicUI (ARDOUR::Session&);
41         virtual ~BasicUI ();
42         
43         void add_marker ();
44
45         void register_thread (std::string name);
46
47         /* transport control */
48
49         void loop_toggle ();
50         void access_action ( std::string action_path );
51         static PBD::Signal2<void,std::string,std::string> AccessAction;
52         void goto_start ();
53         void goto_end ();
54         void rewind ();
55         void ffwd ();
56         void transport_stop ();
57         void transport_play (bool jump_back = true);
58         void set_transport_speed (double speed);
59         double get_transport_speed ();
60
61         jack_nframes_t transport_frame ();
62         void locate (jack_nframes_t frame, bool play = false);
63         bool locating ();
64         bool locked ();
65
66         void save_state ();
67         void prev_marker ();
68         void next_marker ();
69         void undo ();
70         void redo ();
71         void toggle_punch_in ();
72         void toggle_punch_out ();
73
74         void set_record_enable (bool yn);
75         bool get_record_enabled ();
76
77         void rec_enable_toggle ();
78         void toggle_all_rec_enables ();
79
80         jack_nframes_t timecode_frames_per_hour ();
81
82         void timecode_time (jack_nframes_t where, Timecode::Time&);
83         void timecode_to_sample (Timecode::Time& timecode, int64_t& sample, bool use_subframes) const;
84         void sample_to_timecode (int64_t sample, Timecode::Time& timecode, bool use_subframes) const;
85
86   protected:
87         BasicUI ();
88         ARDOUR::Session* session;
89 };
90
91 #endif /* __ardour_basic_ui_h__ */