[SCM] calf/master: Fix restore of LV2 Monosynth. Untested.
js at users.alioth.debian.org
js at users.alioth.debian.org
Tue May 7 15:40:33 UTC 2013
The following commit has been merged in the master branch:
commit 719ee503258f938e5cd8137fa676541d994f828a
Author: Krzysztof Foltman <wdev at foltman.com>
Date: Thu Dec 30 18:19:59 2010 +0000
Fix restore of LV2 Monosynth. Untested.
Previously, Monosynth didn't have a correct implementation of
get_configure_vars, and so it didn't know which variables it has to
restore. The current implementation should work for all modulation
matrices in future.
diff --git a/src/calf/metadata.h b/src/calf/metadata.h
index ecf84e3..75505e4 100644
--- a/src/calf/metadata.h
+++ b/src/calf/metadata.h
@@ -150,6 +150,7 @@ struct monosynth_metadata: public plugin_metadata<monosynth_metadata>
monosynth_metadata();
/// Lookup of table edit interface
virtual const table_metadata_iface *get_table_metadata_iface(const char *key) const { if (!strcmp(key, "mod_matrix")) return &mm_metadata; else return NULL; }
+ const char *const *get_configure_vars() const;
};
/// Thor's compressor - metadata
diff --git a/src/calf/modmatrix.h b/src/calf/modmatrix.h
index d66c323..08b44cd 100644
--- a/src/calf/modmatrix.h
+++ b/src/calf/modmatrix.h
@@ -22,6 +22,7 @@
#define __CALF_MODMATRIX_H
#include "giface.h"
+#include <stdio.h>
namespace dsp {
@@ -88,6 +89,32 @@ public:
void send_configures(send_configure_iface *);
char *configure(const char *key, const char *value);
+ /// Return a list of configure variables used by the modulation matrix
+ template<int rows>
+ static const char **get_configure_vars()
+ {
+ static std::vector<std::string> names_vector;
+ static const char *names[rows * 5 + 1];
+
+ if (names[0] == NULL)
+ {
+ for (int i = 0; i < rows; i++)
+ {
+ for (int j = 0; j < 5; j++)
+ {
+ char buf[40];
+ sprintf(buf, "mod_matrix:%d,%d", i, j);
+ names_vector.push_back(buf);
+ }
+ }
+ for (size_t i = 0; i < names_vector.size(); i++)
+ names[i] = names_vector[i].c_str();
+ names[names_vector.size()] = NULL;
+ }
+
+ return names;
+ }
+
private:
std::string get_cell(int row, int column) const;
void set_cell(int row, int column, const std::string &src, std::string &error);
diff --git a/src/fluidsynth.cpp b/src/fluidsynth.cpp
index bd4dc4d..cf0dca8 100644
--- a/src/fluidsynth.cpp
+++ b/src/fluidsynth.cpp
@@ -196,6 +196,7 @@ char *fluidsynth_audio_module::configure(const char *key, const char *value)
void fluidsynth_audio_module::send_configures(send_configure_iface *sci)
{
sci->send_configure("soundfont", soundfont.c_str());
+ sci->send_configure("preset_key_set", calf_utils::i2s(last_selected_preset).c_str());
}
int fluidsynth_audio_module::send_status_updates(send_updates_iface *sui, int last_serial)
diff --git a/src/metadata.cpp b/src/metadata.cpp
index 2a76fc5..5bd37eb 100644
--- a/src/metadata.cpp
+++ b/src/metadata.cpp
@@ -22,6 +22,7 @@
#include <calf/giface.h>
#include <calf/metadata.h>
#include <calf/audio_fx.h>
+#include <calf/modmatrix.h>
using namespace dsp;
using namespace calf_plugins;
@@ -808,6 +809,11 @@ monosynth_metadata::monosynth_metadata()
{
}
+const char *const *monosynth_metadata::get_configure_vars() const
+{
+ return mod_matrix_impl::get_configure_vars<mod_matrix_slots>();
+}
+
////////////////////////////////////////////////////////////////////////////
CALF_PLUGIN_INFO(organ) = { 0x8481, "Organ", "Calf Organ", "Krzysztof Foltman", calf_plugins::calf_copyright_info, "SynthesizerPlugin" };
diff --git a/src/modmatrix.cpp b/src/modmatrix.cpp
index 670051b..0a320c2 100644
--- a/src/modmatrix.cpp
+++ b/src/modmatrix.cpp
@@ -134,6 +134,17 @@ char *mod_matrix_impl::configure(const char *key, const char *value)
if (row != -1 && column != -1)
{
string error;
+ string value_text;
+ if (value == NULL)
+ {
+ const table_column_info &ci = metadata->get_table_columns()[column];
+ if (ci.type == TCT_ENUM)
+ value_text = ci.values[(int)ci.def_value];
+ else
+ if (ci.type == TCT_FLOAT)
+ value_text = f2s(ci.def_value);
+ value = value_text.c_str();
+ }
set_cell(row, column, value, error);
if (!error.empty())
return strdup(error.c_str());
--
calf audio plugins packaging
More information about the pkg-multimedia-commits
mailing list