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-2007 Christian Schoenebeck * |
* Copyright (C) 2005-2008 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 * |
156 |
|
|
157 |
dmsg(1,("LinuxSampler %s\n", VERSION)); |
dmsg(1,("LinuxSampler %s\n", VERSION)); |
158 |
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")); |
159 |
dmsg(1,("Copyright (C) 2005-2007 Christian Schoenebeck\n")); |
dmsg(1,("Copyright (C) 2005-2008 Christian Schoenebeck\n")); |
160 |
|
|
161 |
if (tune) { |
if (tune) { |
162 |
// detect and print system / CPU specific features |
// detect and print system / CPU specific features |
196 |
|
|
197 |
printf("LinuxSampler initialization completed. :-)\n\n"); |
printf("LinuxSampler initialization completed. :-)\n\n"); |
198 |
|
|
|
std::list<LSCPEvent::event_t> rtEvents; |
|
|
rtEvents.push_back(LSCPEvent::event_voice_count); |
|
|
rtEvents.push_back(LSCPEvent::event_stream_count); |
|
|
rtEvents.push_back(LSCPEvent::event_buffer_fill); |
|
|
rtEvents.push_back(LSCPEvent::event_total_voice_count); |
|
|
|
|
199 |
while (atomic_read(&running)) { |
while (atomic_read(&running)) { |
200 |
if (bPrintStatistics) { |
if (bPrintStatistics) { |
201 |
const std::set<Engine*>& engines = EngineFactory::EngineInstances(); |
const std::set<Engine*>& engines = EngineFactory::EngineInstances(); |
222 |
} |
} |
223 |
} |
} |
224 |
|
|
225 |
if (LSCPServer::EventSubscribers(rtEvents)) |
pSampler->fireStatistics(); |
|
{ |
|
|
LSCPServer::LockRTNotify(); |
|
|
std::map<uint,SamplerChannel*> channels = pSampler->GetSamplerChannels(); |
|
|
std::map<uint,SamplerChannel*>::iterator iter = channels.begin(); |
|
|
for (; iter != channels.end(); iter++) { |
|
|
SamplerChannel* pSamplerChannel = iter->second; |
|
|
EngineChannel* pEngineChannel = pSamplerChannel->GetEngineChannel(); |
|
|
if (!pEngineChannel) continue; |
|
|
Engine* pEngine = pEngineChannel->GetEngine(); |
|
|
if (!pEngine) continue; |
|
|
pSampler->fireVoiceCountChanged(iter->first, pEngineChannel->GetVoiceCount()); |
|
|
pSampler->fireStreamCountChanged(iter->first, pEngineChannel->GetDiskStreamCount()); |
|
|
pSampler->fireBufferFillChanged(iter->first, pEngine->DiskStreamBufferFillPercentage()); |
|
|
pSampler->fireTotalStreamCountChanged(pSampler->GetDiskStreamCount()); |
|
|
pSampler->fireTotalVoiceCountChanged(pSampler->GetVoiceCount()); |
|
|
} |
|
|
LSCPServer::UnlockRTNotify(); |
|
|
} |
|
226 |
} |
} |
227 |
if (pLSCPServer) pLSCPServer->StopThread(); |
if (pLSCPServer) pLSCPServer->StopThread(); |
228 |
// the delete order here is important: the Sampler |
// the delete order here is important: the Sampler |
229 |
// destructor sends notifications to the lscpserver |
// destructor sends notifications to the lscpserver |
230 |
if (pSampler) delete pSampler; |
if (pSampler) delete pSampler; |
231 |
if (pLSCPServer) delete pLSCPServer; |
if (pLSCPServer) delete pLSCPServer; |
|
#if HAVE_SQLITE3 |
|
|
InstrumentsDb::Destroy(); |
|
|
#endif |
|
232 |
printf("LinuxSampler stopped due to SIGINT.\n"); |
printf("LinuxSampler stopped due to SIGINT.\n"); |
233 |
return EXIT_SUCCESS; |
return EXIT_SUCCESS; |
234 |
} |
} |
373 |
if (optarg) { |
if (optarg) { |
374 |
std::cout << "Creating instruments database..." << std::endl; |
std::cout << "Creating instruments database..." << std::endl; |
375 |
InstrumentsDb::CreateInstrumentsDb(String(optarg)); |
InstrumentsDb::CreateInstrumentsDb(String(optarg)); |
|
InstrumentsDb::Destroy(); |
|
376 |
std::cout << "Done" << std::endl; |
std::cout << "Done" << std::endl; |
377 |
} |
} |
378 |
} catch(Exception e) { |
} catch(Exception e) { |