コード例 #1
1
ファイル: ControlHub.cs プロジェクト: eighthrazz/luminaryT
        private void SendDXM(RGB rgb)
        {
            // initialize the engine if needed
            if (ArtNetEngine == null)
            {
                System.Diagnostics.Debug.WriteLine("Staring ArtEngine...");
                ArtNetStopWatch.Restart();
                ArtNetEngine = new ArtNet.Engine("ArtNet Engine", "");
                ArtNetEngine.Start();
                ArtNetStopWatch.Stop();
                System.Diagnostics.Debug.WriteLine( String.Format("...took {0}ms", ArtNetStopWatch.ElapsedMilliseconds) );
            }

            // build DMX data
            System.Diagnostics.Debug.WriteLine("Building DMXData...");
            ArtNetStopWatch.Restart();
            byte[] DMXData = new byte[512];
            for(int i=0;i<DMXData.Length;i+=3) {
                DMXData[i] = (byte)rgb.red;
                if(i+1<DMXData.Length)
                    DMXData[i + 1] = (byte)rgb.green;
                if(i+2<DMXData.Length)
                    DMXData[i + 2] = (byte)rgb.blue;
            }
            ArtNetStopWatch.Stop();
            System.Diagnostics.Debug.WriteLine(String.Format("...took {0}ms", ArtNetStopWatch.ElapsedMilliseconds));

            // send DMX data
            System.Diagnostics.Debug.WriteLine("Sending ArtEngine data...");
            ArtNetStopWatch.Restart();
            ArtNetEngine.SendDMX(0, DMXData, DMXData.Length);
            ArtNetStopWatch.Stop();
            System.Diagnostics.Debug.WriteLine(String.Format("...took {0}ms", ArtNetStopWatch.ElapsedMilliseconds));
        }
コード例 #2
0
ファイル: ControlHub.cs プロジェクト: eighthrazz/luminaryT
 public ControlHub()
 {
     ArtNetEngine = null;
     ArtNetStopWatch = new Stopwatch();
 }