Skip to content

GlovePIE GUI

Ravbug edited this page Jan 12, 2019 · 1 revision

GlovePIE has three tabs. The first tab is the script tab, and shows the name of the script file. You can write any script you want here. The third tab is the Variables tab which only works while your script is running, and shows the values of all the variables.

The second tab is the GUI tab. It can automatically generate a script using gesture recognition, or you can edit a script manually with the Graphical User Interface. Pretty cool! Once upon a time, GlovePIE’s GUI was just for MIDI, but not anymore, now it works for everything. Well, most of the main things.

The GUI is not the recommended way to make scripts, because it can sometimes be as hard to use as writing scripts manually and it is less powerful. Please don’t be afraid of writing scripts manually. Scripts are easier than you think.

You can also swap tabs by using the View menu.

Getting Started with the GUI

  1. Plug in any devices you want to use.
  2. Click on the GUI tab.
  3. If you want to use any Wii Remotes, hold down the 1 and 2 buttons together on all of them. They will automatically connect (if you have MS Bluetooth).
  4. Wait a few seconds while the devices are detected and started.
  5. Click on “Detect Output To Emulate”.
  6. Press a key, mouse button, or joystick button that the game normally uses.
  7. Click on “Detect Input”.
  8. Do any gesture, or press any combination of buttons, or both, (with double-clicks or holding-down if you want) that you want to use to control the game instead.
  9. Wait until the answer appears (if it doesn’t appear, turn the Wii Remotes up the right way), and check that what it says is what you wanted.
  10. If it is correct, click Apply. A star (*) will appear on the left next to what you chose, to show it has been set.
  11. Go back to step 5 to either set the next button or fix this one, unless you are finished.
  12. Save your script.
  13. Click the Run button to test or use your script.

Overview

The GUI is what is called a two-way tool, much like the graphical form designer in Delphi, C#, or Visual Basic. It is an alternate view of the same script, which you can edit with either the GUI, or the script editor, or both, swapping between the two as much as you want.

Some complex script elements, and anything inside IF statements, will just not appear in the GUI. The GUI won’t delete those things, it just won’t let you see them or change them until you switch back to the script view. The Script view will show everything you created in the GUI or the script editor and let you modify everything to your heart’s content. But all lines which are similar to “something = something”, or “something => something” will be shown in the GUI. Even lines like “x++” will be shown in the GUI (although they don’t make a lot of sense outside IF statements).

You can create, load or save your whole program using only the GUI. It will switch back to script view when you run it, but that is just because the GUI window chews through lots of memory and CPU. But you can switch straight back to GUI to edit it again. You don’t need to do any scripting to create GlovePIE scripts, or even to load other people’s.

The left hand side of the GUI is a list of all the output values that can be set with the GUI. This includes MIDI output, keyboard emulation, mouse emulation, joystick emulation (using PPJoy), and fake mouse cursors. Output values that have already been set to something, are marked with an asterisk (*). If you need to click on the drop-down button of a drop-down box to see the items that have been set, then it will be marked with the drop-down symbol (-v-).

The right hand side of the GUI specifies what input values you want to set the selected value to. You can set it to a constant value or mathematical expression by typing it in, or you can choose parts of the input devices from drop-down boxes. You can also choose what range you want the input to be mapped from or to, or, if you are more advanced, what functions you want to apply to it.

Output Device

You need to start from the top of the left hand side. You can choose “Detect Output to Emulate” if you want to automatically detect it, or you can set it manually.

The top drop-down box lists all the MIDI output devices followed by the keyboard, mouse, joystick and fake cursors. The MIDI output devices show both the number and the name. Choose a device from this list. You can see which output devices have something set in them already by the * symbol. If the chosen device doesn’t have anything set yet, but other devices do, you will see “-v-” after it, which means you can click on the drop down box to see which ones have *s.

If you want to use MIDI then I recommend choosing “Default MIDI”. That way you can choose later what the default MIDI device will be, without having to change your whole file. Another alternative is to choose the MIDI Mapper device. The MIDI Mapper was a complicated MIDI mapping device in Windows 3.1, but these days it is a mere shadow of its former self. From Windows 95 onwards the MIDI Mapper is just a single setting in Control Panel which chooses which MIDI device MIDI playback should go to. You can go to the MIDI page of Control Panel, by choosing MIDI from the CP-Settings menu in GlovePIE. Unlike “Default MIDI”, which can be changed by GlovePIE settings, the Mapper is considered to be just another MIDI device. If you need to output to more than one MIDI device at once, choose the MIDI device in this box, otherwise use the default.

If you chose Keyboard or Mouse then the two drop-down boxes underneath will disappear. That is because you can only emulate the combined system mouse or combined system keyboard, not multiple keyboards or multiple mice individually. Very few programs (eg. MAME) distinguish between multiple mice or keyboards. Also GlovePIE doesn’t group the keyboard and mouse values into categories yet. There is only a single category for all the keyboard and mouse values.

Channel Box

If you chose PPJoy Virtual Joystick, or Fake Cursor, then there will be a drop-down box underneath, listing all 16 possible Virtual Joysticks numbered 1 to 16, or listing 17 possible fake cursors, numbered from 0 to 16. You need to install PPJoy, and configure PPJoy to add virtual joysticks before they will work in GlovePIE, but they will all be listed here whether they have been installed or not.

If you chose a MIDI output device, then there will be two drop-down boxes underneath. The first drop-down box lists all the MIDI channels, plus the default channel. You should choose “Default Channel” so you can change it later without changing your entire file, unless you need to output on multiple channels at once. There are 16 channels, but if your device uses General Midi then Channel 10 will always be percussion. But all the other channels have their own individual settings, such as instrument and volume, and each channel can play multiple notes at once (of the same instrument).

Category Box

The category box only appears for MIDI. Everything else just uses a single category, because I was lazy. So skip to the next section if you don’t care about MIDI. But because MIDI has so many things you can set, I have grouped them into categories. There is obviously no default category, because that makes no sense.

You need to choose a category. The first category you should choose should probably be “Other Controls” because it allows you to change general settings, like which device is the default, and which channel is the default.

The categories are:

14-bit Controls 0..31

These set main parameters such as volume. They apply separately to each channel. These are the combined Coarse and Fine controls for the first 32 MIDI controls. The controls in this category will set both the coarse and fine settings at once, giving you 14-bits of precision (16 thousand possible levels). This is the recommended way to set these controls, (unless your MIDI system interprets the coarse and fine values as separate things). Some of them have pre-defined names and functions, some of them don’t. But you can set any of them that you like. It will set the coarse value using cc0 to cc31 messages and it will set the fine value using cc32 to cc63 messages.

7-bit Controls 64..95

Other controls have no separate coarse and fine settings. These ones just have a single value for 7 bits of precision (only 128 possible levels). This is the only way to set these controls. These are often used for pedals, buttons and things like that. They can control effects like Hold, Sustenuto, Portamento, Legato, Chorus, AttackTime, etc.

7-bit Controls 96..127

These controls don’t really do anything much. I think most of the later ones actually correspond to other MIDI messages, like All Notes Off, so it doesn’t make much sense to set them. But you can set all these ones anyway if you want, just for completeness.

Coarse Controls 0..31

These controls set only the coarse half of the MIDI value. Since the coarse half is 128 times as significant as the fine half, sometimes it makes sense to only use the coarse half. Some devices (particularly software ones) use the coarse and fine values separately for different things. The coarse control is set with cc0 to cc31 messages. Fine Controls 0..31 These controls set only the fine half of the MIDI value. Some devices (particularly software ones) use the coarse and fine values separately for different things. The coarse control is set with cc0 to cc31 messages. Other Controls This is where you set other important controls. It includes the important DeviceIn, DeviceOut, and DefaultChannel defaults. Set DeviceOut to a constant value of the MIDI output device you want to use. Set DefaultChannel to a constant value of the channel you want to use. Of the other controls, some apply to the channel like what instrument to use, what the overall channel pressure is, and what the Pitch Wheel is set to. Others apply to every channel, and use RPN messages, like Master Tuning, and Pitch Bend Range. Others use SysEx messages, like GeneralMidi, and SetupFile. You can set SetupFile to the name of a SysEx file (in quotation marks) that you want to send to the MIDI device at the start of your program. This is useful for all SysEx messages GlovePIE doesn’t support. Percussion These are the drum beats, symbol clashes, and other percussion sounds supported by General MIDI devices. These don’t change the instrument, they just turn a specific sound on or off. They all play on channel 10, no matter which channel you set them on, so it is best to set them on the default channel. You should set your MIDI device to General MIDI mode before using these, by setting GeneralMidi to true in “Other Controls”.

Notes Octaves 0..4

These are all the notes below Middle C. Octave 0 being the lowest (If you need a note deeper than C 0, use pitch bend). The octaves go from C to B. The notes are either true or false, representing On and Off. Setting a note to On this way will be like you hit the key with a velocity of 64/127 (50%). Setting a note to Off this way will be like you released the key with a velocity of 50%. You can also turn notes On and Off by setting their velocities using the categories below, if you want more control. If it is channel 10 on a General MIDI device then these play percussion rather than notes.

Notes Octaves 5..10

These are all the notes from Middle C (octave 5) upwards. Octave 10 is the highest, but it is incomplete, since MIDI devices only support 128 keys (If you need notes higher than G 10, use pitch bend). See above for the velocities.

Note Velocity o0..o4 and Note Velocity o5..o10

These are the key hit velocities for all the notes. Set the hit velocity to 0 to switch off the note (although the release velocity will always be 50% in GlovePIE). Set the hit velocity to anything else to turn on the note with that velocity. This is the better way to turn notes on and off when you need fine control over how hard they are struck.

Note Pressure o0..o4 and Note Pressure o5..o10

These are the key aftertouch, or note pressure. It is how much force you want holding down the key after it has been triggered. Most devices probably don’t support this.

The Item List

Once you have chosen which device, channel and category you want, there will be a list of items you can set for that category of that device. Items that have already been set to something will have an asterisk beside them.

When you have clicked on something here, the right hand side will show what it is set to, so you can modify it, or show a blank form you can fill in. Make sure you click Apply before you choose another item in this list, or whatever changes you made will be lost.

The Right Side

The right side is for the input action that you will do. This could be anything, Wii Remote gestures, buttons, keys, mouse, joystick, gamepad, etc.

You can click on the “Detect Input” button to automatically detect the gestures, button clicks, or whatever that you want to use. You can use any combination of things such as holding down a keyboard key and a mouse button while you shake the Wii Remote.

Or you can choose manually from the drop-down boxes. Some things can’t be detected yet, so you need to choose those things manually.

The Format Box

The first thing on the right hand side is the Format box. You don’t have to change it. It is purely a matter of preference. For some MIDI items, and all non-MIDI items, the format box will be locked to a particular format.

The format box specifies what format you want to specify the value in. If you prefer to think of the MIDI value as being between 0 and 127 then choose that. If you prefer to think of the MIDI value as being between 0 and 1 then choose that. Or choose any other format. Whichever one you choose is going to be how you have to specify the value in the boxes underneath, unless you use the “Convert From Source Range” button. Even if you choose “Convert From Source Range”, you still need to use the format you choose in the “Limit Output to Range” box.

But whatever format you specify the value in, the computer will later convert it into the correct format for MIDI messages when it sends them.

The default format is 0..1, which means you specify everything as a fraction between 0 and 1. Like 0.75 for 75%.

Limit Output To Range

If you never want to set the value to the maximum or minimum possible, but just want to adjust it within a certain range, then tick this “Limit Output To Range” check-box. When it is checked two more boxes appear specifying the maximum and minimum values (in whatever format you chose). So if you chose the format 0..1, but you don’t want the volume or whatever you are setting to go above 90%, check the box and put 0.9 in the maximum box. On the other hand, if you chose the format 0..127, then you need to put 114.3 in the box instead to stop it going over 90%. Note that decimals are allowed, and often necessary. The maximum and minimum values you choose here are what the source range will be converted to, if you choose “Convert From Source Range” below. You don’t need to choose anything here, most of the time.

Input Source

In the “Input Source” area, you need to choose where the input is going to come from, that you are using to control the output. Or you can choose a constant, or a mathematical expression that you want the output to be set to.

If you want to set it to a constant value, just type it into the “Part of device, or numeric value, or expression” box. Or choose a constant from the drop down box. If you want to set it to a string (text) value, then you need to put it in quotation marks. For example, file names need quotation marks around them. Then you just need to click “Apply”.

Input Device

On the other hand, if you want to use a device to control the output, then choose which kind of device in the first drop-down box called “Input Device”. The “Remote” device only works on COM Port 2, and only if you enable it from the Troubleshooter menu, and only for a few remotes, like the one that comes with the Pinnacle PCTV card. The Screen and Window devices only return constant values, and aren’t much use in most cases. But the other input devices work for most occasions.

If you don’t want to use any of the devices in the list, just leave it blank, and type what value you want to set it to in the next box.

Number

Once you have selected a device, the number box appears next to it. You normally leave it blank to just use the default device, but if you want to use a specific joystick, or a specific glove, or a specific mouse or keyboard, then choose the number here, starting from 1 being the first device of that kind. Sometimes there is a special 0 device for keyboards or mouses, which represents a virtual software device used for Remote Desktop in Windows XP Pro. MIDI device 0 is the MIDI Mapper, which you can set in Control Panel. But normal devices are numbered starting from 1, with 1 being the first device of that type. Reading multiple mice and keyboards independently is currently only implemented on Windows XP (or possibly Vista, which isn’t tested). To use all the mice combined into 1 virtual mouse, like Windows normally does, just leave the number box blank. The same applies to keyboards.

Part of device, or numeric value, or expression

In this box will be a list of all the different parts or values that device supports. It may be a long list, and some of them make no sense to use, so choose wisely.

By default, only the most useful or common values will be listed. Click on the “More…” button to add more values to the list (in addition to showing extra boxes). Click the “Less…” button to only show the most useful.

You can also type something in the box. For example, to use a glove gesture to control something, you should select “Glove” in the device box, and type in the five letter code in the “part of device” box, with one letter representing each finger like this:

xlrnn

In this case, x means don’t care (about the thumb), l (that’s the letter L) means the finger is straight (the index finger in this case), r means the finger is partly bent (the middle finger here) and n means the finger is very bent. The shape of the letter corresponds to its function.

Or if you leave the “device” box blank, you can type in any expression that GlovePIE understands in the “part of device” box.

For midi input, if you need to specify the channel, there is no box for it. So you need to add the channel to the front of this “part of device” box. Specify the channel like this: channel4.volume (where “volume” could be any part of the device).

Convert From Source Range

The “Convert From Source Range” box is used to convert the input device value from whatever range it uses (for example 0 to 63 for glove finger bends) into the correct values for your chosen format and output range. This box is automatically activated for some common device parts, but you can still turn it on or off manually if you want. When it is checked, two more boxes appear for the minimum and maximum. You should specify the minimum and maximum for the range in these boxes, using whatever units you choose in the “Units” box. If you want the range to be backwards, for example because the screen and glove use opposite directions for “y”, then just swap the min and max values around. So that max is smaller than min.

Units

Choose the units that you are using for the source value in the “Units” box. If there are no units for that particular value, then just leave it set to “Units”. The Units box is mostly used with the “Convert From Source Range” range, but it can also be used by itself to specify what units the value in the “part of device” box will use. Make sure you use appropriate units for the value you choose, for example speeds should be in meters per second or kilometres per hour rather than in something nonsensical for a speed, like degrees. Of course you can use degrees per second for angular velocities.

More… Button

The “More…” button is used to show extra, more complicated, information for advanced users. It allows you to choose a function to apply to the value (like Smooth), or to do arithmetic or other operations on the value. It also adds more values to the drop down box. To hide the extra options again, click “Less…”

Maths

The Maths box (when you click “More…”) lets you choose what you want to do to the value. It includes standard maths, like add or subtract, and it includes comparisons for comparing a value and returning true or false, and it also includes “and” and “or” for when you want to use multiple inputs. Note that in GlovePIE, “*” means multiplied by, “/” means divided by, “^” means raised to the power of, “>=” means is greater than or equal to, “<=” means is less than or equal to, “!=” means is not equal to, “xor” means either a or b but not both, “&” means only include the binary bits that are the same in both, “|” means include all binary bits that are true in either value, “div” means the whole number part of the division, “mod” means the remainder of dividing the two, “shl” means shift all the binary bits of the value left by some amount, and “shr” means shifting all the bits of the value right by some amount.

Note that “div” and “mod” don’t just work on whole numbers. “Div” always returns a whole number result, but “mod” doesn’t, since the remainder of dividing decimal numbers will include decimals. If you have been brainwashed into thinking that “div” and “mod”, or the C language equivalents, only make sense for integers, think again. Actually they are extremely useful for decimals, especially with real world units.

PIE is unusually in the way it handles + and / of values that are both either true or false. In that case “+” means “and” and “/” means “or”. That is useful for keyboard commands like Shift+A which means “Shift and A”. But be careful because that doesn’t work on some things that aren’t considered true or false even if they normally return a value of 0 or 1.

Right Hand Side of Maths Expression

This box sort of speaks for itself. Just type in whatever you want to add, subtract, compare it to, etc. once you have selected an operator in the “maths” box.

You have to type it in manually, which shouldn’t be a problem if you are advanced enough to want to use it. Note that you can type anything here, even complex mathematical equations and other device inputs like Glove2.x . Remember strings should be in quotation marks, but nothing else should.

Function

The function box lets you choose one of the “temporal” functions to apply to the value. It doesn’t include normal maths functions yet like “Sin” or “Cos”, it only includes functions that change over time. These include the “Smooth” function, which smooths out random noise or sudden bumps. They also include the “Pressed” and “Released” functions which only return true for a single frame when the value is first activated or finally returns to 0 or false. There are other functions like “Clicked”, “DoubleClicked” and “SingleClicked” which only return true when the button has been pressed and released the right number of times. And then there is the “HeldDown” function which only returns true once it has been held down for a certain length of time. Then there is the easily confused “KeepDown” function, which actually keeps the value as true for a while even after the button itself has been released. It is good for values that are normally only true for an instant (like Said() for microphone) but which you want to keep activating the output for longer.

If you want normal maths functions instead, you need to set the “device” box to blank and type the whole function call in the “DevicePart” box instead.

Apply Button

You need to click the Apply Button once you have made changes, or the changes will be lost when you choose a different output item to set. You can still edit it after you click the Apply button. Once you have clicked Apply, an asterisk (*) will appear beside the name of the item to show that it is set to something. If you added a new item, a line will be added to the end of your script. If you edited an existing item, that line of the script will be changed. Your entire script is reprocessed by the GUI every time you click Apply, which means you can instantly tell how GlovePIE understood and interpreted your changes. There is no Cancel button. If you don’t want to keep your changes, just choose a different output item to set and when you come back your changes will be gone.

Don’t forget, the Apply button doesn’t save your script, it just adds that line to it. You need to use the “File > Save” menu item after you have applied if you want to save your script to disk.

Delete Button

If you have started creating a new item that you don’t want to Apply, or if you want to delete an existing item, use the Delete button. You can’t use it to revert your changes, it will just delete that item rather than restoring it to how it was before.

How to use the GUI with other features

You can also use the “Search > Find” menu from the GUI. It will search for the specified text which appears anywhere in any of the items you have set. You need to click “Apply” first. Make sure you search in both directions. The search direction depends on when you added things, not their order in the output item list. The search is a powerful and useful way of navigating the GUI.

When you change from one the GUI tab to the Script tab, the cursor will stay on the same item. For example if you are looking at midi1.channel1.Volume in the GUI, then that line of the script will have the cursor when you switch back to the script. The same thing works the other way around. Choose a line of your script and change to the GUI and that item will be displayed in the GUI.

You can’t cut and paste from the GUI. So if you assign a complicated expression to control the Enter key, and you later decide you want it to control the space bar instead, you have to delete it from Enter, and create it again under Space. But an easier method is just to switch to the script editor, where you can more easily cut and paste, or change such things, and then switch back once you have fixed it. You will have the same problem if you apply a lot of things to MIDI device 1 and you want to move them all to MIDI device 2. Just use the script editor. You can even use Find and Replace from the script editor, but not from the GUI.

Clone this wiki locally