--- linuxsampler/trunk/src/network/lscpserver.cpp 2008/09/29 18:21:21 1781 +++ linuxsampler/trunk/src/network/lscpserver.cpp 2008/12/07 01:26:46 1800 @@ -2540,7 +2540,79 @@ String LSCPServer::GetTotalVoiceCountMax() { dmsg(2,("LSCPServer: GetTotalVoiceCountMax()\n")); LSCPResultSet result; - result.Add(EngineFactory::EngineInstances().size() * CONFIG_MAX_VOICES); + result.Add(EngineFactory::EngineInstances().size() * GLOBAL_MAX_VOICES); + return result.Produce(); +} + +/** + * Will be called by the parser to return the sampler global maximum + * allowed number of voices. + */ +String LSCPServer::GetGlobalMaxVoices() { + dmsg(2,("LSCPServer: GetGlobalMaxVoices()\n")); + LSCPResultSet result; + result.Add(GLOBAL_MAX_VOICES); + return result.Produce(); +} + +/** + * Will be called by the parser to set the sampler global maximum number of + * voices. + */ +String LSCPServer::SetGlobalMaxVoices(int iVoices) { + dmsg(2,("LSCPServer: SetGlobalMaxVoices(%d)\n", iVoices)); + LSCPResultSet result; + try { + if (iVoices < 1) throw Exception("Maximum voices may not be less than 1"); + GLOBAL_MAX_VOICES = iVoices; // see common/global_private.cpp + const std::set& engines = EngineFactory::EngineInstances(); + if (engines.size() > 0) { + std::set::iterator iter = engines.begin(); + std::set::iterator end = engines.end(); + for (; iter != end; ++iter) { + (*iter)->SetMaxVoices(iVoices); + } + } + LSCPServer::SendLSCPNotify(LSCPEvent(LSCPEvent::event_global_info, "VOICES", GLOBAL_MAX_VOICES)); + } catch (Exception e) { + result.Error(e); + } + return result.Produce(); +} + +/** + * Will be called by the parser to return the sampler global maximum + * allowed number of disk streams. + */ +String LSCPServer::GetGlobalMaxStreams() { + dmsg(2,("LSCPServer: GetGlobalMaxStreams()\n")); + LSCPResultSet result; + result.Add(GLOBAL_MAX_STREAMS); + return result.Produce(); +} + +/** + * Will be called by the parser to set the sampler global maximum number of + * disk streams. + */ +String LSCPServer::SetGlobalMaxStreams(int iStreams) { + dmsg(2,("LSCPServer: SetGlobalMaxStreams(%d)\n", iStreams)); + LSCPResultSet result; + try { + if (iStreams < 0) throw Exception("Maximum disk streams may not be negative"); + GLOBAL_MAX_STREAMS = iStreams; // see common/global_private.cpp + const std::set& engines = EngineFactory::EngineInstances(); + if (engines.size() > 0) { + std::set::iterator iter = engines.begin(); + std::set::iterator end = engines.end(); + for (; iter != end; ++iter) { + (*iter)->SetMaxDiskStreams(iStreams); + } + } + LSCPServer::SendLSCPNotify(LSCPEvent(LSCPEvent::event_global_info, "STREAMS", GLOBAL_MAX_STREAMS)); + } catch (Exception e) { + result.Error(e); + } return result.Produce(); }