X-Git-Url: https://git.cinelerra-gg.org/git/?a=blobdiff_plain;f=cinelerra-5.1%2Fcinelerra%2Fadeviceprefs.C;h=ddc75b2f0d744e7f46b6dde35b7218ef68b97d09;hb=87a3d09b0344fd6b60851161cbf250111301a63f;hp=d93cef30551aa45cb63b1eafa19323d4bc6075a7;hpb=7fd85fb66168f6b518c5f2d73e04036e87faa0e1;p=goodguy%2Fcinelerra.git diff --git a/cinelerra-5.1/cinelerra/adeviceprefs.C b/cinelerra-5.1/cinelerra/adeviceprefs.C index d93cef30..ddc75b2f 100644 --- a/cinelerra-5.1/cinelerra/adeviceprefs.C +++ b/cinelerra-5.1/cinelerra/adeviceprefs.C @@ -22,6 +22,7 @@ #include "adeviceprefs.h" #include "audioalsa.h" #include "audiodevice.inc" +#include "audiopulse.h" #include "bcsignals.h" #include "bitspopup.h" #include "edl.h" @@ -62,6 +63,9 @@ void ADevicePrefs::reset() follow_audio_config = 0; firewire_path = 0; firewire_syt = 0; + channel_title = 0; + firewire_port = 0; + firewire_channel = 0; syt_title = 0; path_title = 0; @@ -86,6 +90,9 @@ void ADevicePrefs::reset() cine_bits = 0; cine_path = 0; + server_title = 0; + port_title = 0; + port = 0; } int ADevicePrefs::initialize(int creation) @@ -108,10 +115,7 @@ int ADevicePrefs::initialize(int creation) if(!menu) { dialog->add_subwindow(menu = new ADriverMenu(x, - y + 10, - this, - (mode == MODERECORD), - driver)); + y + yS(10), this, (mode == MODERECORD), driver)); menu->create_objects(); } @@ -123,6 +127,9 @@ int ADevicePrefs::initialize(int creation) case AUDIO_ALSA: create_alsa_objs(); break; + case AUDIO_PULSE: + create_pulse_objs(); + break; case AUDIO_ESOUND: create_esound_objs(); break; @@ -164,8 +171,11 @@ int ADevicePrefs::delete_objects() case AUDIO_ALSA: delete_alsa_objs(); break; + case AUDIO_PULSE: + delete_pulse_objs(); + break; case AUDIO_ESOUND: - delete_esound_objs(); + delete_esound_objs(); break; case AUDIO_1394: case AUDIO_DV1394: @@ -202,9 +212,9 @@ int ADevicePrefs::delete_oss_objs() int ADevicePrefs::delete_esound_objs() { delete server_title; + delete server; delete port_title; - delete esound_server; - delete esound_port; + delete port; return 0; } @@ -243,6 +253,15 @@ int ADevicePrefs::delete_alsa_objs() return 0; } +int ADevicePrefs::delete_pulse_objs() +{ +#ifdef HAVE_PULSE + delete server_title; + delete server; +#endif + return 0; +} + int ADevicePrefs::delete_dvb_objs() { delete dvb_adapter_title; @@ -270,7 +289,7 @@ int ADevicePrefs::create_oss_objs() BC_Resources *resources = BC_WindowBase::get_resources(); for(int i = 0; i < MAXDEVICES; i++) { - int x1 = x + menu->get_w() + 5; + int x1 = x + menu->get_w() + xS(5); #if 0 switch(mode) { case MODEPLAY: @@ -283,7 +302,7 @@ int ADevicePrefs::create_oss_objs() output_int = &out_config->oss_enable[i]; break; } - dialog->add_subwindow(oss_enable[i] = new OSSEnable(x1, y1 + 20, output_int)); + dialog->add_subwindow(oss_enable[i] = new OSSEnable(x1, y1 + yS(20), output_int)); x1 += oss_enable[i]->get_w() + margin; #endif switch(mode) { @@ -378,7 +397,7 @@ int ADevicePrefs::create_alsa_objs() alsa_device->create_objects(); int x2 = x1; - x1 += alsa_device->get_w() + 5; + x1 += alsa_device->get_w() + xS(5); switch(mode) { case MODEPLAY: output_int = &out_config->alsa_out_bits; @@ -407,15 +426,13 @@ int ADevicePrefs::create_alsa_objs() _("Stop playback locks up.")); dialog->add_subwindow(alsa_workaround); } - #endif - return 0; } int ADevicePrefs::create_esound_objs() { - int x1 = x + menu->get_w() + 5; + int x1 = x + menu->get_w() + xS(5); char *output_char = 0; int *output_int = 0; BC_Resources *resources = BC_WindowBase::get_resources(); @@ -434,8 +451,8 @@ int ADevicePrefs::create_esound_objs() server_title = new BC_Title(x1, y, _("Server:"), MEDIUMFONT, resources->text_default); dialog->add_subwindow(server_title); - esound_server = new ADeviceTextBox(x1, y + 20, output_char); - dialog->add_subwindow(esound_server); + server = new ADeviceTextBox(x1, y + yS(20), output_char); + dialog->add_subwindow(server); switch(mode) { case MODEPLAY: @@ -448,18 +465,20 @@ int ADevicePrefs::create_esound_objs() output_int = &out_config->esound_out_port; break; } - x1 += esound_server->get_w() + 5; + x1 += server->get_w() + xS(5); port_title = new BC_Title(x1, y, _("Port:"), MEDIUMFONT, resources->text_default); dialog->add_subwindow(port_title); - esound_port = new ADeviceIntBox(x1, y + 20, output_int); - dialog->add_subwindow(esound_port); + port = new ADeviceIntBox(x1, y + yS(20), output_int); + dialog->add_subwindow(port); return 0; } int ADevicePrefs::create_firewire_objs() { - int x1 = x + menu->get_w() + 5; + int xs5 = xS(5); + int ys20 = yS(20); + int x1 = x + menu->get_w() + xs5; int *output_int = 0; char *output_char = 0; BC_Resources *resources = BC_WindowBase::get_resources(); @@ -481,8 +500,8 @@ int ADevicePrefs::create_firewire_objs() if(output_char) { dialog->add_subwindow(path_title = new BC_Title(x1, y, _("Device Path:"), MEDIUMFONT, resources->text_default)); - dialog->add_subwindow(firewire_path = new ADeviceTextBox(x1, y + 20, output_char)); - x1 += firewire_path->get_w() + 5; + dialog->add_subwindow(firewire_path = new ADeviceTextBox(x1, y + ys20, output_char)); + x1 += firewire_path->get_w() + xs5; } // Firewire port @@ -503,10 +522,10 @@ int ADevicePrefs::create_firewire_objs() port_title = new BC_Title(x1, y, _("Port:"), MEDIUMFONT, resources->text_default); dialog->add_subwindow(port_title); - firewire_port = new ADeviceIntBox(x1, y + 20, output_int); + firewire_port = new ADeviceIntBox(x1, y + ys20, output_int); dialog->add_subwindow(firewire_port); - x1 += firewire_port->get_w() + 5; + x1 += firewire_port->get_w() + xs5; // Firewire channel switch(mode) { @@ -523,9 +542,9 @@ int ADevicePrefs::create_firewire_objs() channel_title = new BC_Title(x1, y, _("Channel:"), MEDIUMFONT, resources->text_default); dialog->add_subwindow(channel_title); - firewire_channel = new ADeviceIntBox(x1, y + 20, output_int); + firewire_channel = new ADeviceIntBox(x1, y + ys20, output_int); dialog->add_subwindow(firewire_channel); - x1 += firewire_channel->get_w() + 5; + x1 += firewire_channel->get_w() + xs5; // Syt offset switch(mode) { @@ -547,9 +566,9 @@ int ADevicePrefs::create_firewire_objs() syt_title = new BC_Title(x1, y, _("Syt Offset:"), MEDIUMFONT, resources->text_default); dialog->add_subwindow(syt_title); - firewire_syt = new ADeviceIntBox(x1, y + 20, output_int); + firewire_syt = new ADeviceIntBox(x1, y + ys20, output_int); dialog->add_subwindow(firewire_syt); - x1 += firewire_syt->get_w() + 5; + x1 += firewire_syt->get_w() + xs5; } return 0; @@ -559,31 +578,31 @@ int ADevicePrefs::create_firewire_objs() int ADevicePrefs::create_dvb_objs() { - int x1 = x + menu->get_w() + 30; - int y1 = y + 10; + int x1 = x + menu->get_w() + xS(30); + int y1 = y + yS(10); char *output_char = in_config->dvb_in_adapter; - int y2 = y1 - BC_Title::calculate_h(dialog, _("DVB Adapter:"), MEDIUMFONT) - 5; + int y2 = y1 - BC_Title::calculate_h(dialog, _("DVB Adapter:"), MEDIUMFONT) - yS(5); BC_Resources *resources = BC_WindowBase::get_resources(); dvb_adapter_title = new BC_Title(x1, y2, _("DVB Adapter:"), MEDIUMFONT, resources->text_default); dialog->add_subwindow(dvb_adapter_title); dvb_adapter_path = new ADeviceTextBox(x1, y1, output_char); dialog->add_subwindow(dvb_adapter_path); - int x2 = x1 + dvb_adapter_path->get_w() + 5; + int x2 = x1 + dvb_adapter_path->get_w() + xS(5); dvb_device_title = new BC_Title(x2, y2, _("dev:"), MEDIUMFONT, resources->text_default); dialog->add_subwindow(dvb_device_title); int *output_int = &in_config->dvb_in_device; - dvb_adapter_device = new ADeviceTumbleBox(this, x2, y1, output_int, 0, 9, 20); + dvb_adapter_device = new ADeviceTumbleBox(this, x2, y1, output_int, 0, 9, xS(20)); dvb_adapter_device->create_objects(); - x2 += dvb_device_title->get_w() + 30; + x2 += dvb_device_title->get_w() + xS(30); bits_title = new BC_Title(x2, y2, _("Bits:"), MEDIUMFONT, resources->text_default); dialog->add_subwindow(bits_title); output_int = &in_config->dvb_in_bits; dvb_bits = new BitsPopup(dialog, x2, y1, output_int, 0, 0, 0, 0, 1); dvb_bits->create_objects(); - x1 += 100; y1 += dvb_adapter_path->get_h() + 5; + x1 += xS(100); y1 += dvb_adapter_path->get_h() + yS(5); output_int = &in_config->follow_audio; follow_audio_config = new BC_CheckBox(x1, y1, output_int, _("Follow audio config")); dialog->add_subwindow(follow_audio_config); @@ -592,9 +611,9 @@ int ADevicePrefs::create_dvb_objs() int ADevicePrefs::create_v4l2mpeg_objs() { - int x1 = x + menu->get_w() + 30; - int y1 = y + 10; - int y2 = y1 - BC_Title::calculate_h(dialog, _("Bits:"), MEDIUMFONT) - 5; + int x1 = x + menu->get_w() + xS(30); + int y1 = y + yS(10); + int y2 = y1 - BC_Title::calculate_h(dialog, _("Bits:"), MEDIUMFONT) - yS(5); BC_Resources *resources = BC_WindowBase::get_resources(); bits_title = new BC_Title(x1, y2, _("Bits:"), MEDIUMFONT, resources->text_default); @@ -602,7 +621,7 @@ int ADevicePrefs::create_v4l2mpeg_objs() int *output_int = &in_config->v4l2_in_bits; v4l2_bits = new BitsPopup(dialog, x1, y1, output_int, 0, 0, 0, 0, 1); v4l2_bits->create_objects(); - x1 += v4l2_bits->get_w() + 10; + x1 += v4l2_bits->get_w() + xS(10); follow_audio_config = new BC_CheckBox(x1, y1, &in_config->follow_audio, _("Follow audio config")); dialog->add_subwindow(follow_audio_config); @@ -610,9 +629,32 @@ int ADevicePrefs::create_v4l2mpeg_objs() } +int ADevicePrefs::create_pulse_objs() +{ +#ifdef HAVE_PULSE + char *output_char = 0; + switch(mode) { + case MODEPLAY: + output_char = out_config->pulse_out_server; + break; + case MODERECORD: + output_char = in_config->pulse_in_server; + break; + } + int x1 = x, y1 = y; + x1 += menu->get_w() + xS(5); + dialog->add_subwindow(server_title = new BC_Title(x1, y1, + _("Server (blank for default):"))); + y1 += server_title->get_h() + yS(5); + dialog->add_subwindow(server = new ADeviceTextBox(x1, y1, output_char)); +#endif + return 0; +} + + ADriverMenu::ADriverMenu(int x, int y, ADevicePrefs *device_prefs, int do_input, int *output) - : BC_PopupMenu(x, y, 125, adriver_to_string(*output), 1) + : BC_PopupMenu(x, y, xS(125), adriver_to_string(*output), 1) { this->output = output; this->do_input = do_input; @@ -651,6 +693,9 @@ void ADriverMenu::create_objects() #ifdef HAVE_VIDEO4LINUX2 if(do_input) add_item(new ADriverItem(this, AUDIO_V4L2MPEG_TITLE, AUDIO_V4L2MPEG)); #endif +#ifdef HAVE_PULSE + add_item(new ADriverItem(this, AUDIO_PULSE_TITLE, AUDIO_PULSE)); +#endif } char* ADriverMenu::adriver_to_string(int driver) @@ -665,6 +710,9 @@ char* ADriverMenu::adriver_to_string(int driver) case AUDIO_ESOUND: sprintf(string, AUDIO_ESOUND_TITLE); break; + case AUDIO_PULSE: + sprintf(string, AUDIO_PULSE_TITLE); + break; case AUDIO_NAS: sprintf(string, AUDIO_NAS_TITLE); break; @@ -730,7 +778,7 @@ int OSSEnable::handle_event() ADeviceTextBox::ADeviceTextBox(int x, int y, char *output) - : BC_TextBox(x, y, 150, 1, output) + : BC_TextBox(x, y, xS(150), 1, output) { this->output = output; } @@ -742,7 +790,7 @@ int ADeviceTextBox::handle_event() } ADeviceIntBox::ADeviceIntBox(int x, int y, int *output) - : BC_TextBox(x, y, 80, 1, *output) + : BC_TextBox(x, y, xS(80), 1, *output) { this->output = output; } @@ -775,7 +823,7 @@ ALSADevice::ALSADevice(PreferencesDialog *dialog, int y, char *output, ArrayList *devices) - : BC_PopupTextBox(dialog, devices, output, x, y, 200, 200) + : BC_PopupTextBox(dialog, devices, output, x, y, xS(200), yS(200)) { this->output = output; }