/[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 1895 by persson, Sun May 3 12:15:40 2009 UTC revision 2473 by schoenebeck, Sun Sep 15 17:55:56 2013 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-2013 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 23  Line 23 
23    
24  #include <getopt.h>  #include <getopt.h>
25  #include <signal.h>  #include <signal.h>
26    #include <sys/stat.h>
27    
28  #if defined(WIN32)  #if defined(WIN32)
29  // require at least Windows 2000 for the GlobalMemoryStatusEx() call  // require at least Windows 2000 for the GlobalMemoryStatusEx() call
# Line 40  Line 41 
41  #include "plugins/InstrumentEditorFactory.h"  #include "plugins/InstrumentEditorFactory.h"
42  #include "drivers/midi/MidiInputDeviceFactory.h"  #include "drivers/midi/MidiInputDeviceFactory.h"
43  #include "drivers/audio/AudioOutputDeviceFactory.h"  #include "drivers/audio/AudioOutputDeviceFactory.h"
44    #include "effects/EffectFactory.h"
45  #include "engines/gig/Profiler.h"  #include "engines/gig/Profiler.h"
46  #include "network/lscpserver.h"  #include "network/lscpserver.h"
47  #include "common/stacktrace.h"  #include "common/stacktrace.h"
# Line 71  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 116  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-2013 Christian Schoenebeck\n"));
123    
124      #if defined(WIN32)      #if defined(WIN32)
125      #if 0      #if 0
# Line 187  int main(int argc, char **argv) { Line 190  int main(int argc, char **argv) {
190      dmsg(1,("Registered MIDI input drivers: %s\n", MidiInputDeviceFactory::AvailableDriversAsString().c_str()));      dmsg(1,("Registered MIDI input drivers: %s\n", MidiInputDeviceFactory::AvailableDriversAsString().c_str()));
191      dmsg(1,("Registered audio output drivers: %s\n", AudioOutputDeviceFactory::AvailableDriversAsString().c_str()));      dmsg(1,("Registered audio output drivers: %s\n", AudioOutputDeviceFactory::AvailableDriversAsString().c_str()));
192      dmsg(1,("Registered instrument editors: %s\n", InstrumentEditorFactory::AvailableEditorsAsString().c_str()));      dmsg(1,("Registered instrument editors: %s\n", InstrumentEditorFactory::AvailableEditorsAsString().c_str()));
193        dmsg(1,("Registered internal effect systems: %s\n", EffectFactory::AvailableEffectSystemsAsString().c_str()));
194        dmsg(1,("Registered internal effects: %d\n", EffectFactory::AvailableEffectsCount()));
195    
196      // start LSCP network server      // start LSCP network server
197      struct in_addr addr;      struct in_addr addr;
# Line 207  int main(int argc, char **argv) { Line 212  int main(int argc, char **argv) {
212      }      }
213    
214      printf("LinuxSampler initialization completed. :-)\n\n");      printf("LinuxSampler initialization completed. :-)\n\n");
215        
216        if (ExecAfterInit != "") {
217            printf("Executing command: %s\n\n", ExecAfterInit.c_str());
218            if (system(ExecAfterInit.c_str()) == -1) {
219                std::cerr << "Failed to execute the command" << std::endl;
220            }
221        }
222    
223    //TODO: (hopefully) just a temporary nasty hack for launching gigedit on the main thread on Mac (see comments in gigedit.cpp for details)
224    #if defined(__APPLE__)
225        g_mainThreadCallbackSupported = true;
226    #endif
227    
228      while (atomic_read(&running)) {      while (atomic_read(&running)) {
229          if (bPrintStatistics) {          if (bPrintStatistics) {
# Line 235  int main(int argc, char **argv) { Line 252  int main(int argc, char **argv) {
252          }          }
253    
254          pSampler->fireStatistics();          pSampler->fireStatistics();
255            
256            //TODO: (hopefully) just a temporary nasty hack for launching gigedit on the main thread on Mac (see comments in gigedit.cpp for details)
257            #if defined(__APPLE__)
258            if (g_fireMainThreadCallback && g_mainThreadCallback) {
259                void (*fn)(void* info) = g_mainThreadCallback;
260                void* info = g_mainThreadCallbackInfo;
261                g_mainThreadCallbackInfo = NULL;
262                g_mainThreadCallback     = NULL;
263                g_fireMainThreadCallback = false;
264                printf("Received main thread callback, calling now ...\n"); fflush(stdout);
265                (*fn)(info);
266                printf("Main thread callback executed.\n"); fflush(stdout);
267            }
268            #endif
269      }      }
270    //#endif
271      if (pLSCPServer) pLSCPServer->StopThread();      if (pLSCPServer) pLSCPServer->StopThread();
272      // the delete order here is important: the Sampler      // the delete order here is important: the Sampler
273      // destructor sends notifications to the lscpserver      // destructor sends notifications to the lscpserver
# Line 311  void parse_options(int argc, char **argv Line 343  void parse_options(int argc, char **argv
343              {"lscp-addr",1,0,0},              {"lscp-addr",1,0,0},
344              {"lscp-port",1,0,0},              {"lscp-port",1,0,0},
345              {"stacktrace",0,0,0},              {"stacktrace",0,0,0},
346                {"exec-after-init",1,0,0},
347              {0,0,0,0}              {0,0,0,0}
348          };          };
349    
# Line 336  void parse_options(int argc, char **argv Line 369  void parse_options(int argc, char **argv
369                      printf("--instruments-db-location   specifies the instruments DB file\n");                      printf("--instruments-db-location   specifies the instruments DB file\n");
370                      printf("--stacktrace                automatically shows stacktrace if crashes\n");                      printf("--stacktrace                automatically shows stacktrace if crashes\n");
371                      printf("                            (broken on most systems at the moment)\n");                      printf("                            (broken on most systems at the moment)\n");
372                        printf("--exec-after-init           executes a command after initialization\n");
373                      exit(EXIT_SUCCESS);                      exit(EXIT_SUCCESS);
374                      break;                      break;
375                  case 1: // --version                  case 1: // --version
# Line 344  void parse_options(int argc, char **argv Line 378  void parse_options(int argc, char **argv
378                      break;                      break;
379                  case 2: // --profile                  case 2: // --profile
380                      profile = true;                      profile = true;
381                        //FIXME: profiling code is currently broken!
382                        std::cerr << "Option '--profile' is currently not supported, since the profiling code is currently broken!"  << std::endl;
383                        exit(EXIT_FAILURE);
384                      break;                      break;
385                  case 3: // --no-tune                  case 3: // --no-tune
386                      tune = false;                      tune = false;
# Line 425  void parse_options(int argc, char **argv Line 462  void parse_options(int argc, char **argv
462                  case 9: // --stacktrace                  case 9: // --stacktrace
463                      bShowStackTrace = true;                      bShowStackTrace = true;
464                      break;                      break;
465                    case 10: // --exec-after-init
466                        ExecAfterInit = optarg;
467                        break;
468              }              }
469          }          }
470      }      }

Legend:
Removed from v.1895  
changed lines
  Added in v.2473

  ViewVC Help
Powered by ViewVC