[SCM] calf/master: + Framework: make control outputs work again (oops... hurried refactoring without enough testing is never working properly) + Small modules: added a 74121/74123-like timer plugin (edge-triggered trigger, level triggered reset, settable time, configurable retriggerability, "running" level output, "finished" edge output, normalized progress output)
js at users.alioth.debian.org
js at users.alioth.debian.org
Tue May 7 15:37:40 UTC 2013
The following commit has been merged in the master branch:
commit d8c843177ad6f71a83a16d62259afa6b6d97310e
Author: kfoltman <kfoltman at 78b06b96-2940-0410-b7fc-879d825d01d8>
Date: Tue Sep 30 21:51:42 2008 +0000
+ Framework: make control outputs work again (oops... hurried refactoring without enough testing is never working properly)
+ Small modules: added a 74121/74123-like timer plugin (edge-triggered trigger, level triggered reset, settable time, configurable retriggerability, "running" level output, "finished" edge output, normalized progress output)
git-svn-id: https://calf.svn.sourceforge.net/svnroot/calf/trunk@313 78b06b96-2940-0410-b7fc-879d825d01d8
diff --git a/src/calf/modulelist.h b/src/calf/modulelist.h
index 4ed537c..5d2bcee 100644
--- a/src/calf/modulelist.h
+++ b/src/calf/modulelist.h
@@ -48,6 +48,7 @@
PER_SMALL_MODULE_ITEM(between_c, "between_c")
PER_SMALL_MODULE_ITEM(less_c, "less_c")
PER_SMALL_MODULE_ITEM(clip_c, "clip_c")
+ PER_SMALL_MODULE_ITEM(timer_c, "timer_c")
#endif
#undef PER_MODULE_ITEM
#undef PER_SMALL_MODULE_ITEM
diff --git a/src/makerdf.cpp b/src/makerdf.cpp
index 7952326..72b196d 100644
--- a/src/makerdf.cpp
+++ b/src/makerdf.cpp
@@ -237,7 +237,7 @@ struct lv2_port_impl: public base_iface, public base_data
struct lv2_control_port_base: public lv2_port_base
{
- bool is_input, is_log, is_toggle, is_trigger, is_integer;
+ bool is_log, is_toggle, is_trigger, is_integer;
double min, max, def_value;
bool has_min, has_max;
diff --git a/src/modules_small.cpp b/src/modules_small.cpp
index 5ef354f..112d9ec 100644
--- a/src/modules_small.cpp
+++ b/src/modules_small.cpp
@@ -438,6 +438,73 @@ public:
}
};
+/// Monostable multivibrator like 74121 or 74123, with reset input, progress output (0 to 1), "finished" signal, configurable to allow or forbid retriggering.
+class timer_c_audio_module: public null_small_audio_module
+{
+public:
+ enum { in_trigger, in_time, in_reset, in_allow_retrig, in_count };
+ enum { out_running, out_finished, out_progress, out_count };
+ float *ins[in_count];
+ float *outs[out_count];
+ bool running, finished, old_trigger;
+ double state;
+
+ void activate()
+ {
+ state = 0.f;
+ running = false;
+ finished = false;
+ old_trigger = false;
+ }
+ static void plugin_info(plugin_info_iface *pii)
+ {
+ pii->names("timer_c", "Timer (C)", "lv2:UtilityPlugin");
+ pii->control_port("trigger", "Trigger", 0.f).input().toggle().trigger();
+ pii->control_port("time", "Time", 0.f).input();
+ pii->control_port("reset", "Reset", 0).input().toggle();
+ pii->control_port("allow_retrig", "Allow retrig", 0).input().toggle();
+ pii->control_port("running", "Running", 0.f).output().toggle();
+ pii->control_port("finished", "Finished", 0.f).output().toggle();
+ pii->control_port("progress", "Progress", 0.f).output().lin_range(0, 1);
+ }
+ void process(uint32_t count)
+ {
+ // This is a branch city, which is definitely a bad thing.
+ // Perhaps I'll add a bunch of __builtin_expect hints some day, but somebody would have to start using it first.
+ if (*ins[in_reset] > 0)
+ {
+ state = 0.0;
+ running = finished = false;
+ }
+ else
+ if (!old_trigger && *ins[in_trigger] > 0 && (!running || *ins[in_allow_retrig] > 0))
+ {
+ state = 0.0;
+ running = true;
+ finished = false;
+ }
+ else
+ if (running)
+ {
+ float rate = (1.0 / std::max(0.0000001f, *ins[in_time]));
+ state += rate * odsr * count;
+ if (state >= 1.0)
+ {
+ running = false;
+ finished = true;
+ state = 1.0;
+ }
+ }
+ old_trigger = *ins[in_trigger] > 0;
+ *outs[out_running] = running ? 1.f : 0.f;
+ *outs[out_finished] = finished ? 1.f : 0.f;
+ *outs[out_progress] = state;
+ }
+};
+
+
+
+/// Linear-to-exponential mapper
class map_lin2exp_audio_module: public null_small_audio_module
{
public:
--
calf audio plugins packaging
More information about the pkg-multimedia-commits
mailing list