add asset select used to proxy list menu
[goodguy/cinelerra.git] / cinelerra-5.1 / cinelerra / recordengine.h
1
2 /*
3  * CINELERRA
4  * Copyright (C) 2008 Adam Williams <broadcast at earthling dot net>
5  *
6  * This program is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation; either version 2 of the License, or
9  * (at your option) any later version.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with this program; if not, write to the Free Software
18  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
19  *
20  */
21
22 #ifndef RECORDENGINE_H
23 #define RECORDENGINE_H
24
25 #define JUMP_DELAYS 5
26
27 #include "assets.inc"
28 #include "audiodevice.inc"
29 #include "channel.inc"
30 #include "file.inc"
31 #include "filexml.inc"
32 #include "mwindow.inc"
33 #include "playbackengine.inc"
34 #include "record.inc"
35 #include "recordaudio.inc"
36 #include "recordvideo.inc"
37 #include "recordgui.inc"
38 #include "recordlabel.inc"
39 #include "recordthread.inc"
40 #include "bctimer.h"
41 #include "videodevice.inc"
42
43 class RecordEngine
44 {
45 public:
46         RecordEngine(MWindow *mwindow, Record *record);
47
48         Record *record;
49         MWindow *mwindow;
50
51
52
53
54
55
56
57         RecordEngine(MWindow *mwindow,
58                         Record *record,
59                         File *file,
60                         Asset *asset,
61                         RecordLabels *labels);
62         ~RecordEngine();
63
64         int initialize();
65         int set_gui(RecordGUI *gui);
66         long get_dc_offset(int offset);
67         int set_dc_offset(long new_offset, int number);
68         long get_dc_offset(long *dc_offset, RecordGUIDCOffsetText **dc_offset_text);
69         int run_script(FileXML *script);
70
71 // =================================== record operations
72
73         int start_monitor();
74         int stop_monitor();
75         int pause_monitor();
76
77         int resume_monitor();
78
79         int start_saving(int duplex = 0);
80         int stop_saving(int no_monitor = 0);
81         int save_frame();
82
83         int arm_duplex();
84         int start_duplex();
85         int stop_duplex();
86
87         int start_preview();
88         int stop_preview(int no_monitor = 0);
89
90         int stop_operation(int no_monitor = 0);
91         int start_over();
92
93         int lock_window();
94         int unlock_window();
95         int set_video_picture();   // Send the picture quality to the device
96
97 // Open device for recording
98         int open_input_devices(int duplex);
99         int close_input_devices();
100 // Open device for previewing
101         int open_output_devices();
102         int close_output_devices();
103
104 // ======================================= transport
105
106         int delete_all_labels();
107         int calibrate_dc_offset();
108         int calibrate_dc_offset(long new_value, int channel);
109
110         int update_position(long new_position);
111         int update_total_length(long new_length);
112         int update_prev_label(long new_label);
113         int update_next_label(long new_label);
114
115         int goto_prev_label();
116         int goto_next_label();
117         int toggle_label();
118
119         int reset_over();
120         int set_done(int value);
121
122         RecordThread *monitor_thread;
123         RecordThread *record_thread;
124         PlaybackEngine *duplex_thread;
125
126         RecordGUI *gui;
127         AudioDevice *adevice;
128         VideoDevice *vdevice;
129         File *file;
130         Asset *asset;
131         RecordLabels *labels;
132
133 // For video synchronization when no audio thread
134         Timer monitor_timer, preview_timer, record_timer;
135         int record_mode;
136         int is_saving;
137         int is_previewing;
138         int is_duplexing;
139         int is_monitoring;
140         long total_length;
141         long current_position;
142         long prev_label;
143         long next_label;
144
145 // =========================================== info
146
147         int mode_to_text(char *string, int mode);
148         int text_to_mode(char *string);
149
150 // Current sample depending on the operation
151         long absolute_monitor_position();
152         long absolute_preview_position();
153         long absolute_record_position();
154
155         ArrayList<char*>* get_video_inputs();
156         int change_channel(Channel *channel);
157         int get_vu_format();
158         int get_loop_hr();
159         int get_loop_min();
160         int get_loop_sec();
161         long get_loop_duration();
162         int set_loop_duration();
163         int get_duplex_status();
164         int set_duplex_status(int duplex_status);
165         int set_record_mode(char *text);
166         int set_monitor_video(int value);
167         int set_monitor_audio(int value);
168         int get_record_mode(char *text);
169         int get_record_mode();
170         int get_dither();
171         int get_duplex_enable();
172         int get_input_channels();
173         int get_format(char *string);
174         int get_samplerate();
175         int get_time_format();
176         float get_frames_per_foot();
177         float get_min_db();
178         float get_frame_rate();
179         long get_current_position();
180         int get_bits();
181         long get_current_delay();
182         long get_current_jumps();
183         int reset_current_delay();
184         int get_in_length();    // Length to read during record
185         int get_meter_over_hold(int divisions);
186         int get_meter_peak_hold(int divisions);
187         int get_meter_speed();
188
189 private:
190         long jump_delay[JUMP_DELAYS], current_jump_jumps[JUMP_DELAYS];
191         int current_jump_delay, current_jump_jump;
192 };
193
194 #endif