1 |
/* |
/* |
2 |
* jlscp - a java LinuxSampler control protocol API |
* jlscp - a java LinuxSampler control protocol API |
3 |
* |
* |
4 |
* Copyright (C) 2005 Grigor Kirilov Iliev |
* Copyright (C) 2005-2006 Grigor Iliev <grigor@grigoriliev.com> |
5 |
* |
* |
6 |
* This file is part of jlscp. |
* This file is part of jlscp. |
7 |
* |
* |
32 |
public abstract class AbstractDevice implements Device { |
public abstract class AbstractDevice implements Device { |
33 |
private int id = -1; |
private int id = -1; |
34 |
private String driver = null; |
private String driver = null; |
35 |
private boolean active = false; |
private BoolParameter active = new BoolParameter("ACTIVE", true); |
36 |
|
|
37 |
private final Vector<Parameter> prmList = new Vector<Parameter>(); |
private final Vector<Parameter> prmList = new Vector<Parameter>(); |
38 |
|
|
46 |
* @return The numerical ID of this device or -1 if the device number is not set. |
* @return The numerical ID of this device or -1 if the device number is not set. |
47 |
*/ |
*/ |
48 |
public int |
public int |
49 |
getDeviceID() { return id; } |
getDeviceId() { return id; } |
50 |
|
|
51 |
/** |
/** |
52 |
* Sets the numerical ID of this device. |
* Sets the numerical ID of this device. |
53 |
* @param id The new numerical ID of this device. |
* @param id The new numerical ID of this device. |
54 |
*/ |
*/ |
55 |
public void |
public void |
56 |
setDeviceID(int id) { this.id = id; } |
setDeviceId(int id) { this.id = id; } |
57 |
|
|
58 |
/** |
/** |
59 |
* Gets the driver name used by this device. |
* Gets the driver name used by this device. |
74 |
* @return <code>false</code> if the device is inactive and <code>true</code> otherwise. |
* @return <code>false</code> if the device is inactive and <code>true</code> otherwise. |
75 |
*/ |
*/ |
76 |
public boolean |
public boolean |
77 |
isActive() { return active; } |
isActive() { return active.getValue(); } |
78 |
|
|
79 |
/** |
/** |
80 |
* Sets whether this audio output device is active or not. |
* Sets whether this audio output device is active or not. |
82 |
* <code>true</code> otherwise. |
* <code>true</code> otherwise. |
83 |
*/ |
*/ |
84 |
public void |
public void |
85 |
setActive(boolean active) { this.active = active; } |
setActive(boolean active) { this.active.setValue(active); } |
86 |
|
|
87 |
|
/** |
88 |
|
* Gets the <code>ACTIVE</code> parameter. |
89 |
|
* @return A <code>Parameter<Boolean></code> instance |
90 |
|
* representing the active state of the device. |
91 |
|
*/ |
92 |
|
public Parameter<Boolean> |
93 |
|
getActiveParameter() { return active; } |
94 |
|
|
95 |
/** |
/** |
96 |
* Adds additional parameter to this device. |
* Adds additional parameter to this device. |
119 |
* @return The numerical ID of the device. |
* @return The numerical ID of the device. |
120 |
*/ |
*/ |
121 |
public String |
public String |
122 |
toString() { return String.valueOf(getDeviceID()); } |
toString() { return String.valueOf(getDeviceId()); } |
123 |
} |
} |