/[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 841 by persson, Sat Mar 4 16:23:53 2006 UTC revision 880 by schoenebeck, Tue Jun 27 22:57:37 2006 UTC
# Line 3  Line 3 
3   *   LinuxSampler - modular, streaming capable sampler                     *   *   LinuxSampler - modular, streaming capable sampler                     *
4   *                                                                         *   *                                                                         *
5   *   Copyright (C) 2003, 2004 by Benno Senoner and Christian Schoenebeck   *   *   Copyright (C) 2003, 2004 by Benno Senoner and Christian Schoenebeck   *
6   *   Copyright (C) 2005 Christian Schoenebeck                              *   *   Copyright (C) 2005, 2006 Christian Schoenebeck                        *
7   *                                                                         *   *                                                                         *
8   *   This library is free software; you can redistribute it and/or modify  *   *   This library is free software; you can redistribute it and/or modify  *
9   *   it under the terms of the GNU General Public License as published by  *   *   it under the terms of the GNU General Public License as published by  *
# Line 427  String LSCPServer::CreateAudioOutputDevi Line 427  String LSCPServer::CreateAudioOutputDevi
427          AudioOutputDevice* pDevice = pSampler->CreateAudioOutputDevice(Driver, Parameters);          AudioOutputDevice* pDevice = pSampler->CreateAudioOutputDevice(Driver, Parameters);
428          // search for the created device to get its index          // search for the created device to get its index
429          int index = GetAudioOutputDeviceIndex(pDevice);          int index = GetAudioOutputDeviceIndex(pDevice);
430          if (index == -1) throw LinuxSamplerException("Internal error: could not find created audio output device.");          if (index == -1) throw Exception("Internal error: could not find created audio output device.");
431          result = index; // success          result = index; // success
432      }      }
433      catch (LinuxSamplerException e) {      catch (Exception e) {
434          result.Error(e);          result.Error(e);
435      }      }
436      return result.Produce();      return result.Produce();
# Line 443  String LSCPServer::CreateMidiInputDevice Line 443  String LSCPServer::CreateMidiInputDevice
443          MidiInputDevice* pDevice = pSampler->CreateMidiInputDevice(Driver, Parameters);          MidiInputDevice* pDevice = pSampler->CreateMidiInputDevice(Driver, Parameters);
444          // search for the created device to get its index          // search for the created device to get its index
445          int index = GetMidiInputDeviceIndex(pDevice);          int index = GetMidiInputDeviceIndex(pDevice);
446          if (index == -1) throw LinuxSamplerException("Internal error: could not find created midi input device.");          if (index == -1) throw Exception("Internal error: could not find created midi input device.");
447          result = index; // success          result = index; // success
448      }      }
449      catch (LinuxSamplerException e) {      catch (Exception e) {
450          result.Error(e);          result.Error(e);
451      }      }
452      return result.Produce();      return result.Produce();
# Line 457  String LSCPServer::DestroyAudioOutputDev Line 457  String LSCPServer::DestroyAudioOutputDev
457      LSCPResultSet result;      LSCPResultSet result;
458      try {      try {
459          std::map<uint, AudioOutputDevice*> devices = pSampler->GetAudioOutputDevices();          std::map<uint, AudioOutputDevice*> devices = pSampler->GetAudioOutputDevices();
460          if (!devices.count(DeviceIndex)) throw LinuxSamplerException("There is no audio output device with index " + ToString(DeviceIndex) + ".");          if (!devices.count(DeviceIndex)) throw Exception("There is no audio output device with index " + ToString(DeviceIndex) + ".");
461          AudioOutputDevice* pDevice = devices[DeviceIndex];          AudioOutputDevice* pDevice = devices[DeviceIndex];
462          pSampler->DestroyAudioOutputDevice(pDevice);          pSampler->DestroyAudioOutputDevice(pDevice);
463      }      }
464      catch (LinuxSamplerException e) {      catch (Exception e) {
465          result.Error(e);          result.Error(e);
466      }      }
467      return result.Produce();      return result.Produce();
# Line 472  String LSCPServer::DestroyMidiInputDevic Line 472  String LSCPServer::DestroyMidiInputDevic
472      LSCPResultSet result;      LSCPResultSet result;
473      try {      try {
474          std::map<uint, MidiInputDevice*> devices = pSampler->GetMidiInputDevices();          std::map<uint, MidiInputDevice*> devices = pSampler->GetMidiInputDevices();
475          if (!devices.count(DeviceIndex)) throw LinuxSamplerException("There is no audio output device with index " + ToString(DeviceIndex) + ".");          if (!devices.count(DeviceIndex)) throw Exception("There is no audio output device with index " + ToString(DeviceIndex) + ".");
476          MidiInputDevice* pDevice = devices[DeviceIndex];          MidiInputDevice* pDevice = devices[DeviceIndex];
477          pSampler->DestroyMidiInputDevice(pDevice);          pSampler->DestroyMidiInputDevice(pDevice);
478      }      }
479      catch (LinuxSamplerException e) {      catch (Exception e) {
480          result.Error(e);          result.Error(e);
481      }      }
482      return result.Produce();      return result.Produce();
# Line 490  String LSCPServer::LoadInstrument(String Line 490  String LSCPServer::LoadInstrument(String
490      LSCPResultSet result;      LSCPResultSet result;
491      try {      try {
492          SamplerChannel* pSamplerChannel = pSampler->GetSamplerChannel(uiSamplerChannel);          SamplerChannel* pSamplerChannel = pSampler->GetSamplerChannel(uiSamplerChannel);
493          if (!pSamplerChannel) throw LinuxSamplerException("Invalid sampler channel number " + ToString(uiSamplerChannel));          if (!pSamplerChannel) throw Exception("Invalid sampler channel number " + ToString(uiSamplerChannel));
494          EngineChannel* pEngineChannel = pSamplerChannel->GetEngineChannel();          EngineChannel* pEngineChannel = pSamplerChannel->GetEngineChannel();
495          if (!pEngineChannel) throw LinuxSamplerException("No engine type assigned to sampler channel yet");          if (!pEngineChannel) throw Exception("No engine type assigned to sampler channel yet");
496          if (!pSamplerChannel->GetAudioOutputDevice())          if (!pSamplerChannel->GetAudioOutputDevice())
497              throw LinuxSamplerException("No audio output device connected to sampler channel");              throw Exception("No audio output device connected to sampler channel");
498          if (bBackground) {          if (bBackground) {
499              InstrumentLoader.StartNewLoad(Filename, uiInstrument, pEngineChannel);              InstrumentLoader.StartNewLoad(Filename, uiInstrument, pEngineChannel);
500          }          }
# Line 505  String LSCPServer::LoadInstrument(String Line 505  String LSCPServer::LoadInstrument(String
505              pEngineChannel->LoadInstrument();              pEngineChannel->LoadInstrument();
506          }          }
507      }      }
508      catch (LinuxSamplerException e) {      catch (Exception e) {
509           result.Error(e);           result.Error(e);
510      }      }
511      return result.Produce();      return result.Produce();
# Line 520  String LSCPServer::SetEngineType(String Line 520  String LSCPServer::SetEngineType(String
520      LSCPResultSet result;      LSCPResultSet result;
521      try {      try {
522          SamplerChannel* pSamplerChannel = pSampler->GetSamplerChannel(uiSamplerChannel);          SamplerChannel* pSamplerChannel = pSampler->GetSamplerChannel(uiSamplerChannel);
523          if (!pSamplerChannel) throw LinuxSamplerException("Invalid sampler channel number " + ToString(uiSamplerChannel));          if (!pSamplerChannel) throw Exception("Invalid sampler channel number " + ToString(uiSamplerChannel));
524          LockRTNotify();          LockRTNotify();
525          pSamplerChannel->SetEngineType(EngineName);          pSamplerChannel->SetEngineType(EngineName);
526          if(HasSoloChannel()) pSamplerChannel->GetEngineChannel()->SetMute(-1);          if(HasSoloChannel()) pSamplerChannel->GetEngineChannel()->SetMute(-1);
527          UnlockRTNotify();          UnlockRTNotify();
528      }      }
529      catch (LinuxSamplerException e) {      catch (Exception e) {
530           result.Error(e);           result.Error(e);
531      }      }
532      return result.Produce();      return result.Produce();
# Line 615  String LSCPServer::GetEngineInfo(String Line 615  String LSCPServer::GetEngineInfo(String
615          result.Add("VERSION",     pEngine->Version());          result.Add("VERSION",     pEngine->Version());
616          EngineFactory::Destroy(pEngine);          EngineFactory::Destroy(pEngine);
617      }      }
618      catch (LinuxSamplerException e) {      catch (Exception e) {
619           result.Error(e);           result.Error(e);
620      }      }
621      UnlockRTNotify();      UnlockRTNotify();
# Line 631  String LSCPServer::GetChannelInfo(uint u Line 631  String LSCPServer::GetChannelInfo(uint u
631      LSCPResultSet result;      LSCPResultSet result;
632      try {      try {
633          SamplerChannel* pSamplerChannel = pSampler->GetSamplerChannel(uiSamplerChannel);          SamplerChannel* pSamplerChannel = pSampler->GetSamplerChannel(uiSamplerChannel);
634          if (!pSamplerChannel) throw LinuxSamplerException("Invalid sampler channel number " + ToString(uiSamplerChannel));          if (!pSamplerChannel) throw Exception("Invalid sampler channel number " + ToString(uiSamplerChannel));
635          EngineChannel* pEngineChannel = pSamplerChannel->GetEngineChannel();          EngineChannel* pEngineChannel = pSamplerChannel->GetEngineChannel();
636    
637          //Defaults values          //Defaults values
# Line 684  String LSCPServer::GetChannelInfo(uint u Line 684  String LSCPServer::GetChannelInfo(uint u
684          result.Add("MUTE", Mute == -1 ? "MUTED_BY_SOLO" : (Mute ? "true" : "false"));          result.Add("MUTE", Mute == -1 ? "MUTED_BY_SOLO" : (Mute ? "true" : "false"));
685          result.Add("SOLO", Solo);          result.Add("SOLO", Solo);
686      }      }
687      catch (LinuxSamplerException e) {      catch (Exception e) {
688           result.Error(e);           result.Error(e);
689      }      }
690      return result.Produce();      return result.Produce();
# Line 699  String LSCPServer::GetVoiceCount(uint ui Line 699  String LSCPServer::GetVoiceCount(uint ui
699      LSCPResultSet result;      LSCPResultSet result;
700      try {      try {
701          SamplerChannel* pSamplerChannel = pSampler->GetSamplerChannel(uiSamplerChannel);          SamplerChannel* pSamplerChannel = pSampler->GetSamplerChannel(uiSamplerChannel);
702          if (!pSamplerChannel) throw LinuxSamplerException("Invalid sampler channel number " + ToString(uiSamplerChannel));          if (!pSamplerChannel) throw Exception("Invalid sampler channel number " + ToString(uiSamplerChannel));
703          EngineChannel* pEngineChannel = pSamplerChannel->GetEngineChannel();          EngineChannel* pEngineChannel = pSamplerChannel->GetEngineChannel();
704          if (!pEngineChannel) throw LinuxSamplerException("No engine loaded on sampler channel");          if (!pEngineChannel) throw Exception("No engine loaded on sampler channel");
705          if (!pEngineChannel->GetEngine()) throw LinuxSamplerException("No audio output device connected to sampler channel");          if (!pEngineChannel->GetEngine()) throw Exception("No audio output device connected to sampler channel");
706          result.Add(pEngineChannel->GetEngine()->VoiceCount());          result.Add(pEngineChannel->GetEngine()->VoiceCount());
707      }      }
708      catch (LinuxSamplerException e) {      catch (Exception e) {
709           result.Error(e);           result.Error(e);
710      }      }
711      return result.Produce();      return result.Produce();
# Line 720  String LSCPServer::GetStreamCount(uint u Line 720  String LSCPServer::GetStreamCount(uint u
720      LSCPResultSet result;      LSCPResultSet result;
721      try {      try {
722          SamplerChannel* pSamplerChannel = pSampler->GetSamplerChannel(uiSamplerChannel);          SamplerChannel* pSamplerChannel = pSampler->GetSamplerChannel(uiSamplerChannel);
723          if (!pSamplerChannel) throw LinuxSamplerException("Invalid sampler channel number " + ToString(uiSamplerChannel));          if (!pSamplerChannel) throw Exception("Invalid sampler channel number " + ToString(uiSamplerChannel));
724          EngineChannel* pEngineChannel = pSamplerChannel->GetEngineChannel();          EngineChannel* pEngineChannel = pSamplerChannel->GetEngineChannel();
725          if (!pEngineChannel) throw LinuxSamplerException("No engine type assigned to sampler channel");          if (!pEngineChannel) throw Exception("No engine type assigned to sampler channel");
726          if (!pEngineChannel->GetEngine()) throw LinuxSamplerException("No audio output device connected to sampler channel");          if (!pEngineChannel->GetEngine()) throw Exception("No audio output device connected to sampler channel");
727          result.Add(pEngineChannel->GetEngine()->DiskStreamCount());          result.Add(pEngineChannel->GetEngine()->DiskStreamCount());
728      }      }
729      catch (LinuxSamplerException e) {      catch (Exception e) {
730           result.Error(e);           result.Error(e);
731      }      }
732      return result.Produce();      return result.Produce();
# Line 741  String LSCPServer::GetBufferFill(fill_re Line 741  String LSCPServer::GetBufferFill(fill_re
741      LSCPResultSet result;      LSCPResultSet result;
742      try {      try {
743          SamplerChannel* pSamplerChannel = pSampler->GetSamplerChannel(uiSamplerChannel);          SamplerChannel* pSamplerChannel = pSampler->GetSamplerChannel(uiSamplerChannel);
744          if (!pSamplerChannel) throw LinuxSamplerException("Invalid sampler channel number " + ToString(uiSamplerChannel));          if (!pSamplerChannel) throw Exception("Invalid sampler channel number " + ToString(uiSamplerChannel));
745          EngineChannel* pEngineChannel = pSamplerChannel->GetEngineChannel();          EngineChannel* pEngineChannel = pSamplerChannel->GetEngineChannel();
746          if (!pEngineChannel) throw LinuxSamplerException("No engine type assigned to sampler channel");          if (!pEngineChannel) throw Exception("No engine type assigned to sampler channel");
747          if (!pEngineChannel->GetEngine()) throw LinuxSamplerException("No audio output device connected to sampler channel");          if (!pEngineChannel->GetEngine()) throw Exception("No audio output device connected to sampler channel");
748          if (!pEngineChannel->GetEngine()->DiskStreamSupported()) result.Add("NA");          if (!pEngineChannel->GetEngine()->DiskStreamSupported()) result.Add("NA");
749          else {          else {
750              switch (ResponseType) {              switch (ResponseType) {
# Line 755  String LSCPServer::GetBufferFill(fill_re Line 755  String LSCPServer::GetBufferFill(fill_re
755                      result.Add(pEngineChannel->GetEngine()->DiskStreamBufferFillPercentage());                      result.Add(pEngineChannel->GetEngine()->DiskStreamBufferFillPercentage());
756                      break;                      break;
757                  default:                  default:
758                      throw LinuxSamplerException("Unknown fill response type");                      throw Exception("Unknown fill response type");
759              }              }
760          }          }
761      }      }
762      catch (LinuxSamplerException e) {      catch (Exception e) {
763           result.Error(e);           result.Error(e);
764      }      }
765      return result.Produce();      return result.Produce();
# Line 772  String LSCPServer::GetAvailableAudioOutp Line 772  String LSCPServer::GetAvailableAudioOutp
772          int n = AudioOutputDeviceFactory::AvailableDrivers().size();          int n = AudioOutputDeviceFactory::AvailableDrivers().size();
773          result.Add(n);          result.Add(n);
774      }      }
775      catch (LinuxSamplerException e) {      catch (Exception e) {
776          result.Error(e);          result.Error(e);
777      }      }
778      return result.Produce();      return result.Produce();
# Line 785  String LSCPServer::ListAvailableAudioOut Line 785  String LSCPServer::ListAvailableAudioOut
785          String s = AudioOutputDeviceFactory::AvailableDriversAsString();          String s = AudioOutputDeviceFactory::AvailableDriversAsString();
786          result.Add(s);          result.Add(s);
787      }      }
788      catch (LinuxSamplerException e) {      catch (Exception e) {
789          result.Error(e);          result.Error(e);
790      }      }
791      return result.Produce();      return result.Produce();
# Line 798  String LSCPServer::GetAvailableMidiInput Line 798  String LSCPServer::GetAvailableMidiInput
798          int n = MidiInputDeviceFactory::AvailableDrivers().size();          int n = MidiInputDeviceFactory::AvailableDrivers().size();
799          result.Add(n);          result.Add(n);
800      }      }
801      catch (LinuxSamplerException e) {      catch (Exception e) {
802          result.Error(e);          result.Error(e);
803      }      }
804      return result.Produce();      return result.Produce();
# Line 811  String LSCPServer::ListAvailableMidiInpu Line 811  String LSCPServer::ListAvailableMidiInpu
811          String s = MidiInputDeviceFactory::AvailableDriversAsString();          String s = MidiInputDeviceFactory::AvailableDriversAsString();
812          result.Add(s);          result.Add(s);
813      }      }
814      catch (LinuxSamplerException e) {      catch (Exception e) {
815          result.Error(e);          result.Error(e);
816      }      }
817      return result.Produce();      return result.Produce();
# Line 835  String LSCPServer::GetMidiInputDriverInf Line 835  String LSCPServer::GetMidiInputDriverInf
835              result.Add("PARAMETERS", s);              result.Add("PARAMETERS", s);
836          }          }
837      }      }
838      catch (LinuxSamplerException e) {      catch (Exception e) {
839          result.Error(e);          result.Error(e);
840      }      }
841      return result.Produce();      return result.Produce();
# Line 859  String LSCPServer::GetAudioOutputDriverI Line 859  String LSCPServer::GetAudioOutputDriverI
859              result.Add("PARAMETERS", s);              result.Add("PARAMETERS", s);
860          }          }
861      }      }
862      catch (LinuxSamplerException e) {      catch (Exception e) {
863          result.Error(e);          result.Error(e);
864      }      }
865      return result.Produce();      return result.Produce();
# Line 886  String LSCPServer::GetMidiInputDriverPar Line 886  String LSCPServer::GetMidiInputDriverPar
886          if (oRangeMax)      result.Add("RANGE_MAX",     *oRangeMax);          if (oRangeMax)      result.Add("RANGE_MAX",     *oRangeMax);
887          if (oPossibilities) result.Add("POSSIBILITIES", *oPossibilities);          if (oPossibilities) result.Add("POSSIBILITIES", *oPossibilities);
888      }      }
889      catch (LinuxSamplerException e) {      catch (Exception e) {
890          result.Error(e);          result.Error(e);
891      }      }
892      return result.Produce();      return result.Produce();
# Line 913  String LSCPServer::GetAudioOutputDriverP Line 913  String LSCPServer::GetAudioOutputDriverP
913          if (oRangeMax)      result.Add("RANGE_MAX",     *oRangeMax);          if (oRangeMax)      result.Add("RANGE_MAX",     *oRangeMax);
914          if (oPossibilities) result.Add("POSSIBILITIES", *oPossibilities);          if (oPossibilities) result.Add("POSSIBILITIES", *oPossibilities);
915      }      }
916      catch (LinuxSamplerException e) {      catch (Exception e) {
917          result.Error(e);          result.Error(e);
918      }      }
919      return result.Produce();      return result.Produce();
# Line 926  String LSCPServer::GetAudioOutputDeviceC Line 926  String LSCPServer::GetAudioOutputDeviceC
926          uint count = pSampler->AudioOutputDevices();          uint count = pSampler->AudioOutputDevices();
927          result.Add(count); // success          result.Add(count); // success
928      }      }
929      catch (LinuxSamplerException e) {      catch (Exception e) {
930          result.Error(e);          result.Error(e);
931      }      }
932      return result.Produce();      return result.Produce();
# Line 939  String LSCPServer::GetMidiInputDeviceCou Line 939  String LSCPServer::GetMidiInputDeviceCou
939          uint count = pSampler->MidiInputDevices();          uint count = pSampler->MidiInputDevices();
940          result.Add(count); // success          result.Add(count); // success
941      }      }
942      catch (LinuxSamplerException e) {      catch (Exception e) {
943          result.Error(e);          result.Error(e);
944      }      }
945      return result.Produce();      return result.Produce();
# Line 958  String LSCPServer::GetAudioOutputDevices Line 958  String LSCPServer::GetAudioOutputDevices
958          }          }
959          result.Add(s);          result.Add(s);
960      }      }
961      catch (LinuxSamplerException e) {      catch (Exception e) {
962          result.Error(e);          result.Error(e);
963      }      }
964      return result.Produce();      return result.Produce();
# Line 977  String LSCPServer::GetMidiInputDevices() Line 977  String LSCPServer::GetMidiInputDevices()
977          }          }
978          result.Add(s);          result.Add(s);
979      }      }
980      catch (LinuxSamplerException e) {      catch (Exception e) {
981          result.Error(e);          result.Error(e);
982      }      }
983      return result.Produce();      return result.Produce();
# Line 988  String LSCPServer::GetAudioOutputDeviceI Line 988  String LSCPServer::GetAudioOutputDeviceI
988      LSCPResultSet result;      LSCPResultSet result;
989      try {      try {
990          std::map<uint,AudioOutputDevice*> devices = pSampler->GetAudioOutputDevices();          std::map<uint,AudioOutputDevice*> devices = pSampler->GetAudioOutputDevices();
991          if (!devices.count(DeviceIndex)) throw LinuxSamplerException("There is no audio output device with index " + ToString(DeviceIndex) + ".");          if (!devices.count(DeviceIndex)) throw Exception("There is no audio output device with index " + ToString(DeviceIndex) + ".");
992          AudioOutputDevice* pDevice = devices[DeviceIndex];          AudioOutputDevice* pDevice = devices[DeviceIndex];
993          result.Add("DRIVER", pDevice->Driver());          result.Add("DRIVER", pDevice->Driver());
994          std::map<String,DeviceCreationParameter*> parameters = pDevice->DeviceParameters();          std::map<String,DeviceCreationParameter*> parameters = pDevice->DeviceParameters();
# Line 997  String LSCPServer::GetAudioOutputDeviceI Line 997  String LSCPServer::GetAudioOutputDeviceI
997              result.Add(iter->first, iter->second->Value());              result.Add(iter->first, iter->second->Value());
998          }          }
999      }      }
1000      catch (LinuxSamplerException e) {      catch (Exception e) {
1001          result.Error(e);          result.Error(e);
1002      }      }
1003      return result.Produce();      return result.Produce();
# Line 1008  String LSCPServer::GetMidiInputDeviceInf Line 1008  String LSCPServer::GetMidiInputDeviceInf
1008      LSCPResultSet result;      LSCPResultSet result;
1009      try {      try {
1010          std::map<uint,MidiInputDevice*> devices = pSampler->GetMidiInputDevices();          std::map<uint,MidiInputDevice*> devices = pSampler->GetMidiInputDevices();
1011          if (!devices.count(DeviceIndex)) throw LinuxSamplerException("There is no MIDI input device with index " + ToString(DeviceIndex) + ".");          if (!devices.count(DeviceIndex)) throw Exception("There is no MIDI input device with index " + ToString(DeviceIndex) + ".");
1012          MidiInputDevice* pDevice = devices[DeviceIndex];          MidiInputDevice* pDevice = devices[DeviceIndex];
1013          result.Add("DRIVER", pDevice->Driver());          result.Add("DRIVER", pDevice->Driver());
1014          std::map<String,DeviceCreationParameter*> parameters = pDevice->DeviceParameters();          std::map<String,DeviceCreationParameter*> parameters = pDevice->DeviceParameters();
# Line 1017  String LSCPServer::GetMidiInputDeviceInf Line 1017  String LSCPServer::GetMidiInputDeviceInf
1017              result.Add(iter->first, iter->second->Value());              result.Add(iter->first, iter->second->Value());
1018          }          }
1019      }      }
1020      catch (LinuxSamplerException e) {      catch (Exception e) {
1021          result.Error(e);          result.Error(e);
1022      }      }
1023      return result.Produce();      return result.Produce();
# Line 1028  String LSCPServer::GetMidiInputPortInfo( Line 1028  String LSCPServer::GetMidiInputPortInfo(
1028      try {      try {
1029          // get MIDI input device          // get MIDI input device
1030          std::map<uint,MidiInputDevice*> devices = pSampler->GetMidiInputDevices();          std::map<uint,MidiInputDevice*> devices = pSampler->GetMidiInputDevices();
1031          if (!devices.count(DeviceIndex)) throw LinuxSamplerException("There is no MIDI input device with index " + ToString(DeviceIndex) + ".");          if (!devices.count(DeviceIndex)) throw Exception("There is no MIDI input device with index " + ToString(DeviceIndex) + ".");
1032          MidiInputDevice* pDevice = devices[DeviceIndex];          MidiInputDevice* pDevice = devices[DeviceIndex];
1033    
1034          // get MIDI port          // get MIDI port
1035          MidiInputPort* pMidiInputPort = pDevice->GetPort(PortIndex);          MidiInputPort* pMidiInputPort = pDevice->GetPort(PortIndex);
1036          if (!pMidiInputPort) throw LinuxSamplerException("There is no MIDI input port with index " + ToString(PortIndex) + ".");          if (!pMidiInputPort) throw Exception("There is no MIDI input port with index " + ToString(PortIndex) + ".");
1037    
1038          // return the values of all MIDI port parameters          // return the values of all MIDI port parameters
1039          std::map<String,DeviceRuntimeParameter*> parameters = pMidiInputPort->PortParameters();          std::map<String,DeviceRuntimeParameter*> parameters = pMidiInputPort->PortParameters();
# Line 1042  String LSCPServer::GetMidiInputPortInfo( Line 1042  String LSCPServer::GetMidiInputPortInfo(
1042              result.Add(iter->first, iter->second->Value());              result.Add(iter->first, iter->second->Value());
1043          }          }
1044      }      }
1045      catch (LinuxSamplerException e) {      catch (Exception e) {
1046          result.Error(e);          result.Error(e);
1047      }      }
1048      return result.Produce();      return result.Produce();
# Line 1054  String LSCPServer::GetAudioOutputChannel Line 1054  String LSCPServer::GetAudioOutputChannel
1054      try {      try {
1055          // get audio output device          // get audio output device
1056          std::map<uint,AudioOutputDevice*> devices = pSampler->GetAudioOutputDevices();          std::map<uint,AudioOutputDevice*> devices = pSampler->GetAudioOutputDevices();
1057          if (!devices.count(DeviceId)) throw LinuxSamplerException("There is no audio output device with index " + ToString(DeviceId) + ".");          if (!devices.count(DeviceId)) throw Exception("There is no audio output device with index " + ToString(DeviceId) + ".");
1058          AudioOutputDevice* pDevice = devices[DeviceId];          AudioOutputDevice* pDevice = devices[DeviceId];
1059    
1060          // get audio channel          // get audio channel
1061          AudioChannel* pChannel = pDevice->Channel(ChannelId);          AudioChannel* pChannel = pDevice->Channel(ChannelId);
1062          if (!pChannel) throw LinuxSamplerException("Audio output device does not have audio channel " + ToString(ChannelId) + ".");          if (!pChannel) throw Exception("Audio output device does not have audio channel " + ToString(ChannelId) + ".");
1063    
1064          // return the values of all audio channel parameters          // return the values of all audio channel parameters
1065          std::map<String,DeviceRuntimeParameter*> parameters = pChannel->ChannelParameters();          std::map<String,DeviceRuntimeParameter*> parameters = pChannel->ChannelParameters();
# Line 1068  String LSCPServer::GetAudioOutputChannel Line 1068  String LSCPServer::GetAudioOutputChannel
1068              result.Add(iter->first, iter->second->Value());              result.Add(iter->first, iter->second->Value());
1069          }          }
1070      }      }
1071      catch (LinuxSamplerException e) {      catch (Exception e) {
1072          result.Error(e);          result.Error(e);
1073      }      }
1074      return result.Produce();      return result.Produce();
# Line 1080  String LSCPServer::GetMidiInputPortParam Line 1080  String LSCPServer::GetMidiInputPortParam
1080      try {      try {
1081          // get MIDI input device          // get MIDI input device
1082          std::map<uint,MidiInputDevice*> devices = pSampler->GetMidiInputDevices();          std::map<uint,MidiInputDevice*> devices = pSampler->GetMidiInputDevices();
1083          if (!devices.count(DeviceId)) throw LinuxSamplerException("There is no midi input device with index " + ToString(DeviceId) + ".");          if (!devices.count(DeviceId)) throw Exception("There is no midi input device with index " + ToString(DeviceId) + ".");
1084          MidiInputDevice* pDevice = devices[DeviceId];          MidiInputDevice* pDevice = devices[DeviceId];
1085    
1086          // get midi port          // get midi port
1087          MidiInputPort* pPort = pDevice->GetPort(PortId);          MidiInputPort* pPort = pDevice->GetPort(PortId);
1088          if (!pPort) throw LinuxSamplerException("Midi input device does not have port " + ToString(PortId) + ".");          if (!pPort) throw Exception("Midi input device does not have port " + ToString(PortId) + ".");
1089    
1090          // get desired port parameter          // get desired port parameter
1091          std::map<String,DeviceRuntimeParameter*> parameters = pPort->PortParameters();          std::map<String,DeviceRuntimeParameter*> parameters = pPort->PortParameters();
1092          if (!parameters.count(ParameterName)) throw LinuxSamplerException("Midi port does not provide a parameter '" + ParameterName + "'.");          if (!parameters.count(ParameterName)) throw Exception("Midi port does not provide a parameter '" + ParameterName + "'.");
1093          DeviceRuntimeParameter* pParameter = parameters[ParameterName];          DeviceRuntimeParameter* pParameter = parameters[ParameterName];
1094    
1095          // return all fields of this audio channel parameter          // return all fields of this audio channel parameter
# Line 1101  String LSCPServer::GetMidiInputPortParam Line 1101  String LSCPServer::GetMidiInputPortParam
1101          if (pParameter->RangeMax())      result.Add("RANGE_MAX",     *pParameter->RangeMax());          if (pParameter->RangeMax())      result.Add("RANGE_MAX",     *pParameter->RangeMax());
1102          if (pParameter->Possibilities()) result.Add("POSSIBILITIES", *pParameter->Possibilities());          if (pParameter->Possibilities()) result.Add("POSSIBILITIES", *pParameter->Possibilities());
1103      }      }
1104      catch (LinuxSamplerException e) {      catch (Exception e) {
1105          result.Error(e);          result.Error(e);
1106      }      }
1107      return result.Produce();      return result.Produce();
# Line 1113  String LSCPServer::GetAudioOutputChannel Line 1113  String LSCPServer::GetAudioOutputChannel
1113      try {      try {
1114          // get audio output device          // get audio output device
1115          std::map<uint,AudioOutputDevice*> devices = pSampler->GetAudioOutputDevices();          std::map<uint,AudioOutputDevice*> devices = pSampler->GetAudioOutputDevices();
1116          if (!devices.count(DeviceId)) throw LinuxSamplerException("There is no audio output device with index " + ToString(DeviceId) + ".");          if (!devices.count(DeviceId)) throw Exception("There is no audio output device with index " + ToString(DeviceId) + ".");
1117          AudioOutputDevice* pDevice = devices[DeviceId];          AudioOutputDevice* pDevice = devices[DeviceId];
1118    
1119          // get audio channel          // get audio channel
1120          AudioChannel* pChannel = pDevice->Channel(ChannelId);          AudioChannel* pChannel = pDevice->Channel(ChannelId);
1121          if (!pChannel) throw LinuxSamplerException("Audio output device does not have audio channel " + ToString(ChannelId) + ".");          if (!pChannel) throw Exception("Audio output device does not have audio channel " + ToString(ChannelId) + ".");
1122    
1123          // get desired audio channel parameter          // get desired audio channel parameter
1124          std::map<String,DeviceRuntimeParameter*> parameters = pChannel->ChannelParameters();          std::map<String,DeviceRuntimeParameter*> parameters = pChannel->ChannelParameters();
1125          if (!parameters.count(ParameterName)) throw LinuxSamplerException("Audio channel does not provide a parameter '" + ParameterName + "'.");          if (!parameters.count(ParameterName)) throw Exception("Audio channel does not provide a parameter '" + ParameterName + "'.");
1126          DeviceRuntimeParameter* pParameter = parameters[ParameterName];          DeviceRuntimeParameter* pParameter = parameters[ParameterName];
1127    
1128          // return all fields of this audio channel parameter          // return all fields of this audio channel parameter
# Line 1134  String LSCPServer::GetAudioOutputChannel Line 1134  String LSCPServer::GetAudioOutputChannel
1134          if (pParameter->RangeMax())      result.Add("RANGE_MAX",     *pParameter->RangeMax());          if (pParameter->RangeMax())      result.Add("RANGE_MAX",     *pParameter->RangeMax());
1135          if (pParameter->Possibilities()) result.Add("POSSIBILITIES", *pParameter->Possibilities());          if (pParameter->Possibilities()) result.Add("POSSIBILITIES", *pParameter->Possibilities());
1136      }      }
1137      catch (LinuxSamplerException e) {      catch (Exception e) {
1138          result.Error(e);          result.Error(e);
1139      }      }
1140      return result.Produce();      return result.Produce();
# Line 1146  String LSCPServer::SetAudioOutputChannel Line 1146  String LSCPServer::SetAudioOutputChannel
1146      try {      try {
1147          // get audio output device          // get audio output device
1148          std::map<uint,AudioOutputDevice*> devices = pSampler->GetAudioOutputDevices();          std::map<uint,AudioOutputDevice*> devices = pSampler->GetAudioOutputDevices();
1149          if (!devices.count(DeviceId)) throw LinuxSamplerException("There is no audio output device with index " + ToString(DeviceId) + ".");          if (!devices.count(DeviceId)) throw Exception("There is no audio output device with index " + ToString(DeviceId) + ".");
1150          AudioOutputDevice* pDevice = devices[DeviceId];          AudioOutputDevice* pDevice = devices[DeviceId];
1151    
1152          // get audio channel          // get audio channel
1153          AudioChannel* pChannel = pDevice->Channel(ChannelId);          AudioChannel* pChannel = pDevice->Channel(ChannelId);
1154          if (!pChannel) throw LinuxSamplerException("Audio output device does not have audio channel " + ToString(ChannelId) + ".");          if (!pChannel) throw Exception("Audio output device does not have audio channel " + ToString(ChannelId) + ".");
1155    
1156          // get desired audio channel parameter          // get desired audio channel parameter
1157          std::map<String,DeviceRuntimeParameter*> parameters = pChannel->ChannelParameters();          std::map<String,DeviceRuntimeParameter*> parameters = pChannel->ChannelParameters();
1158          if (!parameters.count(ParamKey)) throw LinuxSamplerException("Audio channel does not provide a parameter '" + ParamKey + "'.");          if (!parameters.count(ParamKey)) throw Exception("Audio channel does not provide a parameter '" + ParamKey + "'.");
1159          DeviceRuntimeParameter* pParameter = parameters[ParamKey];          DeviceRuntimeParameter* pParameter = parameters[ParamKey];
1160    
1161          // set new channel parameter value          // set new channel parameter value
1162          pParameter->SetValue(ParamVal);          pParameter->SetValue(ParamVal);
1163      }      }
1164      catch (LinuxSamplerException e) {      catch (Exception e) {
1165          result.Error(e);          result.Error(e);
1166      }      }
1167      return result.Produce();      return result.Produce();
# Line 1172  String LSCPServer::SetAudioOutputDeviceP Line 1172  String LSCPServer::SetAudioOutputDeviceP
1172      LSCPResultSet result;      LSCPResultSet result;
1173      try {      try {
1174          std::map<uint,AudioOutputDevice*> devices = pSampler->GetAudioOutputDevices();          std::map<uint,AudioOutputDevice*> devices = pSampler->GetAudioOutputDevices();
1175          if (!devices.count(DeviceIndex)) throw LinuxSamplerException("There is no audio output device with index " + ToString(DeviceIndex) + ".");          if (!devices.count(DeviceIndex)) throw Exception("There is no audio output device with index " + ToString(DeviceIndex) + ".");
1176          AudioOutputDevice* pDevice = devices[DeviceIndex];          AudioOutputDevice* pDevice = devices[DeviceIndex];
1177          std::map<String,DeviceCreationParameter*> parameters = pDevice->DeviceParameters();          std::map<String,DeviceCreationParameter*> parameters = pDevice->DeviceParameters();
1178          if (!parameters.count(ParamKey)) throw LinuxSamplerException("Audio output device " + ToString(DeviceIndex) + " does not have a device parameter '" + ParamKey + "'");          if (!parameters.count(ParamKey)) throw Exception("Audio output device " + ToString(DeviceIndex) + " does not have a device parameter '" + ParamKey + "'");
1179          parameters[ParamKey]->SetValue(ParamVal);          parameters[ParamKey]->SetValue(ParamVal);
1180      }      }
1181      catch (LinuxSamplerException e) {      catch (Exception e) {
1182          result.Error(e);          result.Error(e);
1183      }      }
1184      return result.Produce();      return result.Produce();
# Line 1189  String LSCPServer::SetMidiInputDevicePar Line 1189  String LSCPServer::SetMidiInputDevicePar
1189      LSCPResultSet result;      LSCPResultSet result;
1190      try {      try {
1191          std::map<uint,MidiInputDevice*> devices = pSampler->GetMidiInputDevices();          std::map<uint,MidiInputDevice*> devices = pSampler->GetMidiInputDevices();
1192          if (!devices.count(DeviceIndex)) throw LinuxSamplerException("There is no MIDI input device with index " + ToString(DeviceIndex) + ".");          if (!devices.count(DeviceIndex)) throw Exception("There is no MIDI input device with index " + ToString(DeviceIndex) + ".");
1193          MidiInputDevice* pDevice = devices[DeviceIndex];          MidiInputDevice* pDevice = devices[DeviceIndex];
1194          std::map<String,DeviceCreationParameter*> parameters = pDevice->DeviceParameters();          std::map<String,DeviceCreationParameter*> parameters = pDevice->DeviceParameters();
1195          if (!parameters.count(ParamKey)) throw LinuxSamplerException("MIDI input device " + ToString(DeviceIndex) + " does not have a device parameter '" + ParamKey + "'");          if (!parameters.count(ParamKey)) throw Exception("MIDI input device " + ToString(DeviceIndex) + " does not have a device parameter '" + ParamKey + "'");
1196          parameters[ParamKey]->SetValue(ParamVal);          parameters[ParamKey]->SetValue(ParamVal);
1197      }      }
1198      catch (LinuxSamplerException e) {      catch (Exception e) {
1199          result.Error(e);          result.Error(e);
1200      }      }
1201      return result.Produce();      return result.Produce();
# Line 1207  String LSCPServer::SetMidiInputPortParam Line 1207  String LSCPServer::SetMidiInputPortParam
1207      try {      try {
1208          // get MIDI input device          // get MIDI input device
1209          std::map<uint,MidiInputDevice*> devices = pSampler->GetMidiInputDevices();          std::map<uint,MidiInputDevice*> devices = pSampler->GetMidiInputDevices();
1210          if (!devices.count(DeviceIndex)) throw LinuxSamplerException("There is no MIDI input device with index " + ToString(DeviceIndex) + ".");          if (!devices.count(DeviceIndex)) throw Exception("There is no MIDI input device with index " + ToString(DeviceIndex) + ".");
1211          MidiInputDevice* pDevice = devices[DeviceIndex];          MidiInputDevice* pDevice = devices[DeviceIndex];
1212    
1213          // get MIDI port          // get MIDI port
1214          MidiInputPort* pMidiInputPort = pDevice->GetPort(PortIndex);          MidiInputPort* pMidiInputPort = pDevice->GetPort(PortIndex);
1215          if (!pMidiInputPort) throw LinuxSamplerException("There is no MIDI input port with index " + ToString(PortIndex) + ".");          if (!pMidiInputPort) throw Exception("There is no MIDI input port with index " + ToString(PortIndex) + ".");
1216    
1217          // set port parameter value          // set port parameter value
1218          std::map<String,DeviceRuntimeParameter*> parameters = pMidiInputPort->PortParameters();          std::map<String,DeviceRuntimeParameter*> parameters = pMidiInputPort->PortParameters();
1219          if (!parameters.count(ParamKey)) throw LinuxSamplerException("MIDI input device " + ToString(PortIndex) + " does not have a parameter '" + ParamKey + "'");          if (!parameters.count(ParamKey)) throw Exception("MIDI input device " + ToString(PortIndex) + " does not have a parameter '" + ParamKey + "'");
1220          parameters[ParamKey]->SetValue(ParamVal);          parameters[ParamKey]->SetValue(ParamVal);
1221      }      }
1222      catch (LinuxSamplerException e) {      catch (Exception e) {
1223          result.Error(e);          result.Error(e);
1224      }      }
1225      return result.Produce();      return result.Produce();
# Line 1234  String LSCPServer::SetAudioOutputChannel Line 1234  String LSCPServer::SetAudioOutputChannel
1234      LSCPResultSet result;      LSCPResultSet result;
1235      try {      try {
1236          SamplerChannel* pSamplerChannel = pSampler->GetSamplerChannel(uiSamplerChannel);          SamplerChannel* pSamplerChannel = pSampler->GetSamplerChannel(uiSamplerChannel);
1237          if (!pSamplerChannel) throw LinuxSamplerException("Invalid sampler channel number " + ToString(uiSamplerChannel));          if (!pSamplerChannel) throw Exception("Invalid sampler channel number " + ToString(uiSamplerChannel));
1238          EngineChannel* pEngineChannel = pSamplerChannel->GetEngineChannel();          EngineChannel* pEngineChannel = pSamplerChannel->GetEngineChannel();
1239          if (!pEngineChannel) throw LinuxSamplerException("No engine type yet assigned to sampler channel " + ToString(uiSamplerChannel));          if (!pEngineChannel) throw Exception("No engine type yet assigned to sampler channel " + ToString(uiSamplerChannel));
1240          if (!pSamplerChannel->GetAudioOutputDevice()) throw LinuxSamplerException("No audio output device connected to sampler channel " + ToString(uiSamplerChannel));          if (!pSamplerChannel->GetAudioOutputDevice()) throw Exception("No audio output device connected to sampler channel " + ToString(uiSamplerChannel));
1241          pEngineChannel->SetOutputChannel(ChannelAudioOutputChannel, AudioOutputDeviceInputChannel);          pEngineChannel->SetOutputChannel(ChannelAudioOutputChannel, AudioOutputDeviceInputChannel);
1242      }      }
1243      catch (LinuxSamplerException e) {      catch (Exception e) {
1244           result.Error(e);           result.Error(e);
1245      }      }
1246      return result.Produce();      return result.Produce();
# Line 1252  String LSCPServer::SetAudioOutputDevice( Line 1252  String LSCPServer::SetAudioOutputDevice(
1252      LockRTNotify();      LockRTNotify();
1253      try {      try {
1254          SamplerChannel* pSamplerChannel = pSampler->GetSamplerChannel(uiSamplerChannel);          SamplerChannel* pSamplerChannel = pSampler->GetSamplerChannel(uiSamplerChannel);
1255          if (!pSamplerChannel) throw LinuxSamplerException("Invalid sampler channel number " + ToString(uiSamplerChannel));          if (!pSamplerChannel) throw Exception("Invalid sampler channel number " + ToString(uiSamplerChannel));
1256          std::map<uint, AudioOutputDevice*> devices = pSampler->GetAudioOutputDevices();          std::map<uint, AudioOutputDevice*> devices = pSampler->GetAudioOutputDevices();
1257          if (!devices.count(AudioDeviceId)) throw LinuxSamplerException("There is no audio output device with index " + ToString(AudioDeviceId));          if (!devices.count(AudioDeviceId)) throw Exception("There is no audio output device with index " + ToString(AudioDeviceId));
1258          AudioOutputDevice* pDevice = devices[AudioDeviceId];          AudioOutputDevice* pDevice = devices[AudioDeviceId];
1259          pSamplerChannel->SetAudioOutputDevice(pDevice);          pSamplerChannel->SetAudioOutputDevice(pDevice);
1260      }      }
1261      catch (LinuxSamplerException e) {      catch (Exception e) {
1262           result.Error(e);           result.Error(e);
1263      }      }
1264      UnlockRTNotify();      UnlockRTNotify();
# Line 1271  String LSCPServer::SetAudioOutputType(St Line 1271  String LSCPServer::SetAudioOutputType(St
1271      LockRTNotify();      LockRTNotify();
1272      try {      try {
1273          SamplerChannel* pSamplerChannel = pSampler->GetSamplerChannel(uiSamplerChannel);          SamplerChannel* pSamplerChannel = pSampler->GetSamplerChannel(uiSamplerChannel);
1274          if (!pSamplerChannel) throw LinuxSamplerException("Invalid sampler channel number " + ToString(uiSamplerChannel));          if (!pSamplerChannel) throw Exception("Invalid sampler channel number " + ToString(uiSamplerChannel));
1275          // Driver type name aliasing...          // Driver type name aliasing...
1276          if (AudioOutputDriver == "Alsa") AudioOutputDriver = "ALSA";          if (AudioOutputDriver == "Alsa") AudioOutputDriver = "ALSA";
1277          if (AudioOutputDriver == "Jack") AudioOutputDriver = "JACK";          if (AudioOutputDriver == "Jack") AudioOutputDriver = "JACK";
# Line 1293  String LSCPServer::SetAudioOutputType(St Line 1293  String LSCPServer::SetAudioOutputType(St
1293          }          }
1294          // Must have a device...          // Must have a device...
1295          if (pDevice == NULL)          if (pDevice == NULL)
1296              throw LinuxSamplerException("Internal error: could not create audio output device.");              throw Exception("Internal error: could not create audio output device.");
1297          // Set it as the current channel device...          // Set it as the current channel device...
1298          pSamplerChannel->SetAudioOutputDevice(pDevice);          pSamplerChannel->SetAudioOutputDevice(pDevice);
1299      }      }
1300      catch (LinuxSamplerException e) {      catch (Exception e) {
1301           result.Error(e);           result.Error(e);
1302      }      }
1303      UnlockRTNotify();      UnlockRTNotify();
# Line 1309  String LSCPServer::SetMIDIInputPort(uint Line 1309  String LSCPServer::SetMIDIInputPort(uint
1309      LSCPResultSet result;      LSCPResultSet result;
1310      try {      try {
1311          SamplerChannel* pSamplerChannel = pSampler->GetSamplerChannel(uiSamplerChannel);          SamplerChannel* pSamplerChannel = pSampler->GetSamplerChannel(uiSamplerChannel);
1312          if (!pSamplerChannel) throw LinuxSamplerException("Invalid sampler channel number " + ToString(uiSamplerChannel));          if (!pSamplerChannel) throw Exception("Invalid sampler channel number " + ToString(uiSamplerChannel));
1313          pSamplerChannel->SetMidiInputPort(MIDIPort);          pSamplerChannel->SetMidiInputPort(MIDIPort);
1314      }      }
1315      catch (LinuxSamplerException e) {      catch (Exception e) {
1316           result.Error(e);           result.Error(e);
1317      }      }
1318      return result.Produce();      return result.Produce();
# Line 1323  String LSCPServer::SetMIDIInputChannel(u Line 1323  String LSCPServer::SetMIDIInputChannel(u
1323      LSCPResultSet result;      LSCPResultSet result;
1324      try {      try {
1325          SamplerChannel* pSamplerChannel = pSampler->GetSamplerChannel(uiSamplerChannel);          SamplerChannel* pSamplerChannel = pSampler->GetSamplerChannel(uiSamplerChannel);
1326          if (!pSamplerChannel) throw LinuxSamplerException("Invalid sampler channel number " + ToString(uiSamplerChannel));          if (!pSamplerChannel) throw Exception("Invalid sampler channel number " + ToString(uiSamplerChannel));
1327          pSamplerChannel->SetMidiInputChannel((midi_chan_t) MIDIChannel);          pSamplerChannel->SetMidiInputChannel((midi_chan_t) MIDIChannel);
1328      }      }
1329      catch (LinuxSamplerException e) {      catch (Exception e) {
1330           result.Error(e);           result.Error(e);
1331      }      }
1332      return result.Produce();      return result.Produce();
# Line 1337  String LSCPServer::SetMIDIInputDevice(ui Line 1337  String LSCPServer::SetMIDIInputDevice(ui
1337      LSCPResultSet result;      LSCPResultSet result;
1338      try {      try {
1339          SamplerChannel* pSamplerChannel = pSampler->GetSamplerChannel(uiSamplerChannel);          SamplerChannel* pSamplerChannel = pSampler->GetSamplerChannel(uiSamplerChannel);
1340          if (!pSamplerChannel) throw LinuxSamplerException("Invalid sampler channel number " + ToString(uiSamplerChannel));          if (!pSamplerChannel) throw Exception("Invalid sampler channel number " + ToString(uiSamplerChannel));
1341          std::map<uint, MidiInputDevice*> devices = pSampler->GetMidiInputDevices();          std::map<uint, MidiInputDevice*> devices = pSampler->GetMidiInputDevices();
1342          if (!devices.count(MIDIDeviceId)) throw LinuxSamplerException("There is no MIDI input device with index " + ToString(MIDIDeviceId));          if (!devices.count(MIDIDeviceId)) throw Exception("There is no MIDI input device with index " + ToString(MIDIDeviceId));
1343          MidiInputDevice* pDevice = devices[MIDIDeviceId];          MidiInputDevice* pDevice = devices[MIDIDeviceId];
1344          pSamplerChannel->SetMidiInputDevice(pDevice);          pSamplerChannel->SetMidiInputDevice(pDevice);
1345      }      }
1346      catch (LinuxSamplerException e) {      catch (Exception e) {
1347           result.Error(e);           result.Error(e);
1348      }      }
1349      return result.Produce();      return result.Produce();
# Line 1354  String LSCPServer::SetMIDIInputType(Stri Line 1354  String LSCPServer::SetMIDIInputType(Stri
1354      LSCPResultSet result;      LSCPResultSet result;
1355      try {      try {
1356          SamplerChannel* pSamplerChannel = pSampler->GetSamplerChannel(uiSamplerChannel);          SamplerChannel* pSamplerChannel = pSampler->GetSamplerChannel(uiSamplerChannel);
1357          if (!pSamplerChannel) throw LinuxSamplerException("Invalid sampler channel number " + ToString(uiSamplerChannel));          if (!pSamplerChannel) throw Exception("Invalid sampler channel number " + ToString(uiSamplerChannel));
1358          // Driver type name aliasing...          // Driver type name aliasing...
1359          if (MidiInputDriver == "Alsa") MidiInputDriver = "ALSA";          if (MidiInputDriver == "Alsa") MidiInputDriver = "ALSA";
1360          // Check if there's one MIDI input device already created          // Check if there's one MIDI input device already created
# Line 1378  String LSCPServer::SetMIDIInputType(Stri Line 1378  String LSCPServer::SetMIDIInputType(Stri
1378          }          }
1379          // Must have a device...          // Must have a device...
1380          if (pDevice == NULL)          if (pDevice == NULL)
1381              throw LinuxSamplerException("Internal error: could not create MIDI input device.");              throw Exception("Internal error: could not create MIDI input device.");
1382          // Set it as the current channel device...          // Set it as the current channel device...
1383          pSamplerChannel->SetMidiInputDevice(pDevice);          pSamplerChannel->SetMidiInputDevice(pDevice);
1384      }      }
1385      catch (LinuxSamplerException e) {      catch (Exception e) {
1386           result.Error(e);           result.Error(e);
1387      }      }
1388      return result.Produce();      return result.Produce();
# Line 1397  String LSCPServer::SetMIDIInput(uint MID Line 1397  String LSCPServer::SetMIDIInput(uint MID
1397      LSCPResultSet result;      LSCPResultSet result;
1398      try {      try {
1399          SamplerChannel* pSamplerChannel = pSampler->GetSamplerChannel(uiSamplerChannel);          SamplerChannel* pSamplerChannel = pSampler->GetSamplerChannel(uiSamplerChannel);
1400          if (!pSamplerChannel) throw LinuxSamplerException("Invalid sampler channel number " + ToString(uiSamplerChannel));          if (!pSamplerChannel) throw Exception("Invalid sampler channel number " + ToString(uiSamplerChannel));
1401          std::map<uint, MidiInputDevice*> devices =  pSampler->GetMidiInputDevices();          std::map<uint, MidiInputDevice*> devices =  pSampler->GetMidiInputDevices();
1402          if (!devices.count(MIDIDeviceId)) throw LinuxSamplerException("There is no MIDI input device with index " + ToString(MIDIDeviceId));          if (!devices.count(MIDIDeviceId)) throw Exception("There is no MIDI input device with index " + ToString(MIDIDeviceId));
1403          MidiInputDevice* pDevice = devices[MIDIDeviceId];          MidiInputDevice* pDevice = devices[MIDIDeviceId];
1404          pSamplerChannel->SetMidiInput(pDevice, MIDIPort, (midi_chan_t) MIDIChannel);          pSamplerChannel->SetMidiInput(pDevice, MIDIPort, (midi_chan_t) MIDIChannel);
1405      }      }
1406      catch (LinuxSamplerException e) {      catch (Exception e) {
1407           result.Error(e);           result.Error(e);
1408      }      }
1409      return result.Produce();      return result.Produce();
# Line 1418  String LSCPServer::SetVolume(double dVol Line 1418  String LSCPServer::SetVolume(double dVol
1418      LSCPResultSet result;      LSCPResultSet result;
1419      try {      try {
1420          SamplerChannel* pSamplerChannel = pSampler->GetSamplerChannel(uiSamplerChannel);          SamplerChannel* pSamplerChannel = pSampler->GetSamplerChannel(uiSamplerChannel);
1421          if (!pSamplerChannel) throw LinuxSamplerException("Invalid sampler channel number " + ToString(uiSamplerChannel));          if (!pSamplerChannel) throw Exception("Invalid sampler channel number " + ToString(uiSamplerChannel));
1422          EngineChannel* pEngineChannel = pSamplerChannel->GetEngineChannel();          EngineChannel* pEngineChannel = pSamplerChannel->GetEngineChannel();
1423          if (!pEngineChannel) throw LinuxSamplerException("No engine type assigned to sampler channel");          if (!pEngineChannel) throw Exception("No engine type assigned to sampler channel");
1424          pEngineChannel->Volume(dVolume);          pEngineChannel->Volume(dVolume);
1425      }      }
1426      catch (LinuxSamplerException e) {      catch (Exception e) {
1427           result.Error(e);           result.Error(e);
1428      }      }
1429      return result.Produce();      return result.Produce();
# Line 1437  String LSCPServer::SetChannelMute(bool b Line 1437  String LSCPServer::SetChannelMute(bool b
1437      LSCPResultSet result;      LSCPResultSet result;
1438      try {      try {
1439          SamplerChannel* pSamplerChannel = pSampler->GetSamplerChannel(uiSamplerChannel);          SamplerChannel* pSamplerChannel = pSampler->GetSamplerChannel(uiSamplerChannel);
1440          if (!pSamplerChannel) throw LinuxSamplerException("Invalid sampler channel number " + ToString(uiSamplerChannel));          if (!pSamplerChannel) throw Exception("Invalid sampler channel number " + ToString(uiSamplerChannel));
1441    
1442          EngineChannel* pEngineChannel = pSamplerChannel->GetEngineChannel();          EngineChannel* pEngineChannel = pSamplerChannel->GetEngineChannel();
1443          if (!pEngineChannel) throw LinuxSamplerException("No engine type assigned to sampler channel");          if (!pEngineChannel) throw Exception("No engine type assigned to sampler channel");
1444    
1445          if(!bMute) pEngineChannel->SetMute((HasSoloChannel() && !pEngineChannel->GetSolo()) ? -1 : 0);          if(!bMute) pEngineChannel->SetMute((HasSoloChannel() && !pEngineChannel->GetSolo()) ? -1 : 0);
1446          else pEngineChannel->SetMute(1);          else pEngineChannel->SetMute(1);
1447      } catch (LinuxSamplerException e) {      } catch (Exception e) {
1448          result.Error(e);          result.Error(e);
1449      }      }
1450      return result.Produce();      return result.Produce();
# Line 1458  String LSCPServer::SetChannelSolo(bool b Line 1458  String LSCPServer::SetChannelSolo(bool b
1458      LSCPResultSet result;      LSCPResultSet result;
1459      try {      try {
1460          SamplerChannel* pSamplerChannel = pSampler->GetSamplerChannel(uiSamplerChannel);          SamplerChannel* pSamplerChannel = pSampler->GetSamplerChannel(uiSamplerChannel);
1461          if (!pSamplerChannel) throw LinuxSamplerException("Invalid sampler channel number " + ToString(uiSamplerChannel));          if (!pSamplerChannel) throw Exception("Invalid sampler channel number " + ToString(uiSamplerChannel));
1462    
1463          EngineChannel* pEngineChannel = pSamplerChannel->GetEngineChannel();          EngineChannel* pEngineChannel = pSamplerChannel->GetEngineChannel();
1464          if (!pEngineChannel) throw LinuxSamplerException("No engine type assigned to sampler channel");          if (!pEngineChannel) throw Exception("No engine type assigned to sampler channel");
1465    
1466          bool oldSolo = pEngineChannel->GetSolo();          bool oldSolo = pEngineChannel->GetSolo();
1467          bool hadSoloChannel = HasSoloChannel();          bool hadSoloChannel = HasSoloChannel();
# Line 1477  String LSCPServer::SetChannelSolo(bool b Line 1477  String LSCPServer::SetChannelSolo(bool b
1477              if(!HasSoloChannel()) UnmuteChannels();              if(!HasSoloChannel()) UnmuteChannels();
1478              else if(!pEngineChannel->GetMute()) pEngineChannel->SetMute(-1);              else if(!pEngineChannel->GetMute()) pEngineChannel->SetMute(-1);
1479          }          }
1480      } catch (LinuxSamplerException e) {      } catch (Exception e) {
1481          result.Error(e);          result.Error(e);
1482      }      }
1483      return result.Produce();      return result.Produce();
# Line 1538  String LSCPServer::ResetChannel(uint uiS Line 1538  String LSCPServer::ResetChannel(uint uiS
1538      LSCPResultSet result;      LSCPResultSet result;
1539      try {      try {
1540          SamplerChannel* pSamplerChannel = pSampler->GetSamplerChannel(uiSamplerChannel);          SamplerChannel* pSamplerChannel = pSampler->GetSamplerChannel(uiSamplerChannel);
1541          if (!pSamplerChannel) throw LinuxSamplerException("Invalid sampler channel number " + ToString(uiSamplerChannel));          if (!pSamplerChannel) throw Exception("Invalid sampler channel number " + ToString(uiSamplerChannel));
1542          EngineChannel* pEngineChannel = pSamplerChannel->GetEngineChannel();          EngineChannel* pEngineChannel = pSamplerChannel->GetEngineChannel();
1543          if (!pEngineChannel) throw LinuxSamplerException("No engine type assigned to sampler channel");          if (!pEngineChannel) throw Exception("No engine type assigned to sampler channel");
1544          pEngineChannel->Reset();          pEngineChannel->Reset();
1545      }      }
1546      catch (LinuxSamplerException e) {      catch (Exception e) {
1547           result.Error(e);           result.Error(e);
1548      }      }
1549      return result.Produce();      return result.Produce();
# Line 1660  String LSCPServer::SetEcho(yyparse_param Line 1660  String LSCPServer::SetEcho(yyparse_param
1660      try {      try {
1661          if      (boolean_value == 0) pSession->bVerbose = false;          if      (boolean_value == 0) pSession->bVerbose = false;
1662          else if (boolean_value == 1) pSession->bVerbose = true;          else if (boolean_value == 1) pSession->bVerbose = true;
1663          else throw LinuxSamplerException("Not a boolean value, must either be 0 or 1");          else throw Exception("Not a boolean value, must either be 0 or 1");
1664      }      }
1665      catch (LinuxSamplerException e) {      catch (Exception e) {
1666           result.Error(e);           result.Error(e);
1667      }      }
1668      return result.Produce();      return result.Produce();

Legend:
Removed from v.841  
changed lines
  Added in v.880

  ViewVC Help
Powered by ViewVC