62 |
|
|
63 |
LSCPServer::LSCPServer(Sampler* pSampler) : Thread(true, false, 0, -4) { |
LSCPServer::LSCPServer(Sampler* pSampler) : Thread(true, false, 0, -4) { |
64 |
this->pSampler = pSampler; |
this->pSampler = pSampler; |
65 |
LSCPEvent::RegisterEvent(LSCPEvent::event_channels, "CHANNELS"); |
LSCPEvent::RegisterEvent(LSCPEvent::event_channel_count, "CHANNEL_COUNT"); |
66 |
LSCPEvent::RegisterEvent(LSCPEvent::event_voice_count, "VOICE_COUNT"); |
LSCPEvent::RegisterEvent(LSCPEvent::event_voice_count, "VOICE_COUNT"); |
67 |
LSCPEvent::RegisterEvent(LSCPEvent::event_stream_count, "STREAM_COUNT"); |
LSCPEvent::RegisterEvent(LSCPEvent::event_stream_count, "STREAM_COUNT"); |
68 |
LSCPEvent::RegisterEvent(LSCPEvent::event_buffer_fill, "BUFFER_FILL"); |
LSCPEvent::RegisterEvent(LSCPEvent::event_buffer_fill, "BUFFER_FILL"); |
69 |
LSCPEvent::RegisterEvent(LSCPEvent::event_info, "INFO"); |
LSCPEvent::RegisterEvent(LSCPEvent::event_channel_info, "CHANNEL_INFO"); |
70 |
LSCPEvent::RegisterEvent(LSCPEvent::event_misc, "MISCELLANEOUS"); |
LSCPEvent::RegisterEvent(LSCPEvent::event_misc, "MISCELLANEOUS"); |
71 |
hSocket = -1; |
hSocket = -1; |
72 |
} |
} |
550 |
} |
} |
551 |
|
|
552 |
/** |
/** |
553 |
* Will be called by the parser to get all available engines. |
* Will be called by the parser to get the amount of all available engines. |
554 |
*/ |
*/ |
555 |
String LSCPServer::GetAvailableEngines() { |
String LSCPServer::GetAvailableEngines() { |
556 |
dmsg(2,("LSCPServer: GetAvailableEngines()\n")); |
dmsg(2,("LSCPServer: GetAvailableEngines()\n")); |
557 |
LSCPResultSet result("GigEngine"); |
LSCPResultSet result("1"); |
558 |
|
return result.Produce(); |
559 |
|
} |
560 |
|
|
561 |
|
/** |
562 |
|
* Will be called by the parser to get a list of all available engines. |
563 |
|
*/ |
564 |
|
String LSCPServer::ListAvailableEngines() { |
565 |
|
dmsg(2,("LSCPServer: ListAvailableEngines()\n")); |
566 |
|
LSCPResultSet result("\'GIG\'"); |
567 |
return result.Produce(); |
return result.Produce(); |
568 |
} |
} |
569 |
|
|
660 |
if (!pSamplerChannel) throw LinuxSamplerException("Invalid sampler channel number " + ToString(uiSamplerChannel)); |
if (!pSamplerChannel) throw LinuxSamplerException("Invalid sampler channel number " + ToString(uiSamplerChannel)); |
661 |
EngineChannel* pEngineChannel = pSamplerChannel->GetEngineChannel(); |
EngineChannel* pEngineChannel = pSamplerChannel->GetEngineChannel(); |
662 |
if (!pEngineChannel) throw LinuxSamplerException("No engine loaded on sampler channel"); |
if (!pEngineChannel) throw LinuxSamplerException("No engine loaded on sampler channel"); |
663 |
|
if (!pEngineChannel->GetEngine()) throw LinuxSamplerException("No audio output device connected to sampler channel"); |
664 |
result.Add(pEngineChannel->GetEngine()->VoiceCount()); |
result.Add(pEngineChannel->GetEngine()->VoiceCount()); |
665 |
} |
} |
666 |
catch (LinuxSamplerException e) { |
catch (LinuxSamplerException e) { |
681 |
if (!pSamplerChannel) throw LinuxSamplerException("Invalid sampler channel number " + ToString(uiSamplerChannel)); |
if (!pSamplerChannel) throw LinuxSamplerException("Invalid sampler channel number " + ToString(uiSamplerChannel)); |
682 |
EngineChannel* pEngineChannel = pSamplerChannel->GetEngineChannel(); |
EngineChannel* pEngineChannel = pSamplerChannel->GetEngineChannel(); |
683 |
if (!pEngineChannel) throw LinuxSamplerException("No engine type assigned to sampler channel"); |
if (!pEngineChannel) throw LinuxSamplerException("No engine type assigned to sampler channel"); |
684 |
|
if (!pEngineChannel->GetEngine()) throw LinuxSamplerException("No audio output device connected to sampler channel"); |
685 |
result.Add(pEngineChannel->GetEngine()->DiskStreamCount()); |
result.Add(pEngineChannel->GetEngine()->DiskStreamCount()); |
686 |
} |
} |
687 |
catch (LinuxSamplerException e) { |
catch (LinuxSamplerException e) { |
702 |
if (!pSamplerChannel) throw LinuxSamplerException("Invalid sampler channel number " + ToString(uiSamplerChannel)); |
if (!pSamplerChannel) throw LinuxSamplerException("Invalid sampler channel number " + ToString(uiSamplerChannel)); |
703 |
EngineChannel* pEngineChannel = pSamplerChannel->GetEngineChannel(); |
EngineChannel* pEngineChannel = pSamplerChannel->GetEngineChannel(); |
704 |
if (!pEngineChannel) throw LinuxSamplerException("No engine type assigned to sampler channel"); |
if (!pEngineChannel) throw LinuxSamplerException("No engine type assigned to sampler channel"); |
705 |
|
if (!pEngineChannel->GetEngine()) throw LinuxSamplerException("No audio output device connected to sampler channel"); |
706 |
if (!pEngineChannel->GetEngine()->DiskStreamSupported()) result.Add("NA"); |
if (!pEngineChannel->GetEngine()->DiskStreamSupported()) result.Add("NA"); |
707 |
else { |
else { |
708 |
switch (ResponseType) { |
switch (ResponseType) { |
727 |
dmsg(2,("LSCPServer: GetAvailableAudioOutputDrivers()\n")); |
dmsg(2,("LSCPServer: GetAvailableAudioOutputDrivers()\n")); |
728 |
LSCPResultSet result; |
LSCPResultSet result; |
729 |
try { |
try { |
730 |
|
int n = AudioOutputDeviceFactory::AvailableDrivers().size(); |
731 |
|
result.Add(n); |
732 |
|
} |
733 |
|
catch (LinuxSamplerException e) { |
734 |
|
result.Error(e); |
735 |
|
} |
736 |
|
return result.Produce(); |
737 |
|
} |
738 |
|
|
739 |
|
String LSCPServer::ListAvailableAudioOutputDrivers() { |
740 |
|
dmsg(2,("LSCPServer: ListAvailableAudioOutputDrivers()\n")); |
741 |
|
LSCPResultSet result; |
742 |
|
try { |
743 |
String s = AudioOutputDeviceFactory::AvailableDriversAsString(); |
String s = AudioOutputDeviceFactory::AvailableDriversAsString(); |
744 |
result.Add(s); |
result.Add(s); |
745 |
} |
} |
753 |
dmsg(2,("LSCPServer: GetAvailableMidiInputDrivers()\n")); |
dmsg(2,("LSCPServer: GetAvailableMidiInputDrivers()\n")); |
754 |
LSCPResultSet result; |
LSCPResultSet result; |
755 |
try { |
try { |
756 |
|
int n = MidiInputDeviceFactory::AvailableDrivers().size(); |
757 |
|
result.Add(n); |
758 |
|
} |
759 |
|
catch (LinuxSamplerException e) { |
760 |
|
result.Error(e); |
761 |
|
} |
762 |
|
return result.Produce(); |
763 |
|
} |
764 |
|
|
765 |
|
String LSCPServer::ListAvailableMidiInputDrivers() { |
766 |
|
dmsg(2,("LSCPServer: ListAvailableMidiInputDrivers()\n")); |
767 |
|
LSCPResultSet result; |
768 |
|
try { |
769 |
String s = MidiInputDeviceFactory::AvailableDriversAsString(); |
String s = MidiInputDeviceFactory::AvailableDriversAsString(); |
770 |
result.Add(s); |
result.Add(s); |
771 |
} |
} |
1394 |
if (!pSamplerChannel) throw LinuxSamplerException("Invalid sampler channel number " + ToString(uiSamplerChannel)); |
if (!pSamplerChannel) throw LinuxSamplerException("Invalid sampler channel number " + ToString(uiSamplerChannel)); |
1395 |
EngineChannel* pEngineChannel = pSamplerChannel->GetEngineChannel(); |
EngineChannel* pEngineChannel = pSamplerChannel->GetEngineChannel(); |
1396 |
if (!pEngineChannel) throw LinuxSamplerException("No engine type assigned to sampler channel"); |
if (!pEngineChannel) throw LinuxSamplerException("No engine type assigned to sampler channel"); |
1397 |
|
if (!pEngineChannel->GetEngine()) throw LinuxSamplerException("No audio output device connected to sampler channel"); |
1398 |
pEngineChannel->GetEngine()->Reset(); |
pEngineChannel->GetEngine()->Reset(); |
1399 |
} |
} |
1400 |
catch (LinuxSamplerException e) { |
catch (LinuxSamplerException e) { |
1413 |
return result.Produce(); |
return result.Produce(); |
1414 |
} |
} |
1415 |
|
|
1416 |
|
/** |
1417 |
|
* Will be called by the parser to return general informations about this |
1418 |
|
* sampler. |
1419 |
|
*/ |
1420 |
|
String LSCPServer::GetServerInfo() { |
1421 |
|
dmsg(2,("LSCPServer: GetServerInfo()\n")); |
1422 |
|
LSCPResultSet result; |
1423 |
|
result.Add("DESCRIPTION", "LinuxSampler - modular, streaming capable sampler"); |
1424 |
|
result.Add("VERSION", VERSION); |
1425 |
|
result.Add("PROTOCOL_VERSION", "1.0"); |
1426 |
|
return result.Produce(); |
1427 |
|
} |
1428 |
|
|
1429 |
/** |
/** |
1430 |
* Will be called by the parser to subscribe a client (frontend) on the |
* Will be called by the parser to subscribe a client (frontend) on the |
1431 |
* server for receiving event messages. |
* server for receiving event messages. |