/[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 198 by senkov, Tue Jul 13 15:36:16 2004 UTC revision 203 by schoenebeck, Tue Jul 13 22:44:13 2004 UTC
# Line 25  Line 25 
25  #include "lscpevent.h"  #include "lscpevent.h"
26    
27  #include "../engines/gig/Engine.h"  #include "../engines/gig/Engine.h"
28  #include "../audiodriver/AudioOutputDeviceFactory.h"  #include "../drivers/audio/AudioOutputDeviceFactory.h"
29  #include "../mididriver/MidiInputDeviceFactory.h"  #include "../drivers/midi/MidiInputDeviceFactory.h"
30    
31  /**  /**
32   * Below are a few static members of the LSCPServer class.   * Below are a few static members of the LSCPServer class.
# Line 89  int LSCPServer::Main() { Line 89  int LSCPServer::Main() {
89      FD_ZERO(&fdSet);      FD_ZERO(&fdSet);
90      FD_SET(hSocket, &fdSet);      FD_SET(hSocket, &fdSet);
91      int maxSessions = hSocket;      int maxSessions = hSocket;
92    
93      // Parser initialization      // Parser initialization
94      yyparse_param_t yyparse_param;      yyparse_param_t yyparse_param;
95      yyparse_param.pServer = this;      yyparse_param.pServer = this;
# Line 104  int LSCPServer::Main() { Line 104  int LSCPServer::Main() {
104                  close(hSocket);                  close(hSocket);
105                  exit(EXIT_FAILURE);                  exit(EXIT_FAILURE);
106          }          }
107            
108          //Accept new connections now (if any)          //Accept new connections now (if any)
109          if (FD_ISSET(hSocket, &selectSet)) {          if (FD_ISSET(hSocket, &selectSet)) {
110                  int socket = accept(hSocket, (sockaddr*) &client, (socklen_t*) &length);                  int socket = accept(hSocket, (sockaddr*) &client, (socklen_t*) &length);
# Line 143  int LSCPServer::Main() { Line 143  int LSCPServer::Main() {
143                          }                          }
144                          //socket may have been closed, iter may be invalid, get out of the loop for now.                          //socket may have been closed, iter may be invalid, get out of the loop for now.
145                          //we'll be back if there is data.                          //we'll be back if there is data.
146                          break;                          break;
147                  }                  }
148          }          }
149    
# Line 238  bool LSCPServer::GetLSCPCommand( std::ve Line 238  bool LSCPServer::GetLSCPCommand( std::ve
238                          break;                          break;
239                  }                  }
240                  if (result == 1) {                  if (result == 1) {
241                          if (c == '\r')                          if (c == '\r')
242                                  continue; //Ignore CR                                  continue; //Ignore CR
243                          if (c == '\n') {                          if (c == '\n') {
244                                  LSCPServer::SendLSCPNotify(LSCPEvent(LSCPEvent::event_misc, "Received \'" + bufferedCommands[socket] + "\' on socket", socket));                                  LSCPServer::SendLSCPNotify(LSCPEvent(LSCPEvent::event_misc, "Received \'" + bufferedCommands[socket] + "\' on socket", socket));
# Line 265  bool LSCPServer::GetLSCPCommand( std::ve Line 265  bool LSCPServer::GetLSCPCommand( std::ve
265                                          break;                                          break;
266                                  case EAGAIN:                                  case EAGAIN:
267                                          dmsg(2,("LSCPScanner: The socket is marked non-blocking and the receive operation would block, or a receive timeout had been set and the timeout expired before data was received.\n"));                                          dmsg(2,("LSCPScanner: The socket is marked non-blocking and the receive operation would block, or a receive timeout had been set and the timeout expired before data was received.\n"));
268                                          break;                                          break;
269                                  case EINTR:                                  case EINTR:
270                                          dmsg(2,("LSCPScanner: The receive was interrupted by delivery of a signal before any data were available.\n"));                                          dmsg(2,("LSCPScanner: The receive was interrupted by delivery of a signal before any data were available.\n"));
271                                          break;                                          break;
272                                  case EFAULT:                                  case EFAULT:
273                                          dmsg(2,("LSCPScanner: The receive buffer pointer(s) point outside the process's address space.\n"));                                          dmsg(2,("LSCPScanner: The receive buffer pointer(s) point outside the process's address space.\n"));
274                                          break;                                          break;
275                                  case EINVAL:                                  case EINVAL:
276                                          dmsg(2,("LSCPScanner: Invalid argument passed.\n"));                                          dmsg(2,("LSCPScanner: Invalid argument passed.\n"));
277                                          break;                                          break;
278                                  case ENOMEM:                                  case ENOMEM:
279                                          dmsg(2,("LSCPScanner: Could not allocate memory for recvmsg.\n"));                                          dmsg(2,("LSCPScanner: Could not allocate memory for recvmsg.\n"));
280                                          break;                                          break;
281                                  default:                                  default:
282                                          dmsg(2,("LSCPScanner: Unknown recv() error.\n"));                                          dmsg(2,("LSCPScanner: Unknown recv() error.\n"));
283                                          break;                                          break;
284                          }                          }
285                          CloseConnection(iter);                          CloseConnection(iter);
286                          break;                          break;
287                  }                  }
# Line 911  String LSCPServer::GetMidiInputPortParam Line 911  String LSCPServer::GetMidiInputPortParam
911          std::map<String,DeviceCreationParameter*> parameters = pPort->DeviceParameters();          std::map<String,DeviceCreationParameter*> parameters = pPort->DeviceParameters();
912          if (!parameters[ParameterName]) throw LinuxSamplerException("Midi port does not provice a parameters '" + ParameterName + "'.");          if (!parameters[ParameterName]) throw LinuxSamplerException("Midi port does not provice a parameters '" + ParameterName + "'.");
913          DeviceCreationParameter* pParameter = parameters[ParameterName];          DeviceCreationParameter* pParameter = parameters[ParameterName];
914            
915          // return all fields of this audio channel parameter          // return all fields of this audio channel parameter
916          result.Add("TYPE",         pParameter->Type());          result.Add("TYPE",         pParameter->Type());
917          result.Add("DESCRIPTION",  pParameter->Description());          result.Add("DESCRIPTION",  pParameter->Description());
# Line 1074  String LSCPServer::SetAudioOutputType(St Line 1074  String LSCPServer::SetAudioOutputType(St
1074          if (!pSamplerChannel) throw LinuxSamplerException("Invalid channel number " + ToString(uiSamplerChannel));          if (!pSamplerChannel) throw LinuxSamplerException("Invalid channel number " + ToString(uiSamplerChannel));
1075          // Driver type name aliasing...          // Driver type name aliasing...
1076          if (AudioOutputDriver == "ALSA") AudioOutputDriver = "Alsa";          if (AudioOutputDriver == "ALSA") AudioOutputDriver = "Alsa";
1077          if (AudioOutputDriver == "JACK") AudioOutputDriver = "Jack";                  if (AudioOutputDriver == "JACK") AudioOutputDriver = "Jack";
1078          // Check if there's one audio output device already created          // Check if there's one audio output device already created
1079          // for the intended audio driver type (AudioOutputDriver)...          // for the intended audio driver type (AudioOutputDriver)...
1080          AudioOutputDevice *pDevice = NULL;          AudioOutputDevice *pDevice = NULL;

Legend:
Removed from v.198  
changed lines
  Added in v.203

  ViewVC Help
Powered by ViewVC