/[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 2043 by persson, Sat Jan 9 09:37:01 2010 UTC revision 2330 by schoenebeck, Mon Mar 12 15:14:31 2012 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-2012 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 59  namespace LinuxSampler { namespace gig { Line 58  namespace LinuxSampler { namespace gig {
58       *  @param Program     - MIDI program change number       *  @param Program     - MIDI program change number
59       */       */
60      void EngineChannel::SendProgramChange(uint8_t Program) {      void EngineChannel::SendProgramChange(uint8_t Program) {
61            SetMidiProgram(Program);
62          Engine* engine = dynamic_cast<Engine*>(pEngine);          Engine* engine = dynamic_cast<Engine*>(pEngine);
63          if(engine == NULL) return;          if(engine == NULL) return;
64    
65          if(engine->GetDiskThread()) {          if(engine->GetDiskThread()) {
66              engine->GetDiskThread()->OrderProgramChange(Program, this);              uint32_t merged = (GetMidiBankMsb() << 16) | (GetMidiBankLsb() << 8) | Program;
67                engine->GetDiskThread()->OrderProgramChange(merged, this);
68          } else {          } else {
69              // TODO:              // TODO:
70          }          }
# Line 91  namespace LinuxSampler { namespace gig { Line 92  namespace LinuxSampler { namespace gig {
92          cmd.pRegionsInUse->clear();          cmd.pRegionsInUse->clear();
93    
94          // delete all key groups          // delete all key groups
95          ActiveKeyGroups.clear();          DeleteGroupEventLists();
96    
97          // request gig instrument from instrument manager          // request gig instrument from instrument manager
98          ::gig::Instrument* newInstrument;          ::gig::Instrument* newInstrument;
# Line 131  namespace LinuxSampler { namespace gig { Line 132  namespace LinuxSampler { namespace gig {
132          // counter for each region          // counter for each region
133          int region = 0;          int region = 0;
134          for (::gig::Region* pRegion = newInstrument->GetFirstRegion(); pRegion; pRegion = newInstrument->GetNextRegion()) {          for (::gig::Region* pRegion = newInstrument->GetFirstRegion(); pRegion; pRegion = newInstrument->GetNextRegion()) {
135              if (pRegion->KeyGroup) ActiveKeyGroups[pRegion->KeyGroup] = NULL;              AddGroup(pRegion->KeyGroup);
136    
137              RoundRobinIndexes[region] = 0;              RoundRobinIndexes[region] = 0;
138              for (int iKey = pRegion->KeyRange.low; iKey <= pRegion->KeyRange.high; iKey++) {              for (int iKey = pRegion->KeyRange.low; iKey <= pRegion->KeyRange.high; iKey++) {
# Line 156  namespace LinuxSampler { namespace gig { Line 157  namespace LinuxSampler { namespace gig {
157                      (pInstrument->DimensionKeyRange.high - pInstrument->DimensionKeyRange.low + 1);                      (pInstrument->DimensionKeyRange.high - pInstrument->DimensionKeyRange.low + 1);
158          }          }
159      }      }
160        
161        String EngineChannel::InstrumentFileName() {
162            return EngineChannelBase<Voice, ::gig::DimensionRegion, ::gig::Instrument>::InstrumentFileName();
163        }
164        
165        String EngineChannel::InstrumentFileName(int index) {
166            if (index == 0) return InstrumentFileName();
167            if (!pInstrument || !pInstrument->GetParent()) return "";
168            DLS::File* pMainFile = dynamic_cast<DLS::File*>(pInstrument->GetParent());
169            if (!pMainFile) return "";
170            RIFF::File* pExtensionFile = pMainFile->GetExtensionFile(index);
171            return (pExtensionFile) ? pExtensionFile->GetFileName() : "";
172        }
173    
174  }} // namespace LinuxSampler::gig  }} // namespace LinuxSampler::gig

Legend:
Removed from v.2043  
changed lines
  Added in v.2330

  ViewVC Help
Powered by ViewVC