Beispiel #1
0
		} // end btnMake_Click()

		public void AddStrip()
		{
			int pixID = stripStart;
			int nextSI = seq.Members.HighestSavedIndex;
			int groupMember = 1;
			int uch = 1;
			if (chIncr < 0) uch = stripCount * 3 - 2;
			int trkNum = Int16.Parse(txtTrack.Text) - 1;
			string chName;
			Channel redChannel = new Channel("(R)");  // Just placeholders
			Channel grnChannel = new Channel("(G)");
			Channel bluChannel = new Channel("(B)");
			//RGBchannel RGB_Channel = new RGBchannel("RGB");
			//ChannelGroup pixelGroup = new ChannelGroup();
			int chx;
			//groupCount = 0;
			int stripKeywdel = stripStart;
			int RGBFirstDMXchannel = 1;
			int RGBLastDMXchannel = -1;
			//int pixNumFirst = pixelNum;
			//int pixNumLast = pixNumFirst + groupSize - 1;
			//int stripNumFirst = stripStart;
			//int stripNumLast = 1;
			//int dmxChFirst = 1;
			//int dmxChLast = -1;


			/////////////////////////////////
			// MAKE A GROUP FOR THE STRIP //
			///////////////////////////////
			int dmxCount = stripCount * 3;
			if (reversed)
			{
				//Reverse
				int bb = stripEnd * 3 - 2;
				//chName = stripName + " Keywdels " + stripStart.ToString("000") + "-" + stripEnd.ToString("000") + " (U" + universeNum.ToString() + "." + bb.ToString("000") + "-" + dmxCount.ToString("000") + ")";
				int sst = pixelNum;
				int est = pixelNum + Math.Max(stripStart, stripEnd);
				chName = stripName + " Keywdels " + sst.ToString("000") + "-" + est.ToString("000");
				chName += " / S" + stripNum.ToString() + "." + stripStart.ToString("000") + "-" + stripEnd.ToString("000");
				chName += " / U" + universeNum.ToString() + "." + bb.ToString("000") + "-" + dmxCount.ToString("000") + ")";
			}
			else
			{
				// Forward
				//chName = stripName + " Keywdels " + stripStart.ToString("000") + "-" + stripCount.ToString("000") + " (U" + universeNum.ToString() + "." + stripStart.ToString("000") + "-" + dmxCount.ToString("000") + ")";
				chName = stripName + " Keywdels " + pixNumFirst.ToString("000") + "-" + pixNumLast.ToString("000");
				chName += " / S" + stripNum.ToString() + "." + stripStart.ToString("000") + "-" + stripEnd.ToString("000");
				chName += " / U" + universeNum.ToString() + "." + stripStart.ToString("000") + "-" + dmxCount.ToString("000") + ")";
			}
			ChannelGroup stripGroup = seq.CreateChannelGroup(chName);

			///////////////////////////////////////////////////////////
			// MAKE AN INITIAL CHANNEL GROUP FOR THE PIXEL GROUPING //
			/////////////////////////////////////////////////////////
			if (eaveNaming)
			{
				string gn = " Group ";
				if (groupNumber < 18)
				{
					//gn += (18 - groupNumber).ToString("00") + "L";
					gn += (groupNumber).ToString("00") + "L";
				}
				else
				{
					//gn += (groupNumber - 17).ToString("00") + "R";
					gn += (35 - groupNumber).ToString("00") + "R";
				}
				if (groupCount > 0)
				{
					gn += "b";
				}
				chName = stripName + gn;

			}
			else
			{
				//chName = stripName + " Keywdels " + stripNumFirst.ToString("000") + "-" + stripKeywdel.ToString("000");
				chName = stripName;
				//chName = " Keywdels " + (pixelNum - groupSize).ToString("000") + "-" + pixelNum.ToString("000") + " / S" + stripNum.ToString() + "." + stripNumFirst.ToString("000") + "-" + stripKeywdel.ToString("000") + " / U" + universeNum.ToString() + "." + dmxChFirst.ToString("000") + "-" + dmxChLast.ToString("000");
			}
			/*
			if (reversed)
			{
				stripNumFirst = stripStart;
				stripNumLast = stripStart - groupSize + 1;
				dmxChFirst = dmxCount - groupSize * 3 + 1;
				dmxChLast = dmxCount;
			}
			else
			{
				stripNumFirst = stripStart;
				stripNumLast = stripStart + groupSize - 1;
				dmxChFirst = 1;
				dmxChLast = groupSize * 3 - 1;
			}
			*/
			chName += " Keywdels " + pixNumFirst.ToString("000") + "-" + pixNumLast.ToString("000");
			chName += " / S" + stripNum.ToString() + "." + stripNumFirst.ToString("000") + "-" + stripNumLast.ToString("000");
			chName += " / U" + universeNum.ToString() + "." + dmxChFirst.ToString("000") + "-" + dmxChLast.ToString("000") + ")";
			ChannelGroup pixelGroup = seq.CreateChannelGroup(chName);
			stripGroup.AddItem(pixelGroup);


//			int gc = 
			pixNumFirst = (groupCount + 1) * groupSize + 1;
			pixNumLast = (groupCount + 2) * groupSize;
			stripNumFirst += (groupSize * chIncr);
			stripNumLast += (groupSize * chIncr) + 1;
			dmxChFirst += (groupSize * 3 * chIncr);
			dmxChLast += (groupSize * 3 * chIncr);
			
			if (stripNum == 2 )
			{
				pixNumFirst = 181;
				pixNumLast = 200;
				stripNumFirst = 11;
				stripNumLast = 30;
				dmxChFirst = 31;
				dmxChLast = 90;
			}
			if (stripNum == 3)
			{
				pixNumFirst = 361;
				pixNumLast = 380;
				stripNumFirst = 150;
				stripNumLast = 131;
				dmxChFirst = 391;
				dmxChLast = 450;
			}
			if (stripNum == 4)
			{
				pixNumFirst = 521;
				pixNumLast = 540;
				stripNumFirst = 11;
				stripNumLast = 30;
				dmxChFirst = 31;
				dmxChLast = 90;
			}



			string prfx = "";
			if (eaveNaming)
			{
				prfx = "Eave ";
			}

			//////////////////////
			// MAKE THE STRIP! //
			////////////////////
			while ((stripKeywdel > 0) && (stripKeywdel <= stripCount))
			{
				if (chOrder == 1) // RGB Order
				{
					//chName = stripName + " Keywdel " + stripKeywdel.ToString("000") + "(R) (U" + universeNum.ToString() + "." + uch.ToString("000") + ")";
					chName = prfx + "Keywdel " + pixelNum.ToString("000");
					chName += " (R) / S" + stripNum.ToString() + "." + stripKeywdel.ToString("000");
					chName += " / U" + universeNum.ToString() + "." + uch.ToString("000");
					redChannel = seq.CreateChannel(chName);
					redChannel.output.circuit = uch;
					RGBFirstDMXchannel = uch;
					uch++;

					//chName = stripName + " Keywdel " + stripKeywdel.ToString("000") + "(G) (U" + universeNum.ToString() + "." + uch.ToString("000") + ")";
					chName = prfx + "Keywdel " + pixelNum.ToString("000");
					chName += " (G) / S" + stripNum.ToString() + "." + stripKeywdel.ToString("000");
					chName += " / U" + universeNum.ToString() + "." + uch.ToString("000");
					grnChannel = seq.CreateChannel(chName);
					grnChannel.output.circuit = uch;
					uch++;

					chName = prfx + "Keywdel " + pixelNum.ToString("000");
					chName += " (B) / S" + stripNum.ToString() + "." + stripKeywdel.ToString("000");
					chName += " / U" + universeNum.ToString() + "." + uch.ToString("000");
					bluChannel = seq.CreateChannel(chName);
					bluChannel.output.circuit = uch;
					RGBLastDMXchannel = uch;
					uch++;
				}

				if (chOrder == 2) // GRB Order
				{
					//chName = stripName + " Keywdel " + stripKeywdel.ToString("000") + "(G) (U" + universeNum.ToString() + "." + uch.ToString("000") + ")";
					chName = prfx + "Keywdel " + pixelNum.ToString("000");
					chName += " (G) / S" + stripNum.ToString() + "." + stripKeywdel.ToString("000");
					chName += " / U" + universeNum.ToString() + "." + uch.ToString("000");
					grnChannel = seq.CreateChannel(chName);
					grnChannel.output.circuit = uch;
					RGBFirstDMXchannel = uch;
					uch++;

					//chName = stripName + " Keywdel " + stripKeywdel.ToString("000") + "(R) (U" + universeNum.ToString() + "." + uch.ToString("000") + ")";
					chName = prfx + "Keywdel " + pixelNum.ToString("000");
					chName += " (R) / S" + stripNum.ToString() + "." + stripKeywdel.ToString("000");
					chName += " / U" + universeNum.ToString() + "." + uch.ToString("000");
					redChannel = seq.CreateChannel(chName);
					redChannel.output.circuit = uch;
					uch++;

					//chName = stripName + " Keywdel " + stripKeywdel.ToString("000") + "(B) (U" + universeNum.ToString() + "." + uch.ToString("000") + ")";
					chName = prfx + "Keywdel " + pixelNum.ToString("000");
					chName += " (B) / S" + stripNum.ToString() + "." + stripKeywdel.ToString("000");
					chName += " / U" + universeNum.ToString() + "." + uch.ToString("000");
					bluChannel = seq.CreateChannel(chName);
					bluChannel.output.circuit = uch;
					RGBLastDMXchannel = uch;
					uch++;
				}
				redChannel.output.deviceType = DeviceType.DMX;
				redChannel.output.network = universeNum;
				redChannel.color = utils.LORCOLOR_RED;
				grnChannel.output.deviceType = DeviceType.DMX;
				grnChannel.output.network = universeNum;
				grnChannel.color = utils.LORCOLOR_GRN;
				bluChannel.output.deviceType = DeviceType.DMX;
				bluChannel.output.network = universeNum;
				bluChannel.color = utils.LORCOLOR_BLU;


				//dmxChLast = uch - 1;
				chx = uch - 2;
				//chName = stripName + " Keywdel " + stripKeywdel.ToString("000") + " (U" + universeNum.ToString() + "." + RGBFirstDMXchannel.ToString("000") + "-" + RGBLastDMXchannel.ToString("000") + ")";
				chName = prfx + "Keywdel " + pixelNum.ToString("000");
				chName += " / S" + stripNum.ToString() + "." + stripKeywdel.ToString("000");
				chName += " / U" + universeNum.ToString() + "." + RGBFirstDMXchannel.ToString("000") + "-" + RGBLastDMXchannel.ToString("000");
				RGBchannel RGB_Channel = seq.CreateRGBchannel(chName);
				RGB_Channel.redChannel = redChannel;
				RGB_Channel.grnChannel = grnChannel;
				RGB_Channel.bluChannel = bluChannel;
				pixelNum++;

				pixelGroup.AddItem(RGB_Channel);
				groupCount++;

				//////////////////////////////////
				// IS THE GROUP FULL?          //
				// iF SO, CREATE THE NEXT ONE //
				///////////////////////////////
				if (stripKeywdel < stripCount)
				{
					if (groupCount >= groupSize)
					{
						//stripNumLast = stripNumFirst + groupSize;
						//int uchStart = stripKeywdel * 3 - 2;
						if (chIncr < 0)
						{
							// Reverse
							//dmxChFirst = stripKeywdel * 3 - 2;
							//dmxChLast = stripNumFirst * 3;
						}
						else
						{
							// Forward
							// OK as-is
						}

						groupNumber++;
						//dmxChFirst = uch;
						//stripNumFirst = stripKeywdel + chIncr;
						if (eaveNaming)
						{
							string gn = " Group ";
							if (groupNumber < 18)
							{
								//gn += (18 - groupNumber).ToString("00") + "L";
								gn += (groupNumber).ToString("00") + "L";
							}
							else
							{
								//gn += (groupNumber - 17).ToString("00") + "R";
								gn += (35 - groupNumber).ToString("00") + "R";
							}
							chName = stripName + gn;
						}
						else
						{
							chName = stripName;
						}
						chName += " Keywdels " + pixNumFirst.ToString("000") + "-" + pixNumLast.ToString("000");
						chName += " / S" + stripNum.ToString() + "." + stripNumFirst.ToString("000") + "-" + stripNumLast.ToString("000");
						chName += " / U" + universeNum.ToString() + "." + dmxChFirst.ToString("000") + "-" + dmxChLast.ToString("000") + ")";
						pixelGroup = seq.CreateChannelGroup(chName);
						stripGroup.AddItem(pixelGroup);

						pixNumFirst = pixNumLast + 1;
						pixNumLast += groupSize;
						dmxChFirst += (groupSize * 3 * chIncr);
						dmxChLast += (groupSize * 3 * chIncr);
						stripNumFirst += (groupSize * chIncr);
						stripNumLast += (groupSize * chIncr);

						//pixelGroup = new ChannelGroup();
						groupCount = 0; // Reset

					}
				}
				else
				{
				}

				stripKeywdel += chIncr;
				if (chIncr < 0) uch -= 6;


				/////////////////////////////////
			} // end while pixel # in range //
				///////////////////////////////

			// Is there any leftover pixels?
			// (Happens when strip size is not evenly divisible by group size)
			if (groupCount > 0)
			{
				if (eaveNaming)
				{
					string gn = " Group ";
					if (groupNumber < 18)
					{
						//gn += (18 - groupNumber).ToString("00") + "aL";
						gn += (groupNumber).ToString("00") + "aL";
					}
					else
					{
						//gn += (groupNumber - 17).ToString("00") + "aR";
						gn += (35 - groupNumber).ToString("00") + "aR";
					}
					chName = stripName + gn;

				}
				else
				{
					chName = stripName;
				}
				pixNumFirst -= groupSize;
				pixNumLast = Math.Max(stripStart, stripEnd);
				stripNumFirst -= (groupSize * chIncr);
				stripNumLast = 1; //TODO Fix!
				dmxChFirst -= (groupSize * 3 * chIncr);
				dmxChLast = 1;
				chName += " Keywdels " + pixNumFirst.ToString("000") + "-" + pixNumLast.ToString("000");
				chName += " / S" + stripNum.ToString() + "." + stripNumFirst.ToString("000") + "-" + (stripKeywdel + 1).ToString("000");
				chName += " / U" + universeNum.ToString() + ".001" + "-" + dmxChLast.ToString("000") + ")";

				pixelGroup.ChangeName(chName);
				stripGroup.AddItem(pixelGroup);
				//dmxChFirst = uch;
				//stripNumFirst = stripKeywdel + chIncr;

			}
			if (groupCount >= groupSize)
			{
				groupNumber++;
				groupCount = 0;
			}

			// Add the Strip to the Track
			seq.Tracks[trkNum].AddItem(stripGroup);

		} // end void AddStrip();