Exemplo n.º 1
0
        private void DecodeLoad(ushort channelId)
        {
            var position = ReceiveUint();
            var index    = new TrackIndex {
                ChannelId = channelId, Position = position
            };

            var type        = DecodeTrackType();
            var description = ReceiveString();

            var duration = 0U;

            if (type.HasAudio())
            {
                duration = ReceiveUint();
            }

            var text = "";

            if (type.HasText())
            {
                text = ReceiveString();
            }

            var track = TrackFactory.Create(type, description, duration, text);

            Dispatch(new MarkerChangeArgs(channelId, MarkerType.Position, 0U));
            Dispatch(new TrackLoadArgs(index, track));
        }
Exemplo n.º 2
0
        protected override void DecodeItem(byte channelId)
        {
            // The client version of this command gets the item information.
            var position = ReceiveUint();
            var index    = new TrackIndex {
                ChannelId = channelId, Position = position
            };

            var type        = DecodeTrackType();
            var description = ReceiveString();
            var entry       = TrackFactory.Create(type, description);

            Dispatch(new TrackAddArgs(index, entry));
        }
Exemplo n.º 3
0
        //speed must be in [-1, 1] range
        public bool SetTrackForwardSpeed(TrackIndex trackId, double speed)
        {
            if (speed < MinInputSpeed || speed > MaxInputSpeed)
            {
                return(false);
            }

            byte[] buff =
            {
                (byte)MoveEnum.TrackSetSpeed,
                (byte)(trackId + '0'),
                Delimiter,
            };

            buff = buff.Concat(CalcSpeed(speed).NumToArray());
            SendCommand(ControllerEnum.MovementController, buff);

            return(true);
        }
Exemplo n.º 4
0
        void TrackGetGroupElementIndexRecursive(Group grp, int id, ref TrackIndex trackIndexOutput)
        {
            int grpElemInd = grp.getItemIndex(id);

            if (grpElemInd != -1)
            {
                trackIndexOutput.index = grpElemInd;
                return;
            }

            //grab through sub groups
            for (int grpInd = 0; grpInd < grp.elements.Count; grpInd++)
            {
                int grpElemId = grp.elements[grpInd];
                if (grpElemId < 0)  //is group?
                {
                    Group subGrp = null;
                    for (int i = 0; i < groupValues.Count; i++)
                    {
                        if (groupValues[i].group_id == grpElemId)
                        {
                            subGrp = groupValues[i];
                            break;
                        }
                    }

                    if (subGrp != null)
                    {
                        TrackGetGroupElementIndexRecursive(subGrp, id, ref trackIndexOutput);
                        if (trackIndexOutput.index != -1)
                        {
                            trackIndexOutput.groupIndices.Add(grpInd);
                            break;
                        }
                    }
                }
            }
        }
Exemplo n.º 5
0
        int TrackIdGroupOrderCompare(int t1, int t2)
        {
            TrackIndex t1Ind = TrackIndex.Create(), t2Ind = TrackIndex.Create();

            TrackGetGroupElementIndexRecursive(rootGroup, t1, ref t1Ind);
            TrackGetGroupElementIndexRecursive(rootGroup, t2, ref t2Ind);

            if (t1Ind.groupIndices.Count == t2Ind.groupIndices.Count)
            {
                return(t1Ind.index - t2Ind.index);
            }
            else if (t1Ind.groupIndices.Count < t2Ind.groupIndices.Count)
            {
                int t2GroupIndex = t1Ind.groupIndices.Count;
                return(t1Ind.index - t2Ind.groupIndices[t2GroupIndex]);
            }
            else if (t1Ind.groupIndices.Count > t2Ind.groupIndices.Count)
            {
                int t1GroupIndex = t2Ind.groupIndices.Count;
                return(t1Ind.groupIndices[t1GroupIndex] - t2Ind.index);
            }

            return(0);
        }
Exemplo n.º 6
0
 public bool Equals(TrackIndex obj)
 {
     return(DiscNumber == obj.DiscNumber && TrackNumber == obj.TrackNumber);
 }
Exemplo n.º 7
0
		public bool Equals(TrackIndex obj) {
			return DiscNumber == obj.DiscNumber && TrackNumber == obj.TrackNumber;
		}