[SCM] calf/master: Merge remote-tracking branch 'markus/master'

js at users.alioth.debian.org js at users.alioth.debian.org
Tue May 7 15:41:14 UTC 2013


get_changed_offsets for multiband limiter
minor optical changes to ui elements and backgrounds
move triangular window functions to the end choose linear window as default
all windowing functions implemented
tap function for vintage delay
blackman as default window
Spectralizer in Analyzer added windowing for Analyzer
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
X-Git-Refname: refs/heads/master
X-Git-Reftype: branch
X-Git-Oldrev: d6a3c1a63a147948535a50da009275278ad5e6a3
X-Git-Newrev: 34569260c452f0fa4c543155ebba174a42a343dc

The following commit has been merged in the master branch:
commit 424afbf08a3b4a6d30633cddbe4cc94fd00be7d4
Merge: 70cdb3b1a31fc259f179c457d909ca2726227314 1a5d1a7fae86eb9e74d7e6d937b24d73da92b0f6
Author: Krzysztof Foltman <wdev at foltman.com>
Date:   Fri Sep 21 18:49:05 2012 +0100

    Merge remote-tracking branch 'markus/master'
    
    Conflicts:
    	src/custom_ctl.cpp
    	src/metadata.cpp

diff --combined src/calf/modules.h
index 717cd63,7b7cfbe..8c217ef
--- a/src/calf/modules.h
+++ b/src/calf/modules.h
@@@ -21,8 -21,8 +21,8 @@@
  #ifndef CALF_MODULES_H
  #define CALF_MODULES_H
  
 -#include "rfftw.h"
  #include <assert.h>
 +#include <fftw3.h>
  #include <limits.h>
  #include "biquad.h"
  #include "inertia.h"
@@@ -79,6 -79,9 +79,9 @@@ public
      void set_sample_rate(uint32_t sr);
      void calc_filters();
      uint32_t process(uint32_t offset, uint32_t numsamples, uint32_t inputs_mask, uint32_t outputs_mask);
+     
+     long _tap_avg;
+     long _tap_last;
  };
  
  template<typename FilterClass, typename Metadata>
@@@ -327,7 -330,6 +330,7 @@@ public
      bool get_graph(int index, int subindex, float *data, int points, cairo_iface *context, int *mode) const;
      bool get_gridline(int index, int subindex, float &pos, bool &vertical, std::string &legend, cairo_iface *context) const;
      bool get_clear_all(int index) const;
 +    ~analyzer_audio_module();
      mutable int _mode_old;
      mutable bool _falling;
  protected:
@@@ -340,12 -342,12 +343,12 @@@
      int plength;
      int ppos;
      int fpos;
 -    mutable rfftw_plan fft_plan;
 +    mutable fftwf_plan fft_plan;
      static const int max_fft_cache_size = 32768;
      static const int max_fft_buffer_size = max_fft_cache_size * 2;
 -    fftw_real *fft_inL, *fft_outL;
 -    fftw_real *fft_inR, *fft_outR;
 -    fftw_real *fft_smoothL, *fft_smoothR;
 +    float *fft_inL, *fft_outL;
 +    float *fft_inR, *fft_outR;
 +    float *fft_smoothL, *fft_smoothR;
      float *fft_deltaL, *fft_deltaR;
      float *fft_holdL, *fft_holdR;
      float *fft_fallingL, *fft_fallingR;
diff --combined src/custom_ctl.cpp
index feacbc9,570126e..1104144
--- a/src/custom_ctl.cpp
+++ b/src/custom_ctl.cpp
@@@ -392,7 -392,6 +392,7 @@@ calf_line_graph_expose (GtkWidget *widg
      }
      
      calf_line_graph_copy_cache_to_window( lg->master_surface, c );
-     
++
      // printf("exposed %p %dx%d %d+%d\n", widget->window, event->area.x, event->area.y, event->area.width, event->area.height);
  
      return TRUE;
diff --combined src/metadata.cpp
index fe81db6,3126f12..210d0bc
--- a/src/metadata.cpp
+++ b/src/metadata.cpp
@@@ -166,6 -166,8 +166,8 @@@ CALF_PORT_PROPS(vintage_delay) = 
      { 1,         0,    2,     0, PF_ENUM | PF_CTL_COMBO, vintage_delay_fbmodes, "medium", "Medium" },
      { 1.0,       0,    4,     0, PF_FLOAT | PF_SCALE_GAIN | PF_CTL_KNOB | PF_UNIT_COEF | PF_PROP_NOBOUNDS, NULL, "dry", "Dry Amount" },
      { 1.0,      -1,    1,     0, PF_FLOAT | PF_SCALE_PERC | PF_CTL_KNOB , NULL, "width", "Stereo Width" },
+     { 0,         0,    1,     2, PF_BOOL | PF_CTL_BUTTON , NULL, "tap", "Tap" },
+     { 0,         0,    1,     0, PF_BOOL | PF_CTL_LED | PF_PROP_OUTPUT | PF_PROP_OPTIONAL, NULL, "waiting", "Waiting" },
      {}
  };
  
@@@ -988,7 -990,7 +990,7 @@@ const char *analyzer_smooth_names[] = 
  const char *analyzer_post_names[] = { "Normalized", "Average", "Additive", "Denoised Peaks" };
  const char *analyzer_view_names[] = { "Bars", "Lines", "Cubic Splines" };
  const char *analyzer_scale_names[] = { "Logarithmic", "Linear" };
 -const char *analyzer_windowing_names[] = { "Linear", "Hamming", "von Hann", "Blackman", "Blackman-Harris", "Blackman-Nuttall", "Sine", "Lanczos", "Gauß", "Bartlett", "Triangular", "Bartlett-Hann" };
 +const char *analyzer_windowing_names[] = { "Rectangular", "Hamming", "von Hann", "Blackman", "Blackman-Harris", "Blackman-Nuttall", "Sine", "Lanczos", "Gauß", "Bartlett", "Triangular", "Bartlett-Hann" };
  CALF_PORT_PROPS(analyzer) = {
      { 0,           0,           1,     0,  PF_FLOAT | PF_SCALE_GAIN | PF_CTL_METER | PF_CTLO_LABEL | PF_UNIT_DB | PF_PROP_OUTPUT | PF_PROP_OPTIONAL, NULL, "meter_L", "Level L" },
      { 0,           0,           1,     0,  PF_FLOAT | PF_SCALE_GAIN | PF_CTL_METER | PF_CTLO_LABEL | PF_UNIT_DB | PF_PROP_OUTPUT | PF_PROP_OPTIONAL, NULL, "meter_R", "Level R" },
@@@ -1055,7 -1057,7 +1057,7 @@@ CALF_PORT_PROPS(monosynth) = 
      { 0,         -1,    1,  0.1, PF_FLOAT | PF_SCALE_PERC | PF_CTL_KNOB, NULL, "o2_pw", "Osc2 PW" },
  
      { 10,         0,  100,    0, PF_FLOAT | PF_SCALE_LINEAR | PF_CTL_KNOB | PF_UNIT_CENTS, NULL, "o12_detune", "O1<>2 Detune" },
 -    { 12,       -24,   24,    0, PF_INT | PF_SCALE_LINEAR | PF_CTL_KNOB | PF_UNIT_SEMITONES, NULL, "o2_xpose", "Osc 2 transpose" },
 +    { 12,       -24,   24,    0, PF_INT | PF_SCALE_LINEAR | PF_CTL_KNOB | PF_UNIT_SEMITONES, NULL, "o2_xpose", "Osc2 transpose" },
      { 0,          0,    5,    0, PF_ENUM | PF_CTL_COMBO, monosynth_mode_names, "phase_mode", "Phase mode" },
      { 0.5,        0,    1,    0, PF_FLOAT | PF_SCALE_PERC, NULL, "o12_mix", "O1<>2 Mix" },
      { 1,          0,    7,    0, PF_ENUM | PF_CTL_COMBO | PF_PROP_GRAPH, monosynth_filter_choices, "filter", "Filter" },
diff --combined src/modules.cpp
index 13c72f4,485c9d2..a4b6a28
--- a/src/modules.cpp
+++ b/src/modules.cpp
@@@ -21,11 -21,11 +21,11 @@@
  #include <limits.h>
  #include <memory.h>
  #include <math.h>
 -#include <rfftw.h>
 +#include <fftw3.h>
  #include <calf/giface.h>
  #include <calf/modules.h>
  #include <calf/modules_dev.h>
- 
+ #include <sys/time.h>
  
  using namespace dsp;
  using namespace calf_plugins;
@@@ -113,10 -113,27 +113,27 @@@ vintage_delay_audio_module::vintage_del
          buffers[0][i] = 0.f;
          buffers[1][i] = 0.f;
      }
+     _tap_avg = 0;
+     _tap_last = 0;
  }
  
  void vintage_delay_audio_module::params_changed()
  {
+     if(*params[par_tap] >= .5f) {
+         timeval tv;
+         gettimeofday(&tv, 0);
+         long _now = tv.tv_sec * 1000000 + tv.tv_usec;
+         if(_tap_last) {
+             if(_tap_avg)
+                 _tap_avg = (_tap_avg * 3 + (_now - _tap_last)) / 4.f;
+             else
+                 _tap_avg = _now - _tap_last;
+             *params[par_bpm] = 60.f / (float)(_tap_avg / 1000000.f);
+             printf("bpm: %.5f\n", *params[par_bpm]);
+         }
+         _tap_last = _now;
+         *params[par_tap] = 0.f;
+     }
      float unit = 60.0 * srate / (*params[par_bpm] * *params[par_divide]);
      deltime_l = dsp::fastf2i_drm(unit * *params[par_time_l]);
      deltime_r = dsp::fastf2i_drm(unit * *params[par_time_r]);
@@@ -302,6 -319,22 +319,22 @@@ uint32_t vintage_delay_audio_module::pr
          biquad_left[1].sanitize();biquad_right[1].sanitize();
          
      }
+     
+     // get microseconds
+     if(_tap_last) {
+         timeval tv;
+         gettimeofday(&tv, 0);
+         long _now = tv.tv_sec * 1000 * 1000 + tv.tv_usec;
+         if(_now > _tap_last + 2000000) {
+             // user stopped tapping
+             _tap_avg = 0;
+             _tap_last = 0;
+         }
+         *params[par_waiting] = 1.f;
+     } else {
+         *params[par_waiting] = 0.f;
+     }
+     
      return ostate;
  }
  
@@@ -699,7 -732,7 +732,7 @@@ void stereo_audio_module::set_sample_ra
      // rebuild buffer
      buffer_size = (int)(srate * 0.05 * 2.f); // buffer size attack rate multiplied by 2 channels
      buffer = (float*) calloc(buffer_size, sizeof(float));
 -    memset(buffer, 0, buffer_size * sizeof(float)); // reset buffer to zero
 +    dsp::zero(buffer, buffer_size); // reset buffer to zero
      pos = 0;
  }
  
@@@ -848,7 -881,7 +881,7 @@@ void mono_audio_module::set_sample_rate
      // rebuild buffer
      buffer_size = (int)srate * 0.05 * 2; // delay buffer size multiplied by 2 channels
      buffer = (float*) calloc(buffer_size, sizeof(float));
 -    memset(buffer, 0, buffer_size * sizeof(float)); // reset buffer to zero
 +    dsp::zero(buffer, buffer_size); // reset buffer to zero
      pos = 0;
  }
  
@@@ -875,63 -908,47 +908,63 @@@ analyzer_audio_module::analyzer_audio_m
      memset(spline_buffer, 0, 200 * sizeof(int)); // reset buffer to zero
      
      phase_buffer = (float*) calloc(max_phase_buffer_size, sizeof(float));
 -    memset(phase_buffer, 0, max_phase_buffer_size * sizeof(float));
 +    dsp::zero(phase_buffer, max_phase_buffer_size);
      
      fft_buffer = (float*) calloc(max_fft_buffer_size, sizeof(float));
 -    memset(fft_buffer, 0, max_fft_buffer_size * sizeof(float));
      
 -    fft_inL = (fftw_real*) calloc(max_fft_cache_size, sizeof(fftw_real));
 -    fft_outL = (fftw_real*) calloc(max_fft_cache_size, sizeof(fftw_real));
 -    fft_inR = (fftw_real*) calloc(max_fft_cache_size, sizeof(fftw_real));
 -    fft_outR = (fftw_real*) calloc(max_fft_cache_size, sizeof(fftw_real));
 +    fft_inL = (float*) calloc(max_fft_cache_size, sizeof(float));
 +    fft_outL = (float*) calloc(max_fft_cache_size, sizeof(float));
 +    fft_inR = (float*) calloc(max_fft_cache_size, sizeof(float));
 +    fft_outR = (float*) calloc(max_fft_cache_size, sizeof(float));
      
 -    fft_smoothL = (fftw_real*) calloc(max_fft_cache_size, sizeof(fftw_real));
 -    fft_smoothR = (fftw_real*) calloc(max_fft_cache_size, sizeof(fftw_real));
 -    memset(fft_smoothL, 0, max_fft_cache_size * sizeof(fftw_real));
 -    memset(fft_smoothR, 0, max_fft_cache_size * sizeof(fftw_real));
 +    fft_smoothL = (float*) calloc(max_fft_cache_size, sizeof(float));
 +    fft_smoothR = (float*) calloc(max_fft_cache_size, sizeof(float));
      
      fft_fallingL = (float*) calloc(max_fft_cache_size, sizeof(float));
      fft_fallingR = (float*) calloc(max_fft_cache_size, sizeof(float));
 -    memset(fft_fallingL, 1.f, max_fft_cache_size * sizeof(float));
 -    memset(fft_fallingR, 1.f, max_fft_cache_size * sizeof(float));
 +    dsp::fill(fft_fallingL, 1.f, max_fft_cache_size);
 +    dsp::fill(fft_fallingR, 1.f, max_fft_cache_size);
      
      fft_deltaL = (float*) calloc(max_fft_cache_size, sizeof(float));
      fft_deltaR = (float*) calloc(max_fft_cache_size, sizeof(float));
      
      fft_holdL = (float*) calloc(max_fft_cache_size, sizeof(float));
      fft_holdR = (float*) calloc(max_fft_cache_size, sizeof(float));
      
      fft_freezeL = (float*) calloc(max_fft_cache_size, sizeof(float));
      fft_freezeR = (float*) calloc(max_fft_cache_size, sizeof(float));
 -    memset(fft_freezeL, 0, max_fft_cache_size * sizeof(float));
 -    memset(fft_freezeR, 0, max_fft_cache_size * sizeof(float));
      
 -    fft_plan = false;
 +    fft_plan = NULL;
      
      ____analyzer_phase_was_drawn_here = 0;
      ____analyzer_sanitize = 0;
  }
  
 +analyzer_audio_module::~analyzer_audio_module()
 +{
 +    free(fft_freezeR);
 +    free(fft_freezeL);
 +    free(fft_holdR);
 +    free(fft_holdL);
 +    free(fft_deltaR);
 +    free(fft_deltaL);
 +    free(fft_fallingR);
 +    free(fft_fallingL);
 +    free(fft_smoothR);
 +    free(fft_smoothL);
 +    free(fft_outR);
 +    free(fft_outL);
 +    free(fft_inR);
 +    free(fft_inL);
 +    free(phase_buffer);
 +    free(spline_buffer);
 +    if (fft_plan)
 +    {
 +        fftwf_destroy_plan(fft_plan);
 +        fft_plan = NULL;
 +    }
 +}
 +
  void analyzer_audio_module::activate() {
      active = true;
  }
@@@ -943,12 -960,11 +976,12 @@@ void analyzer_audio_module::deactivate(
  void analyzer_audio_module::params_changed() {
      bool ___sanitize = false;
      if(*params[param_analyzer_accuracy] != _acc_old) {
 -        _accuracy = pow(2, 7 + *params[param_analyzer_accuracy]);
 +        _accuracy = 1 << (7 + (int)*params[param_analyzer_accuracy]);
          _acc_old = *params[param_analyzer_accuracy];
          // recreate fftw plan
 -        if (fft_plan) rfftw_destroy_plan (fft_plan);
 -        fft_plan = rfftw_create_plan(_accuracy, FFTW_FORWARD, 0);
 +        if (fft_plan) fftwf_destroy_plan (fft_plan);
 +        //fft_plan = rfftw_create_plan(_accuracy, FFTW_FORWARD, 0);
 +        fft_plan = fftwf_plan_r2r_1d(_accuracy, NULL, NULL, FFTW_R2HC, FFTW_ESTIMATE);
          lintrans = -1;
          ___sanitize = true;
      }
@@@ -974,19 -990,19 +1007,19 @@@
      }
      if(___sanitize) {
          // null the overall buffer
 -        memset(fft_inL, 1e-20, max_fft_cache_size * sizeof(float));
 -        memset(fft_inR, 1e-20, max_fft_cache_size * sizeof(float));
 -        memset(fft_outL, 1e-20, max_fft_cache_size * sizeof(float));
 -        memset(fft_outR, 1e-20, max_fft_cache_size * sizeof(float));
 -        memset(fft_holdL, 1e-20, max_fft_cache_size * sizeof(float));
 -        memset(fft_holdR, 1e-20, max_fft_cache_size * sizeof(float));
 -        memset(fft_smoothL, 1e-20, max_fft_cache_size * sizeof(float));
 -        memset(fft_smoothR, 1e-20, max_fft_cache_size * sizeof(float));
 -        memset(fft_deltaL, 1e-20, max_fft_cache_size * sizeof(float));
 -        memset(fft_deltaR, 1e-20, max_fft_cache_size * sizeof(float));
 +        dsp::zero(fft_inL, max_fft_cache_size);
 +        dsp::zero(fft_inR, max_fft_cache_size);
 +        dsp::zero(fft_outL, max_fft_cache_size);
 +        dsp::zero(fft_outR, max_fft_cache_size);
 +        dsp::zero(fft_holdL, max_fft_cache_size);
 +        dsp::zero(fft_holdR, max_fft_cache_size);
 +        dsp::zero(fft_smoothL, max_fft_cache_size);
 +        dsp::zero(fft_smoothR, max_fft_cache_size);
 +        dsp::zero(fft_deltaL, max_fft_cache_size);
 +        dsp::zero(fft_deltaR, max_fft_cache_size);
  //        memset(fft_fallingL, 1.f, max_fft_cache_size * sizeof(float));
  //        memset(fft_fallingR, 1.f, max_fft_cache_size * sizeof(float));
 -        memset(spline_buffer, 0, 200 * sizeof(int));
 +        dsp::zero(spline_buffer, 200);
          ____analyzer_phase_was_drawn_here = 0;
      }
  }
@@@ -1062,8 -1078,8 +1095,8 @@@ bool analyzer_audio_module::get_graph(i
          // null the overall buffer to feed the fft with if someone requested so
          // in the last cycle
          // afterwards quit this call
 -        memset(fft_inL, 1e-20, max_fft_cache_size * sizeof(float));
 -        memset(fft_inR, 1e-20, max_fft_cache_size * sizeof(float));
 +        dsp::zero(fft_inL, max_fft_cache_size);
 +        dsp::zero(fft_inR, max_fft_cache_size);
          ____analyzer_sanitize = 0;
          return false;
      }
@@@ -1129,9 -1145,6 +1162,9 @@@
                      _fpos = max_fft_buffer_size + _fpos;
                  float L = fft_buffer[_fpos];
                  float R = fft_buffer[_fpos + 1];
 +                float win = 0.54 - 0.46 * cos(2 * M_PI * i / _accuracy);
 +                L *= win;
 +                R *= win;
                  
                  // #######################################
                  // Do some windowing functions on the
@@@ -1217,12 -1230,12 +1250,12 @@@
                  L *= _f;
                  if(_param_mode > _m)
                      R *= _f;
--                
++
                  // perhaps we need to compute two FFT's, so store left and right
                  // channel in case we need only one FFT, the left channel is
                  // used as 'standard'"
 -                fftw_real valL;
 -                fftw_real valR;
 +                float valL;
 +                float valR;
                  
                  switch(_param_mode) {
                      case 0:
@@@ -1277,11 -1290,11 +1310,11 @@@
              // this takes our latest buffer and returns an array with
              // non-normalized
              if (fft_plan)
 -                rfftw_one(fft_plan, fft_inL, fft_outL);
 +                fftwf_execute_r2r(fft_plan, fft_inL, fft_outL);
              //run fft for for right channel too. it is needed for stereo image 
              //and stereo difference modes
              if(_param_mode >= 3 and fft_plan) {
 -                rfftw_one(fft_plan, fft_inR, fft_outR);
 +                fftwf_execute_r2r(fft_plan, fft_inR, fft_outR);
              }
              // ...and set some values for later use
              ____analyzer_phase_was_drawn_here = 0;     
@@@ -1788,4 -1801,3 +1821,4 @@@ bool analyzer_audio_module::get_clear_a
      }
      return false;
  }
 +

-- 
calf audio plugins packaging



More information about the pkg-multimedia-commits mailing list