RumblepadDevice aangepast aan nieuwe actions systeem. Enkele problemen worden duidelijk:

- Toevoegen van release event mist bij opgeven van slechts press.
- Verschillende macro's lopen door elkaar / stoppen niet.
- iTunes's playPause functionaliteit lijkt next te invoken.
This commit is contained in:
2011-02-12 22:34:43 +00:00
parent 8092b678cf
commit d62a354d9a
2 changed files with 34 additions and 35 deletions

View File

@@ -3,13 +3,15 @@ package pm.device.javainput.rumblepad;
import pm.Action;
import pm.Button;
import pm.Target;
import pm.Task;
import pm.device.javainput.DirectionButton;
import pm.device.javainput.JavaInputDevice;
import pm.exception.MacroException;
import pm.exception.device.DeviceInitialiseException;
import pm.exception.event.UnknownButtonException;
import pm.exception.event.UnknownDirectionException;
import pm.macro.event.Hold;
import pm.macro.event.Press;
import pm.task.Continuous;
import de.hardcode.jxinput.event.JXInputButtonEvent;
import de.hardcode.jxinput.event.JXInputDirectionalEvent;
@@ -18,37 +20,33 @@ public class RumblepadDevice extends JavaInputDevice {
public void initialise() throws DeviceInitialiseException {
super.initialise(NAME);
try {
add(
new Press(RumblepadButton.ONE),
Action.PLAY.setTarget(Target.APPLICATION));
add(
new Press(RumblepadButton.TWO),
Action.PAUSE.setTarget(Target.APPLICATION));
add(
new Press(RumblepadButton.THREE),
Action.RESUME.setTarget(Target.APPLICATION));
add(
new Press(RumblepadButton.SIX),
Action.NEXT.setTarget(Target.APPLICATION));
add(
new Press(RumblepadButton.EIGHT),
Action.PREVIOUS.setTarget(Target.APPLICATION));
add(
new Press(RumblepadButton.FIVE),
Action.FORWARD.setTarget(Target.APPLICATION));
add(
new Press(RumblepadButton.SEVEN),
Action.REWIND.setTarget(Target.APPLICATION));
add(
new Press(RumblepadButton.NINE),
Action.VOLUME_DOWN.setTarget(Target.APPLICATION));
add(
new Press(RumblepadButton.TEN),
Action.VOLUME_UP.setTarget(Target.APPLICATION));
} catch (MacroException e) {
e.printStackTrace();
}
add(
new Press(RumblepadButton.ONE),
new Task(Action.PLAY, Target.APPLICATION));
add(
new Press(RumblepadButton.TWO),
new Task(Action.PAUSE, Target.APPLICATION));
add(
new Press(RumblepadButton.THREE),
new Task(Action.RESUME, Target.APPLICATION));
add(
new Press(RumblepadButton.SIX),
new Task(Action.NEXT, Target.APPLICATION));
add(
new Press(RumblepadButton.EIGHT),
new Task(Action.PREVIOUS, Target.APPLICATION));
add(
new Hold(RumblepadButton.FIVE),
new Continuous(Action.FORWARD, Target.APPLICATION, 300));
add(
new Hold(RumblepadButton.SEVEN),
new Continuous(Action.REWIND, Target.APPLICATION, 300));
add(
new Hold(RumblepadButton.NINE),
new Continuous(Action.VOLUME_DOWN, Target.APPLICATION, 100));
add(
new Hold(RumblepadButton.TEN),
new Continuous(Action.VOLUME_UP, Target.APPLICATION, 100));
}
protected Button getButton(JXInputButtonEvent event) throws UnknownButtonException {