Generate an accompaniement for a given melody
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
Pitch Struct Reference

Describe a note with its absolute pitch. More...

#include <Music.hpp>

Inheritance diagram for Pitch:
CompleteNoteName Note

Public Member Functions

 Pitch (const CompleteNoteName &n, Octave o=4)
 Construtor for Pitch with a CompleteNotename. More...
 
 Pitch (NoteName n=NoteName::C, Accidental mod=Accidental::None, Octave o=4)
 Construtor for Pitch with full info If the note is A Flat, and octave o, it means it is a G Sharp at octave o. More...
 
Pitchoperator+= (int nb)
 Adds half tones to pitch. More...
 
Pitch operator+ (int nb) const __attribute__((pure))
 Creates new Pitch by adding nb half tones to this one. More...
 
Pitchoperator-= (int nb)
 Substract half tones to pitch. More...
 
Pitch operator- (int nb) const __attribute__((pure))
 Creates new Pitch by substracting nb half tones to this one. More...
 
bool operator== (const Pitch &o) const __attribute__((pure))
 Comparison operator for Pitch done.
 
bool operator!= (const Pitch &o) const __attribute__((pure))
 Difference operator for Pitch done.
 
CompleteNoteName getNoteName () const __attribute__((pure))
 Returns the name of the note, ommiting the octave. More...
 
- Public Member Functions inherited from CompleteNoteName
 CompleteNoteName (NoteName n=NoteName::C, Accidental mod=Accidental::None)
 Constructor for CompleteNoteName. More...
 
bool operator== (const CompleteNoteName &o) const __attribute__((pure))
 Comparison operator for CompleteNoteName. More...
 
bool operator!= (const CompleteNoteName &o) const __attribute__((pure))
 Difference operator for CompleteNoteName. More...
 

Public Attributes

Octave m_octave
 octave of the note (absolute height of the note)
 
- Public Attributes inherited from CompleteNoteName
NoteName m_name
 Name of the note (C,D,...)
 
Accidental m_modifier
 Accidental of the note (sharp, flat,none)
 

Detailed Description

Describe a note with its absolute pitch.

Constructor & Destructor Documentation

Pitch::Pitch ( const CompleteNoteName n,
Octave  o = 4 
)

Construtor for Pitch with a CompleteNotename.

Note
done
Pitch::Pitch ( NoteName  n = NoteName::C,
Accidental  mod = Accidental::None,
Octave  o = 4 
)

Construtor for Pitch with full info If the note is A Flat, and octave o, it means it is a G Sharp at octave o.

Note
done

Member Function Documentation

CompleteNoteName Pitch::getNoteName ( ) const

Returns the name of the note, ommiting the octave.

Returns
a complete note name
Pitch Pitch::operator+ ( int  nb) const

Creates new Pitch by adding nb half tones to this one.

Parameters
nbthe number of half tones to add
Exceptions
std::domain_errorif the result is bellow the lowest representable note
Returns
a Pitch which sound is nb half tones higher done
Pitch& Pitch::operator+= ( int  nb)

Adds half tones to pitch.

Parameters
nbthe number of half tones to add
Returns
*this
Exceptions
std::domain_errorif the result is bellow the lowest representable note done
Pitch Pitch::operator- ( int  nb) const

Creates new Pitch by substracting nb half tones to this one.

Parameters
nbnumber of half tones to substract
Returns
a Pitch which sound is nb half tone lower
Exceptions
std::domain_errorif the result is bellow the lowest representable note done
Pitch& Pitch::operator-= ( int  nb)

Substract half tones to pitch.

Parameters
nbthe number of half tones to substract
Returns
*this
Exceptions
std::domain_errorif the result is bellow the lowest representable note done

The documentation for this struct was generated from the following file: