[SCM] calf/master: + Organ: simplistic summed waveform preview (output selection, panning and detune are ignored), DSaw/DPls/DSqr waveforms are phase-shifted in a more interesting way

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


The following commit has been merged in the master branch:
commit b9368ef6faf27118a94c9c1fd189a3e4a24418f3
Author: kfoltman <kfoltman at 78b06b96-2940-0410-b7fc-879d825d01d8>
Date:   Sat May 10 22:58:49 2008 +0000

    + Organ: simplistic summed waveform preview (output selection, panning and detune are ignored), DSaw/DPls/DSqr waveforms are phase-shifted in a more interesting way
    
    
    git-svn-id: https://calf.svn.sourceforge.net/svnroot/calf/trunk@175 78b06b96-2940-0410-b7fc-879d825d01d8

diff --git a/src/calf/modules_synths.h b/src/calf/modules_synths.h
index 912e445..bad61c8 100644
--- a/src/calf/modules_synths.h
+++ b/src/calf/modules_synths.h
@@ -238,6 +238,7 @@ public:
         return 3;
     }
     void execute(int cmd_no);
+    bool get_graph(int index, int subindex, float *data, int points, cairo_t *context);
     static const char *get_name() { return "organ"; }    
     static const char *get_id() { return "organ"; }    
     static const char *get_label() { return "Organ"; }    
diff --git a/src/calf/organ.h b/src/calf/organ.h
index 327072a..f9413c3 100644
--- a/src/calf/organ.h
+++ b/src/calf/organ.h
@@ -123,6 +123,9 @@ protected:
     }
 public:
     organ_parameters *parameters;
+    static inline waveform_family<ORGAN_WAVE_BITS> &get_wave(int wave) {
+        return waves[wave];
+    }
 };
 
 class organ_vibrato
diff --git a/src/organ.cpp b/src/organ.cpp
index 2c394a1..82f32c4 100644
--- a/src/organ.cpp
+++ b/src/organ.cpp
@@ -53,6 +53,7 @@ const char *organ_audio_module::get_gui_xml()
     return 
     "<vbox border=\"10\">"
         "<hbox>"
+            "<line-graph param=\"master\" refresh=\"1\"/>"
             "<vbox>"
                 "<label param=\"foldnote\"/>"
                 "<align><knob param=\"foldnote\"/></align>"
@@ -294,6 +295,33 @@ const char *organ_audio_module::get_gui_xml()
     ;
 }
 
+bool organ_audio_module::get_graph(int index, int subindex, float *data, int points, cairo_t *context)
+{
+    if (index == par_master) {
+        if (subindex)
+            return false;
+        enum { S = 1 << ORGAN_WAVE_BITS };
+        float *waveforms[9];
+        for (int i = 0; i < 9; i++)
+        {
+            int wave = dsp::clip((int)(parameters->waveforms[i]), 0, (int)organ_voice_base::wave_count - 1);
+            waveforms[i] = organ_voice_base::get_wave(wave).original;
+        }
+        for (int i = 0; i < points; i++)
+        {
+            float sum = 0.f;
+            for (int j = 0; j < 9; j++)
+            {
+                float shift = parameters->phase[j] * S / 360.0;
+                sum += parameters->drawbars[j] * waveforms[j][int(parameters->harmonics[j] * i * S / points + shift) & (S - 1)];
+            }
+            data[i] = sum * 2 / (9 * 8);
+        }
+        return true;
+    }
+    return false;
+}
+
 const char *organ_audio_module::port_names[] = {"Out L", "Out R"};
 
 const char *organ_percussion_timbre_names[] = { 
@@ -467,7 +495,7 @@ static void phaseshift(bandlimiter<ORGAN_WAVE_BITS> &bl, float tmp[ORGAN_WAVE_SI
     bl.compute_spectrum(tmp);
     for (int i = 1; i <= ORGAN_WAVE_SIZE / 2; i++) {
         float frac = i * 2.0 / ORGAN_WAVE_SIZE;
-        float phase = 2 * M_PI * frac * frac;
+        float phase = M_PI / sqrt(frac) ;
         complex<float> shift = complex<float>(cos(phase), sin(phase));
         bl.spectrum[i] *= shift;
         bl.spectrum[ORGAN_WAVE_SIZE - i] *= conj(shift);

-- 
calf audio plugins packaging



More information about the pkg-multimedia-commits mailing list