--- linuxsampler/trunk/src/linuxsampler.cpp 2007/05/26 22:20:46 1208 +++ linuxsampler/trunk/src/linuxsampler.cpp 2007/10/03 18:41:09 1375 @@ -26,6 +26,7 @@ #include "Sampler.h" #include "engines/EngineFactory.h" +#include "plugins/InstrumentEditorFactory.h" #include "drivers/midi/MidiInputDeviceFactory.h" #include "drivers/audio/AudioOutputDeviceFactory.h" #include "engines/gig/Profiler.h" @@ -99,6 +100,7 @@ dmsg(1,("Registered sampler engines: %s\n", EngineFactory::AvailableEngineTypesAsString().c_str())); dmsg(1,("Registered MIDI input drivers: %s\n", MidiInputDeviceFactory::AvailableDriversAsString().c_str())); dmsg(1,("Registered audio output drivers: %s\n", AudioOutputDeviceFactory::AvailableDriversAsString().c_str())); + dmsg(1,("Registered instrument editors: %s\n", InstrumentEditorFactory::AvailableEditorsAsString().c_str())); // start LSCP network server struct in_addr addr; @@ -163,8 +165,8 @@ if (!pEngineChannel) continue; Engine* pEngine = pEngineChannel->GetEngine(); if (!pEngine) continue; - pSampler->fireVoiceCountChanged(iter->first, pEngine->VoiceCount()); - pSampler->fireStreamCountChanged(iter->first, pEngine->DiskStreamCount()); + pSampler->fireVoiceCountChanged(iter->first, pEngineChannel->GetVoiceCount()); + pSampler->fireStreamCountChanged(iter->first, pEngineChannel->GetDiskStreamCount()); pSampler->fireBufferFillChanged(iter->first, pEngine->DiskStreamBufferFillPercentage()); pSampler->fireTotalVoiceCountChanged(pSampler->GetVoiceCount()); } @@ -180,11 +182,11 @@ switch (iSignal) { case SIGINT: { if (pthread_equal(pthread_self(), main_thread)) { - if (pLSCPServer) { - pLSCPServer->StopThread(); - delete pLSCPServer; - } + if (pLSCPServer) pLSCPServer->StopThread(); + // the delete order here is important: the Sampler + // destructor sends notifications to the lscpserver if (pSampler) delete pSampler; + if (pLSCPServer) delete pLSCPServer; #if HAVE_SQLITE3 InstrumentsDb::Destroy(); #endif @@ -289,7 +291,7 @@ if (res) { std::stringstream ss; - ss << "Fail to stat `" << optarg << "`: " << strerror(errno); + ss << "Failed to stat `" << optarg << "`: " << strerror(errno); throw Exception(ss.str()); } @@ -302,16 +304,17 @@ InstrumentsDb::GetInstrumentsDb()->SetDbFile(String(optarg)); } } catch(Exception e) { - std::cerr << e.Message() << std::endl << std::endl; - return; + std::cerr << "Could not open instruments DB file: " + << e.Message() << std::endl; + exit(EXIT_FAILURE); } - - return; + break; #else std::cerr << "LinuxSampler was not build with "; - std::cerr << "instruments database support." <