/[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 225 by schoenebeck, Sun Aug 22 14:46:47 2004 UTC revision 227 by schoenebeck, Thu Aug 26 22:05:44 2004 UTC
# Line 88  int LSCPServer::Main() { Line 88  int LSCPServer::Main() {
88      SocketAddress.sin_addr.s_addr = htonl(INADDR_ANY);      SocketAddress.sin_addr.s_addr = htonl(INADDR_ANY);
89    
90      if (bind(hSocket, (sockaddr*) &SocketAddress, sizeof(sockaddr_in)) < 0) {      if (bind(hSocket, (sockaddr*) &SocketAddress, sizeof(sockaddr_in)) < 0) {
91          std::cerr << "LSCPServer: Could not bind server socket." << std::endl;          std::cerr << "LSCPServer: Could not bind server socket, retrying for " << ToString(LSCP_SERVER_BIND_TIMEOUT) << " seconds...";
92          close(hSocket);          for (int trial = 0; true; trial++) { // retry for LSCP_SERVER_BIND_TIMEOUT seconds
93          //return -1;              if (bind(hSocket, (sockaddr*) &SocketAddress, sizeof(sockaddr_in)) < 0) {
94          exit(EXIT_FAILURE);                  if (trial > LSCP_SERVER_BIND_TIMEOUT) {
95                        std::cerr << "gave up!" << std::endl;
96                        close(hSocket);
97                        //return -1;
98                        exit(EXIT_FAILURE);
99                    }
100                    else sleep(1); // sleep 1s
101                }
102                else break; // success
103            }
104      }      }
105    
106      listen(hSocket, 1);      listen(hSocket, 1);
# Line 743  String LSCPServer::GetAudioOutputDriverI Line 752  String LSCPServer::GetAudioOutputDriverI
752  }  }
753    
754  String LSCPServer::GetMidiInputDriverParameterInfo(String Driver, String Parameter, std::map<String,String> DependencyList) {  String LSCPServer::GetMidiInputDriverParameterInfo(String Driver, String Parameter, std::map<String,String> DependencyList) {
755      dmsg(2,("LSCPServer: GetMidiInputDriverParameterInfo(Driver=%s,Parameter=%s)\n",Driver.c_str(),Parameter.c_str()));      dmsg(2,("LSCPServer: GetMidiInputDriverParameterInfo(Driver=%s,Parameter=%s,DependencyListSize=%d)\n",Driver.c_str(),Parameter.c_str(),DependencyList.size()));
756      LSCPResultSet result;      LSCPResultSet result;
757      try {      try {
758          DeviceCreationParameter* pParameter = MidiInputDeviceFactory::GetDriverParameter(Driver, Parameter);          DeviceCreationParameter* pParameter = MidiInputDeviceFactory::GetDriverParameter(Driver, Parameter);
# Line 752  String LSCPServer::GetMidiInputDriverPar Line 761  String LSCPServer::GetMidiInputDriverPar
761          result.Add("MANDATORY",    pParameter->Mandatory());          result.Add("MANDATORY",    pParameter->Mandatory());
762          result.Add("FIX",          pParameter->Fix());          result.Add("FIX",          pParameter->Fix());
763          result.Add("MULTIPLICITY", pParameter->Multiplicity());          result.Add("MULTIPLICITY", pParameter->Multiplicity());
764          if (pParameter->Depends())       result.Add("DEPENDS",       *pParameter->Depends());          optional<String> oDepends       = pParameter->Depends();
765          if (pParameter->Default())       result.Add("DEFAULT",       *pParameter->Default());          optional<String> oDefault       = pParameter->Default(DependencyList);
766          if (pParameter->RangeMin())      result.Add("RANGE_MIN",     *pParameter->RangeMin());          optional<String> oRangeMin      = pParameter->RangeMin(DependencyList);
767          if (pParameter->RangeMax())      result.Add("RANGE_MAX",     *pParameter->RangeMax());          optional<String> oRangeMax      = pParameter->RangeMax(DependencyList);
768          if (pParameter->Possibilities()) result.Add("POSSIBILITIES", *pParameter->Possibilities());          optional<String> oPossibilities = pParameter->Possibilities(DependencyList);
769            if (oDepends)       result.Add("DEPENDS",       *oDepends);
770            if (oDefault)       result.Add("DEFAULT",       *oDefault);
771            if (oRangeMin)      result.Add("RANGE_MIN",     *oRangeMin);
772            if (oRangeMax)      result.Add("RANGE_MAX",     *oRangeMax);
773            if (oPossibilities) result.Add("POSSIBILITIES", *oPossibilities);
774      }      }
775      catch (LinuxSamplerException e) {      catch (LinuxSamplerException e) {
776          result.Error(e);          result.Error(e);
# Line 765  String LSCPServer::GetMidiInputDriverPar Line 779  String LSCPServer::GetMidiInputDriverPar
779  }  }
780    
781  String LSCPServer::GetAudioOutputDriverParameterInfo(String Driver, String Parameter, std::map<String,String> DependencyList) {  String LSCPServer::GetAudioOutputDriverParameterInfo(String Driver, String Parameter, std::map<String,String> DependencyList) {
782      dmsg(2,("LSCPServer: GetAudioOutputDriverParameterInfo(Driver=%s,Parameter=%s)\n",Driver.c_str(),Parameter.c_str()));      dmsg(2,("LSCPServer: GetAudioOutputDriverParameterInfo(Driver=%s,Parameter=%s,DependencyListSize=%d)\n",Driver.c_str(),Parameter.c_str(),DependencyList.size()));
783      LSCPResultSet result;      LSCPResultSet result;
784      try {      try {
785          DeviceCreationParameter* pParameter = AudioOutputDeviceFactory::GetDriverParameter(Driver, Parameter);          DeviceCreationParameter* pParameter = AudioOutputDeviceFactory::GetDriverParameter(Driver, Parameter);
# Line 774  String LSCPServer::GetAudioOutputDriverP Line 788  String LSCPServer::GetAudioOutputDriverP
788          result.Add("MANDATORY",    pParameter->Mandatory());          result.Add("MANDATORY",    pParameter->Mandatory());
789          result.Add("FIX",          pParameter->Fix());          result.Add("FIX",          pParameter->Fix());
790          result.Add("MULTIPLICITY", pParameter->Multiplicity());          result.Add("MULTIPLICITY", pParameter->Multiplicity());
791          if (pParameter->Depends())       result.Add("DEPENDS",       *pParameter->Depends());          optional<String> oDepends       = pParameter->Depends();
792          if (pParameter->Default())       result.Add("DEFAULT",       *pParameter->Default());          optional<String> oDefault       = pParameter->Default(DependencyList);
793          if (pParameter->RangeMin())      result.Add("RANGE_MIN",     *pParameter->RangeMin());          optional<String> oRangeMin      = pParameter->RangeMin(DependencyList);
794          if (pParameter->RangeMax())      result.Add("RANGE_MAX",     *pParameter->RangeMax());          optional<String> oRangeMax      = pParameter->RangeMax(DependencyList);
795          if (pParameter->Possibilities()) result.Add("POSSIBILITIES", *pParameter->Possibilities());          optional<String> oPossibilities = pParameter->Possibilities(DependencyList);
796            if (oDepends)       result.Add("DEPENDS",       *oDepends);
797            if (oDefault)       result.Add("DEFAULT",       *oDefault);
798            if (oRangeMin)      result.Add("RANGE_MIN",     *oRangeMin);
799            if (oRangeMax)      result.Add("RANGE_MAX",     *oRangeMax);
800            if (oPossibilities) result.Add("POSSIBILITIES", *oPossibilities);
801      }      }
802      catch (LinuxSamplerException e) {      catch (LinuxSamplerException e) {
803          result.Error(e);          result.Error(e);
# Line 1136  String LSCPServer::SetAudioOutputType(St Line 1155  String LSCPServer::SetAudioOutputType(St
1155          SamplerChannel* pSamplerChannel = pSampler->GetSamplerChannel(uiSamplerChannel);          SamplerChannel* pSamplerChannel = pSampler->GetSamplerChannel(uiSamplerChannel);
1156          if (!pSamplerChannel) throw LinuxSamplerException("Invalid channel number " + ToString(uiSamplerChannel));          if (!pSamplerChannel) throw LinuxSamplerException("Invalid channel number " + ToString(uiSamplerChannel));
1157          // Driver type name aliasing...          // Driver type name aliasing...
1158          if (AudioOutputDriver == "ALSA") AudioOutputDriver = "Alsa";          if (AudioOutputDriver == "Alsa") AudioOutputDriver = "ALSA";
1159          if (AudioOutputDriver == "JACK") AudioOutputDriver = "Jack";          if (AudioOutputDriver == "Jack") AudioOutputDriver = "JACK";
1160          // Check if there's one audio output device already created          // Check if there's one audio output device already created
1161          // for the intended audio driver type (AudioOutputDriver)...          // for the intended audio driver type (AudioOutputDriver)...
1162          AudioOutputDevice *pDevice = NULL;          AudioOutputDevice *pDevice = NULL;
# Line 1218  String LSCPServer::SetMIDIInputType(Stri Line 1237  String LSCPServer::SetMIDIInputType(Stri
1237          SamplerChannel* pSamplerChannel = pSampler->GetSamplerChannel(uiSamplerChannel);          SamplerChannel* pSamplerChannel = pSampler->GetSamplerChannel(uiSamplerChannel);
1238          if (!pSamplerChannel) throw LinuxSamplerException("Invalid channel number " + ToString(uiSamplerChannel));          if (!pSamplerChannel) throw LinuxSamplerException("Invalid channel number " + ToString(uiSamplerChannel));
1239          // Driver type name aliasing...          // Driver type name aliasing...
1240          if (MidiInputDriver == "ALSA") MidiInputDriver = "Alsa";          if (MidiInputDriver == "Alsa") MidiInputDriver = "ALSA";
1241          // Check if there's one MIDI input device already created          // Check if there's one MIDI input device already created
1242          // for the intended MIDI driver type (MidiInputDriver)...          // for the intended MIDI driver type (MidiInputDriver)...
1243          MidiInputDevice *pDevice = NULL;          MidiInputDevice *pDevice = NULL;

Legend:
Removed from v.225  
changed lines
  Added in v.227

  ViewVC Help
Powered by ViewVC