comparison src/Analyser.cpp @ 227:ae0bf8dc5833

Crude ability to adjust displayed frequency range
author Chris Cannam
date Tue, 11 Mar 2014 09:26:04 +0000
parents 9bdff8d10a86
children d40c6cdb30a4
comparison
equal deleted inserted replaced
226:9bdff8d10a86 227:ae0bf8dc5833
114 m_reAnalysisCandidates.clear(); 114 m_reAnalysisCandidates.clear();
115 m_currentCandidate = -1; 115 m_currentCandidate = -1;
116 m_reAnalysingSelection = Selection(); 116 m_reAnalysingSelection = Selection();
117 } 117 }
118 118
119 bool
120 Analyser::getDisplayFrequencyExtents(float &min, float &max)
121 {
122 if (!m_layers[Spectrogram]) return false;
123 return m_layers[Spectrogram]->getDisplayExtents(min, max);
124 }
125
126 bool
127 Analyser::setDisplayFrequencyExtents(float min, float max)
128 {
129 if (!m_layers[Spectrogram]) return false;
130 m_layers[Spectrogram]->setDisplayExtents(min, max);
131 }
132
119 QString 133 QString
120 Analyser::addVisualisations() 134 Analyser::addVisualisations()
121 { 135 {
122 /* 136 // A spectrogram, off by default. Must go at the back because it's
137 // opaque
138
139 /* This is roughly what we'd do for a constant-Q spectrogram, but it
140 currently has issues with y-axis alignment
141
123 TransformFactory *tf = TransformFactory::getInstance(); 142 TransformFactory *tf = TransformFactory::getInstance();
124 143
125 QString name = "Constant-Q"; 144 QString name = "Constant-Q";
126 QString base = "vamp:cqvamp:cqvamp:"; 145 QString base = "vamp:cqvamp:cqvamp:";
127 QString out = "constantq"; 146 QString out = "constantq";
128 147
129 // A spectrogram, off by default. Must go at the back because it's
130 // opaque
131
132 QString notFound = tr("Transform \"%1\" not found, spectrogram will not be enabled.<br><br>Is the %2 Vamp plugin correctly installed?"); 148 QString notFound = tr("Transform \"%1\" not found, spectrogram will not be enabled.<br><br>Is the %2 Vamp plugin correctly installed?");
133 if (!tf->haveTransform(base + out)) { 149 if (!tf->haveTransform(base + out)) {
134 return notFound.arg(base + out).arg(name); 150 return notFound.arg(base + out).arg(name);
135 } 151 }
136 152
147 SpectrogramLayer *spectrogram = qobject_cast<SpectrogramLayer *> 163 SpectrogramLayer *spectrogram = qobject_cast<SpectrogramLayer *>
148 (m_document->createMainModelLayer(LayerFactory::MelodicRangeSpectrogram)); 164 (m_document->createMainModelLayer(LayerFactory::MelodicRangeSpectrogram));
149 165
150 spectrogram->setColourMap((int)ColourMapper::BlackOnWhite); 166 spectrogram->setColourMap((int)ColourMapper::BlackOnWhite);
151 spectrogram->setNormalizeHybrid(true); 167 spectrogram->setNormalizeHybrid(true);
152 // spectrogram->setSmooth(true);
153 // spectrogram->setGain(0.5); //!!! arbitrary at this point
154 spectrogram->setMinFrequency(15);
155 spectrogram->setGain(100); 168 spectrogram->setGain(100);
156 m_document->addLayerToView(m_pane, spectrogram); 169 m_document->addLayerToView(m_pane, spectrogram);
157 spectrogram->setLayerDormant(m_pane, true); 170 spectrogram->setLayerDormant(m_pane, true);
158 171
159 m_layers[Spectrogram] = spectrogram; 172 m_layers[Spectrogram] = spectrogram;