28 |
import org.jsampler.HF; |
import org.jsampler.HF; |
29 |
|
|
30 |
import org.linuxsampler.lscp.ServerInfo; |
import org.linuxsampler.lscp.ServerInfo; |
31 |
|
import org.linuxsampler.lscp.Instrument; |
32 |
|
|
33 |
import static org.jsampler.JSI18n.i18n; |
import static org.jsampler.JSI18n.i18n; |
34 |
|
|
92 |
* This task gets the global volume of the sampler. |
* This task gets the global volume of the sampler. |
93 |
*/ |
*/ |
94 |
public static class GetVolume extends EnhancedTask<Float> { |
public static class GetVolume extends EnhancedTask<Float> { |
95 |
/** Creates a new instance of <code>Get</code>. */ |
/** Creates a new instance of <code>GetVolume</code>. */ |
96 |
public |
public |
97 |
GetVolume() { |
GetVolume() { |
98 |
setTitle("Global.GetVolume_task"); |
setTitle("Global.GetVolume_task"); |
139 |
} |
} |
140 |
} |
} |
141 |
} |
} |
142 |
|
|
143 |
|
|
144 |
|
/** |
145 |
|
* This task sets the LSCP client's read timeout. |
146 |
|
*/ |
147 |
|
public static class SetClientReadTimeout extends EnhancedTask { |
148 |
|
private int timeout; |
149 |
|
|
150 |
|
/** |
151 |
|
* Creates new instance of <code>SetClientReadTimeout</code>. |
152 |
|
* @param timeout The new timeout value (in seconds). |
153 |
|
*/ |
154 |
|
public |
155 |
|
SetClientReadTimeout(int timeout) { |
156 |
|
setTitle("Global.SetClientReadTimeout_task"); |
157 |
|
setDescription(i18n.getMessage("Global.SetClientReadTimeout.desc")); |
158 |
|
this.timeout = timeout; |
159 |
|
} |
160 |
|
|
161 |
|
/** The entry point of the task. */ |
162 |
|
public void |
163 |
|
run() { |
164 |
|
try { |
165 |
|
CC.getClient().setSoTimeout(timeout * 1000); |
166 |
|
} catch(Exception x) { |
167 |
|
setErrorMessage(getDescription() + ": " + HF.getErrorMessage(x)); |
168 |
|
CC.getLogger().log(Level.FINE, getErrorMessage(), x); |
169 |
|
} |
170 |
|
} |
171 |
|
} |
172 |
|
|
173 |
|
/** |
174 |
|
* This task gets the list of instruments in the specified instrument file. |
175 |
|
*/ |
176 |
|
public static class GetFileInstruments extends EnhancedTask<Instrument[]> { |
177 |
|
private final String filename; |
178 |
|
|
179 |
|
/** Creates a new instance of <code>GetFileInstruments</code>. */ |
180 |
|
public |
181 |
|
GetFileInstruments(String filename) { |
182 |
|
this.filename = filename; |
183 |
|
setTitle("Global.GetFileInstruments_task"); |
184 |
|
setDescription(i18n.getMessage("Global.GetFileInstruments.desc")); |
185 |
|
} |
186 |
|
|
187 |
|
/** The entry point of the task. */ |
188 |
|
public void |
189 |
|
run() { |
190 |
|
try { setResult(CC.getClient().getFileInstruments(filename)); } |
191 |
|
catch(Exception x) { |
192 |
|
String s = getDescription() + ": " + HF.getErrorMessage(x); |
193 |
|
CC.getLogger().log(Level.FINER, s, x); |
194 |
|
} |
195 |
|
} |
196 |
|
} |
197 |
|
|
198 |
|
public static class DummyTask extends EnhancedTask { |
199 |
|
public void |
200 |
|
run() { } |
201 |
|
} |
202 |
} |
} |