Beispiel #1
0
        static CNoteFingerPosition GetNextPositionForNote(int eNote, CFingerPosition sLastPosition)
        {
            CNoteFingerPosition sCurrentNote = null;

            if (sLastPosition != null)
            {
                sCurrentNote = new CNoteFingerPosition(sLastPosition, eNote);
                sCurrentNote.AdvanceFrets(1);
            }
            else
            {
                sCurrentNote = new CNoteFingerPosition(Globals.s_posFirstGuitarNote);
            }

            // Go through the notes to find that requested note.
            bool fNoteFound = false;

            // Kidder asks: You just set it to false, why check?
            while (!fNoteFound)
            {
                // Check if we got our note.
                if (eNote == sCurrentNote.Note)
                {
                    fNoteFound = true;
                    break;
                }

                if (!sCurrentNote.AdvanceFrets(1))
                {
                    throw new Exception("What the f**k you want?");
                }
            }

            return(sCurrentNote);
        }
        public override bool Add(CFingerPosition cPos, out bool fCapo)
        {
            fCapo = false;

            if (Fret == -1)
            {
                int nPriority;
                if (!GetPriorityForPlay(cPos, out nPriority))
                {
                    return(false);
                }
                Priority = nPriority;
                Fret     = cPos.Fret;
                Strings.Add(cPos.String);
                return(true);
            }

            Strings.Sort(new Comparison <EString>(CompareString));

            if (cPos.Fret == Fret)
            {
                bool fToAdd = (Strings.Count == 0);

                // Going through the strings.
                foreach (EString eCurr in Strings)
                {
                    if (Math.Abs(eCurr - cPos.String) == 1)
                    {
                        fCapo  = true;
                        fToAdd = true;
                    }

                    if (eCurr == cPos.String)
                    {
                        return(true);
                    }
                }

                if (fToAdd)
                {
                    Strings.Add(cPos.String);
                    int nPriority;
                    if (!GetPriorityForPlay(cPos, true, out nPriority))
                    {
                        return(false);
                    }
                    Priority = nPriority;
                    return(true);
                }
            }

            return(false);
        }
Beispiel #3
0
        protected override bool GetPriorityForPlay(CFingerPosition cFngr, bool fCapo, out int nPriority)
        {
            nPriority = 0;
            if (!cFngr.IsValid())
            {
                return(false);
            }

            int nResult = 0;

            nResult += (cFngr.Fret * 3);

            if (fCapo)
            {
                nResult -= 10; // TODO: Change to be constants.
            }

            nPriority = nResult;
            return(true);
        }
Beispiel #4
0
        protected override bool GetPriorityForPlay(CFingerPosition cFngr, bool fCapo, out int nPriority)
        {
            nPriority = 0;
            if (!cFngr.IsValid())
            {
                return(false);
            }

            int nResult = 0;

            nResult += cFngr.Fret;

            if (fCapo)
            {
                nResult -= 10; // TODO: Change to be constants.
            }
            else
            {
                switch (cFngr.String)
                {
                case EString.Sixth:
                case EString.Fifth:
                case EString.Fourth:
                case EString.Third:
                    nResult -= ((EString.NumberOfStrings - cFngr.String) * 2);
                    break;

                case EString.Second:
                case EString.First:
                    nResult += 10;
                    break;

                default:
                    throw new Exception("Damnit");
                }
            }

            nPriority = nResult;

            return(true);
        }
Beispiel #5
0
        bool IsBefore(CFingerPosition other)
        {
            if (String == other.String)
            {
                return(Fret < other.Fret);
            }

            if (String < other.String)
            {
                int nFretToCheck =
                    other.Fret + (other.String - String) * Globals.NUMBER_OF_FRETS_IN_OCTAVE;

                return(Fret < nFretToCheck);
            }
            else
            {
                int nFretToCheck =
                    Fret + (String - other.String) * Globals.NUMBER_OF_FRETS_IN_OCTAVE;

                return(nFretToCheck < other.Fret);
            }
        }
Beispiel #6
0
        protected override bool GetPriorityForPlay(CFingerPosition cFngr, bool fCapo, out int nPriority)
        {
            nPriority = 0;
            if (!cFngr.IsValid())
            {
                return(false);
            }

            int nResult = 0;

            nResult += (Globals.NUMBER_OF_FRETS - cFngr.Fret);

            if (fCapo)
            {
                nResult -= 4; // TODO: Change to be constants.
            }

            switch (cFngr.String)
            {
            case EString.Sixth:
            case EString.Fifth:
            case EString.Fourth:
            case EString.Third:
                nResult += 5;
                nResult -= ((EString.NumberOfStrings - cFngr.String) / 2);
                break;

            case EString.Second:
            case EString.First:
                nResult -= (3 + (int)cFngr.String);
                break;

            default:
                return(false);
            }

            nPriority = nResult;
            return(true);
        }
Beispiel #7
0
        protected override bool GetPriorityForPlay(CFingerPosition cFngr, bool fCapo, out int nPriority)
        {
            nPriority = 0;

            if (!cFngr.IsValid())
            {
                return(false);
                //throw new Exception("F**k it");
            }

            int nResult = 0;

            nResult += Globals.NUMBER_OF_FRETS - cFngr.Fret;

            nResult += ((EString.NumberOfStrings - cFngr.String) * Globals.NUMBER_OF_FRETS_IN_OCTAVE / 3); // TODO: This should be more dynamic.

            if (fCapo)
            {
                nResult += (Strings.Count / 2);
            }

            nPriority = nResult;
            return(true);
        }
 protected override bool GetPriorityForPlay(CFingerPosition cFngr, out int o_nPriority)
 {
     return(GetPriorityForPlay(cFngr, false, out o_nPriority));
 }
        public override bool Add(CFingerPosition cPos)
        {
            bool fFuckIt;

            return(Add(cPos, out fFuckIt));
        }
Beispiel #10
0
 public CNoteFingerPosition(CFingerPosition cPosition, int eNote)
 {
     FingerPosition = new CFingerPosition(cPosition);
     Note           = eNote;
 }
Beispiel #11
0
 bool IsLastPosition(CFingerPosition pos)
 {
     return(pos.IsLastPosition());
 }
Beispiel #12
0
 public bool Equals(CFingerPosition other)
 {
     return(String == other.String &&
            Fret == other.Fret);
 }
Beispiel #13
0
 public CNoteFingerPosition(CNoteFingerPosition other)
 {
     FingerPosition = new CFingerPosition(other.FingerPosition);
     Note           = other.Note;
 }
Beispiel #14
0
 public CFingerPosition(CFingerPosition other)
 {
     String = other.String;
     Fret   = other.Fret;
 }
Beispiel #15
0
 abstract protected bool GetPriorityForPlay(CFingerPosition cFngr, bool fCapo, out int nPriority);
Beispiel #16
0
 abstract public bool Add(CFingerPosition cPos, out bool fCapo);
Beispiel #17
0
 abstract public bool Add(CFingerPosition cPos);