/[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 3118 by schoenebeck, Fri Apr 21 13:33:03 2017 UTC revision 3188 by schoenebeck, Fri May 19 14:23:12 2017 UTC
# Line 147  namespace LinuxSampler { Line 147  namespace LinuxSampler {
147          // this rate is used for rather mellow volume fades          // this rate is used for rather mellow volume fades
148          const float subfragmentRate = GetEngine()->SampleRate / CONFIG_DEFAULT_SUBFRAGMENT_SIZE;          const float subfragmentRate = GetEngine()->SampleRate / CONFIG_DEFAULT_SUBFRAGMENT_SIZE;
149          // this rate is used for very fast volume fades          // this rate is used for very fast volume fades
150          const float quickRampRate = RTMath::Min(subfragmentRate, GetEngine()->SampleRate * 0.001f /* 1ms */);          const float quickRampRate = RTMath::Min(subfragmentRate, GetEngine()->SampleRate * 0.001f /* approx. 13ms */);
151          CrossfadeSmoother.trigger(crossfadeVolume, subfragmentRate);          CrossfadeSmoother.trigger(crossfadeVolume, subfragmentRate);
152    
153          VolumeSmoother.trigger(pEngineChannel->MidiVolume, subfragmentRate);          VolumeSmoother.trigger(pEngineChannel->MidiVolume, subfragmentRate);
154          NoteVolumeSmoother.trigger(pNote ? pNote->Override.Volume : 1.f, quickRampRate);          NoteVolume.setCurrentValue(pNote ? pNote->Override.Volume : 1.f);
155            NoteVolume.setDefaultDuration(pNote ? pNote->Override.VolumeTime : DEFAULT_NOTE_VOLUME_TIME_S);
156    
157          // Check if the sample needs disk streaming or is too short for that          // Check if the sample needs disk streaming or is too short for that
158          long cachedsamples = GetSampleCacheSize() / SmplInfo.FrameSize;          long cachedsamples = GetSampleCacheSize() / SmplInfo.FrameSize;
# Line 191  namespace LinuxSampler { Line 192  namespace LinuxSampler {
192          }          }
193    
194          Pitch = CalculatePitchInfo(PitchBend);          Pitch = CalculatePitchInfo(PitchBend);
195          NotePitch = (pNote) ? pNote->Override.Pitch : 1.0f;          NotePitch.setCurrentValue(pNote ? pNote->Override.Pitch : 1.0f);
196            NotePitch.setDefaultDuration(pNote ? pNote->Override.PitchTime : DEFAULT_NOTE_PITCH_TIME_S);
197          NoteCutoff = (pNote) ? pNote->Override.Cutoff : 1.0f;          NoteCutoff = (pNote) ? pNote->Override.Cutoff : 1.0f;
198          NoteResonance = (pNote) ? pNote->Override.Resonance : 1.0f;          NoteResonance = (pNote) ? pNote->Override.Resonance : 1.0f;
199    
# Line 456  namespace LinuxSampler { Line 458  namespace LinuxSampler {
458              PanLeftSmoother.update(AbstractEngine::PanCurve[128 - pan] * NotePanLeft);              PanLeftSmoother.update(AbstractEngine::PanCurve[128 - pan] * NotePanLeft);
459              PanRightSmoother.update(AbstractEngine::PanCurve[pan]      * NotePanRight);              PanRightSmoother.update(AbstractEngine::PanCurve[pan]      * NotePanRight);
460    
461              finalSynthesisParameters.fFinalPitch = Pitch.PitchBase * Pitch.PitchBend * NotePitch;              finalSynthesisParameters.fFinalPitch = Pitch.PitchBase * Pitch.PitchBend * NotePitch.render();
462    
463              float fFinalVolume = VolumeSmoother.render() * CrossfadeSmoother.render() * NoteVolumeSmoother.render();              float fFinalVolume = VolumeSmoother.render() * CrossfadeSmoother.render() * NoteVolume.render();
464  #ifdef CONFIG_PROCESS_MUTED_CHANNELS  #ifdef CONFIG_PROCESS_MUTED_CHANNELS
465              if (pChannel->GetMute()) fFinalVolume = 0;              if (pChannel->GetMute()) fFinalVolume = 0;
466  #endif  #endif
# Line 729  namespace LinuxSampler { Line 731  namespace LinuxSampler {
731              {              {
732                  EnterReleaseStage();                  EnterReleaseStage();
733              }              }
734                // process kill-note events (caused by built-in instrument script function fade_out())
735                if (itEvent->Type == Event::type_kill_note && pNote &&
736                    pEngineChannel->pEngine->NoteByID( itEvent->Param.Note.ID ) == pNote)
737                {
738                    Kill(itEvent);
739                }
740              // process synthesis parameter events (caused by built-in realt-time instrument script functions)              // process synthesis parameter events (caused by built-in realt-time instrument script functions)
741              if (itEvent->Type == Event::type_note_synth_param && pNote &&              if (itEvent->Type == Event::type_note_synth_param && pNote &&
742                  pEngineChannel->pEngine->NoteByID( itEvent->Param.NoteSynthParam.NoteID ) == pNote)                  pEngineChannel->pEngine->NoteByID( itEvent->Param.NoteSynthParam.NoteID ) == pNote)
743              {              {
744                  switch (itEvent->Param.NoteSynthParam.Type) {                  switch (itEvent->Param.NoteSynthParam.Type) {
745                      case Event::synth_param_volume:                      case Event::synth_param_volume:
746                          NoteVolumeSmoother.update(itEvent->Param.NoteSynthParam.AbsValue);                          NoteVolume.fadeTo(itEvent->Param.NoteSynthParam.AbsValue, GetEngine()->SampleRate / CONFIG_DEFAULT_SUBFRAGMENT_SIZE);
747                            break;
748                        case Event::synth_param_volume_time:
749                            NoteVolume.setDefaultDuration(itEvent->Param.NoteSynthParam.AbsValue);
750                          break;                          break;
751                      case Event::synth_param_pitch:                      case Event::synth_param_pitch:
752                          NotePitch = itEvent->Param.NoteSynthParam.AbsValue;                          NotePitch.fadeTo(itEvent->Param.NoteSynthParam.AbsValue, GetEngine()->SampleRate / CONFIG_DEFAULT_SUBFRAGMENT_SIZE);
753                            break;
754                        case Event::synth_param_pitch_time:
755                            NotePitch.setDefaultDuration(itEvent->Param.NoteSynthParam.AbsValue);
756                          break;                          break;
757                      case Event::synth_param_pan:                      case Event::synth_param_pan:
758                          NotePanLeft  = AbstractEngine::PanCurveValueNorm(itEvent->Param.NoteSynthParam.AbsValue, 0 /*left*/);                          NotePanLeft  = AbstractEngine::PanCurveValueNorm(itEvent->Param.NoteSynthParam.AbsValue, 0 /*left*/);

Legend:
Removed from v.3118  
changed lines
  Added in v.3188

  ViewVC Help
Powered by ViewVC