Mercurial > hg > svgui
comparison layer/SpectrogramLayer.cpp @ 592:a13aa5320221 sonification
Extends the audio feedback of the piano scale to the Spectrum layer (horizontal piano keyboard).
Increase of the piano keyboard width (SpectrogramLayer) and height (SpectrumLayer) for layout purposes. A get method should be added to obtain the scale size parameter outside the layer class.
author | mathieub <mathieu.barthet@eecs.qmul.ac.uk> |
---|---|
date | Wed, 06 Jul 2011 18:05:42 +0100 |
parents | 0946feb81b79 |
children | c080d14ff414 |
comparison
equal
deleted
inserted
replaced
591:0946feb81b79 | 592:a13aa5320221 |
---|---|
3272 m_model->getSampleRate() / 2)); | 3272 m_model->getSampleRate() / 2)); |
3273 | 3273 |
3274 int fw = paint.fontMetrics().width(tr("43Hz")); | 3274 int fw = paint.fontMetrics().width(tr("43Hz")); |
3275 if (tw < fw) tw = fw; | 3275 if (tw < fw) tw = fw; |
3276 | 3276 |
3277 int tickw = (m_frequencyScale == LogFrequencyScale ? 10 : 4); | 3277 //int tickw = (m_frequencyScale == LogFrequencyScale ? 10 : 4); |
3278 int tickw = (m_frequencyScale == LogFrequencyScale ? 20 : 4); | |
3278 | 3279 |
3279 return cw + tickw + tw + 13; | 3280 return cw + tickw + tw + 13; |
3280 } | 3281 } |
3281 | 3282 |
3282 void | 3283 void |
3290 | 3291 |
3291 //!!! cache this? | 3292 //!!! cache this? |
3292 | 3293 |
3293 int h = rect.height(), w = rect.width(); | 3294 int h = rect.height(), w = rect.width(); |
3294 | 3295 |
3295 int tickw = (m_frequencyScale == LogFrequencyScale ? 10 : 4); | 3296 //int tickw = (m_frequencyScale == LogFrequencyScale ? 10 : 4); |
3296 int pkw = (m_frequencyScale == LogFrequencyScale ? 10 : 0); | 3297 //int pkw = (m_frequencyScale == LogFrequencyScale ? 10 : 0); |
3298 | |
3299 int tickw = (m_frequencyScale == LogFrequencyScale ? 20 : 4); | |
3300 int pkw = (m_frequencyScale == LogFrequencyScale ? 20 : 0); | |
3297 | 3301 |
3298 size_t bins = m_fftSize / 2; | 3302 size_t bins = m_fftSize / 2; |
3299 int sr = m_model->getSampleRate(); | 3303 int sr = m_model->getSampleRate(); |
3300 | 3304 |
3301 if (m_maxFrequency > 0) { | 3305 if (m_maxFrequency > 0) { |
3796 | 3800 |
3797 midipitch = Pitch::getPitchForFrequency(freq,centsOffsetReturn,concertA); | 3801 midipitch = Pitch::getPitchForFrequency(freq,centsOffsetReturn,concertA); |
3798 | 3802 |
3799 std::cerr<< "Frequency: " << freq << " " << unit.toStdString() << " (midi pitch = " << midipitch << ")" << std::endl; | 3803 std::cerr<< "Frequency: " << freq << " " << unit.toStdString() << " (midi pitch = " << midipitch << ")" << std::endl; |
3800 | 3804 |
3801 v->playExampleNote(midipitch); | 3805 if ((midipitch>=0)&&(midipitch<127)) { |
3806 v->playExampleNote(midipitch); | |
3807 } | |
3802 | 3808 |
3803 return true; | 3809 return true; |
3804 | 3810 |
3805 } else { | 3811 } else { |
3806 return false; | 3812 return false; |