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

Diff of /linuxsampler/trunk/src/engines/sfz/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 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-2009 Christian Schoenebeck                         *   *   Copyright (C) 2005-2009 Christian Schoenebeck                         *
7   *   Copyright (C) 2009 Grigor Iliev                                       *   *   Copyright (C) 2009-2010 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 39  namespace LinuxSampler { namespace sfz { Line 39  namespace LinuxSampler { namespace sfz {
39          // fully loaded, try to give back instrument again (see bug #113)          // fully loaded, try to give back instrument again (see bug #113)
40          InstrumentChangeCmd< ::sfz::Region, ::sfz::Instrument>& cmd = ChangeInstrument(NULL);          InstrumentChangeCmd< ::sfz::Region, ::sfz::Instrument>& cmd = ChangeInstrument(NULL);
41          if (cmd.pInstrument) {          if (cmd.pInstrument) {
42                  InstrumentResourceManager* instrs = dynamic_cast<InstrumentResourceManager*>(pEngine->GetInstrumentManager());              Engine::instruments.HandBack(cmd.pInstrument, this);
                 instrs->HandBack(cmd.pInstrument, this);  
43          }          }
44          ///////          ///////
45      }      }
# Line 95  namespace LinuxSampler { namespace sfz { Line 94  namespace LinuxSampler { namespace sfz {
94          cmd.pRegionsInUse->clear();          cmd.pRegionsInUse->clear();
95    
96          // delete all key groups          // delete all key groups
97          ActiveKeyGroups.clear();          DeleteGroupEventLists();
98    
99          // request sfz instrument from instrument manager          // request sfz instrument from instrument manager
100          ::sfz::Instrument* newInstrument;          ::sfz::Instrument* newInstrument;
# Line 135  namespace LinuxSampler { namespace sfz { Line 134  namespace LinuxSampler { namespace sfz {
134          }          }
135    
136          // rebuild ActiveKeyGroups map with key groups of current instrument          // rebuild ActiveKeyGroups map with key groups of current instrument
137          //for (::gig::Region* pRegion = newInstrument->GetFirstRegion(); pRegion; pRegion = newInstrument->GetNextRegion())          for (std::vector< ::sfz::Region*>::iterator itRegion = newInstrument->regions.begin() ;
138          //    if (pRegion->KeyGroup) ActiveKeyGroups[pRegion->KeyGroup] = NULL;               itRegion != newInstrument->regions.end() ; ++itRegion) {
139          // TODO: ^^^              AddGroup((*itRegion)->group);
140                AddGroup((*itRegion)->off_by);
141            }
142    
143          InstrumentIdxName = newInstrument->GetName();          InstrumentIdxName = newInstrument->GetName();
144          InstrumentStat = 100;          InstrumentStat = 100;
# Line 150  namespace LinuxSampler { namespace sfz { Line 151  namespace LinuxSampler { namespace sfz {
151      void EngineChannel::ProcessKeySwitchChange(int key) { }      void EngineChannel::ProcessKeySwitchChange(int key) { }
152    
153      void EngineChannel::PreProcessNoteOn(uint8_t key, uint8_t velocity) {      void EngineChannel::PreProcessNoteOn(uint8_t key, uint8_t velocity) {
         LastKey = key;  
154          if(pInstrument != NULL && pInstrument->HasKeySwitchBinding(key)) LastKeySwitch = key;          if(pInstrument != NULL && pInstrument->HasKeySwitchBinding(key)) LastKeySwitch = key;
155          PressedKeys[key] = true;          PressedKeys[key] = true;
156      }      }
157    
158        void EngineChannel::PostProcessNoteOn(uint8_t key, uint8_t velocity) {
159            LastKey = key;
160        }
161    
162      void EngineChannel::PreProcessNoteOff(uint8_t key, uint8_t velocity) {      void EngineChannel::PreProcessNoteOff(uint8_t key, uint8_t velocity) {
163          PressedKeys[key] = false;          PressedKeys[key] = false;
164      }      }

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

  ViewVC Help
Powered by ViewVC