Mercurial > hg > svapp
comparison framework/TransformUserConfigurator.cpp @ 582:b2d49e7c4149
Merge from branch 3.0-integration
author | Chris Cannam |
---|---|
date | Fri, 13 Jan 2017 10:29:55 +0000 |
parents | 36aa947ec962 |
children | b23bebfdfaba |
comparison
equal
deleted
inserted
replaced
513:d65ce7e55346 | 582:b2d49e7c4149 |
---|---|
43 Vamp::PluginBase *plugin, | 43 Vamp::PluginBase *plugin, |
44 int &minChannels, int &maxChannels) | 44 int &minChannels, int &maxChannels) |
45 { | 45 { |
46 if (plugin && plugin->getType() == "Feature Extraction Plugin") { | 46 if (plugin && plugin->getType() == "Feature Extraction Plugin") { |
47 Vamp::Plugin *vp = static_cast<Vamp::Plugin *>(plugin); | 47 Vamp::Plugin *vp = static_cast<Vamp::Plugin *>(plugin); |
48 SVDEBUG << "TransformUserConfigurator::getChannelRange: is a VP" << endl; | 48 SVDEBUG << "TransformUserConfigurator::getChannelRange: is a Vamp plugin" << endl; |
49 minChannels = int(vp->getMinChannelCount()); | 49 minChannels = int(vp->getMinChannelCount()); |
50 maxChannels = int(vp->getMaxChannelCount()); | 50 maxChannels = int(vp->getMaxChannelCount()); |
51 return true; | 51 return true; |
52 } else { | 52 } else { |
53 SVDEBUG << "TransformUserConfigurator::getChannelRange: is not a VP" << endl; | 53 SVDEBUG << "TransformUserConfigurator::getChannelRange: is not a Vamp plugin" << endl; |
54 return TransformFactory::getInstance()-> | 54 return TransformFactory::getInstance()-> |
55 getTransformChannelRange(identifier, minChannels, maxChannels); | 55 getTransformChannelRange(identifier, minChannels, maxChannels); |
56 } | 56 } |
57 } | 57 } |
58 | 58 |
78 bool effect = false; | 78 bool effect = false; |
79 bool generator = false; | 79 bool generator = false; |
80 | 80 |
81 if (!plugin) return false; | 81 if (!plugin) return false; |
82 | 82 |
83 if (FeatureExtractionPluginFactory::instanceFor(id)) { | 83 SVDEBUG << "TransformUserConfigurator::configure: identifier " << id << endl; |
84 | |
85 if (RealTimePluginFactory::instanceFor(id)) { | |
86 | |
87 RealTimePluginFactory *factory = RealTimePluginFactory::instanceFor(id); | |
88 const RealTimePluginDescriptor *desc = factory->getPluginDescriptor(id); | |
89 | |
90 if (desc->audioInputPortCount > 0 && | |
91 desc->audioOutputPortCount > 0 && | |
92 !desc->isSynth) { | |
93 effect = true; | |
94 } | |
95 | |
96 if (desc->audioInputPortCount == 0) { | |
97 generator = true; | |
98 } | |
99 | |
100 if (output != "A") { | |
101 int outputNo = output.toInt(); | |
102 if (outputNo >= 0 && outputNo < int(desc->controlOutputPortCount)) { | |
103 outputLabel = desc->controlOutputPortNames[outputNo].c_str(); | |
104 } | |
105 } | |
106 | |
107 RealTimePluginInstance *rtp = | |
108 static_cast<RealTimePluginInstance *>(plugin); | |
109 | |
110 if (effect && source) { | |
111 SVDEBUG << "Setting auditioning effect" << endl; | |
112 source->setAuditioningEffect(rtp); | |
113 } | |
114 | |
115 } else { | |
84 | 116 |
85 Vamp::Plugin *vp = static_cast<Vamp::Plugin *>(plugin); | 117 Vamp::Plugin *vp = static_cast<Vamp::Plugin *>(plugin); |
86 | 118 |
87 frequency = (vp->getInputDomain() == Vamp::Plugin::FrequencyDomain); | 119 frequency = (vp->getInputDomain() == Vamp::Plugin::FrequencyDomain); |
88 | 120 |
89 std::vector<Vamp::Plugin::OutputDescriptor> od = | 121 std::vector<Vamp::Plugin::OutputDescriptor> od = |
90 vp->getOutputDescriptors(); | 122 vp->getOutputDescriptors(); |
91 | 123 |
92 cerr << "configure: looking for output: " << output << endl; | 124 // cerr << "configure: looking for output: " << output << endl; |
93 | 125 |
94 if (od.size() > 1) { | 126 if (od.size() > 1) { |
95 for (size_t i = 0; i < od.size(); ++i) { | 127 for (size_t i = 0; i < od.size(); ++i) { |
96 if (od[i].identifier == output.toStdString()) { | 128 if (od[i].identifier == output.toStdString()) { |
97 outputLabel = od[i].name.c_str(); | 129 outputLabel = od[i].name.c_str(); |
98 outputDescription = od[i].description.c_str(); | 130 outputDescription = od[i].description.c_str(); |
99 break; | 131 break; |
100 } | 132 } |
101 } | 133 } |
102 } | 134 } |
103 | 135 } |
104 } else if (RealTimePluginFactory::instanceFor(id)) { | 136 |
105 | |
106 RealTimePluginFactory *factory = RealTimePluginFactory::instanceFor(id); | |
107 const RealTimePluginDescriptor *desc = factory->getPluginDescriptor(id); | |
108 | |
109 if (desc->audioInputPortCount > 0 && | |
110 desc->audioOutputPortCount > 0 && | |
111 !desc->isSynth) { | |
112 effect = true; | |
113 } | |
114 | |
115 if (desc->audioInputPortCount == 0) { | |
116 generator = true; | |
117 } | |
118 | |
119 if (output != "A") { | |
120 int outputNo = output.toInt(); | |
121 if (outputNo >= 0 && outputNo < int(desc->controlOutputPortCount)) { | |
122 outputLabel = desc->controlOutputPortNames[outputNo].c_str(); | |
123 } | |
124 } | |
125 | |
126 RealTimePluginInstance *rtp = | |
127 static_cast<RealTimePluginInstance *>(plugin); | |
128 | |
129 if (effect && source) { | |
130 SVDEBUG << "Setting auditioning effect" << endl; | |
131 source->setAuditioningEffect(rtp); | |
132 } | |
133 } | |
134 | |
135 int sourceChannels = 1; | 137 int sourceChannels = 1; |
136 if (dynamic_cast<DenseTimeValueModel *>(inputModel)) { | 138 if (dynamic_cast<DenseTimeValueModel *>(inputModel)) { |
137 sourceChannels = dynamic_cast<DenseTimeValueModel *>(inputModel) | 139 sourceChannels = dynamic_cast<DenseTimeValueModel *>(inputModel) |
138 ->getChannelCount(); | 140 ->getChannelCount(); |
139 } | 141 } |
180 | 182 |
181 QString selectedInput = dialog->getInputModel(); | 183 QString selectedInput = dialog->getInputModel(); |
182 if (selectedInput != "") { | 184 if (selectedInput != "") { |
183 if (modelMap.contains(selectedInput)) { | 185 if (modelMap.contains(selectedInput)) { |
184 inputModel = modelMap.value(selectedInput); | 186 inputModel = modelMap.value(selectedInput); |
185 cerr << "Found selected input \"" << selectedInput << "\" in model map, result is " << inputModel << endl; | 187 SVDEBUG << "Found selected input \"" << selectedInput << "\" in model map, result is " << inputModel << endl; |
186 } else { | 188 } else { |
187 cerr << "Failed to find selected input \"" << selectedInput << "\" in model map" << endl; | 189 SVDEBUG << "Failed to find selected input \"" << selectedInput << "\" in model map" << endl; |
188 } | 190 } |
189 } else { | 191 } else { |
190 cerr << "Selected input empty: \"" << selectedInput << "\"" << endl; | 192 SVDEBUG << "Selected input empty: \"" << selectedInput << "\"" << endl; |
191 } | 193 } |
192 | 194 |
193 // Write parameters back to transform object | 195 // Write parameters back to transform object |
194 TransformFactory::getInstance()-> | 196 TransformFactory::getInstance()-> |
195 setParametersFromPlugin(transform, plugin); | 197 setParametersFromPlugin(transform, plugin); |