bool Pitch::operator==( const Pitch &orig ){ if( m_note == orig.getNoteName() && m_acc == orig.getAccidental() && m_oct == orig.getOctave() ) return true; else return false; }
void TestTranspose::testTransposeBbToF() { Pitch bb(70, Accidentals::Flat); Key besmaj("Bb major"); Pitch result = bb.transpose(besmaj, -5, -3); Accidental resultAccidental = result.getAccidental(besmaj); int resultPitch = result.getPerformancePitch(); QCOMPARE(resultAccidental, Accidentals::NoAccidental); QCOMPARE(resultPitch, 65); }
/** * transpose an C# down by an augmented prime in C# major, should yield a C (in C major) */ void TestTranspose::testCisToC() { // Testing transposing C# to C Pitch cis(73, Accidentals::Sharp); Pitch result = cis.transpose(Key("C# major"), -1, 0); Accidental resultAccidental = result.getAccidental(Key("C major")); int resultPitch = result.getPerformancePitch(); QCOMPARE(resultAccidental, Accidentals::NoAccidental); QCOMPARE(resultPitch, 72); }
/** * Transpose G to D in the key of D major. */ void TestTranspose::testGToD() { // Testing transposing G to D Pitch g(67, Accidentals::Natural); Key* dmaj = new Key("D major"); Pitch result = g.transpose(*dmaj, 7, 4); Accidental resultAccidental = result.getAccidental(*dmaj); int resultPitch = result.getPerformancePitch(); QCOMPARE(resultAccidental, Accidentals::NoAccidental); QCOMPARE(resultPitch, 74); }
/** * transpose an A# up by a major second, should * yield a B# (as C would be a minor triad) */ void TestTranspose::testAisToBis() { // Testing transposing A# to B# Pitch ais(70, Accidentals::Sharp); Key cmaj ("C major"); Pitch result = ais.transpose(cmaj, 2, 1); Accidental resultAccidental = result.getAccidental(cmaj); int resultPitch = result.getPerformancePitch(); QCOMPARE(resultAccidental, Accidentals::Sharp); QCOMPARE(resultPitch, 72); }
bool Pitch::operator!=( const Pitch &orig ){ if( m_note != orig.getNoteName() ) return true; if( m_acc != orig.getAccidental() ) return true; if( m_oct != orig.getOctave() ) return true; else return false; }