/[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 705 by schoenebeck, Wed Jul 20 21:43:23 2005 UTC revision 778 by iliev, Fri Sep 23 06:58:26 2005 UTC
# Line 72  LSCPServer::LSCPServer(Sampler* pSampler Line 72  LSCPServer::LSCPServer(Sampler* pSampler
72      LSCPEvent::RegisterEvent(LSCPEvent::event_buffer_fill, "BUFFER_FILL");      LSCPEvent::RegisterEvent(LSCPEvent::event_buffer_fill, "BUFFER_FILL");
73      LSCPEvent::RegisterEvent(LSCPEvent::event_channel_info, "CHANNEL_INFO");      LSCPEvent::RegisterEvent(LSCPEvent::event_channel_info, "CHANNEL_INFO");
74      LSCPEvent::RegisterEvent(LSCPEvent::event_misc, "MISCELLANEOUS");      LSCPEvent::RegisterEvent(LSCPEvent::event_misc, "MISCELLANEOUS");
75        LSCPEvent::RegisterEvent(LSCPEvent::event_total_voice_count, "TOTAL_VOICE_COUNT");
76      hSocket = -1;      hSocket = -1;
77  }  }
78    
# Line 205  int LSCPServer::Main() { Line 206  int LSCPServer::Main() {
206          //Now let's deliver late notifies (if any)          //Now let's deliver late notifies (if any)
207          NotifyBufferMutex.Lock();          NotifyBufferMutex.Lock();
208          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++) {
209                  send(iterNotify->first, iterNotify->second.c_str(), iterNotify->second.size(), 0);                  send(iterNotify->first, iterNotify->second.c_str(), iterNotify->second.size(), MSG_NOSIGNAL);
210                  bufferedNotifies.erase(iterNotify);                  bufferedNotifies.erase(iterNotify);
211          }          }
212          NotifyBufferMutex.Unlock();          NotifyBufferMutex.Unlock();
# Line 255  void LSCPServer::SendLSCPNotify( LSCPEve Line 256  void LSCPServer::SendLSCPNotify( LSCPEve
256          while (true) {          while (true) {
257                  if (NotifyMutex.Trylock()) {                  if (NotifyMutex.Trylock()) {
258                          for(;iter != end; iter++)                          for(;iter != end; iter++)
259                                  send(*iter, notify.c_str(), notify.size(), 0);                                  send(*iter, notify.c_str(), notify.size(), MSG_NOSIGNAL);
260                          NotifyMutex.Unlock();                          NotifyMutex.Unlock();
261                          break;                          break;
262                  } else {                  } else {
# Line 364  void LSCPServer::AnswerClient(String Ret Line 365  void LSCPServer::AnswerClient(String Ret
365      dmsg(2,("LSCPServer::AnswerClient(ReturnMessage=%s)", ReturnMessage.c_str()));      dmsg(2,("LSCPServer::AnswerClient(ReturnMessage=%s)", ReturnMessage.c_str()));
366      if (currentSocket != -1) {      if (currentSocket != -1) {
367              NotifyMutex.Lock();              NotifyMutex.Lock();
368              send(currentSocket, ReturnMessage.c_str(), ReturnMessage.size(), 0);              send(currentSocket, ReturnMessage.c_str(), ReturnMessage.size(), MSG_NOSIGNAL);
369              NotifyMutex.Unlock();              NotifyMutex.Unlock();
370      }      }
371  }  }
# Line 1545  String LSCPServer::GetServerInfo() { Line 1546  String LSCPServer::GetServerInfo() {
1546      return result.Produce();      return result.Produce();
1547  }  }
1548    
1549    /**
1550     * Will be called by the parser to return the current number of all active voices.
1551     */
1552    String LSCPServer::GetTotalVoiceCount() {
1553        dmsg(2,("LSCPServer: GetTotalVoiceCount()\n"));
1554        LSCPResultSet result;
1555        result.Add(pSampler->GetVoiceCount());
1556        return result.Produce();
1557    }
1558    
1559    /**
1560     * Will be called by the parser to return the maximum number of voices.
1561     */
1562    String LSCPServer::GetTotalVoiceCountMax() {
1563        dmsg(2,("LSCPServer: GetTotalVoiceCountMax()\n"));
1564        LSCPResultSet result;
1565        result.Add(EngineFactory::EngineInstances().size() * CONFIG_MAX_VOICES);
1566        return result.Produce();
1567    }
1568    
1569  /**  /**
1570   * Will be called by the parser to subscribe a client (frontend) on the   * Will be called by the parser to subscribe a client (frontend) on the
1571   * server for receiving event messages.   * server for receiving event messages.

Legend:
Removed from v.705  
changed lines
  Added in v.778

  ViewVC Help
Powered by ViewVC