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