[SCM] calf/master: + Monosynth: Osc Mix modulation destination, use smoothing for xfade value, destination unit changes

js at users.alioth.debian.org js at users.alioth.debian.org
Tue May 7 15:39:32 UTC 2013


The following commit has been merged in the master branch:
commit f1fd7803069b3eca42710b3759141a2f42e6af72
Author: Krzysztof Foltman <wdev at foltman.com>
Date:   Sun Apr 26 00:16:56 2009 +0100

    + Monosynth: Osc Mix modulation destination, use smoothing for xfade value, destination unit changes

diff --git a/src/calf/metadata.h b/src/calf/metadata.h
index 5b2b22b..8f4a60a 100644
--- a/src/calf/metadata.h
+++ b/src/calf/metadata.h
@@ -115,6 +115,7 @@ struct monosynth_metadata: public plugin_metadata<monosynth_metadata>
     enum {
         moddest_none,
         moddest_attenuation,
+        moddest_oscmix,
         moddest_cutoff,
         moddest_resonance,
         moddest_o1detune,
diff --git a/src/calf/modules_synths.h b/src/calf/modules_synths.h
index bb054e4..0918614 100644
--- a/src/calf/modules_synths.h
+++ b/src/calf/modules_synths.h
@@ -94,6 +94,8 @@ public:
     modulation_entry mod_matrix[mod_matrix_slots];
     /// Currently used velocity
     float velocity;
+    /// Last value of oscillator mix ratio
+    float last_xfade;
     /// Current calculated mod matrix outputs
     float moddest[moddest_count];
      
diff --git a/src/monosynth.cpp b/src/monosynth.cpp
index e4c858e..693ff47 100644
--- a/src/monosynth.cpp
+++ b/src/monosynth.cpp
@@ -242,8 +242,8 @@ void monosynth_audio_module::calculate_buffer_oscs(float lfo)
     int flag2 = (wave2 == wave_sqr);
     int32_t shift1 = last_pwshift1;
     int32_t shift2 = last_pwshift2;
-    int32_t shift_target1 = (int32_t)(0x78000000 * dsp::clip11(*params[par_pw1] + lfo * *params[par_lfopw] + moddest[moddest_o1pw]));
-    int32_t shift_target2 = (int32_t)(0x78000000 * dsp::clip11(*params[par_pw2] + lfo * *params[par_lfopw] + moddest[moddest_o2pw]));
+    int32_t shift_target1 = (int32_t)(0x78000000 * dsp::clip11(*params[par_pw1] + lfo * *params[par_lfopw] + 0.01f * moddest[moddest_o1pw]));
+    int32_t shift_target2 = (int32_t)(0x78000000 * dsp::clip11(*params[par_pw2] + lfo * *params[par_lfopw] + 0.01f * moddest[moddest_o2pw]));
     int32_t shift_delta1 = ((shift_target1 >> 1) - (last_pwshift1 >> 1)) >> (step_shift - 1);
     int32_t shift_delta2 = ((shift_target2 >> 1) - (last_pwshift2 >> 1)) >> (step_shift - 1);
     last_lfov = lfo;
@@ -254,15 +254,21 @@ void monosynth_audio_module::calculate_buffer_oscs(float lfo)
     shift2 += (flag2 << 31);
     float mix1 = 1 - 2 * flag1, mix2 = 1 - 2 * flag2;
     
+    float new_xfade = dsp::clip<float>(xfade + 0.01f * moddest[moddest_oscmix], 0.f, 1.f);
+    float cur_xfade = last_xfade;
+    float xfade_step = (new_xfade - cur_xfade) * (1.0 / step_size);
+    
     for (uint32_t i = 0; i < step_size; i++) 
     {
         float osc1val = osc1.get_phaseshifted(shift1, mix1);
         float osc2val = osc2.get_phaseshifted(shift2, mix2);
-        float wave = osc1val + (osc2val - osc1val) * xfade;
+        float wave = osc1val + (osc2val - osc1val) * cur_xfade;
         buffer[i] = wave;
         shift1 += shift_delta1;
         shift2 += shift_delta2;
+        cur_xfade += xfade_step;
     }
+    last_xfade = new_xfade;
 }
 
 void monosynth_audio_module::calculate_buffer_ser()
@@ -333,6 +339,7 @@ void monosynth_audio_module::delayed_note_on()
     {
         if (legato >= 2)
             porta_time = -1.f;
+        last_xfade = xfade;
         osc1.reset();
         osc2.reset();
         filter.reset();
@@ -663,12 +670,13 @@ static const char *monosynth_mod_src_names[] = {
 static const char *monosynth_mod_dest_names[] = {
     "None",
     "Attenuation",
-    "Cutoff",
+    "Osc Mix Ratio (%)",
+    "Cutoff [ct]",
     "Resonance",
-    "O1: Detune",
-    "O2: Detune",
-    "O1: PW",
-    "O2: PW",
+    "O1: Detune [ct]",
+    "O2: Detune [ct]",
+    "O1: PW (%)",
+    "O2: PW (%)",
     NULL
 };
 

-- 
calf audio plugins packaging



More information about the pkg-multimedia-commits mailing list