예제 #1
0
파일: DmxStreamer.cs 프로젝트: batourin/ACN
        public void AddUniverse(DmxUniverse universe)
        {
            lock (universes)
            {
                if (universes.ContainsKey(universe.Universe))
                {
                    throw new InvalidOperationException("This universe is already being streamed.");
                }

                universes.Add(universe.Universe, universe);
            }
        }
예제 #2
0
        public void Start()
        {
            Console.WriteLine("Start listening on {0} {1}.{2} for {3}ms pauses", IpAddress, Universe, Channel, Threshold);
            socket.Open(IPAddress.Parse(IpAddress));
            socket.NewPacket += socket_NewPacket;

            socket.JoinDmxUniverse(Universe);

            receiveData = new DmxUniverse(Universe);
            receiveData.DmxDataChanged += universe_DmxDataChanged;

            startTime     = DateTime.UtcNow;
            labelingTimer = new Timer(new TimerCallback((o) =>
            {
                var now = DateTime.UtcNow;
                Console.WriteLine("{0}   {1}", now, now - startTime);
            }), null, TimeSpan.FromMinutes(0), TimeSpan.FromMinutes(1));

            while (true)
            {
                Thread.Sleep(1000);
            }
        }
예제 #3
0
 public DmxUniverseData()
 {
     Universe = new DmxUniverse(1);
 }
예제 #4
0
            public AcnUniverse(Acn.DmxStreamer streamer, int universe, AcnStream parent)
            {
                this.streamer = streamer;
                this.universe = universe;
                this.parent = parent;

                this.dmxUniverse = new DmxUniverse(universe);
                bool isStreamerRunning = this.streamer.Streaming;
                if (isStreamerRunning)
                    this.streamer.Stop();
                this.streamer.AddUniverse(this.dmxUniverse);
                if (isStreamerRunning)
                    this.streamer.Start();
            }
예제 #5
0
        static void Main(string[] args)
        {
            // 1-37 = Fusion Orbit
            // 38-43 = Latta Alvor
            var universe = new DmxUniverse(0, 43);


            var sender = new StreamingAcnSender("192.168.1.46");

            // Latta Alvor:
            // Manual mode, full total brightness, with half red/blue and full green
            universe.SetChannelValues(38, new byte[] { 255, 127, 255, 127, 0, 0 });

            // Fusion orbit
            // Channels 1-5 are for pan/tilt; leave at 0.
            universe[6] = 255;   // Master dimmer: full brightness

            // Beam
            universe[7]  = 0;    // No strobe
            universe[8]  = 0;    // No colour macro
            universe[9]  = 127;  // Red
            universe[10] = 255;  // Green
            universe[11] = 127;  // Blue
            universe[12] = 31;   // White

            // LED Ring
            universe[13] = 255;  // Master dimmer: full brightness
            universe[14] = 0;    // No strobe
            universe[15] = 0;    // No colour macro
            universe[16] = 0;    // No colour program
            universe[17] = 0;    // No macro progam speed

            universe[18] = 255;  // Segment 1: all red
            universe[22] = 255;  // Segment 2: all green
            universe[26] = 255;  // Segment 3: all blue

            universe[26] = 127;  // Segment 4: half-brightness R+G+B
            universe[27] = 127;
            universe[28] = 127;

            universe[29] = 31;   // Segment 5: dull red
            universe[34] = 31;   // Segment 6: dull green

            universe[36] = 0;    // No "show"
            universe[37] = 0;    // No sound sensitivity

            sender.SendUniverse(universe);

            // Pan to max
            Console.ReadLine();
            universe[1] = 255;
            sender.SendUniverse(universe);

            // Tilt to max
            Console.ReadLine();
            universe[3] = 255;
            sender.SendUniverse(universe);

            // Reset back, with all red
            Console.ReadLine();
            universe[1]  = 0;
            universe[3]  = 0;
            universe[9]  = 255;
            universe[10] = 0;
            universe[11] = 0;
            universe[12] = 0;

            for (int ring = 0; ring < 6; ring++)
            {
                universe[ring * 3 + 18] = 255;
                universe[ring * 3 + 19] = 0;
                universe[ring * 3 + 20] = 0;
            }
            sender.SendUniverse(universe);

            // Move it around a bit
            Console.ReadLine();
            universe.SetChannelValues(38, new byte[] { 255, 0, 0, 255, 0, 0 });
            universe[1] = 10;
            universe[3] = 10;
            sender.SendUniverse(universe);
            Thread.Sleep(2000);

            universe.SetChannelValues(38, new byte[] { 255, 0, 255, 0, 0, 0 });
            universe[1] = 30;
            universe[3] = 30;
            sender.SendUniverse(universe);
            Thread.Sleep(2000);

            universe.SetChannelValues(38, new byte[] { 255, 255, 0, 0, 0, 0 });
            universe[1] = 40;
            universe[3] = 0;
            sender.SendUniverse(universe);

            // Turn everything off
            Console.ReadLine();
            for (int i = 1; i <= 43; i++)
            {
                universe[i] = 0;
            }
            sender.SendUniverse(universe);
        }