Пример #1
0
    public Note(uint _position,
                GuitarFret _fret_type,
                uint _sustain = 0,
                Flags _flags  = Flags.None) : base(_position)
    {
        length     = _sustain;
        flags      = _flags;
        guitarFret = _fret_type;

        previous = null;
        next     = null;
    }
Пример #2
0
 public Position(GuitarString stringNum, GuitarFret fretNum)
 {
     String = stringNum;
     Fret   = fretNum;
 }
 public Position(GuitarString stringNum, GuitarFret fretNum)
 {
     String = stringNum;
     Fret = fretNum;
 }
        /// <summary>
        /// Gets the X, Y, Width, and Height of the fret which is represented on the screen by a view.
        /// </summary>
        /// <param name="fretNum">The number of the requested fret.</param>
        /// <returns>Returns the metrics of the requested fret.</returns>
        private FretMetrics GetFretMetrics(GuitarFret fretNum)
        {
            //Initialize a dummy fret.
            View fret = new View(_currentActivity);

            //Get the correct fret number.
            /*if (_currentActivity.Title == "TutorActivity")

            else if (_currentActivity.Title == "PlayerActivity")

            else if (_currentActivity.Title == "RecorderActivity")*/

            switch (fretNum)
            {
                case GuitarFret.OpenString:
                        fret = _currentActivity.FindViewById(Resource.Id.openString);
                    break;
                case GuitarFret.Fret1:
                        fret = _currentActivity.FindViewById(Resource.Id.fret1);
                    break;
                case GuitarFret.Fret2:
                        fret = _currentActivity.FindViewById(Resource.Id.fret2);
                    break;
                case GuitarFret.Fret3:
                        fret = _currentActivity.FindViewById(Resource.Id.fret3);
                    break;
                case GuitarFret.Fret4:
                        fret = _currentActivity.FindViewById(Resource.Id.fret4);
                    break;
                case GuitarFret.Fret5:
                        fret = _currentActivity.FindViewById(Resource.Id.fret5);
                    break;
                case GuitarFret.Fret6:
                        fret = _currentActivity.FindViewById(Resource.Id.fret6);
                    break;
            }

            //Get the X & Y coordinates of the fret on the screen.
            int[] coordinates = new int[2];
            fret.GetLocationInWindow(coordinates);

            //Summerize X, Y, Width, and Height.
            FretMetrics metrics = new FretMetrics(
                (int)fret.GetX(), //coordinates[0],
                (int)((TableRow)fret.Parent).GetY(), //coordinates[1],
                fret.MeasuredWidth,
                fret.MeasuredHeight);

            Log.Info("", fret.Tag.ToString());
            Log.Info(fret.GetX().ToString(), fret.GetY().ToString());
            Log.Info(coordinates[0].ToString(), coordinates[1].ToString());
            Log.Info(fret.Width.ToString(), fret.Height.ToString());
            Log.Info("Left", fret.Left.ToString());
            Log.Info("Right", fret.Right.ToString());
            Log.Info("Top", fret.Top.ToString());
            Log.Info("Bottom", fret.Bottom.ToString());

            return metrics;
        }
Пример #5
0
        /// <summary>
        /// Gets the X, Y, Width, and Height of the fret which is represented on the screen by a view.
        /// </summary>
        /// <param name="fretNum">The number of the requested fret.</param>
        /// <returns>Returns the metrics of the requested fret.</returns>
        private FretMetrics GetFretMetrics(GuitarFret fretNum)
        {
            //Initialize a dummy fret.
            View fret = new View(_currentActivity);

            //Get the correct fret number.

            /*if (_currentActivity.Title == "TutorActivity")
             *
             * else if (_currentActivity.Title == "PlayerActivity")
             *
             * else if (_currentActivity.Title == "RecorderActivity")*/

            switch (fretNum)
            {
            case GuitarFret.OpenString:
                fret = _currentActivity.FindViewById(Resource.Id.openString);
                break;

            case GuitarFret.Fret1:
                fret = _currentActivity.FindViewById(Resource.Id.fret1);
                break;

            case GuitarFret.Fret2:
                fret = _currentActivity.FindViewById(Resource.Id.fret2);
                break;

            case GuitarFret.Fret3:
                fret = _currentActivity.FindViewById(Resource.Id.fret3);
                break;

            case GuitarFret.Fret4:
                fret = _currentActivity.FindViewById(Resource.Id.fret4);
                break;

            case GuitarFret.Fret5:
                fret = _currentActivity.FindViewById(Resource.Id.fret5);
                break;

            case GuitarFret.Fret6:
                fret = _currentActivity.FindViewById(Resource.Id.fret6);
                break;
            }

            //Get the X & Y coordinates of the fret on the screen.
            int[] coordinates = new int[2];
            fret.GetLocationInWindow(coordinates);

            //Summerize X, Y, Width, and Height.
            FretMetrics metrics = new FretMetrics(
                (int)fret.GetX(),                    //coordinates[0],
                (int)((TableRow)fret.Parent).GetY(), //coordinates[1],
                fret.MeasuredWidth,
                fret.MeasuredHeight);

            Log.Info("", fret.Tag.ToString());
            Log.Info(fret.GetX().ToString(), fret.GetY().ToString());
            Log.Info(coordinates[0].ToString(), coordinates[1].ToString());
            Log.Info(fret.Width.ToString(), fret.Height.ToString());
            Log.Info("Left", fret.Left.ToString());
            Log.Info("Right", fret.Right.ToString());
            Log.Info("Top", fret.Top.ToString());
            Log.Info("Bottom", fret.Bottom.ToString());

            return(metrics);
        }