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

@@ -6,6 +6,7 @@ import pm.application.Winamp.WinampApplication;
import pm.application.example.ExampleApplication;
import pm.application.iTunes.iTunesApplication;
import pm.device.gui.GUIDevice;
import pm.device.javainput.rumblepad.RumblepadDevice;
import pm.device.jintellitype.JIntellitypeDevice;
import pm.exception.application.ApplicationExitException;
import pm.exception.device.DeviceExitException;
@@ -33,7 +34,7 @@ public class Main extends TaskListener {
public void initialise() throws DeviceInitialiseException {
add(new JIntellitypeDevice());
//add(new RumblepadDevice());
add(new RumblepadDevice());
//add(new GUIDevice());
for (Device device : deviceList) {
device.initialise();
@@ -41,8 +42,8 @@ public class Main extends TaskListener {
add(new ExampleApplication());
//add(new WinampApplication());
//add(new iTunesApplication());
//applicationCycle.next();
add(new iTunesApplication());
applicationCycle.next();
for (Application application : applicationCycle) {
application.start();
}

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 {