示例#1
0
        static void Main(string[] args)
        {
            //int[] lstNotes = {0, 4, 7, 12, 16, 19, 24, 28 };
            int[] lstNotes   = { 0, 3, 7 };
            int[] multiplied = new int[12];
            for (int multiply = 0; multiply < 4; multiply++)
            {
                for (int i = 0; i < lstNotes.Length; i++)
                {
                    multiplied[multiply * lstNotes.Length + i] = lstNotes[i] + 12 * multiply + (int)ENotes.E;
                }
            }
            CGuitarHand cHand = GetFingerPosition(multiplied);

            Console.WriteLine("cHand: " + cHand.ToString());
            Console.ReadLine();
        }
示例#2
0
        static public CGuitarHand GetFingerPosition(int[] lstNotes)
        {
            CGuitarHand rResult = null;

            // Get the first position for the starting note.
            CNoteFingerPosition posStart = null;

            while (true)
            {
                rResult = new CGuitarHand();

                if (posStart == null)
                {
                    posStart =
                        new CNoteFingerPosition(GetNextPositionForNote(lstNotes[0]));
                }
                else
                {
                    // Get the first position for the starting note
                    posStart =
                        new CNoteFingerPosition(GetNextPositionForNote(posStart.Note, posStart.FingerPosition));
                }

                if (!rResult.Add2(posStart))
                {
                    continue;
                }

                CNoteFingerPosition currPos;

                bool fContinue = false;

                // Now get all the rest.
                for (int nNoteIndex = 1; nNoteIndex < lstNotes.Length; nNoteIndex++)
                {
                    // Get the next position.W
                    currPos =
                        new CNoteFingerPosition(posStart);

                    if (!currPos.AdvanceFrets(lstNotes[nNoteIndex] - lstNotes[0]))
                    {
                        break;
                        //throw new Exception("I realy dont care anymore");
                    }

                    if (!rResult.Add2(currPos))
                    {
                        fContinue = true;
                        break;
                    }
                }

                if (fContinue)
                {
                    continue;
                }

                break;
            }

            if (!rResult.GenerateFingerPositioningFromLists())
            {
                return(null);
            }

            return(rResult);
        }