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

Diff of /linuxsampler/trunk/src/engines/gig/InstrumentResourceManager.cpp

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

revision 947 by schoenebeck, Mon Nov 27 21:34:55 2006 UTC revision 958 by schoenebeck, Wed Nov 29 19:48:38 2006 UTC
# Line 77  namespace LinuxSampler { namespace gig { Line 77  namespace LinuxSampler { namespace gig {
77          SetAvailabilityMode(ID, static_cast<ResourceManager<InstrumentManager::instrument_id_t, ::gig::Instrument>::mode_t>(Mode));          SetAvailabilityMode(ID, static_cast<ResourceManager<InstrumentManager::instrument_id_t, ::gig::Instrument>::mode_t>(Mode));
78      }      }
79    
     float InstrumentResourceManager::GetVolume(const instrument_id_t& ID) {  
         void* pCustomData = CustomData(ID);  
         const float fVolume = (pCustomData) ? *((float*)pCustomData) /* stored value */ : 1.0f /* default value */;  
         return fVolume;  
     }  
   
     void InstrumentResourceManager::SetVolume(const instrument_id_t& ID, float Volume) {  
         void* pCustomData = CustomData(ID);  
         if (Volume == 1.0f) { // if default volume ...  
             if (pCustomData) { // ... delete volume entry if necessary  
                 delete (float*)pCustomData;  
                 SetCustomData(ID, NULL);  
             }  
         } else { // if not default volume  
             if (!pCustomData) { // create volume entry if necessary  
                 pCustomData = new float;  
                 SetCustomData(ID, pCustomData);  
             }  
             *((float*)pCustomData) = Volume;  
         }  
     }  
   
80      String InstrumentResourceManager::GetInstrumentName(instrument_id_t ID) {      String InstrumentResourceManager::GetInstrumentName(instrument_id_t ID) {
81          return ""; // TODO: ...          ::gig::Instrument* pInstrument = Resource(ID);
82            return (pInstrument) ? pInstrument->pInfo->Name : "";
83      }      }
84    
85      ::gig::Instrument* InstrumentResourceManager::Create(instrument_id_t Key, InstrumentConsumer* pConsumer, void*& pArg) {      ::gig::Instrument* InstrumentResourceManager::Create(instrument_id_t Key, InstrumentConsumer* pConsumer, void*& pArg) {
# Line 167  namespace LinuxSampler { namespace gig { Line 146  namespace LinuxSampler { namespace gig {
146    
147      void InstrumentResourceManager::Destroy( ::gig::Instrument* pResource, void* pArg) {      void InstrumentResourceManager::Destroy( ::gig::Instrument* pResource, void* pArg) {
148          instr_entry_t* pEntry = (instr_entry_t*) pArg;          instr_entry_t* pEntry = (instr_entry_t*) pArg;
         // remove volume entry if necessary  
         void* pCustomData = CustomData(pEntry->ID);  
         if (pCustomData) {  
             delete (float*)pCustomData;  
             SetCustomData(pEntry->ID, NULL);  
         }  
149          // we don't need the .gig file here anymore          // we don't need the .gig file here anymore
150          Gigs.HandBack(pEntry->pGig, (GigConsumer*) pEntry->ID.Index); // conversion kinda hackish :/          Gigs.HandBack(pEntry->pGig, (GigConsumer*) pEntry->ID.Index); // conversion kinda hackish :/
151          delete pEntry;          delete pEntry;

Legend:
Removed from v.947  
changed lines
  Added in v.958

  ViewVC Help
Powered by ViewVC