48 lines
1.5 KiB
C++
48 lines
1.5 KiB
C++
#ifndef _CHORDMAPPER_HPP_
|
|
#define _CHORDMAPPER_HPP_
|
|
#ifndef _COMMON_BLOCK_HPP_
|
|
#include <common/block.hpp>
|
|
#endif
|
|
#ifndef _GUITAR_FRETTEDNOTE_HPP_
|
|
#include <guitar/FrettedNote.hpp>
|
|
#endif
|
|
#ifndef _GUITAR_FRETBOARD_HPP_
|
|
#include <guitar/Fretboard.hpp>
|
|
#endif
|
|
#ifndef _MUSIC_CHORD_HPP_
|
|
#include <music/Chord.hpp>
|
|
#endif
|
|
|
|
class ChordMapper
|
|
{
|
|
public:
|
|
ChordMapper();
|
|
virtual ~ChordMapper();
|
|
bool map(const Music::Chord &chord,Block<FrettedNote> &frettedNotes);
|
|
private:
|
|
enum {MaxFretDistance=4}; // Maximum distance for note spanning across frets
|
|
bool getAt(const Note ¬e,FrettedNote &frettedNote,Block<FrettedNote> &containedNotes);
|
|
bool getAt(int startingString,int direction,const Note ¬e,FrettedNote &frettedNote,Block<FrettedNote> &containedNotes);
|
|
int distance(const FrettedNote &frettedNote,Block<FrettedNote> &frettedNotes);
|
|
int distance(const FrettedNote &firstNote,const FrettedNote &secondNote);
|
|
bool getFillerNotes(int fret,const Music::Chord &chord,Block<FrettedNote> &frettedNotes);
|
|
bool contains(const FrettedNote &frettedNote,Block<FrettedNote> &frettedNotes);
|
|
bool isIn(const FrettedNote &frettedNote,const Music::Chord &chord);
|
|
|
|
void getNearestNote(const FrettedNote &frettedNote,const Note &srchNote,FrettedNote &foundNote);
|
|
bool getNearestNoteInRange(const FrettedNote &frettedNote,const Note &srchNote,FrettedNote &foundNote,int stringOffset,int fretOffset);
|
|
|
|
Fretboard mFretboard;
|
|
};
|
|
|
|
inline
|
|
ChordMapper::ChordMapper()
|
|
{
|
|
}
|
|
|
|
inline
|
|
ChordMapper::~ChordMapper()
|
|
{
|
|
}
|
|
#endif
|