//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; } } }
//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 (FPinInAddress.IsChanged) { ReassignRegister(); } FPinOutOutput.SliceCount = FPinInAddress.SliceCount; FPinOutOnReceive.SliceCount = FPinInAddress.SliceCount; for (int i = 0; i < FPinInAddress.SliceCount; i++) { if (FPinInAddress[i] == "") { FPinOutOutput[i].SliceCount = 0; } else { FPinOutOutput[i] = FRegister[FPinInAddress[i]].Values; } FPinOutOnReceive[i] = FRegister[FPinInAddress[i]].New; } }
void Send(int SliceCount) { SRComms.Queue q = new SRComms.Queue(FPinInChannel[0]); for (int i = 0; i < SliceCount; i++) { q.Add(FPinInInput[0]); } SRComms.OnMessageSent(q); }
//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(); }
//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; } }