comparison flattendynamics-ladspa.cpp @ 0:7632b9bf0cff

Initial stub plugin commit
author Chris Cannam
date Thu, 17 Jul 2014 12:16:02 +0100
parents
children f21753c504e1
comparison
equal deleted inserted replaced
-1:000000000000 0:7632b9bf0cff
1 /* -*- c-basic-offset: 4 indent-tabs-mode: nil -*- vi:set ts=8 sts=4 sw=4: */
2
3 #include "flattendynamics-ladspa.h"
4
5 #include <alloca.h>
6 #include <iostream>
7 #include <cmath>
8
9 const char *const
10 FlattenDynamics::portNames[PortCount] =
11 {
12 "Input",
13 "Output",
14 };
15
16 const LADSPA_PortDescriptor
17 FlattenDynamics::ports[PortCount] =
18 {
19 LADSPA_PORT_INPUT | LADSPA_PORT_AUDIO,
20 LADSPA_PORT_OUTPUT | LADSPA_PORT_AUDIO,
21 };
22
23 const LADSPA_PortRangeHint
24 FlattenDynamics::hints[PortCount] =
25 {
26 { 0, 0, 0 },
27 { 0, 0, 0 },
28 };
29
30 const LADSPA_Properties
31 FlattenDynamics::properties = LADSPA_PROPERTY_HARD_RT_CAPABLE;
32
33 const LADSPA_Descriptor
34 FlattenDynamics::ladspaDescriptor =
35 {
36 0xf0b375, // "Unique" ID
37 "flattendynamics", // Label
38 properties,
39 "FlattenDynamics", // Name
40 "Queen Mary, University of London", // Maker
41 "BSD", // Copyright
42 PortCount,
43 ports,
44 portNames,
45 hints,
46 0, // Implementation data
47 instantiate,
48 connectPort,
49 activate,
50 run,
51 0, // Run adding
52 0, // Set run adding gain
53 deactivate,
54 cleanup
55 };
56
57 const LADSPA_Descriptor *
58 FlattenDynamics::getDescriptor(unsigned long index)
59 {
60 if (index == 0) return &ladspaDescriptor;
61 return 0;
62 }
63
64 FlattenDynamics::FlattenDynamics(int sampleRate) :
65 m_sampleRate(sampleRate),
66 m_input(0),
67 m_output(0)
68 {
69 reset();
70 }
71
72 FlattenDynamics::~FlattenDynamics()
73 {
74 }
75
76 LADSPA_Handle
77 FlattenDynamics::instantiate(const LADSPA_Descriptor *, unsigned long rate)
78 {
79 FlattenDynamics *flatten = new FlattenDynamics(rate);
80 return flatten;
81 }
82
83 void
84 FlattenDynamics::connectPort(LADSPA_Handle handle,
85 unsigned long port, LADSPA_Data *location)
86 {
87 FlattenDynamics *flatten = (FlattenDynamics *)handle;
88
89 float **ports[PortCount] = {
90 &flatten->m_input,
91 &flatten->m_output,
92 };
93
94 *ports[port] = (float *)location;
95 }
96
97 void
98 FlattenDynamics::activate(LADSPA_Handle handle)
99 {
100 FlattenDynamics *flatten = (FlattenDynamics *)handle;
101 flatten->reset();
102 }
103
104 void
105 FlattenDynamics::run(LADSPA_Handle handle, unsigned long samples)
106 {
107 FlattenDynamics *flatten = (FlattenDynamics *)handle;
108 flatten->runImpl(samples);
109 }
110
111 void
112 FlattenDynamics::deactivate(LADSPA_Handle handle)
113 {
114 activate(handle); // both functions just reset the plugin
115 }
116
117 void
118 FlattenDynamics::cleanup(LADSPA_Handle handle)
119 {
120 delete (FlattenDynamics *)handle;
121 }
122
123 void
124 FlattenDynamics::reset()
125 {
126 }
127
128 void
129 FlattenDynamics::updateParameters()
130 {
131 }
132
133 void
134 FlattenDynamics::runImpl(unsigned long sampleCount)
135 {
136 if (!m_input || !m_output) return;
137 updateParameters();
138
139 int ii = 0;
140 int oi = 0;
141 const int sc = sampleCount;
142
143 while (ii < sc) {
144 //!!!
145 }
146 }
147
148 const LADSPA_Descriptor *
149 ladspa_descriptor(unsigned long ix)
150 {
151 return FlattenDynamics::getDescriptor(ix);
152 }
153