/[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 2026 by iliev, Fri Oct 23 17:53:17 2009 UTC revision 2027 by iliev, Tue Nov 3 19:27:42 2009 UTC
# Line 347  namespace LinuxSampler { Line 347  namespace LinuxSampler {
347              }              }
348    
349              virtual void ProcessKeySwitchChange(int key) = 0;              virtual void ProcessKeySwitchChange(int key) = 0;
350    
351                /**
352                 * Handle key group (a.k.a. exclusive group) conflicts
353                 */
354                void HandleKeyGroupConflicts(uint KeyGroup, Pool<Event>::Iterator& itNoteOnEvent) {
355                    if (KeyGroup) { // if this voice / key belongs to a key group
356                    uint** ppKeyGroup = &MidiKeyboardManager<V>::ActiveKeyGroups[KeyGroup];
357                    if (*ppKeyGroup) { // if there's already an active key in that key group
358                        MidiKey* pOtherKey = &MidiKeyboardManager<V>::pMIDIKeyInfo[**ppKeyGroup];
359                        // kill all voices on the (other) key
360                        typename RTList<V>::Iterator itVoiceToBeKilled = pOtherKey->pActiveVoices->first();
361                        typename RTList<V>::Iterator end               = pOtherKey->pActiveVoices->end();
362                        for (; itVoiceToBeKilled != end; ++itVoiceToBeKilled) {
363                            if (itVoiceToBeKilled->Type != Voice::type_release_trigger) {
364                                itVoiceToBeKilled->Kill(itNoteOnEvent);
365                                --pEngine->VoiceSpawnsLeft; //FIXME: just a hack, we should better check in StealVoice() if the voice was killed due to key conflict
366                            }
367                        }
368                    }
369                }
370                }
371      };      };
372    
373  } // namespace LinuxSampler  } // namespace LinuxSampler

Legend:
Removed from v.2026  
changed lines
  Added in v.2027

  ViewVC Help
Powered by ViewVC