/[svn]/linuxsampler/trunk/src/engines/common/AbstractVoice.cpp
ViewVC logotype

Diff of /linuxsampler/trunk/src/engines/common/AbstractVoice.cpp

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

revision 2296 by iliev, Thu Dec 8 20:03:47 2011 UTC revision 2297 by iliev, Fri Dec 9 15:04:55 2011 UTC
# Line 312  namespace LinuxSampler { Line 312  namespace LinuxSampler {
312       *  @param Skip    - number of sample points to skip in output buffer       *  @param Skip    - number of sample points to skip in output buffer
313       */       */
314      void AbstractVoice::Synthesize(uint Samples, sample_t* pSrc, uint Skip) {      void AbstractVoice::Synthesize(uint Samples, sample_t* pSrc, uint Skip) {
315            bool delay = false; // Whether the voice playback should be delayed for this call
316            
317            if (pSignalUnitRack != NULL) {
318                uint delaySteps = pSignalUnitRack->GetEndpointUnit()->DelayTrigger();
319                if (delaySteps > 0) { // delay on the endpoint unit means delay of the voice playback
320                    if (delaySteps >= Samples) {
321                        pSignalUnitRack->GetEndpointUnit()->DecreaseDelay(Samples);
322                        delay = true;
323                    } else {
324                        pSignalUnitRack->GetEndpointUnit()->DecreaseDelay(delaySteps);
325                        Samples -= delaySteps;
326                        Skip += delaySteps;
327                    }
328                }
329            }
330            
331          AbstractEngineChannel* pChannel = pEngineChannel;          AbstractEngineChannel* pChannel = pEngineChannel;
332          MidiKeyBase* pMidiKeyInfo = GetMidiKeyInfo(MIDIKey);          MidiKeyBase* pMidiKeyInfo = GetMidiKeyInfo(MIDIKey);
333    
# Line 404  namespace LinuxSampler { Line 420  namespace LinuxSampler {
420              // process transition events (note on, note off & sustain pedal)              // process transition events (note on, note off & sustain pedal)
421              processTransitionEvents(itNoteEvent, iSubFragmentEnd);              processTransitionEvents(itNoteEvent, iSubFragmentEnd);
422              processGroupEvents(itGroupEvent, iSubFragmentEnd);              processGroupEvents(itGroupEvent, iSubFragmentEnd);
423                
424              if (pSignalUnitRack == NULL) {              if (pSignalUnitRack == NULL) {
425                  // if the voice was killed in this subfragment, or if the                  // if the voice was killed in this subfragment, or if the
426                  // filter EG is finished, switch EG1 to fade out stage                  // filter EG is finished, switch EG1 to fade out stage
# Line 502  namespace LinuxSampler { Line 518  namespace LinuxSampler {
518                  fFinalVolume * VolumeRight * PanRightSmoother.render();                  fFinalVolume * VolumeRight * PanRightSmoother.render();
519  #endif  #endif
520              // render audio for one subfragment              // render audio for one subfragment
521              RunSynthesisFunction(SynthesisMode, &finalSynthesisParameters, &loop);              if (!delay) RunSynthesisFunction(SynthesisMode, &finalSynthesisParameters, &loop);
522    
523              if (pSignalUnitRack == NULL) {              if (pSignalUnitRack == NULL) {
524                  // stop the rendering if volume EG is finished                  // stop the rendering if volume EG is finished
# Line 539  namespace LinuxSampler { Line 555  namespace LinuxSampler {
555                      }*/                      }*/
556                  // TODO: ^^^                  // TODO: ^^^
557                                    
558                  pSignalUnitRack->Increment();                  if (!delay) pSignalUnitRack->Increment();
559              }              }
560    
561              Pos = newPos;              Pos = newPos;
562              i = iSubFragmentEnd;              i = iSubFragmentEnd;
563          }          }
564            
565            if (delay) return;
566    
567          if (bVoiceRequiresDedicatedRouting) {          if (bVoiceRequiresDedicatedRouting) {
568              if (bEq) {              if (bEq) {

Legend:
Removed from v.2296  
changed lines
  Added in v.2297

  ViewVC Help
Powered by ViewVC