a reverb is a reverb is a reverb
[ardour.git] / gtk2_ardour / video_monitor.h
1 /*
2     Copyright (C) 2010 Paul Davis
3     Author: Robin Gareus <robin@gareus.org>
4
5     This program is free software; you can redistribute it and/or modify
6     it under the terms of the GNU General Public License as published by
7     the Free Software Foundation; either version 2 of the License, or
8     (at your 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 #ifndef __ardour_video_monitor_h__
21 #define __ardour_video_monitor_h__
22
23 #include <string>
24
25 #include "ardour/ardour.h"
26 #include "ardour/types.h"
27 #include "ardour/session.h"
28 #include "ardour/session_handle.h"
29 #include "ardour/system_exec.h"
30
31 namespace ARDOUR {
32         class Session;
33 }
34 class PublicEditor;
35
36 enum XJSettingOptions {
37         XJ_WINDOW_SIZE = 1,
38         XJ_WINDOW_POS = 2,
39         XJ_WINDOW_ONTOP = 4,
40         XJ_LETTERBOX = 8,
41         XJ_OSD = 16,
42         XJ_OFFSET = 32,
43         XJ_FULLSCREEN = 64,
44 };
45
46 /** @class VideoMonitor
47  *  @brief communication with xjadeo's remote-control interface
48  */
49 class VideoMonitor : public sigc::trackable , public ARDOUR::SessionHandlePtr, public PBD::ScopedConnectionList
50 {
51         public:
52         VideoMonitor (PublicEditor*, std::string);
53         virtual ~VideoMonitor ();
54
55         void set_filename (std::string filename);
56         void set_fps (float f) {fps = f;}
57         bool is_started ();
58         bool start ();
59         void quit ();
60         void open (std::string);
61
62         void set_session (ARDOUR::Session *s);
63         void save_session ();
64         void query_full_state (bool);
65         bool set_custom_setting (const std::string, const std::string);
66         const std::string get_custom_setting (const std::string);
67         void restore_settings_mask (int i)  { _restore_settings_mask = i;}
68         int restore_settings_mask () const { return _restore_settings_mask;}
69
70         void set_offset (ARDOUR::frameoffset_t);
71         void manual_seek (ARDOUR::framepos_t, bool, ARDOUR::frameoffset_t);
72         void srsupdate ();
73         void querystate ();
74         bool synced_by_manual_seeks() { return sync_by_manual_seek; }
75
76         sigc::signal<void> Terminated;
77         PBD::Signal1<void,std::string> UiState;
78         void send_cmd (int what, int param);
79
80 #if 1
81         void set_debug (bool onoff) { debug_enable = onoff; }
82 #endif
83
84         protected:
85         PublicEditor *editor;
86         ARDOUR::SystemExec *process;
87         float fps;
88         void parse_output (std::string d, size_t s);
89         void terminated ();
90         void forward_keyevent (unsigned int);
91
92         void parameter_changed (std::string const & p);
93
94         typedef std::map<std::string,std::string> XJSettings;
95
96         int _restore_settings_mask;
97         bool skip_setting(std::string);
98         XJSettings xjadeo_settings;
99
100         void xjadeo_sync_setup ();
101         ARDOUR::framepos_t manually_seeked_frame;
102         ARDOUR::frameoffset_t video_offset;
103         bool sync_by_manual_seek;
104         sigc::connection clock_connection;
105         sigc::connection state_connection;
106         int state_clk_divide;
107         int starting;
108         int knownstate;
109         int osdmode;
110
111         PBD::Signal1<void, unsigned int> XJKeyEvent;
112 #if 1
113         bool debug_enable;
114 #endif
115 };
116
117 #endif /* __ardour_video_monitor_h__ */