244 |
if (c == '\r') |
if (c == '\r') |
245 |
continue; //Ignore CR |
continue; //Ignore CR |
246 |
if (c == '\n') { |
if (c == '\n') { |
247 |
|
LSCPServer::SendLSCPNotify(LSCPEvent(LSCPEvent::event_misc, "Received \'" + bufferedCommands[socket] + "\' on socket", socket)); |
248 |
bufferedCommands[socket] += "\n"; |
bufferedCommands[socket] += "\n"; |
249 |
return true; //Complete command was read |
return true; //Complete command was read |
250 |
} |
} |
893 |
} |
} |
894 |
catch (LinuxSamplerException e) { |
catch (LinuxSamplerException e) { |
895 |
result.Error(e); |
result.Error(e); |
896 |
|
} |
897 |
|
return result.Produce(); |
898 |
|
} |
899 |
|
|
900 |
|
String LSCPServer::GetMidiInputPortParameterInfo(uint DeviceId, uint PortId, String ParameterName) { |
901 |
|
dmsg(2,("LSCPServer: GetMidiInputPortParameterInfo(DeviceId=%d,PortId=%d,ParameterName=%s)\n",DeviceId,PortId,ParameterName.c_str())); |
902 |
|
LSCPResultSet result; |
903 |
|
try { |
904 |
|
// get audio output device |
905 |
|
std::map<uint,MidiInputDevice*> devices = pSampler->GetMidiInputDevices(); |
906 |
|
if (!devices[DeviceId]) throw LinuxSamplerException("There is no midi input device with index " + ToString(DeviceId) + "."); |
907 |
|
MidiInputDevice* pDevice = devices[DeviceId]; |
908 |
|
|
909 |
|
// get midi port |
910 |
|
MidiInputDevice::MidiInputPort* pPort = pDevice->GetPort(PortId); |
911 |
|
if (!pPort) throw LinuxSamplerException("Midi input device does not have port " + ToString(PortId) + "."); |
912 |
|
|
913 |
|
// get desired port parameter |
914 |
|
std::map<String,DeviceCreationParameter*> parameters = pPort->DeviceParameters(); |
915 |
|
if (!parameters[ParameterName]) throw LinuxSamplerException("Midi port does not provice a parameters '" + ParameterName + "'."); |
916 |
|
DeviceCreationParameter* pParameter = parameters[ParameterName]; |
917 |
|
|
918 |
|
// return all fields of this audio channel parameter |
919 |
|
result.Add("TYPE", pParameter->Type()); |
920 |
|
result.Add("DESCRIPTION", pParameter->Description()); |
921 |
|
result.Add("FIX", pParameter->Fix()); |
922 |
|
result.Add("MULTIPLICITY", pParameter->Multiplicity()); |
923 |
|
if (pParameter->RangeMin()) result.Add("RANGE_MIN", pParameter->RangeMin()); |
924 |
|
if (pParameter->RangeMax()) result.Add("RANGE_MAX", pParameter->RangeMax()); |
925 |
|
if (pParameter->Possibilities()) result.Add("POSSIBILITIES", pParameter->Possibilities()); |
926 |
|
} |
927 |
|
catch (LinuxSamplerException e) { |
928 |
|
result.Error(e); |
929 |
} |
} |
930 |
return result.Produce(); |
return result.Produce(); |
931 |
} |
} |