/[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 2124 by schoenebeck, Sat Sep 18 09:24:41 2010 UTC revision 2885 by schoenebeck, Fri Apr 22 15:37:45 2016 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-2009 Christian Schoenebeck                         *   *   Copyright (C) 2005-2016 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 73  bool tune = true; Line 73  bool tune = true;
73  static bool bShowStackTrace = false;  static bool bShowStackTrace = false;
74  unsigned long int lscp_addr;  unsigned long int lscp_addr;
75  unsigned short int lscp_port;  unsigned short int lscp_port;
76    String ExecAfterInit;
77    
78  void parse_options(int argc, char **argv);  void parse_options(int argc, char **argv);
79  void signal_handler(int signal);  void signal_handler(int signal);
# Line 118  int main(int argc, char **argv) { Line 119  int main(int argc, char **argv) {
119    
120      dmsg(1,("LinuxSampler %s\n", VERSION));      dmsg(1,("LinuxSampler %s\n", VERSION));
121      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"));
122      dmsg(1,("Copyright (C) 2005-2009 Christian Schoenebeck\n"));      dmsg(1,("Copyright (C) 2005-2016 Christian Schoenebeck\n"));
123        dmsg(1,("Binary built: " __DATE__ "\n"))
124    
125      #if defined(WIN32)      #if defined(WIN32)
126      #if 0      #if 0
# Line 211  int main(int argc, char **argv) { Line 213  int main(int argc, char **argv) {
213      }      }
214    
215      printf("LinuxSampler initialization completed. :-)\n\n");      printf("LinuxSampler initialization completed. :-)\n\n");
216        
217        if (ExecAfterInit != "") {
218            printf("Executing command: %s\n\n", ExecAfterInit.c_str());
219            if (system(ExecAfterInit.c_str()) == -1) {
220                std::cerr << "Failed to execute the command" << std::endl;
221            }
222        }
223    
224    //TODO: (hopefully) just a temporary nasty hack for launching gigedit on the main thread on Mac (see comments in gigedit.cpp for details)
225    #if defined(__APPLE__)
226        g_mainThreadCallbackSupported = true;
227    #endif
228    
229      while (atomic_read(&running)) {      while (atomic_read(&running)) {
230          if (bPrintStatistics) {          if (bPrintStatistics) {
# Line 239  int main(int argc, char **argv) { Line 253  int main(int argc, char **argv) {
253          }          }
254    
255          pSampler->fireStatistics();          pSampler->fireStatistics();
256            
257            //TODO: (hopefully) just a temporary nasty hack for launching gigedit on the main thread on Mac (see comments in gigedit.cpp for details)
258            #if defined(__APPLE__)
259            if (g_fireMainThreadCallback && g_mainThreadCallback) {
260                void (*fn)(void* info) = g_mainThreadCallback;
261                void* info = g_mainThreadCallbackInfo;
262                g_mainThreadCallbackInfo = NULL;
263                g_mainThreadCallback     = NULL;
264                g_fireMainThreadCallback = false;
265                printf("Received main thread callback, calling now ...\n"); fflush(stdout);
266                (*fn)(info);
267                printf("Main thread callback executed.\n"); fflush(stdout);
268            }
269            #endif
270      }      }
271    //#endif
272      if (pLSCPServer) pLSCPServer->StopThread();      if (pLSCPServer) pLSCPServer->StopThread();
273      // the delete order here is important: the Sampler      // the delete order here is important: the Sampler
274      // destructor sends notifications to the lscpserver      // destructor sends notifications to the lscpserver
# Line 315  void parse_options(int argc, char **argv Line 344  void parse_options(int argc, char **argv
344              {"lscp-addr",1,0,0},              {"lscp-addr",1,0,0},
345              {"lscp-port",1,0,0},              {"lscp-port",1,0,0},
346              {"stacktrace",0,0,0},              {"stacktrace",0,0,0},
347                {"exec-after-init",1,0,0},
348              {0,0,0,0}              {0,0,0,0}
349          };          };
350    
# Line 340  void parse_options(int argc, char **argv Line 370  void parse_options(int argc, char **argv
370                      printf("--instruments-db-location   specifies the instruments DB file\n");                      printf("--instruments-db-location   specifies the instruments DB file\n");
371                      printf("--stacktrace                automatically shows stacktrace if crashes\n");                      printf("--stacktrace                automatically shows stacktrace if crashes\n");
372                      printf("                            (broken on most systems at the moment)\n");                      printf("                            (broken on most systems at the moment)\n");
373                        printf("--exec-after-init           executes a command after initialization\n");
374                      exit(EXIT_SUCCESS);                      exit(EXIT_SUCCESS);
375                      break;                      break;
376                  case 1: // --version                  case 1: // --version
# Line 423  void parse_options(int argc, char **argv Line 454  void parse_options(int argc, char **argv
454                  }                  }
455                  case 8: {// --lscp-port                  case 8: {// --lscp-port
456                      long unsigned int port = 0;                      long unsigned int port = 0;
457                      if ((sscanf(optarg, "%u", &port) != 1) || (port == 0) || (port > 65535))                      if ((sscanf(optarg, "%lu", &port) != 1) || (port == 0) || (port > 65535))
458                          printf("WARNING: Failed to parse lscp-port argument, ignoring!\n");                          printf("WARNING: Failed to parse lscp-port argument, ignoring!\n");
459                      else                      else
460                          lscp_port = htons(port);                          lscp_port = htons(port);
# Line 432  void parse_options(int argc, char **argv Line 463  void parse_options(int argc, char **argv
463                  case 9: // --stacktrace                  case 9: // --stacktrace
464                      bShowStackTrace = true;                      bShowStackTrace = true;
465                      break;                      break;
466                    case 10: // --exec-after-init
467                        ExecAfterInit = optarg;
468                        break;
469              }              }
470          }          }
471      }      }

Legend:
Removed from v.2124  
changed lines
  Added in v.2885

  ViewVC Help
Powered by ViewVC