summaryrefslogtreecommitdiff
path: root/plugins/dsp_libsrc
diff options
context:
space:
mode:
authorGravatar waker <wakeroid@gmail.com>2010-12-27 17:46:53 +0100
committerGravatar waker <wakeroid@gmail.com>2010-12-27 17:46:53 +0100
commit8990244b8aff1ed931bc49a419b9d729887702c1 (patch)
treed60ef6738d94d578a63464c3fe734d8ceb004d47 /plugins/dsp_libsrc
parent105a5af47b396941781adf422511b2b7e899f56a (diff)
improved gui script:
added support for spinbtn and combobox changed API to allow generic use (e.g. for dsp plugins) dsp set/get_param are now using strings instead of floats dsp plugins are now using gui script fixed many errors in converter and its gui supereq set/get_param now uses dBs instead of amplitude
Diffstat (limited to 'plugins/dsp_libsrc')
-rw-r--r--plugins/dsp_libsrc/src.c22
1 files changed, 15 insertions, 7 deletions
diff --git a/plugins/dsp_libsrc/src.c b/plugins/dsp_libsrc/src.c
index 432bf871..fdb96d14 100644
--- a/plugins/dsp_libsrc/src.c
+++ b/plugins/dsp_libsrc/src.c
@@ -197,13 +197,13 @@ ddb_src_get_param_name (int p) {
}
}
void
-ddb_src_set_param (ddb_dsp_context_t *ctx, int p, float val) {
+ddb_src_set_param (ddb_dsp_context_t *ctx, int p, const char *val) {
switch (p) {
case SRC_PARAM_SAMPLERATE:
- ((ddb_src_libsamplerate_t*)ctx)->samplerate = val;
+ ((ddb_src_libsamplerate_t*)ctx)->samplerate = atof (val);
break;
case SRC_PARAM_QUALITY:
- ((ddb_src_libsamplerate_t*)ctx)->quality = val;
+ ((ddb_src_libsamplerate_t*)ctx)->quality = atoi (val);
((ddb_src_libsamplerate_t*)ctx)->quality_changed = 1;
break;
default:
@@ -211,18 +211,25 @@ ddb_src_set_param (ddb_dsp_context_t *ctx, int p, float val) {
}
}
-float
-ddb_src_get_param (ddb_dsp_context_t *ctx, int p) {
+void
+ddb_src_get_param (ddb_dsp_context_t *ctx, int p, char *val, int sz) {
switch (p) {
case SRC_PARAM_SAMPLERATE:
- return ((ddb_src_libsamplerate_t*)ctx)->samplerate;
+ snprintf (val, sz, "%f", ((ddb_src_libsamplerate_t*)ctx)->samplerate);
+ break;
case SRC_PARAM_QUALITY:
- return ((ddb_src_libsamplerate_t*)ctx)->quality;
+ snprintf (val, sz, "%d", ((ddb_src_libsamplerate_t*)ctx)->quality);
+ break;
default:
fprintf (stderr, "ddb_src_get_param: invalid param index (%d)\n", p);
}
}
+static const char settings_dlg[] =
+ "property \"Target Samplerate\" spinbtn[8192,192000,1] 0 48000;\n"
+ "property \"Quality / Algorythm\" select[5] 1 2 SINC_BEST_QUALITY SINC_MEDIUM_QUALITY SINC_FASTEST ZERO_ORDER_HOLD LINEAR;\n"
+;
+
static DB_dsp_t plugin = {
.plugin.api_vmajor = DB_API_VERSION_MAJOR,
.plugin.api_vminor = DB_API_VERSION_MINOR,
@@ -243,6 +250,7 @@ static DB_dsp_t plugin = {
.set_param = ddb_src_set_param,
.get_param = ddb_src_get_param,
.reset = ddb_src_reset,
+ .configdialog = settings_dlg,
};
DB_plugin_t *