comparison transform/TransformFactory.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 45e95de8b11d
children 26cf6d5251ec
comparison
equal deleted inserted replaced
1038:cc27f35aa75c 1039:b14064bd1f97
752 Transform 752 Transform
753 TransformFactory::getDefaultTransformFor(TransformId id, int rate) 753 TransformFactory::getDefaultTransformFor(TransformId id, int rate)
754 { 754 {
755 Transform t; 755 Transform t;
756 t.setIdentifier(id); 756 t.setIdentifier(id);
757 if (rate != 0) t.setSampleRate(rate); 757 if (rate != 0) t.setSampleRate(float(rate));
758 758
759 Vamp::PluginBase *plugin = instantiateDefaultPluginFor(id, rate); 759 Vamp::PluginBase *plugin = instantiateDefaultPluginFor(id, rate);
760 760
761 if (plugin) { 761 if (plugin) {
762 t.setPluginVersion(QString("%1").arg(plugin->getPluginVersion())); 762 t.setPluginVersion(QString("%1").arg(plugin->getPluginVersion()));
770 770
771 Vamp::PluginBase * 771 Vamp::PluginBase *
772 TransformFactory::instantiatePluginFor(const Transform &transform) 772 TransformFactory::instantiatePluginFor(const Transform &transform)
773 { 773 {
774 Vamp::PluginBase *plugin = instantiateDefaultPluginFor 774 Vamp::PluginBase *plugin = instantiateDefaultPluginFor
775 (transform.getIdentifier(), transform.getSampleRate()); 775 (transform.getIdentifier(), int(lrintf(transform.getSampleRate())));
776 776
777 if (plugin) { 777 if (plugin) {
778 setPluginParameters(transform, plugin); 778 setPluginParameters(transform, plugin);
779 } 779 }
780 780
795 795
796 FeatureExtractionPluginFactory *factory = 796 FeatureExtractionPluginFactory *factory =
797 FeatureExtractionPluginFactory::instanceFor(pluginId); 797 FeatureExtractionPluginFactory::instanceFor(pluginId);
798 798
799 if (factory) { 799 if (factory) {
800 plugin = factory->instantiatePlugin(pluginId, rate); 800 plugin = factory->instantiatePlugin(pluginId, float(rate));
801 } 801 }
802 802
803 } else { 803 } else {
804 804
805 RealTimePluginFactory *factory = 805 RealTimePluginFactory *factory =
911 Vamp::Plugin *plugin = 911 Vamp::Plugin *plugin =
912 FeatureExtractionPluginFactory::instanceFor(id)-> 912 FeatureExtractionPluginFactory::instanceFor(id)->
913 instantiatePlugin(id, 44100); 913 instantiatePlugin(id, 44100);
914 if (!plugin) return false; 914 if (!plugin) return false;
915 915
916 min = plugin->getMinChannelCount(); 916 min = (int)plugin->getMinChannelCount();
917 max = plugin->getMaxChannelCount(); 917 max = (int)plugin->getMaxChannelCount();
918 delete plugin; 918 delete plugin;
919 919
920 return true; 920 return true;
921 921
922 } else if (RealTimePluginFactory::instanceFor(id)) { 922 } else if (RealTimePluginFactory::instanceFor(id)) {
1038 transform.setStepSize(transform.getBlockSize()); 1038 transform.setStepSize(transform.getBlockSize());
1039 } 1039 }
1040 } else { 1040 } else {
1041 Vamp::Plugin::InputDomain domain = vp->getInputDomain(); 1041 Vamp::Plugin::InputDomain domain = vp->getInputDomain();
1042 if (!transform.getStepSize()) { 1042 if (!transform.getStepSize()) {
1043 transform.setStepSize(vp->getPreferredStepSize()); 1043 transform.setStepSize((int)vp->getPreferredStepSize());
1044 } 1044 }
1045 if (!transform.getBlockSize()) { 1045 if (!transform.getBlockSize()) {
1046 transform.setBlockSize(vp->getPreferredBlockSize()); 1046 transform.setBlockSize((int)vp->getPreferredBlockSize());
1047 } 1047 }
1048 if (!transform.getBlockSize()) { 1048 if (!transform.getBlockSize()) {
1049 transform.setBlockSize(1024); 1049 transform.setBlockSize(1024);
1050 } 1050 }
1051 if (!transform.getStepSize()) { 1051 if (!transform.getStepSize()) {