示例#1
0
        public TestMidi1(IEnumerable<string> args)
        {
            p = new PhysicalDevices
            {
                SmallLED = new Physical.SmallRGBStrobe(testLight1, 1),
                CatAir = new Physical.GenericDimmer(catAir, 10),
                CatLight = new Physical.GenericDimmer(catLight, 11)
            };

            inputBrightness.ConnectTo(testLight1.InputBrightness);
            inputBrightness.ConnectTo(testLight2.InputBrightness);

            acnOutput.Connect(p.SmallLED, 20);
            acnOutput.Connect(p.CatAir, 20);
            acnOutput.Connect(p.CatLight, 20);

            buttonTest2.ConnectTo(catAir.Control);

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

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

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

            inputBrightness.Output.Subscribe(x =>
                {
                    midiOutput.Send(0, 81, x.Value.GetByteScale(127));
                });
            midiInput.Controller(1, 1).Controls(inputBrightness.Control);
            midiInput.Controller(0, 81).Controls(inputBrightness.Control);
            midiInput.Controller(1, 2).Controls(inputH.Control);
            midiInput.Controller(1, 3).Controls(inputS.Control);
            midiInput.Controller(1, 4).Controls(inputV.Control);

            midiInput.Note(1, 36).Controls(buttonTest1.Control);
            midiInput.Note(1, 37).Controls(buttonTest2.Control);
            midiInput.Note(1, 38).Controls(buttonTest3.Control);

            buttonTest2.Output.Subscribe(catAir.Control);
            buttonTest3.Output.Subscribe(catLight.Control);

            buttonTest1.Output.Subscribe(x =>
            {
                if (x)
                {
                    testLight1.RunEffect(new Effect2.Fader(0.0, 1.0), S(1.0));
                }
                else
                {
                    if (testLight1.Brightness > 0)
                        testLight1.RunEffect(new Effect2.Fader(1.0, 0.0), S(1.0));
                }
            });
        }
示例#2
0
        public TestMidi1(IEnumerable <string> args)
        {
            p = new PhysicalDevices
            {
                SmallLED = new Physical.SmallRGBStrobe(testLight1, 1),
                CatAir   = new Physical.GenericDimmer(catAir, 10),
                CatLight = new Physical.GenericDimmer(catLight, 11)
            };

            inputBrightness.ConnectTo(testLight1.InputBrightness);
            inputBrightness.ConnectTo(testLight2.InputBrightness);

            acnOutput.Connect(p.SmallLED, 20);
            acnOutput.Connect(p.CatAir, 20);
            acnOutput.Connect(p.CatLight, 20);

            buttonTest2.ConnectTo(catAir.Control);

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

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

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

            inputBrightness.Output.Subscribe(x =>
            {
                midiOutput.Send(0, 81, x.Value.GetByteScale(127));
            });
            midiInput.Controller(1, 1).Controls(inputBrightness.Control);
            midiInput.Controller(0, 81).Controls(inputBrightness.Control);
            midiInput.Controller(1, 2).Controls(inputH.Control);
            midiInput.Controller(1, 3).Controls(inputS.Control);
            midiInput.Controller(1, 4).Controls(inputV.Control);

            midiInput.Note(1, 36).Controls(buttonTest1.Control);
            midiInput.Note(1, 37).Controls(buttonTest2.Control);
            midiInput.Note(1, 38).Controls(buttonTest3.Control);


            buttonTest2.Output.Subscribe(catAir.Control);
            buttonTest3.Output.Subscribe(catLight.Control);

            buttonTest1.Output.Subscribe(x =>
            {
                if (x)
                {
                    testLight1.RunEffect(new Effect2.Fader(0.0, 1.0), S(1.0));
                }
                else
                {
                    if (testLight1.Brightness > 0)
                    {
                        testLight1.RunEffect(new Effect2.Fader(1.0, 0.0), S(1.0));
                    }
                }
            });
        }