comparison transform/TransformFactory.cpp @ 20:742e6882e187

* Refactor sparse models. Previously the 1D and time-value models duplicated a lot of code; now there is a base class (SparseModel) templated on the stored point type, and the subclasses define point types with the necessary characteristics. * Add NoteModel, a new SparseModel subclass. * Reorganise local feature description display. Instead of asking the layer to draw its own, just query it for a textual description and draw that in Pane. Greatly simplifies this part of the layer code. * Add local feature descriptions to colour 3D plot and waveform layers. * Add pitch in MIDI-pitch-and-cents to spectrogram layer. * Give AudioGenerator its own mutex to shorten lock times in CallbackPlaySource. * Minor adjustments to layers menu &c
author Chris Cannam
date Thu, 02 Feb 2006 16:10:19 +0000
parents 4563a72c1d8b
children bac8b14ab355
comparison
equal deleted inserted replaced
19:a7ed14263fe4 20:742e6882e187
56 QString pluginId = fexplugs[i]; 56 QString pluginId = fexplugs[i];
57 57
58 FeatureExtractionPluginFactory *factory = 58 FeatureExtractionPluginFactory *factory =
59 FeatureExtractionPluginFactory::instanceFor(pluginId); 59 FeatureExtractionPluginFactory::instanceFor(pluginId);
60 60
61 if (factory) { 61 if (!factory) {
62 //!!! well, really we want to be able to query this without having to instantiate 62 std::cerr << "WARNING: TransformFactory::populateTransforms: No feature extraction plugin factory for instance " << pluginId.toLocal8Bit().data() << std::endl;
63 continue;
64 }
63 65
64 FeatureExtractionPlugin *plugin = 66 //!!! well, really we want to be able to query this without having to instantiate
65 factory->instantiatePlugin(pluginId, 48000);
66 67
67 QString pluginDescription = plugin->getDescription().c_str(); 68 FeatureExtractionPlugin *plugin =
69 factory->instantiatePlugin(pluginId, 48000);
68 70
69 if (plugin) { 71 if (!plugin) {
72 std::cerr << "WARNING: TransformFactory::populateTransforms: Failed to instantiate plugin " << pluginId.toLocal8Bit().data() << std::endl;
73 continue;
74 }
75
76 QString pluginDescription = plugin->getDescription().c_str();
77 FeatureExtractionPlugin::OutputList outputs =
78 plugin->getOutputDescriptors();
70 79
71 FeatureExtractionPlugin::OutputList outputs = 80 for (size_t j = 0; j < outputs.size(); ++j) {
72 plugin->getOutputDescriptors();
73 81
74 if (outputs.size() == 1) { 82 QString transformName = QString("%1:%2")
75 m_transforms[QString("%1:%2") 83 .arg(pluginId).arg(outputs[j].name.c_str());
76 .arg(pluginId) 84
77 .arg(outputs[0].name.c_str())] 85 QString userDescription;
78 = pluginDescription; 86
79 } else { 87 if (outputs.size() == 1) {
80 for (size_t j = 0; j < outputs.size(); ++j) { 88 userDescription = pluginDescription;
81 m_transforms[QString("%1:%2") 89 } else {
82 .arg(pluginId) 90 userDescription = QString("%1: %2")
83 .arg(outputs[j].name.c_str())] 91 .arg(pluginDescription)
84 = QString("%1: %2") 92 .arg(outputs[j].description.c_str());
85 .arg(pluginDescription)
86 .arg(outputs[j].description.c_str());
87 }
88 }
89 } 93 }
94
95 m_transforms[transformName] = userDescription;
90 } 96 }
91 } 97 }
92 } 98 }
93 99
94 QString 100 QString