/[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 2879 by schoenebeck, Tue Apr 19 14:07:53 2016 UTC revision 2927 by schoenebeck, Thu Jun 30 16:44:46 2016 UTC
# Line 60  namespace LinuxSampler { Line 60  namespace LinuxSampler {
60      template <class V /* Voice */, class R /* Region */, class I /* Instrument */>      template <class V /* Voice */, class R /* Region */, class I /* Instrument */>
61      class EngineChannelBase: public AbstractEngineChannel, public MidiKeyboardManager<V>, public ResourceConsumer<I> {      class EngineChannelBase: public AbstractEngineChannel, public MidiKeyboardManager<V>, public ResourceConsumer<I> {
62          public:          public:
63                typedef typename RTList< Note<V> >::Iterator NoteIterator;
64              typedef typename RTList<R*>::Iterator RTListRegionIterator;              typedef typename RTList<R*>::Iterator RTListRegionIterator;
65              typedef typename MidiKeyboardManager<V>::MidiKey MidiKey;              typedef typename MidiKeyboardManager<V>::MidiKey MidiKey;
66    
# Line 291  namespace LinuxSampler { Line 292  namespace LinuxSampler {
292                  bStatusChanged = true; // status of engine has changed, so set notify flag                  bStatusChanged = true; // status of engine has changed, so set notify flag
293              }              }
294    
295                /**
296                 * Called on sustain pedal up events to check and if required,
297                 * launch release trigger voices on the respective active key.
298                 *
299                 * @param pEngineChannel - engine channel on which this event occurred on
300                 * @param itEvent - release trigger event (contains note number)
301                 */
302                virtual void ProcessReleaseTrigger(RTList<Event>::Iterator& itEvent) OVERRIDE {
303                    if (!pEngine) return;
304                    pEngine->ProcessReleaseTrigger(this, itEvent);
305                }
306    
307              void RenderActiveVoices(uint Samples) {              void RenderActiveVoices(uint Samples) {
308                  RenderVoicesHandler handler(this, Samples);                  RenderVoicesHandler handler(this, Samples);
309                  this->ProcessActiveVoices(&handler);                  this->ProcessActiveVoices(&handler);
# Line 333  namespace LinuxSampler { Line 346  namespace LinuxSampler {
346                  return noteID;                  return noteID;
347              }              }
348    
349                /**
350                 * Called by real-time instrument script functions to ignore the note
351                 * reflected by given note ID. The note's event will be freed immediately
352                 * to its event pool and this will prevent voices to be launched for the
353                 * note.
354                 *
355                 * NOTE: preventing a note by calling this method works only if the note
356                 * was launched within the current audio fragment cycle.
357                 *
358                 * @param id - unique ID of note to be dropped
359                 */
360                void IgnoreNote(note_id_t id) OVERRIDE {
361                    Pool< Note<V> >* pNotePool =
362                        dynamic_cast<NotePool<V>*>(pEngine)->GetNotePool();
363    
364                    NoteIterator itNote = pNotePool->fromID(id);
365                    if (!itNote) return; // note probably already released
366    
367                    // if the note already got active voices, then it is too late to drop it
368                    if (!itNote->pActiveVoices->isEmpty()) return;
369    
370                    // if the original (note-on) event is not available anymore, then it is too late to drop it
371                    RTList<Event>::Iterator itEvent = pEvents->fromID(itNote->eventID);
372                    if (!itEvent) return;
373    
374                    // drop the note
375                    pNotePool->free(itNote);
376    
377                    // drop the original event
378                    pEvents->free(itEvent);
379                }
380    
381              RTList<R*>* pRegionsInUse;     ///< temporary pointer into the instrument change command, used by the audio thread              RTList<R*>* pRegionsInUse;     ///< temporary pointer into the instrument change command, used by the audio thread
382              I* pInstrument;              I* pInstrument;
383    

Legend:
Removed from v.2879  
changed lines
  Added in v.2927

  ViewVC Help
Powered by ViewVC