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 |
|
|
334 |
return noteID; |
return noteID; |
335 |
} |
} |
336 |
|
|
337 |
|
/** |
338 |
|
* Called by real-time instrument script functions to ignore the note |
339 |
|
* reflected by given note ID. The note's event will be freed immediately |
340 |
|
* to its event pool and this will prevent voices to be launched for the |
341 |
|
* note. |
342 |
|
* |
343 |
|
* NOTE: preventing a note by calling this method works only if the note |
344 |
|
* was launched within the current audio fragment cycle. |
345 |
|
* |
346 |
|
* @param id - unique ID of note to be dropped |
347 |
|
*/ |
348 |
|
void IgnoreNote(note_id_t id) OVERRIDE { |
349 |
|
Pool< Note<V> >* pNotePool = |
350 |
|
dynamic_cast<NotePool<V>*>(pEngine)->GetNotePool(); |
351 |
|
|
352 |
|
NoteIterator itNote = pNotePool->fromID(id); |
353 |
|
if (!itNote) return; // note probably already released |
354 |
|
|
355 |
|
// if the note already got active voices, then it is too late to drop it |
356 |
|
if (!itNote->pActiveVoices->isEmpty()) return; |
357 |
|
|
358 |
|
// if the original (note-on) event is not available anymore, then it is too late to drop it |
359 |
|
RTList<Event>::Iterator itEvent = pEvents->fromID(itNote->eventID); |
360 |
|
if (!itEvent) return; |
361 |
|
|
362 |
|
// drop the note |
363 |
|
pNotePool->free(itNote); |
364 |
|
|
365 |
|
// drop the original event |
366 |
|
pEvents->free(itEvent); |
367 |
|
} |
368 |
|
|
369 |
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 |
370 |
I* pInstrument; |
I* pInstrument; |
371 |
|
|