comparison plugin/LADSPAPluginFactory.cpp @ 1039:b14064bd1f97 cxx11

This code now compiles. Main problem: sample rate types
author Chris Cannam
date Tue, 03 Mar 2015 17:09:19 +0000
parents 7aa9088e9bcd
children a1cd5abcb38b
comparison
equal deleted inserted replaced
1038:cc27f35aa75c 1039:b14064bd1f97
102 102
103 } 103 }
104 104
105 list.push_back(QString("%1").arg(descriptor->PortCount)); 105 list.push_back(QString("%1").arg(descriptor->PortCount));
106 106
107 for (unsigned long p = 0; p < descriptor->PortCount; ++p) { 107 for (int p = 0; p < (int)descriptor->PortCount; ++p) {
108 108
109 int type = 0; 109 int type = 0;
110 if (LADSPA_IS_PORT_CONTROL(descriptor->PortDescriptors[p])) { 110 if (LADSPA_IS_PORT_CONTROL(descriptor->PortDescriptors[p])) {
111 type |= PortType::Control; 111 type |= PortType::Control;
112 } else { 112 } else {
148 LADSPAPluginFactory::getPortMinimum(const LADSPA_Descriptor *descriptor, int port) 148 LADSPAPluginFactory::getPortMinimum(const LADSPA_Descriptor *descriptor, int port)
149 { 149 {
150 LADSPA_PortRangeHintDescriptor d = 150 LADSPA_PortRangeHintDescriptor d =
151 descriptor->PortRangeHints[port].HintDescriptor; 151 descriptor->PortRangeHints[port].HintDescriptor;
152 152
153 float minimum = 0.0; 153 float minimum = 0.f;
154 154
155 if (LADSPA_IS_HINT_BOUNDED_BELOW(d)) { 155 if (LADSPA_IS_HINT_BOUNDED_BELOW(d)) {
156 float lb = descriptor->PortRangeHints[port].LowerBound; 156 float lb = descriptor->PortRangeHints[port].LowerBound;
157 minimum = lb; 157 minimum = lb;
158 } else if (LADSPA_IS_HINT_BOUNDED_ABOVE(d)) { 158 } else if (LADSPA_IS_HINT_BOUNDED_ABOVE(d)) {
159 float ub = descriptor->PortRangeHints[port].UpperBound; 159 float ub = descriptor->PortRangeHints[port].UpperBound;
160 minimum = std::min(0.0, ub - 1.0); 160 minimum = std::min(0.f, ub - 1.f);
161 } 161 }
162 162
163 if (LADSPA_IS_HINT_SAMPLE_RATE(d)) { 163 if (LADSPA_IS_HINT_SAMPLE_RATE(d)) {
164 minimum *= m_sampleRate; 164 minimum *= float(m_sampleRate);
165 } 165 }
166 166
167 if (LADSPA_IS_HINT_LOGARITHMIC(d)) { 167 if (LADSPA_IS_HINT_LOGARITHMIC(d)) {
168 if (minimum == 0.f) minimum = 1.f; 168 if (minimum == 0.f) minimum = 1.f;
169 } 169 }
175 LADSPAPluginFactory::getPortMaximum(const LADSPA_Descriptor *descriptor, int port) 175 LADSPAPluginFactory::getPortMaximum(const LADSPA_Descriptor *descriptor, int port)
176 { 176 {
177 LADSPA_PortRangeHintDescriptor d = 177 LADSPA_PortRangeHintDescriptor d =
178 descriptor->PortRangeHints[port].HintDescriptor; 178 descriptor->PortRangeHints[port].HintDescriptor;
179 179
180 float maximum = 1.0; 180 float maximum = 1.f;
181 181
182 if (LADSPA_IS_HINT_BOUNDED_ABOVE(d)) { 182 if (LADSPA_IS_HINT_BOUNDED_ABOVE(d)) {
183 float ub = descriptor->PortRangeHints[port].UpperBound; 183 float ub = descriptor->PortRangeHints[port].UpperBound;
184 maximum = ub; 184 maximum = ub;
185 } else { 185 } else {
186 float lb = descriptor->PortRangeHints[port].LowerBound; 186 float lb = descriptor->PortRangeHints[port].LowerBound;
187 maximum = lb + 1.0; 187 maximum = lb + 1.f;
188 } 188 }
189 189
190 if (LADSPA_IS_HINT_SAMPLE_RATE(d)) { 190 if (LADSPA_IS_HINT_SAMPLE_RATE(d)) {
191 maximum *= m_sampleRate; 191 maximum *= float(m_sampleRate);
192 } 192 }
193 193
194 return maximum; 194 return maximum;
195 } 195 }
196 196
238 deft = minimum; 238 deft = minimum;
239 239
240 } else if (LADSPA_IS_HINT_DEFAULT_LOW(d)) { 240 } else if (LADSPA_IS_HINT_DEFAULT_LOW(d)) {
241 241
242 if (logarithmic) { 242 if (logarithmic) {
243 deft = powf(10, logmin * 0.75 + logmax * 0.25); 243 deft = powf(10, logmin * 0.75f + logmax * 0.25f);
244 } else { 244 } else {
245 deft = minimum * 0.75 + maximum * 0.25; 245 deft = minimum * 0.75f + maximum * 0.25f;
246 } 246 }
247 247
248 } else if (LADSPA_IS_HINT_DEFAULT_MIDDLE(d)) { 248 } else if (LADSPA_IS_HINT_DEFAULT_MIDDLE(d)) {
249 249
250 if (logarithmic) { 250 if (logarithmic) {
251 deft = powf(10, logmin * 0.5 + logmax * 0.5); 251 deft = powf(10, logmin * 0.5f + logmax * 0.5f);
252 } else { 252 } else {
253 deft = minimum * 0.5 + maximum * 0.5; 253 deft = minimum * 0.5f + maximum * 0.5f;
254 } 254 }
255 255
256 } else if (LADSPA_IS_HINT_DEFAULT_HIGH(d)) { 256 } else if (LADSPA_IS_HINT_DEFAULT_HIGH(d)) {
257 257
258 if (logarithmic) { 258 if (logarithmic) {
259 deft = powf(10, logmin * 0.25 + logmax * 0.75); 259 deft = powf(10, logmin * 0.25f + logmax * 0.75f);
260 } else { 260 } else {
261 deft = minimum * 0.25 + maximum * 0.75; 261 deft = minimum * 0.25f + maximum * 0.75f;
262 } 262 }
263 263
264 } else if (LADSPA_IS_HINT_DEFAULT_MAXIMUM(d)) { 264 } else if (LADSPA_IS_HINT_DEFAULT_MAXIMUM(d)) {
265 265
266 deft = maximum; 266 deft = maximum;
278 deft = 100.0; 278 deft = 100.0;
279 279
280 } else if (LADSPA_IS_HINT_DEFAULT_440(d)) { 280 } else if (LADSPA_IS_HINT_DEFAULT_440(d)) {
281 281
282 // deft = 440.0; 282 // deft = 440.0;
283 deft = Preferences::getInstance()->getTuningFrequency(); 283 deft = (float)Preferences::getInstance()->getTuningFrequency();
284 284
285 } else { 285 } else {
286 286
287 deft = minimum; 287 deft = minimum;
288 } 288 }
301 float 301 float
302 LADSPAPluginFactory::getPortQuantization(const LADSPA_Descriptor *descriptor, int port) 302 LADSPAPluginFactory::getPortQuantization(const LADSPA_Descriptor *descriptor, int port)
303 { 303 {
304 int displayHint = getPortDisplayHint(descriptor, port); 304 int displayHint = getPortDisplayHint(descriptor, port);
305 if (displayHint & PortHint::Toggled) { 305 if (displayHint & PortHint::Toggled) {
306 return lrintf(getPortMaximum(descriptor, port)) - 306 return float(lrintf(getPortMaximum(descriptor, port)) -
307 lrintf(getPortMinimum(descriptor, port)); 307 lrintf(getPortMinimum(descriptor, port)));
308 } 308 }
309 if (displayHint & PortHint::Integer) { 309 if (displayHint & PortHint::Integer) {
310 return 1.0; 310 return 1.0;
311 } 311 }
312 return 0.0; 312 return 0.0;
752 defs = lrdf_get_setting_values(def_uri); 752 defs = lrdf_get_setting_values(def_uri);
753 } 753 }
754 754
755 unsigned int controlPortNumber = 1; 755 unsigned int controlPortNumber = 1;
756 756
757 for (unsigned long i = 0; i < descriptor->PortCount; i++) { 757 for (int i = 0; i < (int)descriptor->PortCount; i++) {
758 758
759 if (LADSPA_IS_PORT_CONTROL(descriptor->PortDescriptors[i])) { 759 if (LADSPA_IS_PORT_CONTROL(descriptor->PortDescriptors[i])) {
760 760
761 if (def_uri && defs) { 761 if (def_uri && defs) {
762 762
772 ++controlPortNumber; 772 ++controlPortNumber;
773 } 773 }
774 } 774 }
775 #endif // HAVE_LRDF 775 #endif // HAVE_LRDF
776 776
777 for (unsigned long i = 0; i < descriptor->PortCount; i++) { 777 for (int i = 0; i < (int)descriptor->PortCount; i++) {
778 if (LADSPA_IS_PORT_CONTROL(descriptor->PortDescriptors[i])) { 778 if (LADSPA_IS_PORT_CONTROL(descriptor->PortDescriptors[i])) {
779 if (LADSPA_IS_PORT_INPUT(descriptor->PortDescriptors[i])) { 779 if (LADSPA_IS_PORT_INPUT(descriptor->PortDescriptors[i])) {
780 ++rtd->parameterCount; 780 ++rtd->parameterCount;
781 } else { 781 } else {
782 if (strcmp(descriptor->PortNames[i], "latency") && 782 if (strcmp(descriptor->PortNames[i], "latency") &&