/[svn]/libgig/trunk/src/gig.cpp
ViewVC logotype

Diff of /libgig/trunk/src/gig.cpp

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

revision 1627 by persson, Sun Jan 6 10:53:53 2008 UTC revision 1678 by persson, Sun Feb 10 16:07:22 2008 UTC
# Line 2965  MidiRuleCtrlTrigger::MidiRuleCtrlTrigger Line 2965  MidiRuleCtrlTrigger::MidiRuleCtrlTrigger
2965          PianoReleaseMode = false;          PianoReleaseMode = false;
2966          DimensionKeyRange.low = 0;          DimensionKeyRange.low = 0;
2967          DimensionKeyRange.high = 0;          DimensionKeyRange.high = 0;
2968            pMidiRules = new MidiRule*[3];
2969            pMidiRules[0] = NULL;
2970    
2971          // Loading          // Loading
2972          RIFF::List* lart = insList->GetSubList(LIST_TYPE_LART);          RIFF::List* lart = insList->GetSubList(LIST_TYPE_LART);
# Line 2982  MidiRuleCtrlTrigger::MidiRuleCtrlTrigger Line 2984  MidiRuleCtrlTrigger::MidiRuleCtrlTrigger
2984    
2985                  if (_3ewg->GetSize() > 32) {                  if (_3ewg->GetSize() > 32) {
2986                      // read MIDI rules                      // read MIDI rules
2987                        int i = 0;
2988                      _3ewg->SetPos(32);                      _3ewg->SetPos(32);
2989                      uint8_t id1 = _3ewg->ReadUint8();                      uint8_t id1 = _3ewg->ReadUint8();
2990                      uint8_t id2 = _3ewg->ReadUint8();                      uint8_t id2 = _3ewg->ReadUint8();
2991    
2992                      if (id1 == 4 && id2 == 16) {                      if (id1 == 4 && id2 == 16) {
2993                          MidiRules.push_back(new MidiRuleCtrlTrigger(_3ewg));                          pMidiRules[i++] = new MidiRuleCtrlTrigger(_3ewg);
2994                      }                      }
2995                      //TODO: all the other types of rules                      //TODO: all the other types of rules
2996    
2997                        pMidiRules[i] = NULL;
2998                  }                  }
2999              }              }
3000          }          }
# Line 3027  MidiRuleCtrlTrigger::MidiRuleCtrlTrigger Line 3032  MidiRuleCtrlTrigger::MidiRuleCtrlTrigger
3032      }      }
3033    
3034      Instrument::~Instrument() {      Instrument::~Instrument() {
3035            delete[] pMidiRules;
3036      }      }
3037    
3038      /**      /**
# Line 3142  MidiRuleCtrlTrigger::MidiRuleCtrlTrigger Line 3148  MidiRuleCtrlTrigger::MidiRuleCtrlTrigger
3148      }      }
3149    
3150      /**      /**
3151       * Returns the first MIDI rule of the instrument. You have to call       * Returns a MIDI rule of the instrument.
      * this method once before you use GetNextMidiRule().  
3152       *       *
3153       * The list of MIDI rules, at least in gig v3, always contains at       * The list of MIDI rules, at least in gig v3, always contains at
3154       * most two rules. The second rule can only be the DEF filter       * most two rules. The second rule can only be the DEF filter
3155       * (which currently isn't supported by libgig).       * (which currently isn't supported by libgig).
3156       *       *
3157       * @returns  pointer address to first MIDI rule or NULL if there is none       * @param i - MIDI rule number
3158       * @see      GetNextMidiRule()       * @returns   pointer address to MIDI rule number i or NULL if there is none
3159       */       */
3160      MidiRule* Instrument::GetFirstMidiRule() {      MidiRule* Instrument::GetMidiRule(int i) {
3161          MidiRulesIterator = MidiRules.begin();          return pMidiRules[i];
         return MidiRulesIterator != MidiRules.end() ? *MidiRulesIterator : NULL;  
     }  
   
     /**  
      * Returns the next MIDI rule of the instrument. You have to call  
      * GetFirstMidiRule() once before you can use this method. By  
      * calling this method multiple times it iterates through the  
      * available rules.  
      *  
      * @returns  pointer address to the next MIDI rule or NULL if end reached  
      * @see      GetFirstMidiRule()  
      */  
     MidiRule* Instrument::GetNextMidiRule() {  
         MidiRulesIterator++;  
         return MidiRulesIterator != MidiRules.end() ? *MidiRulesIterator : NULL;  
3162      }      }
3163    
3164    
# Line 3413  MidiRuleCtrlTrigger::MidiRuleCtrlTrigger Line 3403  MidiRuleCtrlTrigger::MidiRuleCtrlTrigger
3403          pSamples->erase(iter);          pSamples->erase(iter);
3404          delete pSample;          delete pSample;
3405    
3406            SampleList::iterator tmp = SamplesIterator;
3407          // remove all references to the sample          // remove all references to the sample
3408          for (Instrument* instrument = GetFirstInstrument() ; instrument ;          for (Instrument* instrument = GetFirstInstrument() ; instrument ;
3409               instrument = GetNextInstrument()) {               instrument = GetNextInstrument()) {
# Line 3427  MidiRuleCtrlTrigger::MidiRuleCtrlTrigger Line 3418  MidiRuleCtrlTrigger::MidiRuleCtrlTrigger
3418                  }                  }
3419              }              }
3420          }          }
3421            SamplesIterator = tmp; // restore iterator
3422      }      }
3423    
3424      void File::LoadSamples() {      void File::LoadSamples() {

Legend:
Removed from v.1627  
changed lines
  Added in v.1678

  ViewVC Help
Powered by ViewVC