[SCM] calf/master: + Mod Matrix: clean up the previous patch
js at users.alioth.debian.org
js at users.alioth.debian.org
Tue May 7 15:39:34 UTC 2013
The following commit has been merged in the master branch:
commit c7dbd2a2a8ecfd147b2f0ec8f0c047f5f106519b
Author: Krzysztof Foltman <wdev at foltman.com>
Date: Sat May 23 23:22:21 2009 +0100
+ Mod Matrix: clean up the previous patch
diff --git a/src/calf/modmatrix.h b/src/calf/modmatrix.h
index 96f7d16..fa80654 100644
--- a/src/calf/modmatrix.h
+++ b/src/calf/modmatrix.h
@@ -25,12 +25,34 @@
namespace dsp {
+/// Modulation modes
+enum modulation_mode {
+ mod_positive, ///< 0..100%
+ mod_bipolar, ///< -100%..100%
+ mod_negative, ///< -100%..0%
+ mod_squared, ///< x^2
+ mod_squared_bipolar, ///< x^2 scaled to -100%..100%
+ mod_antisquared, ///< 1-(1-x)^2 scaled to 0..100%
+ mod_antisquared_bipolar, ///< 1-(1-x)^2 scaled to -100..100%
+ mod_parabola, ///< inverted parabola (peaks at 0.5, then decreases to 0)
+ mod_type_count
+};
+
struct modulation_entry
{
+ /// Sources
int src1, src2;
- int mapping;
+ modulation_mode mapping;
float amount;
int dest;
+
+ void reset() {
+ src1 = 0;
+ src2 = 0;
+ mapping = mod_positive;
+ amount = 0.f;
+ dest = 0;
+ }
};
};
@@ -40,9 +62,8 @@ namespace calf_plugins {
class mod_matrix: public table_edit_iface
{
protected:
- enum modulation_mode { mod_positive, mod_bipolar, mod_negative, mod_squared, mod_squared_bipolar, mod_antisquared, mod_antisquared_bipolar, mod_parabola, mod_type_count };
/// Polynomials for different scaling modes (1, x, x^2)
- static const float scaling_coeffs[mod_type_count][3];
+ static const float scaling_coeffs[dsp::mod_type_count][3];
/// Column descriptions for table widget
table_column_info table_columns[6];
diff --git a/src/modmatrix.cpp b/src/modmatrix.cpp
index 85569a6..518e57c 100644
--- a/src/modmatrix.cpp
+++ b/src/modmatrix.cpp
@@ -28,7 +28,7 @@ using namespace calf_plugins;
const char *mod_mapping_names[] = { "0..1", "-1..1", "-1..0", "x^2", "2x^2-1", "ASqr", "ASqrBip", "Para", NULL };
-const float mod_matrix::scaling_coeffs[mod_matrix::mod_type_count][3] = {
+const float mod_matrix::scaling_coeffs[dsp::mod_type_count][3] = {
{ 0, 1, 0 },
{ -1, 2, 0 },
{ -1, 1, 0 },
@@ -55,6 +55,8 @@ mod_matrix::mod_matrix(modulation_entry *_matrix, unsigned int _rows, const char
};
assert(sizeof(table_columns) == sizeof(tci));
memcpy(table_columns, tci, sizeof(table_columns));
+ for (unsigned int i = 0; i < matrix_rows; i++)
+ matrix[i].reset();
}
const table_column_info *mod_matrix::get_table_columns(int param)
@@ -112,7 +114,7 @@ void mod_matrix::set_cell(int param, int row, int column, const std::string &src
else if (column == 1)
slot.src2 = i;
else if (column == 2)
- slot.mapping = i;
+ slot.mapping = (modulation_mode)i;
else if (column == 4)
slot.dest = i;
error.clear();
diff --git a/src/monosynth.cpp b/src/monosynth.cpp
index db62a39..d847386 100644
--- a/src/monosynth.cpp
+++ b/src/monosynth.cpp
@@ -66,11 +66,7 @@ monosynth_audio_module::monosynth_audio_module()
for (int i = 0; i < mod_matrix_slots; i++)
{
dsp::modulation_entry &slot = mod_matrix_data[i];
- slot.src1 = modsrc_none;
- slot.src2 = modsrc_none;
- slot.mapping = mod_matrix::mod_positive;
- slot.amount = 0.f;
- slot.dest = moddest_none;
+ slot.reset();
}
}
--
calf audio plugins packaging
More information about the pkg-multimedia-commits
mailing list