ddc75b2f0d744e7f46b6dde35b7218ef68b97d09
[goodguy/cinelerra.git] / cinelerra-5.1 / cinelerra / adeviceprefs.C
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 #include "adeviceprefs.h"
23 #include "audioalsa.h"
24 #include "audiodevice.inc"
25 #include "audiopulse.h"
26 #include "bcsignals.h"
27 #include "bitspopup.h"
28 #include "edl.h"
29 #include "language.h"
30 #include "mwindow.h"
31 #include "playbackconfig.h"
32 #include "preferences.h"
33 #include "preferencesthread.h"
34 #include "recordconfig.h"
35 #include "theme.h"
36 #include <string.h>
37
38 //#define DEVICE_H 50
39
40 ADevicePrefs::ADevicePrefs(int x, int y, PreferencesWindow *pwindow, PreferencesDialog *dialog,
41         AudioOutConfig *out_config, AudioInConfig *in_config, int mode)
42 {
43         reset();
44         this->pwindow = pwindow;
45         this->dialog = dialog;
46         this->driver = -1;
47         this->mode = mode;
48         this->out_config = out_config;
49         this->in_config = in_config;
50         this->x = x;
51         this->y = y;
52 }
53
54 ADevicePrefs::~ADevicePrefs()
55 {
56         delete_objects();
57         if(menu) delete menu;
58 }
59
60 void ADevicePrefs::reset()
61 {
62         menu = 0;
63         follow_audio_config = 0;
64         firewire_path = 0;
65         firewire_syt = 0;
66         channel_title = 0;
67         firewire_port = 0;
68         firewire_channel = 0;
69         syt_title = 0;
70         path_title = 0;
71
72         alsa_drivers = 0;
73         path_title = 0;
74         bits_title = 0;
75         alsa_device = 0;
76         alsa_workaround = 0;
77
78         alsa_bits = 0;
79         oss_bits = 0;
80         dvb_bits = 0;
81         v4l2_bits = 0;
82
83         for(int i = 0; i < MAXDEVICES; i++)
84                 oss_path[i] = 0;
85
86         dvb_adapter_title = 0;
87         dvb_adapter_path = 0;
88         dvb_device_title = 0;
89         dvb_adapter_device = 0;
90
91         cine_bits = 0;
92         cine_path = 0;
93         server_title = 0;
94         port_title = 0;
95         port = 0;
96 }
97
98 int ADevicePrefs::initialize(int creation)
99 {
100         int *driver = 0;
101         delete_objects();
102
103         switch(mode) {
104         case MODEPLAY:
105                 driver = &out_config->driver;
106                 break;
107         case MODERECORD:
108                 driver = &in_config->driver;
109                 break;
110         case MODEDUPLEX:
111                 driver = &out_config->driver;
112                 break;
113         }
114         this->driver = *driver;
115
116         if(!menu) {
117                 dialog->add_subwindow(menu = new ADriverMenu(x,
118                         y + yS(10), this, (mode == MODERECORD), driver));
119                 menu->create_objects();
120         }
121
122         switch(*driver) {
123         case AUDIO_OSS:
124         case AUDIO_OSS_ENVY24:
125                 create_oss_objs();
126                 break;
127         case AUDIO_ALSA:
128                 create_alsa_objs();
129                 break;
130         case AUDIO_PULSE:
131                 create_pulse_objs();
132                 break;
133         case AUDIO_ESOUND:
134                 create_esound_objs();
135                 break;
136         case AUDIO_1394:
137         case AUDIO_DV1394:
138         case AUDIO_IEC61883:
139                 create_firewire_objs();
140                 break;
141         case AUDIO_DVB:
142                 create_dvb_objs();
143                 break;
144         case AUDIO_V4L2MPEG:
145                 create_v4l2mpeg_objs();
146                 break;
147         }
148
149         return 0;
150 }
151
152 int ADevicePrefs::get_h(int recording)
153 {
154         int margin = pwindow->mwindow->theme->widget_border;
155         int result = BC_Title::calculate_h(dialog, "X", MEDIUMFONT) + margin +
156                 BC_TextBox::calculate_h(dialog, MEDIUMFONT, 1, 1);
157         if( !recording ) {
158                 result += BC_CheckBox::calculate_h(dialog) + margin;
159         }
160
161         return result;
162 }
163
164 int ADevicePrefs::delete_objects()
165 {
166         switch(driver) {
167         case AUDIO_OSS:
168         case AUDIO_OSS_ENVY24:
169                 delete_oss_objs();
170                 break;
171         case AUDIO_ALSA:
172                 delete_alsa_objs();
173                 break;
174         case AUDIO_PULSE:
175                 delete_pulse_objs();
176                 break;
177         case AUDIO_ESOUND:
178                 delete_esound_objs();
179                 break;
180         case AUDIO_1394:
181         case AUDIO_DV1394:
182         case AUDIO_IEC61883:
183                 delete_firewire_objs();
184                 break;
185         case AUDIO_DVB:
186                 delete_dvb_objs();
187                 break;
188         case AUDIO_V4L2MPEG:
189                 delete_v4l2mpeg_objs();
190                 break;
191         }
192
193         delete cine_bits;
194         delete cine_path;
195
196         reset();
197         driver = -1;
198         return 0;
199 }
200
201 int ADevicePrefs::delete_oss_objs()
202 {
203         delete path_title;
204         delete bits_title;
205         delete oss_bits;
206
207         for(int i = 0; i < MAXDEVICES; i++)
208                 delete oss_path[i];
209         return 0;
210 }
211
212 int ADevicePrefs::delete_esound_objs()
213 {
214         delete server_title;
215         delete server;
216         delete port_title;
217         delete port;
218         return 0;
219 }
220
221 int ADevicePrefs::delete_firewire_objs()
222 {
223         delete port_title;
224         delete channel_title;
225         delete firewire_port;
226         delete firewire_channel;
227         if(firewire_path)
228         {
229                 delete path_title;
230                 delete firewire_path;
231         }
232         firewire_path = 0;
233         if(firewire_syt)
234         {
235                 delete firewire_syt;
236                 delete syt_title;
237         }
238         firewire_syt = 0;
239         return 0;
240 }
241
242 int ADevicePrefs::delete_alsa_objs()
243 {
244 #ifdef HAVE_ALSA
245         if(alsa_drivers) alsa_drivers->remove_all_objects();
246         delete alsa_drivers;
247         delete path_title;
248         delete bits_title;
249         delete alsa_device;
250         delete alsa_bits;
251         delete alsa_workaround;
252 #endif
253         return 0;
254 }
255
256 int ADevicePrefs::delete_pulse_objs()
257 {
258 #ifdef HAVE_PULSE
259         delete server_title;
260         delete server;
261 #endif
262         return 0;
263 }
264
265 int ADevicePrefs::delete_dvb_objs()
266 {
267         delete dvb_adapter_title;
268         delete dvb_adapter_path;
269         delete dvb_device_title;
270         delete dvb_adapter_device;
271         delete dvb_bits;
272         delete follow_audio_config;
273         return 0;
274 }
275
276 int ADevicePrefs::delete_v4l2mpeg_objs()
277 {
278         delete follow_audio_config;
279         delete v4l2_bits;
280         return 0;
281 }
282
283 int ADevicePrefs::create_oss_objs()
284 {
285         char *output_char = 0;
286         int *output_int = 0;
287         int margin = pwindow->mwindow->theme->widget_border;
288         int y1 = y;
289         BC_Resources *resources = BC_WindowBase::get_resources();
290
291         for(int i = 0; i < MAXDEVICES; i++) {
292                 int x1 = x + menu->get_w() + xS(5);
293 #if 0
294                 switch(mode) {
295                 case MODEPLAY:
296                         output_int = &out_config->oss_enable[i];
297                         break;
298                 case MODERECORD:
299                         output_int = &in_config->oss_enable[i];
300                         break;
301                 case MODEDUPLEX:
302                         output_int = &out_config->oss_enable[i];
303                         break;
304                 }
305                 dialog->add_subwindow(oss_enable[i] = new OSSEnable(x1, y1 + yS(20), output_int));
306                 x1 += oss_enable[i]->get_w() + margin;
307 #endif
308                 switch(mode) {
309                 case MODEPLAY:
310                         output_char = out_config->oss_out_device[i];
311                         break;
312                 case MODERECORD:
313                         output_char = in_config->oss_in_device[i];
314                         break;
315                 case MODEDUPLEX:
316                         output_char = out_config->oss_out_device[i];
317                         break;
318                 }
319
320                 if(i == 0) {
321                         path_title = new BC_Title(x1, y, _("Device path:"),
322                                 MEDIUMFONT, resources->text_default);
323                         dialog->add_subwindow(path_title);
324                 }
325
326                 oss_path[i] = new ADeviceTextBox(
327                         x1, y1 + path_title->get_h() + margin, output_char);
328                 dialog->add_subwindow(oss_path[i]);
329                 x1 += oss_path[i]->get_w() + margin;
330                 if(i == 0) {
331                         switch(mode) {
332                         case MODEPLAY:
333                                 output_int = &out_config->oss_out_bits;
334                                 break;
335                         case MODERECORD:
336                                 output_int = &in_config->oss_in_bits;
337                                 break;
338                         case MODEDUPLEX:
339                                 output_int = &out_config->oss_out_bits;
340                                 break;
341                         }
342                         bits_title = new BC_Title(x1, y, _("Bits:"),
343                                         MEDIUMFONT, resources->text_default);
344                         dialog->add_subwindow(bits_title);
345                         oss_bits = new BitsPopup(dialog,
346                                 x1, y1 + bits_title->get_h() + margin, 
347                                 output_int, 0, 0, 0, 0, 1);
348                         oss_bits->create_objects();
349                 }
350
351                 x1 += oss_bits->get_w() + margin;
352 //              y1 += DEVICE_H;
353                 break;
354         }
355
356         return 0;
357 }
358
359 int ADevicePrefs::create_alsa_objs()
360 {
361 #ifdef HAVE_ALSA
362         char *output_char = 0;
363         int *output_int = 0;
364         int margin = pwindow->mwindow->theme->widget_border;
365         BC_Resources *resources = BC_WindowBase::get_resources();
366
367         int x1 = x + menu->get_w() + margin;
368         int y1 = y;
369
370         ArrayList<char*> *alsa_titles = new ArrayList<char*>;
371         alsa_titles->set_array_delete();
372         AudioALSA::list_devices(alsa_titles, 0, mode);
373
374         alsa_drivers = new ArrayList<BC_ListBoxItem*>;
375         for(int i = 0; i < alsa_titles->total; i++)
376                 alsa_drivers->append(new BC_ListBoxItem(alsa_titles->values[i]));
377         alsa_titles->remove_all_objects();
378         delete alsa_titles;
379
380         switch(mode) {
381         case MODEPLAY:
382                 output_char = out_config->alsa_out_device;
383                 break;
384         case MODERECORD:
385                 output_char = in_config->alsa_in_device;
386                 break;
387         case MODEDUPLEX:
388                 output_char = out_config->alsa_out_device;
389                 break;
390         }
391         path_title = new BC_Title(x1, y, _("Device:"),
392                         MEDIUMFONT, resources->text_default);
393         dialog->add_subwindow(path_title);
394         y1 += path_title->get_h() + margin;
395         alsa_device = new ALSADevice(dialog,
396                 x1, y1, output_char, alsa_drivers);
397         alsa_device->create_objects();
398         int x2 = x1;
399
400         x1 += alsa_device->get_w() + xS(5);
401         switch(mode) {
402         case MODEPLAY:
403                 output_int = &out_config->alsa_out_bits;
404                 break;
405         case MODERECORD:
406                 output_int = &in_config->alsa_in_bits;
407                 break;
408         case MODEDUPLEX:
409                 output_int = &out_config->alsa_out_bits;
410                 break;
411         }
412         bits_title = new BC_Title(x1, y, _("Bits:"),
413                         MEDIUMFONT, resources->text_default);
414         dialog->add_subwindow(bits_title);
415         y1 = y + bits_title->get_h() + margin;
416         alsa_bits = new BitsPopup(dialog,
417                         x1, y1, output_int, 0, 0, 0, 0, 1);
418         alsa_bits->create_objects();
419
420         y1 += alsa_bits->get_h();
421         x1 = x2;
422
423         if(mode == MODEPLAY) {
424                 alsa_workaround = new BC_CheckBox(x1, y1,
425                                 &out_config->interrupt_workaround,
426                                 _("Stop playback locks up."));
427                 dialog->add_subwindow(alsa_workaround);
428         }
429 #endif
430         return 0;
431 }
432
433 int ADevicePrefs::create_esound_objs()
434 {
435         int x1 = x + menu->get_w() + xS(5);
436         char *output_char = 0;
437         int *output_int = 0;
438         BC_Resources *resources = BC_WindowBase::get_resources();
439
440         switch(mode) {
441         case MODEPLAY:
442                 output_char = out_config->esound_out_server;
443                 break;
444         case MODERECORD:
445                 output_char = in_config->esound_in_server;
446                 break;
447         case MODEDUPLEX:
448                 output_char = out_config->esound_out_server;
449                 break;
450         }
451         server_title = new BC_Title(x1, y, _("Server:"),
452                         MEDIUMFONT, resources->text_default);
453         dialog->add_subwindow(server_title);
454         server = new ADeviceTextBox(x1, y + yS(20), output_char);
455         dialog->add_subwindow(server);
456
457         switch(mode) {
458         case MODEPLAY:
459                 output_int = &out_config->esound_out_port;
460                 break;
461         case MODERECORD:
462                 output_int = &in_config->esound_in_port;
463                 break;
464         case MODEDUPLEX:
465                 output_int = &out_config->esound_out_port;
466                 break;
467         }
468         x1 += server->get_w() + xS(5);
469         port_title = new BC_Title(x1, y, _("Port:"),
470                         MEDIUMFONT, resources->text_default);
471         dialog->add_subwindow(port_title);
472         port = new ADeviceIntBox(x1, y + yS(20), output_int);
473         dialog->add_subwindow(port);
474         return 0;
475 }
476
477 int ADevicePrefs::create_firewire_objs()
478 {
479         int xs5 = xS(5);
480         int ys20 = yS(20);
481         int x1 = x + menu->get_w() + xs5;
482         int *output_int = 0;
483         char *output_char = 0;
484         BC_Resources *resources = BC_WindowBase::get_resources();
485
486 // Firewire path
487         switch(mode) {
488         case MODEPLAY:
489                 if(driver == AUDIO_DV1394)
490                         output_char = out_config->dv1394_path;
491                 else
492                 if(driver == AUDIO_1394)
493                         output_char = out_config->firewire_path;
494                 break;
495         case MODERECORD:
496                 if(driver == AUDIO_DV1394 || driver == AUDIO_1394)
497                         output_char = in_config->firewire_path;
498                 break;
499         }
500
501         if(output_char) {
502                 dialog->add_subwindow(path_title = new BC_Title(x1, y, _("Device Path:"), MEDIUMFONT, resources->text_default));
503                 dialog->add_subwindow(firewire_path = new ADeviceTextBox(x1, y + ys20, output_char));
504                 x1 += firewire_path->get_w() + xs5;
505         }
506
507 // Firewire port
508         switch(mode) {
509         case MODEPLAY:
510                 if(driver == AUDIO_DV1394)
511                         output_int = &out_config->dv1394_port;
512                 else
513                         output_int = &out_config->firewire_port;
514                 break;
515         case MODERECORD:
516                 output_int = &in_config->firewire_port;
517                 break;
518         case MODEDUPLEX:
519 //              output_int = &out_config->afirewire_out_port;
520                 break;
521         }
522         port_title = new BC_Title(x1, y, _("Port:"),
523                         MEDIUMFONT, resources->text_default);
524         dialog->add_subwindow(port_title);
525         firewire_port = new ADeviceIntBox(x1, y + ys20, output_int);
526         dialog->add_subwindow(firewire_port);
527
528         x1 += firewire_port->get_w() + xs5;
529
530 // Firewire channel
531         switch(mode) {
532         case MODEPLAY:
533                 if(driver == AUDIO_DV1394)
534                         output_int = &out_config->dv1394_channel;
535                 else
536                         output_int = &out_config->firewire_channel;
537                 break;
538         case MODERECORD:
539                 output_int = &in_config->firewire_channel;
540                 break;
541         }
542         channel_title = new BC_Title(x1, y, _("Channel:"),
543                         MEDIUMFONT, resources->text_default);
544         dialog->add_subwindow(channel_title);
545         firewire_channel = new ADeviceIntBox(x1, y + ys20, output_int);
546         dialog->add_subwindow(firewire_channel);
547         x1 += firewire_channel->get_w() + xs5;
548
549 // Syt offset
550         switch(mode) {
551         case MODEPLAY:
552                 if(driver == AUDIO_DV1394)
553                         output_int = &out_config->dv1394_syt;
554                 else
555                 if(driver == AUDIO_1394)
556                         output_int = &out_config->firewire_syt;
557                 else
558                         output_int = 0;
559                 break;
560         case MODERECORD:
561                 output_int = 0;
562                 break;
563         }
564
565         if(output_int) {
566                 syt_title = new BC_Title(x1, y, _("Syt Offset:"),
567                                 MEDIUMFONT, resources->text_default);
568                 dialog->add_subwindow(syt_title);
569                 firewire_syt = new ADeviceIntBox(x1, y + ys20, output_int);
570                 dialog->add_subwindow(firewire_syt);
571                 x1 += firewire_syt->get_w() + xs5;
572         }
573
574         return 0;
575 }
576
577
578
579 int ADevicePrefs::create_dvb_objs()
580 {
581         int x1 = x + menu->get_w() + xS(30);
582         int y1 = y + yS(10);
583         char *output_char = in_config->dvb_in_adapter;
584         int y2 = y1 - BC_Title::calculate_h(dialog, _("DVB Adapter:"), MEDIUMFONT) - yS(5);
585         BC_Resources *resources = BC_WindowBase::get_resources();
586         dvb_adapter_title = new BC_Title(x1, y2, _("DVB Adapter:"),
587                         MEDIUMFONT, resources->text_default);
588         dialog->add_subwindow(dvb_adapter_title);
589         dvb_adapter_path = new ADeviceTextBox(x1, y1, output_char);
590         dialog->add_subwindow(dvb_adapter_path);
591         int x2 = x1 + dvb_adapter_path->get_w() + xS(5);
592         dvb_device_title = new BC_Title(x2, y2, _("dev:"),
593                         MEDIUMFONT, resources->text_default);
594         dialog->add_subwindow(dvb_device_title);
595         int *output_int = &in_config->dvb_in_device;
596         dvb_adapter_device = new ADeviceTumbleBox(this, x2, y1, output_int, 0, 9, xS(20));
597         dvb_adapter_device->create_objects();
598         x2 += dvb_device_title->get_w() + xS(30);
599         bits_title = new BC_Title(x2, y2, _("Bits:"),
600                         MEDIUMFONT, resources->text_default);
601         dialog->add_subwindow(bits_title);
602         output_int = &in_config->dvb_in_bits;
603         dvb_bits = new BitsPopup(dialog, x2, y1, output_int, 0, 0, 0, 0, 1);
604         dvb_bits->create_objects();
605         x1 += xS(100);  y1 += dvb_adapter_path->get_h() + yS(5);
606         output_int =  &in_config->follow_audio;
607         follow_audio_config = new BC_CheckBox(x1, y1, output_int, _("Follow audio config"));
608         dialog->add_subwindow(follow_audio_config);
609         return 0;
610 }
611
612 int ADevicePrefs::create_v4l2mpeg_objs()
613 {
614         int x1 = x + menu->get_w() + xS(30);
615         int y1 = y + yS(10);
616         int y2 = y1 - BC_Title::calculate_h(dialog, _("Bits:"), MEDIUMFONT) - yS(5);
617         BC_Resources *resources = BC_WindowBase::get_resources();
618         bits_title = new BC_Title(x1, y2, _("Bits:"),
619                         MEDIUMFONT, resources->text_default);
620         dialog->add_subwindow(bits_title);
621         int *output_int = &in_config->v4l2_in_bits;
622         v4l2_bits = new BitsPopup(dialog, x1, y1, output_int, 0, 0, 0, 0, 1);
623         v4l2_bits->create_objects();
624         x1 += v4l2_bits->get_w() + xS(10);
625         follow_audio_config = new BC_CheckBox(x1, y1,
626                         &in_config->follow_audio, _("Follow audio config"));
627         dialog->add_subwindow(follow_audio_config);
628         return 0;
629 }
630
631
632 int ADevicePrefs::create_pulse_objs()
633 {
634 #ifdef HAVE_PULSE
635         char *output_char = 0;
636         switch(mode) {
637         case MODEPLAY:
638                 output_char = out_config->pulse_out_server;
639                 break;
640         case MODERECORD:
641                 output_char = in_config->pulse_in_server;
642                 break;
643         }
644         int x1 = x, y1 = y;
645         x1 += menu->get_w() + xS(5);
646         dialog->add_subwindow(server_title = new BC_Title(x1, y1,
647                 _("Server (blank for default):")));
648         y1 += server_title->get_h() + yS(5);
649         dialog->add_subwindow(server = new ADeviceTextBox(x1, y1, output_char));
650 #endif
651         return 0;
652 }
653
654
655 ADriverMenu::ADriverMenu(int x, int y, ADevicePrefs *device_prefs,
656         int do_input, int *output)
657  : BC_PopupMenu(x, y, xS(125), adriver_to_string(*output), 1)
658 {
659         this->output = output;
660         this->do_input = do_input;
661         this->device_prefs = device_prefs;
662 }
663
664 ADriverMenu::~ADriverMenu()
665 {
666 }
667
668 void ADriverMenu::create_objects()
669 {
670 #ifdef HAVE_ALSA
671         add_item(new ADriverItem(this, AUDIO_ALSA_TITLE, AUDIO_ALSA));
672 #endif
673
674 #ifdef HAVE_OSS
675         add_item(new ADriverItem(this, AUDIO_OSS_TITLE, AUDIO_OSS));
676         add_item(new ADriverItem(this, AUDIO_OSS_ENVY24_TITLE, AUDIO_OSS_ENVY24));
677 #endif
678
679 #ifdef HAVE_ESOUND
680         if(!do_input) add_item(new ADriverItem(this, AUDIO_ESOUND_TITLE, AUDIO_ESOUND));
681 #endif
682
683 #ifdef HAVE_FIREWIRE
684         if(!do_input) add_item(new ADriverItem(this, AUDIO_1394_TITLE, AUDIO_1394));
685         add_item(new ADriverItem(this, AUDIO_DV1394_TITLE, AUDIO_DV1394));
686         add_item(new ADriverItem(this, AUDIO_IEC61883_TITLE, AUDIO_IEC61883));
687 #endif
688
689 #ifdef HAVE_DVB
690         if(do_input) add_item(new ADriverItem(this, AUDIO_DVB_TITLE, AUDIO_DVB));
691 #endif
692
693 #ifdef HAVE_VIDEO4LINUX2
694         if(do_input) add_item(new ADriverItem(this, AUDIO_V4L2MPEG_TITLE, AUDIO_V4L2MPEG));
695 #endif
696 #ifdef HAVE_PULSE
697         add_item(new ADriverItem(this, AUDIO_PULSE_TITLE, AUDIO_PULSE));
698 #endif
699 }
700
701 char* ADriverMenu::adriver_to_string(int driver)
702 {
703         switch(driver) {
704         case AUDIO_OSS:
705                 sprintf(string, AUDIO_OSS_TITLE);
706                 break;
707         case AUDIO_OSS_ENVY24:
708                 sprintf(string, AUDIO_OSS_ENVY24_TITLE);
709                 break;
710         case AUDIO_ESOUND:
711                 sprintf(string, AUDIO_ESOUND_TITLE);
712                 break;
713         case AUDIO_PULSE:
714                 sprintf(string, AUDIO_PULSE_TITLE);
715                 break;
716         case AUDIO_NAS:
717                 sprintf(string, AUDIO_NAS_TITLE);
718                 break;
719         case AUDIO_ALSA:
720                 sprintf(string, AUDIO_ALSA_TITLE);
721                 break;
722 #ifdef HAVE_FIREWIRE
723         case AUDIO_1394:
724                 sprintf(string, AUDIO_1394_TITLE);
725                 break;
726         case AUDIO_DV1394:
727                 sprintf(string, AUDIO_DV1394_TITLE);
728                 break;
729         case AUDIO_IEC61883:
730                 sprintf(string, AUDIO_IEC61883_TITLE);
731                 break;
732 #endif
733         case AUDIO_DVB:
734                 sprintf(string, AUDIO_DVB_TITLE);
735                 break;
736         case AUDIO_V4L2MPEG:
737                 sprintf(string, AUDIO_V4L2MPEG_TITLE);
738                 break;
739         }
740         return string;
741 }
742
743 ADriverItem::ADriverItem(ADriverMenu *popup, const char *text, int driver)
744  : BC_MenuItem(text)
745 {
746         this->popup = popup;
747         this->driver = driver;
748 }
749
750 ADriverItem::~ADriverItem()
751 {
752 }
753
754 int ADriverItem::handle_event()
755 {
756         popup->set_text(get_text());
757         *(popup->output) = driver;
758         popup->device_prefs->initialize(0);
759         popup->device_prefs->pwindow->show_dialog();
760         return 1;
761 }
762
763
764
765
766 OSSEnable::OSSEnable(int x, int y, int *output)
767  : BC_CheckBox(x, y, *output)
768 {
769         this->output = output;
770 }
771 int OSSEnable::handle_event()
772 {
773         *output = get_value();
774         return 1;
775 }
776
777
778
779
780 ADeviceTextBox::ADeviceTextBox(int x, int y, char *output)
781  : BC_TextBox(x, y, xS(150), 1, output)
782 {
783         this->output = output;
784 }
785
786 int ADeviceTextBox::handle_event()
787 {
788         strcpy(output, get_text());
789         return 1;
790 }
791
792 ADeviceIntBox::ADeviceIntBox(int x, int y, int *output)
793  : BC_TextBox(x, y, xS(80), 1, *output)
794 {
795         this->output = output;
796 }
797
798 int ADeviceIntBox::handle_event()
799 {
800         *output = atol(get_text());
801         return 1;
802 }
803
804
805
806 ADeviceTumbleBox::ADeviceTumbleBox(ADevicePrefs *prefs,
807         int x, int y, int *output, int min, int max, int text_w)
808  : BC_TumbleTextBox(prefs->dialog, *output, min, max, x, y, text_w)
809 {
810         this->output = output;
811 }
812
813 int ADeviceTumbleBox::handle_event()
814 {
815         *output = atol(get_text());
816         return 1;
817 }
818
819
820
821 ALSADevice::ALSADevice(PreferencesDialog *dialog,
822         int x,
823         int y,
824         char *output,
825         ArrayList<BC_ListBoxItem*> *devices)
826  : BC_PopupTextBox(dialog, devices, output, x, y, xS(200), yS(200))
827 {
828         this->output = output;
829 }
830
831 ALSADevice::~ALSADevice()
832 {
833 }
834
835 int ALSADevice::handle_event()
836 {
837         strcpy(output, get_text());
838         return 1;
839 }
840