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