summaryrefslogtreecommitdiff
path: root/muse2/plugins/pandelay/pandelay.cpp
diff options
context:
space:
mode:
authorRobert Jonsson <spamatica@gmail.com>2010-10-13 19:34:22 +0000
committerRobert Jonsson <spamatica@gmail.com>2010-10-13 19:34:22 +0000
commit8a2c2824a59d7644e13bc52c9a0ecbd641f21f95 (patch)
tree064ad3f2bf8daab0ad27b128abd86a9bbdb1e496 /muse2/plugins/pandelay/pandelay.cpp
parenta27706d9629e8b592cca4659f865b70adef24e6d (diff)
new branch muse2, first checkin
Diffstat (limited to 'muse2/plugins/pandelay/pandelay.cpp')
-rw-r--r--muse2/plugins/pandelay/pandelay.cpp170
1 files changed, 170 insertions, 0 deletions
diff --git a/muse2/plugins/pandelay/pandelay.cpp b/muse2/plugins/pandelay/pandelay.cpp
new file mode 100644
index 00000000..18ce1a41
--- /dev/null
+++ b/muse2/plugins/pandelay/pandelay.cpp
@@ -0,0 +1,170 @@
+//=========================================================
+// PanDelay for MusE
+//
+// (C) Copyright 2006 Nil Geisweiller
+//=========================================================
+
+#include "ladspapandelay.h"
+#include <stdio.h>
+
+//---------------------------------------------------------
+// instantiate pandelay
+// Construct a new plugin instance.
+//---------------------------------------------------------
+
+LADSPA_Handle instantiate(const LADSPA_Descriptor* /*Descriptor*/,
+ unsigned long samplerate)
+{
+ return new LADSPAPanDelay(samplerate);
+}
+
+//---------------------------------------------------------
+// connect PortTo pandelay
+// Connect a port to a data location.
+//---------------------------------------------------------
+
+void connect(LADSPA_Handle Instance, unsigned long port,
+ LADSPA_Data* data)
+{
+ ((LADSPAPanDelay*)Instance)->port[port] = data;
+}
+
+//---------------------------------------------------------
+// activate
+//---------------------------------------------------------
+
+void activate(LADSPA_Handle instance)
+{
+ ((LADSPAPanDelay*)instance)->activate();
+}
+
+//---------------------------------------------------------
+// deactivate
+//---------------------------------------------------------
+
+void deactivate(LADSPA_Handle /*Instance*/)
+{
+}
+
+//---------------------------------------------------------
+// run pandelay
+//---------------------------------------------------------
+
+void run(LADSPA_Handle Instance, unsigned long n)
+{
+ ((LADSPAPanDelay*)Instance)->processReplace(n);
+}
+
+//---------------------------------------------------------
+// runAdding pandelay
+// *ADD* the output to the output buffer.
+//---------------------------------------------------------
+
+void runAdding(LADSPA_Handle Instance, unsigned long n)
+{
+ ((LADSPAPanDelay*)Instance)->processMix(n);
+}
+
+//---------------------------------------------------------
+// set pandelay RunAddingGain
+//---------------------------------------------------------
+
+void setGain(LADSPA_Handle /*Instance*/, LADSPA_Data /*Gain*/)
+{
+ printf("TEST setGain\n");
+ // ((LADSPAPanDelay*)Instance)->m_fRunAddingGain = Gain;
+}
+
+//---------------------------------------------------------
+// cleanup pandelay
+//---------------------------------------------------------
+
+void cleanup(LADSPA_Handle Instance)
+{
+ delete (LADSPAPanDelay*)Instance;
+}
+
+static const char* portNames[] = {
+ "Input (Left)",
+ "Input (Right)",
+ "Output (Left)",
+ "Output (Right)",
+ "BMP",
+ "Beat Ratio",
+ "Feedback",
+ "Pan LFO Freq",
+ "Pan LFO Depth",
+ "Dry/Wet"
+};
+
+LADSPA_PortDescriptor portDescriptors[] = {
+ LADSPA_PORT_INPUT | LADSPA_PORT_AUDIO,
+ LADSPA_PORT_INPUT | LADSPA_PORT_AUDIO,
+ LADSPA_PORT_OUTPUT | LADSPA_PORT_AUDIO,
+ LADSPA_PORT_OUTPUT | LADSPA_PORT_AUDIO,
+ LADSPA_PORT_INPUT | LADSPA_PORT_CONTROL,
+ LADSPA_PORT_INPUT | LADSPA_PORT_CONTROL,
+ LADSPA_PORT_INPUT | LADSPA_PORT_CONTROL,
+ LADSPA_PORT_INPUT | LADSPA_PORT_CONTROL,
+ LADSPA_PORT_INPUT | LADSPA_PORT_CONTROL,
+ LADSPA_PORT_INPUT | LADSPA_PORT_CONTROL
+};
+
+LADSPA_PortRangeHint portRangeHints[] = {
+ { 0, 0.0, 0.0 },
+ { 0, 0.0, 0.0 },
+ { 0, 0.0, 0.0 },
+ { 0, 0.0, 0.0 },
+ { LADSPA_HINT_BOUNDED_ABOVE | LADSPA_HINT_BOUNDED_BELOW | LADSPA_HINT_DEFAULT_100, MINBPM, MAXBPM },
+ { LADSPA_HINT_BOUNDED_ABOVE | LADSPA_HINT_BOUNDED_BELOW | LADSPA_HINT_DEFAULT_1, MINBEATRATIO, MAXBEATRATIO },
+ { LADSPA_HINT_BOUNDED_ABOVE | LADSPA_HINT_BOUNDED_BELOW | LADSPA_HINT_DEFAULT_HIGH, -1.0, 1.0 },
+ { LADSPA_HINT_BOUNDED_ABOVE | LADSPA_HINT_BOUNDED_BELOW | LADSPA_HINT_LOGARITHMIC | LADSPA_HINT_DEFAULT_HIGH, MINFREQ, MAXFREQ },
+ { LADSPA_HINT_BOUNDED_ABOVE | LADSPA_HINT_BOUNDED_BELOW | LADSPA_HINT_DEFAULT_HIGH, 0.0, 1.0 },
+ { LADSPA_HINT_BOUNDED_ABOVE | LADSPA_HINT_BOUNDED_BELOW | LADSPA_HINT_DEFAULT_MIDDLE, 0.0, 1.0 }
+};
+
+LADSPA_Descriptor descriptor = {
+ 1052,
+ "pandelay",
+ LADSPA_PROPERTY_HARD_RT_CAPABLE,
+ "PanDelay",
+ "Nil Geisweiller",
+ "GPL",
+ NBRPARAM + 4,
+ portDescriptors,
+ portNames,
+ portRangeHints,
+ 0, // impl. data
+ instantiate,
+ connect,
+ activate,
+ run,
+ runAdding,
+ setGain,
+ deactivate,
+ cleanup
+};
+
+//---------------------------------------------------------
+// _init
+// called automatically when the plugin library is first
+// loaded.
+//---------------------------------------------------------
+void _init() {
+}
+
+//---------------------------------------------------------
+// _fini
+// called automatically when the library is unloaded.
+//---------------------------------------------------------
+void _fini() {
+}
+
+//---------------------------------------------------------
+// ladspa_descriptor
+// Return a descriptor of the requested plugin type.
+//---------------------------------------------------------
+const LADSPA_Descriptor* ladspa_descriptor(unsigned long i) {
+ return (i == 0) ? &descriptor : 0;
+}
+