/[svn]/linuxsampler/trunk/src/linuxsampler.cpp
ViewVC logotype

Diff of /linuxsampler/trunk/src/linuxsampler.cpp

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 2500 by schoenebeck, Fri Jan 10 12:20:05 2014 UTC revision 3766 by schoenebeck, Mon Apr 6 12:41:49 2020 UTC
# Line 3  Line 3 
3   *   LinuxSampler - modular, streaming capable sampler                     *   *   LinuxSampler - modular, streaming capable sampler                     *
4   *                                                                         *   *                                                                         *
5   *   Copyright (C) 2003-2004 by Benno Senoner and Christian Schoenebeck    *   *   Copyright (C) 2003-2004 by Benno Senoner and Christian Schoenebeck    *
6   *   Copyright (C) 2005-2014 Christian Schoenebeck                         *   *   Copyright (C) 2005-2020 Christian Schoenebeck                         *
7   *                                                                         *   *                                                                         *
8   *   This program is free software; you can redistribute it and/or modify  *   *   This program is free software; you can redistribute it and/or modify  *
9   *   it under the terms of the GNU General Public License as published by  *   *   it under the terms of the GNU General Public License as published by  *
# Line 58  LSCPServer* pLSCPServer = NULL; Line 58  LSCPServer* pLSCPServer = NULL;
58  #define INADDR_NONE 0xffffffff  #define INADDR_NONE 0xffffffff
59  #endif  #endif
60    
61    typedef unsigned long in_addr_t;
62    
63  int inet_aton(const char *cp, struct in_addr *addr)  int inet_aton(const char *cp, struct in_addr *addr)
64  {  {
65      addr->s_addr = inet_addr(cp);      addr->s_addr = inet_addr(cp);
# Line 82  static atomic_t running = ATOMIC_INIT(1) Line 84  static atomic_t running = ATOMIC_INIT(1)
84    
85  int main(int argc, char **argv) {  int main(int argc, char **argv) {
86    
87        Thread::setNameOfCaller("ls-main");
88    
89      lscp_addr = htonl(LSCP_ADDR);      lscp_addr = htonl(LSCP_ADDR);
90      lscp_port = htons(LSCP_PORT);      lscp_port = htons(LSCP_PORT);
91    
# Line 100  int main(int argc, char **argv) { Line 104  int main(int argc, char **argv) {
104      if (bShowStackTrace) {      if (bShowStackTrace) {
105          #if defined(WIN32)          #if defined(WIN32)
106          // FIXME: sigaction() not supported on WIN32, we ignore it for now          // FIXME: sigaction() not supported on WIN32, we ignore it for now
107            #elif AC_APPLE_UNIVERSAL_BUILD
108            // not used for Xcode
109          #else          #else
110          StackTraceInit(argv[0], -1);          StackTraceInit(argv[0], -1);
111          // register signal handler for all unusual signals          // register signal handler for all unusual signals
# Line 119  int main(int argc, char **argv) { Line 125  int main(int argc, char **argv) {
125    
126      dmsg(1,("LinuxSampler %s\n", VERSION));      dmsg(1,("LinuxSampler %s\n", VERSION));
127      dmsg(1,("Copyright (C) 2003,2004 by Benno Senoner and Christian Schoenebeck\n"));      dmsg(1,("Copyright (C) 2003,2004 by Benno Senoner and Christian Schoenebeck\n"));
128      dmsg(1,("Copyright (C) 2005-2014 Christian Schoenebeck\n"));      dmsg(1,("Copyright (C) 2005-2020 Christian Schoenebeck\n"));
129        dmsg(1,("Binary built: " __DATE__ "\n"))
130    
131      #if defined(WIN32)      #if defined(WIN32)
132      #if 0      #if 0
# Line 195  int main(int argc, char **argv) { Line 202  int main(int argc, char **argv) {
202    
203      // start LSCP network server      // start LSCP network server
204      struct in_addr addr;      struct in_addr addr;
205      addr.s_addr = lscp_addr;      addr.s_addr = (in_addr_t)lscp_addr;
206      dmsg(1,("Starting LSCP network server (%s:%d)...", inet_ntoa(addr), ntohs(lscp_port)));      dmsg(1,("Starting LSCP network server (%s:%d)...", inet_ntoa(addr), ntohs(lscp_port)));
207      pLSCPServer = new LSCPServer(pSampler, lscp_addr, lscp_port);      pLSCPServer = new LSCPServer(pSampler, lscp_addr, lscp_port);
208      pLSCPServer->StartThread();      pLSCPServer->StartThread();
# Line 312  void signal_handler(int iSignal) { Line 319  void signal_handler(int iSignal) {
319      signal(iSignal, SIG_DFL); // Reinstall default handler to prevent race conditions      signal(iSignal, SIG_DFL); // Reinstall default handler to prevent race conditions
320      if (bShowStackTrace) {      if (bShowStackTrace) {
321          std::cerr << "Showing stack trace...\n" << std::flush;          std::cerr << "Showing stack trace...\n" << std::flush;
322            #if !AC_APPLE_UNIVERSAL_BUILD
323          StackTrace();          StackTrace();
324            #endif
325          sleep(2);          sleep(2);
326      }      }
327      std::cerr << "Killing LinuxSampler...\n" << std::flush;      std::cerr << "Killing LinuxSampler...\n" << std::flush;
# Line 333  void parse_options(int argc, char **argv Line 342  void parse_options(int argc, char **argv
342      int option_index = 0;      int option_index = 0;
343      static struct option long_options[] =      static struct option long_options[] =
344          {          {
345              {"help",0,0,0},              {"help",no_argument,0,0},
346              {"version",0,0,0},              {"version",no_argument,0,0},
347              {"profile",0,0,0},              {"profile",no_argument,0,0},
348              {"no-tune",0,0,0},              {"no-tune",no_argument,0,0},
349              {"statistics",0,0,0},              {"statistics",no_argument,0,0},
350              {"instruments-db-location",1,0,0},              {"instruments-db-location",required_argument,0,0},
351              {"create-instruments-db",1,0,0},              {"create-instruments-db",optional_argument,0,0},
352              {"lscp-addr",1,0,0},              {"lscp-addr",required_argument,0,0},
353              {"lscp-port",1,0,0},              {"lscp-port",required_argument,0,0},
354              {"stacktrace",0,0,0},              {"stacktrace",no_argument,0,0},
355              {"exec-after-init",1,0,0},              {"exec-after-init",required_argument,0,0},
356              {0,0,0,0}              {0,0,0,0}
357          };          };
358    
# Line 424  void parse_options(int argc, char **argv Line 433  void parse_options(int argc, char **argv
433                  case 6: // --create-instruments-db                  case 6: // --create-instruments-db
434  #if HAVE_SQLITE3  #if HAVE_SQLITE3
435                      try {                      try {
436                          if (optarg) {                          std::cout << "Creating instruments database..." << std::endl;
437                              std::cout << "Creating instruments database..." << std::endl;                          if (optarg) // with glibc this only fires with form --create-instruments-db=bla (see below)
438                              InstrumentsDb::CreateInstrumentsDb(String(optarg));                              InstrumentsDb::GetInstrumentsDb()->CreateInstrumentsDb(String(optarg));
439                              std::cout << "Done" << std::endl;                          else if (argv[optind] && argv[optind][0] != '-') // workaround: glibc actually expects form --foo=value for all optional arguments ...
440                          }                              InstrumentsDb::GetInstrumentsDb()->CreateInstrumentsDb(String(argv[optind++]));
441                            else
442                                InstrumentsDb::GetInstrumentsDb()->CreateInstrumentsDb(); // use default instruments db location
443                            std::cout << "Done" << std::endl;
444                      } catch(Exception e) {                      } catch(Exception e) {
445                          std::cerr << e.Message() << std::endl;                          std::cerr << e.Message() << std::endl;
446                          exit(EXIT_FAILURE);                          exit(EXIT_FAILURE);
# Line 453  void parse_options(int argc, char **argv Line 465  void parse_options(int argc, char **argv
465                  }                  }
466                  case 8: {// --lscp-port                  case 8: {// --lscp-port
467                      long unsigned int port = 0;                      long unsigned int port = 0;
468                      if ((sscanf(optarg, "%u", &port) != 1) || (port == 0) || (port > 65535))                      if ((sscanf(optarg, "%lu", &port) != 1) || (port == 0) || (port > 65535))
469                          printf("WARNING: Failed to parse lscp-port argument, ignoring!\n");                          printf("WARNING: Failed to parse lscp-port argument, ignoring!\n");
470                      else                      else
471                          lscp_port = htons(port);                          lscp_port = htons(port);

Legend:
Removed from v.2500  
changed lines
  Added in v.3766

  ViewVC Help
Powered by ViewVC