1 #include "adeviceprefs.h"
2 #include "audioconfig.h"
5 #include "edlsession.h"
6 #include "formattools.h"
10 #include "preferences.h"
11 #include "recordconfig.h"
12 #include "recordprefs.h"
14 #include "vdeviceprefs.h"
19 RecordPrefs::RecordPrefs(MWindow *mwindow, PreferencesWindow *pwindow)
20 : PreferencesDialog(mwindow, pwindow)
22 this->mwindow = mwindow;
25 RecordPrefs::~RecordPrefs()
27 delete audio_in_device;
28 delete recording_format;
29 // delete duplex_device;
32 int RecordPrefs::create_objects()
35 char string[BCTEXTLEN];
36 BC_Resources *resources = BC_WindowBase::get_resources();
39 x = mwindow->theme->preferencesoptions_x;
40 y = mwindow->theme->preferencesoptions_y;
42 add_subwindow(title = new BC_Title(x,
46 resources->text_default));
47 y += title->get_h() + 5;
50 new FormatTools(mwindow,
52 pwindow->thread->edl->session->recording_format);
53 recording_format->create_objects(x,
55 1, // Include tools for audio
56 1, // Include tools for video
57 1, // Include checkbox for audio
58 1, // Include checkbox for video
61 0, // Select compressors to be offered
62 1, // Prompt for recording options
63 0, // If nonzero, prompt for insertion strategy
64 0); // Supply file formats for background rendering
71 add_subwindow(new BC_Bar(5, y, get_w() - 10));
75 add_subwindow(title = new BC_Title(x,
79 resources->text_default));
81 y += title->get_h() + 5;
83 add_subwindow(new BC_Title(x, y, _("Record Driver:"), MEDIUMFONT, resources->text_default));
84 audio_in_device = new ADevicePrefs(x + 110,
89 pwindow->thread->edl->session->aconfig_in,
91 audio_in_device->initialize(1);
92 y += audio_in_device->get_h(1);
96 BC_Title *title1, *title2, *title3;
97 add_subwindow(title1 = new BC_Title(x, y, _("Samples to write to disk at a time:")));
98 add_subwindow(title2 = new BC_Title(x, y + 30, _("Sample rate for recording:")));
99 add_subwindow(title3 = new BC_Title(x, y + 60, _("Channels to record:")));
100 x2 = MAX(title1->get_w(), title2->get_w()) + 10;
101 x2 = MAX(x2, title3->get_w() + 10);
103 sprintf(string, "%ld", pwindow->thread->edl->session->record_write_length);
104 add_subwindow(textbox = new RecordWriteLength(mwindow,
109 add_subwindow(textbox = new RecordSampleRate(pwindow, x2, y + 30));
110 add_subwindow(new SampleRatePulldown(mwindow, textbox, x2 + textbox->get_w(), y + 30));
112 RecordChannels *channels = new RecordChannels(pwindow, this, x2, y + 60);
113 channels->create_objects();
118 add_subwindow(new RecordRealTime(mwindow,
122 pwindow->thread->edl->session->real_time_record));
130 add_subwindow(new BC_Bar(5, y, get_w() - 10));
134 add_subwindow(new BC_Title(x, y, _("Video In"), LARGEFONT, resources->text_default));
137 add_subwindow(new BC_Title(x,
141 resources->text_default));
142 video_in_device = new VDevicePrefs(x + 110,
147 pwindow->thread->edl->session->vconfig_in,
149 video_in_device->initialize(1);
152 sprintf(string, "%d", pwindow->thread->edl->session->video_write_length);
153 add_subwindow(textbox = new VideoWriteLength(pwindow, string, y));
154 add_subwindow(new CaptureLengthTumbler(pwindow, textbox, textbox->get_x() + textbox->get_w(), y));
155 add_subwindow(new BC_Title(x, y, _("Frames to record to disk at a time:")));
157 sprintf(string, "%d", pwindow->thread->edl->session->vconfig_in->capture_length);
158 add_subwindow(textbox = new VideoCaptureLength(pwindow, string, y));
159 add_subwindow(new CaptureLengthTumbler(pwindow, textbox, textbox->get_x() + textbox->get_w(), y));
160 add_subwindow(new BC_Title(x, y, _("Frames to buffer in device:")));
163 add_subwindow(new RecordSoftwareTimer(pwindow,
164 pwindow->thread->edl->session->record_software_position,
168 add_subwindow(new RecordSyncDrives(pwindow,
169 pwindow->thread->edl->session->record_sync_drives,
174 BC_TextBox *w_text, *h_text;
175 add_subwindow(new BC_Title(x, y, _("Size of captured frame:")));
177 add_subwindow(w_text = new RecordW(pwindow, x, y));
178 x += w_text->get_w() + 2;
179 add_subwindow(new BC_Title(x, y, "x"));
181 add_subwindow(h_text = new RecordH(pwindow, x, y));
182 x += h_text->get_w();
183 add_subwindow(new FrameSizePulldown(mwindow,
191 add_subwindow(new BC_Title(x, y, _("Frame rate for recording:")));
193 add_subwindow(textbox = new RecordFrameRate(pwindow, x, y));
195 add_subwindow(new FrameRatePulldown(mwindow, textbox, x, y));
199 add_subwindow(new BC_Title(x, y, _("Images"), LARGEFONT, BLACK));
201 add_subwindow(new StillImageUseDuration(pwindow,
202 pwindow->thread->edl->session->si_useduration,
207 add_subwindow(new StillImageDuration(pwindow, x, y));
210 add_subwindow(new BC_Title(x, y, _("Seconds")));
217 RecordWriteLength::RecordWriteLength(MWindow *mwindow, PreferencesWindow *pwindow, int x, int y, char *text)
218 : BC_TextBox(x, y, 100, 1, text)
220 this->pwindow = pwindow;
223 int RecordWriteLength::handle_event()
225 pwindow->thread->edl->session->record_write_length = atol(get_text());
231 RecordRealTime::RecordRealTime(MWindow *mwindow,
232 PreferencesWindow *pwindow,
239 _("Record in realtime priority (root only)"))
241 this->pwindow = pwindow;
244 int RecordRealTime::handle_event()
246 pwindow->thread->edl->session->real_time_record = get_value();
250 RecordSampleRate::RecordSampleRate(PreferencesWindow *pwindow, int x, int y)
251 : BC_TextBox(x, y, 70, 1, pwindow->thread->edl->session->aconfig_in->in_samplerate)
253 this->pwindow = pwindow;
255 int RecordSampleRate::handle_event()
257 pwindow->thread->edl->session->aconfig_in->in_samplerate = atol(get_text());
262 // DuplexEnable::DuplexEnable(MWindow *mwindow, PreferencesWindow *pwindow, int x, int y, int value)
263 // : BC_CheckBox(x, y, value, _("Enable full duplex"))
264 // { this->pwindow = pwindow; }
266 // int DuplexEnable::handle_event()
268 // pwindow->thread->edl->session->enable_duplex = get_value();
273 RecordW::RecordW(PreferencesWindow *pwindow, int x, int y)
274 : BC_TextBox(x, y, 70, 1, pwindow->thread->edl->session->vconfig_in->w)
276 this->pwindow = pwindow;
278 int RecordW::handle_event()
280 pwindow->thread->edl->session->vconfig_in->w = atol(get_text());
284 RecordH::RecordH(PreferencesWindow *pwindow, int x, int y)
285 : BC_TextBox(x, y, 70, 1, pwindow->thread->edl->session->vconfig_in->h)
287 this->pwindow = pwindow;
289 int RecordH::handle_event()
291 pwindow->thread->edl->session->vconfig_in->h = atol(get_text());
295 RecordFrameRate::RecordFrameRate(PreferencesWindow *pwindow, int x, int y)
296 : BC_TextBox(x, y, 70, 1, pwindow->thread->edl->session->vconfig_in->in_framerate)
298 this->pwindow = pwindow;
300 int RecordFrameRate::handle_event()
302 pwindow->thread->edl->session->vconfig_in->in_framerate = atof(get_text());
308 RecordChannels::RecordChannels(PreferencesWindow *pwindow, BC_SubWindow *gui, int x, int y)
309 : BC_TumbleTextBox(gui,
310 pwindow->thread->edl->session->aconfig_in->channels,
317 this->pwindow = pwindow;
320 int RecordChannels::handle_event()
322 pwindow->thread->edl->session->aconfig_in->channels = atoi(get_text());
328 VideoWriteLength::VideoWriteLength(PreferencesWindow *pwindow, char *text, int y)
329 : BC_TextBox(260, y, 100, 1, text)
331 this->pwindow = pwindow;
334 int VideoWriteLength::handle_event()
336 pwindow->thread->edl->session->video_write_length = atol(get_text());
341 VideoCaptureLength::VideoCaptureLength(PreferencesWindow *pwindow, char *text, int y)
342 : BC_TextBox(260, y, 100, 1, text)
344 this->pwindow = pwindow;
347 int VideoCaptureLength::handle_event()
349 pwindow->thread->edl->session->vconfig_in->capture_length = atol(get_text());
353 CaptureLengthTumbler::CaptureLengthTumbler(PreferencesWindow *pwindow, BC_TextBox *text, int x, int y)
360 int CaptureLengthTumbler::handle_up_event()
362 int value = atol(text->get_text());
364 char string[BCTEXTLEN];
365 sprintf(string, "%d", value);
366 text->update(string);
367 text->handle_event();
371 int CaptureLengthTumbler::handle_down_event()
373 int value = atol(text->get_text());
375 value = MAX(1, value);
376 char string[BCTEXTLEN];
377 sprintf(string, "%d", value);
378 text->update(string);
379 text->handle_event();
385 RecordSoftwareTimer::RecordSoftwareTimer(PreferencesWindow *pwindow, int value, int x, int y)
386 : BC_CheckBox(x, y, value, _("Use software for positioning information"))
388 this->pwindow = pwindow;
391 int RecordSoftwareTimer::handle_event()
393 pwindow->thread->edl->session->record_software_position = get_value();
399 RecordSyncDrives::RecordSyncDrives(PreferencesWindow *pwindow, int value, int x, int y)
400 : BC_CheckBox(x, y, value, _("Sync drives automatically"))
402 this->pwindow = pwindow;
405 int RecordSyncDrives::handle_event()
407 pwindow->thread->edl->session->record_sync_drives = get_value();
411 StillImageUseDuration::StillImageUseDuration(PreferencesWindow *pwindow, int value, int x, int y)
412 : BC_CheckBox(x, y, value, _("Import images with a duration of"))
414 this->pwindow = pwindow;
417 int StillImageUseDuration::handle_event()
419 pwindow->thread->edl->session->si_useduration = get_value();
422 StillImageDuration::StillImageDuration(PreferencesWindow *pwindow, int x, int y)
423 : BC_TextBox(x, y, 70, 1, pwindow->thread->edl->session->si_duration)
425 this->pwindow = pwindow;
427 int StillImageDuration::handle_event()
429 pwindow->thread->edl->session->si_duration = atof(get_text());