Credit Andrew - fix vorbis audio which was scratchy and ensure aging plugin does...
[goodguy/cinelerra.git] / cinelerra-5.1 / cinelerra / lv2ui.C
1 /*
2  * CINELERRA
3  * Copyright (C) 2016-2020 William Morrow
4  *
5  * This program is free software; you can redistribute it and/or modify it
6  * under the terms of the GNU General Public License as published
7  * by the Free Software Foundation; either version 2 of the License, or
8  * (at your option) any later version.
9  *
10  * This program is distributed in the hope that it will be useful, but
11  * WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
13  * General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public
16  * License along with this program; if not, write to the Free Software
17  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
18  * USA
19  */
20
21 #include <stdio.h>
22 #include <signal.h>
23
24 #include <gtk/gtk.h>
25 #include <gdk/gdk.h>
26
27 #include "bcsignals.h"
28 #include "pluginlv2client.h"
29 #include "pluginlv2ui.h"
30
31 int main(int ac, char **av)
32 {
33 // to grab this task in the debugger
34 const char *cp = getenv("BUG");
35 static int zbug = !cp ? 0 : atoi(cp);  volatile int bug = zbug;
36 while( bug ) usleep(10000);
37         BC_WindowBase::init_resources(1);
38         BC_Signals signals;
39         if( getenv("BC_TRAP_LV2_SEGV") ) {
40                 signals.initialize("/tmp/lv2ui_%d.dmp");
41                 BC_Signals::set_catch_segv(1);
42         }
43         return PluginLV2ChildUI().run(ac, av);
44 }
45
46 int PluginLV2ChildUI::run(int ac, char **av)
47 {
48         this->ac = ac;
49         this->av = av;
50
51         if( ac > 3 ) {
52                 signal(SIGINT, SIG_IGN);
53                 ForkBase::child_fd = atoi(av[1]);
54                 ForkBase::parent_fd = atoi(av[2]);
55                 ForkBase::ppid = atoi(av[3]);
56         }
57         else {
58                 int sample_rate = samplerate, bfrsz = block_length;
59                 if( ac > 2 ) sample_rate = atoi(av[2]);
60                 if( init_ui(av[1], sample_rate, bfrsz) ) {
61                         fprintf(stderr," init_ui failed\n");
62                         return 1;
63                 }
64                 start_gui();
65         }
66         return run_ui();
67 }
68