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 * |
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 * |
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" |
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 |
|
|
74 |
|
|
75 |
dmsg(1,("LinuxSampler %s\n", VERSION)); |
dmsg(1,("LinuxSampler %s\n", VERSION)); |
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")); |
78 |
|
|
79 |
if (tune) |
if (tune) |
80 |
{ |
{ |
119 |
rtEvents.push_back(LSCPEvent::event_stream_count); |
rtEvents.push_back(LSCPEvent::event_stream_count); |
120 |
rtEvents.push_back(LSCPEvent::event_buffer_fill); |
rtEvents.push_back(LSCPEvent::event_buffer_fill); |
121 |
|
|
122 |
while(true) |
while (true) { |
123 |
{ |
if (bPrintStatistics) { |
124 |
/*printf("Voices: %3.3d (Max: %3.3d) Streams: %3.3d (Max: %3.3d, Unused: %3.3d)\r", |
std::set<Engine*> engines = EngineFactory::EngineInstances(); |
125 |
pEngine->ActiveVoiceCount, pEngine->ActiveVoiceCountMax, |
std::set<Engine*>::iterator itEngine = engines.begin(); |
126 |
pEngine->pDiskThread->ActiveStreamCount, pEngine->pDiskThread->ActiveStreamCountMax, Stream::GetUnusedStreams()); |
for (int i = 0; itEngine != engines.end(); itEngine++, i++) { |
127 |
fflush(stdout);*/ |
Engine* pEngine = *itEngine; |
128 |
|
printf("Engine %d) Voices: %3.3d (Max: %3.3d) Streams: %3.3d (Max: %3.3d)\n", i, |
129 |
|
pEngine->VoiceCount(), pEngine->VoiceCountMax(), |
130 |
|
pEngine->DiskStreamCount(), pEngine->DiskStreamCountMax() |
131 |
|
); |
132 |
|
fflush(stdout); |
133 |
|
} |
134 |
|
} |
135 |
|
|
136 |
sleep(1); |
sleep(1); |
137 |
if (profile) |
if (profile) |
138 |
{ |
{ |
152 |
std::map<uint,SamplerChannel*>::iterator iter = channels.begin(); |
std::map<uint,SamplerChannel*>::iterator iter = channels.begin(); |
153 |
for (; iter != channels.end(); iter++) { |
for (; iter != channels.end(); iter++) { |
154 |
SamplerChannel* pSamplerChannel = iter->second; |
SamplerChannel* pSamplerChannel = iter->second; |
155 |
Engine* pEngine = pSamplerChannel->GetEngine(); |
EngineChannel* pEngineChannel = pSamplerChannel->GetEngineChannel(); |
156 |
|
if (!pEngineChannel) continue; |
157 |
|
Engine* pEngine = pEngineChannel->GetEngine(); |
158 |
if (!pEngine) continue; |
if (!pEngine) continue; |
159 |
LSCPServer::SendLSCPNotify(LSCPEvent(LSCPEvent::event_voice_count, iter->first, pEngine->VoiceCount())); |
LSCPServer::SendLSCPNotify(LSCPEvent(LSCPEvent::event_voice_count, iter->first, pEngine->VoiceCount())); |
160 |
LSCPServer::SendLSCPNotify(LSCPEvent(LSCPEvent::event_stream_count, iter->first, pEngine->DiskStreamCount())); |
LSCPServer::SendLSCPNotify(LSCPEvent(LSCPEvent::event_stream_count, iter->first, pEngine->DiskStreamCount())); |
226 |
{"version",0,0,0}, |
{"version",0,0,0}, |
227 |
{"profile",0,0,0}, |
{"profile",0,0,0}, |
228 |
{"no-tune",0,0,0}, |
{"no-tune",0,0,0}, |
229 |
|
{"statistics",0,0,0}, |
230 |
{0,0,0,0} |
{0,0,0,0} |
231 |
}; |
}; |
232 |
|
|
245 |
printf("--version prints version information\n"); |
printf("--version prints version information\n"); |
246 |
printf("--profile profile synthesis algorithms\n"); |
printf("--profile profile synthesis algorithms\n"); |
247 |
printf("--no-tune disable assembly optimization\n"); |
printf("--no-tune disable assembly optimization\n"); |
248 |
|
printf("--statistics prints periodically statistics\n"); |
249 |
exit(EXIT_SUCCESS); |
exit(EXIT_SUCCESS); |
250 |
break; |
break; |
251 |
case 1: // --version |
case 1: // --version |
258 |
case 3: // --no-tune |
case 3: // --no-tune |
259 |
tune = false; |
tune = false; |
260 |
break; |
break; |
261 |
|
case 4: // --statistics |
262 |
|
bPrintStatistics = true; |
263 |
|
break; |
264 |
} |
} |
265 |
} |
} |
266 |
} |
} |