/[svn]/linuxsampler/trunk/src/engines/EngineChannelBase.h
ViewVC logotype

Diff of /linuxsampler/trunk/src/engines/EngineChannelBase.h

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

revision 2434 by schoenebeck, Thu Mar 7 19:23:24 2013 UTC revision 2611 by schoenebeck, Mon Jun 9 19:20:37 2014 UTC
# Line 39  namespace LinuxSampler { Line 39  namespace LinuxSampler {
39              bool bChangeInstrument;       ///< Set to true by the loader when the channel should change instrument.              bool bChangeInstrument;       ///< Set to true by the loader when the channel should change instrument.
40              I* pInstrument;               ///< The new instrument. Also used by the loader to read the previously loaded instrument.              I* pInstrument;               ///< The new instrument. Also used by the loader to read the previously loaded instrument.
41              RTList<R*>* pRegionsInUse; ///< List of dimension regions in use by the currently loaded instrument. Continuously updated by the audio thread.              RTList<R*>* pRegionsInUse; ///< List of dimension regions in use by the currently loaded instrument. Continuously updated by the audio thread.
42                InstrumentScript* pScript; ///< Instrument script to be executed for this instrument, or NULL if instrument does not have a script.
43      };      };
44    
45      template<class R>      template<class R>
# Line 289  namespace LinuxSampler { Line 290  namespace LinuxSampler {
290                      InstrumentChangeCmd<R, I>& cmd = InstrumentChangeCommand.GetConfigForUpdate();                      InstrumentChangeCmd<R, I>& cmd = InstrumentChangeCommand.GetConfigForUpdate();
291                      cmd.pRegionsInUse = NULL;                      cmd.pRegionsInUse = NULL;
292                      cmd.pInstrument = NULL;                      cmd.pInstrument = NULL;
293                        cmd.pScript = new InstrumentScript(this);
294                      cmd.bChangeInstrument = false;                      cmd.bChangeInstrument = false;
295                  }                  }
296                  {                  {
297                      InstrumentChangeCmd<R, I>& cmd = InstrumentChangeCommand.SwitchConfig();                      InstrumentChangeCmd<R, I>& cmd = InstrumentChangeCommand.SwitchConfig();
298                      cmd.pRegionsInUse = NULL;                      cmd.pRegionsInUse = NULL;
299                      cmd.pInstrument = NULL;                      cmd.pInstrument = NULL;
300                        cmd.pScript = new InstrumentScript(this);
301                      cmd.bChangeInstrument = false;                      cmd.bChangeInstrument = false;
302                  }                  }
303              }              }
304    
305              virtual ~EngineChannelBase() { }              virtual ~EngineChannelBase() {
306                    {
307                        InstrumentChangeCmd<R, I>& cmd = InstrumentChangeCommand.GetConfigForUpdate();
308                        if (cmd.pScript) delete cmd.pScript;
309                    }
310                    {
311                        InstrumentChangeCmd<R, I>& cmd = InstrumentChangeCommand.SwitchConfig();
312                        if (cmd.pScript) delete cmd.pScript;
313                    }
314                }
315    
316              typedef typename RTList<V>::Iterator RTListVoiceIterator;              typedef typename RTList<V>::Iterator RTListVoiceIterator;
317    
# Line 352  namespace LinuxSampler { Line 364  namespace LinuxSampler {
364              }              }
365    
366              /**              /**
367                 * Load real-time instrument script and all its resources required
368                 * for the upcoming instrument change.
369                 *
370                 * @param text - source code of script
371                 */
372                void LoadInstrumentScript(const String& text) {
373                    InstrumentChangeCmd<R, I>& cmd = InstrumentChangeCommand.GetConfigForUpdate();
374                    // unload *PRE*-previous script
375                    cmd.pScript->reset(); //TODO: previous script should be freed as soon as the EngineBase switched the instrument, right now 2 scripts are kept in memory all the time, even though the old one is not used anymore
376                    // load the new script
377                    cmd.pScript->load(text);
378                }
379    
380                /**
381               * Changes the instrument for an engine channel.               * Changes the instrument for an engine channel.
382               *               *
383               * @param pInstrument - new instrument               * @param pInstrument - new instrument

Legend:
Removed from v.2434  
changed lines
  Added in v.2611

  ViewVC Help
Powered by ViewVC