r125: This commit was manufactured by cvs2svn to create tag 'r1_1_7-last'.
[cinelerra_cv/mob.git] / hvirtual / cinelerra / recordprefs.C
blob62d970a0ccd3e43005b2ef592866df82901df271
1 #include "adeviceprefs.h"
2 #include "audioconfig.h"
3 #include "clip.h"
4 #include "edl.h"
5 #include "edlsession.h"
6 #include "new.h"
7 #include "preferences.h"
8 #include "recordconfig.h"
9 #include "recordprefs.h"
10 #include "vdeviceprefs.h"
13 #include <libintl.h>
14 #define _(String) gettext(String)
15 #define gettext_noop(String) String
16 #define N_(String) gettext_noop (String)
19 RecordPrefs::RecordPrefs(MWindow *mwindow, PreferencesWindow *pwindow)
20  : PreferencesDialog(mwindow, pwindow)
22         this->mwindow = mwindow;
25 RecordPrefs::~RecordPrefs()
27         delete in_device;
28 //      delete duplex_device;
31 int RecordPrefs::create_objects()
33         int x = 5, y = 5;
34         char string[BCTEXTLEN];
36         add_subwindow(new BC_Title(x, y, _("Audio In"), LARGEFONT, BLACK));
37         y += 25;
40         add_subwindow(new BC_Title(x, y, _("Record Driver:"), MEDIUMFONT, BLACK));
41         in_device = new ADevicePrefs(x + 110, 
42                 y, 
43                 pwindow, 
44                 this, 
45                 0,
46                 pwindow->thread->edl->session->aconfig_in, 
47                 MODERECORD);
48         in_device->initialize();
50         y += ADevicePrefs::get_h();
52 //      add_subwindow(new BC_Title(x, y, _("Duplex Driver:"), MEDIUMFONT, BLACK));
53 //      duplex_device = new ADevicePrefs(x + 110, 
54 //              y, 
55 //              pwindow, 
56 //              this, 
57 //              pwindow->thread->edl->session->aconfig_duplex, 
58 //              0,
59 //              MODEDUPLEX);
60 //      duplex_device->initialize();
61 // 
62 //      y += ADevicePrefs::get_h();
64         BC_TextBox *textbox;
65         add_subwindow(new BC_Title(x, y, _("Samples to write to disk at a time:")));
66         sprintf(string, "%ld", pwindow->thread->edl->session->record_write_length);
67         add_subwindow(textbox = new RecordWriteLength(mwindow, pwindow, x + 240, y, string));
69         y += 30;
70 //      add_subwindow(new DuplexEnable(mwindow, pwindow, x, y, pwindow->thread->edl->session->enable_duplex));
71 //      y += 30;
72         add_subwindow(new RecordRealTime(mwindow, pwindow, x, y, pwindow->thread->edl->session->real_time_record));
73         y += 35;
74         add_subwindow(new BC_Title(x, y, _("Sample rate for recording:")));
75         x += 190;
76         add_subwindow(textbox = new RecordSampleRate(pwindow, x, y));
77         x += 75;
78         add_subwindow(new SampleRatePulldown(mwindow, textbox, x, y));
79         y += 45;
80         x = 5;
83         add_subwindow(new BC_Title(x, y, _("Video In"), LARGEFONT, BLACK));
84         y += 25;
86         add_subwindow(new BC_Title(x, y, _("Record Driver:"), MEDIUMFONT, BLACK));
87         video_in_device = new VDevicePrefs(x + 110, 
88                 y, 
89                 pwindow, 
90                 this, 
91                 0, 
92                 pwindow->thread->edl->session->vconfig_in, 
93                 MODERECORD);
94         video_in_device->initialize();
96         y += 55;
97         sprintf(string, "%d", pwindow->thread->edl->session->video_write_length);
98         add_subwindow(textbox = new VideoWriteLength(pwindow, string, y));
99         add_subwindow(new CaptureLengthTumbler(pwindow, textbox, textbox->get_x() + textbox->get_w(), y));
100         add_subwindow(new BC_Title(x, y, _("Frames to record to disk at a time:")));
101         y += 27;
102         sprintf(string, "%d", pwindow->thread->edl->session->vconfig_in->capture_length);
103         add_subwindow(textbox = new VideoCaptureLength(pwindow, string, y));
104         add_subwindow(new CaptureLengthTumbler(pwindow, textbox, textbox->get_x() + textbox->get_w(), y));
105         add_subwindow(new BC_Title(x, y, _("Frames to buffer in device:")));
106         y += 27;
108         add_subwindow(new RecordSoftwareTimer(pwindow, 
109                 pwindow->thread->edl->session->record_software_position, 
110                 x, 
111                 y));
112         y += 27;
113         add_subwindow(new RecordSyncDrives(pwindow, 
114                 pwindow->thread->edl->session->record_sync_drives, 
115                 x, 
116                 y));
117         y += 35;
119         BC_TextBox *w_text, *h_text;
120         add_subwindow(new BC_Title(x, y, _("Size of captured frame:")));
121         x += 170;
122         add_subwindow(w_text = new RecordW(pwindow, x, y));
123         x += w_text->get_w() + 2;
124         add_subwindow(new BC_Title(x, y, "x"));
125         x += 10;
126         add_subwindow(h_text = new RecordH(pwindow, x, y));
127         x += h_text->get_w();
128         add_subwindow(new FrameSizePulldown(mwindow, 
129                 w_text, 
130                 h_text, 
131                 x, 
132                 y));
134         y += 30;
135         x = 5;
136         add_subwindow(new BC_Title(x, y, _("Frame rate for recording:")));
137         x += 180;
138         add_subwindow(textbox = new RecordFrameRate(pwindow, x, y));
139         x += 75;
140         add_subwindow(new FrameRatePulldown(mwindow, textbox, x, y));
141         y += 30;
143         return 0;
147 RecordWriteLength::RecordWriteLength(MWindow *mwindow, PreferencesWindow *pwindow, int x, int y, char *text)
148  : BC_TextBox(x, y, 100, 1, text)
150         this->pwindow = pwindow; 
153 int RecordWriteLength::handle_event()
155         pwindow->thread->edl->session->record_write_length = atol(get_text());
156         return 1; 
161 RecordRealTime::RecordRealTime(MWindow *mwindow, PreferencesWindow *pwindow, int x, int y, int value)
162  : BC_CheckBox(x, y, value, _("Record in realtime priority (root only)"))
164         this->pwindow = pwindow; 
167 int RecordRealTime::handle_event()
169         pwindow->thread->edl->session->real_time_record = get_value();
173 RecordSampleRate::RecordSampleRate(PreferencesWindow *pwindow, int x, int y)
174  : BC_TextBox(x, y, 70, 1, pwindow->thread->edl->session->aconfig_in->in_samplerate)
176         this->pwindow = pwindow;
178 int RecordSampleRate::handle_event()
180         pwindow->thread->edl->session->aconfig_in->in_samplerate = atol(get_text());
181         return 1;
185 // DuplexEnable::DuplexEnable(MWindow *mwindow, PreferencesWindow *pwindow, int x, int y, int value)
186 //  : BC_CheckBox(x, y, value, _("Enable full duplex"))
187 // { this->pwindow = pwindow; }
188 // 
189 // int DuplexEnable::handle_event()
190 // {
191 //      pwindow->thread->edl->session->enable_duplex = get_value();
192 // }
193 // 
196 RecordW::RecordW(PreferencesWindow *pwindow, int x, int y)
197  : BC_TextBox(x, y, 70, 1, pwindow->thread->edl->session->vconfig_in->w)
199         this->pwindow = pwindow;
201 int RecordW::handle_event()
203         pwindow->thread->edl->session->vconfig_in->w = atol(get_text());
204         return 1;
207 RecordH::RecordH(PreferencesWindow *pwindow, int x, int y)
208  : BC_TextBox(x, y, 70, 1, pwindow->thread->edl->session->vconfig_in->h)
210         this->pwindow = pwindow;
212 int RecordH::handle_event()
214         pwindow->thread->edl->session->vconfig_in->h = atol(get_text());
215         return 1;
218 RecordFrameRate::RecordFrameRate(PreferencesWindow *pwindow, int x, int y)
219  : BC_TextBox(x, y, 70, 1, pwindow->thread->edl->session->vconfig_in->in_framerate)
221         this->pwindow = pwindow;
223 int RecordFrameRate::handle_event()
225         pwindow->thread->edl->session->vconfig_in->in_framerate = atof(get_text());
226         return 1;
230 VideoWriteLength::VideoWriteLength(PreferencesWindow *pwindow, char *text, int y)
231  : BC_TextBox(260, y, 100, 1, text)
233         this->pwindow = pwindow; 
236 int VideoWriteLength::handle_event()
238         pwindow->thread->edl->session->video_write_length = atol(get_text()); 
239         return 1;
243 VideoCaptureLength::VideoCaptureLength(PreferencesWindow *pwindow, char *text, int y)
244  : BC_TextBox(260, y, 100, 1, text)
246         this->pwindow = pwindow;
249 int VideoCaptureLength::handle_event()
251         pwindow->thread->edl->session->vconfig_in->capture_length = atol(get_text()); 
252         return 1; 
255 CaptureLengthTumbler::CaptureLengthTumbler(PreferencesWindow *pwindow, BC_TextBox *text, int x, int y)
256  : BC_Tumbler(x, y)
258         this->pwindow;
259         this->text = text;
262 int CaptureLengthTumbler::handle_up_event()
264         int value = atol(text->get_text());
265         value++;
266         char string[BCTEXTLEN];
267         sprintf(string, "%d", value);
268         text->update(string);
269         text->handle_event();
270         return 1;
273 int CaptureLengthTumbler::handle_down_event()
275         int value = atol(text->get_text());
276         value--;
277         value = MAX(1, value);
278         char string[BCTEXTLEN];
279         sprintf(string, "%d", value);
280         text->update(string);
281         text->handle_event();
282         return 1;
287 RecordSoftwareTimer::RecordSoftwareTimer(PreferencesWindow *pwindow, int value, int x, int y)
288  : BC_CheckBox(x, y, value, _("Use software for positioning information"))
290         this->pwindow = pwindow; 
293 int RecordSoftwareTimer::handle_event() 
295         pwindow->thread->edl->session->record_software_position = get_value(); 
296         return 1;
301 RecordSyncDrives::RecordSyncDrives(PreferencesWindow *pwindow, int value, int x, int y)
302  : BC_CheckBox(x, y, value, _("Sync drives automatically"))
304         this->pwindow = pwindow; 
307 int RecordSyncDrives::handle_event() 
309         pwindow->thread->edl->session->record_sync_drives = get_value(); 
310         return 1;