comparison framework/TransformUserConfigurator.cpp @ 685:7540733f5480 by-id

Overhaul SV file reader etc
author Chris Cannam
date Thu, 04 Jul 2019 14:31:22 +0100
parents e2715204feaa
children ddfac001b543
comparison
equal deleted inserted replaced
684:5e9b1956b609 685:7540733f5480
58 58
59 bool 59 bool
60 TransformUserConfigurator::configure(ModelTransformer::Input &input, 60 TransformUserConfigurator::configure(ModelTransformer::Input &input,
61 Transform &transform, 61 Transform &transform,
62 Vamp::PluginBase *plugin, 62 Vamp::PluginBase *plugin,
63 Model *&inputModel, 63 ModelId &inputModel,
64 AudioPlaySource *source, 64 AudioPlaySource *source,
65 sv_frame_t startFrame, 65 sv_frame_t startFrame,
66 sv_frame_t duration, 66 sv_frame_t duration,
67 const QMap<QString, Model *> &modelMap, 67 const QMap<QString, ModelId> &modelMap,
68 QStringList candidateModelNames, 68 QStringList candidateModelNames,
69 QString defaultModelName) 69 QString defaultModelName)
70 { 70 {
71 bool ok = false; 71 bool ok = false;
72 QString id = transform.getPluginIdentifier(); 72 QString id = transform.getPluginIdentifier();
119 frequency = (vp->getInputDomain() == Vamp::Plugin::FrequencyDomain); 119 frequency = (vp->getInputDomain() == Vamp::Plugin::FrequencyDomain);
120 120
121 std::vector<Vamp::Plugin::OutputDescriptor> od = 121 std::vector<Vamp::Plugin::OutputDescriptor> od =
122 vp->getOutputDescriptors(); 122 vp->getOutputDescriptors();
123 123
124 // cerr << "configure: looking for output: " << output << endl;
125
126 if (od.size() > 1) { 124 if (od.size() > 1) {
127 for (size_t i = 0; i < od.size(); ++i) { 125 for (size_t i = 0; i < od.size(); ++i) {
128 if (od[i].identifier == output.toStdString()) { 126 if (od[i].identifier == output.toStdString()) {
129 outputLabel = od[i].name.c_str(); 127 outputLabel = od[i].name.c_str();
130 outputDescription = od[i].description.c_str(); 128 outputDescription = od[i].description.c_str();
133 } 131 }
134 } 132 }
135 } 133 }
136 134
137 int sourceChannels = 1; 135 int sourceChannels = 1;
138 if (dynamic_cast<DenseTimeValueModel *>(inputModel)) { 136
139 sourceChannels = dynamic_cast<DenseTimeValueModel *>(inputModel) 137 if (auto dtvm = ModelById::getAs<DenseTimeValueModel>(inputModel)) {
140 ->getChannelCount(); 138 sourceChannels = dtvm->getChannelCount();
141 } 139 }
142 140
143 int minChannels = 1, maxChannels = sourceChannels; 141 int minChannels = 1, maxChannels = sourceChannels;
144 getChannelRange(transform.getIdentifier(), plugin, 142 getChannelRange(transform.getIdentifier(), plugin,
145 minChannels, maxChannels); 143 minChannels, maxChannels);
201 //!!! The dialog ought to be taking & returning transform 199 //!!! The dialog ought to be taking & returning transform
202 //objects and input objects and stuff rather than passing 200 //objects and input objects and stuff rather than passing
203 //around all this misc stuff, but that's for tomorrow 201 //around all this misc stuff, but that's for tomorrow
204 //(whenever that may be) 202 //(whenever that may be)
205 203
204 sv_samplerate_t sampleRate = 0;
205 if (auto m = ModelById::get(inputModel)) {
206 sampleRate = m->getSampleRate();
207 }
208
206 if (startFrame != 0 || duration != 0) { 209 if (startFrame != 0 || duration != 0) {
207 if (dialog->getSelectionOnly()) { 210 if (dialog->getSelectionOnly() && sampleRate != 0) {
208 transform.setStartTime(RealTime::frame2RealTime 211 transform.setStartTime
209 (startFrame, inputModel->getSampleRate())); 212 (RealTime::frame2RealTime(startFrame, sampleRate));
210 transform.setDuration(RealTime::frame2RealTime 213 transform.setDuration
211 (duration, inputModel->getSampleRate())); 214 (RealTime::frame2RealTime(duration, sampleRate));
212 } 215 }
213 } 216 }
214 217
215 int stepSize = 0, blockSize = 0; 218 int stepSize = 0, blockSize = 0;
216 WindowType windowType = HanningWindow; 219 WindowType windowType = HanningWindow;