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

Describe a chord. More...

#include <Music.hpp>

Public Types

enum  ChordType {
  ChordType::Minor, ChordType::Major, ChordType::Sus4, ChordType::Sus2,
  ChordType::Dim, ChordType::Aug
}
 Describes the type of the third note in the chord. More...
 
enum  SeventhType { Major, Minor, Dim, None }
 Describes the Type of the fourth note of the chord. More...
 
using ChordID = unsigned
 

Public Member Functions

std::vector< CompleteNoteNamegetNotes () const __attribute__((pure))
 transform a chord into notes More...
 
 Chord (Fraction d=4, const CompleteNoteName &b=CompleteNoteName(), const SeventhType &s=SeventhType::None, const ChordType &c=ChordType::Major)
 Constructor with parameters. More...
 
bool operator== (const Chord &o) const __attribute__((pure))
 Equality operator for Chord. More...
 
bool operator!= (const Chord &o) const __attribute__((pure))
 Inequality operator for Chord. More...
 
 Chord (ChordID id)
 
 operator ChordID () const
 

Static Public Member Functions

static const std::vector
< CompleteNoteName > & 
getNotes (ChordID c)
 

Public Attributes

Fraction m_duration
 Hold the duration of the chord, in fraction of the bar it is played in. SHOULD BE DELETED ?
 
CompleteNoteName m_base
 Name of the base name of the note.
 
SeventhType m_seventh
 if it's not None, the seventh is added according to this value (Dim = double Flat)
 
ChordType m_type
 Type of the chord.
 

Static Public Attributes

static const unsigned nbChords = 6*4*12
 

Detailed Description

Describe a chord.

A chord is characterized by a base note, a duration (fraction of the measure) and some alteration.

Member Enumeration Documentation

enum Chord::ChordType
strong

Describes the type of the third note in the chord.

Enumerator
Minor 

Describes a minor chord, meaning that the first third is a minor third.

Major 

Describes a major chord, meaning that the first third is a major third.

Sus4 

Describes a suspended fourth chord, meaning that the third is replaced by a forth.

Sus2 

Describes a suspended second chord, meaning that the third is replaced by a second.

Dim 

Describes a diminished chord, composed of a minor third and a diminished fifth.

Aug 

Describes a augmented chord, in which the fifth is augmented.

enum Chord::SeventhType
strong

Describes the Type of the fourth note of the chord.

Describe the nature of the chord.

By default, a chord is a triad composed of a base note, a third, and a fifth over it.

Constructor & Destructor Documentation

Chord::Chord ( Fraction  d = 4,
const CompleteNoteName b = CompleteNoteName(),
const SeventhType s = SeventhType::None,
const ChordType c = ChordType::Major 
)

Constructor with parameters.

Parameters
dDuration of the chord, in fraction of the bar it is played in.
bName of the base name of the note
sType of the seventh
cType of the chord
Note
done

Member Function Documentation

std::vector<CompleteNoteName> Chord::getNotes ( ) const

transform a chord into notes

Returns
vector of size 3 (or 4) containing the notes of the chord
Note
done
bool Chord::operator!= ( const Chord o) const

Inequality operator for Chord.

Note
done
bool Chord::operator== ( const Chord o) const

Equality operator for Chord.

Note
done

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