--- linuxsampler/trunk/src/network/lscpserver.cpp 2005/05/21 01:10:12 556 +++ linuxsampler/trunk/src/network/lscpserver.cpp 2005/06/17 19:49:30 660 @@ -33,6 +33,7 @@ #endif #include "../engines/EngineFactory.h" +#include "../engines/EngineChannelFactory.h" #include "../drivers/audio/AudioOutputDeviceFactory.h" #include "../drivers/midi/MidiInputDeviceFactory.h" @@ -190,6 +191,18 @@ } } + // check if some engine channel's parameter / status changed, if so notify the respective LSCP event subscribers + { + std::set engineChannels = EngineChannelFactory::EngineChannelInstances(); + std::set::iterator itEngineChannel = engineChannels.begin(); + std::set::iterator itEnd = engineChannels.end(); + for (; itEngineChannel != itEnd; ++itEngineChannel) { + if ((*itEngineChannel)->StatusChanged()) { + SendLSCPNotify(LSCPEvent(LSCPEvent::event_channel_info, (*itEngineChannel)->iSamplerChannelIndex)); + } + } + } + //Now let's deliver late notifies (if any) NotifyBufferMutex.Lock(); for (std::map::iterator iterNotify = bufferedNotifies.begin(); iterNotify != bufferedNotifies.end(); iterNotify++) { @@ -578,7 +591,7 @@ Engine* pEngine = EngineFactory::Create(EngineName); result.Add("DESCRIPTION", pEngine->Description()); result.Add("VERSION", pEngine->Version()); - delete pEngine; + EngineFactory::Destroy(pEngine); } catch (LinuxSamplerException e) { result.Error(e); @@ -660,6 +673,7 @@ if (!pSamplerChannel) throw LinuxSamplerException("Invalid sampler channel number " + ToString(uiSamplerChannel)); EngineChannel* pEngineChannel = pSamplerChannel->GetEngineChannel(); if (!pEngineChannel) throw LinuxSamplerException("No engine loaded on sampler channel"); + if (!pEngineChannel->GetEngine()) throw LinuxSamplerException("No audio output device connected to sampler channel"); result.Add(pEngineChannel->GetEngine()->VoiceCount()); } catch (LinuxSamplerException e) { @@ -680,6 +694,7 @@ if (!pSamplerChannel) throw LinuxSamplerException("Invalid sampler channel number " + ToString(uiSamplerChannel)); EngineChannel* pEngineChannel = pSamplerChannel->GetEngineChannel(); if (!pEngineChannel) throw LinuxSamplerException("No engine type assigned to sampler channel"); + if (!pEngineChannel->GetEngine()) throw LinuxSamplerException("No audio output device connected to sampler channel"); result.Add(pEngineChannel->GetEngine()->DiskStreamCount()); } catch (LinuxSamplerException e) { @@ -700,6 +715,7 @@ if (!pSamplerChannel) throw LinuxSamplerException("Invalid sampler channel number " + ToString(uiSamplerChannel)); EngineChannel* pEngineChannel = pSamplerChannel->GetEngineChannel(); if (!pEngineChannel) throw LinuxSamplerException("No engine type assigned to sampler channel"); + if (!pEngineChannel->GetEngine()) throw LinuxSamplerException("No audio output device connected to sampler channel"); if (!pEngineChannel->GetEngine()->DiskStreamSupported()) result.Add("NA"); else { switch (ResponseType) { @@ -1391,6 +1407,7 @@ if (!pSamplerChannel) throw LinuxSamplerException("Invalid sampler channel number " + ToString(uiSamplerChannel)); EngineChannel* pEngineChannel = pSamplerChannel->GetEngineChannel(); if (!pEngineChannel) throw LinuxSamplerException("No engine type assigned to sampler channel"); + if (!pEngineChannel->GetEngine()) throw LinuxSamplerException("No audio output device connected to sampler channel"); pEngineChannel->GetEngine()->Reset(); } catch (LinuxSamplerException e) { @@ -1409,6 +1426,19 @@ return result.Produce(); } +/** + * Will be called by the parser to return general informations about this + * sampler. + */ +String LSCPServer::GetServerInfo() { + dmsg(2,("LSCPServer: GetServerInfo()\n")); + LSCPResultSet result; + result.Add("DESCRIPTION", "LinuxSampler - modular, streaming capable sampler"); + result.Add("VERSION", VERSION); + result.Add("PROTOCOL_VERSION", "1.0"); + return result.Produce(); +} + /** * Will be called by the parser to subscribe a client (frontend) on the * server for receiving event messages.