/[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 337 by senkov, Sun Jan 9 02:26:29 2005 UTC revision 360 by senkov, Mon Feb 7 00:19:30 2005 UTC
# Line 50  std::map< LSCPEvent::event_t, std::list< Line 50  std::map< LSCPEvent::event_t, std::list<
50  Mutex LSCPServer::NotifyMutex = Mutex();  Mutex LSCPServer::NotifyMutex = Mutex();
51  Mutex LSCPServer::NotifyBufferMutex = Mutex();  Mutex LSCPServer::NotifyBufferMutex = Mutex();
52  Mutex LSCPServer::SubscriptionMutex = Mutex();  Mutex LSCPServer::SubscriptionMutex = Mutex();
53    Mutex LSCPServer::RTNotifyMutex = Mutex();
54    
55  LSCPServer::LSCPServer(Sampler* pSampler) : Thread(false, 0, -4) {  LSCPServer::LSCPServer(Sampler* pSampler) : Thread(false, 0, -4) {
56      this->pSampler = pSampler;      this->pSampler = pSampler;
# Line 203  void LSCPServer::CloseConnection( std::v Line 204  void LSCPServer::CloseConnection( std::v
204          NotifyMutex.Unlock();          NotifyMutex.Unlock();
205  }  }
206    
207    int LSCPServer::EventSubscribers( std::list<LSCPEvent::event_t> events ) {
208            int subs = 0;
209            SubscriptionMutex.Lock();
210            for( std::list<LSCPEvent::event_t>::iterator iter = events.begin();
211                            iter != events.end(); iter++)
212            {
213                    subs += eventSubscriptions.count(*iter);
214            }
215            SubscriptionMutex.Unlock();
216            return subs;
217    }
218    
219  void LSCPServer::SendLSCPNotify( LSCPEvent event ) {  void LSCPServer::SendLSCPNotify( LSCPEvent event ) {
220          SubscriptionMutex.Lock();          SubscriptionMutex.Lock();
221          if (eventSubscriptions.count(event.GetType()) == 0) {          if (eventSubscriptions.count(event.GetType()) == 0) {
# Line 461  String LSCPServer::LoadEngine(String Eng Line 474  String LSCPServer::LoadEngine(String Eng
474          else throw LinuxSamplerException("Unknown engine type");          else throw LinuxSamplerException("Unknown engine type");
475          SamplerChannel* pSamplerChannel = pSampler->GetSamplerChannel(uiSamplerChannel);          SamplerChannel* pSamplerChannel = pSampler->GetSamplerChannel(uiSamplerChannel);
476          if (!pSamplerChannel) throw LinuxSamplerException("Index out of bounds");          if (!pSamplerChannel) throw LinuxSamplerException("Index out of bounds");
477            LockRTNotify();
478          pSamplerChannel->LoadEngine(type);          pSamplerChannel->LoadEngine(type);
479            UnlockRTNotify();
480      }      }
481      catch (LinuxSamplerException e) {      catch (LinuxSamplerException e) {
482           result.Error(e);           result.Error(e);
# Line 512  String LSCPServer::AddChannel() { Line 527  String LSCPServer::AddChannel() {
527  String LSCPServer::RemoveChannel(uint uiSamplerChannel) {  String LSCPServer::RemoveChannel(uint uiSamplerChannel) {
528      dmsg(2,("LSCPServer: RemoveChannel(SamplerChannel=%d)\n", uiSamplerChannel));      dmsg(2,("LSCPServer: RemoveChannel(SamplerChannel=%d)\n", uiSamplerChannel));
529      LSCPResultSet result;      LSCPResultSet result;
530        LockRTNotify();
531      pSampler->RemoveSamplerChannel(uiSamplerChannel);      pSampler->RemoveSamplerChannel(uiSamplerChannel);
532        UnlockRTNotify();
533      return result.Produce();      return result.Produce();
534  }  }
535    

Legend:
Removed from v.337  
changed lines
  Added in v.360

  ViewVC Help
Powered by ViewVC