1 |
/* |
2 |
* JSampler - a java front-end for LinuxSampler |
3 |
* |
4 |
* Copyright (C) 2005-2011 Grigor Iliev <grigor@grigoriliev.com> |
5 |
* |
6 |
* This file is part of JSampler. |
7 |
* |
8 |
* JSampler 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 |
* JSampler 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 JSampler; 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.jsampler.task; |
24 |
|
25 |
import java.util.ArrayList; |
26 |
|
27 |
import org.jsampler.AudioDeviceModel; |
28 |
import org.jsampler.CC; |
29 |
import org.jsampler.EffectChain; |
30 |
import org.jsampler.SamplerModel; |
31 |
|
32 |
import org.linuxsampler.lscp.AudioOutputDevice; |
33 |
import org.linuxsampler.lscp.AudioOutputDriver; |
34 |
import org.linuxsampler.lscp.EffectChainInfo; |
35 |
import org.linuxsampler.lscp.EffectInstanceInfo; |
36 |
import org.linuxsampler.lscp.Effect; |
37 |
import org.linuxsampler.lscp.Parameter; |
38 |
|
39 |
import static org.jsampler.JSI18n.i18n; |
40 |
|
41 |
|
42 |
/** |
43 |
* Provides the audio specific tasks. |
44 |
* @author Grigor Iliev |
45 |
*/ |
46 |
public class Audio { |
47 |
/** Forbids the instantiation of this class. */ |
48 |
private Audio() { } |
49 |
|
50 |
/** |
51 |
* This task retrieves all audio output drivers currently |
52 |
* available for the LinuxSampler instance. |
53 |
*/ |
54 |
public static class GetDrivers extends EnhancedTask<AudioOutputDriver[]> { |
55 |
/** Creates a new instance of <code>GetDrivers</code>. */ |
56 |
public |
57 |
GetDrivers() { |
58 |
setTitle("Audio.GetDrivers_task"); |
59 |
setDescription(i18n.getMessage("Audio.GetDrivers.desc")); |
60 |
} |
61 |
|
62 |
/** The entry point of the task. */ |
63 |
@Override |
64 |
public void |
65 |
exec() throws Exception { setResult(CC.getClient().getAudioOutputDrivers()); } |
66 |
} |
67 |
|
68 |
/** |
69 |
* This task retrieves detailed information about all parameters |
70 |
* of the specified audio output driver. |
71 |
*/ |
72 |
public static class GetDriverParametersInfo extends EnhancedTask<Parameter[]> { |
73 |
private String driver; |
74 |
Parameter[] depList; |
75 |
|
76 |
/** |
77 |
* Creates a new instance of <code>GetDriverParametersInfo</code>. |
78 |
* @param depList - A dependences list. |
79 |
*/ |
80 |
public |
81 |
GetDriverParametersInfo(String driver, Parameter... depList) { |
82 |
setTitle("Audio.GetDriverParametersInfo_task"); |
83 |
setDescription(i18n.getMessage("Audio.GetDriverParametersInfo.desc")); |
84 |
|
85 |
this.driver = driver; |
86 |
this.depList = depList; |
87 |
} |
88 |
|
89 |
/** The entry point of the task. */ |
90 |
@Override |
91 |
public void |
92 |
exec() throws Exception { |
93 |
AudioOutputDriver d; |
94 |
d = CC.getClient().getAudioOutputDriverInfo(driver, depList); |
95 |
setResult(d.getParameters()); |
96 |
} |
97 |
} |
98 |
|
99 |
/** |
100 |
* This task creates a new audio output device. |
101 |
*/ |
102 |
public static class CreateDevice extends EnhancedTask<Integer> { |
103 |
private String driver; |
104 |
private Parameter[] parameters; |
105 |
|
106 |
|
107 |
/** |
108 |
* Creates a new instance of <code>CreateDevice</code>. |
109 |
* @param driver The desired audio output system. |
110 |
* @param parameters An optional list of driver specific parameters. |
111 |
*/ |
112 |
public |
113 |
CreateDevice(String driver, Parameter... parameters) { |
114 |
setTitle("Audio.CreateDevice_task"); |
115 |
setDescription(i18n.getMessage("Audio.CreateDevice.desc")); |
116 |
|
117 |
this.driver = driver; |
118 |
this.parameters = parameters; |
119 |
} |
120 |
|
121 |
/** The entry point of the task. */ |
122 |
@Override |
123 |
public void |
124 |
exec() throws Exception { |
125 |
Integer deviceId = CC.getClient().createAudioOutputDevice(driver, parameters); |
126 |
setResult(deviceId); |
127 |
} |
128 |
} |
129 |
|
130 |
/** |
131 |
* This task destroys the specified audio output device. |
132 |
*/ |
133 |
public static class DestroyDevice extends EnhancedTask { |
134 |
private int deviceId; |
135 |
|
136 |
|
137 |
/** |
138 |
* Creates a new instance of <code>DestroyDevice</code>. |
139 |
* @param deviceId The ID of the audio output device to be destroyed. |
140 |
*/ |
141 |
public |
142 |
DestroyDevice(int deviceId) { |
143 |
setTitle("Audio.DestroyDevice_task"); |
144 |
setDescription(i18n.getMessage("Audio.DestroyDevice.desc", deviceId)); |
145 |
|
146 |
this.deviceId = deviceId; |
147 |
} |
148 |
|
149 |
/** The entry point of the task. */ |
150 |
@Override |
151 |
public void |
152 |
exec() throws Exception { CC.getClient().destroyAudioOutputDevice(deviceId); } |
153 |
} |
154 |
|
155 |
/** |
156 |
* This task enables/disables a specific audio output device. |
157 |
*/ |
158 |
public static class EnableDevice extends EnhancedTask { |
159 |
private int dev; |
160 |
private boolean enable; |
161 |
|
162 |
/** |
163 |
* Creates new instance of <code>EnableDevice</code>. |
164 |
* @param dev The id of the device to be enabled/disabled. |
165 |
* @param enable Specify <code>true</code> to enable the audio device; |
166 |
* code>false</code> to disable it. |
167 |
*/ |
168 |
public |
169 |
EnableDevice(int dev, boolean enable) { |
170 |
setTitle("Audio.EnableDevice_task"); |
171 |
setDescription(i18n.getMessage("Audio.EnableDevice.desc", dev)); |
172 |
|
173 |
this.dev = dev; |
174 |
this.enable = enable; |
175 |
} |
176 |
|
177 |
/** The entry point of the task. */ |
178 |
@Override |
179 |
public void |
180 |
exec() throws Exception { |
181 |
CC.getClient().enableAudioOutputDevice(dev, enable); |
182 |
|
183 |
// Not needed, but eventually speeds up the change. |
184 |
CC.getSamplerModel().getAudioDeviceById(dev).setActive(enable); |
185 |
} |
186 |
} |
187 |
|
188 |
/** |
189 |
* This task alters a specific setting of an audio output device. |
190 |
*/ |
191 |
public static class SetDeviceParameter extends EnhancedTask { |
192 |
private int dev; |
193 |
private Parameter prm; |
194 |
|
195 |
/** |
196 |
* Creates new instance of <code>SetDeviceParameter</code>. |
197 |
* @param dev The id of the device whose parameter should be set. |
198 |
* @param prm The parameter to be set. |
199 |
*/ |
200 |
public |
201 |
SetDeviceParameter(int dev, Parameter prm) { |
202 |
setTitle("Audio.SetDeviceParameter_task"); |
203 |
setDescription(i18n.getMessage("Audio.SetDeviceParameter.desc", dev)); |
204 |
|
205 |
this.dev = dev; |
206 |
this.prm = prm; |
207 |
} |
208 |
|
209 |
/** The entry point of the task. */ |
210 |
@Override |
211 |
public void |
212 |
exec() throws Exception { |
213 |
CC.getClient().setAudioOutputDeviceParameter(dev, prm); |
214 |
} |
215 |
} |
216 |
|
217 |
/** |
218 |
* This task alters a specific setting of an audio output channel. |
219 |
*/ |
220 |
public static class SetChannelParameter extends EnhancedTask { |
221 |
private int dev; |
222 |
private int channel; |
223 |
private Parameter prm; |
224 |
|
225 |
/** |
226 |
* Creates new instance of <code>SetChannelParameter</code>. |
227 |
* @param dev The id of the device whose channel parameter should be set. |
228 |
* @param channel The channel number. |
229 |
* @param prm The parameter to be set. |
230 |
*/ |
231 |
public |
232 |
SetChannelParameter(int dev, int channel, Parameter prm) { |
233 |
setTitle("Audio.SetChannelParameter_task"); |
234 |
setDescription(i18n.getMessage("Audio.SetChannelParameter.desc")); |
235 |
|
236 |
this.dev = dev; |
237 |
this.channel = channel; |
238 |
this.prm = prm; |
239 |
} |
240 |
|
241 |
/** The entry point of the task. */ |
242 |
@Override |
243 |
public void |
244 |
exec() throws Exception { |
245 |
CC.getClient().setAudioOutputChannelParameter(dev, channel, prm); |
246 |
} |
247 |
} |
248 |
|
249 |
/** |
250 |
* This task changes the channel number of the speicifed audio output device. |
251 |
*/ |
252 |
public static class SetChannelCount extends EnhancedTask { |
253 |
private int deviceId; |
254 |
private int channels; |
255 |
|
256 |
/** |
257 |
* Creates new instance of <code>SetChannelCount</code>. |
258 |
* @param deviceId The id of the device whose channels number will be changed. |
259 |
* @param channels The new number of audio channels. |
260 |
*/ |
261 |
public |
262 |
SetChannelCount(int deviceId, int channels) { |
263 |
setTitle("SetAudioOutputChannelCount_task"); |
264 |
setDescription(i18n.getMessage("Audio.SetChannelCount.desc", deviceId)); |
265 |
|
266 |
this.deviceId = deviceId; |
267 |
this.channels = channels; |
268 |
} |
269 |
|
270 |
/** The entry point of the task. */ |
271 |
@Override |
272 |
public void |
273 |
exec() throws Exception { |
274 |
CC.getClient().setAudioOutputChannelCount(deviceId, channels); |
275 |
} |
276 |
} |
277 |
|
278 |
/** |
279 |
* This task adds a send effect chain to the specified audio output device. |
280 |
*/ |
281 |
public static class AddSendEffectChain extends EnhancedTask<Integer> { |
282 |
private int audioDeviceId; |
283 |
|
284 |
/** |
285 |
* Creates a new instance of <code>AddSendEffectChain</code>. |
286 |
* @param audioDeviceId The numerical ID of the audio output device. |
287 |
*/ |
288 |
public |
289 |
AddSendEffectChain(int audioDeviceId) { |
290 |
setTitle("Audio.AddSendEffectChain_task"); |
291 |
setDescription(i18n.getMessage("Audio.AddSendEffectChain.desc")); |
292 |
|
293 |
this.audioDeviceId = audioDeviceId; |
294 |
} |
295 |
|
296 |
/** The entry point of the task. */ |
297 |
@Override |
298 |
public void |
299 |
exec() throws Exception { |
300 |
Integer chainId = CC.getClient().addSendEffectChain(audioDeviceId); |
301 |
setResult(chainId); |
302 |
} |
303 |
} |
304 |
|
305 |
/** |
306 |
* This task removes the specified send effect chain of the specified audio output device. |
307 |
*/ |
308 |
public static class RemoveSendEffectChain extends EnhancedTask { |
309 |
private int audioDeviceId; |
310 |
private int chainId; |
311 |
|
312 |
/** |
313 |
* Creates a new instance of <code>RemoveSendEffectChain</code>. |
314 |
* @param audioDeviceId The numerical ID of the audio output device. |
315 |
* @param chainId The numerical ID of the send effect chain to remove. |
316 |
*/ |
317 |
public |
318 |
RemoveSendEffectChain(int audioDeviceId, int chainId) { |
319 |
setTitle("Audio.RemoveSendEffectChain_task"); |
320 |
setDescription(i18n.getMessage("Audio.RemoveSendEffectChain.desc")); |
321 |
|
322 |
this.audioDeviceId = audioDeviceId; |
323 |
this.chainId = chainId; |
324 |
} |
325 |
|
326 |
/** The entry point of the task. */ |
327 |
@Override |
328 |
public void |
329 |
exec() throws Exception { |
330 |
AudioDeviceModel adm = CC.getSamplerModel().getAudioDevice(audioDeviceId); |
331 |
EffectChain chain = adm.getSendEffectChainById(chainId); |
332 |
|
333 |
for(int i = chain.getEffectInstanceCount() - 1; i >= 0; i--) { |
334 |
CC.getClient().removeEffectInstanceFromChain ( |
335 |
audioDeviceId, chainId, i |
336 |
); |
337 |
|
338 |
int iid = chain.getEffectInstance(i).getInstanceId(); |
339 |
CC.getClient().destroyEffectInstance(iid); |
340 |
} |
341 |
CC.getClient().removeSendEffectChain(audioDeviceId, chainId); |
342 |
} |
343 |
} |
344 |
|
345 |
/** |
346 |
* This task creates new effect instances and inserts them |
347 |
* in the specified send effect chain at the specified position. |
348 |
*/ |
349 |
public static class AddNewEffectInstances extends EnhancedTask { |
350 |
private Effect[] effects; |
351 |
private int audioDeviceId; |
352 |
private int chainId; |
353 |
private int index; |
354 |
|
355 |
/** |
356 |
* Creates a new instance of <code>AddNewEffectInstances</code>. |
357 |
* @param audioDeviceId The numerical ID of the audio output device. |
358 |
* @param chainId The numerical ID of the send effect chain. |
359 |
* @param index The position in the chain where the newly created |
360 |
* effect instances should be inserted to. Use -1 to append. |
361 |
*/ |
362 |
public |
363 |
AddNewEffectInstances(Effect[] effects, int audioDeviceId, int chainId, int index) { |
364 |
setTitle("Audio.AddNewEffectInstances_task"); |
365 |
setDescription(i18n.getMessage("Audio.AddNewEffectInstances.desc")); |
366 |
|
367 |
this.effects = effects; |
368 |
this.audioDeviceId = audioDeviceId; |
369 |
this.chainId = chainId; |
370 |
this.index = index; |
371 |
} |
372 |
|
373 |
/** The entry point of the task. */ |
374 |
@Override |
375 |
public void |
376 |
exec() throws Exception { |
377 |
for(Effect e : effects) { |
378 |
int ei = CC.getClient().createEffectInstance(e); |
379 |
if(index != -1) { |
380 |
CC.getClient().insertEffectInstance(audioDeviceId, chainId, index, ei); |
381 |
} else { |
382 |
CC.getClient().appendEffectInstance(audioDeviceId, chainId, ei); |
383 |
} |
384 |
} |
385 |
} |
386 |
} |
387 |
|
388 |
/** |
389 |
* This task removes the specified effect instance from the specified send effect chain. |
390 |
*/ |
391 |
public static class RemoveEffectInstance extends EnhancedTask { |
392 |
private int audioDeviceId; |
393 |
private int chainId; |
394 |
private int instanceId; |
395 |
|
396 |
/** |
397 |
* Creates a new instance of <code>RemoveEffectInstance</code>. |
398 |
* @param audioDeviceId The numerical ID of the audio output device. |
399 |
* @param chainId The numerical ID of the send effect chain. |
400 |
* @param instanceId The numerical ID of the effect instance to remove. |
401 |
*/ |
402 |
public |
403 |
RemoveEffectInstance(int audioDeviceId, int chainId, int instanceId) { |
404 |
setTitle("Audio.RemoveEffectInstance_task"); |
405 |
setDescription(i18n.getMessage("Audio.RemoveEffectInstance.desc")); |
406 |
|
407 |
this.audioDeviceId = audioDeviceId; |
408 |
this.chainId = chainId; |
409 |
this.instanceId = instanceId; |
410 |
} |
411 |
|
412 |
/** The entry point of the task. */ |
413 |
@Override |
414 |
public void |
415 |
exec() throws Exception { |
416 |
AudioDeviceModel adm = CC.getSamplerModel().getAudioDevice(audioDeviceId); |
417 |
EffectChain chain = adm.getSendEffectChainById(chainId); |
418 |
|
419 |
CC.getClient().removeEffectInstanceFromChain ( |
420 |
audioDeviceId, chainId, chain.getIndex(instanceId) |
421 |
); |
422 |
|
423 |
CC.getClient().destroyEffectInstance(instanceId); |
424 |
|
425 |
} |
426 |
} |
427 |
|
428 |
|
429 |
/** |
430 |
* This task updates the send effect chain list of an audio output device. |
431 |
*/ |
432 |
public static class UpdateSendEffectChains extends EnhancedTask { |
433 |
private int devId; |
434 |
|
435 |
/** |
436 |
* Creates new instance of <code>UpdateSendEffectChains</code>. |
437 |
* @param devId The id of the device. |
438 |
*/ |
439 |
public |
440 |
UpdateSendEffectChains(int devId) { |
441 |
setTitle("Audio.UpdateSendEffectChains_task"); |
442 |
setDescription(i18n.getMessage("Audio.UpdateSendEffectChains.desc", devId)); |
443 |
|
444 |
this.devId = devId; |
445 |
} |
446 |
|
447 |
/** The entry point of the task. */ |
448 |
@Override |
449 |
public void |
450 |
exec() throws Exception { |
451 |
AudioDeviceModel m = CC.getSamplerModel().getAudioDeviceById(devId); |
452 |
|
453 |
Integer[] idS = CC.getClient().getSendEffectChainIDs(devId); |
454 |
|
455 |
ArrayList<Integer> removedChains = new ArrayList<Integer>(); |
456 |
|
457 |
for(int i = 0; i < m.getSendEffectChainCount(); i++) { |
458 |
boolean found = false; |
459 |
for(int j = 0; j < idS.length; j++) { |
460 |
if(idS[j] != null && m.getSendEffectChain(i).getChainId() == idS[j]) { |
461 |
found = true; |
462 |
idS[j] = null; |
463 |
} |
464 |
} |
465 |
if(!found) removedChains.add(m.getSendEffectChain(i).getChainId()); |
466 |
} |
467 |
|
468 |
for(int i : removedChains) m.removeSendEffectChain(i); |
469 |
|
470 |
for(int i = 0; i < idS.length; i++) { |
471 |
if(idS[i] != null) { |
472 |
m.addSendEffectChain ( |
473 |
new EffectChain(CC.getClient().getSendEffectChainInfo(devId, idS[i])) |
474 |
); |
475 |
} |
476 |
} |
477 |
} |
478 |
} |
479 |
|
480 |
/** |
481 |
* This task updates the list of effect instances. |
482 |
*/ |
483 |
public static class UpdateEffectInstances extends EnhancedTask { |
484 |
private int audioDeviceId; |
485 |
private int chainId; |
486 |
|
487 |
/** |
488 |
* Creates a new instance of <code>UpdateEffectInstances</code>. |
489 |
* @param audioDeviceId The numerical ID of the audio output device. |
490 |
* @param chainId The numerical ID of the send effect chain. |
491 |
*/ |
492 |
public |
493 |
UpdateEffectInstances(int audioDeviceId, int chainId) { |
494 |
setTitle("Audio.UpdateEffectInstances_task"); |
495 |
setDescription(i18n.getMessage("Audio.UpdateEffectInstances.desc")); |
496 |
|
497 |
this.audioDeviceId = audioDeviceId; |
498 |
this.chainId = chainId; |
499 |
} |
500 |
|
501 |
/** The entry point of the task. */ |
502 |
@Override |
503 |
public void |
504 |
exec() throws Exception { |
505 |
setSilent(true); |
506 |
|
507 |
EffectChainInfo c = |
508 |
CC.getClient().getSendEffectChainInfo(audioDeviceId, chainId); |
509 |
|
510 |
AudioDeviceModel m = CC.getSamplerModel().getAudioDeviceById(audioDeviceId); |
511 |
m.getSendEffectChainById(chainId).setEffectInstances(c); |
512 |
} |
513 |
} |
514 |
|
515 |
|
516 |
/** |
517 |
* This task updates the setting of an effect instance. |
518 |
*/ |
519 |
public static class UpdateEffectInstanceInfo extends EnhancedTask { |
520 |
private int instanceId; |
521 |
|
522 |
/** |
523 |
* Creates new instance of <code>UpdateEffectInstanceInfo</code>. |
524 |
* @param instanceId The id of the effect instance, which settings should be updated. |
525 |
*/ |
526 |
public |
527 |
UpdateEffectInstanceInfo(int instanceId) { |
528 |
setTitle("Audio.UpdateEffectInstanceInfo_task"); |
529 |
setDescription(i18n.getMessage("Audio.UpdateEffectInstanceInfo.desc", instanceId)); |
530 |
|
531 |
this.instanceId = instanceId; |
532 |
} |
533 |
|
534 |
/** The entry point of the task. */ |
535 |
@Override |
536 |
public void |
537 |
exec() throws Exception { |
538 |
EffectInstanceInfo ei = CC.getClient().getEffectInstanceInfo(instanceId); |
539 |
CC.getSamplerModel().updateEffectInstance(ei); |
540 |
} |
541 |
} |
542 |
|
543 |
|
544 |
/** |
545 |
* This task changes the value of an effect instance parameter. |
546 |
*/ |
547 |
public static class SetEffectInstanceParameter extends EnhancedTask { |
548 |
private int instanceId; |
549 |
private int prmIndex; |
550 |
private float newValue; |
551 |
|
552 |
/** |
553 |
* Creates new instance of <code>SetEffectInstanceParameter</code>. |
554 |
*/ |
555 |
public |
556 |
SetEffectInstanceParameter(int instanceId, int prmIndex, float newValue) { |
557 |
setTitle("Audio.SetEffectInstanceParameter_task"); |
558 |
setDescription(i18n.getMessage("Audio.SetEffectInstanceParameter.desc")); |
559 |
|
560 |
this.instanceId = instanceId; |
561 |
this.prmIndex = prmIndex; |
562 |
this.newValue = newValue; |
563 |
} |
564 |
|
565 |
/** The entry point of the task. */ |
566 |
@Override |
567 |
public void |
568 |
exec() throws Exception { |
569 |
CC.getClient().setEffectInstanceParameter(instanceId, prmIndex, newValue); |
570 |
} |
571 |
} |
572 |
|
573 |
|
574 |
/** |
575 |
* This task updates the setting of an audio output device. |
576 |
*/ |
577 |
public static class UpdateDeviceInfo extends EnhancedTask { |
578 |
private int dev; |
579 |
|
580 |
/** |
581 |
* Creates new instance of <code>UpdateDeviceInfo</code>. |
582 |
* @param dev The id of the device, which settings should be updated. |
583 |
*/ |
584 |
public |
585 |
UpdateDeviceInfo(int dev) { |
586 |
setTitle("Audio.UpdateDeviceInfo_task"); |
587 |
setDescription(i18n.getMessage("Audio.UpdateDeviceInfo.desc", dev)); |
588 |
|
589 |
this.dev = dev; |
590 |
} |
591 |
|
592 |
/** The entry point of the task. */ |
593 |
@Override |
594 |
public void |
595 |
exec() throws Exception { |
596 |
AudioOutputDevice d = CC.getClient().getAudioOutputDeviceInfo(dev); |
597 |
CC.getSamplerModel().getAudioDeviceById(dev).setDeviceInfo(d); |
598 |
} |
599 |
} |
600 |
|
601 |
/** |
602 |
* This task updates the audio output device list. |
603 |
*/ |
604 |
public static class UpdateDevices extends EnhancedTask { |
605 |
/** Creates a new instance of <code>UpdateDevices</code>. */ |
606 |
public |
607 |
UpdateDevices() { |
608 |
setTitle("Audio.UpdateDevices_task"); |
609 |
setDescription(i18n.getMessage("Audio.UpdateDevices.desc")); |
610 |
} |
611 |
|
612 |
/** The entry point of the task. */ |
613 |
@Override |
614 |
public void |
615 |
exec() throws Exception { |
616 |
SamplerModel sm = CC.getSamplerModel(); |
617 |
Integer[] devIDs = CC.getClient().getAudioOutputDeviceIDs(); |
618 |
|
619 |
boolean found = false; |
620 |
|
621 |
for(AudioDeviceModel m : sm.getAudioDevices()) { |
622 |
for(int i = 0; i < devIDs.length; i++) { |
623 |
if(m.getDeviceId() == devIDs[i]) { |
624 |
devIDs[i] = -1; |
625 |
found = true; |
626 |
} |
627 |
} |
628 |
|
629 |
if(!found) sm.removeAudioDeviceById(m.getDeviceId()); |
630 |
found = false; |
631 |
} |
632 |
|
633 |
AudioOutputDevice d; |
634 |
|
635 |
for(int id : devIDs) { |
636 |
if(id >= 0) { |
637 |
d = CC.getClient().getAudioOutputDeviceInfo(id); |
638 |
sm.addAudioDevice(d); |
639 |
} |
640 |
} |
641 |
} |
642 |
} |
643 |
|
644 |
} |