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