/[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 793 by iliev, Wed Oct 26 09:34:38 2005 UTC revision 841 by persson, Sat Mar 4 16:23:53 2006 UTC
# Line 146  int LSCPServer::Main() { Line 146  int LSCPServer::Main() {
146          //Now let's deliver late notifies (if any)          //Now let's deliver late notifies (if any)
147          NotifyBufferMutex.Lock();          NotifyBufferMutex.Lock();
148          for (std::map<int,String>::iterator iterNotify = bufferedNotifies.begin(); iterNotify != bufferedNotifies.end(); iterNotify++) {          for (std::map<int,String>::iterator iterNotify = bufferedNotifies.begin(); iterNotify != bufferedNotifies.end(); iterNotify++) {
149    #ifdef MSG_NOSIGNAL
150                  send(iterNotify->first, iterNotify->second.c_str(), iterNotify->second.size(), MSG_NOSIGNAL);                  send(iterNotify->first, iterNotify->second.c_str(), iterNotify->second.size(), MSG_NOSIGNAL);
151                  bufferedNotifies.erase(iterNotify);  #else
152                    send(iterNotify->first, iterNotify->second.c_str(), iterNotify->second.size(), 0);
153    #endif
154          }          }
155            bufferedNotifies.clear();
156          NotifyBufferMutex.Unlock();          NotifyBufferMutex.Unlock();
157    
158          fd_set selectSet = fdSet;          fd_set selectSet = fdSet;
# Line 262  void LSCPServer::SendLSCPNotify( LSCPEve Line 266  void LSCPServer::SendLSCPNotify( LSCPEve
266          while (true) {          while (true) {
267                  if (NotifyMutex.Trylock()) {                  if (NotifyMutex.Trylock()) {
268                          for(;iter != end; iter++)                          for(;iter != end; iter++)
269    #ifdef MSG_NOSIGNAL
270                                  send(*iter, notify.c_str(), notify.size(), MSG_NOSIGNAL);                                  send(*iter, notify.c_str(), notify.size(), MSG_NOSIGNAL);
271    #else
272                                    send(*iter, notify.c_str(), notify.size(), 0);
273    #endif
274                          NotifyMutex.Unlock();                          NotifyMutex.Unlock();
275                          break;                          break;
276                  } else {                  } else {
# Line 371  void LSCPServer::AnswerClient(String Ret Line 379  void LSCPServer::AnswerClient(String Ret
379      dmsg(2,("LSCPServer::AnswerClient(ReturnMessage=%s)", ReturnMessage.c_str()));      dmsg(2,("LSCPServer::AnswerClient(ReturnMessage=%s)", ReturnMessage.c_str()));
380      if (currentSocket != -1) {      if (currentSocket != -1) {
381              NotifyMutex.Lock();              NotifyMutex.Lock();
382    #ifdef MSG_NOSIGNAL
383              send(currentSocket, ReturnMessage.c_str(), ReturnMessage.size(), MSG_NOSIGNAL);              send(currentSocket, ReturnMessage.c_str(), ReturnMessage.size(), MSG_NOSIGNAL);
384    #else
385                send(currentSocket, ReturnMessage.c_str(), ReturnMessage.size(), 0);
386    #endif
387              NotifyMutex.Unlock();              NotifyMutex.Unlock();
388      }      }
389  }  }
# Line 552  String LSCPServer::ListChannels() { Line 564  String LSCPServer::ListChannels() {
564   */   */
565  String LSCPServer::AddChannel() {  String LSCPServer::AddChannel() {
566      dmsg(2,("LSCPServer: AddChannel()\n"));      dmsg(2,("LSCPServer: AddChannel()\n"));
567        LockRTNotify();
568      SamplerChannel* pSamplerChannel = pSampler->AddSamplerChannel();      SamplerChannel* pSamplerChannel = pSampler->AddSamplerChannel();
569        UnlockRTNotify();
570      LSCPResultSet result(pSamplerChannel->Index());      LSCPResultSet result(pSamplerChannel->Index());
571      return result.Produce();      return result.Produce();
572  }  }
# Line 594  String LSCPServer::ListAvailableEngines( Line 608  String LSCPServer::ListAvailableEngines(
608  String LSCPServer::GetEngineInfo(String EngineName) {  String LSCPServer::GetEngineInfo(String EngineName) {
609      dmsg(2,("LSCPServer: GetEngineInfo(EngineName=%s)\n", EngineName.c_str()));      dmsg(2,("LSCPServer: GetEngineInfo(EngineName=%s)\n", EngineName.c_str()));
610      LSCPResultSet result;      LSCPResultSet result;
611        LockRTNotify();
612      try {      try {
613          Engine* pEngine = EngineFactory::Create(EngineName);          Engine* pEngine = EngineFactory::Create(EngineName);
614          result.Add("DESCRIPTION", pEngine->Description());          result.Add("DESCRIPTION", pEngine->Description());
# Line 603  String LSCPServer::GetEngineInfo(String Line 618  String LSCPServer::GetEngineInfo(String
618      catch (LinuxSamplerException e) {      catch (LinuxSamplerException e) {
619           result.Error(e);           result.Error(e);
620      }      }
621        UnlockRTNotify();
622      return result.Produce();      return result.Produce();
623  }  }
624    
# Line 1233  String LSCPServer::SetAudioOutputChannel Line 1249  String LSCPServer::SetAudioOutputChannel
1249  String LSCPServer::SetAudioOutputDevice(uint AudioDeviceId, uint uiSamplerChannel) {  String LSCPServer::SetAudioOutputDevice(uint AudioDeviceId, uint uiSamplerChannel) {
1250      dmsg(2,("LSCPServer: SetAudiotOutputDevice(AudioDeviceId=%d, SamplerChannel=%d)\n",AudioDeviceId,uiSamplerChannel));      dmsg(2,("LSCPServer: SetAudiotOutputDevice(AudioDeviceId=%d, SamplerChannel=%d)\n",AudioDeviceId,uiSamplerChannel));
1251      LSCPResultSet result;      LSCPResultSet result;
1252        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 LinuxSamplerException("Invalid sampler channel number " + ToString(uiSamplerChannel));
# Line 1244  String LSCPServer::SetAudioOutputDevice( Line 1261  String LSCPServer::SetAudioOutputDevice(
1261      catch (LinuxSamplerException e) {      catch (LinuxSamplerException e) {
1262           result.Error(e);           result.Error(e);
1263      }      }
1264        UnlockRTNotify();
1265      return result.Produce();      return result.Produce();
1266  }  }
1267    
1268  String LSCPServer::SetAudioOutputType(String AudioOutputDriver, uint uiSamplerChannel) {  String LSCPServer::SetAudioOutputType(String AudioOutputDriver, uint uiSamplerChannel) {
1269      dmsg(2,("LSCPServer: SetAudioOutputType(String AudioOutputDriver=%s, SamplerChannel=%d)\n",AudioOutputDriver.c_str(),uiSamplerChannel));      dmsg(2,("LSCPServer: SetAudioOutputType(String AudioOutputDriver=%s, SamplerChannel=%d)\n",AudioOutputDriver.c_str(),uiSamplerChannel));
1270      LSCPResultSet result;      LSCPResultSet result;
1271        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 LinuxSamplerException("Invalid sampler channel number " + ToString(uiSamplerChannel));
# Line 1281  String LSCPServer::SetAudioOutputType(St Line 1300  String LSCPServer::SetAudioOutputType(St
1300      catch (LinuxSamplerException e) {      catch (LinuxSamplerException e) {
1301           result.Error(e);           result.Error(e);
1302      }      }
1303        UnlockRTNotify();
1304      return result.Produce();      return result.Produce();
1305  }  }
1306    

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

  ViewVC Help
Powered by ViewVC