58 lines
1.3 KiB
C++
58 lines
1.3 KiB
C++
#ifndef _MUSIC_CHORD_HPP_
|
|
#define _MUSIC_CHORD_HPP_
|
|
#ifndef _MUSIC_NOTES_HPP_
|
|
#include <music/notes.hpp>
|
|
#endif
|
|
#ifndef _MUSIC_DEGREE_HPP_
|
|
#include <music/degree.hpp>
|
|
#endif
|
|
#ifndef _MIDISEQ_MIDIOUTDEVICE_HPP_
|
|
#include <midiseq/midiout.hpp>
|
|
#endif
|
|
|
|
namespace Music
|
|
{
|
|
class Chord : public Notes
|
|
{
|
|
public:
|
|
typedef enum ChordType{MajorTriad,MinorTriad,DiminishedTriad,AugmentedTriad,MajorSeventh,DiminishedSeventh,
|
|
HalfDiminishedSeventh,MinorSixth,MinorSeventh,MinorMajorSeventh,DominantSixth,DominantSeventh};
|
|
Chord();
|
|
virtual ~Chord();
|
|
bool play(MIDIOutputDevice &device,bool noteOffAfterPlay=true);
|
|
void create(const Note &root=Note(Note::C),ChordType chordType=MajorTriad);
|
|
Note getRoot(void)const;
|
|
private:
|
|
void handleMajorTriad(Note root);
|
|
void handleMajorSeventh(Note root);
|
|
void handleMinorTriad(Note root);
|
|
void handleDiminishedTriad(Note root);
|
|
void handleAugmentedTriad(Note root);
|
|
void handleDiminishedSeventh(Note note);
|
|
void handleHalfDiminishedSeventh(Note note);
|
|
void handleMinorSixth(Note note);
|
|
void handleMinorSeventh(Note note);
|
|
void handleMinorMajorSeventh(Note note);
|
|
void handleDominantSixth(Note note);
|
|
void handleDominantSeventh(Note note);
|
|
};
|
|
|
|
inline
|
|
Chord::Chord()
|
|
{
|
|
}
|
|
|
|
inline
|
|
Chord::~Chord()
|
|
{
|
|
}
|
|
}
|
|
|
|
inline
|
|
Note Music::Chord::getRoot(void)const
|
|
{
|
|
return ((Notes&)*this).operator[](0);
|
|
}
|
|
#endif
|
|
|