41 |
bool bPrintStatistics = false; |
bool bPrintStatistics = false; |
42 |
bool profile = false; |
bool profile = false; |
43 |
bool tune = true; |
bool tune = true; |
44 |
|
unsigned long int lscp_addr; |
45 |
|
unsigned short int lscp_port; |
46 |
|
|
47 |
void parse_options(int argc, char **argv); |
void parse_options(int argc, char **argv); |
48 |
void signal_handler(int signal); |
void signal_handler(int signal); |
71 |
sigaction(SIGUSR1, &sact, NULL); |
sigaction(SIGUSR1, &sact, NULL); |
72 |
sigaction(SIGUSR2, &sact, NULL); |
sigaction(SIGUSR2, &sact, NULL); |
73 |
|
|
74 |
|
lscp_addr = htonl(LSCP_ADDR); |
75 |
|
lscp_port = htons(LSCP_PORT); |
76 |
|
|
77 |
// parse and assign command line options |
// parse and assign command line options |
78 |
parse_options(argc, argv); |
parse_options(argc, argv); |
79 |
|
|
98 |
dmsg(1,("Registered audio output drivers: %s\n", AudioOutputDeviceFactory::AvailableDriversAsString().c_str())); |
dmsg(1,("Registered audio output drivers: %s\n", AudioOutputDeviceFactory::AvailableDriversAsString().c_str())); |
99 |
|
|
100 |
// start LSCP network server |
// start LSCP network server |
101 |
dmsg(1,("Starting LSCP network server (on TCP port %d)...", LSCP_PORT)); |
struct in_addr addr; |
102 |
pLSCPServer = new LSCPServer(pSampler); |
addr.s_addr = lscp_addr; |
103 |
|
dmsg(1,("Starting LSCP network server (%s:%d)...", inet_ntoa(addr), ntohs(lscp_port))); |
104 |
|
pLSCPServer = new LSCPServer(pSampler, lscp_addr, lscp_port); |
105 |
pLSCPServer->StartThread(); |
pLSCPServer->StartThread(); |
106 |
pLSCPServer->WaitUntilInitialized(); |
pLSCPServer->WaitUntilInitialized(); |
107 |
dmsg(1,("OK\n")); |
dmsg(1,("OK\n")); |
229 |
{"profile",0,0,0}, |
{"profile",0,0,0}, |
230 |
{"no-tune",0,0,0}, |
{"no-tune",0,0,0}, |
231 |
{"statistics",0,0,0}, |
{"statistics",0,0,0}, |
232 |
|
{"lscp-addr",1,0,0}, |
233 |
|
{"lscp-port",1,0,0}, |
234 |
{0,0,0,0} |
{0,0,0,0} |
235 |
}; |
}; |
236 |
|
|
249 |
printf("--version prints version information\n"); |
printf("--version prints version information\n"); |
250 |
printf("--profile profile synthesis algorithms\n"); |
printf("--profile profile synthesis algorithms\n"); |
251 |
printf("--no-tune disable assembly optimization\n"); |
printf("--no-tune disable assembly optimization\n"); |
252 |
printf("--statistics prints periodically statistics\n"); |
printf("--statistics periodically prints statistics\n"); |
253 |
|
printf("--lscp-addr set LSCP address (default: any)\n"); |
254 |
|
printf("--lscp-port set LSCP port (default: 8888)\n"); |
255 |
exit(EXIT_SUCCESS); |
exit(EXIT_SUCCESS); |
256 |
break; |
break; |
257 |
case 1: // --version |
case 1: // --version |
267 |
case 4: // --statistics |
case 4: // --statistics |
268 |
bPrintStatistics = true; |
bPrintStatistics = true; |
269 |
break; |
break; |
270 |
|
case 5: // --lscp-addr |
271 |
|
struct in_addr addr; |
272 |
|
if (inet_aton(optarg, &addr) == 0) |
273 |
|
printf("WARNING: Failed to parse lscp-addr argument, ignoring!\n"); |
274 |
|
else |
275 |
|
lscp_addr = addr.s_addr; |
276 |
|
break; |
277 |
|
case 6: // --lscp-port |
278 |
|
long unsigned int port = 0; |
279 |
|
if ((sscanf(optarg, "%u", &port) != 1) || (port == 0) || (port > 65535)) |
280 |
|
printf("WARNING: Failed to parse lscp-port argument, ignoring!\n"); |
281 |
|
else |
282 |
|
lscp_port = htons(port); |
283 |
|
break; |
284 |
} |
} |
285 |
} |
} |
286 |
} |
} |