comparison plugin/LADSPAPluginInstance.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
154 lrdf_get_scale_values(m_descriptor->UniqueID, pn); 154 lrdf_get_scale_values(m_descriptor->UniqueID, pn);
155 155
156 if (defaults) { 156 if (defaults) {
157 if (defaults->count > 0) { 157 if (defaults->count > 0) {
158 std::map<int, std::string> values; 158 std::map<int, std::string> values;
159 size_t v = 0; 159 int v = 0;
160 for (size_t i = 0; i < defaults->count; ++i) { 160 for (size_t i = 0; i < defaults->count; ++i) {
161 v = size_t(lrintf(fabsf(defaults->items[i].value))); 161 v = int(lrintf(fabsf(defaults->items[i].value)));
162 values[v] = defaults->items[i].label; 162 values[v] = defaults->items[i].label;
163 } 163 }
164 for (size_t i = 0; i <= v; ++i) { 164 for (int i = 0; i <= v; ++i) {
165 pd.valueNames.push_back(values[i]); 165 pd.valueNames.push_back(values[i]);
166 } 166 }
167 haveLabels = true; 167 haveLabels = true;
168 } 168 }
169 lrdf_free_setting_values(defaults); 169 lrdf_free_setting_values(defaults);
225 << m_descriptor->PortCount << " ports" << endl; 225 << m_descriptor->PortCount << " ports" << endl;
226 #endif 226 #endif
227 227
228 // Discover ports numbers and identities 228 // Discover ports numbers and identities
229 // 229 //
230 for (unsigned long i = 0; i < m_descriptor->PortCount; ++i) { 230 for (int i = 0; i < (int)m_descriptor->PortCount; ++i) {
231 231
232 if (LADSPA_IS_PORT_AUDIO(m_descriptor->PortDescriptors[i])) { 232 if (LADSPA_IS_PORT_AUDIO(m_descriptor->PortDescriptors[i])) {
233 233
234 if (LADSPA_IS_PORT_INPUT(m_descriptor->PortDescriptors[i])) { 234 if (LADSPA_IS_PORT_INPUT(m_descriptor->PortDescriptors[i])) {
235 #ifdef DEBUG_LADSPA 235 #ifdef DEBUG_LADSPA
462 m_controlPortsOut[i].second); 462 m_controlPortsOut[i].second);
463 } 463 }
464 } 464 }
465 } 465 }
466 466
467 unsigned int 467 int
468 LADSPAPluginInstance::getParameterCount() const 468 LADSPAPluginInstance::getParameterCount() const
469 { 469 {
470 return m_controlPortsIn.size(); 470 return (int)m_controlPortsIn.size();
471 } 471 }
472 472
473 void 473 void
474 LADSPAPluginInstance::setParameterValue(unsigned int parameter, float value) 474 LADSPAPluginInstance::setParameterValue(int parameter, float value)
475 { 475 {
476 if (parameter >= m_controlPortsIn.size()) return; 476 if (!in_range_for(m_controlPortsIn, parameter)) return;
477 477
478 unsigned int portNumber = m_controlPortsIn[parameter].first; 478 unsigned int portNumber = m_controlPortsIn[parameter].first;
479 479
480 LADSPAPluginFactory *f = dynamic_cast<LADSPAPluginFactory *>(m_factory); 480 LADSPAPluginFactory *f = dynamic_cast<LADSPAPluginFactory *>(m_factory);
481 if (f) { 481 if (f) {
491 } 491 }
492 492
493 float 493 float
494 LADSPAPluginInstance::getControlOutputValue(size_t output) const 494 LADSPAPluginInstance::getControlOutputValue(size_t output) const
495 { 495 {
496 if (output > m_controlPortsOut.size()) return 0.0; 496 if (!in_range_for(m_controlPortsOut, output)) return 0.0;
497 return (*m_controlPortsOut[output].second); 497 return (*m_controlPortsOut[output].second);
498 } 498 }
499 499
500 float 500 float
501 LADSPAPluginInstance::getParameterValue(unsigned int parameter) const 501 LADSPAPluginInstance::getParameterValue(int parameter) const
502 { 502 {
503 if (parameter >= m_controlPortsIn.size()) return 0.0; 503 if (!in_range_for(m_controlPortsIn, parameter)) return 0.0;
504 return (*m_controlPortsIn[parameter].second); 504 return (*m_controlPortsIn[parameter].second);
505 } 505 }
506 506
507 float 507 float
508 LADSPAPluginInstance::getParameterDefault(unsigned int parameter) const 508 LADSPAPluginInstance::getParameterDefault(int parameter) const
509 { 509 {
510 if (parameter >= m_controlPortsIn.size()) return 0.0; 510 if (!in_range_for(m_controlPortsIn, parameter)) return 0.0;
511 511
512 LADSPAPluginFactory *f = dynamic_cast<LADSPAPluginFactory *>(m_factory); 512 LADSPAPluginFactory *f = dynamic_cast<LADSPAPluginFactory *>(m_factory);
513 if (f) { 513 if (f) {
514 return f->getPortDefault(m_descriptor, m_controlPortsIn[parameter].first); 514 return f->getPortDefault(m_descriptor, m_controlPortsIn[parameter].first);
515 } else { 515 } else {
516 return 0.0f; 516 return 0.0f;
517 } 517 }
518 } 518 }
519 519
520 int 520 int
521 LADSPAPluginInstance::getParameterDisplayHint(unsigned int parameter) const 521 LADSPAPluginInstance::getParameterDisplayHint(int parameter) const
522 { 522 {
523 if (parameter >= m_controlPortsIn.size()) return 0.0; 523 if (!in_range_for(m_controlPortsIn, parameter)) return 0.0;
524 524
525 LADSPAPluginFactory *f = dynamic_cast<LADSPAPluginFactory *>(m_factory); 525 LADSPAPluginFactory *f = dynamic_cast<LADSPAPluginFactory *>(m_factory);
526 if (f) { 526 if (f) {
527 return f->getPortDisplayHint(m_descriptor, m_controlPortsIn[parameter].first); 527 return f->getPortDisplayHint(m_descriptor, m_controlPortsIn[parameter].first);
528 } else { 528 } else {