/[svn]/linuxsampler/trunk/src/engines/gig/Voice.cpp
ViewVC logotype

Diff of /linuxsampler/trunk/src/engines/gig/Voice.cpp

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

revision 1700 by persson, Sun Feb 17 12:40:59 2008 UTC revision 1857 by schoenebeck, Sat Mar 7 19:23:10 2009 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 - 2007 Christian Schoenebeck                       *   *   Copyright (C) 2005 - 2009 Christian Schoenebeck                       *
7   *                                                                         *   *                                                                         *
8   *   This program is free software; you can redistribute it and/or modify  *   *   This program is free software; you can redistribute it and/or modify  *
9   *   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 781  namespace LinuxSampler { namespace gig { Line 781  namespace LinuxSampler { namespace gig {
781          RTList<Event>::Iterator itCCEvent = pEngineChannel->pEvents->first();          RTList<Event>::Iterator itCCEvent = pEngineChannel->pEvents->first();
782          RTList<Event>::Iterator itNoteEvent = pEngineChannel->pMIDIKeyInfo[MIDIKey].pEvents->first();          RTList<Event>::Iterator itNoteEvent = pEngineChannel->pMIDIKeyInfo[MIDIKey].pEvents->first();
783    
784          if (Skip) { // skip events that happened before this voice was triggered          if (itTriggerEvent) { // skip events that happened before this voice was triggered
785              while (itCCEvent && itCCEvent->FragmentPos() <= Skip) ++itCCEvent;              while (itCCEvent && itCCEvent->FragmentPos() <= Skip) ++itCCEvent;
786              while (itNoteEvent && itNoteEvent->FragmentPos() <= Skip) ++itNoteEvent;              // we can't simply compare the timestamp here, because note events
787                // might happen on the same time stamp, so we have to deal on the
788                // actual sequence the note events arrived instead (see bug #112)
789                for (; itNoteEvent; ++itNoteEvent) {
790                    if (itTriggerEvent == itNoteEvent) {
791                        ++itNoteEvent;
792                        break;
793                    }
794                }
795          }          }
796    
797          uint killPos;          uint killPos;
798          if (itKillEvent) killPos = RTMath::Min(itKillEvent->FragmentPos(), pEngine->MaxFadeOutPos);          if (itKillEvent) {
799                int maxFadeOutPos = Samples - pEngine->MinFadeOutSamples;
800                if (maxFadeOutPos < 0) {
801                    // There's not enough space in buffer to do a fade out
802                    // from max volume (this can only happen for audio
803                    // drivers that use Samples < MaxSamplesPerCycle).
804                    // End the EG1 here, at pos 0, with a shorter max fade
805                    // out time.
806                    EG1.enterFadeOutStage(Samples / CONFIG_DEFAULT_SUBFRAGMENT_SIZE);
807                    itKillEvent = Pool<Event>::Iterator();
808                } else {
809                    killPos = RTMath::Min(itKillEvent->FragmentPos(), maxFadeOutPos);
810                }
811            }
812    
813          uint i = Skip;          uint i = Skip;
814          while (i < Samples) {          while (i < Samples) {

Legend:
Removed from v.1700  
changed lines
  Added in v.1857

  ViewVC Help
Powered by ViewVC