Mercurial > hg > svgui
diff 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 |
line wrap: on
line diff
--- a/view/Pane.cpp Tue Jun 14 15:27:05 2011 +0100 +++ b/view/Pane.cpp Wed Jun 22 00:04:21 2011 +0100 @@ -25,6 +25,10 @@ #include "base/Preferences.h" #include "layer/WaveformLayer.h" +#include "layer/LayerFactory.h" +#include "layer/Layer.h" +#include "layer/SpectrogramLayer.h" + //!!! ugh #include "data/model/WaveFileModel.h" @@ -1305,6 +1309,24 @@ m_dragStartMinValue = dmin; } + //to process the mouse event when a left click is made in the layer and the tool mode is Select + //(to handle e.g. the audio feedback of the piano keyboard notes) + //does not work with the Navigate tool mode: (mode == ViewManager::NavigateMode) || + //which could be also interesting + } else if ((mode == ViewManager::SelectMode) && + (e->buttons() & Qt::LeftButton)) { + + Layer *layer = getTopLayer(); + LayerFactory::LayerType type = LayerFactory::getInstance()->getLayerType(layer); + + //if (type==(LayerFactory::LayerType) MelodicRangeSpectrogram) layer->checkMouseClick(this, e); + + //std::cerr << "Vertical scale width: " << getVerticalScaleWidth() << std::endl; + + //should call processMouseEvent only when a LogFrequencyScale is used but this is handled by + //overidding the function only in the relevant layer types + layer->processMouseEvent(this, e, getVerticalScaleWidth()); + } else if (mode == ViewManager::SelectMode) { if (!hasTopLayerTimeXAxis()) return;