示例#1
0
        public TestOSC(IEnumerable<string> args)
        {
            allPixels = new VirtualPixel1D("All Pixels", 28 + 50);

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

            testDimmer = new Dimmer("Test");

            this.oscServer = new Expander.OscServer(5555);
        }
示例#2
0
        public IceBucket(IEnumerable <string> args)
        {
            stateMachine     = new Controller.EnumStateMachine <States>("Main");
            pulsatingEffect1 = new Effect.Pulsating(S(2), 0.05, 1.0, false);
            lightSpot        = new StrobeColorDimmer("Spotlight");

            inputArm      = new DigitalInput("Arm");
            inputDisarm   = new DigitalInput("Disarm");
            inputDump     = new DigitalInput("Dump");
            inputNextSong = new DigitalInput("Next Song");
            inputReset    = new DigitalInput("Reset");
            relayStart    = new Switch("Relay Start");
            relayDirA     = new Switch("Relay Dir A");
            relayDirB     = new Switch("Relay Dir B");

            audioPlayer = new AudioPlayer("Audio Player");

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

            stateMachine.For(States.Armed)
            .SetUp(() =>
            {
                pulsatingEffect1.Start();
                audioPlayer.PlayEffect("Nuclear-alarm");
            })
            .Execute(instance =>
            {
                while (!instance.IsCancellationRequested)
                {
                    instance.WaitFor(S(1));
                }
            })
            .TearDown(() =>
            {
                audioPlayer.PauseFX();
                pulsatingEffect1.Stop();
            });

            stateMachine.For(States.Dumped)
            .Execute(instance =>
            {
                while (!instance.IsCancellationRequested)
                {
                    instance.WaitFor(S(1));
                }
            });
            ;

            stateMachine.SetBackgroundState(States.Idle);
        }
示例#3
0
        public IceBucket(IEnumerable<string> args)
        {
            stateMachine = new Controller.EnumStateMachine<States>("Main");
            pulsatingEffect1 = new Effect.Pulsating(S(2), 0.05, 1.0, false);
            lightSpot = new StrobeColorDimmer("Spotlight");

            inputArm = new DigitalInput("Arm");
            inputDisarm = new DigitalInput("Disarm");
            inputDump = new DigitalInput("Dump");
            inputNextSong = new DigitalInput("Next Song");
            inputReset = new DigitalInput("Reset");
            relayStart = new Switch("Relay Start");
            relayDirA = new Switch("Relay Dir A");
            relayDirB = new Switch("Relay Dir B");

            audioPlayer = new AudioPlayer("Audio Player");

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

            stateMachine.For(States.Armed)
                .SetUp(() =>
                {
                    pulsatingEffect1.Start();
                    audioPlayer.PlayEffect("Nuclear-alarm");
                })
                .Execute(instance =>
                {
                    while (!instance.IsCancellationRequested)
                    {
                        instance.WaitFor(S(1));
                    }
                })
                .TearDown(() =>
                {
                    audioPlayer.PauseFX();
                    pulsatingEffect1.Stop();
                });

            stateMachine.For(States.Dumped)
                .Execute(instance =>
                {
                    while (!instance.IsCancellationRequested)
                    {
                        instance.WaitFor(S(1));
                    }
                });
            ;

            stateMachine.SetBackgroundState(States.Idle);
        }
示例#4
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");

            this.oscServer = new Expander.OscServer(9999);
        }
示例#5
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);
        }
示例#6
0
        public Xmas2013scene(IEnumerable<string> args)
        {
            hours = new OperatingHours("Hours");

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

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

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

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

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

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

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

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

            this.oscServer = new Expander.OscServer(10000);
        }
示例#7
0
        private void Initialize(string hostEntry, int listenPort)
        {
            var hostParts = hostEntry.Split(':');

            if (hostParts.Length != 2)
            {
                throw new ArgumentException("Requires a host entry with this format [IP:port]");
            }

            this.hostName = hostParts[0];
            this.hostPort = int.Parse(hostParts[1]);

            var ipHostEntry = System.Net.Dns.GetHostAddresses(this.hostName);

            this.oscClient = new OscClient(ipHostEntry.First(), this.hostPort);

            this.DigitalInputs = new PhysicalDevice.DigitalInput[8];
            for (int index = 0; index < this.DigitalInputs.Length; index++)
            {
                this.DigitalInputs[index] = new PhysicalDevice.DigitalInput();
            }

            this.DigitalOutputs = new PhysicalDevice.DigitalOutput[8];
            for (int index = 0; index < this.DigitalOutputs.Length; index++)
            {
                WireupOutput(index);
            }

            this.audioTrackStart = new Subject <string>();

            this.Motor = new PhysicalDevice.MotorWithFeedback((target, speed, timeout) =>
            {
                this.oscClient.Send("/motor/exec", 1, target, (int)(speed * 100), timeout.TotalSeconds.ToString("F0"));
            });

            this.oscServer = new OscServer(listenPort);
            this.oscServer.RegisterAction("/init", msg =>
            {
                if (!CheckIdempotence(msg))
                {
                    return;
                }

                this.log.Information("Raspberry is up");
            });

            this.oscServer.RegisterAction("/audio/trk/done", msg =>
            {
                if (!CheckIdempotence(msg))
                {
                    return;
                }

                log.Debug("Audio track done");
                RaiseAudioTrackDone();
            });

            this.oscServer.RegisterAction("/video/done", msg =>
            {
                if (!CheckIdempotence(msg))
                {
                    return;
                }

                log.Debug("Video done");
                RaiseVideoTrackDone();
            });

            this.oscServer.RegisterAction <string>("/audio/bg/start", (msg, data) =>
            {
                if (!CheckIdempotence(msg))
                {
                    return;
                }

                if (data.Count() >= 2)
                {
                    string track = data.Skip(1).First();
                    log.Debug("Playing background track {0}", track);
                    this.audioTrackStart.OnNext(track);
                }
            });

            this.oscServer.RegisterAction <string, int>("/input", (msg, id, data) =>
            {
                if (!CheckIdempotence(msg))
                {
                    return;
                }

                if (data.Count() >= 2)
                {
                    var values = data.ToArray();
                    this.log.Information("Input {0} set to {1}", values[0], values[1]);

                    if (values[0] >= 0 && values[0] <= 7)
                    {
                        this.DigitalInputs[values[0]].Trigger(values[1] != 0);
                    }
                }
            });

            this.oscServer.RegisterAction("/motor/feedback", msg =>
            {
                if (!CheckIdempotence(msg))
                {
                    return;
                }

                if (msg.Data.Count() >= 2)
                {
                    var values = msg.Data.ToArray();

                    int motorChn    = int.Parse(values[0].ToString());
                    string motorPos = values[1].ToString();

                    if (motorPos == "FAIL")
                    {
                        this.log.Information("Motor {0} failed", motorChn);

                        if (motorChn == 1)
                        {
                            this.Motor.Trigger(null, true);
                        }
                    }
                    else
                    {
                        if (motorPos.StartsWith("S"))
                        {
                            int pos = int.Parse(motorPos.Substring(1));
                            this.log.Information("Motor {0} starting at position {1}", motorChn, pos);
                        }
                        else if (motorPos.StartsWith("E"))
                        {
                            int pos = int.Parse(motorPos.Substring(1));
                            this.log.Information("Motor {0} ending at position {1}", motorChn, pos);

                            if (motorChn == 1)
                            {
                                this.Motor.Trigger(pos, false);
                            }
                        }
                        else
                        {
                            int pos = int.Parse(motorPos);
                            log.Debug("Motor {0} at position {1}", motorChn, pos);
                        }
                    }
                }
            });

            this.DigitalInputs = new PhysicalDevice.DigitalInput[8];
            for (int index = 0; index < this.DigitalInputs.Length; index++)
            {
                this.DigitalInputs[index] = new PhysicalDevice.DigitalInput();
            }

            Executor.Current.Register(this);
        }
        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);
        }