comparison src/Analyser.cpp @ 140:e7f2da26c9ac

Show warning if pitch-tracker plugin is not found (fixes #830)
author Chris Cannam
date Fri, 10 Jan 2014 14:37:05 +0000
parents 995478fbbe17
children cdc9d5f7978c
comparison
equal deleted inserted replaced
139:995478fbbe17 140:e7f2da26c9ac
56 56
57 Analyser::~Analyser() 57 Analyser::~Analyser()
58 { 58 {
59 } 59 }
60 60
61 void 61 QString
62 Analyser::newFileLoaded(Document *doc, WaveFileModel *model, 62 Analyser::newFileLoaded(Document *doc, WaveFileModel *model,
63 PaneStack *paneStack, Pane *pane) 63 PaneStack *paneStack, Pane *pane)
64 { 64 {
65 m_document = doc; 65 m_document = doc;
66 m_fileModel = model; 66 m_fileModel = model;
67 m_paneStack = paneStack; 67 m_paneStack = paneStack;
68 m_pane = pane; 68 m_pane = pane;
69 69
70 QString plugname = "pYIN";
70 QString base = "vamp:pyin:pyin:"; 71 QString base = "vamp:pyin:pyin:";
71 QString f0out = "smoothedpitchtrack"; 72 QString f0out = "smoothedpitchtrack";
72 QString noteout = "notes"; 73 QString noteout = "notes";
73 74
74 // We need at least one main-model layer (time ruler, waveform or 75 // We need at least one main-model layer (time ruler, waveform or
106 lx->setBaseColour(ColourDatabase::getInstance()->getColourIndex(tr("Bright Red"))); 107 lx->setBaseColour(ColourDatabase::getInstance()->getColourIndex(tr("Bright Red")));
107 m_document->addLayerToView(m_pane, lx); 108 m_document->addLayerToView(m_pane, lx);
108 } 109 }
109 */ 110 */
110 111
111 if (!tf->haveTransform(base + f0out) || !tf->haveTransform(base + noteout)) { 112 QString notFound = tr("Transform \"%1\" not found. Unable to analyse audio file.<br><br>Is the %2 Vamp plugin correctly installed?");
112 std::cerr << "ERROR: Analyser::newFileLoaded: Transform unknown" << std::endl; 113 if (!tf->haveTransform(base + f0out)) {
113 return; 114 return notFound.arg(base + f0out).arg(plugname);
115 }
116 if (!tf->haveTransform(base + noteout)) {
117 return notFound.arg(base + noteout).arg(plugname);
114 } 118 }
115 119
116 Transform t = tf->getDefaultTransformFor 120 Transform t = tf->getDefaultTransformFor
117 (base + f0out, m_fileModel->getSampleRate()); 121 (base + f0out, m_fileModel->getSampleRate());
118 t.setStepSize(256); 122 t.setStepSize(256);
162 loadState(Audio); 166 loadState(Audio);
163 loadState(PitchTrack); 167 loadState(PitchTrack);
164 loadState(Notes); 168 loadState(Notes);
165 169
166 emit layersChanged(); 170 emit layersChanged();
171
172 return "";
167 } 173 }
168 174
169 void 175 void
170 Analyser::getEnclosingSelectionScope(size_t f, size_t &f0, size_t &f1) 176 Analyser::getEnclosingSelectionScope(size_t f, size_t &f0, size_t &f1)
171 { 177 {