[SCM] calf/master: * JACK host uses hscale widgets instead of phat knobs if phat is not available * more benchmarking * configure improvements (--enable-experimental, leaving existing CXXFLAGS alone to have debug symbols) * change in giface event handling (just experimenting)
js at users.alioth.debian.org
js at users.alioth.debian.org
Tue May 7 15:36:42 UTC 2013
The following commit has been merged in the master branch:
commit 1161d25172de176f0480fa3d6773951027328efe
Author: kfoltman <kfoltman at 78b06b96-2940-0410-b7fc-879d825d01d8>
Date: Thu Dec 6 20:29:35 2007 +0000
* JACK host uses hscale widgets instead of phat knobs if phat is not available
* more benchmarking
* configure improvements (--enable-experimental, leaving existing CXXFLAGS alone to have debug symbols)
* change in giface event handling (just experimenting)
git-svn-id: https://calf.svn.sourceforge.net/svnroot/calf/trunk@6 78b06b96-2940-0410-b7fc-879d825d01d8
diff --git a/TODO b/TODO
index 71e95c3..89f6e94 100644
--- a/TODO
+++ b/TODO
@@ -1,16 +1,20 @@
1. More effects
-- auto-wah
+- auto-wah (might be integrated into filter)
- envelope follower
- better reverb (more features, use nested allpasses, use 1-pole
1-zero allpass instead of fractional delays)
-- dynamic processing
+- dynamics processing
- distortion?
+- windy rotary speakery stuff
+- true phaser
+- filter: more types
2. Some instruments
- update and merge the old electric organ thingy
- some virtual analogue thing
+- FM (by reusing my MMX code, or something)
3. DSP library
@@ -20,7 +24,7 @@
4. Wrappers
-- LADSPA: proper rdf
+- LADSPA: proper rdf (get clearance from drobilla ;) )
- better jack host (controls etc)
- BSE
- buzztard
@@ -32,3 +36,4 @@
- correct compilation and installation of LADSPA plugins (current version is a hack!)
- switch to -O3
- get to work on 64-bit architectures
+- i18n (gettext or whatever)
diff --git a/config.h.in b/config.h.in
index 6f38196..645552c 100644
--- a/config.h.in
+++ b/config.h.in
@@ -15,6 +15,9 @@
/* Define to 1 if you have the <ladspa.h> header file. */
#undef HAVE_LADSPA_H
+/* Define to 1 if you have the <math.h> header file. */
+#undef HAVE_MATH_H
+
/* Define to 1 if you have the <memory.h> header file. */
#undef HAVE_MEMORY_H
diff --git a/configure.in b/configure.in
index 59fa169..99c48a4 100644
--- a/configure.in
+++ b/configure.in
@@ -24,7 +24,7 @@ PKG_PROG_PKG_CONFIG
# Checks for header files.
AC_HEADER_STDC
-AC_CHECK_HEADERS([memory.h stdint.h stdlib.h ladspa.h time.h])
+AC_CHECK_HEADERS([memory.h stdint.h stdlib.h ladspa.h time.h math.h])
AC_CHECK_HEADER(ladspa.h, LADSPA_FOUND="yes", LADSPA_FOUND="no")
@@ -38,28 +38,48 @@ else
JACK_FOUND="no"
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)
AC_SUBST(JACK_DEPS_LIBS)
+PHAT_ENABLED="no"
if test "$JACK_FOUND" = "yes"; then
- PKG_CHECK_MODULES(GUI_DEPS, gtk+-2.0 >= 2.4.0 phat >= 0.4.1,
+ PKG_CHECK_MODULES(GUI_DEPS, gtk+-2.0 >= 2.4.0,
+ JACK_ENABLED="yes",
+ JACK_ENABLED="no (GTK+ is missing or too old)"
+ )
+else
+ JACK_ENABLED="no"
+fi
+
+if test "$JACK_ENABLED" = "yes"; then
+ PKG_CHECK_MODULES(PHAT_DEPS, phat >= 0.4.1,
[
CFLAGS="$CFLAGS $GUI_DEPS_CFLAGS $JACK_DEPS_CFLAGS"
CPPFLAGS="$CPPFLAGS $GUI_DEPS_CFLAGS $JACK_DEPS_CFLAGS"
AC_CHECK_HEADERS([phat/phatknob.h],
- JACK_ENABLED="yes",
- JACK_ENABLED="no (phat library is too old, SVN version required)")
+ PHAT_ENABLED="yes",
+ PHAT_ENABLED="no (phat library is too old, SVN version required)")
],
- JACK_ENABLED="no (GTK+ or phat is missing or too old)"
+ PHAT_ENABLED="no"
)
-else
- JACK_ENABLED="no"
fi
+AC_MSG_CHECKING([whether to enable experimental/unfinished features])
+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)
+
AM_CONDITIONAL(USE_LADSPA, test "$LADSPA_FOUND" = "yes")
AM_CONDITIONAL(USE_JACK, test "$JACK_ENABLED" = "yes")
+AM_CONDITIONAL(USE_PHAT, test "$PHAT_ENABLED" = "yes")
+AM_CONDITIONAL(ENABLE_EXPERIMENTAL, test "$set_enable_experimental" = "yes")
# Checks for typedefs, structures, and compiler characteristics.
AC_HEADER_STDBOOL
@@ -101,6 +121,7 @@ AC_MSG_RESULT([
LADSPA enabled: $LADSPA_FOUND
JACK host enabled: $JACK_ENABLED
+ PHAT library enabled: $PHAT_ENABLED
Installation prefix: $prefix
])
diff --git a/src/Makefile.am b/src/Makefile.am
index a298e41..916c6a4 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -11,13 +11,20 @@ bin_PROGRAMS =
noinst_PROGRAMS = calfbenchmark
noinst_LTLIBRARIES = libcalf.la libcalfstatic.la
-AM_CXXFLAGS = -O3 -ffast-math -march=pentium4 -finline-limit=8
+AM_CXXFLAGS = -ffast-math -march=pentium4 -finline-limit=80
if USE_JACK
AM_CXXFLAGS += -DUSE_JACK=1
bin_PROGRAMS += calfjackhost
calfjackhost_SOURCES = jackhost.cpp
calfjackhost_LDADD = libcalfstatic.la $(JACK_DEPS_LIBS) $(GUI_DEPS_LIBS)
+if USE_PHAT
+AM_CXXFLAGS += -DUSE_PHAT=1 $(PHAT_DEPS_CFLAGS)
+calfjackhost_LDADD += $(PHAT_DEPS_LIBS)
+endif
+endif
+if ENABLE_EXPERIMENTAL
+AM_CXXFLAGS += -DENABLE_EXPERIMENTAL=1
endif
if USE_LADSPA
diff --git a/src/benchmark.cpp b/src/benchmark.cpp
index 071f5c9..1ac2dee 100644
--- a/src/benchmark.cpp
+++ b/src/benchmark.cpp
@@ -4,11 +4,14 @@
#include <config.h>
#include <calf/giface.h>
#include <calf/modules.h>
+#include <calf/modules_dev.h>
#include <calf/benchmark.h>
using namespace std;
using namespace dsp;
+bool benchmark_globals::warned = false;
+
template<int BUF_SIZE>
struct empty_benchmark
{
@@ -88,6 +91,15 @@ struct filter_24dB_lp_onepass_d2: public filter_lp24dB_benchmark
}
};
+struct filter_24dB_lp_onepass_d2_lp: public filter_lp24dB_benchmark
+{
+ void run()
+ {
+ for (int i = 0; i < BUF_SIZE; i++)
+ buffer[i] = biquad2.process_d2_lp(biquad.process_d2_lp(buffer[i]));
+ }
+};
+
struct filter_12dB_lp_d2: public filter_lp24dB_benchmark
{
void run()
@@ -105,6 +117,7 @@ struct __attribute__((aligned(8))) alignment_test: public empty_benchmark<ALIGN_
float result;
virtual double *get_ptr()=0;
+ virtual ~alignment_test() {}
void prepare()
{
memset(data, 0, sizeof(data));
@@ -150,6 +163,110 @@ static struct option long_options[] = {
{0,0,0,0},
};
+void biquad_test()
+{
+ do_simple_benchmark<filter_24dB_lp_twopass_d1>();
+ do_simple_benchmark<filter_24dB_lp_onepass_d1>();
+ do_simple_benchmark<filter_12dB_lp_d1>();
+ do_simple_benchmark<filter_24dB_lp_twopass_d2>();
+ do_simple_benchmark<filter_24dB_lp_onepass_d2>();
+ do_simple_benchmark<filter_24dB_lp_onepass_d2_lp>();
+ do_simple_benchmark<filter_12dB_lp_d2>();
+}
+
+void alignment_test()
+{
+ do_simple_benchmark<misaligned_double>();
+ do_simple_benchmark<aligned_double>();
+}
+
+template<class Effect>
+void get_default_effect_params(float params[Effect::param_count], uint32_t &sr);
+
+template<>
+void get_default_effect_params<synth::reverb_audio_module>(float params[3], uint32_t &sr)
+{
+ typedef synth::reverb_audio_module mod;
+ params[mod::par_decay] = 4;
+ params[mod::par_hfdamp] = 2000;
+ params[mod::par_amount] = 2;
+ sr = 4000;
+}
+
+template<>
+void get_default_effect_params<synth::filter_audio_module>(float params[4], uint32_t &sr)
+{
+ typedef synth::filter_audio_module mod;
+ params[mod::par_cutoff] = 500;
+ params[mod::par_resonance] = 3;
+ params[mod::par_mode] = 2;
+ params[mod::par_inertia] = 16;
+ sr = 4000;
+}
+
+template<>
+void get_default_effect_params<synth::flanger_audio_module>(float params[5], uint32_t &sr)
+{
+ typedef synth::flanger_audio_module mod;
+ params[mod::par_delay] = 1;
+ params[mod::par_depth] = 2;
+ params[mod::par_rate] = 1;
+ params[mod::par_fb] = 0.9;
+ params[mod::par_amount] = 0.9;
+ sr = 44100;
+}
+
+template<class Effect, unsigned int bufsize = 256>
+class effect_benchmark: public empty_benchmark<bufsize>
+{
+public:
+ Effect effect;
+ float inputs[Effect::in_count][bufsize];
+ float outputs[Effect::out_count][bufsize];
+ float result;
+ float params[Effect::param_count];
+
+ void prepare()
+ {
+ for (int b = 0; b < Effect::out_count; b++)
+ {
+ effect.outs[b] = outputs[b];
+ dsp::zero(outputs[b], bufsize);
+ }
+ for (int b = 0; b < Effect::in_count; b++)
+ {
+ effect.ins[b] = inputs[b];
+ for (unsigned int i = 0; i < bufsize; i++)
+ inputs[b][i] = (float)(10 + i*0.3f*(b+1));
+ }
+ for (int i = 0; i < Effect::param_count; i++)
+ effect.params[i] = ¶ms[i];
+ ::get_default_effect_params<Effect>(params, effect.srate);
+ result = 0.f;
+ effect.activate();
+ }
+ void run()
+ {
+ effect.params_changed();
+ effect.process(bufsize, 3, 3);
+ }
+ void cleanup()
+ {
+ for (int b = 0; b < Effect::out_count; b++)
+ {
+ for (unsigned int i = 0; i < bufsize; i++)
+ result += outputs[b][i];
+ }
+ }
+};
+
+void effect_test()
+{
+ dsp::do_simple_benchmark<effect_benchmark<synth::flanger_audio_module> >(5, 10000);
+ dsp::do_simple_benchmark<effect_benchmark<synth::reverb_audio_module> >(5, 1000);
+ dsp::do_simple_benchmark<effect_benchmark<synth::filter_audio_module> >(5, 10000);
+}
+
int main(int argc, char *argv[])
{
while(1) {
@@ -160,7 +277,7 @@ int main(int argc, char *argv[])
switch(c) {
case 'h':
case '?':
- printf("Benchmark suite Calf plugin pack\nSyntax: %s [--help] [--version] [--unit biquad|alignment]\n", argv[0]);
+ printf("Benchmark suite Calf plugin pack\nSyntax: %s [--help] [--version] [--unit biquad|alignment|effects]\n", argv[0]);
return 0;
case 'v':
printf("%s\n", PACKAGE_STRING);
@@ -171,19 +288,14 @@ int main(int argc, char *argv[])
}
}
- if (!unit || !strcmp(unit, "biquad")) {
- do_simple_benchmark<filter_24dB_lp_twopass_d1>();
- do_simple_benchmark<filter_24dB_lp_onepass_d1>();
- do_simple_benchmark<filter_12dB_lp_d1>();
- do_simple_benchmark<filter_24dB_lp_twopass_d2>();
- do_simple_benchmark<filter_24dB_lp_onepass_d2>();
- do_simple_benchmark<filter_12dB_lp_d2>();
- }
+ if (!unit || !strcmp(unit, "biquad"))
+ biquad_test();
- if (!unit || !strcmp(unit, "alignment")) {
- do_simple_benchmark<misaligned_double>();
- do_simple_benchmark<aligned_double>();
- }
+ if (!unit || !strcmp(unit, "alignment"))
+ alignment_test();
+
+ if (!unit || !strcmp(unit, "effects"))
+ effect_test();
return 0;
}
diff --git a/src/calf/Makefile.am b/src/calf/Makefile.am
index 68ef4b6..ae715da 100644
--- a/src/calf/Makefile.am
+++ b/src/calf/Makefile.am
@@ -1,3 +1,3 @@
calfdir = $(includedir)/calf
-calf_HEADERS = audio_fx.h benchmark.h biquad.h buffer.h delay.h fixed_point.h giface.h inertia.h modules.h onepole.h primitives.h wave.h
+calf_HEADERS = audio_fx.h benchmark.h biquad.h buffer.h delay.h fixed_point.h giface.h inertia.h modules.h modules_dev.h onepole.h primitives.h wave.h
diff --git a/src/calf/audio_fx.h b/src/calf/audio_fx.h
index 2dfaf33..2da56d4 100644
--- a/src/calf/audio_fx.h
+++ b/src/calf/audio_fx.h
@@ -214,6 +214,8 @@ public:
}
};
+#if ENABLE_EXPERIMENTAL
+
/**
* This is crap, not really sounding like rotary speaker.
* I needed it for tests, maybe I'll give it more time later.
@@ -254,6 +256,8 @@ public:
}
};
+#endif
+
/**
* A classic allpass loop reverb with modulated allpass filter.
* Just started implementing it, so there is no control over many
@@ -326,7 +330,6 @@ public:
static const float l5dec=exp(-1573.f/fDec), r5dec=exp(-1671.f/fDec);
static const float l6dec=exp(-1877.f/fDec), r6dec=exp(-1781.f/fDec);
- phase += dphase;
unsigned int ipart = phase.ipart();
// the interpolated LFO might be an overkill here
diff --git a/src/calf/benchmark.h b/src/calf/benchmark.h
index e6835d1..95c5d84 100644
--- a/src/calf/benchmark.h
+++ b/src/calf/benchmark.h
@@ -85,8 +85,13 @@ inline uint64_t rdtsc()
}
#endif
+struct benchmark_globals
+{
+ static bool warned;
+};
+
template<typename Target, class Stat>
-class simple_benchmark
+class simple_benchmark: public benchmark_globals
{
public:
Target target;
@@ -98,12 +103,16 @@ public:
{
}
- int measure(int runs, int repeats)
+ void measure(int runs, int repeats)
{
int priority = getpriority(PRIO_PROCESS, getpid());
stat.start(runs);
- if (setpriority(PRIO_PROCESS, getpid(), -20) < 0)
- fprintf(stderr, "Warning: could not set process priority, measurements can be worthless\n");
+ if (setpriority(PRIO_PROCESS, getpid(), -20) < 0) {
+ if (!warned) {
+ fprintf(stderr, "Warning: could not set process priority, measurements can be worthless\n");
+ warned = true;
+ }
+ }
for (int i = 0; i < runs; i++) {
target.prepare();
// XXXKF measuring CPU time with clock() sucks,
diff --git a/src/calf/biquad.h b/src/calf/biquad.h
index 4c13e28..2b747fb 100644
--- a/src/calf/biquad.h
+++ b/src/calf/biquad.h
@@ -229,17 +229,17 @@ public:
inline T process_d2_lp(T in)
{
T tmp = in - w1 * b1 - w2 * b2;
- T out = (tmp + w1 + w1 + w2) * a0;
+ T out = (tmp + w2 + w1* 2) * a0;
w2 = w1;
w1 = tmp;
return out;
}
- bool empty_d1() {
+ inline bool empty_d1() {
return (y1 == 0.f && y2 == 0.f);
}
- bool empty_d2() {
+ inline bool empty_d2() {
return (w1 == 0.f && w2 == 0.f);
}
diff --git a/src/calf/buffer.h b/src/calf/buffer.h
index 18cf101..b2a2fba 100644
--- a/src/calf/buffer.h
+++ b/src/calf/buffer.h
@@ -61,10 +61,10 @@ void fill(T *data, int size, T value) {
}
template<class T>
-void zero(T *data, int size) {
+void zero(T *data, unsigned int size) {
T value;
dsp::zero(value);
- for (int i=0; i<size; i++)
+ for (unsigned int i=0; i<size; i++)
*data++ = value;
}
diff --git a/src/calf/giface.h b/src/calf/giface.h
index 5a38774..84dc4e1 100644
--- a/src/calf/giface.h
+++ b/src/calf/giface.h
@@ -83,8 +83,8 @@ struct parameter_properties
struct midi_event {
uint8_t command;
uint8_t param1;
- uint8_t param2;
- uint8_t pad;
+ uint16_t param2;
+ float param3;
};
/// this is not a real class, just an empty example
@@ -97,8 +97,7 @@ public:
float **outs;
float **params;
void set_sample_rate(uint32_t sr);
- void handle_midi_event_now(midi_event event) {}
- void handle_param_event_now(uint32_t param, float value) {}
+ void handle_event(uint8_t *data, int len) {}
// all or most params changed
void params_changed() {}
uint32_t process_audio(uint32_t nsamples, uint32_t inputs_mask, uint32_t outputs_mask);
diff --git a/src/calf/modules.h b/src/calf/modules.h
index 7c355c4..f1410a2 100644
--- a/src/calf/modules.h
+++ b/src/calf/modules.h
@@ -18,8 +18,8 @@
* Free Software Foundation, Inc., 59 Temple Place, Suite 330,
* Boston, MA 02111-1307, USA.
*/
-#ifndef __CALF_AMP_H
-#define __CALF_AMP_H
+#ifndef __CALF_MODULES_H
+#define __CALF_MODULES_H
#include <assert.h>
#include "biquad.h"
@@ -62,6 +62,15 @@ public:
}
};
+inline void default_handle_event(uint8_t *data, int len, float *params[], unsigned int param_count)
+{
+ if (data[0] == 0x7F && len >= 8) {
+ midi_event *p = (midi_event *)data;
+ if (p->param2 < param_count)
+ *params[p->param2] = p->param3;
+ }
+}
+
class flanger_audio_module
{
public:
@@ -79,9 +88,8 @@ public:
left.setup(sr);
right.setup(sr);
}
- void handle_midi_event_now(synth::midi_event event) {
- }
- void handle_param_event_now(uint32_t param, float value) {
+ void handle_event(uint8_t *data, int len) {
+ default_handle_event(data, len, params, param_count);
}
void params_changed() {
float dry = 1.0;
@@ -134,9 +142,8 @@ public:
}
void deactivate() {
}
- void handle_midi_event_now(synth::midi_event event) {
- }
- void handle_param_event_now(uint32_t param, float value) {
+ void handle_event(uint8_t *data, int len) {
+ default_handle_event(data, len, params, param_count);
}
void set_sample_rate(uint32_t sr) {
srate = sr;
@@ -215,6 +222,7 @@ public:
calculate_filter();
}
void activate() {
+ calculate_filter();
for (int i=0; i < order; i++) {
left[i].reset();
right[i].reset();
@@ -224,9 +232,8 @@ public:
}
void deactivate() {
}
- void handle_midi_event_now(synth::midi_event event) {
- }
- void handle_param_event_now(uint32_t param, float value) {
+ void handle_event(uint8_t *data, int len) {
+ default_handle_event(data, len, params, param_count);
}
void set_sample_rate(uint32_t sr) {
srate = sr;
diff --git a/src/jackhost.cpp b/src/jackhost.cpp
index f6481f6..91e52a6 100644
--- a/src/jackhost.cpp
+++ b/src/jackhost.cpp
@@ -24,8 +24,11 @@
#include <jack/jack.h>
#include <calf/giface.h>
#include <calf/modules.h>
+#include <calf/modules_dev.h>
#include <gtk/gtk.h>
-#include <phat/phat.h>
+#if USE_PHAT
+#include <phat/phatknob.h>
+#endif
using namespace synth;
@@ -50,8 +53,12 @@ public:
jack_host_gui(GtkWidget *_toplevel);
void create(synth::jack_host_base *_host, const char *title);
- static void knob_value_changed(PhatKnob *widget, gpointer value);
+ static void hscale_value_changed(GtkHScale *widget, gpointer value);
static void combo_value_changed(GtkComboBox *widget, gpointer value);
+
+#if USE_PHAT
+ static void knob_value_changed(PhatKnob *widget, gpointer value);
+#endif
};
jack_host_gui::jack_host_gui(GtkWidget *_toplevel)
@@ -60,15 +67,14 @@ jack_host_gui::jack_host_gui(GtkWidget *_toplevel)
}
-void jack_host_gui::knob_value_changed(PhatKnob *widget, gpointer value)
+void jack_host_gui::hscale_value_changed(GtkHScale *widget, gpointer value)
{
jack_host_param *jhp = (jack_host_param *)value;
jack_host_base &jh = *jhp->gui->host;
const parameter_properties &props = jh.get_param_props()[jhp->param_no];
int nparam = jhp->param_no;
- float cvalue = props.from_01 (phat_knob_get_value (widget));
+ float cvalue = props.from_01 (gtk_range_get_value (GTK_RANGE (widget)));
jh.get_params()[nparam] = cvalue;
- // printf("%d -> %f\n", nparam, cvalue);
jh.set_params();
gtk_label_set_text (GTK_LABEL (jhp->label), props.to_string(cvalue).c_str());
}
@@ -82,6 +88,21 @@ void jack_host_gui::combo_value_changed(GtkComboBox *widget, gpointer value)
jh.set_params();
}
+#if USE_PHAT
+void jack_host_gui::knob_value_changed(PhatKnob *widget, gpointer value)
+{
+ jack_host_param *jhp = (jack_host_param *)value;
+ jack_host_base &jh = *jhp->gui->host;
+ const parameter_properties &props = jh.get_param_props()[jhp->param_no];
+ int nparam = jhp->param_no;
+ float cvalue = props.from_01 (phat_knob_get_value (widget));
+ jh.get_params()[nparam] = cvalue;
+ // printf("%d -> %f\n", nparam, cvalue);
+ jh.set_params();
+ gtk_label_set_text (GTK_LABEL (jhp->label), props.to_string(cvalue).c_str());
+}
+#endif
+
void jack_host_gui::create(synth::jack_host_base *_host, const char *title)
{
host = _host;
@@ -97,12 +118,12 @@ void jack_host_gui::create(synth::jack_host_base *_host, const char *title)
GtkWidget *title_label = gtk_label_new ("");
gtk_label_set_markup (GTK_LABEL (title_label), (string("<b>")+title+"</b>").c_str());
- gtk_table_attach (GTK_TABLE (table), title_label, 0, 3, 0, 1, GTK_EXPAND, GTK_EXPAND, 2, 2);
+ gtk_table_attach (GTK_TABLE (table), title_label, 0, 3, 0, 1, GTK_EXPAND, GTK_SHRINK, 2, 2);
for (int i = 0; i < param_count; i++) {
GtkWidget *label = gtk_label_new (host->get_param_names()[host->get_input_count() + host->get_output_count() + i]);
gtk_misc_set_alignment (GTK_MISC (label), 1.0, 0.5);
- gtk_table_attach (GTK_TABLE (table), label, 0, 1, i + 1, i + 2, GTK_FILL, GTK_EXPAND, 2, 2);
+ gtk_table_attach (GTK_TABLE (table), label, 0, 1, i + 1, i + 2, GTK_FILL, GTK_SHRINK, 2, 2);
parameter_properties &props = host->get_param_props()[i];
@@ -116,23 +137,36 @@ void jack_host_gui::create(synth::jack_host_base *_host, const char *title)
gtk_combo_box_append_text (GTK_COMBO_BOX (widget), props.choices[j]);
gtk_combo_box_set_active (GTK_COMBO_BOX (widget), (int)host->get_params()[i] - (int)props.min);
gtk_signal_connect (GTK_OBJECT (widget), "changed", G_CALLBACK (combo_value_changed), (gpointer)¶ms[i]);
- gtk_table_attach (GTK_TABLE (table), widget, 1, 3, i + 1, i + 2, GTK_EXPAND, GTK_EXPAND, 0, 0);
+ gtk_table_attach (GTK_TABLE (table), widget, 1, 3, i + 1, i + 2, GTK_EXPAND, GTK_SHRINK, 0, 0);
}
else
{
+#if USE_PHAT
GtkWidget *knob = phat_knob_new_with_range (host->get_param_props()[i].to_01 (host->get_params()[i]), 0, 1, 0.01);
gtk_signal_connect (GTK_OBJECT (knob), "value-changed", G_CALLBACK (knob_value_changed), (gpointer)¶ms[i]);
- gtk_table_attach (GTK_TABLE (table), knob, 1, 2, i + 1, i + 2, GTK_EXPAND, GTK_EXPAND, 0, 0);
+ gtk_table_attach (GTK_TABLE (table), knob, 1, 2, i + 1, i + 2, GTK_SHRINK, GTK_SHRINK, 0, 0);
+#else
+ GtkWidget *knob = gtk_hscale_new_with_range (0, 1, 0.01);
+ gtk_signal_connect (GTK_OBJECT (knob), "value-changed", G_CALLBACK (hscale_value_changed), (gpointer)¶ms[i]);
+ gtk_widget_set_size_request (knob, 200, -1);
+ gtk_table_attach (GTK_TABLE (table), knob, 1, 2, i + 1, i + 2, (GtkAttachOptions)(GTK_EXPAND | GTK_FILL), GTK_SHRINK, 0, 0);
+#endif
widget = gtk_label_new ("");
gtk_label_set_width_chars (GTK_LABEL (widget), 12);
gtk_misc_set_alignment (GTK_MISC (widget), 0.0, 0.5);
- gtk_table_attach (GTK_TABLE (table), widget, 2, 3, i + 1, i + 2, GTK_FILL, GTK_EXPAND, 0, 0);
+ gtk_table_attach (GTK_TABLE (table), widget, 2, 3, i + 1, i + 2, (GtkAttachOptions)(GTK_SHRINK | GTK_FILL), GTK_SHRINK, 0, 0);
params[i].label = widget;
// gtk_widget_set_size_request (widget, widget->allocation.width, widget->allocation.height);
// gtk_widget_set_size_request (widget, 100, 10);
+#if USE_PHAT
knob_value_changed (PHAT_KNOB (knob), (gpointer)¶ms[i]);
+#else
+ gtk_range_set_value (GTK_RANGE (knob), host->get_param_props()[i].to_01 (host->get_params()[i]));
+ gtk_scale_set_draw_value (GTK_SCALE (knob), false);
+ hscale_value_changed (GTK_HSCALE (knob), (gpointer)¶ms[i]);
+#endif
}
}
gtk_container_add (GTK_CONTAINER (toplevel), table);
@@ -217,7 +251,7 @@ int main(int argc, char *argv[])
else if (!strcmp(effect_name, "filter"))
jh = new jack_host<filter_audio_module>();
else {
- fprintf(stderr, "Unknown filter name; allowed are: reverb, flanger, filter\n");
+ fprintf(stderr, "Unknown filter name; allowed are: reverb, fastverb, flanger, filter\n");
return 1;
}
jh->open(client_name, input_name, output_name);
diff --git a/src/modules.cpp b/src/modules.cpp
index bd55a3c..a25dcee 100644
--- a/src/modules.cpp
+++ b/src/modules.cpp
@@ -25,6 +25,7 @@
#endif
#include <calf/giface.h>
#include <calf/modules.h>
+#include <calf/modules_dev.h>
using namespace synth;
--
calf audio plugins packaging
More information about the pkg-multimedia-commits
mailing list