1 #include "adeviceprefs.h"
2 #include "audioconfig.h"
5 #include "edlsession.h"
7 #include "preferences.h"
8 #include "recordconfig.h"
9 #include "recordprefs.h"
10 #include "vdeviceprefs.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()
28 // delete duplex_device;
31 int RecordPrefs::create_objects()
34 char string[BCTEXTLEN];
36 add_subwindow(new BC_Title(x, y, _("Audio In"), LARGEFONT, BLACK));
40 add_subwindow(new BC_Title(x, y, _("Record Driver:"), MEDIUMFONT, BLACK));
41 in_device = new ADevicePrefs(x + 110,
46 pwindow->thread->edl->session->aconfig_in,
48 in_device->initialize();
50 y += ADevicePrefs::get_h();
54 BC_Title *title1, *title2;
55 add_subwindow(title1 = new BC_Title(x, y, _("Samples to write to disk at a time:")));
56 add_subwindow(title2 = new BC_Title(x, y + 30, _("Sample rate for recording:")));
57 x2 = MAX(title1->get_w(), title2->get_w()) + 10;
59 sprintf(string, "%ld", pwindow->thread->edl->session->record_write_length);
60 add_subwindow(textbox = new RecordWriteLength(mwindow,
65 add_subwindow(textbox = new RecordSampleRate(pwindow, x2, y + 30));
66 add_subwindow(new SampleRatePulldown(mwindow, textbox, x2 + textbox->get_w(), y + 30));
71 add_subwindow(new RecordRealTime(mwindow,
75 pwindow->thread->edl->session->real_time_record));
80 add_subwindow(new BC_Title(x, y, _("Video In"), LARGEFONT, BLACK));
83 add_subwindow(new BC_Title(x, y, _("Record Driver:"), MEDIUMFONT, BLACK));
84 video_in_device = new VDevicePrefs(x + 110,
89 pwindow->thread->edl->session->vconfig_in,
91 video_in_device->initialize();
94 sprintf(string, "%d", pwindow->thread->edl->session->video_write_length);
95 add_subwindow(textbox = new VideoWriteLength(pwindow, string, y));
96 add_subwindow(new CaptureLengthTumbler(pwindow, textbox, textbox->get_x() + textbox->get_w(), y));
97 add_subwindow(new BC_Title(x, y, _("Frames to record to disk at a time:")));
99 sprintf(string, "%d", pwindow->thread->edl->session->vconfig_in->capture_length);
100 add_subwindow(textbox = new VideoCaptureLength(pwindow, string, y));
101 add_subwindow(new CaptureLengthTumbler(pwindow, textbox, textbox->get_x() + textbox->get_w(), y));
102 add_subwindow(new BC_Title(x, y, _("Frames to buffer in device:")));
105 add_subwindow(new RecordSoftwareTimer(pwindow,
106 pwindow->thread->edl->session->record_software_position,
110 add_subwindow(new RecordSyncDrives(pwindow,
111 pwindow->thread->edl->session->record_sync_drives,
116 BC_TextBox *w_text, *h_text;
117 add_subwindow(new BC_Title(x, y, _("Size of captured frame:")));
119 add_subwindow(w_text = new RecordW(pwindow, x, y));
120 x += w_text->get_w() + 2;
121 add_subwindow(new BC_Title(x, y, "x"));
123 add_subwindow(h_text = new RecordH(pwindow, x, y));
124 x += h_text->get_w();
125 add_subwindow(new FrameSizePulldown(mwindow,
133 add_subwindow(new BC_Title(x, y, _("Frame rate for recording:")));
135 add_subwindow(textbox = new RecordFrameRate(pwindow, x, y));
137 add_subwindow(new FrameRatePulldown(mwindow, textbox, x, y));
144 RecordWriteLength::RecordWriteLength(MWindow *mwindow, PreferencesWindow *pwindow, int x, int y, char *text)
145 : BC_TextBox(x, y, 100, 1, text)
147 this->pwindow = pwindow;
150 int RecordWriteLength::handle_event()
152 pwindow->thread->edl->session->record_write_length = atol(get_text());
158 RecordRealTime::RecordRealTime(MWindow *mwindow, PreferencesWindow *pwindow, int x, int y, int value)
159 : BC_CheckBox(x, y, value, _("Record in realtime priority (root only)"))
161 this->pwindow = pwindow;
164 int RecordRealTime::handle_event()
166 pwindow->thread->edl->session->real_time_record = get_value();
170 RecordSampleRate::RecordSampleRate(PreferencesWindow *pwindow, int x, int y)
171 : BC_TextBox(x, y, 70, 1, pwindow->thread->edl->session->aconfig_in->in_samplerate)
173 this->pwindow = pwindow;
175 int RecordSampleRate::handle_event()
177 pwindow->thread->edl->session->aconfig_in->in_samplerate = atol(get_text());
182 // DuplexEnable::DuplexEnable(MWindow *mwindow, PreferencesWindow *pwindow, int x, int y, int value)
183 // : BC_CheckBox(x, y, value, _("Enable full duplex"))
184 // { this->pwindow = pwindow; }
186 // int DuplexEnable::handle_event()
188 // pwindow->thread->edl->session->enable_duplex = get_value();
193 RecordW::RecordW(PreferencesWindow *pwindow, int x, int y)
194 : BC_TextBox(x, y, 70, 1, pwindow->thread->edl->session->vconfig_in->w)
196 this->pwindow = pwindow;
198 int RecordW::handle_event()
200 pwindow->thread->edl->session->vconfig_in->w = atol(get_text());
204 RecordH::RecordH(PreferencesWindow *pwindow, int x, int y)
205 : BC_TextBox(x, y, 70, 1, pwindow->thread->edl->session->vconfig_in->h)
207 this->pwindow = pwindow;
209 int RecordH::handle_event()
211 pwindow->thread->edl->session->vconfig_in->h = atol(get_text());
215 RecordFrameRate::RecordFrameRate(PreferencesWindow *pwindow, int x, int y)
216 : BC_TextBox(x, y, 70, 1, pwindow->thread->edl->session->vconfig_in->in_framerate)
218 this->pwindow = pwindow;
220 int RecordFrameRate::handle_event()
222 pwindow->thread->edl->session->vconfig_in->in_framerate = atof(get_text());
227 VideoWriteLength::VideoWriteLength(PreferencesWindow *pwindow, char *text, int y)
228 : BC_TextBox(260, y, 100, 1, text)
230 this->pwindow = pwindow;
233 int VideoWriteLength::handle_event()
235 pwindow->thread->edl->session->video_write_length = atol(get_text());
240 VideoCaptureLength::VideoCaptureLength(PreferencesWindow *pwindow, char *text, int y)
241 : BC_TextBox(260, y, 100, 1, text)
243 this->pwindow = pwindow;
246 int VideoCaptureLength::handle_event()
248 pwindow->thread->edl->session->vconfig_in->capture_length = atol(get_text());
252 CaptureLengthTumbler::CaptureLengthTumbler(PreferencesWindow *pwindow, BC_TextBox *text, int x, int y)
259 int CaptureLengthTumbler::handle_up_event()
261 int value = atol(text->get_text());
263 char string[BCTEXTLEN];
264 sprintf(string, "%d", value);
265 text->update(string);
266 text->handle_event();
270 int CaptureLengthTumbler::handle_down_event()
272 int value = atol(text->get_text());
274 value = MAX(1, value);
275 char string[BCTEXTLEN];
276 sprintf(string, "%d", value);
277 text->update(string);
278 text->handle_event();
284 RecordSoftwareTimer::RecordSoftwareTimer(PreferencesWindow *pwindow, int value, int x, int y)
285 : BC_CheckBox(x, y, value, _("Use software for positioning information"))
287 this->pwindow = pwindow;
290 int RecordSoftwareTimer::handle_event()
292 pwindow->thread->edl->session->record_software_position = get_value();
298 RecordSyncDrives::RecordSyncDrives(PreferencesWindow *pwindow, int value, int x, int y)
299 : BC_CheckBox(x, y, value, _("Sync drives automatically"))
301 this->pwindow = pwindow;
304 int RecordSyncDrives::handle_event()
306 pwindow->thread->edl->session->record_sync_drives = get_value();