/[svn]/linuxsampler/trunk/src/engines/common/MidiKeyboardManager.h
ViewVC logotype

Diff of /linuxsampler/trunk/src/engines/common/MidiKeyboardManager.h

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 2927 by schoenebeck, Thu Jun 30 16:44:46 2016 UTC revision 3306 by schoenebeck, Tue Jul 11 15:50:05 2017 UTC
# Line 317  namespace LinuxSampler { Line 317  namespace LinuxSampler {
317              }*/              }*/
318    
319              /**              /**
320                 * Make sure the passed MIDI key is part of the list of active keys,
321                 * if it is not already, then add it to that list. Accordingly it is
322                 * safe to call this method even if the requested key is already
323                 * marked as active.
324                 */
325                void markKeyAsActive(MidiKey* pKey) {
326                    if (!pKey->Active) { // mark as active key
327                        pKey->Active = true;
328                        pKey->itSelf = pActiveKeys->allocAppend();
329                        const int iKey = pKey - &pMIDIKeyInfo[0];
330                        *pKey->itSelf = iKey;
331                    }
332                }
333    
334                /**
335               *  Removes the given voice from the MIDI key's list of active voices.               *  Removes the given voice from the MIDI key's list of active voices.
336               *  This method will be called when a voice went inactive, e.g. because               *  This method will be called when a voice went inactive, e.g. because
337               *  it finished to playback its sample, finished its release stage or               *  it finished to playback its sample, finished its release stage or
# Line 367  namespace LinuxSampler { Line 382  namespace LinuxSampler {
382              /**              /**
383               * Free all keys which have no active voices left               * Free all keys which have no active voices left
384               */               */
385              void FreeAllInactiveKyes() {              void FreeAllInactiveKeys() {
386                  RTList<uint>::Iterator iuiKey = pActiveKeys->first();                  RTList<uint>::Iterator iuiKey = pActiveKeys->first();
387                  RTList<uint>::Iterator end    = pActiveKeys->end();                  RTList<uint>::Iterator end    = pActiveKeys->end();
388                  while (iuiKey != end) { // iterate through all active keys                  while (iuiKey != end) { // iterate through all active keys
# Line 525  namespace LinuxSampler { Line 540  namespace LinuxSampler {
540                      RTList<Event>::Iterator itNewEvent = pKey->pEvents->allocAppend();                      RTList<Event>::Iterator itNewEvent = pKey->pEvents->allocAppend();
541                      if (itNewEvent) {                      if (itNewEvent) {
542                          *itNewEvent = *itReleaseEvent; // copy original event (to the key's event list)                          *itNewEvent = *itReleaseEvent; // copy original event (to the key's event list)
543                          itNewEvent->Type = Event::type_release; // transform event type                          itNewEvent->Type = Event::type_release_key; // transform event type
544                      }                      }
545                      else dmsg(1,("Event pool emtpy!\n"));                      else dmsg(1,("Event pool emtpy!\n"));
546                  }                  }
# Line 667  namespace LinuxSampler { Line 682  namespace LinuxSampler {
682                          RTList<Event>::Iterator itNewEvent = pKey->pEvents->allocAppend();                          RTList<Event>::Iterator itNewEvent = pKey->pEvents->allocAppend();
683                          if (itNewEvent) {                          if (itNewEvent) {
684                              *itNewEvent = *itEvent; // copy event to the key's own event list                              *itNewEvent = *itEvent; // copy event to the key's own event list
685                              itNewEvent->Type = Event::type_cancel_release; // transform event type                              itNewEvent->Type = Event::type_cancel_release_key; // transform event type
686                          }                          }
687                          else dmsg(1,("Event pool emtpy!\n"));                          else dmsg(1,("Event pool emtpy!\n"));
688                      }                      }
# Line 683  namespace LinuxSampler { Line 698  namespace LinuxSampler {
698                          RTList<Event>::Iterator itNewEvent = pKey->pEvents->allocAppend();                          RTList<Event>::Iterator itNewEvent = pKey->pEvents->allocAppend();
699                          if (itNewEvent) {                          if (itNewEvent) {
700                              *itNewEvent = *itEvent; // copy event to the key's own event list                              *itNewEvent = *itEvent; // copy event to the key's own event list
701                              itNewEvent->Type = Event::type_release; // transform event type                              itNewEvent->Type = Event::type_release_key; // transform event type
702                              itNewEvent->Param.Note.Key = *iuiKey;                              itNewEvent->Param.Note.Key = *iuiKey;
703                              itNewEvent->Param.Note.Velocity = 127;                              itNewEvent->Param.Note.Velocity = 127;
704                              if (!SostenutoActiveOnKey(*iuiKey)) {                              if (!SostenutoActiveOnKey(*iuiKey)) {
# Line 748  namespace LinuxSampler { Line 763  namespace LinuxSampler {
763                          RTList<Event>::Iterator itNewEvent = pKey->pEvents->allocAppend();                          RTList<Event>::Iterator itNewEvent = pKey->pEvents->allocAppend();
764                          if (itNewEvent) {                          if (itNewEvent) {
765                              *itNewEvent = *itEvent; // copy event to the key's own event list                              *itNewEvent = *itEvent; // copy event to the key's own event list
766                              itNewEvent->Type = Event::type_release; // transform event type                              itNewEvent->Type = Event::type_release_key; // transform event type
767                          }                          }
768                          else dmsg(1,("Event pool emtpy!\n"));                          else dmsg(1,("Event pool emtpy!\n"));
769                      }                      }

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

  ViewVC Help
Powered by ViewVC