/[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 770 by schoenebeck, Sun Sep 11 15:56:29 2005 UTC revision 1012 by capela, Sun Jan 7 15:52:36 2007 UTC
# Line 2  Line 2 
2   *                                                                         *   *                                                                         *
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 Christian Schoenebeck                              *   *   Copyright (C) 2005-2007 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 38  using namespace LinuxSampler; Line 38  using namespace LinuxSampler;
38  Sampler*    pSampler    = NULL;  Sampler*    pSampler    = NULL;
39  LSCPServer* pLSCPServer = NULL;  LSCPServer* pLSCPServer = NULL;
40  pthread_t   main_thread;  pthread_t   main_thread;
41    pid_t       main_pid;
42  bool bPrintStatistics = false;  bool bPrintStatistics = false;
43  bool profile = false;  bool profile = false;
44  bool tune = true;  bool tune = true;
# Line 53  int main(int argc, char **argv) { Line 54  int main(int argc, char **argv) {
54      // initialize the stack trace mechanism with our binary file      // initialize the stack trace mechanism with our binary file
55      StackTraceInit(argv[0], -1);      StackTraceInit(argv[0], -1);
56    
57        main_pid = getpid();
58      main_thread = pthread_self();      main_thread = pthread_self();
59    
60      // setting signal handler for catching SIGINT (thus e.g. <CTRL><C>)      // setting signal handler for catching SIGINT (thus e.g. <CTRL><C>)
# Line 78  int main(int argc, char **argv) { Line 80  int main(int argc, char **argv) {
80      parse_options(argc, argv);      parse_options(argc, argv);
81    
82      dmsg(1,("LinuxSampler %s\n", VERSION));      dmsg(1,("LinuxSampler %s\n", VERSION));
83      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"));
84      dmsg(1,("Copyright (C) 2005 Christian Schoenebeck\n"));      dmsg(1,("Copyright (C) 2005-2007 Christian Schoenebeck\n"));
85    
86      if (tune) {      if (tune) {
87          // detect and print system / CPU specific features          // detect and print system / CPU specific features
# Line 94  int main(int argc, char **argv) { Line 96  int main(int argc, char **argv) {
96      pSampler = new Sampler;      pSampler = new Sampler;
97      dmsg(1,("OK\n"));      dmsg(1,("OK\n"));
98    
99        dmsg(1,("Registered sampler engines: %s\n", EngineFactory::AvailableEngineTypesAsString().c_str()));
100      dmsg(1,("Registered MIDI input drivers: %s\n", MidiInputDeviceFactory::AvailableDriversAsString().c_str()));      dmsg(1,("Registered MIDI input drivers: %s\n", MidiInputDeviceFactory::AvailableDriversAsString().c_str()));
101      dmsg(1,("Registered audio output drivers: %s\n", AudioOutputDeviceFactory::AvailableDriversAsString().c_str()));      dmsg(1,("Registered audio output drivers: %s\n", AudioOutputDeviceFactory::AvailableDriversAsString().c_str()));
102    
# Line 121  int main(int argc, char **argv) { Line 124  int main(int argc, char **argv) {
124      rtEvents.push_back(LSCPEvent::event_voice_count);      rtEvents.push_back(LSCPEvent::event_voice_count);
125      rtEvents.push_back(LSCPEvent::event_stream_count);      rtEvents.push_back(LSCPEvent::event_stream_count);
126      rtEvents.push_back(LSCPEvent::event_buffer_fill);      rtEvents.push_back(LSCPEvent::event_buffer_fill);
127        rtEvents.push_back(LSCPEvent::event_total_voice_count);
128    
129      while (true) {      while (true) {
130          if (bPrintStatistics) {          if (bPrintStatistics) {
131              std::set<Engine*> engines = EngineFactory::EngineInstances();              const std::set<Engine*>& engines = EngineFactory::EngineInstances();
132              std::set<Engine*>::iterator itEngine = engines.begin();              std::set<Engine*>::iterator itEngine = engines.begin();
133              for (int i = 0; itEngine != engines.end(); itEngine++, i++) {              for (int i = 0; itEngine != engines.end(); itEngine++, i++) {
134                  Engine* pEngine = *itEngine;                  Engine* pEngine = *itEngine;
# Line 162  int main(int argc, char **argv) { Line 166  int main(int argc, char **argv) {
166                LSCPServer::SendLSCPNotify(LSCPEvent(LSCPEvent::event_voice_count, iter->first, pEngine->VoiceCount()));                LSCPServer::SendLSCPNotify(LSCPEvent(LSCPEvent::event_voice_count, iter->first, pEngine->VoiceCount()));
167                LSCPServer::SendLSCPNotify(LSCPEvent(LSCPEvent::event_stream_count, iter->first, pEngine->DiskStreamCount()));                LSCPServer::SendLSCPNotify(LSCPEvent(LSCPEvent::event_stream_count, iter->first, pEngine->DiskStreamCount()));
168                LSCPServer::SendLSCPNotify(LSCPEvent(LSCPEvent::event_buffer_fill, iter->first, pEngine->DiskStreamBufferFillPercentage()));                LSCPServer::SendLSCPNotify(LSCPEvent(LSCPEvent::event_buffer_fill, iter->first, pEngine->DiskStreamBufferFillPercentage()));
169                  LSCPServer::SendLSCPNotify(LSCPEvent(LSCPEvent::event_total_voice_count, pSampler->GetVoiceCount()));
170            }            }
171            LSCPServer::UnlockRTNotify();            LSCPServer::UnlockRTNotify();
172        }        }
# Line 217  void signal_handler(int iSignal) { Line 222  void signal_handler(int iSignal) {
222  }  }
223    
224  void kill_app() {  void kill_app() {
225      kill(main_thread, SIGKILL);      kill(main_pid, SIGKILL);
226  }  }
227    
228  void parse_options(int argc, char **argv) {  void parse_options(int argc, char **argv) {

Legend:
Removed from v.770  
changed lines
  Added in v.1012

  ViewVC Help
Powered by ViewVC