} // end btnMake_Click() public void AddStrip() { int pixID = stripStart; int nextSI = seq.highestSavedIndex + 1; int groupMember = 1; int uch = 1; string chName; channel chr; channel chg; channel chb; channelGroup cg = new channelGroup(); channelGroup cgs = new channelGroup(); cgs.name = stripName; rgbChannel rch; int chx; int grpStart = stripStart; int grpCounter = 0; int l = stripStart; while ((l > 0) && (l <= stripCount)) { chr = new channel(); chg = new channel(); chb = new channel(); chr.deviceType = deviceType.DMX; chr.network = univ; chg.deviceType = deviceType.DMX; chg.network = univ; chb.deviceType = deviceType.DMX; chb.network = univ; if (chOrder == 1) // RGB Order { chName = stripName + " Pixel " + l.ToString("000") + "(R) (U" + univ.ToString() + "." + uch.ToString("000") + ")"; chr.name = chName; chr.unit = uch; seq.AddChannel(chr); uch++; chName = stripName + " Pixel " + l.ToString("000") + "(G) (U" + univ.ToString() + "." + uch.ToString("000") + ")"; chg.name = chName; chg.unit = uch; seq.AddChannel(chg); uch++; chName = stripName + " Pixel " + l.ToString("000") + "(B) (U" + univ.ToString() + "." + uch.ToString("000") + ")"; chb.name = chName; chb.unit = uch; seq.AddChannel(chb); uch++; } if (chOrder == 2) // GRB Order { chName = stripName + " Pixel " + l.ToString("000") + "(G) (U" + univ.ToString() + "." + uch.ToString("000") + ")"; chg.name = chName; chg.unit = uch; seq.AddChannel(chg); uch++; chName = stripName + " Pixel " + l.ToString("000") + "(R) (U" + univ.ToString() + "." + uch.ToString("000") + ")"; chr.name = chName; chr.unit = uch; seq.AddChannel(chr); uch++; chName = stripName + " Pixel " + l.ToString("000") + "(B) (U" + univ.ToString() + "." + uch.ToString("000") + ")"; chb.name = chName; chb.unit = uch; seq.AddChannel(chb); uch++; } rch = new rgbChannel(); chx = uch - 2; chName = stripName + " Pixel " + l.ToString("000") + " (U" + univ.ToString() + "." + chx.ToString("000") + "-" + uch.ToString("000") + ")"; rch.redChannelIndex = chr.savedIndex; rch.grnChannelIndex = chg.savedIndex; rch.bluChannelIndex = chb.savedIndex; seq.AddRGBChannel(rch); if (groupSize > 0) { grpCounter++; cg.AddItem(rch.savedIndex); if (grpCounter == groupSize) { int grpEnd = grpStart + groupSize; int uchStart = l * 3 - 2; chName = stripName + " Pixels " + grpStart.ToString() + "-" + grpEnd.ToString() + " (U" + univ.ToString() + "." + uchStart.ToString() + "-" + uchStart.ToString() + ")"; cg.name = chName; cgs.AddItem(cg.savedIndex); cg = new channelGroup(); } } l += chIncr; } // end while pixel # in range } // end void AddStrip();
private void MakeUniverses(string baseName, int universe, int startCh, int pixelCt, byte pixelOrder, bool reverseOrder) { channel newch; rgbChannel newRGBch; channelGroupList newGroup; channelGroupItem newGroupItem; savedIndex newSI; int curPixel = 1; int curUniverse = universe; int curCh = startCh; int track = Convert.ToInt16(txtTrack.Text) - 1; int nextSI = seq.highestSavedIndex + 1; int nextGI = seq.groupItemCount; // Add new channels - Pixel Count * 3 (1 each for red, green, blue) Array.Resize(ref seq.channels, seq.channelCount + pixelCt * 3 + 2); // Add new RGB Channel groups, Pixel Count Array.Resize(ref seq.rgbChannels, seq.rgbChannelCount + pixelCt + 2); Array.Resize(ref seq.trackItems, seq.trackItemCount + pixelCt + 2); Array.Resize(ref seq.savedIndexes, nextSI + pixelCt * 4 + 2); Array.Resize(ref seq.channelGroups, seq.groupCount + 3); Array.Resize(ref seq.channelGroupItems, seq.groupItemCount + pixelCt + 2); // ** Universe Group ** newGroup = new channelGroupList(); int ch2 = startCh + pixelCt * 3 - 2; // Temp, used only in the name // Name Format: BaseName001 (U001.001-003) newGroup.name = baseName + " Pixels001-" + pixelCt.ToString("000") + " (U" + curUniverse.ToString("00") + "." + startCh.ToString("000") + "-" + ch2.ToString("000") + ")"; newGroup.savedIndex = nextSI + pixelCt * 4; // *!* Double-Check correct saved index for group! for (int pixelNo = 1; pixelNo <= pixelCt; pixelNo++) { curPixel = pixelNo; if (pixelCt > 170) { if ((pixelNo > 150) && (pixelNo < 301)) { curPixel -= 150; curUniverse = universe + 1; curCh = curPixel * 3 - 2; } if ((pixelNo > 300) && (pixelNo < 450)) { curPixel -= 300; curUniverse = universe + 2; curCh = curPixel * 3 - 2; } if ((pixelNo > 450) && (pixelNo < 600)) { curPixel -= 450; curUniverse = universe + 3; curCh = curPixel * 3 - 2; } } // ** RGB Channel Group ** newRGBch = new rgbChannel(); ch2 = curCh + 2; // Temp, used only in the name // Name Format: BaseName001 (U001.001-003) newRGBch.name = baseName + " Pixel" + pixelNo.ToString("000") + " (U" + curUniverse.ToString("00") + "." + curCh.ToString("000") + "-" + ch2.ToString("000") + ")"; // ** RED Channel ** // Create new channel for Red newch = new channel(); newch.deviceType = deviceType.DMX; newch.network = curUniverse; // Name Format: BaseName001 (U001.001) (R) newch.name = baseName + " Pixel" + pixelNo.ToString("000") + " (U" + curUniverse.ToString("00") + "." + curCh.ToString("000") + ") (R)"; newch.circuit = curCh; newch.color = 255; // Red newch.savedIndex = nextSI; newRGBch.redSavedIndex = newch.savedIndex; // update Saved Indexes newSI = new savedIndex(); newSI.objType = tableType.channel; newSI.objIndex = nextSI; seq.savedIndexes[nextSI] = newSI; nextSI++; // Add new channel to array, and incr count seq.channels[seq.channelCount] = newch; seq.channelCount++; // Incr the DMX channel # startCh++; curCh++; // ** GREEN Channel ** // Create new channel for Green newch = new channel(); newch.deviceType = deviceType.DMX; newch.network = curUniverse; // Name Format: BaseName001 (U001.002) (G) newch.name = baseName + " Pixel" + pixelNo.ToString("000") + " (U" + curUniverse.ToString("00") + "." + curCh.ToString("000") + ") (G)"; newch.circuit = curCh; newch.color = 65280; // Green newch.savedIndex = nextSI; newRGBch.grnSavedIndex = newch.savedIndex; // update Saved Indexes newSI = new savedIndex(); newSI.objType = tableType.channel; newSI.objIndex = nextSI; seq.savedIndexes[nextSI] = newSI; nextSI++; // Add new channel to array, and incr count seq.channels[seq.channelCount] = newch; seq.channelCount++; seq.highestSavedIndex++; // Incr the DMX channel # startCh++; curCh++; // ** BLUE Channel ** // Create new channel for Blue newch = new channel(); newch.deviceType = deviceType.DMX; newch.network = curUniverse; newch.name = baseName + " Pixel" + pixelNo.ToString("000") + " (U" + curUniverse.ToString("00") + "." + curCh.ToString("000") + ") (B)"; newch.circuit = curCh; newch.color = 16711680; // Blue newch.savedIndex = nextSI; newRGBch.bluSavedIndex = newch.savedIndex; // update Saved Indexes newSI = new savedIndex(); newSI.objType = tableType.channel; newSI.objIndex = nextSI; seq.savedIndexes[nextSI] = newSI; nextSI++; // Add new channel to array, and incr count seq.channels[seq.channelCount] = newch; seq.channelCount++; seq.highestSavedIndex++; // Incr the DMX channel # startCh++; curCh++; // ** RGB Channel Group ** // Add new RGB channel to array, and incr count newRGBch.savedIndex = nextSI; seq.rgbChannels[seq.rgbChannelCount] = newRGBch; seq.rgbChannelCount++; // update Saved Indexes newSI = new savedIndex(); newSI.objType = tableType.rgbChannel; newSI.objIndex = nextSI; seq.savedIndexes[nextSI] = newSI; nextSI++; // Add the RGB Channel Group to the Universe Group seq.channelGroupItems[seq.groupItemCount] = new channelGroupItem(); seq.channelGroupItems[seq.groupItemCount].channelGroupSavedIndex = newRGBch.savedIndex; seq.channelGroupItems[seq.groupItemCount].channelGroupListIndex = seq.groupCount; seq.groupItemCount++; } seq.channelGroups[seq.groupCount] = newGroup; seq.groupCount++; seq.trackItems[seq.trackItemCount] = new trackItem(); seq.trackItems[seq.trackItemCount].savedIndex = newGroup.savedIndex; seq.trackItems[seq.trackItemCount].trackIndex = track; seq.trackItemCount++; seq.tracks[track].trackItemCount++; seq.highestSavedIndex = nextSI; }
public int AddRGBChannel(rgbChannel newChan);