26 |
|
|
27 |
#include "Sampler.h" |
#include "Sampler.h" |
28 |
#include "engines/EngineFactory.h" |
#include "engines/EngineFactory.h" |
29 |
#include "engines/InstrumentEditorFactory.h" |
#include "plugins/InstrumentEditorFactory.h" |
30 |
#include "drivers/midi/MidiInputDeviceFactory.h" |
#include "drivers/midi/MidiInputDeviceFactory.h" |
31 |
#include "drivers/audio/AudioOutputDeviceFactory.h" |
#include "drivers/audio/AudioOutputDeviceFactory.h" |
32 |
#include "engines/gig/Profiler.h" |
#include "engines/gig/Profiler.h" |
165 |
if (!pEngineChannel) continue; |
if (!pEngineChannel) continue; |
166 |
Engine* pEngine = pEngineChannel->GetEngine(); |
Engine* pEngine = pEngineChannel->GetEngine(); |
167 |
if (!pEngine) continue; |
if (!pEngine) continue; |
168 |
pSampler->fireVoiceCountChanged(iter->first, pEngine->VoiceCount()); |
pSampler->fireVoiceCountChanged(iter->first, pEngineChannel->GetVoiceCount()); |
169 |
pSampler->fireStreamCountChanged(iter->first, pEngine->DiskStreamCount()); |
pSampler->fireStreamCountChanged(iter->first, pEngineChannel->GetDiskStreamCount()); |
170 |
pSampler->fireBufferFillChanged(iter->first, pEngine->DiskStreamBufferFillPercentage()); |
pSampler->fireBufferFillChanged(iter->first, pEngine->DiskStreamBufferFillPercentage()); |
171 |
pSampler->fireTotalVoiceCountChanged(pSampler->GetVoiceCount()); |
pSampler->fireTotalVoiceCountChanged(pSampler->GetVoiceCount()); |
172 |
} |
} |
182 |
switch (iSignal) { |
switch (iSignal) { |
183 |
case SIGINT: { |
case SIGINT: { |
184 |
if (pthread_equal(pthread_self(), main_thread)) { |
if (pthread_equal(pthread_self(), main_thread)) { |
185 |
if (pLSCPServer) { |
if (pLSCPServer) pLSCPServer->StopThread(); |
186 |
pLSCPServer->StopThread(); |
// the delete order here is important: the Sampler |
187 |
delete pLSCPServer; |
// destructor sends notifications to the lscpserver |
|
} |
|
188 |
if (pSampler) delete pSampler; |
if (pSampler) delete pSampler; |
189 |
|
if (pLSCPServer) delete pLSCPServer; |
190 |
#if HAVE_SQLITE3 |
#if HAVE_SQLITE3 |
191 |
InstrumentsDb::Destroy(); |
InstrumentsDb::Destroy(); |
192 |
#endif |
#endif |
291 |
|
|
292 |
if (res) { |
if (res) { |
293 |
std::stringstream ss; |
std::stringstream ss; |
294 |
ss << "Fail to stat `" << optarg << "`: " << strerror(errno); |
ss << "Failed to stat `" << optarg << "`: " << strerror(errno); |
295 |
throw Exception(ss.str()); |
throw Exception(ss.str()); |
296 |
} |
} |
297 |
|
|
304 |
InstrumentsDb::GetInstrumentsDb()->SetDbFile(String(optarg)); |
InstrumentsDb::GetInstrumentsDb()->SetDbFile(String(optarg)); |
305 |
} |
} |
306 |
} catch(Exception e) { |
} catch(Exception e) { |
307 |
std::cerr << e.Message() << std::endl << std::endl; |
std::cerr << "Could not open instruments DB file: " |
308 |
return; |
<< e.Message() << std::endl; |
309 |
|
exit(EXIT_FAILURE); |
310 |
} |
} |
311 |
|
break; |
|
return; |
|
312 |
#else |
#else |
313 |
std::cerr << "LinuxSampler was not build with "; |
std::cerr << "LinuxSampler was not build with "; |
314 |
std::cerr << "instruments database support." <<std::endl; |
std::cerr << "instruments database support!\n"; |
315 |
return; |
exit(EXIT_FAILURE); |
316 |
#endif |
break; |
317 |
|
#endif |
318 |
case 6: // --create-instruments-db |
case 6: // --create-instruments-db |
319 |
#if HAVE_SQLITE3 |
#if HAVE_SQLITE3 |
320 |
try { |
try { |
334 |
return; |
return; |
335 |
#else |
#else |
336 |
std::cerr << "Failed to create the database. LinuxSampler was "; |
std::cerr << "Failed to create the database. LinuxSampler was "; |
337 |
std::cerr << "not build with instruments database support." <<std::endl; |
std::cerr << "not build with instruments database support!\n"; |
338 |
exit(EXIT_FAILURE); |
exit(EXIT_FAILURE); |
339 |
return; |
return; |
340 |
#endif |
#endif |
341 |
case 7: // --lscp-addr |
case 7: // --lscp-addr |
342 |
struct in_addr addr; |
struct in_addr addr; |
343 |
if (inet_aton(optarg, &addr) == 0) |
if (inet_aton(optarg, &addr) == 0) |