/[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 2027 by iliev, Tue Nov 3 19:27:42 2009 UTC revision 2114 by persson, Tue Aug 10 12:05:19 2010 UTC
# Line 3  Line 3 
3   *   LinuxSampler - modular, streaming capable sampler                     *   *   LinuxSampler - modular, streaming capable sampler                     *
4   *                                                                         *   *                                                                         *
5   *   Copyright (C) 2003,2004 by Benno Senoner and Christian Schoenebeck    *   *   Copyright (C) 2003,2004 by Benno Senoner and Christian Schoenebeck    *
6   *   Copyright (C) 2005-2009 Christian Schoenebeck                         *   *   Copyright (C) 2005-2008 Christian Schoenebeck                         *
7   *   Copyright (C) 2009 Grigor Iliev                                       *   *   Copyright (C) 2009-2010 Christian Schoenebeck and Grigor Iliev        *
8   *                                                                         *   *                                                                         *
9   *   This program is free software; you can redistribute it and/or modify  *   *   This program is free software; you can redistribute it and/or modify  *
10   *   it under the terms of the GNU General Public License as published by  *   *   it under the terms of the GNU General Public License as published by  *
# Line 183  namespace LinuxSampler { Line 183  namespace LinuxSampler {
183    
184                      MidiKeyboardManager<V>::DeleteActiveVoices();                      MidiKeyboardManager<V>::DeleteActiveVoices();
185                      MidiKeyboardManager<V>::DeleteEvents();                      MidiKeyboardManager<V>::DeleteEvents();
186                        DeleteGroupEventLists();
187    
188                      AudioOutputDevice* oldAudioDevice = pEngine->pAudioOutputDevice;                      AudioOutputDevice* oldAudioDevice = pEngine->pAudioOutputDevice;
189                      pEngine = NULL;                      pEngine = NULL;
# Line 208  namespace LinuxSampler { Line 209  namespace LinuxSampler {
209                  // empty MIDI key specific event lists                  // empty MIDI key specific event lists
210                  ClearEventListsHandler handler;                  ClearEventListsHandler handler;
211                  ProcessActiveVoices(&handler);                  ProcessActiveVoices(&handler);
212    
213                    // empty exclusive group specific event lists
214                    ClearGroupEventLists();
215              }              }
216    
217              // implementation of abstract methods derived from interface class 'InstrumentConsumer'              // implementation of abstract methods derived from interface class 'InstrumentConsumer'
# Line 347  namespace LinuxSampler { Line 351  namespace LinuxSampler {
351              }              }
352    
353              virtual void ProcessKeySwitchChange(int key) = 0;              virtual void ProcessKeySwitchChange(int key) = 0;
   
             /**  
              * Handle key group (a.k.a. exclusive group) conflicts  
              */  
             void HandleKeyGroupConflicts(uint KeyGroup, Pool<Event>::Iterator& itNoteOnEvent) {  
                 if (KeyGroup) { // if this voice / key belongs to a key group  
                 uint** ppKeyGroup = &MidiKeyboardManager<V>::ActiveKeyGroups[KeyGroup];  
                 if (*ppKeyGroup) { // if there's already an active key in that key group  
                     MidiKey* pOtherKey = &MidiKeyboardManager<V>::pMIDIKeyInfo[**ppKeyGroup];  
                     // kill all voices on the (other) key  
                     typename RTList<V>::Iterator itVoiceToBeKilled = pOtherKey->pActiveVoices->first();  
                     typename RTList<V>::Iterator end               = pOtherKey->pActiveVoices->end();  
                     for (; itVoiceToBeKilled != end; ++itVoiceToBeKilled) {  
                         if (itVoiceToBeKilled->Type != Voice::type_release_trigger) {  
                             itVoiceToBeKilled->Kill(itNoteOnEvent);  
                             --pEngine->VoiceSpawnsLeft; //FIXME: just a hack, we should better check in StealVoice() if the voice was killed due to key conflict  
                         }  
                     }  
                 }  
             }  
             }  
354      };      };
355    
356  } // namespace LinuxSampler  } // namespace LinuxSampler

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

  ViewVC Help
Powered by ViewVC