Esempio n. 1
0
bool Pitch::operator==( const Pitch &orig ){
  if( m_note == orig.getNoteName() &&
      m_acc == orig.getAccidental() && 
      m_oct == orig.getOctave() )
    return true;
  else
    return false;
}
Esempio n. 2
0
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);
}
Esempio n. 3
0
/** 
 * 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);
}
Esempio n. 4
0
/**
 * 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);
}
Esempio n. 5
0
/** 
 * 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);
}
Esempio n. 6
0
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;
}