Beispiel #1
0
        //called when data for any output pin is requested
        public void Evaluate(int SpreadMax)
        {
            if (FPackets.Channel != FPinInChannel[0])
            {
                FPackets = new SRComms.Queue(FPinInChannel[0]);
            }

            lock (FLockPackets)
            {
                int count = FPackets.Count;
                FPinOutOutput.SliceCount = count;
                if (count > 0)
                {
                    int i = 0;
                    foreach (var p in FPackets)
                    {
                        FPinOutOutput[i++] = p;
                    }
                    FPackets.Clear();
                }
                else
                {
                    FPinOutOutput.SliceCount = 1;
                    FPinOutOutput[0]         = null;
                }
            }
        }
Beispiel #2
0
        //called when data for any output pin is requested
        public void Evaluate(int SpreadMax)
        {
            if (FPackets.Channel != FPinInChannel[0])
            {
                FPackets = new SRComms.Queue(FPinInChannel[0]);
            }


            if (FConfigMode[0] == SendMode.Auto)
            {
                if (FPinInAddress.IsChanged || FInput.IsChanged)
                {
                    for (int i = 0; i < SpreadMax; i++)
                    {
                        if (FPinInAddress[i] == "")
                        {
                            continue;
                        }

                        OSCMessage p = new OSCMessage(FPinInAddress[i]);
                        for (int j = 0; j < FInput[i].SliceCount; j++)
                        {
                            p.Append((T)FInput[i][j]);
                        }
                        FPackets.Add(p);
                    }
                }
            }
            else
            {
                for (int i = 0; i < SpreadMax; i++)
                {
                    if (FPinInSend[i])
                    {
                        OSCMessage p = new OSCMessage(FPinInAddress[i]);
                        for (int j = 0; j < FInput[i].SliceCount; j++)
                        {
                            p.Append((T)FInput[i][j]);
                        }
                        FPackets.Add(p);
                    }
                }
            }
            if (FPackets.Count > 0)
            {
                SRComms.OnMessageSent(FPackets);
            }
            FPackets.Clear();
        }
Beispiel #3
0
        void SelectAddress()
        {
            foreach (var p in FPackets)
            {
                if (FRegister.ContainsKey(p.Address))
                {
                    FRegister[p.Address].New = true;

                    int count = p.Values.Count;
                    FRegister[p.Address].Values.SliceCount = count;
                    for (int i = 0; i < count; i++)
                    {
                        FRegister[p.Address].Values[i] = p.Values[i].GetType() == typeof(T) ? (T)p.Values[i] : GetDefault();
                    }
                }
            }
            FPackets.Clear();
        }
Beispiel #4
0
        //called when data for any output pin is requested
        public void Evaluate(int SpreadMax)
        {
            if (FPackets.Channel != FPinInChannel[0])
            {
                FPackets = new SRComms.Queue(FPinInChannel[0]);
            }

            lock (FLockPackets)
            {
                int count = FPackets.Count;
                FPinOutOutput.SliceCount  = count;
                FPinOutAddress.SliceCount = count;

                if (count > 0)
                {
                    int i = 0;
                    foreach (var p in FPackets)
                    {
                        FPinOutOutput[i].SliceCount = p.Values.Count;
                        FPinOutAddress[i]           = p.Address;

                        for (int j = 0; j < p.Values.Count; j++)
                        {
                            FPinOutOutput[i][j] = p.Values[j].GetType() == typeof(T) ? (T)p.Values[j] : GetDefault();
                        }
                        i++;
                    }
                    FPackets.Clear();
                }
                else
                {
                    FPinOutOutput.SliceCount  = 0;
                    FPinOutAddress.SliceCount = 0;
                }
                FPinOutOnReceive[0] = count > 0;
            }
        }