[SCM] calf/master: + Monosynth, Organ: initial attempt at implementing controllers 120-123 + framework: removed audio_module_iface (which was useless and confusing anyway) + Flanger: added smoothing for amount knob

js at users.alioth.debian.org js at users.alioth.debian.org
Tue May 7 15:37:02 UTC 2013


The following commit has been merged in the master branch:
commit 127a0ca03f09b35f1e11147623448418b04007ec
Author: kfoltman <kfoltman at 78b06b96-2940-0410-b7fc-879d825d01d8>
Date:   Tue Jan 29 19:15:17 2008 +0000

    + Monosynth, Organ: initial attempt at implementing controllers 120-123
    + framework: removed audio_module_iface (which was useless and confusing anyway)
    + Flanger: added smoothing for amount knob
    
    
    
    git-svn-id: https://calf.svn.sourceforge.net/svnroot/calf/trunk@116 78b06b96-2940-0410-b7fc-879d825d01d8

diff --git a/src/calf/audio_fx.h b/src/calf/audio_fx.h
index a11e987..f950a08 100644
--- a/src/calf/audio_fx.h
+++ b/src/calf/audio_fx.h
@@ -24,6 +24,7 @@
 #include "primitives.h"
 #include "delay.h"
 #include "fixed_point.h"
+#include "inertia.h"
 
 namespace dsp {
 #if 0
@@ -50,6 +51,7 @@ class chorus_base: public audio_effect
 protected:
     int sample_rate, min_delay_samples, mod_depth_samples;
     float rate, wet, dry, min_delay, mod_depth, odsr;
+    gain_smoothing gs_wet, gs_dry;
     fixed_point<unsigned int, 20> phase, dphase;
     sine_table<int, 4096, 65536> sine;
 public:
@@ -65,12 +67,14 @@ public:
     }
     void set_wet(float wet) {
         this->wet = wet;
+        gs_wet.set_inertia(wet);
     }
     float get_dry() {
         return dry;
     }
     void set_dry(float dry) {
         this->dry = dry;
+        gs_dry.set_inertia(wet);
     }
     float get_min_delay() {
         return min_delay;
@@ -135,8 +139,8 @@ public:
             delay.put(in);
             T fd; // signal from delay's output
             delay.get_interp(fd, ifv, (v & 0xFFFF)*(1.0/65536.0));
-            T sdry = in * dry;
-            T swet = fd * wet;
+            T sdry = in * gs_dry.get();
+            T swet = fd * gs_wet.get();
             *buf_out++ = sdry + swet;
         }
     }
@@ -195,7 +199,7 @@ public:
                 ramp_pos = 0;
             }
             
-            int64_t dp;
+            int64_t dp = 0;
             for (int i=0; i<nsamples; i++) {
                 float in = *buf_in++;
                 T fd; // signal from delay's output
@@ -222,8 +226,8 @@ public:
                 T fd; // signal from delay's output
                 this->delay.get_interp(fd, delay_pos >> 16, (delay_pos & 0xFFFF)*(1.0/65536.0));
                 sanitize(fd);
-                T sdry = in * this->dry;
-                T swet = fd * this->wet;
+                T sdry = in * this->gs_dry.get();
+                T swet = fd * this->gs_wet.get();
                 *buf_out++ = sdry + swet;
                 this->delay.put(in+fb*fd);
 
diff --git a/src/calf/giface.h b/src/calf/giface.h
index 63f37f6..bf89dd3 100644
--- a/src/calf/giface.h
+++ b/src/calf/giface.h
@@ -128,25 +128,6 @@ struct midi_event {
     float param3;
 };
 
-/// this is not a real class, just an empty example
-class audio_module_iface
-{
-public:
-    enum { in_count = 2, out_count = 2, param_count = 0, rt_capable = true };
-    static parameter_properties *param_props;
-    float **ins;
-    float **outs;
-    float **params;
-    void set_sample_rate(uint32_t sr);
-    void handle_event(uint8_t *data, int len) {}
-    // all or most params changed
-    void params_changed() {}
-    uint32_t process_audio(uint32_t nsamples, uint32_t inputs_mask, uint32_t outputs_mask);
-    static int get_in_channels();
-    static int get_out_channels();
-    static const char *get_xml_iface() { return NULL; }
-};
-
 struct ladspa_info
 {
     uint32_t unique_id;
diff --git a/src/calf/modules_synths.h b/src/calf/modules_synths.h
index 2b1bd4a..e3df678 100644
--- a/src/calf/modules_synths.h
+++ b/src/calf/modules_synths.h
@@ -108,6 +108,7 @@ public:
         osc1.set_freq(freq * (2 - detune) * pitchbend, srate);
         osc2.set_freq(freq * (detune)  * pitchbend * xpose, srate);
     }
+    void control_change(int controller, int value);
     void params_changed() {
         float sf = 0.001f;
         envelope.set(*params[par_attack] * sf, *params[par_decay] * sf, min(0.999f, *params[par_sustain]), *params[par_release] * sf, srate / step_size);
diff --git a/src/monosynth.cpp b/src/monosynth.cpp
index b31b610..c10e8d3 100644
--- a/src/monosynth.cpp
+++ b/src/monosynth.cpp
@@ -633,3 +633,17 @@ void monosynth_audio_module::calculate_step()
             stopping = true;
     }
 }
+
+void monosynth_audio_module::control_change(int controller, int value)
+{
+    switch(controller)
+    {
+        case 120: // all sounds off
+        case 123: // all notes off
+            gate = false;
+            envelope.note_off();
+            stack.clear();
+            break;
+    }
+}
+
diff --git a/src/synth.cpp b/src/synth.cpp
index ce0157b..8e5b0ca 100644
--- a/src/synth.cpp
+++ b/src/synth.cpp
@@ -119,6 +119,25 @@ void basic_synth::control_change(int ctl, int val)
             keystack_hold.clear();
         }
     }
+    if (ctl == 123 || ctl == 120) { // all notes off, all sounds off
+        vector<int> notes;
+        notes.reserve(128);
+        if (ctl == 120) // for "all sounds off", automatically release hold pedal
+            control_change(64, 0);
+        for (int i = 0; i < keystack.count(); i++)
+            notes.push_back(keystack.nth(i));
+        for (int i = 0; i < notes.size(); i++)
+            note_off(notes[i], 0);
+    }
+    if (ctl == 121) { 
+        control_change(1, 0);
+        control_change(7, 100);
+        control_change(10, 64);
+        control_change(11, 127);
+        // release hold..hold2
+        for (int i = 64; i <= 69; i++)
+            control_change(i, 0);
+    }
 }
 
 void basic_synth::render_to(float *output[], int nsamples)

-- 
calf audio plugins packaging



More information about the pkg-multimedia-commits mailing list