Inheritance: ISequence, ICanExecute
Esempio n. 1
0
        //        private Controller.Sequence laserSeq;
        public ItalianScene1(IEnumerable<string> args)
        {
            //            testSeq = new Controller.Sequence("Pulse");
            candyCane = new Controller.Sequence("Candy Cane");
            //            laserSeq = new Controller.Sequence("Laser");

            allPixels = new VirtualPixel1D("All Pixels", 28);
        }
Esempio n. 2
0
        //        private Controller.Sequence laserSeq;

        public ItalianScene1(IEnumerable <string> args)
        {
            //            testSeq = new Controller.Sequence("Pulse");
            candyCane = new Controller.Sequence("Candy Cane");
            //            laserSeq = new Controller.Sequence("Laser");

            allPixels = new VirtualPixel1D(28);
        }
Esempio n. 3
0
        public PixelScene1(IEnumerable<string> args)
        {
            testSeq = new Controller.Sequence("Pulse");
            candyCane = new Controller.Sequence("Candy Cane");
            laserSeq = new Controller.Sequence("Laser");

            allPixels = new VirtualPixel1D("All Pixels", 150);

            buttonTest = new DigitalInput("Test");
        }
Esempio n. 4
0
        public TestOSC(IEnumerable<string> args)
        {
            allPixels = new VirtualPixel1D("All Pixels", 28 + 50);

            loopSeq = new Controller.Sequence("Loop Seq");
            fingers = new Finger[10];
            for (int i = 0; i < 10; i++)
                fingers[i] = new Finger();

            testDimmer = new Dimmer("Test");

            this.oscServer = new Expander.OscServer(5555);
        }
Esempio n. 5
0
        public PixelScene1(IEnumerable<string> args)
        {
            testSeq = new Controller.Sequence("Pulse");
            candyCane = new Controller.Sequence("Candy Cane");
            laserSeq = new Controller.Sequence("Laser");

            allPixels = new VirtualPixel1D(200);

            buttonTest = new DigitalInput("Test");

            // WS2811
            acnOutput.Connect(new Physical.PixelRope(allPixels, 0, 200), 51, 1);
            //            acnOutput.Connect(new Physical.PixelRope(allPixels, 50, 100), 5, 1);
            //            acnOutput.Connect(new Physical.PixelRope(allPixels, 150, 50), 4, 151);
            // GECE
            //            acnOutput.Connect(new Physical.PixelRope(allPixels, 100, 50), 2, 91);
        }
Esempio n. 6
0
        public PixelScene1(IEnumerable <string> args)
        {
            testSeq   = new Controller.Sequence("Pulse");
            candyCane = new Controller.Sequence("Candy Cane");
            laserSeq  = new Controller.Sequence("Laser");

            allPixels = new VirtualPixel1D(200);

            buttonTest = new DigitalInput("Test");

            // WS2811
            acnOutput.Connect(new Physical.PixelRope(allPixels, 0, 200), 51, 1);
//            acnOutput.Connect(new Physical.PixelRope(allPixels, 50, 100), 5, 1);
//            acnOutput.Connect(new Physical.PixelRope(allPixels, 150, 50), 4, 151);
            // GECE
//            acnOutput.Connect(new Physical.PixelRope(allPixels, 100, 50), 2, 91);
        }
Esempio n. 7
0
        public override void Start()
        {
            // Set color
            candyLight.SetColor(Color.Violet, 0);
            candyLight2.SetColor(Color.Green, 0);

            var testSequence = new Controller.Sequence("Test Sequence");

            testSequence
            .WhenExecuted
            .Execute(instance =>
            {
                pulsatingEffect.Start();

                instance.WaitFor(S(10));

                pulsatingEffect.Stop();

                candyLight.SetStrobe(1.0, Color.Yellow);

                instance.WaitFor(S(2));
                candyLight.TurnOff();
                candyLight.SetColor(Color.Violet, 0);
            });

            pressureMat.ActiveChanged += (sender, e) =>
            {
                if (e.NewState)
                {
                    this.log.Information("Button press!");

//                    candyLight2.RunEffect(new Effect2.Fader(1.0, 0.0), S(0.5));
//                    Executor.Current.Execute(testSequence);
                }
            };


            pulsatingEffect.AddDevice(candyLight)
            .AddDevice(candyLight2);

//            candyLight.RunEffect(new Effect2.Pulse(0.0, 1.0), S(2));
        }
Esempio n. 8
0
        public override void Start()
        {
            // Set color
            candyLight.SetColor(Color.Violet, 0);
            candyLight2.SetColor(Color.Green, 0);

            var testSequence = new Controller.Sequence("Test Sequence");
            testSequence
                .WhenExecuted
                .Execute(instance =>
                {
                    pulsatingEffect.Start();

                    instance.WaitFor(S(10));

                    pulsatingEffect.Stop();

                    candyLight.SetStrobe(1.0, Color.Yellow);

                    instance.WaitFor(S(2));
                    candyLight.TurnOff();
                    candyLight.SetColor(Color.Violet, 0);
                });

            pressureMat.ActiveChanged += (sender, e) =>
            {
                if (e.NewState)
                {
                    log.Info("Button press!");

            //                    candyLight2.RunEffect(new Effect2.Fader(1.0, 0.0), S(0.5));
            //                    Executor.Current.Execute(testSequence);
                }
            };

            pulsatingEffect.AddDevice(candyLight)
                .AddDevice(candyLight2);

            //            candyLight.RunEffect(new Effect2.Pulse(0.0, 1.0), S(2));
        }
Esempio n. 9
0
        public override void Start()
        {
            hours.AddRange("6:00 pm", "10:00 pm");

            var testSequence = new Controller.Sequence("Test Sequence");
            testSequence
                .WhenExecuted
                .Execute(instance =>
                {
                    candyPulse.Start();
                    audioPlayer.PlayEffect("Laugh");
                    georgeMotor.SetVector(1.0, 160, S(5));
                    georgeStrobeLight.SetStrobe(0.55, 1.0);
                    georgeLight.SetStrobe(0.78, Color.Brown);

                    georgeMotor.WaitForVectorReached();
                    instance.WaitFor(S(2));
                    georgeStrobeLight.TurnOff();
                    georgeLight.TurnOff();

                    georgeMotor.SetVector(0.9, 0, S(6));
                    georgeMotor.WaitForVectorReached();
                    candyPulse.Stop();
                });

            var testSequence2 = new Controller.Sequence("Test Sequence 2");
            testSequence2.WhenExecuted
            .Execute(instance =>
            {
                audioPlayer.PlayEffect("348 Spider Hiss");
                spiderLight.SetStrobe(0.78, Color.Red);

                spiderLift.SetPower(true);

                instance.WaitFor(S(3));

                // Spider up
                audioPlayer.PlayEffect("Scream");
                spiderLift.SetPower(false);

                instance.WaitFor(S(2));
                spiderLight.TurnOff();
            });

            var testSequence3 = new Controller.Sequence("Test Sequence 3");
            testSequence3.WhenExecuted
                .Execute(instance =>
                {
                    spiderEyes.SetPower(true);
                    instance.WaitFor(S(10));
                    spiderEyes.SetPower(false);
                });

            var mainSequence = new Controller.Sequence("Main Sequence");
            mainSequence.WhenExecuted
                .Execute(instance =>
                {
                    pulsatingEffect1.Stop();
                    pulsatingEffect2.Stop();
                    flickerEffect.Stop();
                    blinkyEyesLight.SetPower(false);
                    candyLight.SetColor(Color.Red);

                    audioPlayer.PauseBackground();
                    audioPlayer.PlayEffect("Door-creak");
                    instance.WaitFor(S(2));

                    instance.WaitFor(S(2));
                    candyPulse.Stop();
                    candyLight.SetStrobe(1, Color.White);
                    instance.WaitFor(S(0.5));
                    candyLight.TurnOff();
                    instance.WaitFor(S(1));

                    audioPlayer.PlayEffect("348 Spider Hiss");
                    instance.WaitFor(S(0.5));
                    spiderLight.SetStrobe(0.78, Color.Red);

                    spiderLift.SetPower(true);
                    spiderEyes.SetPower(true);

                    instance.WaitFor(S(1));
                    audioPlayer.PlayEffect("348 Spider Hiss");
                    instance.WaitFor(S(2));

                    // Spider up
                    audioPlayer.PlayEffect("Scream");
                    spiderLift.SetPower(false);
                    spiderEyes.SetPower(false);
                    smokeMachine.SetPower(true);

                    instance.WaitFor(S(2));
                    spiderLight.TurnOff();
                    audioPlayer.PlayEffect("Violin screech");
                    instance.WaitFor(S(2));

                    // Skeleton to the right
                    //                    audioPlayer.PlayEffect("Ghostly");
                    rgbLightRight.SetStrobe(0.78, Color.Violet);
                    instance.WaitFor(MS(1000));
                    rgbLightRight.SetColor(Color.Red);
                    instance.WaitFor(MS(1000));
                    rgbLightRight.SetColor(Color.Blue);
                    instance.WaitFor(S(2));
                    rgbLightRight.TurnOff();
                    instance.WaitFor(S(1));

                    // Skeleton to the left
                    audioPlayer.PlayEffect("death-scream");
                    instance.WaitFor(S(0.5));
                    leftSkeletonLight.SetStrobe(0.78, Color.Pink);
                    instance.WaitFor(S(3));
                    smokeMachine.SetPower(false);
                    instance.WaitFor(S(1));
                    leftSkeletonLight.TurnOff();

                    // George
                    audioPlayer.PlayEffect("Laugh");
                    instance.WaitFor(MS(800));
                    georgeMotor.SetVector(1.0, 160, S(5));
                    georgeStrobeLight.SetStrobe(0.55, 1.0);
                    georgeLight.SetStrobe(0.78, Color.Brown);

                    georgeMotor.WaitForVectorReached();
                    instance.WaitFor(S(2));
                    georgeStrobeLight.TurnOff();
                    georgeLight.TurnOff();

                    candyPulse.MinBrightness = 0.05;
                    candyPulse.MaxBrightness = 1.0;
                    candyLight.SetColor(Color.Violet);
                    candyPulse.Start();
                    georgeMotor.SetVector(0.9, 0, S(6));
                    georgeMotor.WaitForVectorReached();

                    blinkyEyesLight.SetPower(true);

                    flickerEffect.Start();
                    pulsatingEffect1.Start();

                    instance.WaitFor(S(5));
                    smokeMachine.SetPower(true);

                    audioPlayer.PlayBackground();
                    // Wait for reset
                    instance.WaitFor(S(15));
                    pulsatingEffect2.Start();
                    candyPulse.MinBrightness = 0.01;
                    candyPulse.MaxBrightness = 0.1;
                    candyLight.SetColor(Color.Green);
                    smokeMachine.SetPower(false);
                });

            pressureMat.ActiveChanged += (sender, e) =>
            {
                if (e.NewState)
                {
                    if (hours.IsOpen)
                        Executor.Current.Execute(mainSequence);
                    else
                        audioPlayer.PlayEffect("Laugh");
                }
            };

            testButton.ActiveChanged += (sender, e) =>
                {
                    if (e.NewState)
                        Executor.Current.Execute(mainSequence);
                };

            hours.OpenHoursChanged += (sender, e) =>
                {
                    if (e.IsOpenNow)
                    {
                        pulsatingEffect1.Start();
                        pulsatingEffect2.Start();
                        flickerEffect.Start();
                        candyPulse.Start();
                        blinkyEyesLight.SetPower(true);
                        audioPlayer.PlayBackground();
                    }
                    else
                    {
                        pulsatingEffect1.Stop();
                        pulsatingEffect2.Stop();
                        flickerEffect.Stop();
                        candyPulse.Stop();
                        blinkyEyesLight.SetPower(false);
                        audioPlayer.PauseBackground();
                    }
                };

            // Have it turned off, but prepare it with blue color for the effect
            rgbLightRight.SetColor(Color.Blue, 0);
            candyLight.SetColor(Color.Green, 0);
            pulsatingEffect1.AddDevice(rgbLightRight);
            pulsatingEffect2.AddDevice(cobWebLight);
            candyPulse.AddDevice(candyLight);

            flickerEffect.AddDevice(skullsLight);
        }
Esempio n. 10
0
        public override void Start()
        {
            var popSeq = new Controller.Sequence("Pop Sequence");

            popSeq.WhenExecuted
            .Execute(instance =>
            {
//                        audioPlayer.PlayEffect("laugh");
                instance.WaitFor(TimeSpan.FromSeconds(1));
                switchTest1.SetPower(true);
                instance.WaitFor(TimeSpan.FromSeconds(5));
                switchTest1.SetPower(false);
                instance.WaitFor(TimeSpan.FromSeconds(1));
            });

            this.oscServer.RegisterAction <int>("/OnOff", (msg, data) =>
            {
                if (data.Any())
                {
                    if (data.First() != 0)
                    {
                        audioPlayer.PlayEffect("Scream");
                    }
                }
            });

            buttonPlayFX.ActiveChanged += (sender, e) =>
            {
                if (e.NewState)
                {
                    Executor.Current.Execute(popSeq);
                }
            };

            buttonPauseFX.ActiveChanged += (sender, e) =>
            {
                if (e.NewState)
                {
                    audioPlayer.PauseFX();
                }
            };

            buttonCueFX.ActiveChanged += (sender, e) =>
            {
                if (e.NewState)
                {
                    audioPlayer.CueFX("myFile");
                }
            };

            buttonResumeFX.ActiveChanged += (sender, e) =>
            {
                if (e.NewState)
                {
                    audioPlayer.ResumeFX();
                }
            };

            buttonPlayBackground.ActiveChanged += (sender, e) =>
            {
                if (e.NewState)
                {
                    audioPlayer.PlayBackground();

//                    switchTest1.SetPower(true);
                }
            };

            buttonPauseBackground.ActiveChanged += (sender, e) =>
            {
                if (e.NewState)
                {
                    audioPlayer.PauseBackground();

//                    switchTest1.SetPower(false);
                }
            };

            buttonBackgroundLowVolume.ActiveChanged += (sender, e) =>
            {
                if (e.NewState)
                {
                    audioPlayer.SetBackgroundVolume(0.5);
                }
            };

            buttonBackgroundHighVolume.ActiveChanged += (sender, e) =>
            {
                if (e.NewState)
                {
                    audioPlayer.SetBackgroundVolume(1.0);
                }
            };

            buttonBackgroundNext.ActiveChanged += (sender, e) =>
            {
                if (e.NewState)
                {
                    audioPlayer.NextBackgroundTrack();
                }
            };

            buttonTrigger1.ActiveChanged += (sender, e) =>
            {
                if (e.NewState)
                {
                    Executor.Current.Execute(popSeq);
                }
            };
        }
Esempio n. 11
0
        public override void Start()
        {
            var explosion = new Controller.Sequence("Explosion");
            explosion.WhenExecuted
            .Execute(instance =>
            {
                audioPlayer.PlayEffect("18384__inferno__largex");
                instance.WaitFor(MS(300));
                int d = 100;
                explosion1.SetBrightness(1);
                instance.WaitFor(MS(d));
                explosion1.SetBrightness(0.5);
                explosion2.SetBrightness(1);
                instance.WaitFor(MS(d));
                explosion1.TurnOff();
                explosion2.SetBrightness(0.5);
                explosion3.SetBrightness(1);
                instance.WaitFor(MS(d));
                explosion2.TurnOff();
                explosion3.SetBrightness(0.5);
                explosion4.SetBrightness(1);
                instance.WaitFor(MS(d));
                explosion3.TurnOff();
                explosion4.SetBrightness(0.5);
                instance.WaitFor(MS(d));
                explosion4.TurnOff();
            });

            var seq = new Controller.Sequence("Seq");
            seq.WhenExecuted
            .Execute(instance =>
                {
                    //                    audioPlayer.PlayEffect("tie_fighter");
                    //                    x.WaitFor(Seconds(2));

                    audioPlayer.PlayEffect("Lazer");
                    instance.WaitFor(MS(300));
                    audioPlayer.PlayEffect("Lazer");

                    var cb = new ColorBrightness[6];
                    cb[0] = new ColorBrightness(Color.Black, 1.0);
                    cb[1] = new ColorBrightness(Color.Red, 1.0);
                    cb[2] = new ColorBrightness(Color.Orange, 1.0);
                    cb[3] = new ColorBrightness(Color.Yellow, 1.0);
                    cb[4] = new ColorBrightness(Color.Blue, 1.0);
                    cb[5] = new ColorBrightness(Color.White, 1.0);

                    for (int i = -6; i < 50; i++)
                    {
                        testPixels.SetColors(i, cb);
                        instance.WaitFor(MS(10));
                    }

                    if (random.Next(10) > 5)
                        Executor.Current.Execute(explosion);
                });

            //            flickerEffect.AddDevice(candyLight);
            testButton.ActiveChanged += (sender, e) =>
            {
                if (e.NewState)
                {
                    log.Info("Button press!");
                    Executor.Current.Execute(seq);
                    //                    audioPlayer.PlayEffect("Lazer");

                }
                else
                {
                    log.Info("Button depress!");

                    //                    testPixels.SetColor(0, Color.Blue);
                }
            };
        }
Esempio n. 12
0
        public HalloweenScene1(IEnumerable <string> args, System.Collections.Specialized.NameValueCollection settings)
        {
            hours             = new OperatingHours("Hours");
            georgeStrobeLight = new StrobeDimmer("George Strobe");
            spiderLight       = new StrobeColorDimmer("Spider Light");
            skullsLight       = new Dimmer("Skulls");
            cobWebLight       = new Dimmer("Cob Web");
            blinkyEyesLight   = new Switch("Blinky Eyes");
            rgbLightRight     = new StrobeColorDimmer("Light Right");
            georgeLight       = new StrobeColorDimmer("George Light");
            leftSkeletonLight = new StrobeColorDimmer("Skeleton Light");
            georgeMotor       = new MotorWithFeedback("George Motor");
            candyLight        = new StrobeColorDimmer("Candy Light");
            spiderLift        = new Switch("Slider Lift");
            smokeMachine      = new Switch("Smoke Machine");
            spiderEyes        = new Switch("Spider Eyes");
            pressureMat       = new DigitalInput("Pressure Mat");
            testButton        = new DigitalInput("Test");

            pulsatingEffect1 = new Effect.Pulsating(S(2), 0.1, 0.4);
            pulsatingEffect2 = new Effect.Pulsating(S(2), 0.3, 0.5);
            candyPulse       = new Effect.Pulsating(S(3), 0.01, 0.1);
            flickerEffect    = new Effect.Flicker(0.4, 0.6);

            audioPlayer = new Physical.NetworkAudioPlayer(
                settings["NetworkAudioPlayerIP"],
                int.Parse(settings["NetworkAudioPlayerPort"]));

            hours.AddRange("6:00 pm", "10:00 pm");

            var testSequence = new Controller.Sequence("Test Sequence");

            testSequence
            .WhenExecuted
            .Execute(instance =>
            {
                candyPulse.Start();
                audioPlayer.PlayEffect("Laugh");
                georgeMotor.SetVector(1.0, 160, S(5));
                georgeStrobeLight.SetStrobe(0.55, 1.0);
                georgeLight.SetStrobe(0.78, Color.Brown);

                georgeMotor.WaitForVectorReached();
                instance.WaitFor(S(2));
                georgeStrobeLight.TurnOff();
                georgeLight.TurnOff();

                georgeMotor.SetVector(0.9, 0, S(6));
                georgeMotor.WaitForVectorReached();
                candyPulse.Stop();
            });

            var testSequence2 = new Controller.Sequence("Test Sequence 2");

            testSequence2.WhenExecuted
            .Execute(instance =>
            {
                audioPlayer.PlayEffect("348 Spider Hiss");
                spiderLight.SetStrobe(0.78, Color.Red);

                spiderLift.SetPower(true);

                instance.WaitFor(S(3));

                // Spider up
                audioPlayer.PlayEffect("Scream");
                spiderLift.SetPower(false);

                instance.WaitFor(S(2));
                spiderLight.TurnOff();
            });

            var testSequence3 = new Controller.Sequence("Test Sequence 3");

            testSequence3.WhenExecuted
            .Execute(instance =>
            {
                spiderEyes.SetPower(true);
                instance.WaitFor(S(10));
                spiderEyes.SetPower(false);
            });

            var mainSequence = new Controller.Sequence("Main Sequence");

            mainSequence.WhenExecuted
            .Execute(instance =>
            {
                pulsatingEffect1.Stop();
                pulsatingEffect2.Stop();
                flickerEffect.Stop();
                blinkyEyesLight.SetPower(false);
                candyLight.SetColor(Color.Red);

                audioPlayer.PauseBackground();
                audioPlayer.PlayEffect("Door-creak");
                instance.WaitFor(S(2));


                instance.WaitFor(S(2));
                candyPulse.Stop();
                candyLight.SetStrobe(1, Color.White);
                instance.WaitFor(S(0.5));
                candyLight.TurnOff();
                instance.WaitFor(S(1));

                audioPlayer.PlayEffect("348 Spider Hiss");
                instance.WaitFor(S(0.5));
                spiderLight.SetStrobe(0.78, Color.Red);

                spiderLift.SetPower(true);
                spiderEyes.SetPower(true);

                instance.WaitFor(S(1));
                audioPlayer.PlayEffect("348 Spider Hiss");
                instance.WaitFor(S(2));

                // Spider up
                audioPlayer.PlayEffect("Scream");
                spiderLift.SetPower(false);
                spiderEyes.SetPower(false);
                smokeMachine.SetPower(true);

                instance.WaitFor(S(2));
                spiderLight.TurnOff();
                audioPlayer.PlayEffect("Violin screech");
                instance.WaitFor(S(2));


                // Skeleton to the right
                //                    audioPlayer.PlayEffect("Ghostly");
                rgbLightRight.SetStrobe(0.78, Color.Violet);
                instance.WaitFor(MS(1000));
                rgbLightRight.SetColor(Color.Red);
                instance.WaitFor(MS(1000));
                rgbLightRight.SetColor(Color.Blue);
                instance.WaitFor(S(2));
                rgbLightRight.TurnOff();
                instance.WaitFor(S(1));


                // Skeleton to the left
                audioPlayer.PlayEffect("death-scream");
                instance.WaitFor(S(0.5));
                leftSkeletonLight.SetStrobe(0.78, Color.Pink);
                instance.WaitFor(S(3));
                smokeMachine.SetPower(false);
                instance.WaitFor(S(1));
                leftSkeletonLight.TurnOff();


                // George
                audioPlayer.PlayEffect("Laugh");
                instance.WaitFor(MS(800));
                georgeMotor.SetVector(1.0, 160, S(5));
                georgeStrobeLight.SetStrobe(0.55, 1.0);
                georgeLight.SetStrobe(0.78, Color.Brown);

                georgeMotor.WaitForVectorReached();
                instance.WaitFor(S(2));
                georgeStrobeLight.TurnOff();
                georgeLight.TurnOff();

                candyPulse.MinBrightness = 0.05;
                candyPulse.MaxBrightness = 1.0;
                candyLight.SetColor(Color.Violet);
                candyPulse.Start();
                georgeMotor.SetVector(0.9, 0, S(6));
                georgeMotor.WaitForVectorReached();


                blinkyEyesLight.SetPower(true);

                flickerEffect.Start();
                pulsatingEffect1.Start();

                instance.WaitFor(S(5));
                smokeMachine.SetPower(true);

                audioPlayer.PlayBackground();
                // Wait for reset
                instance.WaitFor(S(15));
                pulsatingEffect2.Start();
                candyPulse.MinBrightness = 0.01;
                candyPulse.MaxBrightness = 0.1;
                candyLight.SetColor(Color.Green);
                smokeMachine.SetPower(false);
            });

            pressureMat.ActiveChanged += (sender, e) =>
            {
                if (e.NewState)
                {
                    if (hours.IsOpen)
                    {
                        Executor.Current.Execute(mainSequence);
                    }
                    else
                    {
                        audioPlayer.PlayEffect("Laugh");
                    }
                }
            };

            testButton.ActiveChanged += (sender, e) =>
            {
                if (e.NewState)
                {
                    Executor.Current.Execute(mainSequence);
                }
            };

            hours.OpenHoursChanged += (sender, e) =>
            {
                if (e.IsOpenNow)
                {
                    pulsatingEffect1.Start();
                    pulsatingEffect2.Start();
                    flickerEffect.Start();
                    candyPulse.Start();
                    blinkyEyesLight.SetPower(true);
                    audioPlayer.PlayBackground();
                }
                else
                {
                    pulsatingEffect1.Stop();
                    pulsatingEffect2.Stop();
                    flickerEffect.Stop();
                    candyPulse.Stop();
                    blinkyEyesLight.SetPower(false);
                    audioPlayer.PauseBackground();
                }
            };

            // Have it turned off, but prepare it with blue color for the effect
            rgbLightRight.SetColor(Color.Blue, 0);
            candyLight.SetColor(Color.Green, 0);
            pulsatingEffect1.AddDevice(rgbLightRight);
            pulsatingEffect2.AddDevice(cobWebLight);
            candyPulse.AddDevice(candyLight);

            flickerEffect.AddDevice(skullsLight);
        }
Esempio n. 13
0
        public DemoScene1(IEnumerable <string> args)
        {
            pulsatingEffect1      = new Effect.Pulsating(S(2), 0.1, 1.0, false, "Pulse FX 1");
            light1                = new StrobeColorDimmer("Small RGB");
            buttonTestSound       = new DigitalInput("Test sound");
            buttonPlayBackground  = new DigitalInput("Play Background");
            buttonPauseBackground = new DigitalInput("Pause Background");
            buttonTrigger1        = new DigitalInput("Test seq");
            buttonTestLight1      = new DigitalInput("Test light");
            buttonTestLight2      = new DigitalInput("Test pulse");
            switchTest1           = new Switch("Switch test 1");

            audioPlayer = new AudioPlayer("Audio Player");

            raspberry.DigitalInputs[4].Connect(buttonTrigger1, true);
            raspberry.DigitalOutputs[7].Connect(switchTest1);

            raspberry.Connect(audioPlayer);


            var demoSeq = new Controller.Sequence("Demo Sequence");

            demoSeq.WhenExecuted
            .Execute(instance =>
            {
                audioPlayer.PlayEffect("laugh");
                switchTest1.SetPower(true);
                light1.SetColor(Color.Orange, 1.0);
                instance.WaitFor(TimeSpan.FromSeconds(1));
                switchTest1.SetPower(false);
                light1.RunEffect(new Effect2.Fader(1.0, 0.0), S(1.0));
            });

            buttonTestSound.ActiveChanged += (sender, e) =>
            {
                if (e.NewState)
                {
                    audioPlayer.PlayEffect("sixthsense-deadpeople");
                }
            };

            buttonPlayBackground.ActiveChanged += (sender, e) =>
            {
                if (e.NewState)
                {
                    audioPlayer.PlayBackground();
                }
            };

            buttonPauseBackground.ActiveChanged += (sender, e) =>
            {
                if (e.NewState)
                {
                    audioPlayer.PauseBackground();
                }
            };

            buttonTestLight1.ActiveChanged += (sender, e) =>
            {
                if (e.NewState)
                {
                    light1.SetOnlyColor(Color.White);
                    light1.RunEffect(new Effect2.Fader(0.0, 1.0), S(1.0));
                    Thread.Sleep(S(1));
                    light1.RunEffect(new Effect2.Fader(1.0, 0.0), S(1.0));
                }
            };

            buttonTestLight2.ActiveChanged += (sender, e) =>
            {
                if (e.NewState)
                {
                    pulsatingEffect1.Start();
                }
                else
                {
                    pulsatingEffect1.Stop();
                }
            };

            buttonTrigger1.ActiveChanged += (sender, e) =>
            {
                if (e.NewState)
                {
                    Executor.Current.Execute(demoSeq);
                }
            };

            pulsatingEffect1.AddDevice(light1);
        }
Esempio n. 14
0
        public DemoScene1(IEnumerable<string> args)
        {
            pulsatingEffect1 = new Effect.Pulsating(S(2), 0.1, 1.0, false, "Pulse FX 1");
            light1 = new StrobeColorDimmer("Small RGB");
            buttonTestSound = new DigitalInput("Test sound");
            buttonPlayBackground = new DigitalInput("Play Background");
            buttonPauseBackground = new DigitalInput("Pause Background");
            buttonTrigger1 = new DigitalInput("Test seq");
            buttonTestLight1 = new DigitalInput("Test light");
            buttonTestLight2 = new DigitalInput("Test pulse");
            switchTest1 = new Switch("Switch test 1");

            audioPlayer = new AudioPlayer("Audio Player");

            raspberry.DigitalInputs[4].Connect(buttonTrigger1, true);
            raspberry.DigitalOutputs[7].Connect(switchTest1);

            raspberry.Connect(audioPlayer);

            var demoSeq = new Controller.Sequence("Demo Sequence");
            demoSeq.WhenExecuted
                .Execute(instance =>
                {
                    audioPlayer.PlayEffect("laugh");
                    switchTest1.SetPower(true);
                    light1.SetColor(Color.Orange, 1.0);
                    instance.WaitFor(TimeSpan.FromSeconds(1));
                    switchTest1.SetPower(false);
                    light1.RunEffect(new Effect2.Fader(1.0, 0.0), S(1.0));
                });

            buttonTestSound.ActiveChanged += (sender, e) =>
            {
                if (e.NewState)
                {
                    audioPlayer.PlayEffect("sixthsense-deadpeople");
                }
            };

            buttonPlayBackground.ActiveChanged += (sender, e) =>
            {
                if (e.NewState)
                {
                    audioPlayer.PlayBackground();
                }
            };

            buttonPauseBackground.ActiveChanged += (sender, e) =>
            {
                if (e.NewState)
                {
                    audioPlayer.PauseBackground();
                }
            };

            buttonTestLight1.ActiveChanged += (sender, e) =>
            {
                if (e.NewState)
                {
                    light1.SetOnlyColor(Color.White);
                    light1.RunEffect(new Effect2.Fader(0.0, 1.0), S(1.0));
                    Thread.Sleep(S(1));
                    light1.RunEffect(new Effect2.Fader(1.0, 0.0), S(1.0));
                }
            };

            buttonTestLight2.ActiveChanged += (sender, e) =>
            {
                if (e.NewState)
                {
                    pulsatingEffect1.Start();
                }
                else
                {
                    pulsatingEffect1.Stop();
                }
            };

            buttonTrigger1.ActiveChanged += (sender, e) =>
            {
                if (e.NewState)
                {
                    Executor.Current.Execute(demoSeq);
                }
            };

            pulsatingEffect1.AddDevice(light1);
        }
        public override void Start()
        {
            hoursSmall.AddRange("5:00 pm", "9:00 pm");
            hoursFull.AddRange("5:00 pm", "9:00 pm");
            //hoursFull.SetForced(true);
            //hoursSmall.SetForced(true);
            //hoursFull.SetForced(false);
            //hoursSmall.SetForced(false);

#if !true
            hoursFull.SetForced(true);

            audioBeauty.SetSilent(true);
            audioCat.SetSilent(true);
            audioGeorge.SetSilent(true);
            audioSpider.SetSilent(true);
            georgeMotor.SetDisabled(true);
#endif
            var backgroundSeq = new Controller.Sequence("BG Sequence");
            backgroundSeq.WhenExecuted
            .SetUp(() =>
            {
                audioGeorge.PlayBackground();
                lightFloor.SetOnlyColor(Color.Orange);
                pulsatingEffect1.Start();
                flickerEffect.Start();
            })
            .Execute(instance =>
            {
                while (!instance.IsCancellationRequested)
                {
                    instance.WaitFor(S(1));
                    if (!this.lastFogRun.HasValue || (DateTime.Now - this.lastFogRun.Value).TotalMinutes > 10)
                    {
                        // Run the fog for a little while
                        switchFog.SetPower(true);
                        instance.WaitFor(S(4));
                        switchFog.SetPower(false);
                        this.lastFogRun = DateTime.Now;
                    }
                }
            })
            .TearDown(() =>
            {
                audioGeorge.PauseBackground();
                pulsatingEffect1.Stop();
                flickerEffect.Stop();
            });

            var deadendSeq = new Controller.Sequence("Deadend dr");
            deadendSeq.WhenExecuted
            .Execute(instance =>
            {
                switchDeadendDrive.SetPower(true);
                Thread.Sleep(1000);
                switchDeadendDrive.SetPower(false);
            });

            var stairSeq = new Controller.Sequence("Stair Sequence");
            stairSeq.WhenExecuted
            .SetUp(() =>
            {
            })
            .Execute(instance =>
            {
                switchFog.SetPower(true);
                this.lastFogRun = DateTime.Now;
                Executor.Current.Execute(deadendSeq);
                audioGeorge.PlayEffect("ghostly");
                instance.WaitFor(S(0.5));
                popOutEffect.Pop(1.0);

                instance.WaitFor(S(1.0));
                audioSpider.PlayNewEffect("348 Spider Hiss");
                switchSpider.SetPower(true);
                instance.WaitFor(S(0.5));
                switchSpiderEyes1.SetPower(true);
                instance.WaitFor(S(2));
                switchSpider.SetPower(false);
                switchSpiderEyes1.SetPower(false);
                instance.WaitFor(S(4));
                stateMachine.NextState();
            })
            .TearDown(() =>
            {
                switchFog.SetPower(false);
                audioGeorge.PauseFX();
            });

            var georgeReturnSeq = new Controller.Sequence("George Return Seq");
            georgeReturnSeq.WhenExecuted
            .Execute(instance =>
            {
                georgeMotor.WaitForVectorReached();
                georgeMotor.SetVector(0.9, 0, S(15));
                georgeMotor.WaitForVectorReached();
            });

            var georgeSeq = new Controller.Sequence("George Sequence");
            georgeSeq.WhenExecuted
            .Execute(instance =>
            {
                //Exec.WaitUntilFinished(georgeReturnSeq);

                audioGeorge.PlayEffect("laugh");
                georgeMotor.SetVector(1.0, 350, S(10));
                instance.WaitFor(TimeSpan.FromSeconds(0.8));
                lightGeorge.SetColor(Color.Red);
                georgeMotor.WaitForVectorReached(instance);
                instance.WaitFor(TimeSpan.FromSeconds(2));
                georgeMotor.SetVector(0.9, 0, S(15));
                lightGeorge.RunEffect(new Effect2.Fader(1.0, 0.0), S(1.0));
                instance.WaitFor(TimeSpan.FromSeconds(1));
                lightFloor.SetOnlyColor(Color.Green);
                pulsatingEffect1.Start();
                georgeMotor.WaitForVectorReached(instance);

                instance.WaitFor(S(15));
            })
            .TearDown(() =>
            {
                Exec.Execute(georgeReturnSeq);
                pulsatingEffect1.Stop();
                lightGeorge.TurnOff();
            });

            var spiderEyes2Seq = new Controller.Sequence("Spider Eyes 2");
            spiderEyes2Seq.WhenExecuted
            .Execute(instance =>
            {
                var rnd = new Random();
                while (!instance.IsCancellationRequested)
                {
                    switchSpiderEyes2.SetPower(true);
                    instance.WaitFor(S(1.0 + rnd.Next(10)));
                    switchSpiderEyes2.SetPower(false);
                    instance.WaitFor(S(1.0 + rnd.Next(2)));
                }
            });

            var popupSeq = new Controller.Sequence("Popup Sequence");
            popupSeq.WhenExecuted
            .Execute(instance =>
            {
                audioBeauty.PlayEffect("scream", 0.0, 1.0);
                switchPopEyes.SetPower(true);
                instance.WaitFor(TimeSpan.FromSeconds(1.0));
                lightPopup.SetBrightness(1.0);
                switchPopUp.SetPower(true);

                instance.WaitFor(S(3));

                lightPopup.RunEffect(new Effect2.Fader(1.0, 0.0), S(1.0));
                switchPopEyes.TurnOff();
                switchPopUp.TurnOff();
            });

            var beautySeq = new Controller.Sequence("Beauty Sequence");
            beautySeq.WhenExecuted
            .Execute(instance =>
            {
                flickerEffect2.Stop();
                lightBeauty.SetColor(Color.Purple);
                switchHand.SetPower(true);
                instance.WaitFor(TimeSpan.FromSeconds(1));
                audioBeauty.PlayEffect("gollum_precious1", 1.0, 0.0);
                instance.WaitFor(TimeSpan.FromSeconds(0.4));
                switchHead.SetPower(true);
                instance.WaitFor(TimeSpan.FromSeconds(6));
                switchHead.SetPower(false);
                switchHand.SetPower(false);

                instance.WaitFor(TimeSpan.FromSeconds(1.5));
                lightBeauty.TurnOff();
                instance.WaitFor(TimeSpan.FromSeconds(0.5));
                switchDrawer1.SetPower(true);
                switchHead.SetPower(true);
                instance.WaitFor(TimeSpan.FromSeconds(0.5));
                lightBeauty.SetColor(Color.Red, 1.0);
                audioBeauty.PlayEffect("my_pretty", 1.0, 0.0);
                instance.WaitFor(TimeSpan.FromSeconds(4));
                switchDrawer2.SetPower(true);
                instance.WaitFor(TimeSpan.FromSeconds(2));
                switchDrawer1.SetPower(false);
                instance.WaitFor(TimeSpan.FromSeconds(0.15));
                switchDrawer2.SetPower(false);
                instance.WaitFor(TimeSpan.FromSeconds(1));

                switchHead.SetPower(false);
                lightBeauty.RunEffect(new Effect2.Fader(1.0, 0.0), S(1.0));
                if (hoursSmall.IsOpen)
                {
                    flickerEffect2.Start();
                }
                instance.WaitFor(TimeSpan.FromSeconds(5));
            });


            var catSeq = new Controller.Sequence("Cat Sequence");
            catSeq.WhenExecuted
            .Execute(instance =>
            {
                var maxRuntime = System.Diagnostics.Stopwatch.StartNew();

                var random = new Random();

                catLights.SetPower(true);

                while (true)
                {
                    switch (random.Next(4))
                    {
                    case 0:
                        audioCat.PlayEffect("266 Monster Growl 7", 1.0, 1.0);
                        instance.WaitFor(TimeSpan.FromSeconds(2.0));
                        break;

                    case 1:
                        audioCat.PlayEffect("285 Monster Snarl 2", 1.0, 1.0);
                        instance.WaitFor(TimeSpan.FromSeconds(3.0));
                        break;

                    case 2:
                        audioCat.PlayEffect("286 Monster Snarl 3", 1.0, 1.0);
                        instance.WaitFor(TimeSpan.FromSeconds(2.5));
                        break;

                    case 3:
                        audioCat.PlayEffect("287 Monster Snarl 4", 1.0, 1.0);
                        instance.WaitFor(TimeSpan.FromSeconds(1.5));
                        break;

                    default:
                        instance.WaitFor(TimeSpan.FromSeconds(3.0));
                        break;
                    }

                    instance.CancelToken.ThrowIfCancellationRequested();

                    if (maxRuntime.Elapsed.TotalSeconds > 10)
                    {
                        break;
                    }
                }
            })
            .TearDown(() =>
            {
                catLights.TurnOff();
            });

            var candyCane = new Controller.Sequence("Candy Cane");
            candyCane
            .WhenExecuted
            .SetUp(() => allPixels.TurnOff())
            .Execute(instance =>
            {
                var cbList = new List <ColorBrightness>();
                //cbList.Add(new ColorBrightness(Color.Green, 1.00));
                //cbList.Add(new ColorBrightness(Color.Green, 0.70));
                //cbList.Add(new ColorBrightness(Color.Green, 0.40));
                //cbList.Add(new ColorBrightness(Color.White, 1.00));
                //cbList.Add(new ColorBrightness(Color.White, 0.70));
                //cbList.Add(new ColorBrightness(Color.White, 0.40));
                //cbList.Add(new ColorBrightness(Color.Red, 1.00));
                //cbList.Add(new ColorBrightness(Color.Red, 0.70));
                //cbList.Add(new ColorBrightness(Color.Red, 0.40));
                //cbList.Add(new ColorBrightness(Color.Black, 0.0));
                //cbList.Add(new ColorBrightness(Color.Black, 0.0));
                //cbList.Add(new ColorBrightness(Color.Black, 0.0));
                //cbList.Add(new ColorBrightness(Color.Black, 0.0));

                double b1 = 1.00;
                double b2 = 0.70;
                double b3 = 0.40;
                Color c1  = Color.Blue;
                Color c2  = Color.Yellow;
                Color c3  = Color.Blue;
                Color c4  = Color.Black;

                cbList.Add(new ColorBrightness(c1, b1));
                cbList.Add(new ColorBrightness(c1, b2));
                cbList.Add(new ColorBrightness(c1, b3));
                cbList.Add(new ColorBrightness(c2, b1));
                cbList.Add(new ColorBrightness(c2, b2));
                cbList.Add(new ColorBrightness(c2, b3));
                cbList.Add(new ColorBrightness(c3, b1));
                cbList.Add(new ColorBrightness(c3, b2));
                cbList.Add(new ColorBrightness(c3, b3));
                cbList.Add(new ColorBrightness(c4, 0.0));
                cbList.Add(new ColorBrightness(c4, 0.0));
                cbList.Add(new ColorBrightness(c4, 0.0));
                cbList.Add(new ColorBrightness(c4, 0.0));

                b1 = 1.00;
                b2 = 0.70;
                b3 = 0.40;
                c1 = Color.White;
                c2 = Color.Blue;
                c3 = Color.Red;
                c4 = Color.Black;

                cbList.Add(new ColorBrightness(c1, b1));
                cbList.Add(new ColorBrightness(c1, b2));
                cbList.Add(new ColorBrightness(c1, b3));
                cbList.Add(new ColorBrightness(c2, b1));
                cbList.Add(new ColorBrightness(c2, b2));
                cbList.Add(new ColorBrightness(c2, b3));
                cbList.Add(new ColorBrightness(c3, b1));
                cbList.Add(new ColorBrightness(c3, b2));
                cbList.Add(new ColorBrightness(c3, b3));
                cbList.Add(new ColorBrightness(c4, 0.0));
                cbList.Add(new ColorBrightness(c4, 0.0));
                cbList.Add(new ColorBrightness(c4, 0.0));
                cbList.Add(new ColorBrightness(c4, 0.0));

                b1 = 1.00;
                b2 = 0.70;
                b3 = 0.40;
                c1 = Color.Red;
                c2 = Color.White;
                c3 = Color.Blue;
                c4 = Color.Black;

                cbList.Add(new ColorBrightness(c1, b1));
                cbList.Add(new ColorBrightness(c1, b2));
                cbList.Add(new ColorBrightness(c1, b3));
                cbList.Add(new ColorBrightness(c2, b1));
                cbList.Add(new ColorBrightness(c2, b2));
                cbList.Add(new ColorBrightness(c2, b3));
                cbList.Add(new ColorBrightness(c3, b1));
                cbList.Add(new ColorBrightness(c3, b2));
                cbList.Add(new ColorBrightness(c3, b3));
                cbList.Add(new ColorBrightness(c4, 0.0));
                cbList.Add(new ColorBrightness(c4, 0.0));
                cbList.Add(new ColorBrightness(c4, 0.0));
                cbList.Add(new ColorBrightness(c4, 0.0));

                while (true)
                {
                    foreach (var cb in cbList)
                    {
                        allPixels.Inject(cb);
                        instance.WaitFor(S(0.350), true);
                    }
                }
            })
            .TearDown(() =>
            {
                allPixels.TurnOff();
            });


            stateMachine.ForFromSequence(States.Background, backgroundSeq);
            stateMachine.ForFromSequence(States.Stair, stairSeq);
            stateMachine.ForFromSequence(States.George, georgeSeq);
            stateMachine.ForFromSequence(States.Popup, popupSeq);

            hoursSmall.OpenHoursChanged += (sender, e) =>
            {
                if (e.IsOpenNow)
                {
                    pulsatingEffect2.Start();
                    flickerEffect.Start();
                    flickerEffect2.Start();
                    catFan.SetPower(true);
                    lightEyes.SetPower(true);
                    lightTreeGhost.SetBrightness(1.0);
                    //                        Exec.Execute(candyCane);
                    allPixels.SetAll(Color.FromArgb(255, 115, 0), 0.5);
                }
                else
                {
                    pulsatingEffect2.Stop();
                    flickerEffect.Stop();
                    flickerEffect2.Stop();
                    catFan.SetPower(false);
                    lightEyes.SetPower(false);
                    lightTreeGhost.TurnOff();
                    allPixels.TurnOff();
                }
            };

            hoursFull.OpenHoursChanged += (sender, e) =>
            {
                if (e.IsOpenNow)
                {
                    Executor.Current.Execute(spiderEyes2Seq);
                    stateMachine.SetBackgroundState(States.Background);
                    stateMachine.SetState(States.Background);
                }
                else
                {
                    Executor.Current.Cancel(spiderEyes2Seq);
                    stateMachine.Hold();
                    stateMachine.SetBackgroundState(null);
                    audioGeorge.PauseBackground();
                }
            };

            buttonMotionCat.ActiveChanged += (sender, e) =>
            {
#if CHECK_SENSOR_ALIGNMENT
                catLights.SetPower(e.NewState);
#else
                if (e.NewState && hoursSmall.IsOpen)
                {
                    Executor.Current.Execute(catSeq);
                }
#endif
            };

            buttonMotionBeauty.ActiveChanged += (sender, e) =>
            {
                if (e.NewState && hoursFull.IsOpen)
                {
                    Executor.Current.Execute(beautySeq);
                }
            };

            buttonTriggerStairs.ActiveChanged += (sender, e) =>
            {
                if (!hoursSmall.IsOpen)
                {
                    lightFloor.SetColor(Color.Purple, e.NewState ? 0.6 : 0.0);
                }
                else
                {
                    if (e.NewState && hoursFull.IsOpen)
                    {
                        if (!stateMachine.CurrentState.HasValue || stateMachine.CurrentState == States.Background)
                        {
                            stateMachine.SetState(States.Stair);
                        }
                    }
                }
            };

            buttonTriggerPopup.ActiveChanged += (sender, e) =>
            {
                if (!hoursSmall.IsOpen)
                {
                    lightPopup.SetBrightness(e.NewState ? 0.5 : 0.0);
                }
                else
                {
                    if (e.NewState)
                    {
                        if (stateMachine.CurrentState == States.George)
                        {
                            stateMachine.SetState(States.Popup);
                        }
                    }
                }
            };

            flickerEffect.AddDevice(skullsLight);
            flickerEffect2.AddDevice(skullsLight2);
            lightFloor.SetColor(Color.Orange, 0);
            lightSign.SetColor(Color.Pink, 0);
            pulsatingEffect1.AddDevice(lightFloor);
            pulsatingEffect1.AddDevice(lightSpiderWeb);
            pulsatingEffect2.AddDevice(lightSign);

            popOutEffect.AddDevice(skullsLight);

            ForTest();
        }
Esempio n. 16
0
        public XmasScene2(IEnumerable <string> args, System.Collections.Specialized.NameValueCollection settings)
        {
            hours = new OperatingHours("Hours");
            if (!args.Contains("TEST"))
            {
                hours.AddRange("5:00 pm", "10:00 pm");
                hours.AddRange("5:00 am", "7:00 am");
            }

            lightNetRight     = new Dimmer("Net Right");
            lightGarlandRight = new Dimmer("Garland Right");
            lightHatsRight    = new Dimmer("Hats Right");
            lightTreesRight   = new Dimmer("Trees Right");
            lightReindeers    = new Dimmer("Reindeers");
            lightIcicles      = new Dimmer("Icicles");
            lightNetLeft      = new Dimmer("Net Left");
            lightTree         = new Dimmer("Tree");
            lightGarlandLeft  = new Dimmer("Garland Left");
            lightUnused1      = new Dimmer("Unused 1");
            lightUnused2      = new Dimmer("Unused 2");
            lightJesus        = new StrobeColorDimmer("Jesus");
            lightCeiling1     = new StrobeColorDimmer("Ceiling 1");
            lightCeiling2     = new StrobeColorDimmer("Ceiling 2");
            lightCeiling3     = new StrobeColorDimmer("Ceiling 3");
            lightVader        = new StrobeColorDimmer("Vader");
            buttonLightRed    = new Switch("Button Red");
            buttonLightBlue   = new Switch("Button Blue");
            elLightsaber      = new Switch("Lightsaber");
            elJesus           = new Switch("Jesus Halo");
            bigReindeer       = new Switch("Big Reindeer");

            buttonBlue          = new DigitalInput("Button Blue");
            buttonRed           = new DigitalInput("Button Red");
            buttonStartReindeer = new DigitalInput("Start Reindeer");

            timeline       = new Controller.Timeline <string>(1);
            stateMachine   = new Controller.EnumStateMachine <States>("Main");
            candyCane      = new Controller.Sequence("Candy Cane");
            starwarsCane   = new Controller.Sequence("Starwars Cane");
            backgroundLoop = new Controller.Sequence("Background");
            musicSeq       = new Controller.Sequence("Christmas Canon");
            buttonSeq      = new Controller.Sequence("Buttons");
            fatherSeq      = new Controller.Sequence("Father");
            breathSeq      = new Controller.Sequence("Breath");
            laserSeq       = new Controller.Sequence("Laser");

            allPixels = new VirtualPixel1D(100);

            pulsatingEffect1 = new Effect.Pulsating(S(2), 0.3, 1.0, false);
            pulsatingEffect2 = new Effect.Pulsating(S(2), 0.3, 1.0, false);

            popOutPiano     = new Effect.PopOut(S(0.4));
            popOutDrums     = new Effect.PopOut(S(0.4));
            popOutDrumsFast = new Effect.PopOut(S(0.3));
            popOutChord     = new Effect.PopOut(S(0.4));
            popOutSolo      = new Effect.PopOut(S(0.3));
            popOutSolo2     = new Effect.PopOut(S(0.2));
            popOutChoir     = new Effect.PopOut(S(1.0));
            popOutVoice     = new Effect.PopOut(S(1.0));
            popOutVocal2    = new Effect.PopOut(S(2.0));
            popOutVocalLong = new Effect.PopOut(S(5.0));
            popOutEnd       = new Effect.PopOut(S(5.0));

            popOutPiano
            .AddDevice(lightIcicles);

            popOutDrums
            .AddDevice(lightReindeers)
            .AddDevice(lightHatsRight);

            popOutDrumsFast
            .AddDevice(lightCeiling1)
            .AddDevice(allPixels);

            popOutChord
            .AddDevice(lightTree)
            .AddDevice(lightCeiling2)
            .AddDevice(lightCeiling3);

            popOutSolo
            .AddDevice(lightNetLeft)
            .AddDevice(lightNetRight)
            .AddDevice(lightCeiling1)
            .AddDevice(lightCeiling3)
            .SetPriority(2);

            popOutSolo2
            .AddDevice(lightCeiling1)
            .AddDevice(lightCeiling3)
            .SetPriority(2);

            popOutChoir
            .AddDevice(lightGarlandRight)
            .AddDevice(lightTreesRight)
            .AddDevice(lightCeiling1);

            popOutVoice
            .AddDevice(lightGarlandLeft)
            .AddDevice(lightCeiling3);

            popOutVocal2
            .AddDevice(lightReindeers)
            .AddDevice(allPixels)
            .SetPriority(10);

            popOutVocalLong
            .AddDevice(lightNetRight)
            .AddDevice(lightGarlandRight)
            .AddDevice(lightHatsRight)
            .SetPriority(10);

            popOutEnd
            .AddDevice(lightIcicles)
            .AddDevice(lightReindeers)
            .AddDevice(lightHatsRight)
            .AddDevice(lightCeiling1)
            .AddDevice(lightCeiling2)
            .AddDevice(lightCeiling3)
            .AddDevice(lightGarlandRight)
            .AddDevice(lightGarlandLeft)
            .AddDevice(lightTreesRight)
            .AddDevice(lightNetRight)
            .AddDevice(lightNetLeft)
            .AddDevice(allPixels)
            .SetPriority(100);


            timeline.AddMs(0, "INIT");
            timeline.PopulateFromCSV("Christmas Canon Rock All Labels.csv");
            int state    = 0;
            int halfSolo = 0;

            timeline.TimelineTrigger += (sender, e) =>
            {
                switch (e.Step)
                {
                case 62:
                    // First drum
                    state = 1;
                    allPixels.TurnOff();
                    break;

                case 69:
                    state = 2;
                    lightCeiling2.SetOnlyColor(Color.Green);
                    lightCeiling3.SetOnlyColor(Color.Blue);
                    break;

                case 136:
                    // First solo
                    state = 3;
                    allPixels.TurnOff();
                    lightCeiling2.SetOnlyColor(Color.White);
                    lightCeiling3.SetOnlyColor(Color.Red);
                    break;

                case 265:
                    // First choir
                    allPixels.TurnOff();
                    state = 4;
                    break;

                case 396:
                    // Vocal 2
                    state = 5;
                    allPixels.SetAllOnlyColor(Color.Blue);
                    break;

                case 497:
                    // Second solo
                    state = 6;
                    allPixels.TurnOff();
                    lightCeiling2.SetOnlyColor(Color.White);
                    lightCeiling3.SetOnlyColor(Color.Red);
                    break;

                case 561:
                    // End second solo
                    state = 7;
                    allPixels.TurnOff();
                    break;

                case 585:
                    // End third solo
                    state = 8;
                    allPixels.TurnOff();
                    break;

                case 721:
                    // End third solo
                    state = 9;
                    allPixels.TurnOff();
                    break;
                }

                switch (e.Code)
                {
                case "INIT":
                    state    = 0;
                    halfSolo = 0;
                    lightCeiling1.SetColor(Color.White, 0);
                    lightCeiling2.SetColor(Color.Blue, 0);
                    lightCeiling3.SetColor(Color.Red, 0);
                    break;

                case "N1":
                    popOutPiano.Pop(0.4);
                    if (state == 0)
                    {
                        allPixels.Inject(Color.Red, 0.5);
                    }
                    break;

                case "N2":
                    popOutPiano.Pop(0.6);
                    if (state == 0)
                    {
                        allPixels.Inject(Color.White, 0.5);
                    }
                    break;

                case "N3":
                    popOutPiano.Pop(0.8);
                    if (state == 0)
                    {
                        allPixels.Inject(Color.Blue, 0.5);
                    }
                    break;

                case "N4":
                    popOutPiano.Pop(1.0);
                    if (state == 0)
                    {
                        allPixels.Inject(Color.Black, 0.0);
                    }
                    break;

                case "Base":
                    popOutDrums.Pop(1.0);
                    if (state < 3)
                    {
                        allPixels.SetAllOnlyColor(Color.Purple);
                        popOutDrumsFast.Pop(1.0);
                    }
                    break;

                case "Cymbal":
                    popOutDrums.Pop(1.0);
                    if (state < 3)
                    {
                        allPixels.SetAllOnlyColor(Color.Green);
                        popOutDrumsFast.Pop(1.0);
                    }
                    break;

                case "Chord":
                    popOutChord.Pop(1.0);
                    break;

                case "Solo":
                    popOutSolo.Pop(1.0);
                    if ((halfSolo++ % 2) == 0)
                    {
                        popOutSolo2.Pop(0.8);
                    }
                    if (state == 3 || state == 6 || state == 8)
                    {
                        Color pixCol = Color.Black;
                        switch (e.Step % 4)
                        {
                        case 0:
                            pixCol = Color.Red;
                            break;

                        case 1:
                            pixCol = Color.Yellow;
                            break;

                        case 2:
                            pixCol = Color.Blue;
                            break;

                        case 3:
                            pixCol = Color.Pink;
                            break;
                        }
                        allPixels.Inject(pixCol, 1.0);
                    }
                    break;

                case "Choir":
                    popOutChoir.Pop(1.0);
                    break;

                case "Voice":
                    popOutVoice.Pop(1.0);
                    break;

                case "Vocal2":
                    popOutVocal2.Pop(1.0);
                    break;

                case "Long":
                    popOutVocalLong.Pop(1.0);
                    break;

                case "LongUp":
                    // TODO
                    break;

                case "Down":
                    // TODO
                    break;

                case "End":
                    EverythingOff();
                    popOutEnd.Pop(1.0);
                    break;

                default:
                    this.log.Information("Unhandled code: " + e.Code);
                    break;
                }
            };

            audioPlayer = new Physical.NetworkAudioPlayer(
                settings["NetworkAudioPlayerIP"],
                int.Parse(settings["NetworkAudioPlayerPort"]));
        }
Esempio n. 17
0
        public override void Start()
        {
            var explosion = new Controller.Sequence("Explosion");

            explosion.WhenExecuted
            .Execute(instance =>
            {
                audioPlayer.PlayEffect("18384__inferno__largex");
                instance.WaitFor(MS(300));
                int d = 100;
                explosion1.SetBrightness(1);
                instance.WaitFor(MS(d));
                explosion1.SetBrightness(0.5);
                explosion2.SetBrightness(1);
                instance.WaitFor(MS(d));
                explosion1.TurnOff();
                explosion2.SetBrightness(0.5);
                explosion3.SetBrightness(1);
                instance.WaitFor(MS(d));
                explosion2.TurnOff();
                explosion3.SetBrightness(0.5);
                explosion4.SetBrightness(1);
                instance.WaitFor(MS(d));
                explosion3.TurnOff();
                explosion4.SetBrightness(0.5);
                instance.WaitFor(MS(d));
                explosion4.TurnOff();
            });

            var seq = new Controller.Sequence("Seq");

            seq.WhenExecuted
            .Execute(instance =>
            {
                //                    audioPlayer.PlayEffect("tie_fighter");
                //                    x.WaitFor(Seconds(2));

                audioPlayer.PlayEffect("Lazer");
                instance.WaitFor(MS(300));
                audioPlayer.PlayEffect("Lazer");

                var cb = new ColorBrightness[6];
                cb[0]  = new ColorBrightness(Color.Black, 1.0);
                cb[1]  = new ColorBrightness(Color.Red, 1.0);
                cb[2]  = new ColorBrightness(Color.Orange, 1.0);
                cb[3]  = new ColorBrightness(Color.Yellow, 1.0);
                cb[4]  = new ColorBrightness(Color.Blue, 1.0);
                cb[5]  = new ColorBrightness(Color.White, 1.0);

                for (int i = -6; i < 50; i++)
                {
                    testPixels.SetColors(i, cb);
                    instance.WaitFor(MS(10));
                }

                if (random.Next(10) > 5)
                {
                    Executor.Current.Execute(explosion);
                }
            });

            //            flickerEffect.AddDevice(candyLight);
            testButton.ActiveChanged += (sender, e) =>
            {
                if (e.NewState)
                {
                    this.log.Information("Button press!");
                    Executor.Current.Execute(seq);
                    //                    audioPlayer.PlayEffect("Lazer");
                }
                else
                {
                    this.log.Information("Button depress!");

                    //                    testPixels.SetColor(0, Color.Blue);
                }
            };
        }
Esempio n. 18
0
        public TestPiFace(IEnumerable <string> args)
        {
            raspberry.DigitalInputs[7].Connect(buttonTrigger1);
            raspberry.DigitalOutputs[7].Connect(switchTest1);

            raspberry.DigitalOutputs[0].Connect(switchRelay1);
            raspberry.DigitalOutputs[1].Connect(switchRelay2);

            raspberry.Connect(audioPlayer);

            var popSeq = new Controller.Sequence("Pop Sequence");

            popSeq.WhenExecuted
            .Execute(instance =>
            {
                //                        audioPlayer.PlayEffect("laugh");
                instance.WaitFor(TimeSpan.FromSeconds(1));
                switchTest1.SetPower(true);
                instance.WaitFor(TimeSpan.FromSeconds(5));
                switchTest1.SetPower(false);
                instance.WaitFor(TimeSpan.FromSeconds(1));
            });

            this.oscServer.RegisterAction <int>("/OnOff", (msg, data) =>
            {
                if (data.Any())
                {
                    if (data.First() != 0)
                    {
                        audioPlayer.PlayEffect("Scream");
                    }
                }
            });

            buttonPlayFX.ActiveChanged += (sender, e) =>
            {
                if (e.NewState)
                {
                    Executor.Current.Execute(popSeq);
                }
            };

            buttonPauseFX.ActiveChanged += (sender, e) =>
            {
                if (e.NewState)
                {
                    audioPlayer.PauseFX();
                }
            };

            buttonCueFX.ActiveChanged += (sender, e) =>
            {
                if (e.NewState)
                {
                    audioPlayer.CueFX("myFile");
                }
            };

            buttonResumeFX.ActiveChanged += (sender, e) =>
            {
                if (e.NewState)
                {
                    audioPlayer.ResumeFX();
                }
            };

            buttonPlayBackground.ActiveChanged += (sender, e) =>
            {
                if (e.NewState)
                {
                    audioPlayer.PlayBackground();

                    //                    switchTest1.SetPower(true);
                }
            };

            buttonPauseBackground.ActiveChanged += (sender, e) =>
            {
                if (e.NewState)
                {
                    audioPlayer.PauseBackground();

                    //                    switchTest1.SetPower(false);
                }
            };

            buttonBackgroundLowVolume.ActiveChanged += (sender, e) =>
            {
                if (e.NewState)
                {
                    audioPlayer.SetBackgroundVolume(0.5);
                }
            };

            buttonBackgroundHighVolume.ActiveChanged += (sender, e) =>
            {
                if (e.NewState)
                {
                    audioPlayer.SetBackgroundVolume(1.0);
                }
            };

            buttonBackgroundNext.ActiveChanged += (sender, e) =>
            {
                if (e.NewState)
                {
                    audioPlayer.NextBackgroundTrack();
                }
            };

            buttonTrigger1.ActiveChanged += (sender, e) =>
            {
                if (e.NewState)
                {
                    Executor.Current.Execute(popSeq);
                }
            };

            buttonTriggerRelay1.ActiveChanged += (sender, e) =>
            {
                switchRelay1.SetPower(e.NewState);
            };

            buttonTriggerRelay2.ActiveChanged += (sender, e) =>
            {
                switchRelay2.SetPower(e.NewState);
            };
        }
Esempio n. 19
0
        public XmasScene2(IEnumerable<string> args, System.Collections.Specialized.NameValueCollection settings)
        {
            hours = new OperatingHours("Hours");
            if (!args.Contains("TEST"))
            {
                hours.AddRange("5:00 pm", "10:00 pm");
                hours.AddRange("5:00 am", "7:00 am");
            }

            lightNetRight = new Dimmer("Net Right");
            lightGarlandRight = new Dimmer("Garland Right");
            lightHatsRight = new Dimmer("Hats Right");
            lightTreesRight = new Dimmer("Trees Right");
            lightReindeers = new Dimmer("Reindeers");
            lightIcicles = new Dimmer("Icicles");
            lightNetLeft = new Dimmer("Net Left");
            lightTree = new Dimmer("Tree");
            lightGarlandLeft = new Dimmer("Garland Left");
            lightUnused1 = new Dimmer("Unused 1");
            lightUnused2 = new Dimmer("Unused 2");
            lightJesus = new StrobeColorDimmer("Jesus");
            lightCeiling1 = new StrobeColorDimmer("Ceiling 1");
            lightCeiling2 = new StrobeColorDimmer("Ceiling 2");
            lightCeiling3 = new StrobeColorDimmer("Ceiling 3");
            lightVader = new StrobeColorDimmer("Vader");
            buttonLightRed = new Switch("Button Red");
            buttonLightBlue = new Switch("Button Blue");
            elLightsaber = new Switch("Lightsaber");
            elJesus = new Switch("Jesus Halo");
            bigReindeer = new Switch("Big Reindeer");

            buttonBlue = new DigitalInput("Button Blue");
            buttonRed = new DigitalInput("Button Red");
            buttonStartReindeer = new DigitalInput("Start Reindeer");

            timeline = new Controller.Timeline<string>(1);
            stateMachine = new Controller.EnumStateMachine<States>("Main");
            candyCane = new Controller.Sequence("Candy Cane");
            starwarsCane = new Controller.Sequence("Starwars Cane");
            backgroundLoop = new Controller.Sequence("Background");
            musicSeq = new Controller.Sequence("Christmas Canon");
            buttonSeq = new Controller.Sequence("Buttons");
            fatherSeq = new Controller.Sequence("Father");
            breathSeq = new Controller.Sequence("Breath");
            laserSeq = new Controller.Sequence("Laser");

            allPixels = new VirtualPixel1D(100);

            pulsatingEffect1 = new Effect.Pulsating(S(2), 0.3, 1.0, false);
            pulsatingEffect2 = new Effect.Pulsating(S(2), 0.3, 1.0, false);

            popOutPiano = new Effect.PopOut(S(0.4));
            popOutDrums = new Effect.PopOut(S(0.4));
            popOutDrumsFast = new Effect.PopOut(S(0.3));
            popOutChord = new Effect.PopOut(S(0.4));
            popOutSolo = new Effect.PopOut(S(0.3));
            popOutSolo2 = new Effect.PopOut(S(0.2));
            popOutChoir = new Effect.PopOut(S(1.0));
            popOutVoice = new Effect.PopOut(S(1.0));
            popOutVocal2 = new Effect.PopOut(S(2.0));
            popOutVocalLong = new Effect.PopOut(S(5.0));
            popOutEnd = new Effect.PopOut(S(5.0));

            popOutPiano
                .AddDevice(lightIcicles);

            popOutDrums
                .AddDevice(lightReindeers)
                .AddDevice(lightHatsRight);

            popOutDrumsFast
                .AddDevice(lightCeiling1)
                .AddDevice(allPixels);

            popOutChord
                .AddDevice(lightTree)
                .AddDevice(lightCeiling2)
                .AddDevice(lightCeiling3);

            popOutSolo
                .AddDevice(lightNetLeft)
                .AddDevice(lightNetRight)
                .AddDevice(lightCeiling1)
                .AddDevice(lightCeiling3)
                .SetPriority(2);

            popOutSolo2
                .AddDevice(lightCeiling1)
                .AddDevice(lightCeiling3)
                .SetPriority(2);

            popOutChoir
                .AddDevice(lightGarlandRight)
                .AddDevice(lightTreesRight)
                .AddDevice(lightCeiling1);

            popOutVoice
                .AddDevice(lightGarlandLeft)
                .AddDevice(lightCeiling3);

            popOutVocal2
                .AddDevice(lightReindeers)
                .AddDevice(allPixels)
                .SetPriority(10);

            popOutVocalLong
                .AddDevice(lightNetRight)
                .AddDevice(lightGarlandRight)
                .AddDevice(lightHatsRight)
                .SetPriority(10);

            popOutEnd
                .AddDevice(lightIcicles)
                .AddDevice(lightReindeers)
                .AddDevice(lightHatsRight)
                .AddDevice(lightCeiling1)
                .AddDevice(lightCeiling2)
                .AddDevice(lightCeiling3)
                .AddDevice(lightGarlandRight)
                .AddDevice(lightGarlandLeft)
                .AddDevice(lightTreesRight)
                .AddDevice(lightNetRight)
                .AddDevice(lightNetLeft)
                .AddDevice(allPixels)
                .SetPriority(100);

            timeline.AddMs(0, "INIT");
            timeline.PopulateFromCSV("Christmas Canon Rock All Labels.csv");
            int state = 0;
            int halfSolo = 0;

            timeline.TimelineTrigger += (sender, e) =>
                {
                    switch (e.Step)
                    {
                        case 62:
                            // First drum
                            state = 1;
                            allPixels.TurnOff();
                            break;

                        case 69:
                            state = 2;
                            lightCeiling2.SetOnlyColor(Color.Green);
                            lightCeiling3.SetOnlyColor(Color.Blue);
                            break;

                        case 136:
                            // First solo
                            state = 3;
                            allPixels.TurnOff();
                            lightCeiling2.SetOnlyColor(Color.White);
                            lightCeiling3.SetOnlyColor(Color.Red);
                            break;

                        case 265:
                            // First choir
                            allPixels.TurnOff();
                            state = 4;
                            break;

                        case 396:
                            // Vocal 2
                            state = 5;
                            allPixels.SetAllOnlyColor(Color.Blue);
                            break;

                        case 497:
                            // Second solo
                            state = 6;
                            allPixels.TurnOff();
                            lightCeiling2.SetOnlyColor(Color.White);
                            lightCeiling3.SetOnlyColor(Color.Red);
                            break;

                        case 561:
                            // End second solo
                            state = 7;
                            allPixels.TurnOff();
                            break;

                        case 585:
                            // End third solo
                            state = 8;
                            allPixels.TurnOff();
                            break;

                        case 721:
                            // End third solo
                            state = 9;
                            allPixels.TurnOff();
                            break;
                    }

                    switch (e.Code)
                    {
                        case "INIT":
                            state = 0;
                            halfSolo = 0;
                            lightCeiling1.SetColor(Color.White, 0);
                            lightCeiling2.SetColor(Color.Blue, 0);
                            lightCeiling3.SetColor(Color.Red, 0);
                            break;

                        case "N1":
                            popOutPiano.Pop(0.4);
                            if (state == 0)
                                allPixels.Inject(Color.Red, 0.5);
                            break;

                        case "N2":
                            popOutPiano.Pop(0.6);
                            if (state == 0)
                                allPixels.Inject(Color.White, 0.5);
                            break;

                        case "N3":
                            popOutPiano.Pop(0.8);
                            if (state == 0)
                                allPixels.Inject(Color.Blue, 0.5);
                            break;

                        case "N4":
                            popOutPiano.Pop(1.0);
                            if (state == 0)
                                allPixels.Inject(Color.Black, 0.0);
                            break;

                        case "Base":
                            popOutDrums.Pop(1.0);
                            if (state < 3)
                            {
                                allPixels.SetAllOnlyColor(Color.Purple);
                                popOutDrumsFast.Pop(1.0);
                            }
                            break;

                        case "Cymbal":
                            popOutDrums.Pop(1.0);
                            if (state < 3)
                            {
                                allPixels.SetAllOnlyColor(Color.Green);
                                popOutDrumsFast.Pop(1.0);
                            }
                            break;

                        case "Chord":
                            popOutChord.Pop(1.0);
                            break;

                        case "Solo":
                            popOutSolo.Pop(1.0);
                            if ((halfSolo++ % 2) == 0)
                                popOutSolo2.Pop(0.8);
                            if (state == 3 || state == 6 || state == 8)
                            {
                                Color pixCol = Color.Black;
                                switch (e.Step % 4)
                                {
                                    case 0:
                                        pixCol = Color.Red;
                                        break;
                                    case 1:
                                        pixCol = Color.Yellow;
                                        break;
                                    case 2:
                                        pixCol = Color.Blue;
                                        break;
                                    case 3:
                                        pixCol = Color.Pink;
                                        break;
                                }
                                allPixels.Inject(pixCol, 1.0);
                            }
                            break;

                        case "Choir":
                            popOutChoir.Pop(1.0);
                            break;

                        case "Voice":
                            popOutVoice.Pop(1.0);
                            break;

                        case "Vocal2":
                            popOutVocal2.Pop(1.0);
                            break;

                        case "Long":
                            popOutVocalLong.Pop(1.0);
                            break;

                        case "LongUp":
                            // TODO
                            break;

                        case "Down":
                            // TODO
                            break;

                        case "End":
                            EverythingOff();
                            popOutEnd.Pop(1.0);
                            break;

                        default:
                            log.Info("Unhandled code: " + e.Code);
                            break;
                    }
                };

            audioPlayer = new Physical.NetworkAudioPlayer(
                settings["NetworkAudioPlayerIP"],
                int.Parse(settings["NetworkAudioPlayerPort"]));
        }
Esempio n. 20
0
        public Xmas2013scene(IEnumerable <string> args)
        {
            hours = new OperatingHours("Hours");

            timeline1     = new Controller.Timeline <string>(1);
            stateMachine  = new Controller.EnumStateMachine <States>("Main");
            hatLightState = new Controller.IntStateMachine("Hats");
            lightJesus    = new StrobeColorDimmer("Jesus");
            lightStar     = new Dimmer("Star");
            lightHat1     = new Dimmer("Hat 1");
            lightHat2     = new Dimmer("Hat 2");
            lightHat3     = new Dimmer("Hat 3");
            lightHat4     = new Dimmer("Hat 4");
            lightSnow1    = new Dimmer("Snow 1");
            lightSnow2    = new Dimmer("Snow 2");
            lightStairs1  = new Dimmer("Stair 1");
            lightStairs2  = new Dimmer("Stairs 2");
            lightGarland1 = new Dimmer("Garland 1");
            lightGarland2 = new Dimmer("Garland 2");
            lightGarland3 = new Dimmer("Garland 3");
            lightGarland4 = new Dimmer("Garland 4");
            lightString1  = new Dimmer("String 1");
            lightString2  = new Dimmer("String 1");
            lightXmasTree = new Dimmer("Xmas Tree");

            lightDeerLarge   = new Dimmer("Deer Large");
            lightDeerSmall   = new Dimmer("Deer Small");
            lightTreeUp      = new StrobeColorDimmer("Tree up");
            switchSanta      = new Switch("Santa");
            switchDeerHuge   = new Switch("Deer Huge");
            lightTopperSmall = new Dimmer("Topper Small");
            lightTopperLarge = new Dimmer("Topper Large");
            lightNet1        = new Dimmer("Net 1");
            lightNet2        = new Dimmer("Net 2");
            lightVader       = new StrobeColorDimmer("Vader");
            light3wise       = new StrobeColorDimmer("3wise");

            pulsatingEffect1 = new Effect.Pulsating(S(4), 0.4, 1.0, false);
            pulsatingStar    = new Effect.Pulsating(S(2), 0.2, 0.4, false);
            flickerEffect    = new Effect.Flicker(0.5, 0.6, false);
            faderIn          = new Effect.Fader(S(2), 0.0, 1.0, false);

            candyCane      = new Controller.Sequence("Candy Cane");
            twinkleSeq     = new Controller.Sequence("Twinkle");
            backgroundLoop = new Controller.Sequence("Background");
            music1Seq      = new Controller.Sequence("Christmas Canon");
            starwarsCane   = new Controller.Sequence("Starwars Cane");
            fatherSeq      = new Controller.Sequence("Father");
            offHours1Seq   = new Controller.Sequence("Off hours 1");
            offHours2Seq   = new Controller.Sequence("Off hours 2");
            waveformSeq    = new Controller.Sequence("Waveform");

            allPixels      = new VirtualPixel1D(100);
            starwarsPixels = new VirtualPixel1D(50);
            saberPixels    = new VirtualPixel1D(60);

            buttonTest             = new DigitalInput("Test");
            buttonStartInflatables = new DigitalInput("Inflatables");
            buttonOverrideHours    = new DigitalInput("Override hours", true);

            buttonBlue       = new DigitalInput("Blue");
            buttonRed        = new DigitalInput("Red");
            switchButtonBlue = new Switch("Blue");
            switchButtonRed  = new Switch("Red");
            elJesus          = new Switch("Jesus Halo");
            audioPlayer      = new AudioPlayer("Audio");

            popOut1Piano     = new Effect.PopOut(S(0.4));
            popOut1Drums     = new Effect.PopOut(S(0.4));
            popOut1DrumsFast = new Effect.PopOut(S(0.3));
            popOut1Chord     = new Effect.PopOut(S(0.4));
            popOut1Solo      = new Effect.PopOut(S(0.3));
            popOut1Solo2     = new Effect.PopOut(S(0.2));
            popOut1Choir     = new Effect.PopOut(S(1.0));
            popOut1Voice     = new Effect.PopOut(S(1.0));
            popOut1Vocal2    = new Effect.PopOut(S(2.0));
            popOut1VocalLong = new Effect.PopOut(S(5.0));
            popOut1End       = new Effect.PopOut(S(5.0));

            this.oscServer = new Expander.OscServer(10000);

            raspberry.DigitalInputs[4].Connect(buttonRed);
            raspberry.DigitalInputs[5].Connect(buttonBlue);
            raspberry.DigitalOutputs[0].Connect(switchButtonBlue);
            raspberry.DigitalOutputs[1].Connect(switchButtonRed);
            raspberry.DigitalOutputs[2].Connect(elJesus);

            raspberry.Connect(audioPlayer);
        }
Esempio n. 21
0
        public override void Start()
        {
            var popSeq = new Controller.Sequence("Pop Sequence");
            popSeq.WhenExecuted
                .Execute(instance =>
                    {
                        instance.WaitFor(TimeSpan.FromSeconds(1));
                        audioPlayer.PlayEffect("myprecious");
                        instance.WaitFor(TimeSpan.FromSeconds(0.4));
                        switchHead.SetPower(true);
                        switchHand.SetPower(true);
                        instance.WaitFor(TimeSpan.FromSeconds(4));
                        switchHead.SetPower(false);
                        switchHand.SetPower(false);

                        instance.WaitFor(TimeSpan.FromSeconds(2));
                        switchDrawer1.SetPower(true);
                        switchHead.SetPower(true);
                        instance.WaitFor(TimeSpan.FromSeconds(0.5));
                        audioPlayer.PlayEffect("my_pretty");
                        instance.WaitFor(TimeSpan.FromSeconds(4));
                        switchDrawer2.SetPower(true);
                        instance.WaitFor(TimeSpan.FromSeconds(2));
                        switchDrawer1.SetPower(false);
                        instance.WaitFor(TimeSpan.FromSeconds(0.15));
                        switchDrawer2.SetPower(false);
                        instance.WaitFor(TimeSpan.FromSeconds(1));

                        switchHead.SetPower(false);
                        instance.WaitFor(TimeSpan.FromSeconds(1));
                    });

            buttonRunSequence.ActiveChanged += (sender, e) =>
            {
                if (e.NewState)
                {
                    Executor.Current.Execute(popSeq);
                }
            };

            buttonTestSound.ActiveChanged += (sender, e) =>
                {
                    if (e.NewState)
                    {
                        audioPlayer.PlayEffect("15 Cat Growl 2", 1.0, 1.0);
            //                        System.Threading.Thread.Sleep(3000);
            //                        audioPlayer.PlayEffect("laugh", 0.0, 1.0);
                    }
                };

            buttonTestHand.ActiveChanged += (sender, e) =>
                {
                    switchHand.SetPower(e.NewState);
                };

            buttonTestHead.ActiveChanged += (sender, e) =>
            {
                switchHead.SetPower(e.NewState);
            };

            buttonTestDrawer1.ActiveChanged += (sender, e) =>
            {
                switchDrawer1.SetPower(e.NewState);
            };

            buttonTestDrawer2.ActiveChanged += (sender, e) =>
            {
                switchDrawer2.SetPower(e.NewState);
            };

            buttonTestPopEyes.ActiveChanged += (sender, e) =>
            {
                switchPopEyes.SetPower(e.NewState);
            };

            buttonTestPopUp.ActiveChanged += (sender, e) =>
            {
                switchPopUp.SetPower(e.NewState);
            };
        }
Esempio n. 22
0
        public override void Start()
        {
            hoursSmall.AddRange("5:00 pm", "9:00 pm");
            hoursFull.AddRange("5:00 pm", "9:00 pm");
            //hoursFull.SetForced(true);
            //hoursSmall.SetForced(true);
            //hoursFull.SetForced(false);
            //hoursSmall.SetForced(false);

#if !true
            hoursFull.SetForced(true);

            audioBeauty.SetSilent(true);
            audioCat.SetSilent(true);
            audioGeorge.SetSilent(true);
            audioSpider.SetSilent(true);
            georgeMotor.SetDisabled(true);
#endif
            var backgroundSeq = new Controller.Sequence("BG Sequence");
            backgroundSeq.WhenExecuted
                .SetUp(() =>
                    {
                        audioGeorge.PlayBackground();
                        lightFloor.SetOnlyColor(Color.Orange);
                        pulsatingEffect1.Start();
                        flickerEffect.Start();
                    })
                .Execute(instance =>
                    {
                        while (!instance.IsCancellationRequested)
                        {
                            instance.WaitFor(S(1));
                            if (!this.lastFogRun.HasValue || (DateTime.Now - this.lastFogRun.Value).TotalMinutes > 10)
                            {
                                // Run the fog for a little while
                                switchFog.SetPower(true);
                                instance.WaitFor(S(4));
                                switchFog.SetPower(false);
                                this.lastFogRun = DateTime.Now;
                            }
                        }
                    })
                .TearDown(() =>
                    {
                        audioGeorge.PauseBackground();
                        pulsatingEffect1.Stop();
                        flickerEffect.Stop();
                    });

            var deadendSeq = new Controller.Sequence("Deadend dr");
            deadendSeq.WhenExecuted
                .Execute(instance =>
                    {
                        switchDeadendDrive.SetPower(true);
                        Thread.Sleep(1000);
                        switchDeadendDrive.SetPower(false);
                    });

            var stairSeq = new Controller.Sequence("Stair Sequence");
            stairSeq.WhenExecuted
                .SetUp(() =>
                    {
                    })
                .Execute(instance =>
                    {
                        switchFog.SetPower(true);
                        this.lastFogRun = DateTime.Now;
                        Executor.Current.Execute(deadendSeq);
                        audioGeorge.PlayEffect("ghostly");
                        instance.WaitFor(S(0.5));
                        popOutEffect.Pop(1.0);

                        instance.WaitFor(S(1.0));
                        audioSpider.PlayNewEffect("348 Spider Hiss");
                        switchSpider.SetPower(true);
                        instance.WaitFor(S(0.5));
                        switchSpiderEyes1.SetPower(true);
                        instance.WaitFor(S(2));
                        switchSpider.SetPower(false);
                        switchSpiderEyes1.SetPower(false);
                        instance.WaitFor(S(4));
                        stateMachine.NextState();
                    })
                .TearDown(() =>
                    {
                        switchFog.SetPower(false);
                        audioGeorge.PauseFX();
                    });

            var georgeReturnSeq = new Controller.Sequence("George Return Seq");
            georgeReturnSeq.WhenExecuted
                .Execute(instance =>
                    {
                        georgeMotor.WaitForVectorReached();
                        georgeMotor.SetVector(0.9, 0, S(15));
                        georgeMotor.WaitForVectorReached();
                    });

            var georgeSeq = new Controller.Sequence("George Sequence");
            georgeSeq.WhenExecuted
                .Execute(instance =>
                {
                    //Exec.WaitUntilFinished(georgeReturnSeq);
                        
                    audioGeorge.PlayEffect("laugh");
                    georgeMotor.SetVector(1.0, 350, S(10));
                    instance.WaitFor(TimeSpan.FromSeconds(0.8));
                    lightGeorge.SetColor(Color.Red);
                    georgeMotor.WaitForVectorReached(instance);
                    instance.WaitFor(TimeSpan.FromSeconds(2));
                    georgeMotor.SetVector(0.9, 0, S(15));
                    lightGeorge.RunEffect(new Effect2.Fader(1.0, 0.0), S(1.0));
                    instance.WaitFor(TimeSpan.FromSeconds(1));
                    lightFloor.SetOnlyColor(Color.Green);
                    pulsatingEffect1.Start();
                    georgeMotor.WaitForVectorReached(instance);

                    instance.WaitFor(S(15));
                })
                .TearDown(() =>
                {
                    Exec.Execute(georgeReturnSeq);
                    pulsatingEffect1.Stop();
                    lightGeorge.TurnOff();
                });

            var spiderEyes2Seq = new Controller.Sequence("Spider Eyes 2");
            spiderEyes2Seq.WhenExecuted
                .Execute(instance =>
                    {
                        var rnd = new Random();
                        while (!instance.IsCancellationRequested)
                        {
                            switchSpiderEyes2.SetPower(true);
                            instance.WaitFor(S(1.0 + rnd.Next(10)));
                            switchSpiderEyes2.SetPower(false);
                            instance.WaitFor(S(1.0 + rnd.Next(2)));
                        }
                    });

            var popupSeq = new Controller.Sequence("Popup Sequence");
            popupSeq.WhenExecuted
                .Execute(instance =>
                    {
                        audioBeauty.PlayEffect("scream", 0.0, 1.0);
                        switchPopEyes.SetPower(true);
                        instance.WaitFor(TimeSpan.FromSeconds(1.0));
                        lightPopup.SetBrightness(1.0);
                        switchPopUp.SetPower(true);

                        instance.WaitFor(S(3));

                        lightPopup.RunEffect(new Effect2.Fader(1.0, 0.0), S(1.0));
                        switchPopEyes.TurnOff();
                        switchPopUp.TurnOff();
                    });

            var beautySeq = new Controller.Sequence("Beauty Sequence");
            beautySeq.WhenExecuted
                .Execute(instance =>
                {
                    flickerEffect2.Stop();
                    lightBeauty.SetColor(Color.Purple);
                    switchHand.SetPower(true);
                    instance.WaitFor(TimeSpan.FromSeconds(1));
                    audioBeauty.PlayEffect("gollum_precious1", 1.0, 0.0);
                    instance.WaitFor(TimeSpan.FromSeconds(0.4));
                    switchHead.SetPower(true);
                    instance.WaitFor(TimeSpan.FromSeconds(6));
                    switchHead.SetPower(false);
                    switchHand.SetPower(false);

                    instance.WaitFor(TimeSpan.FromSeconds(1.5));
                    lightBeauty.TurnOff();
                    instance.WaitFor(TimeSpan.FromSeconds(0.5));
                    switchDrawer1.SetPower(true);
                    switchHead.SetPower(true);
                    instance.WaitFor(TimeSpan.FromSeconds(0.5));
                    lightBeauty.SetColor(Color.Red, 1.0);
                    audioBeauty.PlayEffect("my_pretty", 1.0, 0.0);
                    instance.WaitFor(TimeSpan.FromSeconds(4));
                    switchDrawer2.SetPower(true);
                    instance.WaitFor(TimeSpan.FromSeconds(2));
                    switchDrawer1.SetPower(false);
                    instance.WaitFor(TimeSpan.FromSeconds(0.15));
                    switchDrawer2.SetPower(false);
                    instance.WaitFor(TimeSpan.FromSeconds(1));

                    switchHead.SetPower(false);
                    lightBeauty.RunEffect(new Effect2.Fader(1.0, 0.0), S(1.0));
                    if (hoursSmall.IsOpen)
                        flickerEffect2.Start();
                    instance.WaitFor(TimeSpan.FromSeconds(5));
                });


            var catSeq = new Controller.Sequence("Cat Sequence");
            catSeq.WhenExecuted
                .Execute(instance =>
                    {
                        var maxRuntime = System.Diagnostics.Stopwatch.StartNew();

                        var random = new Random();

                        catLights.SetPower(true);

                        while (true)
                        {
                            switch (random.Next(4))
                            {
                                case 0:
                                    audioCat.PlayEffect("266 Monster Growl 7", 1.0, 1.0);
                                    instance.WaitFor(TimeSpan.FromSeconds(2.0));
                                    break;
                                case 1:
                                    audioCat.PlayEffect("285 Monster Snarl 2", 1.0, 1.0);
                                    instance.WaitFor(TimeSpan.FromSeconds(3.0));
                                    break;
                                case 2:
                                    audioCat.PlayEffect("286 Monster Snarl 3", 1.0, 1.0);
                                    instance.WaitFor(TimeSpan.FromSeconds(2.5));
                                    break;
                                case 3:
                                    audioCat.PlayEffect("287 Monster Snarl 4", 1.0, 1.0);
                                    instance.WaitFor(TimeSpan.FromSeconds(1.5));
                                    break;
                                default:
                                    instance.WaitFor(TimeSpan.FromSeconds(3.0));
                                    break;
                            }

                            instance.CancelToken.ThrowIfCancellationRequested();

                            if (maxRuntime.Elapsed.TotalSeconds > 10)
                                break;
                        }
                    })
                    .TearDown(() =>
                        {
                            catLights.TurnOff();
                        });

            var candyCane = new Controller.Sequence("Candy Cane");
            candyCane
                .WhenExecuted
                .SetUp(() => allPixels.TurnOff())
                .Execute(instance =>
                {
                    var cbList = new List<ColorBrightness>();
                    //cbList.Add(new ColorBrightness(Color.Green, 1.00));
                    //cbList.Add(new ColorBrightness(Color.Green, 0.70));
                    //cbList.Add(new ColorBrightness(Color.Green, 0.40));
                    //cbList.Add(new ColorBrightness(Color.White, 1.00));
                    //cbList.Add(new ColorBrightness(Color.White, 0.70));
                    //cbList.Add(new ColorBrightness(Color.White, 0.40));
                    //cbList.Add(new ColorBrightness(Color.Red, 1.00));
                    //cbList.Add(new ColorBrightness(Color.Red, 0.70));
                    //cbList.Add(new ColorBrightness(Color.Red, 0.40));
                    //cbList.Add(new ColorBrightness(Color.Black, 0.0));
                    //cbList.Add(new ColorBrightness(Color.Black, 0.0));
                    //cbList.Add(new ColorBrightness(Color.Black, 0.0));
                    //cbList.Add(new ColorBrightness(Color.Black, 0.0));

                    double b1 = 1.00;
                    double b2 = 0.70;
                    double b3 = 0.40;
                    Color c1 = Color.Blue;
                    Color c2 = Color.Yellow;
                    Color c3 = Color.Blue;
                    Color c4 = Color.Black;

                    cbList.Add(new ColorBrightness(c1, b1));
                    cbList.Add(new ColorBrightness(c1, b2));
                    cbList.Add(new ColorBrightness(c1, b3));
                    cbList.Add(new ColorBrightness(c2, b1));
                    cbList.Add(new ColorBrightness(c2, b2));
                    cbList.Add(new ColorBrightness(c2, b3));
                    cbList.Add(new ColorBrightness(c3, b1));
                    cbList.Add(new ColorBrightness(c3, b2));
                    cbList.Add(new ColorBrightness(c3, b3));
                    cbList.Add(new ColorBrightness(c4, 0.0));
                    cbList.Add(new ColorBrightness(c4, 0.0));
                    cbList.Add(new ColorBrightness(c4, 0.0));
                    cbList.Add(new ColorBrightness(c4, 0.0));

                    b1 = 1.00;
                    b2 = 0.70;
                    b3 = 0.40;
                    c1 = Color.White;
                    c2 = Color.Blue;
                    c3 = Color.Red;
                    c4 = Color.Black;

                    cbList.Add(new ColorBrightness(c1, b1));
                    cbList.Add(new ColorBrightness(c1, b2));
                    cbList.Add(new ColorBrightness(c1, b3));
                    cbList.Add(new ColorBrightness(c2, b1));
                    cbList.Add(new ColorBrightness(c2, b2));
                    cbList.Add(new ColorBrightness(c2, b3));
                    cbList.Add(new ColorBrightness(c3, b1));
                    cbList.Add(new ColorBrightness(c3, b2));
                    cbList.Add(new ColorBrightness(c3, b3));
                    cbList.Add(new ColorBrightness(c4, 0.0));
                    cbList.Add(new ColorBrightness(c4, 0.0));
                    cbList.Add(new ColorBrightness(c4, 0.0));
                    cbList.Add(new ColorBrightness(c4, 0.0));

                    b1 = 1.00;
                    b2 = 0.70;
                    b3 = 0.40;
                    c1 = Color.Red;
                    c2 = Color.White;
                    c3 = Color.Blue;
                    c4 = Color.Black;

                    cbList.Add(new ColorBrightness(c1, b1));
                    cbList.Add(new ColorBrightness(c1, b2));
                    cbList.Add(new ColorBrightness(c1, b3));
                    cbList.Add(new ColorBrightness(c2, b1));
                    cbList.Add(new ColorBrightness(c2, b2));
                    cbList.Add(new ColorBrightness(c2, b3));
                    cbList.Add(new ColorBrightness(c3, b1));
                    cbList.Add(new ColorBrightness(c3, b2));
                    cbList.Add(new ColorBrightness(c3, b3));
                    cbList.Add(new ColorBrightness(c4, 0.0));
                    cbList.Add(new ColorBrightness(c4, 0.0));
                    cbList.Add(new ColorBrightness(c4, 0.0));
                    cbList.Add(new ColorBrightness(c4, 0.0));

                    while (true)
                    {
                        foreach (var cb in cbList)
                        {
                            allPixels.Inject(cb);
                            instance.WaitFor(S(0.350), true);
                        }
                    }
                })
                .TearDown(() =>
                {
                    allPixels.TurnOff();
                });


            stateMachine.ForFromSequence(States.Background, backgroundSeq);
            stateMachine.ForFromSequence(States.Stair, stairSeq);
            stateMachine.ForFromSequence(States.George, georgeSeq);
            stateMachine.ForFromSequence(States.Popup, popupSeq);

            hoursSmall.OpenHoursChanged += (sender, e) =>
                {
                    if (e.IsOpenNow)
                    {
                        pulsatingEffect2.Start();
                        flickerEffect.Start();
                        flickerEffect2.Start();
                        catFan.SetPower(true);
                        lightEyes.SetPower(true);
                        lightTreeGhost.SetBrightness(1.0);
                        //                        Exec.Execute(candyCane);
                        allPixels.SetAll(Color.FromArgb(255, 115, 0), 0.5);
                    }
                    else
                    {
                        pulsatingEffect2.Stop();
                        flickerEffect.Stop();
                        flickerEffect2.Stop();
                        catFan.SetPower(false);
                        lightEyes.SetPower(false);
                        lightTreeGhost.TurnOff();
                        allPixels.TurnOff();
                    }
                };

            hoursFull.OpenHoursChanged += (sender, e) =>
            {
                if (e.IsOpenNow)
                {
                    Executor.Current.Execute(spiderEyes2Seq);
                    stateMachine.SetBackgroundState(States.Background);
                    stateMachine.SetState(States.Background);
                }
                else
                {
                    Executor.Current.Cancel(spiderEyes2Seq);
                    stateMachine.Hold();
                    stateMachine.SetBackgroundState(null);
                    audioGeorge.PauseBackground();
                }
            };

            buttonMotionCat.ActiveChanged += (sender, e) =>
                {
#if CHECK_SENSOR_ALIGNMENT
                    catLights.SetPower(e.NewState);
#else
                    if (e.NewState && hoursSmall.IsOpen)
                        Executor.Current.Execute(catSeq);
#endif
                };

            buttonMotionBeauty.ActiveChanged += (sender, e) =>
                {
                    if (e.NewState && hoursFull.IsOpen)
                        Executor.Current.Execute(beautySeq);
                };

            buttonTriggerStairs.ActiveChanged += (sender, e) =>
                {
                    if (!hoursSmall.IsOpen)
                    {
                        lightFloor.SetColor(Color.Purple, e.NewState ? 0.6 : 0.0);
                    }
                    else
                    {
                        if (e.NewState && hoursFull.IsOpen)
                        {
                            if (!stateMachine.CurrentState.HasValue || stateMachine.CurrentState == States.Background)
                                stateMachine.SetState(States.Stair);
                        }
                    }
                };

            buttonTriggerPopup.ActiveChanged += (sender, e) =>
            {
                if (!hoursSmall.IsOpen)
                {
                    lightPopup.SetBrightness(e.NewState ? 0.5 : 0.0);
                }
                else
                {
                    if (e.NewState)
                    {
                        if (stateMachine.CurrentState == States.George)
                            stateMachine.SetState(States.Popup);
                    }
                }
            };

            flickerEffect.AddDevice(skullsLight);
            flickerEffect2.AddDevice(skullsLight2);
            lightFloor.SetColor(Color.Orange, 0);
            lightSign.SetColor(Color.Pink, 0);
            pulsatingEffect1.AddDevice(lightFloor);
            pulsatingEffect1.AddDevice(lightSpiderWeb);
            pulsatingEffect2.AddDevice(lightSign);

            popOutEffect.AddDevice(skullsLight);

            ForTest();
        }
Esempio n. 23
0
        public Xmas2013scene(IEnumerable<string> args)
        {
            hours = new OperatingHours("Hours");

            timeline1 = new Controller.Timeline<string>(1);
            stateMachine = new Controller.EnumStateMachine<States>("Main");
            hatLightState = new Controller.IntStateMachine("Hats");
            lightJesus = new StrobeColorDimmer("Jesus");
            lightStar = new Dimmer("Star");
            lightHat1 = new Dimmer("Hat 1");
            lightHat2 = new Dimmer("Hat 2");
            lightHat3 = new Dimmer("Hat 3");
            lightHat4 = new Dimmer("Hat 4");
            lightSnow1 = new Dimmer("Snow 1");
            lightSnow2 = new Dimmer("Snow 2");
            lightStairs1 = new Dimmer("Stair 1");
            lightStairs2 = new Dimmer("Stairs 2");
            lightGarland1 = new Dimmer("Garland 1");
            lightGarland2 = new Dimmer("Garland 2");
            lightGarland3 = new Dimmer("Garland 3");
            lightGarland4 = new Dimmer("Garland 4");
            lightString1 = new Dimmer("String 1");
            lightString2 = new Dimmer("String 1");
            lightXmasTree = new Dimmer("Xmas Tree");

            lightDeerLarge = new Dimmer("Deer Large");
            lightDeerSmall = new Dimmer("Deer Small");
            lightTreeUp = new StrobeColorDimmer("Tree up");
            switchSanta = new Switch("Santa");
            switchDeerHuge = new Switch("Deer Huge");
            lightTopperSmall = new Dimmer("Topper Small");
            lightTopperLarge = new Dimmer("Topper Large");
            lightNet1 = new Dimmer("Net 1");
            lightNet2 = new Dimmer("Net 2");
            lightVader = new StrobeColorDimmer("Vader");
            light3wise = new StrobeColorDimmer("3wise");

            pulsatingEffect1 = new Effect.Pulsating("Pulse FX 1", S(4), 0.4, 1.0, false);
            pulsatingStar = new Effect.Pulsating("Pulse Star", S(2), 0.2, 0.4, false);
            flickerEffect = new Effect.Flicker("Flicker", 0.5, 0.6, false);
            faderIn = new Effect.Fader("FaderIn", S(2), 0.0, 1.0, false);

            candyCane = new Controller.Sequence("Candy Cane");
            twinkleSeq = new Controller.Sequence("Twinkle");
            backgroundLoop = new Controller.Sequence("Background");
            music1Seq = new Controller.Sequence("Christmas Canon");
            starwarsCane = new Controller.Sequence("Starwars Cane");
            fatherSeq = new Controller.Sequence("Father");
            offHours1Seq = new Controller.Sequence("Off hours 1");
            offHours2Seq = new Controller.Sequence("Off hours 2");
            waveformSeq = new Controller.Sequence("Waveform");

            allPixels = new VirtualPixel1D("All Pixels", 100);
            starwarsPixels = new VirtualPixel1D("Star wars", 50);
            saberPixels = new VirtualPixel1D("Saber", 60);

            buttonTest = new DigitalInput("Test");
            buttonStartInflatables = new DigitalInput("Inflatables");
            buttonOverrideHours = new DigitalInput("Override hours", true);

            buttonBlue = new DigitalInput("Blue");
            buttonRed = new DigitalInput("Red");
            switchButtonBlue = new Switch("Blue");
            switchButtonRed = new Switch("Red");
            elJesus = new Switch("Jesus Halo");
            audioPlayer = new AudioPlayer("Audio");

            popOut1Piano = new Effect.PopOut("Piano", S(0.4));
            popOut1Drums = new Effect.PopOut("Drums", S(0.4));
            popOut1DrumsFast = new Effect.PopOut("Drums Fast", S(0.3));
            popOut1Chord = new Effect.PopOut("Chord", S(0.4));
            popOut1Solo = new Effect.PopOut("Solo", S(0.3));
            popOut1Solo2 = new Effect.PopOut("Solo 2", S(0.2));
            popOut1Choir = new Effect.PopOut("Choir", S(1.0));
            popOut1Voice = new Effect.PopOut("Voice", S(1.0));
            popOut1Vocal2 = new Effect.PopOut("Vocal 2", S(2.0));
            popOut1VocalLong = new Effect.PopOut("Vocal Long", S(5.0));
            popOut1End = new Effect.PopOut("End", S(5.0));

            this.oscServer = new Expander.OscServer(10000);
        }
Esempio n. 24
0
        public override void Start()
        {
            var dumpSeq = new Controller.Sequence("Pop Sequence");
            dumpSeq.WhenExecuted
                .Execute(instance =>
                    {
                        relayDirA.SetPower(true);
                        relayDirB.SetPower(false);

                        audioPlayer.PlayEffect("Countdown-sequence-5");
                        instance.WaitFor(TimeSpan.FromSeconds(7));
                        relayStart.SetPower(true);
                        instance.WaitFor(TimeSpan.FromSeconds(1.0));
                        relayStart.SetPower(false);
                        relayDirA.SetPower(false);
                        relayDirB.SetPower(false);
                    });

            var resetSeq = new Controller.Sequence("Reset Sequence");
            resetSeq.WhenExecuted
                .Execute(instance =>
                {
                    relayDirA.SetPower(false);
                    relayDirB.SetPower(true);
                    //                    relayStart.SetPower(true);
                    //                    instance.WaitFor(TimeSpan.FromSeconds(0.5));
                    //                    relayStart.SetPower(false);

                    instance.WaitFor(TimeSpan.FromSeconds(3));
                    relayDirA.SetPower(false);
                    relayDirB.SetPower(false);
                });
            this.oscServer.RegisterAction<int>("/osc/arm", (msg, data) =>
                {
                    if (data.Any())
                    {
                        if (data.First() != 0)
                            stateMachine.SetState(States.Armed);
                    }
                });

            this.oscServer.RegisterAction<int>("/osc/disarm", (msg, data) =>
            {
                if (data.Any())
                {
                    if (data.First() != 0)
                        stateMachine.SetState(States.Idle);
                }
            });

            this.oscServer.RegisterAction<int>("/osc/dump", (msg, data) =>
            {
                if (data.Any())
                {
                    if (data.First() != 0)
                    {
                        if(stateMachine.CurrentState == States.Armed)
                            stateMachine.SetState(States.Dump);
                    }
                }
            });

            this.oscServer.RegisterAction<int>("/osc/reset", (msg, data) =>
            {
                if (data.Any())
                {
                    if (data.First() != 0)
                        stateMachine.SetState(States.Reset);
                }
            });

            inputNextSong.ActiveChanged += (sender, e) =>
            {
                if (e.NewState)
                {
                    audioPlayer.NextBackgroundTrack();
                }
            };

            inputArm.ActiveChanged += (sender, e) =>
            {
                if (e.NewState)
                {
                    stateMachine.SetState(States.Armed);
                }
            };

            inputDisarm.ActiveChanged += (sender, e) =>
            {
                if (e.NewState)
                {
                    stateMachine.SetState(States.Idle);
                }
            };

            inputDump.ActiveChanged += (sender, e) =>
            {
                if (e.NewState)
                {
                    if (stateMachine.CurrentState == States.Armed)
                        stateMachine.SetState(States.Dump);
                }
            };

            inputReset.ActiveChanged += (sender, e) =>
            {
                stateMachine.SetState(States.Reset);
            };

            stateMachine.ForFromSequence(States.Dump, dumpSeq);
            stateMachine.ForFromSequence(States.Reset, resetSeq);

            lightSpot.SetColor(Color.Red, 0);
            pulsatingEffect1.AddDevice(lightSpot);

            stateMachine.SetState(States.Idle);
        }
Esempio n. 25
0
        public TestPiFace(IEnumerable<string> args)
        {
            raspberry.DigitalInputs[7].Connect(buttonTrigger1);
            raspberry.DigitalOutputs[7].Connect(switchTest1);

            raspberry.DigitalOutputs[0].Connect(switchRelay1);
            raspberry.DigitalOutputs[1].Connect(switchRelay2);

            raspberry.Connect(audioPlayer);

            var popSeq = new Controller.Sequence("Pop Sequence");
            popSeq.WhenExecuted
                .Execute(instance =>
                {
                    //                        audioPlayer.PlayEffect("laugh");
                    instance.WaitFor(TimeSpan.FromSeconds(1));
                    switchTest1.SetPower(true);
                    instance.WaitFor(TimeSpan.FromSeconds(5));
                    switchTest1.SetPower(false);
                    instance.WaitFor(TimeSpan.FromSeconds(1));
                });

            this.oscServer.RegisterAction<int>("/OnOff", (msg, data) =>
            {
                if (data.Any())
                {
                    if (data.First() != 0)
                        audioPlayer.PlayEffect("Scream");
                }
            });

            buttonPlayFX.ActiveChanged += (sender, e) =>
            {
                if (e.NewState)
                {
                    Executor.Current.Execute(popSeq);
                }
            };

            buttonPauseFX.ActiveChanged += (sender, e) =>
            {
                if (e.NewState)
                    audioPlayer.PauseFX();
            };

            buttonCueFX.ActiveChanged += (sender, e) =>
            {
                if (e.NewState)
                    audioPlayer.CueFX("myFile");
            };

            buttonResumeFX.ActiveChanged += (sender, e) =>
            {
                if (e.NewState)
                    audioPlayer.ResumeFX();
            };

            buttonPlayBackground.ActiveChanged += (sender, e) =>
            {
                if (e.NewState)
                {
                    audioPlayer.PlayBackground();

                    //                    switchTest1.SetPower(true);
                }
            };

            buttonPauseBackground.ActiveChanged += (sender, e) =>
            {
                if (e.NewState)
                {
                    audioPlayer.PauseBackground();

                    //                    switchTest1.SetPower(false);
                }
            };

            buttonBackgroundLowVolume.ActiveChanged += (sender, e) =>
            {
                if (e.NewState)
                    audioPlayer.SetBackgroundVolume(0.5);
            };

            buttonBackgroundHighVolume.ActiveChanged += (sender, e) =>
            {
                if (e.NewState)
                    audioPlayer.SetBackgroundVolume(1.0);
            };

            buttonBackgroundNext.ActiveChanged += (sender, e) =>
            {
                if (e.NewState)
                    audioPlayer.NextBackgroundTrack();
            };

            buttonTrigger1.ActiveChanged += (sender, e) =>
            {
                if (e.NewState)
                {
                    Executor.Current.Execute(popSeq);
                }
            };

            buttonTriggerRelay1.ActiveChanged += (sender, e) =>
            {
                switchRelay1.SetPower(e.NewState);
            };

            buttonTriggerRelay2.ActiveChanged += (sender, e) =>
            {
                switchRelay2.SetPower(e.NewState);
            };
        }
Esempio n. 26
0
        public override void Start()
        {
            var demoSeq = new Controller.Sequence("Demo Sequence");
            demoSeq.WhenExecuted
                .Execute(instance =>
                {
                    audioPlayer.PlayEffect("laugh");
                    switchTest1.SetPower(true);
                    light1.SetColor(Color.Orange, 1.0);
                    instance.WaitFor(TimeSpan.FromSeconds(1));
                    switchTest1.SetPower(false);
                    light1.RunEffect(new Effect2.Fader(1.0, 0.0), S(1.0));
                });

            buttonTestSound.ActiveChanged += (sender, e) =>
            {
                if (e.NewState)
                {
                    audioPlayer.PlayEffect("sixthsense-deadpeople");
                }
            };

            buttonPlayBackground.ActiveChanged += (sender, e) =>
            {
                if (e.NewState)
                {
                    audioPlayer.PlayBackground();
                }
            };

            buttonPauseBackground.ActiveChanged += (sender, e) =>
            {
                if (e.NewState)
                {
                    audioPlayer.PauseBackground();
                }
            };

            buttonTestLight1.ActiveChanged += (sender, e) =>
            {
                if (e.NewState)
                {
                    light1.SetOnlyColor(Color.White);
                    light1.RunEffect(new Effect2.Fader(0.0, 1.0), S(1.0));
                    Thread.Sleep(S(1));
                    light1.RunEffect(new Effect2.Fader(1.0, 0.0), S(1.0));
                }
            };

            buttonTestLight2.ActiveChanged += (sender, e) =>
            {
                if (e.NewState)
                {
                    pulsatingEffect1.Start();
                }
                else
                {
                    pulsatingEffect1.Stop();
                }
            };

            buttonTrigger1.ActiveChanged += (sender, e) =>
            {
                if (e.NewState)
                {
                    Executor.Current.Execute(demoSeq);
                }
            };

            pulsatingEffect1.AddDevice(light1);
        }
Esempio n. 27
0
        public override void Start()
        {
            var dumpSeq = new Controller.Sequence("Pop Sequence");

            dumpSeq.WhenExecuted
            .Execute(instance =>
            {
                relayDirA.SetPower(true);
                relayDirB.SetPower(false);

                audioPlayer.PlayEffect("Countdown-sequence-5");
                instance.WaitFor(TimeSpan.FromSeconds(7));
                relayStart.SetPower(true);
                instance.WaitFor(TimeSpan.FromSeconds(1.0));
                relayStart.SetPower(false);
                relayDirA.SetPower(false);
                relayDirB.SetPower(false);
            });

            var resetSeq = new Controller.Sequence("Reset Sequence");

            resetSeq.WhenExecuted
            .Execute(instance =>
            {
                relayDirA.SetPower(false);
                relayDirB.SetPower(true);
                //                    relayStart.SetPower(true);
                //                    instance.WaitFor(TimeSpan.FromSeconds(0.5));
                //                    relayStart.SetPower(false);

                instance.WaitFor(TimeSpan.FromSeconds(3));
                relayDirA.SetPower(false);
                relayDirB.SetPower(false);
            });
            this.oscServer.RegisterAction <int>("/osc/arm", (msg, data) =>
            {
                if (data.Any())
                {
                    if (data.First() != 0)
                    {
                        stateMachine.SetState(States.Armed);
                    }
                }
            });

            this.oscServer.RegisterAction <int>("/osc/disarm", (msg, data) =>
            {
                if (data.Any())
                {
                    if (data.First() != 0)
                    {
                        stateMachine.SetState(States.Idle);
                    }
                }
            });

            this.oscServer.RegisterAction <int>("/osc/dump", (msg, data) =>
            {
                if (data.Any())
                {
                    if (data.First() != 0)
                    {
                        if (stateMachine.CurrentState == States.Armed)
                        {
                            stateMachine.SetState(States.Dump);
                        }
                    }
                }
            });

            this.oscServer.RegisterAction <int>("/osc/reset", (msg, data) =>
            {
                if (data.Any())
                {
                    if (data.First() != 0)
                    {
                        stateMachine.SetState(States.Reset);
                    }
                }
            });

            inputNextSong.ActiveChanged += (sender, e) =>
            {
                if (e.NewState)
                {
                    audioPlayer.NextBackgroundTrack();
                }
            };

            inputArm.ActiveChanged += (sender, e) =>
            {
                if (e.NewState)
                {
                    stateMachine.SetState(States.Armed);
                }
            };

            inputDisarm.ActiveChanged += (sender, e) =>
            {
                if (e.NewState)
                {
                    stateMachine.SetState(States.Idle);
                }
            };

            inputDump.ActiveChanged += (sender, e) =>
            {
                if (e.NewState)
                {
                    if (stateMachine.CurrentState == States.Armed)
                    {
                        stateMachine.SetState(States.Dump);
                    }
                }
            };

            inputReset.ActiveChanged += (sender, e) =>
            {
                stateMachine.SetState(States.Reset);
            };

            stateMachine.ForFromSequence(States.Dump, dumpSeq);
            stateMachine.ForFromSequence(States.Reset, resetSeq);

            lightSpot.SetColor(Color.Red, 0);
            pulsatingEffect1.AddDevice(lightSpot);

            stateMachine.SetState(States.Idle);
        }
Esempio n. 28
0
        public IntStateMachine ForFromSequence(int state, Sequence sequence)
        {
            var seqJob = (sequence.WhenExecuted as Sequence.SequenceJob);
            this.stateConfigs[state] = seqJob;

            if (state > length - 1)
                length = state + 1;

            return this;
        }
Esempio n. 29
0
        public override void Start()
        {
            var popSeq = new Controller.Sequence("Pop Sequence");
            popSeq.WhenExecuted
                .Execute(instance =>
                    {
            //                        audioPlayer.PlayEffect("laugh");
                        instance.WaitFor(TimeSpan.FromSeconds(1));
                        switchTest1.SetPower(true);
                        instance.WaitFor(TimeSpan.FromSeconds(5));
                        switchTest1.SetPower(false);
                        instance.WaitFor(TimeSpan.FromSeconds(1));
                    });

            this.oscServer.RegisterAction<int>("/OnOff", (msg, data) =>
                {
                    if (data.Any())
                    {
                        if (data.First() != 0)
                            audioPlayer.PlayEffect("Scream");
                    }
                });

            buttonPlayFX.ActiveChanged += (sender, e) =>
            {
                if (e.NewState)
                {
                    Executor.Current.Execute(popSeq);
                }
            };

            buttonPauseFX.ActiveChanged += (sender, e) =>
                {
                    if (e.NewState)
                        audioPlayer.PauseFX();
                };

            buttonCueFX.ActiveChanged += (sender, e) =>
            {
                if (e.NewState)
                    audioPlayer.CueFX("myFile");
            };

            buttonResumeFX.ActiveChanged += (sender, e) =>
            {
                if (e.NewState)
                    audioPlayer.ResumeFX();
            };

            buttonPlayBackground.ActiveChanged += (sender, e) =>
            {
                if (e.NewState)
                {
                    audioPlayer.PlayBackground();

            //                    switchTest1.SetPower(true);
                }
            };

            buttonPauseBackground.ActiveChanged += (sender, e) =>
            {
                if (e.NewState)
                {
                    audioPlayer.PauseBackground();

            //                    switchTest1.SetPower(false);
                }
            };

            buttonBackgroundLowVolume.ActiveChanged += (sender, e) =>
            {
                if (e.NewState)
                    audioPlayer.SetBackgroundVolume(0.5);
            };

            buttonBackgroundHighVolume.ActiveChanged += (sender, e) =>
            {
                if (e.NewState)
                    audioPlayer.SetBackgroundVolume(1.0);
            };

            buttonBackgroundNext.ActiveChanged += (sender, e) =>
            {
                if (e.NewState)
                    audioPlayer.NextBackgroundTrack();
            };

            buttonTrigger1.ActiveChanged += (sender, e) =>
            {
                if (e.NewState)
                {
                    Executor.Current.Execute(popSeq);
                }
            };
        }
        public override void Start()
        {
            var popSeq = new Controller.Sequence("Pop Sequence");

            popSeq.WhenExecuted
            .Execute(instance =>
            {
                instance.WaitFor(TimeSpan.FromSeconds(1));
                audioPlayer.PlayEffect("myprecious");
                instance.WaitFor(TimeSpan.FromSeconds(0.4));
                switchHead.SetPower(true);
                switchHand.SetPower(true);
                instance.WaitFor(TimeSpan.FromSeconds(4));
                switchHead.SetPower(false);
                switchHand.SetPower(false);

                instance.WaitFor(TimeSpan.FromSeconds(2));
                switchDrawer1.SetPower(true);
                switchHead.SetPower(true);
                instance.WaitFor(TimeSpan.FromSeconds(0.5));
                audioPlayer.PlayEffect("my_pretty");
                instance.WaitFor(TimeSpan.FromSeconds(4));
                switchDrawer2.SetPower(true);
                instance.WaitFor(TimeSpan.FromSeconds(2));
                switchDrawer1.SetPower(false);
                instance.WaitFor(TimeSpan.FromSeconds(0.15));
                switchDrawer2.SetPower(false);
                instance.WaitFor(TimeSpan.FromSeconds(1));

                switchHead.SetPower(false);
                instance.WaitFor(TimeSpan.FromSeconds(1));
            });

            buttonRunSequence.ActiveChanged += (sender, e) =>
            {
                if (e.NewState)
                {
                    Executor.Current.Execute(popSeq);
                }
            };

            buttonTestSound.ActiveChanged += (sender, e) =>
            {
                if (e.NewState)
                {
                    audioPlayer.PlayEffect("15 Cat Growl 2", 1.0, 1.0);
//                        System.Threading.Thread.Sleep(3000);
//                        audioPlayer.PlayEffect("laugh", 0.0, 1.0);
                }
            };

            buttonTestHand.ActiveChanged += (sender, e) =>
            {
                switchHand.SetPower(e.NewState);
            };

            buttonTestHead.ActiveChanged += (sender, e) =>
            {
                switchHead.SetPower(e.NewState);
            };

            buttonTestDrawer1.ActiveChanged += (sender, e) =>
            {
                switchDrawer1.SetPower(e.NewState);
            };

            buttonTestDrawer2.ActiveChanged += (sender, e) =>
            {
                switchDrawer2.SetPower(e.NewState);
            };

            buttonTestPopEyes.ActiveChanged += (sender, e) =>
            {
                switchPopEyes.SetPower(e.NewState);
            };

            buttonTestPopUp.ActiveChanged += (sender, e) =>
            {
                switchPopUp.SetPower(e.NewState);
            };
        }