Mercurial > hg > svgui
comparison view/Pane.cpp @ 589:7ebd5a21d74f sonification
Branch to handle audio feedback and metadata sonification interactively with the UI.
Piano keyboard audio feedback:
The midi pitch of a piano keyboard note is retrieved in SpectrogramLayer::processMouseEvent when a left click is made on the note in the Select tool mode (SpectrogramLayer with a log frequency scale). The same process should be applied to the Spectrum layer (log frequency scale) as well.
author | mathieub <mathieu.barthet@eecs.qmul.ac.uk> |
---|---|
date | Wed, 22 Jun 2011 00:04:21 +0100 |
parents | 4806715f7a19 |
children | 241929c5d57c |
comparison
equal
deleted
inserted
replaced
587:4806715f7a19 | 589:7ebd5a21d74f |
---|---|
22 #include "ViewManager.h" | 22 #include "ViewManager.h" |
23 #include "widgets/CommandHistory.h" | 23 #include "widgets/CommandHistory.h" |
24 #include "widgets/TextAbbrev.h" | 24 #include "widgets/TextAbbrev.h" |
25 #include "base/Preferences.h" | 25 #include "base/Preferences.h" |
26 #include "layer/WaveformLayer.h" | 26 #include "layer/WaveformLayer.h" |
27 | |
28 #include "layer/LayerFactory.h" | |
29 #include "layer/Layer.h" | |
30 #include "layer/SpectrogramLayer.h" | |
27 | 31 |
28 //!!! ugh | 32 //!!! ugh |
29 #include "data/model/WaveFileModel.h" | 33 #include "data/model/WaveFileModel.h" |
30 | 34 |
31 #include <QPaintEvent> | 35 #include <QPaintEvent> |
1302 | 1306 |
1303 float vmin, vmax, dmin, dmax; | 1307 float vmin, vmax, dmin, dmax; |
1304 if (getTopLayerDisplayExtents(vmin, vmax, dmin, dmax)) { | 1308 if (getTopLayerDisplayExtents(vmin, vmax, dmin, dmax)) { |
1305 m_dragStartMinValue = dmin; | 1309 m_dragStartMinValue = dmin; |
1306 } | 1310 } |
1311 | |
1312 //to process the mouse event when a left click is made in the layer and the tool mode is Select | |
1313 //(to handle e.g. the audio feedback of the piano keyboard notes) | |
1314 //does not work with the Navigate tool mode: (mode == ViewManager::NavigateMode) || | |
1315 //which could be also interesting | |
1316 } else if ((mode == ViewManager::SelectMode) && | |
1317 (e->buttons() & Qt::LeftButton)) { | |
1318 | |
1319 Layer *layer = getTopLayer(); | |
1320 LayerFactory::LayerType type = LayerFactory::getInstance()->getLayerType(layer); | |
1321 | |
1322 //if (type==(LayerFactory::LayerType) MelodicRangeSpectrogram) layer->checkMouseClick(this, e); | |
1323 | |
1324 //std::cerr << "Vertical scale width: " << getVerticalScaleWidth() << std::endl; | |
1325 | |
1326 //should call processMouseEvent only when a LogFrequencyScale is used but this is handled by | |
1327 //overidding the function only in the relevant layer types | |
1328 layer->processMouseEvent(this, e, getVerticalScaleWidth()); | |
1307 | 1329 |
1308 } else if (mode == ViewManager::SelectMode) { | 1330 } else if (mode == ViewManager::SelectMode) { |
1309 | 1331 |
1310 if (!hasTopLayerTimeXAxis()) return; | 1332 if (!hasTopLayerTimeXAxis()) return; |
1311 | 1333 |