Mercurial > hg > svcore
comparison plugin/DSSIPluginInstance.cpp @ 1038:cc27f35aa75c cxx11
Introducing the signed 64-bit frame index type, and fixing build failures from inclusion of -Wconversion with -Werror. Not finished yet.
author | Chris Cannam |
---|---|
date | Tue, 03 Mar 2015 15:18:24 +0000 |
parents | c598b1d880f2 |
children | b14064bd1f97 |
comparison
equal
deleted
inserted
replaced
1037:bf0e5944289b | 1038:cc27f35aa75c |
---|---|
55 | 55 |
56 DSSIPluginInstance::DSSIPluginInstance(RealTimePluginFactory *factory, | 56 DSSIPluginInstance::DSSIPluginInstance(RealTimePluginFactory *factory, |
57 int clientId, | 57 int clientId, |
58 QString identifier, | 58 QString identifier, |
59 int position, | 59 int position, |
60 unsigned long sampleRate, | 60 int sampleRate, |
61 size_t blockSize, | 61 size_t blockSize, |
62 int idealChannelCount, | 62 int idealChannelCount, |
63 const DSSI_Descriptor* descriptor) : | 63 const DSSI_Descriptor* descriptor) : |
64 RealTimePluginInstance(factory, identifier), | 64 RealTimePluginInstance(factory, identifier), |
65 m_client(clientId), | 65 m_client(clientId), |
147 { | 147 { |
148 ParameterList list; | 148 ParameterList list; |
149 LADSPAPluginFactory *f = dynamic_cast<LADSPAPluginFactory *>(m_factory); | 149 LADSPAPluginFactory *f = dynamic_cast<LADSPAPluginFactory *>(m_factory); |
150 if (!f) return list; | 150 if (!f) return list; |
151 | 151 |
152 for (unsigned int i = 0; i < m_controlPortsIn.size(); ++i) { | 152 for (int i = 0; in_range_for(m_controlPortsIn, i); ++i) { |
153 | 153 |
154 ParameterDescriptor pd; | 154 ParameterDescriptor pd; |
155 unsigned int pn = m_controlPortsIn[i].first; | 155 int pn = (int)m_controlPortsIn[i].first; |
156 | 156 |
157 pd.identifier = m_descriptor->LADSPA_Plugin->PortNames[pn]; | 157 pd.identifier = m_descriptor->LADSPA_Plugin->PortNames[pn]; |
158 pd.name = pd.identifier; | 158 pd.name = pd.identifier; |
159 pd.description = ""; | 159 pd.description = ""; |
160 pd.minValue = f->getPortMinimum(m_descriptor->LADSPA_Plugin, pn); | 160 pd.minValue = f->getPortMinimum(m_descriptor->LADSPA_Plugin, pn); |
179 DSSIPluginInstance::getParameter(std::string id) const | 179 DSSIPluginInstance::getParameter(std::string id) const |
180 { | 180 { |
181 #ifdef DEBUG_DSSI | 181 #ifdef DEBUG_DSSI |
182 SVDEBUG << "DSSIPluginInstance::getParameter(" << id << ")" << endl; | 182 SVDEBUG << "DSSIPluginInstance::getParameter(" << id << ")" << endl; |
183 #endif | 183 #endif |
184 for (unsigned int i = 0; i < m_controlPortsIn.size(); ++i) { | 184 for (int i = 0; in_range_for(m_controlPortsIn, i); ++i) { |
185 if (id == m_descriptor->LADSPA_Plugin->PortNames[m_controlPortsIn[i].first]) { | 185 if (id == m_descriptor->LADSPA_Plugin->PortNames[m_controlPortsIn[i].first]) { |
186 #ifdef DEBUG_DSSI | 186 #ifdef DEBUG_DSSI |
187 cerr << "Matches port " << i << endl; | 187 cerr << "Matches port " << i << endl; |
188 #endif | 188 #endif |
189 float v = getParameterValue(i); | 189 float v = getParameterValue(i); |
202 { | 202 { |
203 #ifdef DEBUG_DSSI | 203 #ifdef DEBUG_DSSI |
204 SVDEBUG << "DSSIPluginInstance::setParameter(" << id << ", " << value << ")" << endl; | 204 SVDEBUG << "DSSIPluginInstance::setParameter(" << id << ", " << value << ")" << endl; |
205 #endif | 205 #endif |
206 | 206 |
207 for (unsigned int i = 0; i < m_controlPortsIn.size(); ++i) { | 207 for (int i = 0; in_range_for(m_controlPortsIn, i); ++i) { |
208 if (id == m_descriptor->LADSPA_Plugin->PortNames[m_controlPortsIn[i].first]) { | 208 if (id == m_descriptor->LADSPA_Plugin->PortNames[m_controlPortsIn[i].first]) { |
209 setParameterValue(i, value); | 209 setParameterValue(i, value); |
210 break; | 210 break; |
211 } | 211 } |
212 } | 212 } |
221 | 221 |
222 // Discover ports numbers and identities | 222 // Discover ports numbers and identities |
223 // | 223 // |
224 const LADSPA_Descriptor *descriptor = m_descriptor->LADSPA_Plugin; | 224 const LADSPA_Descriptor *descriptor = m_descriptor->LADSPA_Plugin; |
225 | 225 |
226 for (unsigned long i = 0; i < descriptor->PortCount; ++i) | 226 for (int i = 0; i < (int)descriptor->PortCount; ++i) |
227 { | 227 { |
228 if (LADSPA_IS_PORT_AUDIO(descriptor->PortDescriptors[i])) | 228 if (LADSPA_IS_PORT_AUDIO(descriptor->PortDescriptors[i])) |
229 { | 229 { |
230 if (LADSPA_IS_PORT_INPUT(descriptor->PortDescriptors[i])) { | 230 if (LADSPA_IS_PORT_INPUT(descriptor->PortDescriptors[i])) { |
231 m_audioPortsIn.push_back(i); | 231 m_audioPortsIn.push_back(i); |
238 { | 238 { |
239 if (LADSPA_IS_PORT_INPUT(descriptor->PortDescriptors[i])) { | 239 if (LADSPA_IS_PORT_INPUT(descriptor->PortDescriptors[i])) { |
240 | 240 |
241 LADSPA_Data *data = new LADSPA_Data(0.0); | 241 LADSPA_Data *data = new LADSPA_Data(0.0); |
242 | 242 |
243 m_controlPortsIn.push_back(std::pair<unsigned long, LADSPA_Data*> | 243 m_controlPortsIn.push_back(std::pair<long, LADSPA_Data*> |
244 (i, data)); | 244 (i, data)); |
245 | 245 |
246 m_backupControlPortsIn.push_back(0.0); | 246 m_backupControlPortsIn.push_back(0.0); |
247 | 247 |
248 } else { | 248 } else { |
249 LADSPA_Data *data = new LADSPA_Data(0.0); | 249 LADSPA_Data *data = new LADSPA_Data(0.0); |
250 m_controlPortsOut.push_back( | 250 m_controlPortsOut.push_back( |
251 std::pair<unsigned long, LADSPA_Data*>(i, data)); | 251 std::pair<long, LADSPA_Data*>(i, data)); |
252 if (!strcmp(descriptor->PortNames[i], "latency") || | 252 if (!strcmp(descriptor->PortNames[i], "latency") || |
253 !strcmp(descriptor->PortNames[i], "_latency")) { | 253 !strcmp(descriptor->PortNames[i], "_latency")) { |
254 #ifdef DEBUG_DSSI | 254 #ifdef DEBUG_DSSI |
255 cerr << "Wooo! We have a latency port!" << endl; | 255 cerr << "Wooo! We have a latency port!" << endl; |
256 #endif | 256 #endif |
426 deactivate(); | 426 deactivate(); |
427 } | 427 } |
428 | 428 |
429 cleanup(); | 429 cleanup(); |
430 | 430 |
431 for (unsigned int i = 0; i < m_controlPortsIn.size(); ++i) | 431 for (int i = 0; in_range_for(m_controlPortsIn, i); ++i) |
432 delete m_controlPortsIn[i].second; | 432 delete m_controlPortsIn[i].second; |
433 | 433 |
434 for (unsigned int i = 0; i < m_controlPortsOut.size(); ++i) | 434 for (int i = 0; in_range_for(m_controlPortsOut, i); ++i) |
435 delete m_controlPortsOut[i].second; | 435 delete m_controlPortsOut[i].second; |
436 | 436 |
437 m_controlPortsIn.clear(); | 437 m_controlPortsIn.clear(); |
438 m_controlPortsOut.clear(); | 438 m_controlPortsOut.clear(); |
439 | 439 |
453 m_audioPortsOut.clear(); | 453 m_audioPortsOut.clear(); |
454 } | 454 } |
455 | 455 |
456 | 456 |
457 void | 457 void |
458 DSSIPluginInstance::instantiate(unsigned long sampleRate) | 458 DSSIPluginInstance::instantiate(int sampleRate) |
459 { | 459 { |
460 if (!m_descriptor) return; | 460 if (!m_descriptor) return; |
461 | 461 |
462 #ifdef DEBUG_DSSI | 462 #ifdef DEBUG_DSSI |
463 cout << "DSSIPluginInstance::instantiate - plugin \"unique\" id = " | 463 cout << "DSSIPluginInstance::instantiate - plugin \"unique\" id = " |
476 | 476 |
477 if (m_instanceHandle) { | 477 if (m_instanceHandle) { |
478 | 478 |
479 if (m_descriptor->get_midi_controller_for_port) { | 479 if (m_descriptor->get_midi_controller_for_port) { |
480 | 480 |
481 for (unsigned long i = 0; i < descriptor->PortCount; ++i) { | 481 for (int i = 0; i < (int)descriptor->PortCount; ++i) { |
482 | 482 |
483 if (LADSPA_IS_PORT_CONTROL(descriptor->PortDescriptors[i]) && | 483 if (LADSPA_IS_PORT_CONTROL(descriptor->PortDescriptors[i]) && |
484 LADSPA_IS_PORT_INPUT(descriptor->PortDescriptors[i])) { | 484 LADSPA_IS_PORT_INPUT(descriptor->PortDescriptors[i])) { |
485 | 485 |
486 int controller = m_descriptor->get_midi_controller_for_port | 486 int controller = m_descriptor->get_midi_controller_for_port |
510 if (!m_descriptor || !m_descriptor->get_program) { | 510 if (!m_descriptor || !m_descriptor->get_program) { |
511 m_programCacheValid = true; | 511 m_programCacheValid = true; |
512 return; | 512 return; |
513 } | 513 } |
514 | 514 |
515 unsigned long index = 0; | 515 int index = 0; |
516 const DSSI_Program_Descriptor *programDescriptor; | 516 const DSSI_Program_Descriptor *programDescriptor; |
517 while ((programDescriptor = m_descriptor->get_program(m_instanceHandle, index))) { | 517 while ((programDescriptor = m_descriptor->get_program(m_instanceHandle, index))) { |
518 ++index; | 518 ++index; |
519 ProgramDescriptor d; | 519 ProgramDescriptor d; |
520 d.bank = programDescriptor->Bank; | 520 d.bank = (int)programDescriptor->Bank; |
521 d.program = programDescriptor->Program; | 521 d.program = (int)programDescriptor->Program; |
522 d.name = programDescriptor->Name; | 522 d.name = programDescriptor->Name; |
523 m_cachedPrograms.push_back(d); | 523 m_cachedPrograms.push_back(d); |
524 } | 524 } |
525 | 525 |
526 #ifdef DEBUG_DSSI | 526 #ifdef DEBUG_DSSI |
568 } | 568 } |
569 | 569 |
570 return std::string(); | 570 return std::string(); |
571 } | 571 } |
572 | 572 |
573 unsigned long | 573 int |
574 DSSIPluginInstance::getProgram(std::string name) const | 574 DSSIPluginInstance::getProgram(std::string name) const |
575 { | 575 { |
576 #ifdef DEBUG_DSSI | 576 #ifdef DEBUG_DSSI |
577 SVDEBUG << "DSSIPluginInstance::getProgram(" << name << ")" << endl; | 577 SVDEBUG << "DSSIPluginInstance::getProgram(" << name << ")" << endl; |
578 #endif | 578 #endif |
579 | 579 |
580 if (!m_descriptor) return 0; | 580 if (!m_descriptor) return 0; |
581 | 581 |
582 checkProgramCache(); | 582 checkProgramCache(); |
583 | 583 |
584 unsigned long rv; | 584 int rv; |
585 | 585 |
586 for (std::vector<ProgramDescriptor>::iterator i = m_cachedPrograms.begin(); | 586 for (std::vector<ProgramDescriptor>::iterator i = m_cachedPrograms.begin(); |
587 i != m_cachedPrograms.end(); ++i) { | 587 i != m_cachedPrograms.end(); ++i) { |
588 if (i->name == name) { | 588 if (i->name == name) { |
589 rv = i->bank; | 589 rv = i->bank; |
619 checkProgramCache(); | 619 checkProgramCache(); |
620 | 620 |
621 if (!m_descriptor->select_program) return; | 621 if (!m_descriptor->select_program) return; |
622 | 622 |
623 bool found = false; | 623 bool found = false; |
624 unsigned long bankNo = 0, programNo = 0; | 624 int bankNo = 0, programNo = 0; |
625 | 625 |
626 for (std::vector<ProgramDescriptor>::iterator i = m_cachedPrograms.begin(); | 626 for (std::vector<ProgramDescriptor>::iterator i = m_cachedPrograms.begin(); |
627 i != m_cachedPrograms.end(); ++i) { | 627 i != m_cachedPrograms.end(); ++i) { |
628 | 628 |
629 if (i->name == program) { | 629 if (i->name == program) { |
698 assert(sizeof(sample_t) == sizeof(float)); | 698 assert(sizeof(sample_t) == sizeof(float)); |
699 | 699 |
700 LADSPAPluginFactory *f = dynamic_cast<LADSPAPluginFactory *>(m_factory); | 700 LADSPAPluginFactory *f = dynamic_cast<LADSPAPluginFactory *>(m_factory); |
701 int inbuf = 0, outbuf = 0; | 701 int inbuf = 0, outbuf = 0; |
702 | 702 |
703 for (unsigned int i = 0; i < m_audioPortsIn.size(); ++i) { | 703 for (size_t i = 0; i < m_audioPortsIn.size(); ++i) { |
704 m_descriptor->LADSPA_Plugin->connect_port | 704 m_descriptor->LADSPA_Plugin->connect_port |
705 (m_instanceHandle, | 705 (m_instanceHandle, |
706 m_audioPortsIn[i], | 706 m_audioPortsIn[i], |
707 (LADSPA_Data *)m_inputBuffers[inbuf]); | 707 (LADSPA_Data *)m_inputBuffers[inbuf]); |
708 ++inbuf; | 708 ++inbuf; |
709 } | 709 } |
710 | 710 |
711 for (unsigned int i = 0; i < m_audioPortsOut.size(); ++i) { | 711 for (size_t i = 0; i < m_audioPortsOut.size(); ++i) { |
712 m_descriptor->LADSPA_Plugin->connect_port | 712 m_descriptor->LADSPA_Plugin->connect_port |
713 (m_instanceHandle, | 713 (m_instanceHandle, |
714 m_audioPortsOut[i], | 714 m_audioPortsOut[i], |
715 (LADSPA_Data *)m_outputBuffers[outbuf]); | 715 (LADSPA_Data *)m_outputBuffers[outbuf]); |
716 ++outbuf; | 716 ++outbuf; |
717 } | 717 } |
718 | 718 |
719 for (unsigned int i = 0; i < m_controlPortsIn.size(); ++i) { | 719 for (size_t i = 0; i < m_controlPortsIn.size(); ++i) { |
720 m_descriptor->LADSPA_Plugin->connect_port | 720 m_descriptor->LADSPA_Plugin->connect_port |
721 (m_instanceHandle, | 721 (m_instanceHandle, |
722 m_controlPortsIn[i].first, | 722 m_controlPortsIn[i].first, |
723 m_controlPortsIn[i].second); | 723 m_controlPortsIn[i].second); |
724 | 724 |
725 if (f) { | 725 if (f) { |
726 float defaultValue = f->getPortDefault | 726 float defaultValue = f->getPortDefault |
727 (m_descriptor->LADSPA_Plugin, m_controlPortsIn[i].first); | 727 (m_descriptor->LADSPA_Plugin, (int)m_controlPortsIn[i].first); |
728 *m_controlPortsIn[i].second = defaultValue; | 728 *m_controlPortsIn[i].second = defaultValue; |
729 m_backupControlPortsIn[i] = defaultValue; | 729 m_backupControlPortsIn[i] = defaultValue; |
730 #ifdef DEBUG_DSSI | 730 #ifdef DEBUG_DSSI |
731 SVDEBUG << "DSSIPluginInstance::connectPorts: set control port " << i << " to default value " << defaultValue << endl; | 731 SVDEBUG << "DSSIPluginInstance::connectPorts: set control port " << i << " to default value " << defaultValue << endl; |
732 #endif | 732 #endif |
733 } | 733 } |
734 } | 734 } |
735 | 735 |
736 for (unsigned int i = 0; i < m_controlPortsOut.size(); ++i) { | 736 for (size_t i = 0; i < m_controlPortsOut.size(); ++i) { |
737 m_descriptor->LADSPA_Plugin->connect_port | 737 m_descriptor->LADSPA_Plugin->connect_port |
738 (m_instanceHandle, | 738 (m_instanceHandle, |
739 m_controlPortsOut[i].first, | 739 m_controlPortsOut[i].first, |
740 m_controlPortsOut[i].second); | 740 m_controlPortsOut[i].second); |
741 } | 741 } |
742 } | 742 } |
743 | 743 |
744 unsigned int | 744 int |
745 DSSIPluginInstance::getParameterCount() const | 745 DSSIPluginInstance::getParameterCount() const |
746 { | 746 { |
747 return m_controlPortsIn.size(); | 747 return (int)m_controlPortsIn.size(); |
748 } | 748 } |
749 | 749 |
750 void | 750 void |
751 DSSIPluginInstance::setParameterValue(unsigned int parameter, float value) | 751 DSSIPluginInstance::setParameterValue(int parameter, float value) |
752 { | 752 { |
753 #ifdef DEBUG_DSSI | 753 #ifdef DEBUG_DSSI |
754 SVDEBUG << "DSSIPluginInstance::setParameterValue(" << parameter << ") to " << value << endl; | 754 SVDEBUG << "DSSIPluginInstance::setParameterValue(" << parameter << ") to " << value << endl; |
755 #endif | 755 #endif |
756 if (parameter >= m_controlPortsIn.size()) return; | 756 if (!in_range_for(m_controlPortsIn, parameter)) return; |
757 | 757 |
758 unsigned int portNumber = m_controlPortsIn[parameter].first; | 758 int portNumber = m_controlPortsIn[parameter].first; |
759 | 759 |
760 LADSPAPluginFactory *f = dynamic_cast<LADSPAPluginFactory *>(m_factory); | 760 LADSPAPluginFactory *f = dynamic_cast<LADSPAPluginFactory *>(m_factory); |
761 if (f) { | 761 if (f) { |
762 if (value < f->getPortMinimum(m_descriptor->LADSPA_Plugin, portNumber)) { | 762 if (value < f->getPortMinimum(m_descriptor->LADSPA_Plugin, portNumber)) { |
763 value = f->getPortMinimum(m_descriptor->LADSPA_Plugin, portNumber); | 763 value = f->getPortMinimum(m_descriptor->LADSPA_Plugin, portNumber); |
770 (*m_controlPortsIn[parameter].second) = value; | 770 (*m_controlPortsIn[parameter].second) = value; |
771 m_backupControlPortsIn[parameter] = value; | 771 m_backupControlPortsIn[parameter] = value; |
772 } | 772 } |
773 | 773 |
774 void | 774 void |
775 DSSIPluginInstance::setPortValueFromController(unsigned int port, int cv) | 775 DSSIPluginInstance::setPortValueFromController(int port, int cv) |
776 { | 776 { |
777 #ifdef DEBUG_DSSI | 777 #ifdef DEBUG_DSSI |
778 SVDEBUG << "DSSIPluginInstance::setPortValueFromController(" << port << ") to " << cv << endl; | 778 SVDEBUG << "DSSIPluginInstance::setPortValueFromController(" << port << ") to " << cv << endl; |
779 #endif | 779 #endif |
780 | 780 |
801 /* XXX !!! todo: fill in logarithmic, sample rate &c */ | 801 /* XXX !!! todo: fill in logarithmic, sample rate &c */ |
802 value = lb + ((ub - lb) * value / 127.0f); | 802 value = lb + ((ub - lb) * value / 127.0f); |
803 } | 803 } |
804 } | 804 } |
805 | 805 |
806 for (unsigned int i = 0; i < m_controlPortsIn.size(); ++i) { | 806 for (int i = 0; in_range_for(m_controlPortsIn, i); ++i) { |
807 if (m_controlPortsIn[i].first == port) { | 807 if (m_controlPortsIn[i].first == port) { |
808 setParameterValue(i, value); | 808 setParameterValue(i, value); |
809 } | 809 } |
810 } | 810 } |
811 } | 811 } |
812 | 812 |
813 float | 813 float |
814 DSSIPluginInstance::getControlOutputValue(size_t output) const | 814 DSSIPluginInstance::getControlOutputValue(size_t output) const |
815 { | 815 { |
816 if (output > m_controlPortsOut.size()) return 0.0; | 816 if (!in_range_for(m_controlPortsOut, output)) return 0.0; |
817 return (*m_controlPortsOut[output].second); | 817 return (*m_controlPortsOut[output].second); |
818 } | 818 } |
819 | 819 |
820 float | 820 float |
821 DSSIPluginInstance::getParameterValue(unsigned int parameter) const | 821 DSSIPluginInstance::getParameterValue(int parameter) const |
822 { | 822 { |
823 #ifdef DEBUG_DSSI | 823 #ifdef DEBUG_DSSI |
824 SVDEBUG << "DSSIPluginInstance::getParameterValue(" << parameter << ")" << endl; | 824 SVDEBUG << "DSSIPluginInstance::getParameterValue(" << parameter << ")" << endl; |
825 #endif | 825 #endif |
826 if (parameter >= m_controlPortsIn.size()) return 0.0; | 826 if (!in_range_for(m_controlPortsIn, parameter)) return 0.0; |
827 return (*m_controlPortsIn[parameter].second); | 827 return (*m_controlPortsIn[parameter].second); |
828 } | 828 } |
829 | 829 |
830 float | 830 float |
831 DSSIPluginInstance::getParameterDefault(unsigned int parameter) const | 831 DSSIPluginInstance::getParameterDefault(int parameter) const |
832 { | 832 { |
833 if (parameter >= m_controlPortsIn.size()) return 0.0; | 833 if (!in_range_for(m_controlPortsIn, parameter)) return 0.0; |
834 | 834 |
835 LADSPAPluginFactory *f = dynamic_cast<LADSPAPluginFactory *>(m_factory); | 835 LADSPAPluginFactory *f = dynamic_cast<LADSPAPluginFactory *>(m_factory); |
836 if (f) { | 836 if (f) { |
837 return f->getPortDefault(m_descriptor->LADSPA_Plugin, | 837 return f->getPortDefault(m_descriptor->LADSPA_Plugin, |
838 m_controlPortsIn[parameter].first); | 838 m_controlPortsIn[parameter].first); |
840 return 0.0f; | 840 return 0.0f; |
841 } | 841 } |
842 } | 842 } |
843 | 843 |
844 int | 844 int |
845 DSSIPluginInstance::getParameterDisplayHint(unsigned int parameter) const | 845 DSSIPluginInstance::getParameterDisplayHint(int parameter) const |
846 { | 846 { |
847 if (parameter >= m_controlPortsIn.size()) return 0.0; | 847 if (!in_range_for(m_controlPortsIn, parameter)) return 0.0; |
848 | 848 |
849 LADSPAPluginFactory *f = dynamic_cast<LADSPAPluginFactory *>(m_factory); | 849 LADSPAPluginFactory *f = dynamic_cast<LADSPAPluginFactory *>(m_factory); |
850 if (f) { | 850 if (f) { |
851 return f->getPortDisplayHint(m_descriptor->LADSPA_Plugin, | 851 return f->getPortDisplayHint(m_descriptor->LADSPA_Plugin, |
852 m_controlPortsIn[parameter].first); | 852 m_controlPortsIn[parameter].first); |
1038 *ev = m_eventBuffer.peekOne(); | 1038 *ev = m_eventBuffer.peekOne(); |
1039 bool accept = true; | 1039 bool accept = true; |
1040 | 1040 |
1041 Vamp::RealTime evTime(ev->time.time.tv_sec, ev->time.time.tv_nsec); | 1041 Vamp::RealTime evTime(ev->time.time.tv_sec, ev->time.time.tv_nsec); |
1042 | 1042 |
1043 int frameOffset = 0; | 1043 long frameOffset = 0; |
1044 if (evTime > blockTime) { | 1044 if (evTime > blockTime) { |
1045 frameOffset = Vamp::RealTime::realTime2Frame(evTime - blockTime, m_sampleRate); | 1045 frameOffset = Vamp::RealTime::realTime2Frame |
1046 (evTime - blockTime, | |
1047 (unsigned int)m_sampleRate); | |
1046 } | 1048 } |
1047 | 1049 |
1048 #ifdef DEBUG_DSSI_PROCESS | 1050 #ifdef DEBUG_DSSI_PROCESS |
1049 SVDEBUG << "DSSIPluginInstance::run: evTime " << evTime << ", blockTime " << blockTime << ", frameOffset " << frameOffset | 1051 SVDEBUG << "DSSIPluginInstance::run: evTime " << evTime << ", blockTime " << blockTime << ", frameOffset " << frameOffset |
1050 << ", blockSize " << m_blockSize << endl; | 1052 << ", blockSize " << m_blockSize << endl; |
1051 cerr << "Type: " << int(ev->type) << ", pitch: " << int(ev->data.note.note) << ", velocity: " << int(ev->data.note.velocity) << endl; | 1053 cerr << "Type: " << int(ev->type) << ", pitch: " << int(ev->data.note.note) << ", velocity: " << int(ev->data.note.velocity) << endl; |
1052 #endif | 1054 #endif |
1053 | 1055 |
1054 if (frameOffset >= int(count)) break; | 1056 if (frameOffset >= (long)count) break; |
1055 if (frameOffset < 0) { | 1057 if (frameOffset < 0) { |
1056 frameOffset = 0; | 1058 frameOffset = 0; |
1057 if (ev->type == SND_SEQ_EVENT_NOTEON) { | 1059 if (ev->type == SND_SEQ_EVENT_NOTEON) { |
1058 m_eventBuffer.skip(1); | 1060 m_eventBuffer.skip(1); |
1059 continue; | 1061 continue; |
1180 #ifdef DEBUG_DSSI_PROCESS | 1182 #ifdef DEBUG_DSSI_PROCESS |
1181 SVDEBUG << "DSSIPluginInstance::runGrouped(" << blockTime << "): I'm the first, running" << endl; | 1183 SVDEBUG << "DSSIPluginInstance::runGrouped(" << blockTime << "): I'm the first, running" << endl; |
1182 #endif | 1184 #endif |
1183 | 1185 |
1184 size_t index = 0; | 1186 size_t index = 0; |
1185 unsigned long *counts = (unsigned long *) | 1187 int *counts = (int *) |
1186 alloca(m_groupLocalEventBufferCount * sizeof(unsigned long)); | 1188 alloca(m_groupLocalEventBufferCount * sizeof(int)); |
1187 LADSPA_Handle *instances = (LADSPA_Handle *) | 1189 LADSPA_Handle *instances = (LADSPA_Handle *) |
1188 alloca(m_groupLocalEventBufferCount * sizeof(LADSPA_Handle)); | 1190 alloca(m_groupLocalEventBufferCount * sizeof(LADSPA_Handle)); |
1189 | 1191 |
1190 for (PluginSet::iterator i = s.begin(); i != s.end(); ++i) { | 1192 for (PluginSet::iterator i = s.begin(); i != s.end(); ++i) { |
1191 | 1193 |
1266 } | 1268 } |
1267 | 1269 |
1268 void | 1270 void |
1269 DSSIPluginInstance::midiSend(LADSPA_Handle /* instance */, | 1271 DSSIPluginInstance::midiSend(LADSPA_Handle /* instance */, |
1270 snd_seq_event_t * /* events */, | 1272 snd_seq_event_t * /* events */, |
1271 unsigned long /* eventCount */) | 1273 unsignd long /* eventCount */) |
1272 { | 1274 { |
1273 // This is likely to be called from an RT context | 1275 // This is likely to be called from an RT context |
1274 | 1276 |
1275 SVDEBUG << "DSSIPluginInstance::midiSend" << endl; | 1277 SVDEBUG << "DSSIPluginInstance::midiSend" << endl; |
1276 } | 1278 } |