1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218
|
/*
rakarrack - a guitar efects software
main.C - Main file of the organ
Copyright (C) 2008-2010 Josep Andreu
Author: Josep Andreu & Douglas McClendon
This program is free software; you can redistribute it and/or modify
it under the terms of version 2 of the GNU General Public License
as published by the Free Software Foundation.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License (version 2) for more details.
You should have received a copy of the GNU General Public License
(version2)
along with this program; if not, write to the Free Software Foundation,
Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include <getopt.h>
#include <sched.h>
#include <sys/mman.h>
#include <pthread.h>
#include "global.h"
#include "rakarrack.h"
#include "jack.h"
void
show_help ()
{
fprintf (stderr, "Usage: rakarrack [OPTION]\n\n");
fprintf (stderr,
" -h , --help \t\t\t display command-line help and exit\n");
fprintf (stderr, " -n , --no-gui \t\t\t disable GUI\n");
fprintf (stderr, " -l File, --load=File \t\t\t loads preset\n");
fprintf (stderr, " -b File, --bank=File \t\t\t loads bank\n");
fprintf (stderr, " -p #, --preset=# \t\t\t set preset\n");
fprintf (stderr, " -x, --dump-preset-names \t\t prints bank of preset names and IDs\n\n");
fprintf (stderr, "FLTK options are:\n\n");
fprintf (stderr, " -bg2 color\n");
fprintf (stderr, " -bg color\n");
fprintf (stderr, " -di[splay] host:n.n\n");
fprintf (stderr, " -dn[d]\n");
fprintf (stderr, " -fg color\n");
fprintf (stderr, " -g[eometry] WxH+X+Y\n");
fprintf (stderr, " -i[conic]\n");
fprintf (stderr, " -k[bd]\n");
fprintf (stderr, " -na[me] classname\n");
fprintf (stderr, " -nod[nd]\n");
fprintf (stderr, " -nok[bd]\n");
fprintf (stderr, " -not[ooltips]\n");
fprintf (stderr, " -s[cheme] scheme (plastic,none,gtk+)\n");
fprintf (stderr, " -ti[tle] windowtitle\n");
fprintf (stderr, " -to[oltips]\n");
fprintf (stderr, "\n");
}
int
main (int argc, char *argv[])
{
// Read command Line
fprintf (stderr,
"\n%s %s - Copyright (c) Josep Andreu - Ryan Billing - Douglas McClendon - Arnout Engelen\n",
PACKAGE, VERSION);
if (argc == 1)
fprintf (stderr, "Try 'rakarrack --help' for command-line options.\n");
struct option opts[] = {
{"load", 1, NULL, 'l'},
{"bank", 1, NULL, 'b'},
{"preset",1,NULL, 'p'},
{"no-gui", 0, NULL, 'n'},
{"dump-preset-names", 0, NULL, 'x'},
{"help", 0, NULL, 'h'},
{0, 0, 0, 0}
};
Pexitprogram = 0;
commandline = 0;
gui = 1;
opterr = 0;
int option_index = 0, opt;
RKR rkr;
if (nojack)
{
show_help ();
if (gui)
rkr.Message (1,"rakarrack error",
"Cannot make a jack client, is jackd running?");
return (0);
}
exitwithhelp = 0;
while (1)
{
opt = getopt_long (argc, argv, "l:b:p:nxh", opts, &option_index);
char *optarguments = optarg;
if (opt == -1)
break;
switch (opt)
{
case 'h':
exitwithhelp = 1;
break;
case 'n':
gui = 0;
break;
case 'l':
if (optarguments != NULL)
{
commandline = 1;
rkr.loadfile (optarguments);
break;
}
case 'b':
if (optarguments != NULL)
{
rkr.loadbank (optarguments);
break;
}
case 'p':
if(optarguments != NULL)
{
preset=atoi(optarguments);
break;
}
case 'x':
rkr.dump_preset_names ();
exit(1);
break;
}
}
if (exitwithhelp != 0)
{
show_help ();
return (0);
};
// Launch GUI
if (gui) new RKRGUI (argc, argv, &rkr);
JACKstart (&rkr, rkr.jackclient);
rkr.InitMIDI ();
rkr.ConnectMIDI ();
if (gui == 0)
{
rkr.Bypass = 1;
rkr.calculavol (1);
rkr.calculavol (2);
rkr.booster = 1.0f;
}
mlockall (MCL_CURRENT | MCL_FUTURE);
//Main Loop
while (Pexitprogram == 0)
{
// Refresh GUI
if (gui)
{
Fl::wait ();
}
else
{
usleep (1500);
if (preset != 1000)
{
if( (preset>0) && (preset<61)) rkr.Bank_to_Preset (preset);
preset = 1000;
}
}
rkr.miramidi ();
}
// free memory etc.
JACKfinish ();
return (0);
};
|