--- linuxsampler/trunk/src/Sampler.cpp 2010/09/15 10:04:07 2123 +++ linuxsampler/trunk/src/Sampler.cpp 2013/03/02 07:03:04 2427 @@ -3,7 +3,7 @@ * LinuxSampler - modular, streaming capable sampler * * * * Copyright (C) 2003, 2004 by Benno Senoner and Christian Schoenebeck * - * Copyright (C) 2005 - 2010 Christian Schoenebeck * + * Copyright (C) 2005 - 2013 Christian Schoenebeck * * * * This library is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * @@ -680,6 +680,40 @@ return count; } + int Sampler::GetGlobalMaxVoices() { + return GLOBAL_MAX_VOICES; // see common/global_private.cpp + } + + int Sampler::GetGlobalMaxStreams() { + return GLOBAL_MAX_STREAMS; // see common/global_private.cpp + } + + void Sampler::SetGlobalMaxVoices(int n) throw (Exception) { + if (n < 1) throw Exception("Maximum voices may not be less than 1"); + GLOBAL_MAX_VOICES = n; // 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(n); + } + } + } + + void Sampler::SetGlobalMaxStreams(int n) throw (Exception) { + if (n < 0) throw Exception("Maximum disk streams may not be negative"); + GLOBAL_MAX_STREAMS = n; // 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(n); + } + } + } + void Sampler::Reset() { // delete sampler channels try { @@ -735,7 +769,7 @@ if (LSCPServer::EventSubscribers(events)) { - LSCPServer::LockRTNotify(); + LockGuard lock(LSCPServer::RTNotifyMutex); std::map channels = GetSamplerChannels(); std::map::iterator iter = channels.begin(); for (; iter != channels.end(); iter++) { @@ -751,8 +785,6 @@ fireTotalStreamCountChanged(GetDiskStreamCount()); fireTotalVoiceCountChanged(GetVoiceCount()); - - LSCPServer::UnlockRTNotify(); } }