#include #include #include bool Fretboard::isOnFretboard(const Note ¬e) { for(int frIndex=0;frIndex &frettedNotes) { frettedNotes.remove(); for(int srIndex=0;srIndex &frettedNotes) { FrettedNote frettedNote; bool returnCode=true; bool isBarChord=false; frettedNotes.remove(); if(getAt(chord.getRoot(),frettedNote,frettedNotes)) // try to set the root on the top string { frettedNotes.insert(&frettedNote); isBarChord=true; } for(int index=chord.size()-1;index>=0;index--) { Note ¬e=((Music::Chord&)chord)[index]; if(getAt(note,frettedNote,frettedNotes))frettedNotes.insert(&frettedNote); else { String message("[Fretboard::getAt] Unable to map note '"+note.toString()+String("'")); GlobalDefs::outDebug(message); returnCode=false; } } // need to come up with a strategy here for mapping notes on the fretboard if(isBarChord) // check to see if we can fill in some notes at the bar chord fret { getFillerNotes(frettedNotes[0].getFret(),chord,frettedNotes); } return returnCode; } /* Find filler notes for given chord on given fret on empty string. */ bool Fretboard::getFillerNotes(int fret,const Music::Chord &chord,Block &frettedNotes) { bool notesInChord; for(int stringIndex=0;stringIndex &containedNotes) { for(int srIndex=0;srIndex4)continue; return true; } } } return false; } /* Check to see if the fretted note exists in the collection of fretted notes. * @param frettedNote - The fretted note to check for * @param frettedNotes - The collection of fretted notes */ bool Fretboard::contains(const FrettedNote &frettedNote,Block &frettedNotes) { for(int index=0;index &frettedNotes) { int maxDistance=0; int currDistance; for(int index=0;indexmaxDistance)maxDistance=currDistance; } return maxDistance; } void Fretboard::createFretboard(const Tuning &tuning,int frets) { mTuning=tuning; mFrets=frets; createFretboard(); } bool Fretboard::play(MIDIOutputDevice &device) { for(int string=0;string&)*this).operator[](string); strFretboard+=stringNotes.toString(); if(string