/[svn]/linuxsampler/trunk/src/engines/EngineChannelFactory.cpp
ViewVC logotype

Diff of /linuxsampler/trunk/src/engines/EngineChannelFactory.cpp

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 2323 by iliev, Fri Oct 23 17:53:17 2009 UTC revision 2324 by persson, Sun Mar 4 09:01:32 2012 UTC
# Line 1  Line 1 
1  /***************************************************************************  /***************************************************************************
2   *                                                                         *   *                                                                         *
3   *   Copyright (C) 2005, 2006 Christian Schoenebeck                        *   *   Copyright (C) 2005 - 2012 Christian Schoenebeck                       *
4   *                                                                         *   *                                                                         *
5   *   This program is free software; you can redistribute it and/or modify  *   *   This program is free software; you can redistribute it and/or modify  *
6   *   it under the terms of the GNU General Public License as published by  *   *   it under the terms of the GNU General Public License as published by  *
# Line 89  namespace LinuxSampler { Line 89  namespace LinuxSampler {
89      } lockedChannels;      } lockedChannels;
90    
91      Mutex EngineChannelFactory::LockedChannelsMutex;      Mutex EngineChannelFactory::LockedChannelsMutex;
92        Mutex EngineChannelFactory::EngineChannelsMutex;
93    
94      void EngineChannelFactory::SetDeleteEnabled(const EngineChannel* pEngineChannel, bool enable) {      void EngineChannelFactory::SetDeleteEnabled(const EngineChannel* pEngineChannel, bool enable) {
95          LockedChannelsMutex.Lock();          LockedChannelsMutex.Lock();
# Line 108  namespace LinuxSampler { Line 109  namespace LinuxSampler {
109      static std::set<LinuxSampler::EngineChannel*> engineChannels;      static std::set<LinuxSampler::EngineChannel*> engineChannels;
110    
111      LinuxSampler::EngineChannel* EngineChannelFactory::Create(String EngineType) throw (Exception) {      LinuxSampler::EngineChannel* EngineChannelFactory::Create(String EngineType) throw (Exception) {
112            LinuxSampler::EngineChannel* pEngineChannel;
113          if (!strcasecmp(EngineType.c_str(),"GigEngine") || !strcasecmp(EngineType.c_str(),"gig")) {          if (!strcasecmp(EngineType.c_str(),"GigEngine") || !strcasecmp(EngineType.c_str(),"gig")) {
114              LinuxSampler::EngineChannel* pEngineChannel = new gig::EngineChannel;              pEngineChannel = new gig::EngineChannel;
             engineChannels.insert(pEngineChannel);  
             return pEngineChannel;  
115          } else if (!strcasecmp(EngineType.c_str(),"sf2")) {          } else if (!strcasecmp(EngineType.c_str(),"sf2")) {
116          #if HAVE_SF2          #if HAVE_SF2
117              LinuxSampler::EngineChannel* pEngineChannel = new sf2::EngineChannel;              pEngineChannel = new sf2::EngineChannel;
             engineChannels.insert(pEngineChannel);  
             return pEngineChannel;  
118          #else          #else
119              throw Exception("LinuxSampler is not compiled with SF2 support");              throw Exception("LinuxSampler is not compiled with SF2 support");
120          #endif          #endif
121          } else if (!strcasecmp(EngineType.c_str(),"sfz")) {          } else if (!strcasecmp(EngineType.c_str(),"sfz")) {
122              LinuxSampler::EngineChannel* pEngineChannel = new sfz::EngineChannel;              pEngineChannel = new sfz::EngineChannel;
123              engineChannels.insert(pEngineChannel);          } else {
124              return pEngineChannel;              throw Exception("Unknown engine type");
125          }          }
126          throw Exception("Unknown engine type");          EngineChannelsMutex.Lock();
127            engineChannels.insert(pEngineChannel);
128            EngineChannelsMutex.Unlock();
129            return pEngineChannel;
130      }      }
131    
132      void EngineChannelFactory::Destroy(LinuxSampler::EngineChannel* pEngineChannel) {      void EngineChannelFactory::Destroy(LinuxSampler::EngineChannel* pEngineChannel) {
133          pEngineChannel->RemoveAllFxSendCountListeners();          pEngineChannel->RemoveAllFxSendCountListeners();
134            EngineChannelsMutex.Lock();
135          engineChannels.erase(pEngineChannel);          engineChannels.erase(pEngineChannel);
136            EngineChannelsMutex.Unlock();
137    
138          // Postpone the deletion of the specified EngineChannel if needed (bug #113)          // Postpone the deletion of the specified EngineChannel if needed (bug #113)
139          LockedChannelsMutex.Lock();          LockedChannelsMutex.Lock();

Legend:
Removed from v.2323  
changed lines
  Added in v.2324

  ViewVC Help
Powered by ViewVC