# HG changeset patch # User Chris Cannam # Date 1417542797 0 # Node ID 139aad8bb445e1e6c4d6f76f835de8e6b0c4533b # Parent 01cceacee3da176eb31167bf5624f149cf85f527 Wire up note/octave stuff diff -r 01cceacee3da -r 139aad8bb445 widgets/UnitConverter.cpp --- a/widgets/UnitConverter.cpp Tue Dec 02 13:50:49 2014 +0000 +++ b/widgets/UnitConverter.cpp Tue Dec 02 17:53:17 2014 +0000 @@ -126,6 +126,9 @@ UnitConverter::noteChanged(int note) { cerr << "noteChanged: " << note << endl; + int pitch = Pitch::getPitchForNoteAndOctave(m_note->currentIndex(), + m_octave->value()); + m_hz->setValue(Pitch::getFrequencyForPitch(pitch, m_cents->value())); } void @@ -153,15 +156,23 @@ { float cents = 0; int pitch = Pitch::getPitchForFrequency(m_hz->value(), ¢s); + int note, octave; + Pitch::getNoteAndOctaveForPitch(pitch, note, octave); m_midi->blockSignals(true); m_cents->blockSignals(true); + m_note->blockSignals(true); + m_octave->blockSignals(true); m_midi->setValue(pitch); m_cents->setValue(cents); - + m_note->setCurrentIndex(note); + m_octave->setValue(octave); + m_midi->blockSignals(false); m_cents->blockSignals(false); + m_note->blockSignals(false); + m_octave->blockSignals(false); }