/[svn]/linuxsampler/trunk/src/network/lscpserver.cpp
ViewVC logotype

Diff of /linuxsampler/trunk/src/network/lscpserver.cpp

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 221 by schoenebeck, Fri Aug 20 17:25:19 2004 UTC revision 223 by schoenebeck, Sat Aug 21 11:43:53 2004 UTC
# Line 390  String LSCPServer::DestroyAudioOutputDev Line 390  String LSCPServer::DestroyAudioOutputDev
390      LSCPResultSet result;      LSCPResultSet result;
391      try {      try {
392          std::map<uint, AudioOutputDevice*> devices = pSampler->GetAudioOutputDevices();          std::map<uint, AudioOutputDevice*> devices = pSampler->GetAudioOutputDevices();
393          if (!devices[DeviceIndex]) throw LinuxSamplerException("There is no audio output device with index " + ToString(DeviceIndex) + ".");          if (!devices.count(DeviceIndex)) throw LinuxSamplerException("There is no audio output device with index " + ToString(DeviceIndex) + ".");
394          AudioOutputDevice* pDevice = devices[DeviceIndex];          AudioOutputDevice* pDevice = devices[DeviceIndex];
395          pSampler->DestroyAudioOutputDevice(pDevice);          pSampler->DestroyAudioOutputDevice(pDevice);
396      }      }
# Line 405  String LSCPServer::DestroyMidiInputDevic Line 405  String LSCPServer::DestroyMidiInputDevic
405      LSCPResultSet result;      LSCPResultSet result;
406      try {      try {
407          std::map<uint, MidiInputDevice*> devices = pSampler->GetMidiInputDevices();          std::map<uint, MidiInputDevice*> devices = pSampler->GetMidiInputDevices();
408            if (!devices.count(DeviceIndex)) throw LinuxSamplerException("There is no audio output device with index " + ToString(DeviceIndex) + ".");
409          MidiInputDevice* pDevice = devices[DeviceIndex];          MidiInputDevice* pDevice = devices[DeviceIndex];
         if (!pDevice) throw LinuxSamplerException("There is no audio output device with index " + ToString(DeviceIndex) + ".");  
410          pSampler->DestroyMidiInputDevice(pDevice);          pSampler->DestroyMidiInputDevice(pDevice);
411      }      }
412      catch (LinuxSamplerException e) {      catch (LinuxSamplerException e) {
# Line 426  String LSCPServer::LoadInstrument(String Line 426  String LSCPServer::LoadInstrument(String
426          if (!pSamplerChannel) throw LinuxSamplerException("Index out of bounds");          if (!pSamplerChannel) throw LinuxSamplerException("Index out of bounds");
427          Engine* pEngine = pSamplerChannel->GetEngine();          Engine* pEngine = pSamplerChannel->GetEngine();
428          if (!pEngine) throw LinuxSamplerException("No engine loaded on channel");          if (!pEngine) throw LinuxSamplerException("No engine loaded on channel");
429          if (pSamplerChannel->GetAudioOutputDevice() == NULL)          if (!pSamplerChannel->GetAudioOutputDevice())
430              throw LinuxSamplerException("No audio output device on channel");              throw LinuxSamplerException("No audio output device on channel");
431          if (bBackground) {          if (bBackground) {
432              LSCPLoadInstrument *pLoadInstrument = new LSCPLoadInstrument(pEngine, Filename.c_str(), uiInstrument);              LSCPLoadInstrument *pLoadInstrument = new LSCPLoadInstrument(pEngine, Filename.c_str(), uiInstrument);
# Line 741  String LSCPServer::GetMidiInputDriverPar Line 741  String LSCPServer::GetMidiInputDriverPar
741          DeviceCreationParameter* pParameter = MidiInputDeviceFactory::GetDriverParameter(Driver, Parameter);          DeviceCreationParameter* pParameter = MidiInputDeviceFactory::GetDriverParameter(Driver, Parameter);
742          result.Add("TYPE",         pParameter->Type());          result.Add("TYPE",         pParameter->Type());
743          result.Add("DESCRIPTION",  pParameter->Description());          result.Add("DESCRIPTION",  pParameter->Description());
744          result.Add("MANDATORY",    (pParameter->Mandatory())    ? "true" : "false");          result.Add("MANDATORY",    pParameter->Mandatory());
745          result.Add("FIX",          (pParameter->Fix())          ? "true" : "false");          result.Add("FIX",          pParameter->Fix());
746          result.Add("MULTIPLICITY", (pParameter->Multiplicity()) ? "true" : "false");          result.Add("MULTIPLICITY", pParameter->Multiplicity());
747          if (pParameter->Depends())       result.Add("DEPENDS",       *pParameter->Depends());          if (pParameter->Depends())       result.Add("DEPENDS",       *pParameter->Depends());
748          if (pParameter->Default())       result.Add("DEFAULT",       *pParameter->Default());          if (pParameter->Default())       result.Add("DEFAULT",       *pParameter->Default());
749          if (pParameter->RangeMin())      result.Add("RANGE_MIN",     *pParameter->RangeMin());          if (pParameter->RangeMin())      result.Add("RANGE_MIN",     *pParameter->RangeMin());
# Line 763  String LSCPServer::GetAudioOutputDriverP Line 763  String LSCPServer::GetAudioOutputDriverP
763          DeviceCreationParameter* pParameter = AudioOutputDeviceFactory::GetDriverParameter(Driver, Parameter);          DeviceCreationParameter* pParameter = AudioOutputDeviceFactory::GetDriverParameter(Driver, Parameter);
764          result.Add("TYPE",         pParameter->Type());          result.Add("TYPE",         pParameter->Type());
765          result.Add("DESCRIPTION",  pParameter->Description());          result.Add("DESCRIPTION",  pParameter->Description());
766          result.Add("MANDATORY",    (pParameter->Mandatory())    ? "true" : "false");          result.Add("MANDATORY",    pParameter->Mandatory());
767          result.Add("FIX",          (pParameter->Fix())          ? "true" : "false");          result.Add("FIX",          pParameter->Fix());
768          result.Add("MULTIPLICITY", (pParameter->Multiplicity()) ? "true" : "false");          result.Add("MULTIPLICITY", pParameter->Multiplicity());
769          if (pParameter->Depends())       result.Add("DEPENDS",       *pParameter->Depends());          if (pParameter->Depends())       result.Add("DEPENDS",       *pParameter->Depends());
770          if (pParameter->Default())       result.Add("DEFAULT",       *pParameter->Default());          if (pParameter->Default())       result.Add("DEFAULT",       *pParameter->Default());
771          if (pParameter->RangeMin())      result.Add("RANGE_MIN",     *pParameter->RangeMin());          if (pParameter->RangeMin())      result.Add("RANGE_MIN",     *pParameter->RangeMin());
# Line 847  String LSCPServer::GetAudioOutputDeviceI Line 847  String LSCPServer::GetAudioOutputDeviceI
847      LSCPResultSet result;      LSCPResultSet result;
848      try {      try {
849          std::map<uint,AudioOutputDevice*> devices = pSampler->GetAudioOutputDevices();          std::map<uint,AudioOutputDevice*> devices = pSampler->GetAudioOutputDevices();
850          if (!devices[DeviceIndex]) throw LinuxSamplerException("There is no audio output device with index " + ToString(DeviceIndex) + ".");          if (!devices.count(DeviceIndex)) throw LinuxSamplerException("There is no audio output device with index " + ToString(DeviceIndex) + ".");
851          AudioOutputDevice* pDevice = devices[DeviceIndex];          AudioOutputDevice* pDevice = devices[DeviceIndex];
852          result.Add("DRIVER", pDevice->Driver());          result.Add("DRIVER", pDevice->Driver());
853          std::map<String,DeviceCreationParameter*> parameters = pDevice->DeviceParameters();          std::map<String,DeviceCreationParameter*> parameters = pDevice->DeviceParameters();
# Line 867  String LSCPServer::GetMidiInputDeviceInf Line 867  String LSCPServer::GetMidiInputDeviceInf
867      LSCPResultSet result;      LSCPResultSet result;
868      try {      try {
869          std::map<uint,MidiInputDevice*> devices = pSampler->GetMidiInputDevices();          std::map<uint,MidiInputDevice*> devices = pSampler->GetMidiInputDevices();
870            if (!devices.count(DeviceIndex)) throw LinuxSamplerException("There is no MIDI input device with index " + ToString(DeviceIndex) + ".");
871          MidiInputDevice* pDevice = devices[DeviceIndex];          MidiInputDevice* pDevice = devices[DeviceIndex];
         if (!pDevice) throw LinuxSamplerException("There is no MIDI input device with index " + ToString(DeviceIndex) + ".");  
872          result.Add("DRIVER", pDevice->Driver());          result.Add("DRIVER", pDevice->Driver());
873          std::map<String,DeviceCreationParameter*> parameters = pDevice->DeviceParameters();          std::map<String,DeviceCreationParameter*> parameters = pDevice->DeviceParameters();
874          std::map<String,DeviceCreationParameter*>::iterator iter = parameters.begin();          std::map<String,DeviceCreationParameter*>::iterator iter = parameters.begin();
# Line 885  String LSCPServer::GetMidiInputPortInfo( Line 885  String LSCPServer::GetMidiInputPortInfo(
885      dmsg(2,("LSCPServer: GetMidiInputPortInfo(DeviceIndex=%d, PortIndex=%d)\n",DeviceIndex, PortIndex));      dmsg(2,("LSCPServer: GetMidiInputPortInfo(DeviceIndex=%d, PortIndex=%d)\n",DeviceIndex, PortIndex));
886      LSCPResultSet result;      LSCPResultSet result;
887      try {      try {
888            // get MIDI input device
889          std::map<uint,MidiInputDevice*> devices = pSampler->GetMidiInputDevices();          std::map<uint,MidiInputDevice*> devices = pSampler->GetMidiInputDevices();
890            if (!devices.count(DeviceIndex)) throw LinuxSamplerException("There is no MIDI input device with index " + ToString(DeviceIndex) + ".");
891          MidiInputDevice* pDevice = devices[DeviceIndex];          MidiInputDevice* pDevice = devices[DeviceIndex];
892          if (!pDevice) throw LinuxSamplerException("There is no MIDI input device with index " + ToString(DeviceIndex) + ".");  
893            // get MIDI port
894          MidiInputPort* pMidiInputPort = pDevice->GetPort(PortIndex);          MidiInputPort* pMidiInputPort = pDevice->GetPort(PortIndex);
895          if (!pMidiInputPort) throw LinuxSamplerException("There is no MIDI input port with index " + ToString(PortIndex) + ".");          if (!pMidiInputPort) throw LinuxSamplerException("There is no MIDI input port with index " + ToString(PortIndex) + ".");
896    
897            // return the values of all MIDI port parameters
898          std::map<String,DeviceRuntimeParameter*> parameters = pMidiInputPort->PortParameters();          std::map<String,DeviceRuntimeParameter*> parameters = pMidiInputPort->PortParameters();
899          std::map<String,DeviceRuntimeParameter*>::iterator iter = parameters.begin();          std::map<String,DeviceRuntimeParameter*>::iterator iter = parameters.begin();
900          for (; iter != parameters.end(); iter++) {          for (; iter != parameters.end(); iter++) {
# Line 908  String LSCPServer::GetAudioOutputChannel Line 913  String LSCPServer::GetAudioOutputChannel
913      try {      try {
914          // get audio output device          // get audio output device
915          std::map<uint,AudioOutputDevice*> devices = pSampler->GetAudioOutputDevices();          std::map<uint,AudioOutputDevice*> devices = pSampler->GetAudioOutputDevices();
916          if (!devices[DeviceId]) throw LinuxSamplerException("There is no audio output device with index " + ToString(DeviceId) + ".");          if (!devices.count(DeviceId)) throw LinuxSamplerException("There is no audio output device with index " + ToString(DeviceId) + ".");
917          AudioOutputDevice* pDevice = devices[DeviceId];          AudioOutputDevice* pDevice = devices[DeviceId];
918    
919          // get audio channel          // get audio channel
# Line 932  String LSCPServer::GetMidiInputPortParam Line 937  String LSCPServer::GetMidiInputPortParam
937      dmsg(2,("LSCPServer: GetMidiInputPortParameterInfo(DeviceId=%d,PortId=%d,ParameterName=%s)\n",DeviceId,PortId,ParameterName.c_str()));      dmsg(2,("LSCPServer: GetMidiInputPortParameterInfo(DeviceId=%d,PortId=%d,ParameterName=%s)\n",DeviceId,PortId,ParameterName.c_str()));
938      LSCPResultSet result;      LSCPResultSet result;
939      try {      try {
940          // get audio output device          // get MIDI input device
941          std::map<uint,MidiInputDevice*> devices = pSampler->GetMidiInputDevices();          std::map<uint,MidiInputDevice*> devices = pSampler->GetMidiInputDevices();
942          if (!devices[DeviceId]) throw LinuxSamplerException("There is no midi input device with index " + ToString(DeviceId) + ".");          if (!devices.count(DeviceId)) throw LinuxSamplerException("There is no midi input device with index " + ToString(DeviceId) + ".");
943          MidiInputDevice* pDevice = devices[DeviceId];          MidiInputDevice* pDevice = devices[DeviceId];
944    
945          // get midi port          // get midi port
946          MidiInputPort* pPort = pDevice->GetPort(PortId);          MidiInputPort* pPort = pDevice->GetPort(PortId);
947          if (!pPort) throw LinuxSamplerException("Midi input device does not have port " + ToString(PortId) + ".");          if (!pPort) throw LinuxSamplerException("Midi input device does not have port " + ToString(PortId) + ".");
948    
949          // get desired port parameter          // get desired port parameter
950          std::map<String,DeviceRuntimeParameter*> parameters = pPort->PortParameters();          std::map<String,DeviceRuntimeParameter*> parameters = pPort->PortParameters();
951          if (!parameters[ParameterName]) throw LinuxSamplerException("Midi port does not provice a parameters '" + ParameterName + "'.");          if (!parameters.count(ParameterName)) throw LinuxSamplerException("Midi port does not provide a parameter '" + ParameterName + "'.");
952          DeviceRuntimeParameter* pParameter = parameters[ParameterName];          DeviceRuntimeParameter* pParameter = parameters[ParameterName];
953    
954          // return all fields of this audio channel parameter          // return all fields of this audio channel parameter
955          result.Add("TYPE",         pParameter->Type());          result.Add("TYPE",         pParameter->Type());
956          result.Add("DESCRIPTION",  pParameter->Description());          result.Add("DESCRIPTION",  pParameter->Description());
957          result.Add("FIX",          pParameter->Fix());          result.Add("FIX",          pParameter->Fix());
958          result.Add("MULTIPLICITY", pParameter->Multiplicity());          result.Add("MULTIPLICITY", pParameter->Multiplicity());
959          if (pParameter->RangeMin())      result.Add("RANGE_MIN",     pParameter->RangeMin());          if (pParameter->RangeMin())      result.Add("RANGE_MIN",     *pParameter->RangeMin());
960          if (pParameter->RangeMax())      result.Add("RANGE_MAX",     pParameter->RangeMax());          if (pParameter->RangeMax())      result.Add("RANGE_MAX",     *pParameter->RangeMax());
961          if (pParameter->Possibilities()) result.Add("POSSIBILITIES", pParameter->Possibilities());          if (pParameter->Possibilities()) result.Add("POSSIBILITIES", *pParameter->Possibilities());
962      }      }
963      catch (LinuxSamplerException e) {      catch (LinuxSamplerException e) {
964          result.Error(e);          result.Error(e);
# Line 967  String LSCPServer::GetAudioOutputChannel Line 972  String LSCPServer::GetAudioOutputChannel
972      try {      try {
973          // get audio output device          // get audio output device
974          std::map<uint,AudioOutputDevice*> devices = pSampler->GetAudioOutputDevices();          std::map<uint,AudioOutputDevice*> devices = pSampler->GetAudioOutputDevices();
975          if (!devices[DeviceId]) throw LinuxSamplerException("There is no audio output device with index " + ToString(DeviceId) + ".");          if (!devices.count(DeviceId)) throw LinuxSamplerException("There is no audio output device with index " + ToString(DeviceId) + ".");
976          AudioOutputDevice* pDevice = devices[DeviceId];          AudioOutputDevice* pDevice = devices[DeviceId];
977    
978          // get audio channel          // get audio channel
# Line 976  String LSCPServer::GetAudioOutputChannel Line 981  String LSCPServer::GetAudioOutputChannel
981    
982          // get desired audio channel parameter          // get desired audio channel parameter
983          std::map<String,DeviceRuntimeParameter*> parameters = pChannel->ChannelParameters();          std::map<String,DeviceRuntimeParameter*> parameters = pChannel->ChannelParameters();
984          if (!parameters[ParameterName]) throw LinuxSamplerException("Audio channel does not provide a parameter '" + ParameterName + "'.");          if (!parameters.count(ParameterName)) throw LinuxSamplerException("Audio channel does not provide a parameter '" + ParameterName + "'.");
985          DeviceRuntimeParameter* pParameter = parameters[ParameterName];          DeviceRuntimeParameter* pParameter = parameters[ParameterName];
986    
987          // return all fields of this audio channel parameter          // return all fields of this audio channel parameter
# Line 984  String LSCPServer::GetAudioOutputChannel Line 989  String LSCPServer::GetAudioOutputChannel
989          result.Add("DESCRIPTION",  pParameter->Description());          result.Add("DESCRIPTION",  pParameter->Description());
990          result.Add("FIX",          pParameter->Fix());          result.Add("FIX",          pParameter->Fix());
991          result.Add("MULTIPLICITY", pParameter->Multiplicity());          result.Add("MULTIPLICITY", pParameter->Multiplicity());
992          if (pParameter->RangeMin())      result.Add("RANGE_MIN",     pParameter->RangeMin());          if (pParameter->RangeMin())      result.Add("RANGE_MIN",     *pParameter->RangeMin());
993          if (pParameter->RangeMax())      result.Add("RANGE_MAX",     pParameter->RangeMax());          if (pParameter->RangeMax())      result.Add("RANGE_MAX",     *pParameter->RangeMax());
994          if (pParameter->Possibilities()) result.Add("POSSIBILITIES", pParameter->Possibilities());          if (pParameter->Possibilities()) result.Add("POSSIBILITIES", *pParameter->Possibilities());
995      }      }
996      catch (LinuxSamplerException e) {      catch (LinuxSamplerException e) {
997          result.Error(e);          result.Error(e);
# Line 1000  String LSCPServer::SetAudioOutputChannel Line 1005  String LSCPServer::SetAudioOutputChannel
1005      try {      try {
1006          // get audio output device          // get audio output device
1007          std::map<uint,AudioOutputDevice*> devices = pSampler->GetAudioOutputDevices();          std::map<uint,AudioOutputDevice*> devices = pSampler->GetAudioOutputDevices();
1008          if (!devices[DeviceId]) throw LinuxSamplerException("There is no audio output device with index " + ToString(DeviceId) + ".");          if (!devices.count(DeviceId)) throw LinuxSamplerException("There is no audio output device with index " + ToString(DeviceId) + ".");
1009          AudioOutputDevice* pDevice = devices[DeviceId];          AudioOutputDevice* pDevice = devices[DeviceId];
1010    
1011          // get audio channel          // get audio channel
# Line 1009  String LSCPServer::SetAudioOutputChannel Line 1014  String LSCPServer::SetAudioOutputChannel
1014    
1015          // get desired audio channel parameter          // get desired audio channel parameter
1016          std::map<String,DeviceRuntimeParameter*> parameters = pChannel->ChannelParameters();          std::map<String,DeviceRuntimeParameter*> parameters = pChannel->ChannelParameters();
1017          if (!parameters[ParamKey]) throw LinuxSamplerException("Audio channel does not provide a parameter '" + ParamKey + "'.");          if (!parameters.count(ParamKey)) throw LinuxSamplerException("Audio channel does not provide a parameter '" + ParamKey + "'.");
1018          DeviceRuntimeParameter* pParameter = parameters[ParamKey];          DeviceRuntimeParameter* pParameter = parameters[ParamKey];
1019    
1020          // set new channel parameter value          // set new channel parameter value
# Line 1026  String LSCPServer::SetAudioOutputDeviceP Line 1031  String LSCPServer::SetAudioOutputDeviceP
1031      LSCPResultSet result;      LSCPResultSet result;
1032      try {      try {
1033          std::map<uint,AudioOutputDevice*> devices = pSampler->GetAudioOutputDevices();          std::map<uint,AudioOutputDevice*> devices = pSampler->GetAudioOutputDevices();
1034          if (!devices[DeviceIndex]) throw LinuxSamplerException("There is no audio output device with index " + ToString(DeviceIndex) + ".");          if (!devices.count(DeviceIndex)) throw LinuxSamplerException("There is no audio output device with index " + ToString(DeviceIndex) + ".");
1035          AudioOutputDevice* pDevice = devices[DeviceIndex];          AudioOutputDevice* pDevice = devices[DeviceIndex];
1036          std::map<String,DeviceCreationParameter*> parameters = pDevice->DeviceParameters();          std::map<String,DeviceCreationParameter*> parameters = pDevice->DeviceParameters();
1037          if (!parameters[ParamKey]) throw LinuxSamplerException("Audio output device " + ToString(DeviceIndex) + " does not have a device parameter '" + ParamKey + "'");          if (!parameters.count(ParamKey)) throw LinuxSamplerException("Audio output device " + ToString(DeviceIndex) + " does not have a device parameter '" + ParamKey + "'");
1038          parameters[ParamKey]->SetValue(ParamVal);          parameters[ParamKey]->SetValue(ParamVal);
1039      }      }
1040      catch (LinuxSamplerException e) {      catch (LinuxSamplerException e) {
# Line 1043  String LSCPServer::SetMidiInputDevicePar Line 1048  String LSCPServer::SetMidiInputDevicePar
1048      LSCPResultSet result;      LSCPResultSet result;
1049      try {      try {
1050          std::map<uint,MidiInputDevice*> devices = pSampler->GetMidiInputDevices();          std::map<uint,MidiInputDevice*> devices = pSampler->GetMidiInputDevices();
1051          if (!devices[DeviceIndex]) throw LinuxSamplerException("There is no MIDI input device with index " + ToString(DeviceIndex) + ".");          if (!devices.count(DeviceIndex)) throw LinuxSamplerException("There is no MIDI input device with index " + ToString(DeviceIndex) + ".");
1052          MidiInputDevice* pDevice = devices[DeviceIndex];          MidiInputDevice* pDevice = devices[DeviceIndex];
1053          std::map<String,DeviceCreationParameter*> parameters = pDevice->DeviceParameters();          std::map<String,DeviceCreationParameter*> parameters = pDevice->DeviceParameters();
1054          if (!parameters[ParamKey]) throw LinuxSamplerException("MIDI input device " + ToString(DeviceIndex) + " does not have a device parameter '" + ParamKey + "'");          if (!parameters.count(ParamKey)) throw LinuxSamplerException("MIDI input device " + ToString(DeviceIndex) + " does not have a device parameter '" + ParamKey + "'");
1055          parameters[ParamKey]->SetValue(ParamVal);          parameters[ParamKey]->SetValue(ParamVal);
1056      }      }
1057      catch (LinuxSamplerException e) {      catch (LinuxSamplerException e) {
# Line 1059  String LSCPServer::SetMidiInputPortParam Line 1064  String LSCPServer::SetMidiInputPortParam
1064      dmsg(2,("LSCPServer: SetMidiOutputDeviceParameter(DeviceIndex=%d,ParamKey=%s,ParamVal=%s)\n",DeviceIndex,ParamKey.c_str(),ParamVal.c_str()));      dmsg(2,("LSCPServer: SetMidiOutputDeviceParameter(DeviceIndex=%d,ParamKey=%s,ParamVal=%s)\n",DeviceIndex,ParamKey.c_str(),ParamVal.c_str()));
1065      LSCPResultSet result;      LSCPResultSet result;
1066      try {      try {
1067            // get MIDI input device
1068          std::map<uint,MidiInputDevice*> devices = pSampler->GetMidiInputDevices();          std::map<uint,MidiInputDevice*> devices = pSampler->GetMidiInputDevices();
1069            if (!devices.count(DeviceIndex)) throw LinuxSamplerException("There is no MIDI input device with index " + ToString(DeviceIndex) + ".");
1070          MidiInputDevice* pDevice = devices[DeviceIndex];          MidiInputDevice* pDevice = devices[DeviceIndex];
1071          if (!pDevice) throw LinuxSamplerException("There is no MIDI input device with index " + ToString(DeviceIndex) + ".");  
1072            // get MIDI port
1073          MidiInputPort* pMidiInputPort = pDevice->GetPort(PortIndex);          MidiInputPort* pMidiInputPort = pDevice->GetPort(PortIndex);
1074          if (!pMidiInputPort) throw LinuxSamplerException("There is no MIDI input port with index " + ToString(PortIndex) + ".");          if (!pMidiInputPort) throw LinuxSamplerException("There is no MIDI input port with index " + ToString(PortIndex) + ".");
1075    
1076            // set port parameter value
1077          std::map<String,DeviceRuntimeParameter*> parameters = pMidiInputPort->PortParameters();          std::map<String,DeviceRuntimeParameter*> parameters = pMidiInputPort->PortParameters();
1078          if (!parameters[ParamKey]) throw LinuxSamplerException("MIDI input device " + ToString(PortIndex) + " does not have a parameter '" + ParamKey + "'");          if (!parameters.count(ParamKey)) throw LinuxSamplerException("MIDI input device " + ToString(PortIndex) + " does not have a parameter '" + ParamKey + "'");
1079          parameters[ParamKey]->SetValue(ParamVal);          parameters[ParamKey]->SetValue(ParamVal);
1080      }      }
1081      catch (LinuxSamplerException e) {      catch (LinuxSamplerException e) {
# Line 1090  String LSCPServer::SetAudioOutputDevice( Line 1100  String LSCPServer::SetAudioOutputDevice(
1100          SamplerChannel* pSamplerChannel = pSampler->GetSamplerChannel(uiSamplerChannel);          SamplerChannel* pSamplerChannel = pSampler->GetSamplerChannel(uiSamplerChannel);
1101          if (!pSamplerChannel) throw LinuxSamplerException("Invalid channel number " + ToString(uiSamplerChannel));          if (!pSamplerChannel) throw LinuxSamplerException("Invalid channel number " + ToString(uiSamplerChannel));
1102          std::map<uint, AudioOutputDevice*> devices = pSampler->GetAudioOutputDevices();          std::map<uint, AudioOutputDevice*> devices = pSampler->GetAudioOutputDevices();
1103            if (!devices.count(AudioDeviceId)) throw LinuxSamplerException("There is no audio output device with index " + ToString(AudioDeviceId));
1104          AudioOutputDevice* pDevice = devices[AudioDeviceId];          AudioOutputDevice* pDevice = devices[AudioDeviceId];
         if (!pDevice) throw LinuxSamplerException("There is no audio output device with index " + ToString(AudioDeviceId));  
1105          pSamplerChannel->SetAudioOutputDevice(pDevice);          pSamplerChannel->SetAudioOutputDevice(pDevice);
1106      }      }
1107      catch (LinuxSamplerException e) {      catch (LinuxSamplerException e) {
# Line 1172  String LSCPServer::SetMIDIInputDevice(ui Line 1182  String LSCPServer::SetMIDIInputDevice(ui
1182          SamplerChannel* pSamplerChannel = pSampler->GetSamplerChannel(uiSamplerChannel);          SamplerChannel* pSamplerChannel = pSampler->GetSamplerChannel(uiSamplerChannel);
1183          if (!pSamplerChannel) throw LinuxSamplerException("Invalid channel number " + ToString(uiSamplerChannel));          if (!pSamplerChannel) throw LinuxSamplerException("Invalid channel number " + ToString(uiSamplerChannel));
1184          std::map<uint, MidiInputDevice*> devices = pSampler->GetMidiInputDevices();          std::map<uint, MidiInputDevice*> devices = pSampler->GetMidiInputDevices();
1185            if (!devices.count(MIDIDeviceId)) throw LinuxSamplerException("There is no MIDI input device with index " + ToString(MIDIDeviceId));
1186          MidiInputDevice* pDevice = devices[MIDIDeviceId];          MidiInputDevice* pDevice = devices[MIDIDeviceId];
         if (!pDevice) throw LinuxSamplerException("There is no MIDI input device with index " + ToString(MIDIDeviceId));  
1187          pSamplerChannel->SetMidiInputDevice(pDevice);          pSamplerChannel->SetMidiInputDevice(pDevice);
1188      }      }
1189      catch (LinuxSamplerException e) {      catch (LinuxSamplerException e) {
# Line 1232  String LSCPServer::SetMIDIInput(uint MID Line 1242  String LSCPServer::SetMIDIInput(uint MID
1242          SamplerChannel* pSamplerChannel = pSampler->GetSamplerChannel(uiSamplerChannel);          SamplerChannel* pSamplerChannel = pSampler->GetSamplerChannel(uiSamplerChannel);
1243          if (!pSamplerChannel) throw LinuxSamplerException("Invalid channel number " + ToString(uiSamplerChannel));          if (!pSamplerChannel) throw LinuxSamplerException("Invalid channel number " + ToString(uiSamplerChannel));
1244          std::map<uint, MidiInputDevice*> devices =  pSampler->GetMidiInputDevices();          std::map<uint, MidiInputDevice*> devices =  pSampler->GetMidiInputDevices();
1245            if (!devices.count(MIDIDeviceId)) throw LinuxSamplerException("There is no MIDI input device with index " + ToString(MIDIDeviceId));
1246          MidiInputDevice* pDevice = devices[MIDIDeviceId];          MidiInputDevice* pDevice = devices[MIDIDeviceId];
         if (!pDevice) throw LinuxSamplerException("There is no MIDI input device with index " + ToString(MIDIDeviceId));  
1247          pSamplerChannel->SetMidiInput(pDevice, MIDIPort, (MidiInputPort::midi_chan_t) MIDIChannel);          pSamplerChannel->SetMidiInput(pDevice, MIDIPort, (MidiInputPort::midi_chan_t) MIDIChannel);
1248      }      }
1249      catch (LinuxSamplerException e) {      catch (LinuxSamplerException e) {

Legend:
Removed from v.221  
changed lines
  Added in v.223

  ViewVC Help
Powered by ViewVC