Subversion Repositories svn.mios

Rev

Rev 739 | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 739 Rev 808
Line 20... Line 20...
20
20
21
package org.midibox.apps.virtualkeyboard;
21
package org.midibox.apps.virtualkeyboard;
22
22
23
import org.midibox.midi.MidiDeviceManager;
23
import org.midibox.midi.MidiDeviceManager;
24
import org.midibox.midi.MidiDeviceRouting;
24
import org.midibox.midi.MidiDeviceRouting;
25
import org.midibox.midi.MidiKeyboardControllerDevice;
25
import org.midibox.midi.MidiKeyboardController;
26
import org.midibox.midi.MidiRouterDevice;
26
import org.midibox.midi.VirtualMidiDevice;
27
27
28
public class VirtualKeyboard {
28
public class VirtualKeyboard {
29
29
30
    private MidiDeviceManager midiDeviceManager;
30
    private MidiDeviceManager midiDeviceManager;
31
31
32
    private MidiDeviceRouting midiDeviceRouting;
32
    private MidiDeviceRouting midiDeviceRouting;
33
33
34
    private MidiKeyboardControllerDevice midiKeyboardControllerDevice;
34
    private MidiKeyboardController midiKeyboardController;
35
35
36
    private MidiRouterDevice virtualKeyboardInPort;
36
    private VirtualMidiDevice midiKeyboardControllerDevice;
37
37
38
    private MidiRouterDevice virtualKeyboardThruPort;
38
    private VirtualMidiDevice virtualKeyboardInPort;
39
39
-
 
40
    private VirtualMidiDevice virtualKeyboardThruPort;
-
 
41
40
    private MidiRouterDevice virtualKeyboardOutPort;
42
    private VirtualMidiDevice virtualKeyboardOutPort;
41
43
42
    public VirtualKeyboard() {
44
    public VirtualKeyboard() {
43
45
44
        midiDeviceRouting = new MidiDeviceRouting();
46
        midiDeviceRouting = new MidiDeviceRouting();
45
47
46
        midiKeyboardControllerDevice = new MidiKeyboardControllerDevice(
48
        midiKeyboardControllerDevice = new VirtualMidiDevice(
47
                "Virtual MIDI Keyboard", 0);
49
                "Virtual MIDI Keyboard", -1, -1);
-
 
50
-
 
51
        midiKeyboardController = new MidiKeyboardController(
-
 
52
                midiKeyboardControllerDevice.getMidiOutReceiver(), 0);
48
53
49
        midiDeviceManager = new MidiDeviceManager();
54
        midiDeviceManager = new MidiDeviceManager();
50
55
51
        midiDeviceManager.rescanDevices();
56
        midiDeviceManager.rescanDevices();
52
57
53
        virtualKeyboardInPort = new MidiRouterDevice("Virtual Keyboard In");
58
        virtualKeyboardInPort = new VirtualMidiDevice("Virtual Keyboard In",
-
 
59
                -1, -1);
-
 
60
        virtualKeyboardInPort.setMidiInReceiver(virtualKeyboardInPort
-
 
61
                .getMidiOutReceiver());
54
62
-
 
63
        virtualKeyboardThruPort = new VirtualMidiDevice(
-
 
64
                "Virtual Keyboard Thru", -1, -1);
55
        virtualKeyboardThruPort = new MidiRouterDevice("Virtual Keyboard Thru");
65
        virtualKeyboardThruPort.setMidiInReceiver(virtualKeyboardThruPort
-
 
66
                .getMidiOutReceiver());
56
67
57
        virtualKeyboardOutPort = new MidiRouterDevice("Virtual Keyboard Out");
68
        virtualKeyboardOutPort = new VirtualMidiDevice("Virtual Keyboard Out",
-
 
69
                -1, -1);
-
 
70
        virtualKeyboardOutPort.setMidiInReceiver(virtualKeyboardOutPort
-
 
71
                .getMidiOutReceiver());
58
72
59
        midiDeviceRouting.connectDevices(virtualKeyboardInPort,
73
        midiDeviceRouting.connectDevices(virtualKeyboardInPort,
60
                midiKeyboardControllerDevice);
74
                midiKeyboardControllerDevice);
61
75
62
        midiDeviceRouting.connectDevices(virtualKeyboardInPort,
76
        midiDeviceRouting.connectDevices(virtualKeyboardInPort,
Line 80... Line 94...
80
94
81
    public MidiDeviceRouting getMidiDeviceRouting() {
95
    public MidiDeviceRouting getMidiDeviceRouting() {
82
        return midiDeviceRouting;
96
        return midiDeviceRouting;
83
    }
97
    }
84
98
85
    public MidiKeyboardControllerDevice getMidiKeyboardControllerDevice() {
99
    public MidiKeyboardController getMidiKeyboardController() {
86
        return midiKeyboardControllerDevice;
100
        return midiKeyboardController;
87
    }
101
    }
88
}
102
}