[SCM] calf/master: + Wavetable: two oscs, support some parameters

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


The following commit has been merged in the master branch:
commit 3140fe65ba857c75c21d14c5e172e8a56138282e
Author: Krzysztof Foltman <wdev at foltman.com>
Date:   Sat Feb 28 21:37:06 2009 +0000

    + Wavetable: two oscs, support some parameters

diff --git a/src/calf/metadata.h b/src/calf/metadata.h
index 39fb67c..93ef2b7 100644
--- a/src/calf/metadata.h
+++ b/src/calf/metadata.h
@@ -216,6 +216,7 @@ struct wavetable_metadata: public plugin_metadata<wavetable_metadata>
 {
     enum { 
         par_o1wave, par_o1offset, par_o1transpose, par_o1detune, par_o1level,
+        par_o2wave, par_o2offset, par_o2transpose, par_o2detune, par_o2level,
         param_count };
     enum { in_count = 0, out_count = 2, support_midi = true, require_midi = true, rt_capable = true };
     enum { step_size = 64 };
diff --git a/src/calf/wavetable.h b/src/calf/wavetable.h
index 47f4eef..b553187 100644
--- a/src/calf/wavetable.h
+++ b/src/calf/wavetable.h
@@ -40,7 +40,7 @@ struct wavetable_oscillator: public dsp::simple_oscillator
 class wavetable_voice: public dsp::voice
 {
 public:
-    enum { Channels = 2, BlockSize = 64, EnvCount = 3, OscCount = 1 };
+    enum { Channels = 2, BlockSize = 64, EnvCount = 3, OscCount = 2 };
     float output_buffer[BlockSize][Channels];
 protected:
     int note;
@@ -62,7 +62,7 @@ public:
     }
     virtual bool get_active() {
         // printf("note %d getactive %d use_percussion %d pamp active %d\n", note, amp.get_active(), use_percussion(), pamp.get_active());
-        return (note != -1) && (amp.get_active());
+        return (note != -1) && (amp.get_active()) && !envs[0].stopped();
     }
 };    
 
@@ -82,7 +82,7 @@ public:
     float *ins[in_count]; 
     float *outs[out_count];
     float *params[param_count];
-    int16_t tables[256][256];
+    int16_t tables[128][256];
 
 public:
     wavetable_audio_module();
diff --git a/src/modules.cpp b/src/modules.cpp
index 3dde553..49ad571 100644
--- a/src/modules.cpp
+++ b/src/modules.cpp
@@ -517,7 +517,13 @@ CALF_PORT_PROPS(wavetable) = {
     { 0.5,     0,      1,  0, PF_FLOAT | PF_SCALE_PERC | PF_CTL_KNOB | PF_UNIT_COEF, NULL, "o1offset", "Osc1 Ctl"},
     { 0,        -48,   48, 48*2+1, PF_INT   | PF_SCALE_LINEAR | PF_CTL_KNOB | PF_UNIT_SEMITONES, NULL, "o1trans", "Osc1 Transpose" },
     { 0,       -100,  100,      0, PF_INT   | PF_SCALE_LINEAR | PF_CTL_KNOB | PF_UNIT_CENTS, NULL, "o1detune", "Osc1 Detune" },
-    { 1,          0,   1,     0, PF_FLOAT | PF_SCALE_GAIN | PF_CTL_KNOB | PF_UNIT_COEF | PF_PROP_NOBOUNDS, NULL, "o1level", "Osc1 Level" },
+    { 0.2,        0,   1,     0, PF_FLOAT | PF_SCALE_GAIN | PF_CTL_KNOB | PF_UNIT_COEF | PF_PROP_NOBOUNDS, NULL, "o1level", "Osc1 Level" },
+
+    { 0,       0,  organ_enums::wave_count - 1, 0, PF_ENUM | PF_SCALE_LINEAR | PF_CTL_COMBO, organ_wave_names, "o2wave", "Osc2 Wave" },
+    { 0.5,     0,      1,  0, PF_FLOAT | PF_SCALE_PERC | PF_CTL_KNOB | PF_UNIT_COEF, NULL, "o2offset", "Osc2 Ctl"},
+    { 0,        -48,   48, 48*2+1, PF_INT   | PF_SCALE_LINEAR | PF_CTL_KNOB | PF_UNIT_SEMITONES, NULL, "o2trans", "Osc2 Transpose" },
+    { 0,       -100,  100,      0, PF_INT   | PF_SCALE_LINEAR | PF_CTL_KNOB | PF_UNIT_CENTS, NULL, "o2detune", "Osc2 Detune" },
+    { 0.2,        0,   1,     0, PF_FLOAT | PF_SCALE_GAIN | PF_CTL_KNOB | PF_UNIT_COEF | PF_PROP_NOBOUNDS, NULL, "o2level", "Osc2 Level" },
 };
 
 ////////////////////////////////////////////////////////////////////////////
diff --git a/src/wavetable.cpp b/src/wavetable.cpp
index 1dbc7a5..6ad4a75 100644
--- a/src/wavetable.cpp
+++ b/src/wavetable.cpp
@@ -80,16 +80,22 @@ void wavetable_voice::steal()
 
 void wavetable_voice::render_block()
 {
+    int spc = wavetable_metadata::par_o2level - wavetable_metadata::par_o1level;
+    for (int j = 0; j < OscCount; j++)
+        oscs[j].set_freq(note_to_hz(note, *params[wavetable_metadata::par_o1transpose + j * spc] * 100+ *params[wavetable_metadata::par_o1detune + j * spc]), sample_rate);
     
-    for (int i = 0; i < BlockSize; i++) {
-        int slice = dsp::clip(fastf2i_drm(envs[0].value * 127.0), 0, 127);
+    for (int i = 0; i < BlockSize; i++) {        
+        float value = 0.f;
         
-        float value = oscs[0].get(slice);
+        for (int j = 0; j < OscCount; j++)
+            value += oscs[j].get(dsp::clip(fastf2i_drm((envs[0].value + *params[wavetable_metadata::par_o1offset + j * spc]) * 127.0), 0, 127)) * *params[wavetable_metadata::par_o1level + j * spc];
         
-        output_buffer[i][0] = output_buffer[i][1] = value * envs[0].value * envs[0].value * 0.25;
+        output_buffer[i][0] = output_buffer[i][1] = value * envs[0].value * envs[0].value * value;
     }
     for (int i = 0; i < EnvCount; i++)
         envs[i].advance();    
+    if (envs[0].stopped())
+        released = true;
 }
 
 /////////////////////////////////////////////////////////////////////////////////////////////////////
@@ -97,7 +103,7 @@ void wavetable_voice::render_block()
 wavetable_audio_module::wavetable_audio_module()
 {
     panic_flag = false;
-    for (int i = 0; i < 256; i++)
+    for (int i = 0; i < 128; i++)
     {
         for (int j = 0; j < 256; j++)
         {

-- 
calf audio plugins packaging



More information about the pkg-multimedia-commits mailing list