[SCM] calf/master: + Organ: LV2 compatibility fixes, initialization fixes + AutoHell: added --enable-debug configure option (disables compiler optimization, enables debug information, disables export name filtering)

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


The following commit has been merged in the master branch:
commit fa56e850c3aec15a287278ebd9f939903069e37d
Author: kfoltman <kfoltman at 78b06b96-2940-0410-b7fc-879d825d01d8>
Date:   Wed May 28 20:35:27 2008 +0000

    + Organ: LV2 compatibility fixes, initialization fixes
    + AutoHell: added --enable-debug configure option (disables compiler optimization, enables debug information, disables export name filtering)
    
    
    git-svn-id: https://calf.svn.sourceforge.net/svnroot/calf/trunk@189 78b06b96-2940-0410-b7fc-879d825d01d8

diff --git a/configure.ac b/configure.ac
index f1d4c2b..28654ab 100644
--- a/configure.ac
+++ b/configure.ac
@@ -47,8 +47,6 @@ if test "$JACK_FOUND" = "yes"; then
   PKG_CHECK_MODULES(JACK_MIDI_DEPS, jack >= 0.105.0, OLD_JACK="no", OLD_JACK="yes")
 fi
 
-CXXFLAGS="$CXXFLAGS -O3 -finline-functions -finline-functions-called-once -Wall"
-
 AC_SUBST(GUI_DEPS_CFLAGS)
 AC_SUBST(GUI_DEPS_LIBS)
 AC_SUBST(JACK_DEPS_CFLAGS)
@@ -89,9 +87,21 @@ AC_ARG_ENABLE(experimental,
   AC_HELP_STRING([--enable-experimental],[enable unfinished features - not recommended!]),
   [set_enable_experimental="$enableval"],
   [set_enable_experimental="no"])
-
 AC_MSG_RESULT($set_enable_experimental)
 
+AC_MSG_CHECKING([whether to enable debugging mode])
+AC_ARG_ENABLE(debug,
+  AC_HELP_STRING([--enable-debug],[enable debug mode - slow!]),
+  [set_enable_debug="$enableval"],
+  [set_enable_debug="no"])
+AC_MSG_RESULT($set_enable_debug)
+
+if test "$set_enable_debug" = "yes"; then
+  CXXFLAGS="$CXXFLAGS -O0 -g -Wall"
+else
+  CXXFLAGS="$CXXFLAGS -O3 -finline-functions -finline-functions-called-once -Wall"
+fi
+
 AM_CONDITIONAL(USE_DSSI, test "$DSSI_FOUND" = "yes")
 AM_CONDITIONAL(USE_LADSPA, test "$LADSPA_FOUND" = "yes")
 AM_CONDITIONAL(USE_JACK, test "$JACK_ENABLED" = "yes")
@@ -100,6 +110,7 @@ AM_CONDITIONAL(USE_GUI, test "$GUI_ENABLED" = "yes")
 AM_CONDITIONAL(USE_DSSI_GUI, test "$DSSI_GUI_ENABLED" = "yes")
 AM_CONDITIONAL(USE_LV2_GUI, test "$LV2_GUI_ENABLED" = "yes")
 AM_CONDITIONAL(USE_LASH, test "$LASH_ENABLED" = "yes")
+AM_CONDITIONAL(USE_DEBUG, test "$set_enable_debug" = "yes")
 if test "$LADSPA_FOUND" = "yes"; then
   AC_DEFINE([USE_LADSPA], [1], [LADSPA wrapper will be built])
 fi
@@ -184,6 +195,7 @@ AC_CONFIG_FILES([Makefile
 AC_MSG_RESULT([
     Calf configured
 
+    Debug mode:             $set_enable_debug
     LADSPA enabled:         $LADSPA_FOUND
     DSSI enabled:           $DSSI_FOUND
     DSSI GUI enabled:       $DSSI_GUI_ENABLED
diff --git a/src/Makefile.am b/src/Makefile.am
index 6fdd26c..d1f6122 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -45,12 +45,20 @@ calfdssigui_LDADD =  -lglib-2.0 libcalfstatic.la libcalfgui.la $(GUI_DEPS_LIBS)
 endif
 
 calf_la_SOURCES = modules.cpp giface.cpp monosynth.cpp organ.cpp osctl.cpp preset.cpp synth.cpp utils.cpp
+if USE_DEBUG
+calf_la_LDFLAGS = -rpath $(ladspadir) -avoid-version -module -lexpat 
+else
 calf_la_LDFLAGS = -rpath $(ladspadir) -avoid-version -module -lexpat -export-symbols-regex "(ladspa_|lv2_|dssi_)descriptor"
+endif
 
 if USE_LV2_GUI
 calflv2gui_la_SOURCES = gui.cpp custom_ctl.cpp modules.cpp giface.cpp monosynth.cpp organ.cpp preset.cpp synth.cpp lv2gui.cpp main_win.cpp
+if USE_DEBUG
+calflv2gui_la_LDFLAGS = -rpath $(lv2dir) -avoid-version -module -lexpat $(GUI_DEPS_LIBS) 
+else
 calflv2gui_la_LDFLAGS = -rpath $(lv2dir) -avoid-version -module -lexpat -export-symbols-regex "lv2_gui_descriptor" $(GUI_DEPS_LIBS)
 endif
+endif
 
 libcalfstatic_la_SOURCES = modules.cpp giface.cpp monosynth.cpp organ.cpp osctl.cpp preset.cpp synth.cpp utils.cpp
 libcalfstatic_la_LDFLAGS = -static -lexpat
diff --git a/src/calf/organ.h b/src/calf/organ.h
index 7591a86..7a2b3cc 100644
--- a/src/calf/organ.h
+++ b/src/calf/organ.h
@@ -152,6 +152,7 @@ public:
     static inline big_wave_family &get_big_wave(int wave) {
         return big_waves[wave];
     }
+    static void precalculate_waves();
 };
 
 class organ_vibrato
@@ -340,6 +341,7 @@ struct drawbar_organ: public synth::basic_synth {
      drawbar_organ(organ_parameters *_parameters)
     : parameters(_parameters)
     , percussion(_parameters) {
+        organ_voice_base::precalculate_waves();
     }
     void render_separate(float *output[], int nsamples)
     {
diff --git a/src/calf/osc.h b/src/calf/osc.h
index 52a1a58..d1740c3 100644
--- a/src/calf/osc.h
+++ b/src/calf/osc.h
@@ -59,18 +59,20 @@ struct bandlimiter
     
     void compute_spectrum(float input[SIZE])
     {
-        std::complex<float> data[SIZE];
+        std::complex<float> *data = new complex<float>[SIZE];
         for (int i = 0; i < SIZE; i++)
             data[i] = input[i];
         fft.calculate(data, spectrum, false);
+        delete []data;
     }
     
     void compute_waveform(float output[SIZE])
     {
-        std::complex<float> data[SIZE];
+        std::complex<float> *data = new complex<float>[SIZE];
         fft.calculate(spectrum, data, true);
         for (int i = 0; i < SIZE; i++)
             output[i] = data[i].real();
+        delete []data;
     }
     
     /// remove DC offset of the spectrum (it usually does more harm than good!)
@@ -83,7 +85,9 @@ struct bandlimiter
     /// might need to be improved much in future!
     void make_waveform(float output[SIZE], int cutoff, bool foldover = false)
     {
-        std::complex<float> new_spec[SIZE], iffted[SIZE];
+        vector<std::complex<float> > new_spec, iffted;
+        new_spec.resize(SIZE);
+        iffted.resize(SIZE);
         for (int i = 0; i < cutoff; i++)
             new_spec[i] = spectrum[i], 
             new_spec[SIZE - 1 - i] = spectrum[SIZE - 1 - i];
@@ -105,7 +109,7 @@ struct bandlimiter
                 new_spec[i] = 0.f,
                 new_spec[SIZE - 1 - i] = 0.f;
         }
-        fft.calculate(new_spec, iffted, true);
+        fft.calculate(new_spec.data(), iffted.data(), true);
         for (int i = 0; i < SIZE; i++)
             output[i] = iffted[i].real();
     }
diff --git a/src/organ.cpp b/src/organ.cpp
index d347625..6e36a40 100644
--- a/src/organ.cpp
+++ b/src/organ.cpp
@@ -300,6 +300,7 @@ 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) {
+        organ_voice_base::precalculate_waves();
         if (subindex)
             return false;
         float *waveforms[9];
@@ -520,7 +521,9 @@ static void phaseshift(bandlimiter<ORGAN_WAVE_BITS> &bl, float tmp[ORGAN_WAVE_SI
 
 static void padsynth(bandlimiter<ORGAN_WAVE_BITS> blSrc, bandlimiter<ORGAN_BIG_WAVE_BITS> &blDest, organ_voice_base::big_wave_family &result, int bwscale = 20, float bell_factor = 0, bool foldover = false)
 {
-    complex<float> orig_spectrum[ORGAN_WAVE_SIZE / 2];
+    // kept in a vector to avoid putting large arrays on stack
+    vector<complex<float> >orig_spectrum;
+    orig_spectrum.resize(ORGAN_WAVE_SIZE / 2);
     for (int i = 0; i < ORGAN_WAVE_SIZE / 2; i++) 
     {
         orig_spectrum[i] = blSrc.spectrum[i];
@@ -572,10 +575,12 @@ static void padsynth(bandlimiter<ORGAN_WAVE_BITS> blSrc, bandlimiter<ORGAN_BIG_W
         
         blDest.spectrum[ORGAN_BIG_WAVE_SIZE - i] = conj(blDest.spectrum[i]);
     }
-    float tmp[ORGAN_BIG_WAVE_SIZE];
-    blDest.compute_waveform(tmp);
-    normalize_waveform(tmp, ORGAN_BIG_WAVE_SIZE);
-    blDest.compute_spectrum(tmp);
+    // same as above - put large array on heap to avoid stack overflow in ingen
+    vector<float> tmp;
+    tmp.resize(ORGAN_BIG_WAVE_SIZE);
+    blDest.compute_waveform(tmp.data());
+    normalize_waveform(tmp.data(), ORGAN_BIG_WAVE_SIZE);
+    blDest.compute_spectrum(tmp.data());
     
     // limit is 1/2 of the number of harmonics of the original wave
     result.make_from_spectrum(blDest, foldover, ORGAN_WAVE_SIZE >> (1 + ORGAN_BIG_WAVE_SHIFT));
@@ -589,18 +594,14 @@ static void padsynth(bandlimiter<ORGAN_WAVE_BITS> blSrc, bandlimiter<ORGAN_BIG_W
     #endif
 }
 
-
-organ_voice_base::organ_voice_base(organ_parameters *_parameters)
-: parameters(_parameters)
+void organ_voice_base::precalculate_waves()
 {
-    note = -1;
     static bool inited = false;
     if (!inited)
     {
         float tmp[ORGAN_WAVE_SIZE];
-        bandlimiter<ORGAN_WAVE_BITS> bl;
-        bandlimiter<ORGAN_BIG_WAVE_BITS> blBig;
-        inited = true;
+        static bandlimiter<ORGAN_WAVE_BITS> bl;
+        static bandlimiter<ORGAN_BIG_WAVE_BITS> blBig;
         for (int i = 0; i < ORGAN_WAVE_SIZE; i++)
             tmp[i] = sin(i * 2 * M_PI / ORGAN_WAVE_SIZE);
         waves[wave_sine].make(bl, tmp);
@@ -825,9 +826,17 @@ organ_voice_base::organ_voice_base(organ_parameters *_parameters)
         normalize_waveform(tmp, ORGAN_WAVE_SIZE);
         bl.compute_spectrum(tmp);
         padsynth(bl, blBig, big_waves[wave_choir3 - wave_count_small], 50, 10);
+        
+        inited = true;
     }
 }
 
+organ_voice_base::organ_voice_base(organ_parameters *_parameters)
+: parameters(_parameters)
+{
+    note = -1;
+}
+
 void organ_vibrato::reset()
 {
     for (int i = 0; i < VibratoSize; i++)

-- 
calf audio plugins packaging



More information about the pkg-multimedia-commits mailing list