1 |
/* |
2 |
* jlscp - a java LinuxSampler control protocol API |
3 |
* |
4 |
* Copyright (C) 2005 Grigor Kirilov Iliev |
5 |
* |
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 |
|
26 |
/** |
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 |
private MidiPort[] midiPorts = new MidiPort[0]; |
32 |
|
33 |
/** Creates a new instance of MidiInputDevice */ |
34 |
public |
35 |
MidiInputDevice() { } |
36 |
|
37 |
/** |
38 |
* Gets the current non-<code>null</code> list of MIDI ports this device offers. |
39 |
* @return A <code>MidiPort</code> array providing all MIDI ports this device offers. |
40 |
*/ |
41 |
public MidiPort[] |
42 |
getMidiPorts() { return midiPorts; } |
43 |
|
44 |
/** |
45 |
* Sets the current list of MIDI ports. |
46 |
* @param ports The new list of MIDI ports. |
47 |
* @throws IllegalArgumentException If <code>ports</code> is <code>null</code>. |
48 |
*/ |
49 |
public void |
50 |
setMidiPorts(MidiPort[] ports) { |
51 |
if(ports == null) throw new IllegalArgumentException("ports must be non null"); |
52 |
midiPorts = ports; |
53 |
} |
54 |
|
55 |
/** |
56 |
* Gets the MIDI port at the specified index. |
57 |
* @param index The index of the MIDI port to be retrieved. |
58 |
*/ |
59 |
public MidiPort |
60 |
getMidiPort(int index) { return midiPorts[index]; } |
61 |
|
62 |
/** |
63 |
* Gets the current number of MIDI ports this device offers. |
64 |
* @return The current number of MIDI ports this device offers. |
65 |
*/ |
66 |
public int |
67 |
getMidiPortCount() { return midiPorts.length; } |
68 |
} |