/[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 2277 by persson, Sat Oct 1 08:23:02 2011 UTC revision 2612 by schoenebeck, Tue Jun 10 13:32:16 2014 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-2008 Christian Schoenebeck                         *   *   Copyright (C) 2005-2008 Christian Schoenebeck                         *
7   *   Copyright (C) 2009-2011 Christian Schoenebeck and 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 89  namespace LinuxSampler { namespace gig { Line 89  namespace LinuxSampler { namespace gig {
89              // keep the dimension regions and samples that are in use              // keep the dimension regions and samples that are in use
90              pInstrumentManager->HandBackInstrument(cmd.pInstrument, this, cmd.pRegionsInUse);              pInstrumentManager->HandBackInstrument(cmd.pInstrument, this, cmd.pRegionsInUse);
91          }          }
92            if (cmd.pScript) {
93                // give old instrument script back to instrument resource manager
94                cmd.pScript->resetAll();
95            }
96          cmd.pRegionsInUse->clear();          cmd.pRegionsInUse->clear();
97    
98          // delete all key groups          // delete all key groups
# Line 105  namespace LinuxSampler { namespace gig { Line 109  namespace LinuxSampler { namespace gig {
109              if (!newInstrument) {              if (!newInstrument) {
110                  throw InstrumentManagerException("resource was not created");                  throw InstrumentManagerException("resource was not created");
111              }              }
112    
113                if (newInstrument->ScriptSlotCount() > 1) {
114                    std::cerr << "WARNING: Executing more than one real-time instrument script slot is not implemented yet!\n";
115                }
116                ::gig::Script* script = newInstrument->GetScriptOfSlot(0);
117                if (script) {
118                    String sourceCode = script->GetScriptAsText();
119                    LoadInstrumentScript(sourceCode);
120                }
121          }          }
122          catch (RIFF::Exception e) {          catch (RIFF::Exception e) {
123              InstrumentStat = -2;              InstrumentStat = -2;
# Line 144  namespace LinuxSampler { namespace gig { Line 157  namespace LinuxSampler { namespace gig {
157          InstrumentIdxName = newInstrument->pInfo->Name;          InstrumentIdxName = newInstrument->pInfo->Name;
158          InstrumentStat = 100;          InstrumentStat = 100;
159    
160          ChangeInstrument(newInstrument);          cmd = ChangeInstrument(newInstrument);
161            if (cmd.pScript) {
162                // give old instrument script back to instrument resource manager
163                cmd.pScript->resetAll();
164            }
165    
166          StatusChanged(true);          StatusChanged(true);
167      }      }
# Line 157  namespace LinuxSampler { namespace gig { Line 174  namespace LinuxSampler { namespace gig {
174                      (pInstrument->DimensionKeyRange.high - pInstrument->DimensionKeyRange.low + 1);                      (pInstrument->DimensionKeyRange.high - pInstrument->DimensionKeyRange.low + 1);
175          }          }
176      }      }
177        
178        String EngineChannel::InstrumentFileName() {
179            return EngineChannelBase<Voice, ::gig::DimensionRegion, ::gig::Instrument>::InstrumentFileName();
180        }
181        
182        String EngineChannel::InstrumentFileName(int index) {
183            if (index == 0) return InstrumentFileName();
184            if (!pInstrument || !pInstrument->GetParent()) return "";
185            DLS::File* pMainFile = dynamic_cast<DLS::File*>(pInstrument->GetParent());
186            if (!pMainFile) return "";
187            RIFF::File* pExtensionFile = pMainFile->GetExtensionFile(index);
188            return (pExtensionFile) ? pExtensionFile->GetFileName() : "";
189        }
190    
191  }} // namespace LinuxSampler::gig  }} // namespace LinuxSampler::gig

Legend:
Removed from v.2277  
changed lines
  Added in v.2612

  ViewVC Help
Powered by ViewVC