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();
52 // add_subwindow(new BC_Title(x, y, _("Duplex Driver:"), MEDIUMFONT, BLACK));
53 // duplex_device = new ADevicePrefs(x + 110,
57 // pwindow->thread->edl->session->aconfig_duplex,
60 // duplex_device->initialize();
62 // y += ADevicePrefs::get_h();
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));
70 // add_subwindow(new DuplexEnable(mwindow, pwindow, x, y, pwindow->thread->edl->session->enable_duplex));
72 add_subwindow(new RecordRealTime(mwindow, pwindow, x, y, pwindow->thread->edl->session->real_time_record));
74 add_subwindow(new BC_Title(x, y, _("Sample rate for recording:")));
76 add_subwindow(textbox = new RecordSampleRate(pwindow, x, y));
78 add_subwindow(new SampleRatePulldown(mwindow, textbox, x, y));
83 add_subwindow(new BC_Title(x, y, _("Video In"), LARGEFONT, BLACK));
86 add_subwindow(new BC_Title(x, y, _("Record Driver:"), MEDIUMFONT, BLACK));
87 video_in_device = new VDevicePrefs(x + 110,
92 pwindow->thread->edl->session->vconfig_in,
94 video_in_device->initialize();
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:")));
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:")));
108 add_subwindow(new RecordSoftwareTimer(pwindow,
109 pwindow->thread->edl->session->record_software_position,
113 add_subwindow(new RecordSyncDrives(pwindow,
114 pwindow->thread->edl->session->record_sync_drives,
119 BC_TextBox *w_text, *h_text;
120 add_subwindow(new BC_Title(x, y, _("Size of captured frame:")));
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"));
126 add_subwindow(h_text = new RecordH(pwindow, x, y));
127 x += h_text->get_w();
128 add_subwindow(new FrameSizePulldown(mwindow,
136 add_subwindow(new BC_Title(x, y, _("Frame rate for recording:")));
138 add_subwindow(textbox = new RecordFrameRate(pwindow, x, y));
140 add_subwindow(new FrameRatePulldown(mwindow, textbox, x, y));
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());
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());
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; }
189 // int DuplexEnable::handle_event()
191 // pwindow->thread->edl->session->enable_duplex = get_value();
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());
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());
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());
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());
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());
255 CaptureLengthTumbler::CaptureLengthTumbler(PreferencesWindow *pwindow, BC_TextBox *text, int x, int y)
262 int CaptureLengthTumbler::handle_up_event()
264 int value = atol(text->get_text());
266 char string[BCTEXTLEN];
267 sprintf(string, "%d", value);
268 text->update(string);
269 text->handle_event();
273 int CaptureLengthTumbler::handle_down_event()
275 int value = atol(text->get_text());
277 value = MAX(1, value);
278 char string[BCTEXTLEN];
279 sprintf(string, "%d", value);
280 text->update(string);
281 text->handle_event();
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();
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();