Mercurial > hg > svgui
comparison layer/NoteLayer.cpp @ 544:1dd2cddc32eb
* Show MIDI pitch number as well as note name and frequency
author | Chris Cannam |
---|---|
date | Tue, 18 Aug 2009 11:01:57 +0000 |
parents | efe0f232685f |
children | d666f5f8b154 |
comparison
equal
deleted
inserted
replaced
543:b73f486fc2e4 | 544:1dd2cddc32eb |
---|---|
452 if (shouldConvertMIDIToHz()) { | 452 if (shouldConvertMIDIToHz()) { |
453 | 453 |
454 int mnote = lrintf(note.value); | 454 int mnote = lrintf(note.value); |
455 int cents = lrintf((note.value - mnote) * 100); | 455 int cents = lrintf((note.value - mnote) * 100); |
456 float freq = Pitch::getFrequencyForPitch(mnote, cents); | 456 float freq = Pitch::getFrequencyForPitch(mnote, cents); |
457 pitchText = tr("%1 (%2 Hz)") | 457 pitchText = tr("%1 (%2, %3 Hz)") |
458 .arg(Pitch::getPitchLabel(mnote, cents)).arg(freq); | 458 .arg(Pitch::getPitchLabel(mnote, cents)) |
459 .arg(mnote) | |
460 .arg(freq); | |
459 | 461 |
460 } else if (m_model->getScaleUnits() == "Hz") { | 462 } else if (m_model->getScaleUnits() == "Hz") { |
461 | 463 |
462 pitchText = tr("%1 Hz (%2)") | 464 pitchText = tr("%1 Hz (%2, %3)") |
463 .arg(note.value) | 465 .arg(note.value) |
464 .arg(Pitch::getPitchLabelForFrequency(note.value)); | 466 .arg(Pitch::getPitchLabelForFrequency(note.value)) |
467 .arg(Pitch::getPitchForFrequency(note.value)); | |
465 | 468 |
466 } else { | 469 } else { |
467 pitchText = tr("%1 %2") | 470 pitchText = tr("%1 %2") |
468 .arg(note.value).arg(m_model->getScaleUnits()); | 471 .arg(note.value).arg(m_model->getScaleUnits()); |
469 } | 472 } |