2540 |
String LSCPServer::GetTotalVoiceCountMax() { |
String LSCPServer::GetTotalVoiceCountMax() { |
2541 |
dmsg(2,("LSCPServer: GetTotalVoiceCountMax()\n")); |
dmsg(2,("LSCPServer: GetTotalVoiceCountMax()\n")); |
2542 |
LSCPResultSet result; |
LSCPResultSet result; |
2543 |
result.Add(EngineFactory::EngineInstances().size() * CONFIG_MAX_VOICES); |
result.Add(EngineFactory::EngineInstances().size() * GLOBAL_MAX_VOICES); |
2544 |
|
return result.Produce(); |
2545 |
|
} |
2546 |
|
|
2547 |
|
/** |
2548 |
|
* Will be called by the parser to return the sampler global maximum |
2549 |
|
* allowed number of voices. |
2550 |
|
*/ |
2551 |
|
String LSCPServer::GetGlobalMaxVoices() { |
2552 |
|
dmsg(2,("LSCPServer: GetGlobalMaxVoices()\n")); |
2553 |
|
LSCPResultSet result; |
2554 |
|
result.Add(GLOBAL_MAX_VOICES); |
2555 |
|
return result.Produce(); |
2556 |
|
} |
2557 |
|
|
2558 |
|
/** |
2559 |
|
* Will be called by the parser to set the sampler global maximum number of |
2560 |
|
* voices. |
2561 |
|
*/ |
2562 |
|
String LSCPServer::SetGlobalMaxVoices(int iVoices) { |
2563 |
|
dmsg(2,("LSCPServer: SetGlobalMaxVoices(%d)\n", iVoices)); |
2564 |
|
LSCPResultSet result; |
2565 |
|
try { |
2566 |
|
if (iVoices < 1) throw Exception("Maximum voices may not be less than 1"); |
2567 |
|
GLOBAL_MAX_VOICES = iVoices; // see common/global_private.cpp |
2568 |
|
const std::set<Engine*>& engines = EngineFactory::EngineInstances(); |
2569 |
|
if (engines.size() > 0) { |
2570 |
|
std::set<Engine*>::iterator iter = engines.begin(); |
2571 |
|
std::set<Engine*>::iterator end = engines.end(); |
2572 |
|
for (; iter != end; ++iter) { |
2573 |
|
(*iter)->SetMaxVoices(iVoices); |
2574 |
|
} |
2575 |
|
} |
2576 |
|
LSCPServer::SendLSCPNotify(LSCPEvent(LSCPEvent::event_global_info, "VOICES", GLOBAL_MAX_VOICES)); |
2577 |
|
} catch (Exception e) { |
2578 |
|
result.Error(e); |
2579 |
|
} |
2580 |
|
return result.Produce(); |
2581 |
|
} |
2582 |
|
|
2583 |
|
/** |
2584 |
|
* Will be called by the parser to return the sampler global maximum |
2585 |
|
* allowed number of disk streams. |
2586 |
|
*/ |
2587 |
|
String LSCPServer::GetGlobalMaxStreams() { |
2588 |
|
dmsg(2,("LSCPServer: GetGlobalMaxStreams()\n")); |
2589 |
|
LSCPResultSet result; |
2590 |
|
result.Add(GLOBAL_MAX_STREAMS); |
2591 |
|
return result.Produce(); |
2592 |
|
} |
2593 |
|
|
2594 |
|
/** |
2595 |
|
* Will be called by the parser to set the sampler global maximum number of |
2596 |
|
* disk streams. |
2597 |
|
*/ |
2598 |
|
String LSCPServer::SetGlobalMaxStreams(int iStreams) { |
2599 |
|
dmsg(2,("LSCPServer: SetGlobalMaxStreams(%d)\n", iStreams)); |
2600 |
|
LSCPResultSet result; |
2601 |
|
try { |
2602 |
|
if (iStreams < 0) throw Exception("Maximum disk streams may not be negative"); |
2603 |
|
GLOBAL_MAX_STREAMS = iStreams; // see common/global_private.cpp |
2604 |
|
const std::set<Engine*>& engines = EngineFactory::EngineInstances(); |
2605 |
|
if (engines.size() > 0) { |
2606 |
|
std::set<Engine*>::iterator iter = engines.begin(); |
2607 |
|
std::set<Engine*>::iterator end = engines.end(); |
2608 |
|
for (; iter != end; ++iter) { |
2609 |
|
(*iter)->SetMaxDiskStreams(iStreams); |
2610 |
|
} |
2611 |
|
} |
2612 |
|
LSCPServer::SendLSCPNotify(LSCPEvent(LSCPEvent::event_global_info, "STREAMS", GLOBAL_MAX_STREAMS)); |
2613 |
|
} catch (Exception e) { |
2614 |
|
result.Error(e); |
2615 |
|
} |
2616 |
return result.Produce(); |
return result.Produce(); |
2617 |
} |
} |
2618 |
|
|