/[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 2115 by persson, Thu Aug 12 15:36:15 2010 UTC revision 2121 by schoenebeck, Tue Sep 14 17:09:08 2010 UTC
# Line 103  namespace LinuxSampler { Line 103  namespace LinuxSampler {
103          Delay           = itNoteOnEvent->FragmentPos();          Delay           = itNoteOnEvent->FragmentPos();
104          itTriggerEvent  = itNoteOnEvent;          itTriggerEvent  = itNoteOnEvent;
105          itKillEvent     = Pool<Event>::Iterator();          itKillEvent     = Pool<Event>::Iterator();
106            MidiKeyBase* pKeyInfo = GetMidiKeyInfo(MIDIKey);
107    
108          pGroupEvents = iKeyGroup ? pEngineChannel->ActiveKeyGroups[iKeyGroup] : 0;          pGroupEvents = iKeyGroup ? pEngineChannel->ActiveKeyGroups[iKeyGroup] : 0;
109    
# Line 112  namespace LinuxSampler { Line 113  namespace LinuxSampler {
113    
114          // calculate volume          // calculate volume
115          const double velocityAttenuation = GetVelocityAttenuation(itNoteOnEvent->Param.Note.Velocity);          const double velocityAttenuation = GetVelocityAttenuation(itNoteOnEvent->Param.Note.Velocity);
116          float volume = CalculateVolume(velocityAttenuation);          float volume = CalculateVolume(velocityAttenuation) * pKeyInfo->Volume;
117          if (volume <= 0) return -1;          if (volume <= 0) return -1;
118    
119          // select channel mode (mono or stereo)          // select channel mode (mono or stereo)
# Line 123  namespace LinuxSampler { Line 124  namespace LinuxSampler {
124          // get starting crossfade volume level          // get starting crossfade volume level
125          float crossfadeVolume = CalculateCrossfadeVolume(itNoteOnEvent->Param.Note.Velocity);          float crossfadeVolume = CalculateCrossfadeVolume(itNoteOnEvent->Param.Note.Velocity);
126    
127          VolumeLeft  = volume * AbstractEngine::PanCurve[64 - RgnInfo.Pan];          VolumeLeft  = volume * pKeyInfo->PanLeft  * AbstractEngine::PanCurve[64 - RgnInfo.Pan];
128          VolumeRight = volume * AbstractEngine::PanCurve[64 + RgnInfo.Pan];          VolumeRight = volume * pKeyInfo->PanRight * AbstractEngine::PanCurve[64 + RgnInfo.Pan];
129    
130          float subfragmentRate = GetEngine()->SampleRate / CONFIG_DEFAULT_SUBFRAGMENT_SIZE;          float subfragmentRate = GetEngine()->SampleRate / CONFIG_DEFAULT_SUBFRAGMENT_SIZE;
131          CrossfadeSmoother.trigger(crossfadeVolume, subfragmentRate);          CrossfadeSmoother.trigger(crossfadeVolume, subfragmentRate);
# Line 306  namespace LinuxSampler { Line 307  namespace LinuxSampler {
307       */       */
308      void AbstractVoice::Synthesize(uint Samples, sample_t* pSrc, uint Skip) {      void AbstractVoice::Synthesize(uint Samples, sample_t* pSrc, uint Skip) {
309          AbstractEngineChannel* pChannel = pEngineChannel;          AbstractEngineChannel* pChannel = pEngineChannel;
310          finalSynthesisParameters.pOutLeft  = &pChannel->pChannelLeft->Buffer()[Skip];          MidiKeyBase* pMidiKeyInfo = GetMidiKeyInfo(MIDIKey);
311          finalSynthesisParameters.pOutRight = &pChannel->pChannelRight->Buffer()[Skip];  
312          finalSynthesisParameters.pSrc      = pSrc;          const bool bVoiceRequiresDedicatedRouting =
313                pEngineChannel->GetFxSendCount() > 0 &&
314                (pMidiKeyInfo->ReverbSend || pMidiKeyInfo->ChorusSend);
315    
316            if (bVoiceRequiresDedicatedRouting) {
317                finalSynthesisParameters.pOutLeft  = &GetEngine()->pDedicatedVoiceChannelLeft->Buffer()[Skip];
318                finalSynthesisParameters.pOutRight = &GetEngine()->pDedicatedVoiceChannelRight->Buffer()[Skip];
319            } else {
320                finalSynthesisParameters.pOutLeft  = &pChannel->pChannelLeft->Buffer()[Skip];
321                finalSynthesisParameters.pOutRight = &pChannel->pChannelRight->Buffer()[Skip];
322            }
323            finalSynthesisParameters.pSrc = pSrc;
324    
325          RTList<Event>::Iterator itCCEvent = pChannel->pEvents->first();          RTList<Event>::Iterator itCCEvent = pChannel->pEvents->first();
326          RTList<Event>::Iterator itNoteEvent;          RTList<Event>::Iterator itNoteEvent;
# Line 471  namespace LinuxSampler { Line 483  namespace LinuxSampler {
483              Pos = newPos;              Pos = newPos;
484              i = iSubFragmentEnd;              i = iSubFragmentEnd;
485          }          }
486    
487            if (bVoiceRequiresDedicatedRouting) {
488                optional<float> effectSendLevels[2] = {
489                    pMidiKeyInfo->ReverbSend,
490                    pMidiKeyInfo->ChorusSend
491                };
492                GetEngine()->RouteDedicatedVoiceChannels(pEngineChannel, effectSendLevels, Samples);
493            }
494      }      }
495    
496      /**      /**

Legend:
Removed from v.2115  
changed lines
  Added in v.2121

  ViewVC Help
Powered by ViewVC