/[svn]/linuxsampler/trunk/src/engines/InstrumentManagerBase.h
ViewVC logotype

Diff of /linuxsampler/trunk/src/engines/InstrumentManagerBase.h

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

revision 2326 by persson, Thu Mar 8 19:40:14 2012 UTC revision 2460 by persson, Sun Aug 18 14:20:53 2013 UTC
# Line 4  Line 4 
4   *                                                                         *   *                                                                         *
5   *   Copyright (C) 2003, 2004 by Benno Senoner and Christian Schoenebeck   *   *   Copyright (C) 2003, 2004 by Benno Senoner and Christian Schoenebeck   *
6   *   Copyright (C) 2005 - 2008 Christian Schoenebeck                       *   *   Copyright (C) 2005 - 2008 Christian Schoenebeck                       *
7   *   Copyright (C) 2009 - 2012 Christian Schoenebeck and Grigor Iliev      *   *   Copyright (C) 2009 - 2013 Christian Schoenebeck and Grigor Iliev      *
8   *                                                                         *   *                                                                         *
9   *   This library is free software; you can redistribute it and/or modify  *   *   This library is free software; you can redistribute it and/or modify  *
10   *   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 59  namespace LinuxSampler { Line 59  namespace LinuxSampler {
59              InstrumentManagerBase() { }              InstrumentManagerBase() { }
60              virtual ~InstrumentManagerBase() { }              virtual ~InstrumentManagerBase() { }
61    
62              virtual InstrumentEditor* LaunchInstrumentEditor(instrument_id_t ID, void* pUserData = NULL) throw (InstrumentManagerException) {              virtual InstrumentEditor* LaunchInstrumentEditor(instrument_id_t ID, void* pUserData = NULL) throw (InstrumentManagerException) OVERRIDE {
63                   throw InstrumentManagerException(                   throw InstrumentManagerException(
64                      "Instrument editing is not supported for this instrument format"                      "Instrument editing is not supported for this instrument format"
65                  );                  );
66              }              }
67    
68              virtual String GetInstrumentDataStructureName(instrument_id_t ID) {              virtual String GetInstrumentDataStructureName(instrument_id_t ID) OVERRIDE {
69                  throw InstrumentManagerException("Not implemented");                  throw InstrumentManagerException("Not implemented");
70              }              }
71    
72              virtual String GetInstrumentDataStructureVersion(instrument_id_t ID) {              virtual String GetInstrumentDataStructureVersion(instrument_id_t ID) OVERRIDE {
73                  throw InstrumentManagerException("Not implemented");                  throw InstrumentManagerException("Not implemented");
74              }              }
75    
# Line 85  namespace LinuxSampler { Line 85  namespace LinuxSampler {
85                  InstrumentConsumer*  pConsumer,                  InstrumentConsumer*  pConsumer,
86                  RTList<R*>*          pRegionsInUse                  RTList<R*>*          pRegionsInUse
87              ) {              ) {
88                  RegionInfoMutex.Lock();                  LockGuard lock(RegionInfoMutex);
89                  for (typename RTList<R*>::Iterator i = pRegionsInUse->first() ; i != pRegionsInUse->end() ; i++) {                  for (typename RTList<R*>::Iterator i = pRegionsInUse->first() ; i != pRegionsInUse->end() ; i++) {
90                      RegionInfo[*i].refCount++;                      RegionInfo[*i].refCount++;
91                      SampleRefCount[(*i)->pSample]++;                      SampleRefCount[(*i)->pSample]++;
92                  }                  }
93                  HandBack(pResource, pConsumer, true);                  this->HandBack(pResource, pConsumer, true);
                 RegionInfoMutex.Unlock();  
94              }              }
95    
96              /**              /**
# Line 99  namespace LinuxSampler { Line 98  namespace LinuxSampler {
98               * was previously handed back.               * was previously handed back.
99               */               */
100              virtual void HandBackRegion(R* pRegion) {              virtual void HandBackRegion(R* pRegion) {
101                  RegionInfoMutex.Lock();                  LockGuard lock(RegionInfoMutex);
102                  if (RegionInfo.find(pRegion) == RegionInfo.end()) {                  if (RegionInfo.find(pRegion) == RegionInfo.end()) {
103                      std::cerr << "Handing back unknown region. This is a BUG!!!" << std::endl;                      std::cerr << "Handing back unknown region. This is a BUG!!!" << std::endl;
104                  }                  }
# Line 117  namespace LinuxSampler { Line 116  namespace LinuxSampler {
116                      }                      }
117                      RegionInfo.erase(pRegion);                      RegionInfo.erase(pRegion);
118                  }                  }
                 RegionInfoMutex.Unlock();  
119              }              }
120    
121              virtual InstrumentManager::mode_t GetMode(const InstrumentManager::instrument_id_t& ID) {              virtual InstrumentManager::mode_t GetMode(const InstrumentManager::instrument_id_t& ID) OVERRIDE {
122                  return static_cast<InstrumentManager::mode_t>(ResourceManager<instrument_id_t, I>::AvailabilityMode(ID));                  return static_cast<InstrumentManager::mode_t>(ResourceManager<instrument_id_t, I>::AvailabilityMode(ID));
123              }              }
124    
125              virtual void SetMode(const InstrumentManager::instrument_id_t& ID, InstrumentManager::mode_t Mode) {              virtual void SetMode(const InstrumentManager::instrument_id_t& ID, InstrumentManager::mode_t Mode) OVERRIDE {
126                  dmsg(2,("InstrumentManagerBase: setting mode for %s (Index=%d) to %d\n",ID.FileName.c_str(),ID.Index,Mode));                  dmsg(2,("InstrumentManagerBase: setting mode for %s (Index=%d) to %d\n",ID.FileName.c_str(),ID.Index,Mode));
127                  SetAvailabilityMode(ID, static_cast<typename ResourceManager<instrument_id_t, I>::mode_t>(Mode));                  this->SetAvailabilityMode(ID, static_cast<typename ResourceManager<instrument_id_t, I>::mode_t>(Mode));
128              }              }
129    
130      protected:      protected:
# Line 241  namespace LinuxSampler { Line 239  namespace LinuxSampler {
239    
240                  if (pEntry->MaxSamplesPerCycle < maxSamplesPerCycle) {                  if (pEntry->MaxSamplesPerCycle < maxSamplesPerCycle) {
241                      dmsg(1,("Completely reloading instrument due to insufficient precached samples ...\n"));                      dmsg(1,("Completely reloading instrument due to insufficient precached samples ...\n"));
242                      Update(pResource, pConsumer);                      this->Update(pResource, pConsumer);
243                  }                  }
244              }              }
245      };      };

Legend:
Removed from v.2326  
changed lines
  Added in v.2460

  ViewVC Help
Powered by ViewVC