Connect() public method

public Connect ( LogicalDevice logicalDevice ) : Raspberry
logicalDevice LogicalDevice
return Raspberry
コード例 #1
0
        public HalloweenScene2013(IEnumerable <string> args)
        {
            buttonTestHand    = new DigitalInput("Hand");
            buttonTestHead    = new DigitalInput("Head");
            buttonTestDrawer1 = new DigitalInput("Drawer 1");
            buttonTestDrawer2 = new DigitalInput("Drawer 2");
            buttonRunSequence = new DigitalInput("Run Seq!");
            buttonTestSound   = new DigitalInput("Test Sound");
            buttonTestPopEyes = new DigitalInput("Pop Eyes");
            buttonTestPopUp   = new DigitalInput("Pop Up");

            switchHand    = new Switch("Hand");
            switchHead    = new Switch("Head");
            switchDrawer1 = new Switch("Drawer 1");
            switchDrawer2 = new Switch("Drawer 2");
            switchPopEyes = new Switch("Pop Eyes");
            switchPopUp   = new Switch("Pop Up");

            audioPlayer = new AudioPlayer("Audio Player");

            raspberry.DigitalInputs[0].Connect(buttonTestHand);
            raspberry.DigitalInputs[1].Connect(buttonTestHead);
            raspberry.DigitalInputs[2].Connect(buttonTestDrawer1);
            raspberry.DigitalInputs[3].Connect(buttonTestDrawer2);
            raspberry.DigitalInputs[7].Connect(buttonRunSequence);
            raspberry.DigitalOutputs[7].Connect(switchHand);
            raspberry.DigitalOutputs[2].Connect(switchHead);
            raspberry.DigitalOutputs[5].Connect(switchDrawer1);
            raspberry.DigitalOutputs[6].Connect(switchDrawer2);
            raspberry.DigitalOutputs[3].Connect(switchPopEyes);
            raspberry.DigitalOutputs[4].Connect(switchPopUp);

            raspberry.Connect(audioPlayer);
        }
コード例 #2
0
        public void WireUp1(Expander.Raspberry port)
        {
            port.DigitalOutputs[7].Connect(relayDirA);
            port.DigitalOutputs[6].Connect(relayDirB);
            port.DigitalOutputs[5].Connect(relayStart);

            port.Connect(audioPlayer);
        }
コード例 #3
0
        public TestScene3(IEnumerable <string> args)
        {
            buttonPlayFX               = new DigitalInput("Play FX");
            buttonPauseFX              = new DigitalInput("Pause FX");
            buttonCueFX                = new DigitalInput("Cue FX");
            buttonResumeFX             = new DigitalInput("Resume FX");
            buttonPlayBackground       = new DigitalInput("Play Background");
            buttonPauseBackground      = new DigitalInput("Pause Background");
            buttonBackgroundLowVolume  = new DigitalInput("Background Low");
            buttonBackgroundHighVolume = new DigitalInput("Background High");
            buttonBackgroundNext       = new DigitalInput("BG next");
            buttonTrigger1             = new DigitalInput("Pop!");
            switchTest1                = new Switch("Switch test 1");

            audioPlayer = new AudioPlayer("Audio Player");

            oscServer = new Expander.OscServer(9999);

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

            raspberry.Connect(audioPlayer);
        }
コード例 #4
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);
            };
        }
コード例 #5
0
        public Halloween2015Manual(IEnumerable <string> args)
        {
            hoursSmall.AddRange("5:00 pm", "9:00 pm");

            // Logging
            hoursSmall.Output.Log("Hours small");

            hoursSmall
            .ControlsMasterPower(catAir);
            //                .ControlsMasterPower(eyes);

            buttonOverrideHours.Output.Subscribe(x =>
            {
                if (x)
                {
                    hoursSmall.SetForced(true);
                }
                else
                {
                    hoursSmall.SetForced(null);
                }
            });

            hoursSmall.Output.Subscribe(x =>
            {
                if (x)
                {
                    flickerEffect.Start();
                }
                else
                {
                    flickerEffect.Stop();
                }
                SetPixelColor();
            });

            flickerEffect.ConnectTo(stairs1Light.InputBrightness);
            flickerEffect.ConnectTo(stairs2Light.InputBrightness);


            acnOutput.Connect(new Physical.PixelRope(pixelsRoofEdge, 0, 50), 6, 1);
            acnOutput.Connect(new Physical.PixelRope(pixelsRoofEdge, 50, 100), 5, 1);

            acnOutput.Connect(new Physical.SmallRGBStrobe(spiderLight, 1), 1);
            acnOutput.Connect(new Physical.RGBStrobe(wall1Light, 60), 1);
            acnOutput.Connect(new Physical.RGBStrobe(wall2Light, 70), 1);
            acnOutput.Connect(new Physical.RGBStrobe(wall3Light, 40), 1);
            acnOutput.Connect(new Physical.RGBStrobe(wall4Light, 80), 1);
            acnOutput.Connect(new Physical.GenericDimmer(stairs1Light, 50), 1);
            acnOutput.Connect(new Physical.GenericDimmer(stairs2Light, 51), 1);
            acnOutput.Connect(new Physical.AmericanDJStrobe(strobeDimmer, 100), 1);
            acnOutput.Connect(new Physical.MonopriceRGBWPinSpot(pinSpot, 20), 1);


            raspberryCat.DigitalInputs[4].Connect(catMotion, false);
            raspberryCat.DigitalInputs[5].Connect(firstBeam, false);
            raspberryCat.DigitalInputs[6].Connect(finalBeam, false);
            raspberryCat.DigitalOutputs[7].Connect(spiderCeilingDrop);
            raspberryCat.Connect(audioCat);
            raspberryLocal.Connect(audioMain);
            raspberry3dfx.Connect(video3dfx);
            raspberryVideo2.Connect(video2);
            raspberryPop.Connect(audioPop);
            raspberryDIN.Connect(audioDIN);
            raspberryDIN.DigitalInputs[4].Connect(motion2);
            raspberryCat.DigitalOutputs[6].Connect(fog);
            raspberryDIN.DigitalOutputs[1].Connect(candyEyes);
            raspberryPop.DigitalOutputs[7].Connect(george1);
            raspberryPop.DigitalOutputs[6].Connect(george2);
            raspberryPop.DigitalOutputs[5].Connect(popper);
            raspberryPop.DigitalOutputs[2].Connect(dropSpiderEyes);

            acnOutput.Connect(new Physical.GenericDimmer(catAir, 10), 1);
            acnOutput.Connect(new Physical.GenericDimmer(catLights, 11), 1);

            oscServer.RegisterAction <int>("/1/push1", d => d.First() != 0, (msg, data) =>
            {
                audioCat.PlayEffect("266 Monster Growl 7", 1.0, 1.0);
            });

            oscServer.RegisterAction <int>("/1/push2", d => d.First() != 0, (msg, data) =>
            {
                audioCat.PlayEffect("285 Monster Snarl 2", 1.0, 1.0);
            });

            oscServer.RegisterAction <int>("/1/push3", d => d.First() != 0, (msg, data) =>
            {
                audioCat.PlayEffect("286 Monster Snarl 3", 1.0, 1.0);
            });

            oscServer.RegisterAction <int>("/1/push4", d => d.First() != 0, (msg, data) =>
            {
                audioCat.PlayEffect("287 Monster Snarl 4", 1.0, 1.0);
            });


            oscServer.RegisterAction <int>("/1/push5", (msg, data) =>
            {
                george1.Value = data.First() != 0;
            });

            oscServer.RegisterAction <int>("/1/push6", (msg, data) =>
            {
                george2.Value = data.First() != 0;
            });

            oscServer.RegisterAction <int>("/1/push7", (msg, data) =>
            {
                popper.Value = data.First() != 0;
            });

            oscServer.RegisterAction <int>("/1/push8", d => d.First() != 0, (msg, data) =>
            {
                audioPop.PlayEffect("laugh.wav", 1.0, 0.0);
            });

            oscServer.RegisterAction <int>("/1/spiderEyes", (msg, data) =>
            {
                dropSpiderEyes.Value = data.First() != 0;
            });

            oscServer.RegisterAction <int>("/1/push10", d => d.First() != 0, (msg, data) =>
            {
                audioPop.PlayEffect("348 Spider Hiss.wav", 0.0, 1.0);
            });

            oscServer.RegisterAction <int>("/1/push11", (msg, data) =>
            {
                spiderCeilingDrop.Value = data.First() != 0;
            });

            oscServer.RegisterAction <int>("/1/push12", (msg, data) =>
            {
                fog.Value = data.First() != 0;
            });

            oscServer.RegisterAction <int>("/1/push13", (msg, data) =>
            {
                candyEyes.Value = data.First() != 0;
            });

            oscServer.RegisterAction <int>("/1/push14", (msg, data) =>
            {
                //                flickerEffect.Start();
                spiderLight.Color       = Color.Red;
                spiderLight.Brightness  = data.First();
                pinSpot.Color           = Color.Purple;
                pinSpot.Brightness      = data.First();
                strobeDimmer.Brightness = data.First();
                wall1Light.Color        = Color.Purple;
                wall1Light.Brightness   = data.First();
                wall2Light.Color        = Color.Purple;
                wall2Light.Brightness   = data.First();
                wall3Light.Color        = Color.Purple;
                wall3Light.Brightness   = data.First();
                wall4Light.Color        = Color.Purple;
                wall4Light.Brightness   = data.First();
                //                audioDIN.PlayEffect("gollum_precious1.wav");
            });

            oscServer.RegisterAction <int>("/1/push20", d => d.First() != 0, (msg, data) =>
            {
                video3dfx.PlayVideo("PHA_Siren_ComeHither_3DFX_H.mp4");
            });

            oscServer.RegisterAction <int>("/1/push21", d => d.First() != 0, (msg, data) =>
            {
                //               video2.PlayVideo("SkeletonSurprise_Door_Horz_HD.mp4");
                video2.PlayVideo("Beauty_Startler_TVHolo_Hor_HD.mp4");
            });

            oscServer.RegisterAction <int>("/1/push22", d => d.First() != 0, (msg, data) =>
            {
                video2.PlayVideo("FearTheReaper_Door_Horz_HD.mp4");
            });

            oscServer.RegisterAction <int>("/1/push23", d => d.First() != 0, (msg, data) =>
            {
                video2.PlayVideo("SkeletonSurprise_Door_Horz_HD.mp4");
            });

            oscServer.RegisterAction <int>("/1/push24", d => d.First() != 0, (msg, data) =>
            {
                video2.PlayVideo("DancingDead_Wall_HD.mp4");
            });


            oscServer.RegisterAction("/1", msg =>
            {
                this.log.Information("Page 1");
                manualFader.Value = false;

                SetPixelColor();
            });

            oscServer.RegisterAction("/2", msg =>
            {
                this.log.Information("Page 2");
                manualFader.Value = true;

                SetPixelColor();
            });

            oscServer.RegisterAction <float>("/2/faderBright", (msg, data) =>
            {
                faderBright.Value = data.First();

                SetPixelColor();
            });

            oscServer.RegisterAction <float>("/2/faderR", (msg, data) =>
            {
                faderR.Value = data.First();

                SetPixelColor();
            });

            oscServer.RegisterAction <float>("/2/faderG", (msg, data) =>
            {
                faderG.Value = data.First();

                SetPixelColor();
            });

            oscServer.RegisterAction <float>("/2/faderB", (msg, data) =>
            {
                faderB.Value = data.First();

                SetPixelColor();
            });



            midiInput.Note(midiChannel, 36).Subscribe(x =>
            {
                if (x)
                {
                    audioCat.PlayEffect("266 Monster Growl 7", 1.0, 1.0);
                }
            });
            midiInput.Note(midiChannel, 37).Subscribe(x =>
            {
                if (x)
                {
                    audioCat.PlayEffect("285 Monster Snarl 2", 1.0, 1.0);
                }
            });
            midiInput.Note(midiChannel, 38).Subscribe(x =>
            {
                if (x)
                {
                    audioCat.PlayEffect("286 Monster Snarl 3", 1.0, 1.0);
                }
            });
            midiInput.Note(midiChannel, 39).Subscribe(x =>
            {
                if (x)
                {
                    audioCat.PlayEffect("287 Monster Snarl 4", 1.0, 1.0);
                }
            });
            midiInput.Note(midiChannel, 40).Subscribe(x =>
            {
                if (x)
                {
                    audioMain.PlayBackground();
                }
            });
            midiInput.Note(midiChannel, 41).Subscribe(x =>
            {
                if (x)
                {
                    audioMain.PauseBackground();
                }
            });
            midiInput.Note(midiChannel, 42).Subscribe(x =>
            {
                spiderCeilingDrop.Value = x;
            });

            //            catMotion.Output.Subscribe(catLights.Control);

            catMotion.Output.Subscribe(x =>
            {
                if (x && hoursSmall.IsOpen)
                {
                    Executor.Current.Execute(catSeq);
                }

                touchOSC.Send("/1/led1", x ? 1 : 0);
            });

            firstBeam.Output.Subscribe(x =>
            {
                touchOSC.Send("/1/led2", x ? 1 : 0);

                //if (x)
                //    Executor.Current.Execute(welcomeSeq);
            });

            finalBeam.Output.Subscribe(x =>
            {
                touchOSC.Send("/1/led3", x ? 1 : 0);
            });

            motion2.Output.Subscribe(x =>
            {
                if (x && hoursSmall.IsOpen)
                {
                    Executor.Current.Execute(motionSeq);
                }

                touchOSC.Send("/1/led4", x ? 1 : 0);
            });

            welcomeSeq.WhenExecuted
            .Execute(i =>
            {
                audioPop.PlayEffect("100471__robinhood76__01886-welcome-spell.wav");

                i.WaitFor(S(3));
            });

            catSeq.WhenExecuted
            .Execute(instance =>
            {
                var maxRuntime = System.Diagnostics.Stopwatch.StartNew();

                catLights.Value = 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.Value = false;
            });

            motionSeq.WhenExecuted
            .Execute(instance =>
            {
                //video2.PlayVideo("DancingDead_Wall_HD.mp4");

                instance.WaitFor(S(10));
            })
            .TearDown(() =>
            {
            });

            SetPixelColor();
        }
コード例 #6
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);
        }
コード例 #7
0
        public Halloween2014(IEnumerable <string> args)
        {
            hoursSmall.AddRange("5:00 pm", "9:00 pm");
            hoursInside.AddRange("6:00 pm", "10:00 pm");
            hoursInside.SetForced(false);

            // Logging
            hoursSmall.Output.Log("Hours small");
            hoursInside.Output.Log("Hours inside");
            movingHead.OutputPan.Log("Pan");
            movingHead.OutputTilt.Log("Tilt");


            hoursSmall
            .ControlsMasterPower(catAir)
            .ControlsMasterPower(catLights)
            .ControlsMasterPower(eyes);

            hoursInside.Output.Subscribe(x =>
            {
                lightInside.Brightness         = x ? 1.0 : 0.0;
                lightMirrorSkeleton.Brightness = x ? 1.0 : 0.0;
            });

            flickerEffect.ConnectTo(lightStairs1.InputBrightness);
            flickerEffect.ConnectTo(lightStairs2.InputBrightness);
            //            pulsatingEffect1.ConnectTo(lightBehindHeads.InputBrightness);
            //            pulsatingEffect1.ConnectTo(lightBehindSheet.InputBrightness);
            pulsatingEffect1.ConnectTo(candySpot.InputBrightness);
            pulsatingEffect2.ConnectTo(lightSpiderWeb.InputBrightness);
            //            pulsatingEffect2.ConnectTo(lightMirrorSkeleton.InputBrightness);
            //            pulsatingEffect2.ConnectTo(lightWindow.InputBrightness);
            //            pulsatingEffect2.ConnectTo(lightInside.InputBrightness);
            //            flickerEffect2.ConnectTo(lightInside.InputBrightness);
            //            pulsatingEffect1.ConnectTo(movingHead.InputBrightness);

            //            movingHead.InputBrightness.Log("Moving Head Brightness");

            //            popOut1.AddDevice(lightning1.InputBrightness);
            //            popOut2.ConnectTo(light.InputBrightness);
            popOut1.ConnectTo(lightBehindHeads.InputBrightness);
            popOut1.ConnectTo(lightBehindSheet.InputBrightness);
            //            popOut1 ConnectTo(lightFlash1.InputBrightness);
            //            popOut2.ConnectTo(lightFlash1.InputBrightness);
            popOut2.ConnectTo(lightBehindSheet.InputBrightness);
            popOut2.ConnectTo(lightning1.InputBrightness);
            popOut3.ConnectTo(lightBehindHeads.InputBrightness);
            popOut3.ConnectTo(lightBehindSheet.InputBrightness);
            popOut3.ConnectTo(lightEntranceR.InputBrightness);
            popOut3.ConnectTo(lightEntranceL.InputBrightness);
            popOut3.ConnectTo(new BrightnessPowerAdapter(lightFlash1).InputBrightness);
            //            popOut3.ConnectTo(lightFlash1.InputBrightness);
            //            popOut4.ConnectTo(lightEntranceL.InputBrightness);
            popOut4.ConnectTo(new BrightnessPowerAdapter(lightFlash1).InputBrightness);
            popOut4.ConnectTo(new BrightnessPowerAdapter(lightFlash2).InputBrightness);

            popOutBehindHeads.ConnectTo(lightBehindHeads.InputBrightness);
            //popOut3.ConnectTo(movingHead.InputBrightness);

            raspberryReaper.DigitalInputs[7].Connect(finalBeam, false);
            raspberryReaper.DigitalOutputs[2].Connect(spiderEyes1);
            raspberryReaper.DigitalOutputs[3].Connect(spiderEyes2);

            raspberryCat.DigitalInputs[4].Connect(catMotion, true);
            raspberryCat.DigitalInputs[5].Connect(firstBeam, false);
            raspberryCat.DigitalOutputs[7].Connect(deadEnd);
            raspberryCat.Connect(audioCat);
            raspberryCat.Motor.Connect(georgeMotor);

            raspberryReaper.Connect(audioReaper);
            raspberryOla.Connect(audioOla);

            raspberryGeorge.DigitalOutputs[7].Connect(fog);
            raspberryGeorge.Connect(audioGeorge);

            inputBrightness.ConnectTo(movingHead);

            // Map Physical lights
            acnOutput.Connect(new Physical.SmallRGBStrobe(reaperLight, 1), 20);
            acnOutput.Connect(new Physical.MonopriceRGBWPinSpot(candySpot, 20), 20);
            acnOutput.Connect(new Physical.MonopriceMovingHeadLight12chn(movingHead, 200), 20);
            acnOutput.Connect(new Physical.GenericDimmer(catAir, 11), 20);
            acnOutput.Connect(new Physical.GenericDimmer(eyes, 12), 20);
            acnOutput.Connect(new Physical.GenericDimmer(catLights, 10), 20);
            //BROKEN            acnOutput.Connect(new Physical.GenericDimmer(testLight3, 103), 20);
            //            acnOutput.Connect(new Physical.GenericDimmer(lightning2, 100), 20);
            acnOutput.Connect(new Physical.GenericDimmer(lightStairs1, 101), 20);
            acnOutput.Connect(new Physical.GenericDimmer(lightStairs2, 102), 20);
            acnOutput.Connect(new Physical.AmericanDJStrobe(lightning1, 5), 20);
            acnOutput.Connect(new Physical.RGBStrobe(lightBehindHeads, 40), 20);
            acnOutput.Connect(new Physical.RGBStrobe(lightBehindSheet, 60), 20);
            acnOutput.Connect(new Physical.RGBStrobe(lightEntranceR, 70), 20);
            acnOutput.Connect(new Physical.RGBStrobe(lightEntranceL, 80), 20);
            acnOutput.Connect(new Physical.GenericDimmer(lightTree, 50), 20);
            acnOutput.Connect(new Physical.GenericDimmer(lightSpiderWeb, 2), 21);
            acnOutput.Connect(new Physical.GenericDimmer(lightMirrorSkeleton, 1), 22);
            acnOutput.Connect(new Physical.GenericDimmer(lightInside, 2), 22);
            acnOutput.Connect(new Physical.GenericDimmer(lightWindow, 3), 22);
            acnOutput.Connect(new Physical.GenericDimmer(lightFlash1, 1), 21);
            acnOutput.Connect(new Physical.GenericDimmer(lightFlash2, 4), 22);

            candySpot.SetOnlyColor(Color.Green);

            oscServer.RegisterAction <int>("/mrmr/pushbutton/0/Hakan-iPhone-6", (msg, data) =>
            {
                if (data.First() != 0)
                {
                    audioOla.PlayTrack("12 Fear of the Dark");
                    //                    popOut4.Pop(1.0);
                    //                    stateMachine.SetState(States.Stair);
                    //                    Exec.Execute(testSeq);
                    //                    Exec.Execute(reaperSeq);
                    //                    popOut4.Pop(1.0);
                    //                    pulsatingEffect2.Start();
                }
            });

            oscServer.RegisterAction <int>("/mrmr/pushbutton/1/Hakan-iPhone-6", (msg, data) =>
            {
                if (data.Any() && data.First() != 0)
                {
                    audioOla.NextBackgroundTrack();
                    //                    stateMachine.SetState(States.George);
                    //                    Exec.Execute(georgeSeq);
                }
            });

            oscServer.RegisterAction <int>("/mrmr/pushbutton/2/Hakan-iPhone-6", (msg, data) =>
            {
                if (data.First() != 0)
                {
                    Exec.Execute(reaperPopSeq);
                }
            });

            oscServer.RegisterAction <int>("/mrmr/pushbutton/3/Hakan-iPhone-6", (msg, data) =>
            {
                if (data.First() != 0)
                {
                    catLights.Value = true;
                    switch (random.Next(3))
                    {
                    case 0:
                        audioCat.PlayEffect("386 Demon Creature Growls");
                        break;

                    case 1:
                        audioCat.PlayEffect("348 Spider Hiss");
                        break;

                    case 2:
                        audioCat.PlayEffect("death-scream");
                        break;
                    }
                    Thread.Sleep(2000);
                    catLights.Value = false;
                }
            });


            finalBeam.WhenOutputChanges(x =>
            {
                if (x && hoursSmall.IsOpen)
                {
                    Exec.Execute(finalSeq);
                }
                //                    lightning1.Brightness = x ? 1.0 : 0.0;
                //if (x)
                //{
                //    Exec.Execute(thunderSeq);
                //}
            });

            firstBeam.WhenOutputChanges(x =>
            {
                if (x && hoursSmall.IsOpen)
                {
                    //                    Exec.Execute(reaperSeq);
                    if (stateMachine.CurrentState == States.Background ||
                        stateMachine.CurrentState == States.StepForward)
                    {
                        stateMachine.SetState(States.Stair);
                    }
                }
            });

            buttonTest2.WhenOutputChanges(x =>
            {
                if (x)
                {
                    audioOla.NextBackgroundTrack();
                    //                        Exec.Execute(georgeSeq);
                }
            });

            raspberryOla.AudioTrackStart.Subscribe(x =>
            {
                // Next track
                switch (x)
                {
                case "12 Fear of the Dark":
                    // Do nothing
                    break;

                case "Thunder1":
                    timelineThunder1.Start();
                    break;

                case "Thunder2":
                    timelineThunder2.Start();
                    break;

                case "Thunder3":
                    timelineThunder3.Start();
                    break;

                case "Thunder4":
                    timelineThunder4.Start();
                    break;

                case "Thunder5":
                    timelineThunder5.Start();
                    break;

                case "Thunder6":
                    timelineThunder6.Start();
                    break;

                case "Thunder7":
                    timelineThunder7.Start();
                    break;

                case "Thunder8":
                    timelineThunder8.Start();
                    break;
                }
            });

            buttonTest4.WhenOutputChanges(x =>
            {
                if (x)
                {
                    audioOla.PlayEffect("125919__klankbeeld__horror-what-are-you-doing-here-cathedral");
                }
                //                        Exec.Execute(reaperSeq);
                //                    lightning2.Brightness = x ? 1.0 : 0.0;
                //                    if (x)
                //                        popOut1.Pop(1.0);
                //                    if (x)
                //                    lightStairs1.Brightness = x ? 1.0 : 0.0;
                //                    testLight3.Brightness = x ? 1.0 : 0.0;
                //                        audioSpider.PlayEffect("348 Spider Hiss");
                //                    Exec.Execute(thunderSeq);
            });

            buttonTest3.WhenOutputChanges(x =>
            {
                //                fog.Power = x;
                if (x)
                {
                    Exec.Execute(reaperPopSeq);

                    //for (int i = 0; i < 100; i++)
                    //{
                    //    raspberryReaper.Test(i);
                    //}
                }
                //                    audioGeorge.PlayEffect("242004__junkfood2121__fart-01");
            });

            raspberryReaper.DigitalOutputs[7].Connect(reaperPopUp);
            raspberryReaper.DigitalOutputs[6].Connect(reaperEyes);
            raspberryReaper.DigitalOutputs[5].Connect(skullEyes);

            forceOpen.WhenOutputChanges(x =>
            {
                if (x)
                {
                    hoursSmall.SetForced(true);
                }
                else
                {
                    hoursSmall.SetForced(null);
                }
            });

            inputH.WhenOutputChanges(x =>
            {
                movingHead.SetOnlyColor(HSV.ColorFromHSV(x.Value.GetByteScale(), inputS.Value, 1.0));
            });

            inputS.Output.Subscribe(x =>
            {
                movingHead.SetOnlyColor(HSV.ColorFromHSV(inputH.Value.GetByteScale(), x.Value, 1.0));
            });

            inputStrobe.Output.Controls(x => movingHead.StrobeSpeed = x);

            //midiInput.Controller(midiChannel, 1).Controls(inputBrightness.Control);
            //midiInput.Controller(midiChannel, 2).Controls(inputH.Control);
            //midiInput.Controller(midiChannel, 3).Controls(inputS.Control);
            //midiInput.Controller(midiChannel, 4).Controls(inputStrobe.Control);

            //midiInput.Controller(midiChannel, 5).Controls(Observer.Create<double>(x =>
            //    {
            //        inputPan.Control.OnNext(new DoubleZeroToOne(x * 540));
            //    }));
            //midiInput.Controller(midiChannel, 6).Controls(Observer.Create<double>(x =>
            //{
            //    inputTilt.Control.OnNext(new DoubleZeroToOne(x * 270));
            //}));

            //midiInput.Note(midiChannel, 36).Controls(buttonTest1.Control);
            //midiInput.Note(midiChannel, 37).Controls(buttonTest2.Control);
            //midiInput.Note(midiChannel, 38).Controls(buttonTest3.Control);
            //midiInput.Note(midiChannel, 39).Controls(buttonTest4.Control);

            //midiInput.Note(midiChannel, 40).Controls(buttonCatTrigger.Control);


            //buttonTest4.Output.Subscribe(x =>
            //    {
            //        if (x)
            //        {
            //            audioOla.NextBackgroundTrack();
            //        }
            //    });

            manualHeadMovement.Output.Subscribe(x =>
            {
                if (x)
                {
                    inputPan.Output.Controls(p => movingHead.Pan   = p.Value);
                    inputTilt.Output.Controls(t => movingHead.Tilt = t.Value);
                }
                else
                {
                    //                        inputPan.Output.Dis
                }
            });

            //            buttonTest2.Output.Subscribe(reaperPopUp.PowerControl);
            catMotion.Output.Subscribe(catLights.Control);

            /*
             *          finalBeam.Output.Subscribe(x =>
             *              {
             *                  lightning1.Brightness = x ? 1.0 : 0.0;
             *              });
             */

            //            buttonTest1.Output.Subscribe(pulsatingEffect2.InputRun);

            //buttonTest1.Output.Subscribe(x =>
            //    {
            //        pulsatingEffect2.Start
            //        if(x)

            //        if (x)
            //        {
            //            movingHead.Brightness = 1;
            //            movingHead.Color = Color.Red;
            //            //                        testLight4.StrobeSpeed = 1.0;
            //        }
            //        else
            //        {
            //            movingHead.TurnOff();
            //        }
            //    });

            catMotion.Output.Subscribe(x =>
            {
                if (x && hoursSmall.IsOpen)
                {
                    Executor.Current.Execute(catSeq);
                }
            });

            buttonCatTrigger.Output.Subscribe(x =>
            {
                if (x)
                {
                    catLights.Value = true;
                    switch (random.Next(3))
                    {
                    case 0:
                        audioCat.PlayEffect("386 Demon Creature Growls");
                        break;

                    case 1:
                        audioCat.PlayEffect("348 Spider Hiss");
                        break;

                    case 2:
                        audioCat.PlayEffect("death-scream");
                        break;
                    }
                    Thread.Sleep(2000);
                    catLights.Value = false;
                }
            });

            buttonTest1.Output.Subscribe(x =>
            {
                if (x)
                {
                    audioOla.PlayTrack("12 Fear of the Dark");
                }

                //if(x)
                //    georgeMotor.SetVector(0.9, 0, S(15));

                //                deadEnd.Power = x;
            });

            //            hoursSmall.Output.Subscribe(catAir.InputPower);
            //            hoursSmall.Output.Subscribe(flickerEffect.InputRun);
            //hoursSmall.Output.Subscribe(pulsatingEffect1.InputRun);
            //hoursSmall.Output.Subscribe(pulsatingEffect2.InputRun);
            hoursSmall.Output.Subscribe(lightTree.Control);

            hoursSmall.Output.Subscribe(x =>
            {
                if (x)
                {
                    stateMachine.SetBackgroundState(States.Background);
                    stateMachine.SetState(States.Background);
                }
                else
                {
                    stateMachine.Hold();
                    stateMachine.SetBackgroundState(null);
                }
            });

            timelineThunder1.AddMs(500, "A");
            timelineThunder1.AddMs(3500, "B");
            timelineThunder1.AddMs(4500, "C");
            timelineThunder1.TimelineTrigger += TriggerThunderTimeline;

            timelineThunder2.AddMs(500, "A");
            timelineThunder2.AddMs(1500, "B");
            timelineThunder2.AddMs(1600, "C");
            timelineThunder2.AddMs(3700, "C");
            timelineThunder2.TimelineTrigger += TriggerThunderTimeline;

            timelineThunder3.AddMs(100, "A");
            timelineThunder3.AddMs(200, "B");
            timelineThunder3.AddMs(300, "C");
            timelineThunder3.TimelineTrigger += TriggerThunderTimeline;

            timelineThunder4.AddMs(0, "A");
            timelineThunder4.AddMs(3500, "B");
            timelineThunder4.AddMs(4500, "C");
            timelineThunder4.TimelineTrigger += TriggerThunderTimeline;

            timelineThunder5.AddMs(1100, "A");
            timelineThunder5.AddMs(3500, "B");
            timelineThunder5.AddMs(4700, "C");
            timelineThunder5.TimelineTrigger += TriggerThunderTimeline;

            timelineThunder6.AddMs(1000, "A");
            timelineThunder6.AddMs(1800, "B");
            timelineThunder6.AddMs(6200, "C");
            timelineThunder6.TimelineTrigger += TriggerThunderTimeline;

            timelineThunder7.AddMs(0, "A");
            timelineThunder7.AddMs(200, "B");
            timelineThunder7.AddMs(300, "C");
            timelineThunder7.TimelineTrigger += TriggerThunderTimeline;

            timelineThunder8.AddMs(500, "A");
            timelineThunder8.AddMs(4000, "B");
            timelineThunder8.AddMs(4200, "C");
            timelineThunder8.TimelineTrigger += TriggerThunderTimeline;

            stateMachine.ForFromSequence(States.Background, backgroundSeq);
            stateMachine.ForFromSequence(States.Stair, reaperSeq);
            stateMachine.ForFromSequence(States.George, georgeSeq);
            stateMachine.ForFromSequence(States.StepForward, stepForwardSeq);


            georgeSeq.WhenExecuted
            .Execute(instance =>
            {
                var controlPan  = new Effect.Fader(S(3.8), 106, 150, false);
                var controlTilt = new Effect.Fader(S(3.8), 231.8823531, 168.3529407, false);

                controlPan.ConnectTo(x => movingHead.Pan   = x);
                controlTilt.ConnectTo(x => movingHead.Tilt = x);

                controlPan.Prime();
                controlTilt.Prime();
                movingHead.Brightness = 0;
                // Make sure George isn't moving
                georgeMotor.WaitForVectorReached();

                instance.WaitFor(S(1.5));

                controlPan.Start();
                controlTilt.Start();

                georgeMotor.SetVector(1.0, 450, S(10));
                instance.WaitFor(S(1.2));
                movingHead.SetColor(Color.Red, 0.1);
                instance.WaitFor(S(1.0));
                audioGeorge.PlayEffect("162 Blood Curdling Scream of Terror");
                georgeMotor.WaitForVectorReached();

                instance.WaitFor(S(4));
                movingHead.Brightness = 0;

                georgeMotor.SetVector(0.9, 0, S(15));
                movingHead.Pan  = 106;
                movingHead.Tilt = 31;
                //georgeMotor.WaitForVectorReached();

                //                        deadEnd.Power = true;
                instance.WaitFor(S(0.5));
                //                        deadEnd.Power = false;
                //                        Exec.Execute(thunderSeq);
                stateMachine.NextState();
            });

            stepForwardSeq.WhenExecuted
            .SetUp(() =>
            {
                audioOla.PlayTrack("152 Haunted Castle");
                candySpot.SetOnlyColor(Color.Green);
                pulsatingEffect1.Start();
                pulsatingEffect2.Start();
            })
            .Execute(i =>
            {
                i.WaitFor(S(30.0));
            })
            .TearDown(() =>
            {
                audioOla.PauseTrack();
                pulsatingEffect1.Stop();
                pulsatingEffect2.Stop();
            });

            reaperSeq.WhenExecuted
            .SetUp(() =>
            {
                flickerEffect.Stop();
                pulsatingEffect2.Stop();
            })
            .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));



                movingHead.Pan  = 106;
                movingHead.Tilt = 31;
                fog.Value       = true;
                this.lastFogRun = DateTime.Now;
                instance.WaitFor(S(0.05));
                audioReaper.PlayEffect("348 Spider Hiss", 1.0, 0.0);
                instance.WaitFor(S(0.05));
                spiderEyes1.Value = true;
                instance.WaitFor(S(0.5));

                movingHead.SetColor(Color.Turquoise, 0.2);
                movingHead.StrobeSpeed = 0.8;

                deadEnd.Value = true;
                instance.WaitFor(S(0.3));
                deadEnd.Value = false;

                instance.WaitFor(S(2.5));
                movingHead.StrobeSpeed = 0;
                movingHead.Brightness  = 0;

                movingHead.Pan  = 80;
                movingHead.Tilt = 26;
                instance.WaitFor(S(1.0));
                audioReaper.PlayNewEffect("laugh", 0.0, 1.0);
                instance.WaitFor(S(0.1));
                spiderEyes1.Value       = false;
                reaperPopUp.Value       = true;
                reaperLight.Color       = Color.Red;
                reaperLight.Brightness  = 1;
                reaperLight.StrobeSpeed = 1;
                instance.WaitFor(S(0.5));
                reaperEyes.Value = true;
                instance.WaitFor(S(2.0));

                reaperPopUp.Value = false;
                reaperEyes.Value  = false;
                reaperLight.TurnOff();
                instance.WaitFor(S(2.0));
                audioOla.PlayEffect("424 Coyote Howling", 0.0, 1.0);
                audioGeorge.PlayEffect("424 Coyote Howling");
                movingHead.SetColor(Color.Orange, 0.2);
                instance.WaitFor(S(2.0));
                spiderEyes2.Value = true;
                popOut2.Pop(0.4);
                audioGeorge.PlayEffect("348 Spider Hiss");
                audioReaper.PlayEffect("348 Spider Hiss");

                movingHead.Brightness  = 0.7;
                movingHead.Color       = Color.Red;
                movingHead.StrobeSpeed = 0.8;
                movingHead.Pan         = 51;
                movingHead.Tilt        = 61;
                instance.WaitFor(S(2.0));
                movingHead.StrobeSpeed = 0.0;
                movingHead.Brightness  = 0;
                spiderEyes2.Value      = false;
                instance.WaitFor(S(2.0));

                movingHead.Pan  = 106;
                movingHead.Tilt = 231;

                stateMachine.NextState();
            })
            .TearDown(() =>
            {
                flickerEffect.Start();
                pulsatingEffect2.Start();
                fog.Value = false;
            });

            reaperPopSeq.WhenExecuted
            .Execute(instance =>
            {
                audioReaper.PlayNewEffect("laugh", 0.0, 1.0);
                instance.WaitFor(S(0.1));
                reaperPopUp.Value       = true;
                reaperLight.Color       = Color.Red;
                reaperLight.Brightness  = 1;
                reaperLight.StrobeSpeed = 1;
                instance.WaitFor(S(0.5));
                reaperEyes.Value = true;
                instance.WaitFor(S(2.0));

                reaperPopUp.Value = false;
                reaperEyes.Value  = false;
                reaperLight.TurnOff();
                instance.WaitFor(S(0.5));
            });

            finalSeq.WhenExecuted
            .SetUp(() =>
            {
                audioOla.PauseTrack();
                pulsatingEffect1.Stop();
                pulsatingEffect2.Stop();
            })
            .Execute(i =>
            {
                skullEyes.Value = true;
                candySpot.SetColor(Color.Red);

                i.WaitFor(S(1.0));
                lightBehindHeads.SetOnlyColor(Color.White);
                popOutBehindHeads.Pop(1.0);
                audioOla.PlayEffect("125919__klankbeeld__horror-what-are-you-doing-here-cathedral", 0.0, 0.7);
                i.WaitFor(S(10));
            })
            .TearDown(() =>
            {
                audioOla.PlayBackground();
                skullEyes.Value = false;
                candySpot.SetOnlyColor(Color.Green);
                pulsatingEffect1.Start();
                pulsatingEffect2.Start();
                //                        candySpot.SetColor(Color.Green);

                //                        audioOla.PlayBackground();

                if (stateMachine.CurrentState == States.StepForward)
                {
                    stateMachine.SetState(States.Background);
                }
            });

            thunderSeq.WhenExecuted
            .SetUp(() =>
            {
                audioOla.PauseBackground();
                //                        movingHead.Pan = 0.25;
                //                        movingHead.Tilt = 0.5;
                Thread.Sleep(200);
            })
            .Execute(i =>
            {
                audioOla.PlayTrack("08 Weather-lightning-strike2");
                //                        movingHead.SetOnlyColor(Color.White);
                popOut1.Pop(1.0);
                popOut2.Pop(1.0);
                popOut3.Pop(1.0);

                i.WaitFor(S(4));
            })
            .TearDown(() =>
            {
                audioOla.PauseTrack();
                audioOla.PlayBackground();
            });

            backgroundSeq.WhenExecuted
            .SetUp(() =>
            {
                audioOla.NextBackgroundTrack();
                flickerEffect.Start();
                pulsatingEffect1.Start();
                pulsatingEffect2.Start();
            })
            .Execute(i =>
            {
                while (!i.IsCancellationRequested)
                {
                    i.WaitFor(S(1));
                    if (!this.lastFogRun.HasValue || (DateTime.Now - this.lastFogRun.Value).TotalMinutes > 10)
                    {
                        // Run the fog for a little while
                        fog.Value = true;
                        i.WaitFor(S(4));
                        fog.Value       = false;
                        this.lastFogRun = DateTime.Now;
                    }
                }
            })
            .TearDown(() =>
            {
                flickerEffect.Stop();
                pulsatingEffect1.Stop();
                pulsatingEffect2.Stop();
                audioOla.PauseTrack();
                audioOla.PauseBackground();
            });

            catSeq.WhenExecuted
            .Execute(instance =>
            {
                var maxRuntime = System.Diagnostics.Stopwatch.StartNew();

                catLights.Value = 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.Value = false;
            });
        }
コード例 #8
0
        public Halloween2015(IEnumerable <string> args)
        {
            hoursSmall.AddRange("5:00 pm", "7:00 pm");
            //            hoursFull.AddRange("5:00 pm", "7:00 pm");

            // Logging
            hoursSmall.Output.Log("Hours small");
            hoursFull.Output.Log("Hours full");

            hoursSmall
            .ControlsMasterPower(catAir);
            hoursFull
            .ControlsMasterPower(catAir);
            //                .ControlsMasterPower(eyes);

            buttonOverrideHours.Output.Subscribe(x =>
            {
                if (x)
                {
                    hoursFull.SetForced(true);
                }
                else
                {
                    hoursFull.SetForced(false);
                }
            });


            emergencyStop.Output.Subscribe(x =>
            {
                if (x)
                {
                    stateMachine.GoToState(States.EmergencyStop);
                }
                else
                {
                    if (hoursFull.IsOpen)
                    {
                        stateMachine.GoToState(States.Background);
                    }
                    else
                    {
                        stateMachine.GoToIdle();
                    }
                }
            });

            hoursFull.Output.Subscribe(x =>
            {
                if (x)
                {
                    stateMachine.SetDefaultState(States.Background);

                    if (emergencyStop.Value)
                    {
                        stateMachine.GoToState(States.EmergencyStop);
                    }
                    else
                    {
                        stateMachine.GoToState(States.Background);
                    }
                }
                else
                {
                    stateMachine.GoToIdle();
                    stateMachine.SetDefaultState(null);
                }
                SetPixelColor();
            });

            popOut1.ConnectTo(wall1Light);
            popOut1.ConnectTo(wall4Light);
            popOut2.ConnectTo(wall2Light);
            popOutAll.ConnectTo(wall1Light);
            popOutAll.ConnectTo(wall2Light);
            popOutAll.ConnectTo(wall3Light);
            popOutAll.ConnectTo(wall4Light);
            popOutAll.ConnectTo(underGeorge);
            popOutAll.ConnectTo(pixelsRoofEdge);
            popOutAll.ConnectTo(pinSpot);

            allLights.Add(wall1Light, wall2Light, wall3Light, wall4Light, underGeorge, pixelsRoofEdge, pinSpot, spiderLight);
            purpleLights.Add(wall1Light, wall2Light, wall3Light, wall4Light, pixelsRoofEdge);

            flickerEffect.ConnectTo(stairs1Light);
            flickerEffect.ConnectTo(stairs2Light);
            pulsatingEffect1.ConnectTo(pinSpot, Tuple.Create <DataElements, object>(DataElements.Color, Color.FromArgb(0, 255, 0)));
            pulsatingEffect2.ConnectTo(pinSpot, Tuple.Create <DataElements, object>(DataElements.Color, Color.FromArgb(255, 0, 0)));

            stateMachine.For(States.Background)
            .Execute(i =>
            {
                subVideo.Run();
                flickerEffect.Start();
                treeGhosts.SetBrightness(1.0);
                audioMain.PlayBackground();
                audioEeebox.SetBackgroundVolume(0.6);
                audioEeebox.PlayBackground();

                ColorBrightness purpleColor = new ColorBrightness(HSV.ColorFromRGB(0.73333333333333328, 0, 1),
                                                                  0.16470588235294117);

                purpleLights.SetData(null, Utils.Data(purpleColor.Color, purpleColor.Brightness));

                while (!i.IsCancellationRequested && stateMachine.CurrentState == States.Background)
                {
                    i.WaitFor(S(0.5));
                    if (!this.lastFogRun.HasValue || (DateTime.Now - this.lastFogRun.Value).TotalMinutes > 5)
                    {
                        // Run the fog for a little while
                        fog.SetValue(true);
                        i.WaitFor(S(4));
                        fog.SetValue(false);
                        this.lastFogRun = DateTime.Now;
                    }
                }
            })
            .TearDown(instance =>
            {
                purpleLights.SetBrightness(0.0);

                Exec.Cancel(subVideo);
                audioMain.PauseBackground();
                audioEeebox.PauseBackground();

                timelineThunder1.Stop();
                timelineThunder2.Stop();
                timelineThunder3.Stop();
                timelineThunder4.Stop();
                timelineThunder5.Stop();
                timelineThunder6.Stop();
                timelineThunder7.Stop();
                timelineThunder8.Stop();

                flickerEffect.Stop();
                treeGhosts.SetBrightness(0.0);
            });

            stateMachine.For(States.EmergencyStop)
            .Execute(i =>
            {
                // Do nothing
                i.WaitUntilCancel();
            });

            stateMachine.For(States.Special1)
            .Execute(i =>
            {
                audioEeebox.PlayNewEffect("640 The Demon Exorcised.wav");

                i.WaitUntilCancel();
            });

            inputBrightness.Output.Subscribe(x =>
            {
                //                testLight1.SetBrightness(x);
            });

            inputH.WhenOutputChanges(x =>
            {
                //                testLight1.SetColor(HSV.ColorFromHSV(x.GetByteScale(), inputS.Value, 1.0));
            });

            inputS.Output.Subscribe(x =>
            {
                //                testLight1.SetColor(HSV.ColorFromHSV(inputH.Value.GetByteScale(), x, 1.0));
            });

            midiInput.Controller(midiChannel, 1).Controls(inputBrightness.Control);
            midiInput.Controller(midiChannel, 2).Controls(inputH.Control);
            midiInput.Controller(midiChannel, 3).Controls(inputS.Control);

            raspberryLocal.AudioTrackStart.Subscribe(x =>
            {
                // Next track
                switch (x)
                {
                case "Thunder1.wav":
                    timelineThunder1.Start();
                    audioEeebox.PlayEffect("scream.wav");
                    break;

                case "Thunder2.wav":
                    timelineThunder2.Start();
                    break;

                case "Thunder3.wav":
                    timelineThunder3.Start();
                    break;

                case "Thunder4.wav":
                    timelineThunder4.Start();
                    audioEeebox.PlayEffect("424 Coyote Howling.wav");
                    break;

                case "Thunder5.wav":
                    timelineThunder5.Start();
                    //                        audioEeebox.PlayEffect("sixthsense-deadpeople.wav");
                    break;

                case "Thunder6.wav":
                    timelineThunder6.Start();
                    break;

                case "Thunder7.wav":
                    timelineThunder7.Start();
                    break;

                case "Thunder8.wav":
                    timelineThunder8.Start();
                    break;

                default:
                    log.Debug("Unknown track {0}", x);
                    break;
                }
            });

            timelineThunder1.AddMs(500, "A");
            timelineThunder1.AddMs(3500, "B");
            timelineThunder1.AddMs(4500, "C");
            timelineThunder1.TimelineTrigger += TriggerThunderTimeline;

            timelineThunder2.AddMs(500, "A");
            timelineThunder2.AddMs(1500, "B");
            timelineThunder2.AddMs(1600, "C");
            timelineThunder2.AddMs(3700, "C");
            timelineThunder2.TimelineTrigger += TriggerThunderTimeline;

            timelineThunder3.AddMs(100, "A");
            timelineThunder3.AddMs(200, "B");
            timelineThunder3.AddMs(300, "C");
            timelineThunder3.TimelineTrigger += TriggerThunderTimeline;

            timelineThunder4.AddMs(0, "A");
            timelineThunder4.AddMs(3500, "B");
            timelineThunder4.AddMs(4500, "C");
            timelineThunder4.TimelineTrigger += TriggerThunderTimeline;

            timelineThunder5.AddMs(1100, "A");
            timelineThunder5.AddMs(3500, "B");
            timelineThunder5.AddMs(4700, "C");
            timelineThunder5.TimelineTrigger += TriggerThunderTimeline;

            timelineThunder6.AddMs(1000, "A");
            timelineThunder6.AddMs(1800, "B");
            timelineThunder6.AddMs(6200, "C");
            timelineThunder6.TimelineTrigger += TriggerThunderTimeline;

            timelineThunder7.AddMs(0, "A");
            timelineThunder7.AddMs(200, "B");
            timelineThunder7.AddMs(300, "C");
            timelineThunder7.TimelineTrigger += TriggerThunderTimeline;

            timelineThunder8.AddMs(500, "A");
            timelineThunder8.AddMs(4000, "B");
            timelineThunder8.AddMs(4200, "C");
            timelineThunder8.TimelineTrigger += TriggerThunderTimeline;

            acnOutput.Connect(new Physical.Pixel1D(pixelsRoofEdge, 0, 50), 6, 1);
            acnOutput.Connect(new Physical.Pixel1D(pixelsRoofEdge, 50, 100), 5, 1);

            acnOutput.Connect(new Physical.SmallRGBStrobe(spiderLight, 1), 1);
            acnOutput.Connect(new Physical.RGBStrobe(wall1Light, 60), 1);
            acnOutput.Connect(new Physical.RGBStrobe(wall2Light, 70), 1);
            acnOutput.Connect(new Physical.RGBStrobe(wall3Light, 40), 1);
            acnOutput.Connect(new Physical.RGBStrobe(wall4Light, 80), 1);
            acnOutput.Connect(new Physical.GenericDimmer(stairs1Light, 50), 1);
            acnOutput.Connect(new Physical.GenericDimmer(stairs2Light, 51), 1);
            acnOutput.Connect(new Physical.GenericDimmer(treeGhosts, 52), 1);
            acnOutput.Connect(new Physical.AmericanDJStrobe(underGeorge, 100), 1);
            acnOutput.Connect(new Physical.MonopriceRGBWPinSpot(pinSpot, 20), 1);

            //            acnOutput.Connect(new Physical.RGBIS(testLight1, 260), 1);


            raspberryCat.DigitalInputs[4].Connect(catMotion, false);
            raspberryCat.DigitalInputs[5].Connect(firstBeam, false);
            raspberryCat.DigitalInputs[6].Connect(finalBeam, false);
            raspberryCat.DigitalOutputs[7].Connect(spiderCeilingDrop);
            raspberryCat.Connect(audioCat);
            raspberryLocal.Connect(audioMain);
            monoExpanderEeebox.Connect(audioEeebox);
            raspberry3dfx.Connect(video3dfx);
            raspberryVideo2.Connect(video2);
            raspberryPop.Connect(audioPop);
            raspberryDIN.Connect(audioDIN);
            raspberryDIN.DigitalInputs[4].Connect(motion2);
            raspberryCat.DigitalOutputs[6].Connect(fog);
            raspberryDIN.DigitalOutputs[1].Connect(candyEyes);
            raspberryPop.DigitalOutputs[7].Connect(george1);
            raspberryPop.DigitalOutputs[6].Connect(george2);
            raspberryPop.DigitalOutputs[5].Connect(popper);
            raspberryPop.DigitalOutputs[2].Connect(dropSpiderEyes);

            acnOutput.Connect(new Physical.GenericDimmer(catAir, 10), 1);
            acnOutput.Connect(new Physical.GenericDimmer(catLights, 11), 1);

            oscServer.RegisterAction <int>("/3/multipush1/6/1", d => d.First() != 0, (msg, data) =>
            {
                audioEeebox.PlayEffect("sixthsense-deadpeople.wav");
            });

            oscServer.RegisterAction <int>("/3/multipush1/6/2", d => d.First() != 0, (msg, data) =>
            {
                audioEeebox.PlayEffect("162 Blood Curdling Scream of Terror.wav");
            });

            oscServer.RegisterAction <int>("/3/multipush1/6/3", d => d.First() != 0, (msg, data) =>
            {
                audioEeebox.PlayEffect("424 Coyote Howling.wav");
            });

            oscServer.RegisterAction <int>("/3/multipush1/6/4", d => d.First() != 0, (msg, data) =>
            {
                audioEeebox.PlayEffect("125919__klankbeeld__horror-what-are-you-doing-here-cathedral.wav");
            });

            oscServer.RegisterAction <int>("/3/multipush1/6/5", d => d.First() != 0, (msg, data) =>
            {
                audioEeebox.PlayEffect("242004__junkfood2121__fart-01.wav");
            });

            oscServer.RegisterAction <int>("/3/multipush1/5/1", d => d.First() != 0, (msg, data) =>
            {
                audioEeebox.PlayEffect("death-scream.wav");
            });

            oscServer.RegisterAction <int>("/3/multipush1/5/2", d => d.First() != 0, (msg, data) =>
            {
                audioEeebox.PlayEffect("scream.wav");
            });

            oscServer.RegisterAction <int>("/3/multipush1/5/3", d => d.First() != 0, (msg, data) =>
            {
                audioEeebox.PlayEffect("door-creak.wav");
            });

            oscServer.RegisterAction <int>("/3/multipush1/5/4", d => d.First() != 0, (msg, data) =>
            {
                audioEeebox.PlayEffect("violin screech.wav");
            });

            oscServer.RegisterAction <int>("/3/multipush1/5/5", d => d.First() != 0, (msg, data) =>
            {
                audioEeebox.PlayEffect("gollum_precious1.wav");
            });

            oscServer.RegisterAction <int>("/3/multipush1/4/1", d => d.First() != 0, (msg, data) =>
            {
                audioEeebox.PlayNewEffect("640 The Demon Exorcised.wav");
            });

            oscServer.RegisterAction <int>("/3/multipush1/4/2", d => d.First() != 0, (msg, data) =>
            {
                audioCat.PlayEffect("266 Monster Growl 7.wav", 1.0, 1.0);
            });

            oscServer.RegisterAction <int>("/3/multipush1/4/3", d => d.First() != 0, (msg, data) =>
            {
                audioCat.PlayEffect("285 Monster Snarl 2.wav", 1.0, 1.0);
            });

            oscServer.RegisterAction <int>("/3/multipush1/4/4", d => d.First() != 0, (msg, data) =>
            {
                audioCat.PlayEffect("286 Monster Snarl 3.wav", 1.0, 1.0);
            });

            oscServer.RegisterAction <int>("/3/multipush1/4/5", d => d.First() != 0, (msg, data) =>
            {
                audioCat.PlayEffect("287 Monster Snarl 4.wav", 1.0, 1.0);
            });

            oscServer.RegisterAction <int>("/3/multipush1/3/1", d => d.First() != 0, (msg, data) =>
            {
                audioEeebox.PlayEffect("180 Babbling Lunatic.wav");
            });

            oscServer.RegisterAction <int>("/1/eStop", (msg, data) =>
            {
                emergencyStop.Control.OnNext(data.First() != 0);
            });

            oscServer.RegisterAction <int>("/1/push2", d => d.First() != 0, (msg, data) =>
            {
                audioCat.PlayEffect("285 Monster Snarl 2.wav", 1.0, 1.0);
            });

            oscServer.RegisterAction <int>("/1/push3", d => d.First() != 0, (msg, data) =>
            {
                audioCat.PlayEffect("286 Monster Snarl 3.wav", 1.0, 1.0);
            });

            oscServer.RegisterAction <int>("/1/push4", (msg, data) =>
            {
                // Flash
                if (data.First() != 0)
                {
                    allLights.TakeAndHoldControl();
                    allLights.SetData(null, Utils.Data(Color.White, 1.0));
                }
                else
                {
                    allLights.ReleaseControl();
                }
            });

            oscServer.RegisterAction <int>("/1/push5", (msg, data) =>
            {
                george1.SetValue(data.First() != 0);
            });

            oscServer.RegisterAction <int>("/1/push6", (msg, data) =>
            {
                george2.SetValue(data.First() != 0);
            });

            oscServer.RegisterAction <int>("/1/push7", (msg, data) =>
            {
                popper.SetValue(data.First() != 0);
            });

            oscServer.RegisterAction <int>("/1/push8", d => d.First() != 0, (msg, data) =>
            {
                audioPop.PlayEffect("laugh.wav", 1.0, 0.0);
            });

            oscServer.RegisterAction <int>("/1/spiderEyes", (msg, data) =>
            {
                dropSpiderEyes.SetValue(data.First() != 0);
            });

            oscServer.RegisterAction <int>("/1/push10", d => d.First() != 0, (msg, data) =>
            {
                audioPop.PlayEffect("348 Spider Hiss.wav", 0.0, 1.0);
            });

            oscServer.RegisterAction <int>("/1/push11", (msg, data) =>
            {
                spiderCeilingDrop.SetValue(data.First() != 0);
            });

            oscServer.RegisterAction <int>("/1/push12", (msg, data) =>
            {
                fog.SetValue(data.First() != 0);
            });

            oscServer.RegisterAction <int>("/1/special1", (msg, data) =>
            {
                if (data.First() != 0)
                {
                    stateMachine.GoToMomentaryState(States.Special1);
                }
                else
                {
                    stateMachine.StopCurrentJob();
                }
            });

            oscServer.RegisterAction <int>("/1/push13", d => d.First() != 0, (msg, data) =>
            {
                //                Exec.MasterEffect.Fade(stairs1Light, 1.0, 0.0, 2000, token: testToken);
                //popOut1.Pop();
                //popOut2.Pop();
                //popOut3.Pop();
                popOutAll.Pop(color: Color.White);
            });

            oscServer.RegisterAction <int>("/1/toggle1", (msg, data) =>
            {
                //                candyEyes.Value = data.First() != 0;
                if (data.First() != 0)
                {
                    audioMain.PlayBackground();
                }
                else
                {
                    audioMain.PauseBackground();
                }
            });

            oscServer.RegisterAction <int>("/1/toggle2", (msg, data) =>
            {
                //                pinSpot.SetBrightness(data.First());
            });

            oscServer.RegisterAction <int>("/1/toggle3", (msg, data) =>
            {
                if (data.First() != 0)
                {
                    audioEeebox.PlayBackground();
                }
                else
                {
                    audioEeebox.PauseBackground();
                }
            });

            oscServer.RegisterAction <int>("/1/toggle4", (msg, data) =>
            {
                block.Value = data.First() != 0;
                //                treeGhosts.SetBrightness(data.First() != 0 ? 1.0 : 0.0);
            });

            oscServer.RegisterAction <int>("/1/push14", (msg, data) =>
            {
                //                flickerEffect.Start();
                //double brightness = data.First();

                //spiderLight.SetColor(Color.Red, brightness);
                //pinSpot.SetColor(Color.Purple, brightness);
                //underGeorge.SetBrightness(brightness);
                //wall1Light.SetColor(Color.Purple, brightness);
                //wall2Light.SetColor(Color.Purple, brightness);
                //wall3Light.SetColor(Color.Purple, brightness);
                //wall4Light.SetColor(Color.Purple, brightness);
                //                audioDIN.PlayEffect("gollum_precious1.wav");
            });

            oscServer.RegisterAction <int>("/1/push20", d => d.First() != 0, (msg, data) =>
            {
                video3dfx.PlayVideo("PHA_Wraith_StartleScare_3DFX_H.mp4");
            });

            oscServer.RegisterAction <int>("/1/push21", d => d.First() != 0, (msg, data) =>
            {
                //               video2.PlayVideo("SkeletonSurprise_Door_Horz_HD.mp4");
                video2.PlayVideo("Beauty_Startler_TVHolo_Hor_HD.mp4");
            });

            oscServer.RegisterAction <int>("/4/multipush2/5/1", d => d.First() != 0, (msg, data) =>
            {
                video2.PlayVideo("Beauty_Startler_TVHolo_Hor_HD.mp4");
            });

            oscServer.RegisterAction <int>("/4/multipush2/5/2", d => d.First() != 0, (msg, data) =>
            {
            });

            oscServer.RegisterAction <int>("/4/multipush2/5/3", d => d.First() != 0, (msg, data) =>
            {
            });

            oscServer.RegisterAction <int>("/4/multipush2/5/4", d => d.First() != 0, (msg, data) =>
            {
                video2.PlayVideo("FearTheReaper_Door_Horz_HD.mp4");
            });

            oscServer.RegisterAction <int>("/4/multipush2/4/1", d => d.First() != 0, (msg, data) =>
            {
                video2.PlayVideo("GatheringGhouls_Door_Horz_HD.mp4");
            });

            oscServer.RegisterAction <int>("/4/multipush2/4/2", d => d.First() != 0, (msg, data) =>
            {
                video2.PlayVideo("Girl_Startler_TVHolo_Hor_HD.mp4");
            });

            oscServer.RegisterAction <int>("/4/multipush2/4/3", d => d.First() != 0, (msg, data) =>
            {
                video2.PlayVideo("HeadOfHouse_Startler_TVHolo_Hor_HD.mp4");
            });

            oscServer.RegisterAction <int>("/4/multipush2/4/4", d => d.First() != 0, (msg, data) =>
            {
                video2.PlayVideo("JitteryBones_Door_Horz_HD.mp4");
            });

            oscServer.RegisterAction <int>("/4/multipush2/3/1", d => d.First() != 0, (msg, data) =>
            {
                video2.PlayVideo("PHA_Poltergeist_StartleScare_Holl_H.mp4");
            });

            oscServer.RegisterAction <int>("/4/multipush2/3/2", d => d.First() != 0, (msg, data) =>
            {
                video2.PlayVideo("PHA_Siren_StartleScare_Holl_H.mp4");
            });

            oscServer.RegisterAction <int>("/4/multipush2/3/3", d => d.First() != 0, (msg, data) =>
            {
                video2.PlayVideo("PHA_Spinster_StartleScare_Holl_H.mp4");
            });

            oscServer.RegisterAction <int>("/4/multipush2/3/4", d => d.First() != 0, (msg, data) =>
            {
                video2.PlayVideo("PHA_Wraith_StartleScare_Holl_H.mp4");
            });

            oscServer.RegisterAction <int>("/4/multipush2/2/1", d => d.First() != 0, (msg, data) =>
            {
                video2.PlayVideo("PopUpPanic_Door_Horz_HD.mp4");
            });

            oscServer.RegisterAction <int>("/4/multipush2/2/2", d => d.First() != 0, (msg, data) =>
            {
                video2.PlayVideo("SkeletonSurprise_Door_Horz_HD.mp4");
            });

            oscServer.RegisterAction <int>("/4/multipush2/2/3", d => d.First() != 0, (msg, data) =>
            {
                video2.PlayVideo("Wraith_Startler_TVHolo_Hor_HD.mp4");
            });

            oscServer.RegisterAction <int>("/4/multipush2/2/4", d => d.First() != 0, (msg, data) =>
            {
            });

            oscServer.RegisterAction <int>("/4/multipush2/1/1", d => d.First() != 0, (msg, data) =>
            {
                video3dfx.PlayVideo("PHA_Wraith_StartleScare_3DFX_H.mp4");
            });

            oscServer.RegisterAction <int>("/4/multipush2/1/2", d => d.First() != 0, (msg, data) =>
            {
                video3dfx.PlayVideo("PHA_Spinster_StartleScare_3DFX_H.mp4");
            });

            oscServer.RegisterAction <int>("/4/multipush2/1/3", d => d.First() != 0, (msg, data) =>
            {
                video3dfx.PlayVideo("PHA_Siren_StartleScare_3DFX_H.mp4");
            });

            oscServer.RegisterAction <int>("/4/multipush2/1/4", d => d.First() != 0, (msg, data) =>
            {
                video3dfx.PlayVideo("PHA_Poltergeist_StartleScare_3DFX_H.mp4");
            });


            oscServer.RegisterAction("/1", msg =>
            {
                this.log.Information("Page 1");
                //                manualFader.Value = false;

                SetPixelColor();
            });

            oscServer.RegisterAction("/2", msg =>
            {
                this.log.Information("Page 2");
                //                manualFader.Value = true;

                SetPixelColor();
            });

            oscServer.RegisterAction <float>("/2/faderBright", (msg, data) =>
            {
                faderBright.Value = data.First();

                SetPixelColor();
            });

            oscServer.RegisterAction <float>("/2/faderR", (msg, data) =>
            {
                faderR.Value = data.First();

                SetPixelColor();
            });

            oscServer.RegisterAction <float>("/2/faderG", (msg, data) =>
            {
                faderG.Value = data.First();

                SetPixelColor();
            });

            oscServer.RegisterAction <float>("/2/faderB", (msg, data) =>
            {
                faderB.Value = data.First();

                SetPixelColor();
            });



            midiInput.Note(midiChannel, 36).Subscribe(x =>
            {
                if (x)
                {
                    audioCat.PlayEffect("266 Monster Growl 7", 1.0, 1.0);
                }
            });

            midiInput.Note(midiChannel, 37).Subscribe(x =>
            {
                if (x)
                {
                    audioCat.PlayEffect("285 Monster Snarl 2", 1.0, 1.0);
                }
            });

            midiInput.Note(midiChannel, 38).Subscribe(x =>
            {
                if (x)
                {
                    audioCat.PlayEffect("286 Monster Snarl 3", 1.0, 1.0);
                }
            });

            midiInput.Note(midiChannel, 39).Subscribe(x =>
            {
                if (x)
                {
                    audioCat.PlayEffect("287 Monster Snarl 4", 1.0, 1.0);
                }
            });

            midiInput.Note(midiChannel, 40).Subscribe(x =>
            {
                if (x)
                {
                    allLights.TakeAndHoldControl();
                    allLights.SetData(null, Utils.Data(Color.White, 1.0));
                }
                else
                {
                    allLights.ReleaseControl();
                }
            });

            midiInput.Note(midiChannel, 41).Subscribe(x =>
            {
                if (x)
                {
                    audioEeebox.PlayEffect("125919__klankbeeld__horror-what-are-you-doing-here-cathedral.wav");
                }
            });

            midiInput.Note(midiChannel, 42).Subscribe(x =>
            {
                if (x)
                {
                    audioEeebox.PlayEffect("180 Babbling Lunatic.wav");
                }
            });

            midiInput.Note(midiChannel, 43).Subscribe(x =>
            {
                if (x)
                {
                    audioEeebox.PlayEffect("162 Blood Curdling Scream of Terror.wav");
                }
            });

            catMotion.Output.Subscribe(x =>
            {
                if (x && (hoursFull.IsOpen || hoursSmall.IsOpen))
                {
                    Executor.Current.Execute(catSeq);
                }

                touchOSC.Send("/1/led1", x ? 1 : 0);
            });

            firstBeam.Output.Subscribe(x =>
            {
                touchOSC.Send("/1/led2", x ? 1 : 0);

                if (x && hoursFull.IsOpen && !emergencyStop.Value && !block.Value)
                {
                    subFirst.Run();
                }
            });

            finalBeam.Output.Subscribe(x =>
            {
                touchOSC.Send("/1/led3", x ? 1 : 0);

                if (x && hoursFull.IsOpen && !emergencyStop.Value && !block.Value)
                {
                    subFinal.Run();
                }
            });

            motion2.Output.Subscribe(x =>
            {
                //if (x && hoursFull.IsOpen)
                //    Executor.Current.Execute(motionSeq);

                touchOSC.Send("/1/led4", x ? 1 : 0);
            });

            welcomeSeq.WhenExecuted
            .Execute(i =>
            {
                audioPop.PlayEffect("100471__robinhood76__01886-welcome-spell.wav");

                i.WaitFor(S(3));
            });

            subFirst
            .LockWhenRunning(10, spiderLight)
            .RunAction(i =>
            {
                fog.SetValue(true);
                this.lastFogRun = DateTime.Now;
                pulsatingEffect2.Start();
                i.WaitFor(S(5.0));

                spiderLight.SetColor(Color.Red, token: i.Token);
                dropSpiderEyes.SetValue(true);
                spiderCeilingDrop.SetValue(true);
                audioPop.PlayEffect("348 Spider Hiss.wav", 1.0, 0.0);

                i.WaitFor(S(2.0));
                dropSpiderEyes.SetValue(false);
                spiderLight.SetBrightness(0.0, i.Token);
                switch (random.Next(4))
                {
                case 0:
                    video3dfx.PlayVideo("PHA_Wraith_StartleScare_3DFX_H.mp4");
                    break;

                case 1:
                    video3dfx.PlayVideo("PHA_Spinster_StartleScare_3DFX_H.mp4");
                    break;

                case 2:
                    video3dfx.PlayVideo("PHA_Siren_StartleScare_3DFX_H.mp4");
                    break;

                case 3:
                    video3dfx.PlayVideo("PHA_Poltergeist_StartleScare_3DFX_H.mp4");
                    break;
                }
                fog.SetValue(false);
                i.WaitFor(S(2.0));
                spiderCeilingDrop.SetValue(false);
                i.WaitFor(S(3.0));
            })
            .TearDown(i =>
            {
                pulsatingEffect2.Stop();
                Thread.Sleep(S(5));
            });

            subVideo
            .RunAction(i =>
            {
                while (!i.IsCancellationRequested)
                {
                    string videoFile;
                    while (true)
                    {
                        videoFile = videoFiles[random.Next(videoFiles.Length)];
                        if (videoFiles.Length == 1 || videoFile != currentVideoFile)
                        {
                            break;
                        }
                    }

                    currentVideoFile = videoFile;
                    video2.PlayVideo(videoFile);
                    i.WaitFor(S(60));
                }
            });

            subFinal
            .LockWhenRunning(10, candyEyes, underGeorge)
            .RunAction(i =>
            {
                pulsatingEffect2.Stop();
                pulsatingEffect1.Start();
                candyEyes.SetValue(true);
                underGeorge.SetStrobeSpeed(0.5, i.Token);
                underGeorge.SetBrightness(1.0, i.Token);
                audioPop.PlayEffect("laugh.wav", 1.0, 0.0);
                for (int r = 0; r < 2; r++)
                {
                    george1.SetValue(true);
                    i.WaitFor(S(0.2));
                    george1.SetValue(false);
                    i.WaitFor(S(0.2));
                }
                i.WaitFor(S(1));
                audioDIN.PlayEffect("125919__klankbeeld__horror-what-are-you-doing-here-cathedral.wav");
                underGeorge.SetStrobeSpeed(0.0, i.Token);
                underGeorge.SetBrightness(0.0, i.Token);
                i.WaitFor(S(1));

                popper.SetValue(true);
                audioPop.PlayEffect("180 Babbling Lunatic.wav", 0.0, 1.0);
                i.WaitFor(S(3));
                popper.SetValue(false);

                i.WaitFor(S(8));

                Exec.MasterEffect.Fade(underGeorge, 0.5, 0.0, 1000, token: i.Token);
                //                    underGeorge.SetBrightness(0.3, i.Token);
                i.WaitFor(S(0.5));
                george2.SetValue(true);
                i.WaitFor(S(1.0));
                george2.SetValue(false);
                i.WaitFor(S(1.0));
                //                    underGeorge.SetBrightness(0.0, i.Token);
            })
            .TearDown(i =>
            {
                candyEyes.SetValue(false);
                pulsatingEffect1.Stop();
                Thread.Sleep(S(5));
            });


            catSeq.WhenExecuted
            .Execute(instance =>
            {
                var maxRuntime = System.Diagnostics.Stopwatch.StartNew();

                catLights.SetValue(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(instance =>
            {
                catLights.SetValue(false);
            });

            motionSeq.WhenExecuted
            .Execute(instance =>
            {
                //video2.PlayVideo("DancingDead_Wall_HD.mp4");

                //                    instance.WaitFor(S(10));
            })
            .TearDown(instance =>
            {
            });
        }
コード例 #9
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);
        }
コード例 #10
0
        public HalloweenScene2013B(IEnumerable <string> args)
        {
            this.lastFogRun = DateTime.Now;
            stateMachine    = new Controller.EnumStateMachine <States>("Main");

            pulsatingEffect1 = new Effect.Pulsating(S(2), 0.1, 0.5, false);
            pulsatingEffect2 = new Effect.Pulsating(S(2), 0.2, 0.8, false);
            flickerEffect    = new Effect.Flicker(0.4, 0.6, false);
            flickerEffect2   = new Effect.Flicker(0.4, 0.6, false);
            popOutEffect     = new Effect.PopOut(S(1));

            hoursSmall          = new OperatingHours("Hours Small");
            hoursFull           = new OperatingHours("Hours Full");
            buttonMotionCat     = new DigitalInput("Walkway Motion");
            buttonMotionBeauty  = new DigitalInput("Beauty Motion");
            buttonTriggerStairs = new DigitalInput("Stairs Trigger 1");
            buttonTriggerPopup  = new DigitalInput("Popup Trigger");
            buttonTestA         = new DigitalInput("Test A");
            buttonTestB         = new DigitalInput("Test B");
            buttonTestC         = new DigitalInput("Test C");
            buttonTestSpider    = new DigitalInput("Spider");

            switchDeadendDrive = new Switch("Deadend dr");
            catLights          = new Switch("Cat lights");
            catFan             = new Switch("Cat");

            georgeMotor    = new MotorWithFeedback("George Motor");
            lightPopup     = new StrobeDimmer("Popup light");
            lightGeorge    = new StrobeColorDimmer("George light");
            lightBeauty    = new StrobeColorDimmer("Beauty light");
            lightFloor     = new StrobeColorDimmer("Floor light");
            lightSign      = new StrobeColorDimmer("Sign");
            skullsLight    = new Dimmer("Skulls");
            lightTreeGhost = new Dimmer("Ghosts in tree");
            skullsLight2   = new Dimmer("Skulls 2");
            lightSpiderWeb = new Dimmer("Spiderweb");
            lightEyes      = new Switch("Eyes");

            audioCat    = new AudioPlayer("Audio Cat");
            audioGeorge = new AudioPlayer("Audio George");
            audioBeauty = new AudioPlayer("Audio Beauty");
            audioSpider = new AudioPlayer("Audio Spider");

            switchHand        = new Switch("Hand");
            switchHead        = new Switch("Head");
            switchDrawer1     = new Switch("Drawer 1");
            switchDrawer2     = new Switch("Drawer 2");
            switchPopEyes     = new Switch("Pop Eyes");
            switchPopUp       = new Switch("Pop Up");
            switchSpider      = new Switch("Spider");
            switchSpiderEyes1 = new Switch("Spider Eyes 1");
            switchSpiderEyes2 = new Switch("Spider Eyes 2");
            switchFog         = new Switch("Fog");

            allPixels = new VirtualPixel1D(28 + 50);

            // Cat
            raspberry1.DigitalInputs[0].Connect(buttonMotionCat);
            raspberry1.DigitalInputs[4].Connect(buttonTriggerStairs, true);
            raspberry1.DigitalOutputs[0].Connect(switchDeadendDrive);
            raspberry1.DigitalOutputs[1].Connect(switchFog);
            raspberry1.Motor.Connect(georgeMotor);

            raspberry1.Connect(audioCat);

            // Beauty
            raspberry2.Connect(audioBeauty);
            raspberry2.DigitalOutputs[7].Connect(switchHand);
            raspberry2.DigitalOutputs[2].Connect(switchHead);
            raspberry2.DigitalOutputs[5].Connect(switchDrawer1);
            raspberry2.DigitalOutputs[6].Connect(switchDrawer2);
            raspberry2.DigitalOutputs[3].Connect(switchPopEyes);
            raspberry2.DigitalOutputs[4].Connect(switchPopUp);

            raspberry2.DigitalInputs[5].Connect(buttonMotionBeauty, true);
            raspberry2.DigitalInputs[6].Connect(buttonTriggerPopup, true);

            // Background/George
            raspberry3.Connect(audioGeorge);

            // Spider
            raspberry4.Connect(audioSpider);

            raspberry4.DigitalOutputs[0].Connect(switchSpider);
            raspberry4.DigitalOutputs[2].Connect(switchSpiderEyes1);
            raspberry4.DigitalOutputs[3].Connect(switchSpiderEyes2);
        }