1 |
iliev |
596 |
/* |
2 |
|
|
* jlscp - a java LinuxSampler control protocol API |
3 |
|
|
* |
4 |
iliev |
1139 |
* Copyright (C) 2005-2006 Grigor Iliev <grigor@grigoriliev.com> |
5 |
iliev |
596 |
* |
6 |
|
|
* This file is part of jlscp. |
7 |
|
|
* |
8 |
|
|
* jlscp is free software; you can redistribute it and/or modify |
9 |
|
|
* it under the terms of the GNU General Public License version 2 |
10 |
|
|
* as published by the Free Software Foundation. |
11 |
|
|
* |
12 |
|
|
* jlscp is distributed in the hope that it will be useful, |
13 |
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
14 |
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
15 |
|
|
* GNU General Public License for more details. |
16 |
|
|
* |
17 |
|
|
* You should have received a copy of the GNU General Public License |
18 |
|
|
* along with jlscp; if not, write to the Free Software |
19 |
|
|
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, |
20 |
|
|
* MA 02111-1307 USA |
21 |
|
|
*/ |
22 |
|
|
|
23 |
|
|
package org.linuxsampler.lscp; |
24 |
|
|
|
25 |
iliev |
784 |
|
26 |
iliev |
596 |
/** |
27 |
|
|
* Provides information about the current settings of a specific MIDI input device. |
28 |
|
|
* @author Grigor Iliev |
29 |
|
|
*/ |
30 |
|
|
public class MidiInputDevice extends AbstractDevice { |
31 |
iliev |
1494 |
private Parameter<Integer> ports = null; |
32 |
iliev |
784 |
private MidiPort[] midiPorts = new MidiPort[0]; |
33 |
|
|
|
34 |
iliev |
596 |
/** Creates a new instance of MidiInputDevice */ |
35 |
|
|
public |
36 |
|
|
MidiInputDevice() { } |
37 |
iliev |
784 |
|
38 |
|
|
/** |
39 |
|
|
* Gets the current non-<code>null</code> list of MIDI ports this device offers. |
40 |
|
|
* @return A <code>MidiPort</code> array providing all MIDI ports this device offers. |
41 |
|
|
*/ |
42 |
|
|
public MidiPort[] |
43 |
|
|
getMidiPorts() { return midiPorts; } |
44 |
|
|
|
45 |
|
|
/** |
46 |
|
|
* Sets the current list of MIDI ports. |
47 |
|
|
* @param ports The new list of MIDI ports. |
48 |
|
|
* @throws IllegalArgumentException If <code>ports</code> is <code>null</code>. |
49 |
|
|
*/ |
50 |
|
|
public void |
51 |
|
|
setMidiPorts(MidiPort[] ports) { |
52 |
|
|
if(ports == null) throw new IllegalArgumentException("ports must be non null"); |
53 |
|
|
midiPorts = ports; |
54 |
|
|
} |
55 |
|
|
|
56 |
|
|
/** |
57 |
iliev |
1494 |
* Gets the <code>PORTS</code> parameter. |
58 |
|
|
* @return A <code>Parameter<Integer></code> instance. |
59 |
|
|
*/ |
60 |
|
|
public Parameter<Integer> |
61 |
|
|
getPortsParameter() { return ports; } |
62 |
|
|
|
63 |
|
|
/** |
64 |
|
|
* Sets the <code>PORTS</code> parameter. |
65 |
|
|
* @param ports The new <code>PORTS</code> parameter. |
66 |
|
|
*/ |
67 |
|
|
public void |
68 |
|
|
setPortsParameter(Parameter<Integer> ports) { this.ports = ports; } |
69 |
|
|
|
70 |
|
|
/** |
71 |
iliev |
784 |
* Gets the MIDI port at the specified index. |
72 |
|
|
* @param index The index of the MIDI port to be retrieved. |
73 |
|
|
*/ |
74 |
|
|
public MidiPort |
75 |
|
|
getMidiPort(int index) { return midiPorts[index]; } |
76 |
|
|
|
77 |
|
|
/** |
78 |
|
|
* Gets the current number of MIDI ports this device offers. |
79 |
|
|
* @return The current number of MIDI ports this device offers. |
80 |
|
|
*/ |
81 |
|
|
public int |
82 |
|
|
getMidiPortCount() { return midiPorts.length; } |
83 |
iliev |
596 |
} |