comparison transform/FeatureExtractionPluginTransform.cpp @ 26:d88d117e0c34

* Add mono timestretch toggle button; some more work on getting blocksize etc parameters through to plugins
author Chris Cannam
date Mon, 18 Sep 2006 16:43:17 +0000
parents e764bbf2b090
children 61259228d029
comparison
equal deleted inserted replaced
25:e74f508db18c 26:d88d117e0c34
34 34
35 FeatureExtractionPluginTransform::FeatureExtractionPluginTransform(Model *inputModel, 35 FeatureExtractionPluginTransform::FeatureExtractionPluginTransform(Model *inputModel,
36 QString pluginId, 36 QString pluginId,
37 int channel, 37 int channel,
38 QString configurationXml, 38 QString configurationXml,
39 QString outputName) : 39 QString outputName,
40 size_t stepSize,
41 size_t blockSize,
42 WindowType windowType) :
40 Transform(inputModel), 43 Transform(inputModel),
41 m_plugin(0), 44 m_plugin(0),
42 m_channel(channel), 45 m_channel(channel),
43 m_stepSize(0), 46 m_stepSize(0),
44 m_blockSize(0), 47 m_blockSize(0),
48 m_windowType(windowType),
45 m_descriptor(0), 49 m_descriptor(0),
46 m_outputFeatureNo(0) 50 m_outputFeatureNo(0)
47 { 51 {
48 // std::cerr << "FeatureExtractionPluginTransform::FeatureExtractionPluginTransform: plugin " << pluginId.toStdString() << ", outputName " << outputName.toStdString() << std::endl; 52 // std::cerr << "FeatureExtractionPluginTransform::FeatureExtractionPluginTransform: plugin " << pluginId.toStdString() << ", outputName " << outputName.toStdString() << std::endl;
49 53
66 70
67 if (configurationXml != "") { 71 if (configurationXml != "") {
68 PluginXml(m_plugin).setParametersFromXml(configurationXml); 72 PluginXml(m_plugin).setParametersFromXml(configurationXml);
69 } 73 }
70 74
71 m_blockSize = m_plugin->getPreferredBlockSize(); 75 if (m_blockSize == 0) m_blockSize = m_plugin->getPreferredBlockSize();
72 m_stepSize = m_plugin->getPreferredStepSize(); 76 if (m_stepSize == 0) m_stepSize = m_plugin->getPreferredStepSize();
73 77
74 if (m_blockSize == 0) m_blockSize = 1024; //!!! todo: ask user 78 if (m_blockSize == 0) m_blockSize = 1024;
75 if (m_stepSize == 0) m_stepSize = m_blockSize; //!!! likewise 79 if (m_stepSize == 0) {
80 if (m_plugin->getInputDomain() == Vamp::Plugin::FrequencyDomain) {
81 m_stepSize = m_blockSize / 2;
82 } else {
83 m_stepSize = m_blockSize;
84 }
85 }
76 86
77 DenseTimeValueModel *input = getInput(); 87 DenseTimeValueModel *input = getInput();
78 if (!input) return; 88 if (!input) return;
79 89
80 size_t channelCount = input->getChannelCount(); 90 size_t channelCount = input->getChannelCount();
248 if (frequencyDomain) { 258 if (frequencyDomain) {
249 for (size_t ch = 0; ch < channelCount; ++ch) { 259 for (size_t ch = 0; ch < channelCount; ++ch) {
250 fftModels.push_back(new FFTModel 260 fftModels.push_back(new FFTModel
251 (getInput(), 261 (getInput(),
252 channelCount == 1 ? m_channel : ch, 262 channelCount == 1 ? m_channel : ch,
253 HanningWindow, 263 m_windowType,
254 m_blockSize, 264 m_blockSize,
255 m_stepSize, 265 m_stepSize,
256 m_blockSize, 266 m_blockSize,
257 false)); 267 false));
258 } 268 }