comparison transform/TransformFactory.cpp @ 16:cc98d496d52b

* Add command history class, and basic undo/redo menus. No actual commands to undo/redo yet. Selecting the placeholders sometimes seems to cause a crash, so this looks a little uncertain so far. * Add Rename Layer * Remove models from playback when their layers are removed (and ref counts hit zero) * Don't hang around waiting so much when there's work to be done in the audio buffer fill thread * Put more sensible names on layers generated from transforms * Add basic editing to time-value layer like existing editing in time-instants layer, and make both of them snap to the appropriate resolution during drag
author Chris Cannam
date Mon, 30 Jan 2006 17:51:56 +0000
parents d86891498eef
children 4563a72c1d8b
comparison
equal deleted inserted replaced
15:47500c27ac26 16:cc98d496d52b
31 } 31 }
32 32
33 TransformFactory::TransformList 33 TransformFactory::TransformList
34 TransformFactory::getAllTransforms() 34 TransformFactory::getAllTransforms()
35 { 35 {
36 if (m_transforms.empty()) populateTransforms();
37
36 TransformList list; 38 TransformList list;
37 //!!! list.push_back(BeatDetectTransform::getName()); 39 for (TransformMap::const_iterator i = m_transforms.begin();
38 // list.push_back(BeatDetectionFunctionTransform::getName()); 40 i != m_transforms.end(); ++i) {
41 list.push_back(TransformDesc(i->first, i->second));
42 }
39 43
44 return list;
45 }
46
47 void
48 TransformFactory::populateTransforms()
49 {
40 //!!! 50 //!!!
41 std::vector<QString> fexplugs = 51 std::vector<QString> fexplugs =
42 FeatureExtractionPluginFactory::getAllPluginIdentifiers(); 52 FeatureExtractionPluginFactory::getAllPluginIdentifiers();
43 53
44 for (size_t i = 0; i < fexplugs.size(); ++i) { 54 for (size_t i = 0; i < fexplugs.size(); ++i) {
60 70
61 FeatureExtractionPlugin::OutputList outputs = 71 FeatureExtractionPlugin::OutputList outputs =
62 plugin->getOutputDescriptors(); 72 plugin->getOutputDescriptors();
63 73
64 if (outputs.size() == 1) { 74 if (outputs.size() == 1) {
65 list.push_back 75 m_transforms[QString("%1:%2")
66 (TransformDesc 76 .arg(pluginId)
67 (QString("%1:%2").arg(pluginId).arg(outputs[0].name.c_str()), 77 .arg(outputs[0].name.c_str())]
68 pluginDescription)); 78 = pluginDescription;
69 } else { 79 } else {
70 for (size_t j = 0; j < outputs.size(); ++j) { 80 for (size_t j = 0; j < outputs.size(); ++j) {
71 list.push_back 81 m_transforms[QString("%1:%2")
72 (TransformDesc 82 .arg(pluginId)
73 (QString("%1:%2").arg(pluginId).arg(outputs[j].name.c_str()), 83 .arg(outputs[j].name.c_str())]
74 QString("%1: %2").arg(pluginDescription) 84 = QString("%1: %2")
75 .arg(outputs[j].description.c_str()))); 85 .arg(pluginDescription)
86 .arg(outputs[j].description.c_str());
76 } 87 }
77 } 88 }
78 } 89 }
79 } 90 }
80 } 91 }
81 92 }
82 return list; 93
94 QString
95 TransformFactory::getTransformDescription(TransformName name)
96 {
97 if (m_transforms.find(name) != m_transforms.end()) {
98 return m_transforms[name];
99 } else return "";
83 } 100 }
84 101
85 Transform * 102 Transform *
86 TransformFactory::createTransform(TransformName name, Model *inputModel) 103 TransformFactory::createTransform(TransformName name, Model *inputModel)
87 { 104 {
109 << name.toStdString() << std::endl; 126 << name.toStdString() << std::endl;
110 } 127 }
111 } 128 }
112 129
113 if (start && transform) transform->start(); 130 if (start && transform) transform->start();
131 transform->setObjectName(name);
114 return transform; 132 return transform;
115 } 133 }
116 134
117 Model * 135 Model *
118 TransformFactory::transform(TransformName name, Model *inputModel) 136 TransformFactory::transform(TransformName name, Model *inputModel)