protected Controller() { Channels = new Channel[MaxChannels]; for (int i = 0; i < Channels.Length; i++) { Channels[i] = new Channel(); } ControllerValues = new UInt16[MaxChannels]; const int devicesPerChild = ChannelsPerChild/3; const int rgbDeviceCount = devicesPerChild * ChildNodes; RgbDevices = new RgbDevice[rgbDeviceCount]; for (int i = 0; i != rgbDeviceCount; i++) { int child = i / devicesPerChild; int firstChannel = (child * ChannelsPerChild) + (i%devicesPerChild); RgbDevices[i] = new RgbDevice(Channels[firstChannel], Channels[firstChannel+1], Channels[firstChannel+2], "RGB Device " + i); } _worker = new Timer(); _worker.Elapsed += Work; _worker.Interval = 16; }
public RgbDevice(Channel r, Channel g, Channel b, string name) { Name = name; Debug.Assert(r != null && g != null && b != null, "Missing channel"); R = new SmoothBehavior(); r.Behavior = R; G = new SmoothBehavior(); g.Behavior = G; B = new SmoothBehavior(); b.Behavior = B; }
public RgbDevice(Channel r, Channel g, Channel b) : this(r, g, b, null) { }