/[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 411 by schoenebeck, Sat Feb 26 02:01:14 2005 UTC revision 579 by schoenebeck, Tue May 24 19:20:20 2005 UTC
# Line 25  Line 25 
25  #include <signal.h>  #include <signal.h>
26    
27  #include "Sampler.h"  #include "Sampler.h"
28    #include "engines/EngineFactory.h"
29  #include "drivers/midi/MidiInputDeviceFactory.h"  #include "drivers/midi/MidiInputDeviceFactory.h"
30  #include "drivers/audio/AudioOutputDeviceFactory.h"  #include "drivers/audio/AudioOutputDeviceFactory.h"
31  #include "engines/gig/Profiler.h"  #include "engines/gig/Profiler.h"
# Line 37  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    bool bPrintStatistics = false;
42  bool profile = false;  bool profile = false;
43  bool tune = true;  bool tune = true;
44    
# Line 74  int main(int argc, char **argv) { Line 76  int main(int argc, char **argv) {
76      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"));
77      dmsg(1,("Copyright (C) 2005 Christian Schoenebeck\n"));      dmsg(1,("Copyright (C) 2005 Christian Schoenebeck\n"));
78    
79      if (tune)      if (tune) {
80      {          // detect and print system / CPU specific features
81              // detect and print system / CPU specific features          Features::detect();
82              String sFeatures;          dmsg(1,("Detected features: %s\n", Features::featuresAsString().c_str()));
83              Features::detect();          // prevent slow denormal FPU modes
84  #if ARCH_X86          Features::enableDenormalsAreZeroMode();
             if (Features::supportsMMX()) sFeatures += " MMX";  
             if (Features::supportsSSE()) sFeatures += " SSE";  
 #endif // ARCH_X86  
             if (!sFeatures.size()) sFeatures = " None";  
             dmsg(1,("Detected features:%s\n",sFeatures.c_str()));  
85      }      }
86    
87      // create LinuxSampler instance      // create LinuxSampler instance
# Line 104  int main(int argc, char **argv) { Line 101  int main(int argc, char **argv) {
101    
102      if (profile)      if (profile)
103      {      {
104              dmsg(1,("Calibrating profiler..."));          dmsg(1,("Calibrating profiler..."));
105              gig::Profiler::Calibrate();          gig::Profiler::Calibrate();
106              gig::Profiler::Reset();          gig::Profiler::Reset();
107              dmsg(1,("OK\n"));          dmsg(1,("OK\n"));
108      }      }
109    
110      printf("LinuxSampler initialization completed.\n");      printf("LinuxSampler initialization completed. :-)\n\n");
111    
112      std::list<LSCPEvent::event_t> rtEvents;      std::list<LSCPEvent::event_t> rtEvents;
113      rtEvents.push_back(LSCPEvent::event_voice_count);      rtEvents.push_back(LSCPEvent::event_voice_count);
114      rtEvents.push_back(LSCPEvent::event_stream_count);      rtEvents.push_back(LSCPEvent::event_stream_count);
115      rtEvents.push_back(LSCPEvent::event_buffer_fill);      rtEvents.push_back(LSCPEvent::event_buffer_fill);
116    
117      while(true)      while (true) {
118      {          if (bPrintStatistics) {
119        /*printf("Voices: %3.3d (Max: %3.3d) Streams: %3.3d (Max: %3.3d, Unused: %3.3d)\r",              std::set<Engine*> engines = EngineFactory::EngineInstances();
120              pEngine->ActiveVoiceCount, pEngine->ActiveVoiceCountMax,              std::set<Engine*>::iterator itEngine = engines.begin();
121              pEngine->pDiskThread->ActiveStreamCount, pEngine->pDiskThread->ActiveStreamCountMax, Stream::GetUnusedStreams());              for (int i = 0; itEngine != engines.end(); itEngine++, i++) {
122        fflush(stdout);*/                  Engine* pEngine = *itEngine;
123                    printf("Engine %d) Voices: %3.3d (Max: %3.3d) Streams: %3.3d (Max: %3.3d)\n", i,
124                        pEngine->VoiceCount(), pEngine->VoiceCountMax(),
125                        pEngine->DiskStreamCount(), pEngine->DiskStreamCountMax()
126                    );
127                    fflush(stdout);
128                }
129            }
130    
131        sleep(1);        sleep(1);
132        if (profile)        if (profile)
133        {        {
134                unsigned int samplingFreq = 48000; //FIXME: hardcoded for now            unsigned int samplingFreq = 48000; //FIXME: hardcoded for now
135                unsigned int bv = gig::Profiler::GetBogoVoices(samplingFreq);            unsigned int bv = gig::Profiler::GetBogoVoices(samplingFreq);
136                if (bv != 0)            if (bv != 0)
137                {            {
138                        printf("       BogoVoices: %i         \r", bv);                printf("       BogoVoices: %i         \r", bv);
139                        fflush(stdout);                fflush(stdout);
140                }            }
141        }        }
142          
143        if (LSCPServer::EventSubscribers(rtEvents))        if (LSCPServer::EventSubscribers(rtEvents))
144        {        {
145                LSCPServer::LockRTNotify();            LSCPServer::LockRTNotify();
146                std::map<uint,SamplerChannel*> channels = pSampler->GetSamplerChannels();            std::map<uint,SamplerChannel*> channels = pSampler->GetSamplerChannels();
147                std::map<uint,SamplerChannel*>::iterator iter = channels.begin();            std::map<uint,SamplerChannel*>::iterator iter = channels.begin();
148                for (; iter != channels.end(); iter++) {            for (; iter != channels.end(); iter++) {
149                        SamplerChannel* pSamplerChannel = iter->second;                SamplerChannel* pSamplerChannel = iter->second;
150                        EngineChannel* pEngineChannel = pSamplerChannel->GetEngineChannel();                EngineChannel* pEngineChannel = pSamplerChannel->GetEngineChannel();
151                        if (!pEngineChannel) continue;                if (!pEngineChannel) continue;
152                        Engine* pEngine = pEngineChannel->GetEngine();                Engine* pEngine = pEngineChannel->GetEngine();
153                        if (!pEngine) continue;                if (!pEngine) continue;
154                        LSCPServer::SendLSCPNotify(LSCPEvent(LSCPEvent::event_voice_count, iter->first, pEngine->VoiceCount()));                LSCPServer::SendLSCPNotify(LSCPEvent(LSCPEvent::event_voice_count, iter->first, pEngine->VoiceCount()));
155                        LSCPServer::SendLSCPNotify(LSCPEvent(LSCPEvent::event_stream_count, iter->first, pEngine->DiskStreamCount()));                LSCPServer::SendLSCPNotify(LSCPEvent(LSCPEvent::event_stream_count, iter->first, pEngine->DiskStreamCount()));
156                        LSCPServer::SendLSCPNotify(LSCPEvent(LSCPEvent::event_buffer_fill, iter->first, pEngine->DiskStreamBufferFillPercentage()));                LSCPServer::SendLSCPNotify(LSCPEvent(LSCPEvent::event_buffer_fill, iter->first, pEngine->DiskStreamBufferFillPercentage()));
157                }            }
158                LSCPServer::UnlockRTNotify();            LSCPServer::UnlockRTNotify();
159        }        }
160    
161      }      }
# Line 216  void parse_options(int argc, char **argv Line 221  void parse_options(int argc, char **argv
221              {"version",0,0,0},              {"version",0,0,0},
222              {"profile",0,0,0},              {"profile",0,0,0},
223              {"no-tune",0,0,0},              {"no-tune",0,0,0},
224                {"statistics",0,0,0},
225              {0,0,0,0}              {0,0,0,0}
226          };          };
227    
# Line 234  void parse_options(int argc, char **argv Line 240  void parse_options(int argc, char **argv
240                      printf("--version          prints version information\n");                      printf("--version          prints version information\n");
241                      printf("--profile          profile synthesis algorithms\n");                      printf("--profile          profile synthesis algorithms\n");
242                      printf("--no-tune          disable assembly optimization\n");                      printf("--no-tune          disable assembly optimization\n");
243                        printf("--statistics       prints periodically statistics\n");
244                      exit(EXIT_SUCCESS);                      exit(EXIT_SUCCESS);
245                      break;                      break;
246                  case 1: // --version                  case 1: // --version
# Line 241  void parse_options(int argc, char **argv Line 248  void parse_options(int argc, char **argv
248                      exit(EXIT_SUCCESS);                      exit(EXIT_SUCCESS);
249                      break;                      break;
250                  case 2: // --profile                  case 2: // --profile
251                      profile = true;                      profile = true;
252                      break;                      break;
253                  case 3: // --no-tune                  case 3: // --no-tune
254                      tune = false;                      tune = false;
255                        break;
256                    case 4: // --statistics
257                        bPrintStatistics = true;
258                      break;                      break;
259              }              }
260          }          }

Legend:
Removed from v.411  
changed lines
  Added in v.579

  ViewVC Help
Powered by ViewVC