Esempio n. 1
0
        public static IValueOut CreateValueOutput(this IPluginHost host, OutputAttribute attribute, Type type)
        {
            attribute = NormalizePinAttribute(attribute, type);

            IValueOut result = null;

            host.CreateValueOutput(attribute.Name, attribute.Dimension, attribute.DimensionNames, (TSliceMode)attribute.SliceMode, (TPinVisibility)attribute.Visibility, out result);
            switch (attribute.Dimension)
            {
            case 2:
                result.SetSubType2D(attribute.MinValue, attribute.MaxValue, attribute.StepSize, attribute.DefaultValues[0], attribute.DefaultValues[1], attribute.IsBang, attribute.IsToggle, attribute.AsInt);
                break;

            case 3:
                result.SetSubType3D(attribute.MinValue, attribute.MaxValue, attribute.StepSize, attribute.DefaultValues[0], attribute.DefaultValues[1], attribute.DefaultValues[2], attribute.IsBang, attribute.IsToggle, attribute.AsInt);
                break;

            case 4:
                result.SetSubType4D(attribute.MinValue, attribute.MaxValue, attribute.StepSize, attribute.DefaultValues[0], attribute.DefaultValues[1], attribute.DefaultValues[2], attribute.DefaultValues[3], attribute.IsBang, attribute.IsToggle, attribute.AsInt);
                break;

            default:
                result.SetSubType(attribute.MinValue, attribute.MaxValue, attribute.StepSize, attribute.DefaultValue, attribute.IsBang, attribute.IsToggle, attribute.AsInt);
                break;
            }
            result.Order = attribute.Order;
            return(result);
        }
Esempio n. 2
0
        //this method is called by vvvv when the node is created
        public void SetPluginHost(IPluginHost Host)
        {
            //assign host
            FHost = Host;

            //create inputs
            FHost.CreateValueInput("Input 1 ", 4, null, TSliceMode.Dynamic, TPinVisibility.True, out FMyValueInput1);
            FMyValueInput1.SetSubType4D(double.MinValue, double.MaxValue, 0.01, 1, 0, 0, 0, false, false, false);

            FHost.CreateValueInput("Input 2 ", 4, null, TSliceMode.Dynamic, TPinVisibility.True, out FMyValueInput2);
            FMyValueInput2.SetSubType4D(double.MinValue, double.MaxValue, 0.01, 0, 0, 0, 0, false, false, false);

            FHost.CreateValueInput("Input 3 ", 4, null, TSliceMode.Dynamic, TPinVisibility.True, out FMyValueInput3);
            FMyValueInput3.SetSubType4D(double.MinValue, double.MaxValue, 0.01, 1, 0, 0, 0, false, false, false);

            FHost.CreateValueInput("Input 4 ", 4, null, TSliceMode.Dynamic, TPinVisibility.True, out FMyValueInput4);
            FMyValueInput4.SetSubType4D(double.MinValue, double.MaxValue, 0.01, 0, 0, 0, 0, false, false, false);

            //create outputs

            FHost.CreateValueOutput("Output 1 ", 4, null, TSliceMode.Dynamic, TPinVisibility.True, out FMyValueOutput1);
            FMyValueOutput1.SetSubType4D(double.MinValue, double.MaxValue, 0.01, 0, 0, 0, 0, false, false, false);

            FHost.CreateValueOutput("Output 2 ", 4, null, TSliceMode.Dynamic, TPinVisibility.True, out FMyValueOutput2);
            FMyValueOutput2.SetSubType4D(double.MinValue, double.MaxValue, 0.01, 0, 0, 0, 0, false, false, false);
        }
Esempio n. 3
0
        public void Configurate(IPluginConfig Input)
        {
/*
 * MotionPlus is included in the highly beta 1.8 version of brian peeks library
 * http://wiimotelib.codeplex.com/releases/view/30401
 *
 * so far it only supports raw accelleration data, no tilt no nothing
 *
 *                      double motionplus;
 *                      FPinMotionPlus.GetValue(0, out motionplus);
 *
 *                      if ((motionplus==1d) != FUseMotionPlus) {
 *                              FUseMotionPlus = (motionplus==1d);
 *
 *                              if (FPinMotionPlusOutputAccelleration != null) FHost.DeletePin(FPinMotionPlusOutputAccelleration);
 * //				if (FPinMotionPlusOutputTilt!= null)FHost.DeletePin(FPinMotionPlusOutputTilt);
 *
 *                              if (FUseMotionPlus) {
 *                                      FHost.CreateValueOutput("MotionPlusAccelleration", 3, new string[3]{"X", "Y", "Z"}, TSliceMode.Dynamic, TPinVisibility.True, out FPinMotionPlusOutputAccelleration);
 *                                      FPinMotionPlusOutputAccelleration.SetSubType3D(double.MinValue, double.MaxValue, 0.0001, 0, 0, 0, false, false, false);
 *
 * //					FHost.CreateValueOutput("MotionPlusTilt", 3, new string[3]{"Pitch", "Roll", "Yaw"}, TSliceMode.Dynamic, TPinVisibility.True, out FPinMotionPlusOutputTilt);
 * //					FPinMotionPlusOutputTilt.SetSubType3D(double.MinValue, double.MaxValue, 0.0001, 0, 0, 0, false, false, false);
 *
 *                                      FRemote.InitializeMotionPlus();
 *                              }
 *                      }
 */


            int newExt;

            FPinConfigExtension.GetOrd(0, out newExt);

            if (newExt != FExtension)
            {
                if (FPinOutputExtAccelleration != null)
                {
                    FHost.DeletePin(FPinOutputExtAccelleration);
                }
                if (FPinOutputExtTilt != null)
                {
                    FHost.DeletePin(FPinOutputExtTilt);
                }
                if (FPinOutputExtButtons != null)
                {
                    FHost.DeletePin(FPinOutputExtButtons);
                }
                if (FPinOutputExtCursor != null)
                {
                    FHost.DeletePin(FPinOutputExtCursor);
                }
                if (FPinOutputExtControls != null)
                {
                    FHost.DeletePin(FPinOutputExtControls);
                }

                if (FPinOutputExtJoystickLeft != null)
                {
                    FHost.DeletePin(FPinOutputExtJoystickLeft);
                }
                if (FPinOutputExtJoystickRight != null)
                {
                    FHost.DeletePin(FPinOutputExtJoystickRight);
                }
                if (FPinOutputExtControls2 != null)
                {
                    FHost.DeletePin(FPinOutputExtControls2);
                }

                FExtension = newExt;

                switch (FExtension)
                {
                case 1:                 //Nunchuk
                    FHost.Log(TLogType.Debug, "Nunchuk");

                    FHost.CreateValueOutput("Nunchuk Buttons", 2, new string[2] {
                        "C", "Z"
                    }, TSliceMode.Dynamic, TPinVisibility.True, out FPinOutputExtButtons);
                    FPinOutputExtButtons.SetSubType2D(0, 1, 1, 0, 0, false, true, false);

                    FHost.CreateValueOutput("Nunchuk Accelleration", 3, null, TSliceMode.Dynamic, TPinVisibility.True, out FPinOutputExtAccelleration);
                    FPinOutputExtAccelleration.SetSubType3D(double.MinValue, double.MaxValue, 0.0001, 0, 0, 0, false, false, false);

                    FHost.CreateValueOutput("Nunchuk Tilt", 3, new string[3] {
                        "Pitch", "Roll", "Yaw"
                    }, TSliceMode.Dynamic, TPinVisibility.True, out FPinOutputExtTilt);
                    FPinOutputExtTilt.SetSubType3D(double.MinValue, double.MaxValue, 0.0001, 0, 0, 0, false, false, false);

                    FHost.CreateValueOutput("Nunchuk Joystick", 2, null, TSliceMode.Dynamic, TPinVisibility.True, out FPinOutputExtJoystickLeft);
                    FPinOutputExtJoystickLeft.SetSubType2D(-1, 1, 0.0001, 0, 0, false, false, false);
                    break;

                case 2:                 // Classic
                    FHost.Log(TLogType.Debug, "Classic");

                    FHost.CreateValueOutput("Classic Cursor", 4, new string[4] {
                        "Up", "Down", "Left", "Right"
                    }, TSliceMode.Single, TPinVisibility.True, out FPinOutputExtCursor);
                    FPinOutputExtCursor.SetSubType4D(0, 1, 1, 0, 0, 0, 0, false, true, false);

                    FHost.CreateValueOutput("Classic Buttons", 4, new string[4] {
                        "A", "B", "X", "Y"
                    }, TSliceMode.Single, TPinVisibility.True, out FPinOutputExtButtons);
                    FPinOutputExtButtons.SetSubType4D(0, 1, 1, 0, 0, 0, 0, false, true, false);

                    FHost.CreateValueOutput("Classic System", 3, new string[3] {
                        "Plus", "Minus", "Home"
                    }, TSliceMode.Single, TPinVisibility.True, out FPinOutputExtControls);
                    FPinOutputExtControls.SetSubType3D(0, 1, 1, 0, 0, 0, false, true, false);

                    FHost.CreateValueOutput("Classic Joystick Left", 2, null, TSliceMode.Single, TPinVisibility.True, out FPinOutputExtJoystickLeft);
                    FPinOutputExtJoystickLeft.SetSubType2D(-1, 1, 0.0001, 0, 0, false, false, false);

                    FHost.CreateValueOutput("Classic Joystick Right", 2, null, TSliceMode.Single, TPinVisibility.True, out FPinOutputExtJoystickRight);
                    FPinOutputExtJoystickRight.SetSubType2D(-1, 1, 0.0001, 0, 0, false, false, false);

                    FHost.CreateValueOutput("Classic Back Control", 4, new string[4] {
                        "Left", "Right", "Left", "Right"
                    }, TSliceMode.Single, TPinVisibility.True, out FPinOutputExtControls2);
                    FPinOutputExtControls2.SetSubType4D(0, 1, 1, 0, 0, 0, 0, false, true, false);

                    break;

                case 3:                 //BalanceBoard
                    FHost.Log(TLogType.Debug, "BalanceBoard");

                    FHost.CreateValueOutput("Balance Board Weight (kg)", 1, null, TSliceMode.Single, TPinVisibility.True, out FPinOutputExtButtons);
                    FPinOutputExtButtons.SetSubType(0, double.MaxValue, 1, 0, false, false, false);

                    FHost.CreateValueOutput("Balance Board Corners", 1, null, TSliceMode.Dynamic, TPinVisibility.True, out FPinOutputExtAccelleration);
                    FPinOutputExtAccelleration.SetSubType(double.MinValue, double.MaxValue, 0.0001, 0, false, false, false);

                    //FHost.CreateValueOutput("Balance Board Corners", 4, new string[4]{"TL", "TR", "BL", "BR"}, TSliceMode.Dynamic, TPinVisibility.True, out FPinOutputExtAccelleration);
                    //FPinOutputExtAccelleration.SetSubType4D(double.MinValue, double.MaxValue, 0.0001, 0, 0, 0, 0, false, false, false);

                    FHost.CreateValueOutput("Balance Board Center Of Gravity", 2, null, TSliceMode.Dynamic, TPinVisibility.True, out FPinOutputExtJoystickLeft);
                    FPinOutputExtJoystickLeft.SetSubType2D(-1, 1, 0.0001, 0, 0, false, false, false);
                    break;

                case 4:                 // Guitar
                    FHost.Log(TLogType.Debug, "Guitar");

                    FHost.CreateValueOutput("Guitar Buttons", 4, new string[4] {
                        "Plus", "Minus", "StrumUp", "StrumDown"
                    }, TSliceMode.Dynamic, TPinVisibility.True, out FPinOutputExtButtons);
                    FPinOutputExtButtons.SetSubType4D(0, 1, 1, 0, 0, 0, 0, false, true, false);

                    FHost.CreateValueOutput("Guitar Color Bar", 1, null, TSliceMode.Dynamic, TPinVisibility.True, out FPinOutputExtControls);
                    FPinOutputExtControls.SetSubType(0, 1, 1, 0, false, true, false);

                    FHost.CreateValueOutput("Guitar Whammy Bar", 1, null, TSliceMode.Single, TPinVisibility.True, out FPinOutputExtJoystickLeft);
                    FPinOutputExtJoystickLeft.SetSubType2D(0, 1, 0.0001, 0, 0, false, false, false);

                    FHost.CreateValueOutput("Guitar Joystick", 2, null, TSliceMode.Single, TPinVisibility.True, out FPinOutputExtJoystickRight);
                    FPinOutputExtJoystickRight.SetSubType2D(-1, 1, 0.0001, 0, 0, false, false, false);

                    break;

                default:                 // None
                    FHost.Log(TLogType.Debug, "No Extension");

                    break;
                }
            }
            FInvalidate = true;
        }
Esempio n. 4
0
        //this method is called by vvvv when the node is created
        public void SetPluginHost(IPluginHost Host)
        {
            FHost = Host;

            FHost.CreateStringInput("Wiimote ID", TSliceMode.Dynamic, TPinVisibility.OnlyInspector, out FPinInputID);
            FPinInputID.SetSubType("-1", false);

            FHost.CreateValueInput("Enable", 1, null, TSliceMode.Single, TPinVisibility.True, out FPinInputEnable);
            FPinInputEnable.SetSubType(0, 1, 1, 0, false, true, false);

            FHost.CreateValueInput("LED", 4, new string[4] {
                "0", "1", "2", "3"
            }, TSliceMode.Dynamic, TPinVisibility.True, out FPinInputLED);
            FPinInputLED.SetSubType4D(0, 1, 1, 0, 0, 0, 0, false, true, false);

            FHost.CreateValueInput("Rumble", 1, null, TSliceMode.Dynamic, TPinVisibility.True, out FPinInputRumble);
            FPinInputRumble.SetSubType(0, 1, 1, 0, false, true, false);

            FHost.UpdateEnum("WiimoteInfraredMode", "Extended", new string[4] {
                "Full", "Extended", "Basic", "Off"
            });

            FHost.CreateEnumInput("Infrared Mode", TSliceMode.Dynamic, TPinVisibility.True, out FPinInputMode);
            FPinInputMode.SetSubType("WiimoteInfraredMode");

            FHost.CreateValueFastInput("Calibration ZeroG", 3, null, TSliceMode.Dynamic, TPinVisibility.OnlyInspector, out FPinInputCalibrationZeroG);
            FPinInputCalibrationZeroG.SetSubType3D(0, 0xFF, 1, 126, 126, 131, false, false, true);

            FHost.CreateValueFastInput("Calibration OneG", 3, null, TSliceMode.Dynamic, TPinVisibility.OnlyInspector, out FPinInputCalibrationOneG);
            FPinInputCalibrationOneG.SetSubType3D(0, 0xFF, 1, 151, 151, 151, false, false, true);

            FHost.CreateValueInput("Calibrate", 1, null, TSliceMode.Single, TPinVisibility.OnlyInspector, out FPinInputCalibrate);
            FPinInputCalibrate.SetSubType(0, 1, 1, 0, true, false, false);

            FHost.CreateValueInput("Force Reset", 1, null, TSliceMode.Single, TPinVisibility.OnlyInspector, out FPinForceReset);
            FPinForceReset.SetSubType(0, 1, 1, 0, true, false, false);

            FHost.UpdateEnum("WiimoteExtensionEnum", "none", new string[5] {
                "none", "Nunchuk", "Classic", "BalanceBoard", "Guitar"
            });
            FHost.CreateEnumConfig("Extension", TSliceMode.Single, TPinVisibility.True, out FPinConfigExtension);
            FPinConfigExtension.SetSubType("WiimoteExtensionEnum");

//			FHost.CreateValueConfig("MotionPlus", 1, null, TSliceMode.Single, TPinVisibility.True, out FPinMotionPlus);
//			FPinMotionPlus.SetSubType(0, 1, 1, 0, false, true, false);

            //create outputs
            FHost.CreateStringOutput("Available Wiimotes", TSliceMode.Dynamic, TPinVisibility.OnlyInspector, out FPinOutputAvailable);
            FPinOutputAvailable.SetSubType("none", false);

            FHost.CreateStringOutput("Working", TSliceMode.Single, TPinVisibility.True, out FPinOutputWorking);
            FPinOutputWorking.SetSubType("Initializing", false);

            FHost.CreateStringOutput("Extension Found", TSliceMode.Single, TPinVisibility.True, out FPinOutputExtensionFound);
            FPinOutputExtensionFound.SetSubType("none", false);

            FHost.CreateValueOutput("Battery", 1, null, TSliceMode.Single, TPinVisibility.True, out FPinOutputBattery);
            FPinOutputBattery.SetSubType(double.MinValue, double.MaxValue, 0.0001, 0, false, false, false);

            FHost.CreateValueOutput("Cursor", 4, new string[4] {
                "Up", "Down", "Left", "Right"
            }, TSliceMode.Dynamic, TPinVisibility.True, out FPinOutputCursor);
            FPinOutputCursor.SetSubType4D(0, 1, 1, 0, 0, 0, 0, false, true, false);

            FHost.CreateValueOutput("Buttons", 4, new string[4] {
                "A", "B", "1", "2"
            }, TSliceMode.Dynamic, TPinVisibility.True, out FPinOutputButtons);
            FPinOutputButtons.SetSubType4D(0, 1, 1, 0, 0, 0, 0, false, true, false);

            FHost.CreateValueOutput("System", 3, new string[3] {
                "Plus", "Minus", "Home"
            }, TSliceMode.Dynamic, TPinVisibility.True, out FPinOutputControls);
            FPinOutputControls.SetSubType3D(0, 1, 1, 0, 0, 0, false, true, false);

            FHost.CreateValueOutput("Acceleration", 3, null, TSliceMode.Dynamic, TPinVisibility.True, out FPinOutputAccelleration);
            FPinOutputAccelleration.SetSubType3D(double.MinValue, double.MaxValue, 0.0001, 0, 0, 0, false, false, false);

            FHost.CreateValueOutput("Angle", 3, new string[3] {
                "Pitch", "Roll", "Yaw"
            }, TSliceMode.Dynamic, TPinVisibility.True, out FPinOutputTilt);
            FPinOutputTilt.SetSubType3D(double.MinValue, double.MaxValue, 0.0001, 0, 0, 0, false, false, false);

            FHost.CreateValueOutput("Infrared", 3, new string[3] {
                "X", "Y", "Size"
            }, TSliceMode.Dynamic, TPinVisibility.True, out FPinOutputInfraredBlobs);
            FPinOutputInfraredBlobs.SetSubType3D(0, 1023, 1, 0, 0, 0, false, false, true);

            Enable();
        }