Beispiel #1
0
        /// <summary>
        /// Process the data stored in fTckDataTable, creating the items in fNotes.
        /// </summary>
        private void InitializeSceneItems()
        {
            var auxiliarTable = new GtSceneGuitarNote[6];

            var endPosition = new BeatTick(fTickDataTable.NumberOfBeats, 470);

            for (var pos = new BeatTick(1, 0); pos <= endPosition; pos = pos.AddTicks(10))
            {
                var tickData = fTickDataTable[pos.Beat, pos.Tick];

                SetSceneGuitarNote(ref auxiliarTable, 1, tickData.String1, pos);
                SetSceneGuitarNote(ref auxiliarTable, 2, tickData.String2, pos);
                SetSceneGuitarNote(ref auxiliarTable, 3, tickData.String3, pos);
                SetSceneGuitarNote(ref auxiliarTable, 4, tickData.String4, pos);
                SetSceneGuitarNote(ref auxiliarTable, 5, tickData.String5, pos);
                SetSceneGuitarNote(ref auxiliarTable, 6, tickData.String6, pos);

                if (tickData.IsEndTick)
                {
                    AddNewNoteWhenExists(ref auxiliarTable, 1);
                    AddNewNoteWhenExists(ref auxiliarTable, 2);
                    AddNewNoteWhenExists(ref auxiliarTable, 3);
                    AddNewNoteWhenExists(ref auxiliarTable, 4);
                    AddNewNoteWhenExists(ref auxiliarTable, 5);
                    AddNewNoteWhenExists(ref auxiliarTable, 6);
                }
            }
        }
Beispiel #2
0
        public void AddTickData(BeatTick pStartPosition, BeatTick pEndPosition, GtTickData pTickData)
        {
            if (pStartPosition > pEndPosition)
            {
                throw new InvalidEndPosition("StartPosition can't be greater then EndPosition");
            }

            this[pStartPosition.Beat, pStartPosition.Tick].MomentInMiliseconds = pTickData.MomentInMiliseconds;

            for (BeatTick pos = pStartPosition; pos <= pEndPosition; pos = pos.AddTicks(10))
            {
                this[pos.Beat, pos.Tick].RemarkOrChordName = pTickData.RemarkOrChordName;

                this[pos.Beat, pos.Tick].String1 = pTickData.String1;
                this[pos.Beat, pos.Tick].String2 = pTickData.String2;
                this[pos.Beat, pos.Tick].String3 = pTickData.String3;
                this[pos.Beat, pos.Tick].String4 = pTickData.String4;
                this[pos.Beat, pos.Tick].String5 = pTickData.String5;
                this[pos.Beat, pos.Tick].String6 = pTickData.String6;

                this[pos.Beat, pos.Tick].IsStartTick = false;
                this[pos.Beat, pos.Tick].IsEndTick   = false;
            }

            //mark the first as StartTick
            this[pStartPosition.Beat, pStartPosition.Tick].IsStartTick = true;

            //mark the last as EndTick
            this[pEndPosition.Beat, pEndPosition.Tick].IsEndTick = true;
        }
        public void Update(BeatTick pCurrentPosition)
        {
            fCurrentPosition = pCurrentPosition;

            this.fIsGone = (this.CurrentPosition > fEndPosition);

            this.fDistanceFromCurrentPosition = this.StartPosition.AsTicks() - this.CurrentPosition.AsTicks();
        }
        public GtSceneMusicItemBase(BeatTick pStartPosition, BeatTick pEndPosition)
        {
            this.fDistanceFromCurrentPosition = long.MaxValue;

            this.fStartPosition = pStartPosition;
            this.fEndPosition   = pEndPosition;

            this.fCurrentPosition = BeatTick.NullValue;

            this.fIsGone = false;
        }
Beispiel #5
0
        /// <summary>
        /// Define the current song position (beat/tick).
        /// Used to sync the screen update with the song played.
        /// </summary>
        /// <param name="pCurrentPosition"></param>
        public void ForceCurrentPosition(BeatTick pCurrentPosition)
        {
            this.fCurrentPosition = pCurrentPosition;

            //return; //performance test

            foreach (var note in this.fNotes)
            {
                note.Update(pCurrentPosition);
            }
        }
Beispiel #6
0
        private void Initialize(GtTickDataTable pTickDataTable, int pNumberOfVisibleBeats)
        {
            if (pTickDataTable == null)
            {
                throw new GtSceneGuitarItemInvalidParameter("pTickDataTable parameter is required for GtSceneGuitarItem construction.");
            }

            if (pTickDataTable.fItems.Length == 0)
            {
                throw new GtSceneGuitarItemInvalidParameter("pTickDataTable parameter must have items to be passed to GtSceneGuitarItem constructor.");
            }

            NumberOfVisibleBeats = pNumberOfVisibleBeats;

            fTickDataTable = pTickDataTable;

            fCurrentPosition = new BeatTick(1, 0);
            fCurrentPositionInMiliseconds = 0;

            InitializeSceneItems();
        }
        public void UpdatePosition(BeatTick pCurrentPosition)
        {
            fCurrentPosition = pCurrentPosition;

            this.fIsGone = (this.CurrentPosition > fEndPosition);
        }
Beispiel #8
0
 public GtSceneGuitarNote(BeatTick pStartPosition, BeatTick pEndPosition, int pString, int pFret)
     : base(pStartPosition, pEndPosition)
 {
     fString = pString;
     fFret   = pFret;
 }
Beispiel #9
0
        /// <summary>
        /// Create a new GtSceneGuitarNote when needed, and update the EndPosition.
        /// </summary>
        /// <param name="pAuxiliarTable">Used to keep the references for the recently created GtSceneGuitarNote not ended until now</param>
        /// <param name="pString">String number (1..6)</param>
        /// <param name="pFret">Fret number</param>
        /// <param name="pCurrentPosition">Current position - the note still playing in this position</param>
        private void SetSceneGuitarNote(ref GtSceneGuitarNote[] pAuxiliarTable, int pString, int?pFret, BeatTick pCurrentPosition)
        {
            var position = pCurrentPosition;

            if (pFret != null)
            {
                if (pAuxiliarTable[pString - 1] == null)
                {
                    //if (!tickData.IsStartTick)
                    //    throw ...

                    pAuxiliarTable[pString - 1] = new GtSceneGuitarNote(position, position, pString, (int)pFret);
                }

                pAuxiliarTable[pString - 1].EndPosition = position;
            }
        }