668 |
*/ |
*/ |
669 |
void AbstractEngineChannel::AddGroup(uint group) { |
void AbstractEngineChannel::AddGroup(uint group) { |
670 |
if (group) { |
if (group) { |
671 |
typedef std::map<uint, RTList<Event>*> map_t; |
std::pair<ActiveKeyGroupMap::iterator, bool> p = |
672 |
|
ActiveKeyGroups.insert(ActiveKeyGroupMap::value_type(group, 0)); |
|
std::pair<map_t::iterator, bool> p = |
|
|
ActiveKeyGroups.insert(map_t::value_type(group, 0)); |
|
673 |
if (p.second) { |
if (p.second) { |
674 |
(*p.first).second = new RTList<Event>(pEngine->pEventPool); |
// If the engine channel is pending deletion (see bug |
675 |
|
// #113), pEngine will be null, so we can't use |
676 |
|
// pEngine->pEventPool here. Instead we're using a |
677 |
|
// specialized RTList that allows specifying the pool |
678 |
|
// later. |
679 |
|
(*p.first).second = new LazyList<Event>; |
680 |
} |
} |
681 |
} |
} |
682 |
} |
} |
688 |
dmsg(4,("HandelKeyGroupConflicts KeyGroup=%d\n", KeyGroup)); |
dmsg(4,("HandelKeyGroupConflicts KeyGroup=%d\n", KeyGroup)); |
689 |
if (KeyGroup) { |
if (KeyGroup) { |
690 |
// send a release event to all active voices in the group |
// send a release event to all active voices in the group |
691 |
RTList<Event>::Iterator itEvent = ActiveKeyGroups[KeyGroup]->allocAppend(); |
RTList<Event>::Iterator itEvent = ActiveKeyGroups[KeyGroup]->allocAppend(pEngine->pEventPool); |
692 |
*itEvent = *itNoteOnEvent; |
*itEvent = *itNoteOnEvent; |
693 |
} |
} |
694 |
} |
} |
698 |
* audio thread, after all voices have been rendered. |
* audio thread, after all voices have been rendered. |
699 |
*/ |
*/ |
700 |
void AbstractEngineChannel::ClearGroupEventLists() { |
void AbstractEngineChannel::ClearGroupEventLists() { |
701 |
for (std::map<uint,RTList<Event>*>::iterator iter = ActiveKeyGroups.begin(); |
for (ActiveKeyGroupMap::iterator iter = ActiveKeyGroups.begin(); |
702 |
iter != ActiveKeyGroups.end(); iter++) { |
iter != ActiveKeyGroups.end(); iter++) { |
703 |
if (iter->second) { |
if (iter->second) { |
704 |
iter->second->clear(); |
iter->second->clear(); |
712 |
* Remove all lists with group events. |
* Remove all lists with group events. |
713 |
*/ |
*/ |
714 |
void AbstractEngineChannel::DeleteGroupEventLists() { |
void AbstractEngineChannel::DeleteGroupEventLists() { |
715 |
for (std::map<uint,RTList<Event>*>::iterator iter = ActiveKeyGroups.begin(); |
for (ActiveKeyGroupMap::iterator iter = ActiveKeyGroups.begin(); |
716 |
iter != ActiveKeyGroups.end(); iter++) { |
iter != ActiveKeyGroups.end(); iter++) { |
717 |
delete iter->second; |
delete iter->second; |
718 |
} |
} |