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

Describe a note as a musical event (pitch + duration) More...

#include <Music.hpp>

Inheritance diagram for Note:
Pitch CompleteNoteName

Public Member Functions

 Note (const Pitch &n=Pitch(), const Fraction &duration=1)
 Constructor for note based on pitch. More...
 
 Note (NoteName n, Accidental mod=Accidental::None, Octave o=4, const Fraction &duration=Fraction(1))
 Constructor for note with full info. More...
 
bool operator== (const Note &o) const __attribute__((pure))
 Comparison operator for Note done.
 
bool operator!= (const Note &o) const __attribute__((pure))
 Difference operator for Note done.
 
- Public Member Functions inherited from Pitch
 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...
 

Static Public Member Functions

static unsigned noteToHalfTone (const CompleteNoteName &n) __attribute__((const ))
 

Public Attributes

Fraction m_duration
 Duration of the note, as a fraction of a beat.
 
- Public Attributes inherited from Pitch
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 as a musical event (pitch + duration)

Constructor & Destructor Documentation

Note::Note ( const Pitch n = Pitch(),
const Fraction duration = 1 
)

Constructor for note based on pitch.

Exceptions
std::domain_errorif the duration is non positive
Note
done
Note::Note ( NoteName  n,
Accidental  mod = Accidental::None,
Octave  o = 4,
const Fraction duration = Fraction(1) 
)

Constructor for note with full info.

Exceptions
std::domain_errorif the duration is non positive
Note
done

Member Function Documentation

static unsigned Note::noteToHalfTone ( const CompleteNoteName n) const
static

Correspondance between notes and integers (respecting the order) Useful in MusicRules.cpp as in Music.cpp


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