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

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

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

revision 2012 by iliev, Fri Oct 23 17:53:17 2009 UTC revision 2127 by persson, Wed Sep 22 18:59:16 2010 UTC
# Line 3  Line 3 
3   *   LinuxSampler - modular, streaming capable sampler                     *   *   LinuxSampler - modular, streaming capable sampler                     *
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-2009 Christian Schoenebeck                         *   *   Copyright (C) 2005-2008 Christian Schoenebeck                         *
7   *   Copyright (C) 2009 Grigor Iliev                                       *   *   Copyright (C) 2009-2010 Christian Schoenebeck and Grigor Iliev        *
8   *                                                                         *   *                                                                         *
9   *   This program is free software; you can redistribute it and/or modify  *   *   This program 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 36  namespace LinuxSampler { namespace gig { Line 36  namespace LinuxSampler { namespace gig {
36          // fully loaded, try to give back instrument again (see bug #113)          // fully loaded, try to give back instrument again (see bug #113)
37          InstrumentChangeCmd< ::gig::DimensionRegion, ::gig::Instrument>& cmd = ChangeInstrument(NULL);          InstrumentChangeCmd< ::gig::DimensionRegion, ::gig::Instrument>& cmd = ChangeInstrument(NULL);
38          if (cmd.pInstrument) {          if (cmd.pInstrument) {
39                  InstrumentResourceManager* instrs = dynamic_cast<InstrumentResourceManager*>(pEngine->GetInstrumentManager());              Engine::instruments.HandBack(cmd.pInstrument, this);
                 instrs->HandBack(cmd.pInstrument, this);  
40          }          }
41          ///////          ///////
42      }      }
# Line 91  namespace LinuxSampler { namespace gig { Line 90  namespace LinuxSampler { namespace gig {
90          cmd.pRegionsInUse->clear();          cmd.pRegionsInUse->clear();
91    
92          // delete all key groups          // delete all key groups
93          ActiveKeyGroups.clear();          DeleteGroupEventLists();
94    
95          // request gig instrument from instrument manager          // request gig instrument from instrument manager
96          ::gig::Instrument* newInstrument;          ::gig::Instrument* newInstrument;
# Line 123  namespace LinuxSampler { namespace gig { Line 122  namespace LinuxSampler { namespace gig {
122              throw Exception("gig::Engine error: Failed to load instrument, cause: Unknown exception while trying to parse gig file.");              throw Exception("gig::Engine error: Failed to load instrument, cause: Unknown exception while trying to parse gig file.");
123          }          }
124    
125          // rebuild ActiveKeyGroups map with key groups of current instrument          RoundRobinIndex = 0;
126          for (::gig::Region* pRegion = newInstrument->GetFirstRegion(); pRegion; pRegion = newInstrument->GetNextRegion())          for (int i = 0 ; i < 128 ; i++) pMIDIKeyInfo[i].pRoundRobinIndex = NULL;
127              if (pRegion->KeyGroup) ActiveKeyGroups[pRegion->KeyGroup] = NULL;  
128            // rebuild ActiveKeyGroups map with key groups of current
129            // instrument and set the round robin pointers to use one
130            // counter for each region
131            int region = 0;
132            for (::gig::Region* pRegion = newInstrument->GetFirstRegion(); pRegion; pRegion = newInstrument->GetNextRegion()) {
133                AddGroup(pRegion->KeyGroup);
134    
135                RoundRobinIndexes[region] = 0;
136                for (int iKey = pRegion->KeyRange.low; iKey <= pRegion->KeyRange.high; iKey++) {
137                    pMIDIKeyInfo[iKey].pRoundRobinIndex = &RoundRobinIndexes[region];
138                }
139                region++;
140            }
141    
142          InstrumentIdxName = newInstrument->pInfo->Name;          InstrumentIdxName = newInstrument->pInfo->Name;
143          InstrumentStat = 100;          InstrumentStat = 100;

Legend:
Removed from v.2012  
changed lines
  Added in v.2127

  ViewVC Help
Powered by ViewVC