[SCM] calf/master: + Monosynth: increase PWM range, add PWM eye candy

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


The following commit has been merged in the master branch:
commit 614fe15bd0556b7fa9ba11d54caa97c62f95582f
Author: Krzysztof Foltman <wdev at foltman.com>
Date:   Thu Mar 5 22:12:28 2009 +0000

    + Monosynth: increase PWM range, add PWM eye candy

diff --git a/gui/gui-monosynth.xml b/gui/gui-monosynth.xml
index 4ed0d89..1296a25 100644
--- a/gui/gui-monosynth.xml
+++ b/gui/gui-monosynth.xml
@@ -11,14 +11,14 @@
         </table>
         <hbox>
           <if cond="directlink">
-            <line-graph param="o1_wave"/>
+            <line-graph param="o1_wave" refresh="1"/>
           </if>
           <vbox>
             <label param="o12_mix"/>
             <hscale param="o12_mix" position="bottom"/>
           </vbox>
           <if cond="directlink">
-            <line-graph param="o2_wave"/>
+            <line-graph param="o2_wave" refresh="1"/>
           </if>
         </hbox>
         <hbox>
diff --git a/src/calf/modules_synths.h b/src/calf/modules_synths.h
index 6e054c7..0bfecb5 100644
--- a/src/calf/modules_synths.h
+++ b/src/calf/modules_synths.h
@@ -122,8 +122,6 @@ public:
     void calculate_buffer_stereo();
     /// Retrieve filter graph (which is 'live' so it cannot be generated by get_static_graph), or fall back to get_static_graph.
     bool get_graph(int index, int subindex, float *data, int points, cairo_iface *context);
-    /// Retrieve waveform graph (which does not need information about synth state)
-    bool get_static_graph(int index, int subindex, float value, float *data, int points, cairo_iface *context);
     /// @retval true if the filter 1 is to be used for the left channel and filter 2 for the right channel
     /// @retval false if filters are to be connected in series and sent (mono) to both channels    
     inline bool is_stereo_filter() const
diff --git a/src/monosynth.cpp b/src/monosynth.cpp
index c93a506..15cfd4c 100644
--- a/src/monosynth.cpp
+++ b/src/monosynth.cpp
@@ -179,27 +179,37 @@ void monosynth_audio_module::precalculate_waves(progress_report_iface *reporter)
     
 }
 
-bool monosynth_audio_module::get_static_graph(int index, int subindex, float value, float *data, int points, cairo_iface *context)
+bool monosynth_audio_module::get_graph(int index, int subindex, float *data, int points, cairo_iface *context)
 {
     monosynth_audio_module::precalculate_waves(NULL);
+    // printf("get_graph %d %p %d wave1=%d wave2=%d\n", index, data, points, wave1, wave2);
     if (index == par_wave1 || index == par_wave2) {
         if (subindex)
             return false;
         enum { S = 1 << MONOSYNTH_WAVE_BITS };
+        float value = *params[index];
         int wave = dsp::clip(dsp::fastf2i_drm(value), 0, (int)wave_count - 1);
 
-        float *waveform = waves[wave].original;
-        for (int i = 0; i < points; i++)
-            data[i] = waveform[i * S / points];
+        uint32_t shift = (int32_t)(0x78000000 * last_lfov * *params[par_lfopw]);
+        int flag = (wave == wave_sqr);
+        
+        if (!running) {
+            float *waveform = waves[wave].original;
+            for (int i = 0; i < points; i++)
+                data[i] = waveform[i * S / points];
+        }
+        else
+        {
+            shift = (flag ? S/2 : 0) + (shift >> (32 - MONOSYNTH_WAVE_BITS));
+            int sign = flag ? -1 : 1;
+            if (wave == wave_sqr)
+                wave = wave_saw;
+            float *waveform = waves[wave].original;
+            for (int i = 0; i < points; i++)
+                data[i] = (sign * waveform[i * S / points] + waveform[(i * S / points + shift) & (S - 1)]) / (sign == -1 ? 1 : 2);
+        }
         return true;
     }
-    return false;
-}
-
-bool monosynth_audio_module::get_graph(int index, int subindex, float *data, int points, cairo_iface *context)
-{
-    monosynth_audio_module::precalculate_waves(NULL);
-    // printf("get_graph %d %p %d wave1=%d wave2=%d\n", index, data, points, wave1, wave2);
     if (index == par_filtertype) {
         if (!running)
             return false;
@@ -225,10 +235,10 @@ bool monosynth_audio_module::get_graph(int index, int subindex, float *data, int
 
 void monosynth_audio_module::calculate_buffer_oscs(float lfo)
 {
-    uint32_t shift = (int32_t)(0x70000000 * last_lfov * *params[par_lfopw]);
+    uint32_t shift = (int32_t)(0x78000000 * last_lfov * *params[par_lfopw]);
     int flag1 = (wave1 == wave_sqr);
     int flag2 = (wave2 == wave_sqr);
-    uint32_t shift_delta = (int32_t)(0x70000000 * (lfo - last_lfov) * *params[par_lfopw] * (1.0 / step_size));
+    uint32_t shift_delta = (int32_t)(0x78000000 * (lfo - last_lfov) * *params[par_lfopw] * (1.0 / step_size));
     
     uint32_t shift1 = (flag1 << 31) + shift;
     uint32_t shift2 = (flag2 << 31) + shift;

-- 
calf audio plugins packaging



More information about the pkg-multimedia-commits mailing list