1 |
/* |
/* |
2 |
* JSampler - a java front-end for LinuxSampler |
* JSampler - a java front-end for LinuxSampler |
3 |
* |
* |
4 |
* Copyright (C) 2005-2007 Grigor Iliev <grigor@grigoriliev.com> |
* Copyright (C) 2005-2008 Grigor Iliev <grigor@grigoriliev.com> |
5 |
* |
* |
6 |
* This file is part of JSampler. |
* This file is part of JSampler. |
7 |
* |
* |
45 |
import javax.swing.ListSelectionModel; |
import javax.swing.ListSelectionModel; |
46 |
|
|
47 |
import net.sf.juife.ComponentList; |
import net.sf.juife.ComponentList; |
|
import net.sf.juife.ComponentListModel; |
|
48 |
import net.sf.juife.DefaultComponentListModel; |
import net.sf.juife.DefaultComponentListModel; |
49 |
|
|
50 |
import net.sf.juife.event.TaskEvent; |
import net.sf.juife.event.TaskEvent; |
60 |
|
|
61 |
import org.jsampler.task.Audio; |
import org.jsampler.task.Audio; |
62 |
|
|
63 |
|
import org.jsampler.view.JSViewConfig; |
64 |
|
import org.jsampler.view.SessionViewConfig.DeviceConfig; |
65 |
|
|
66 |
|
import org.jsampler.view.fantasia.basic.PixmapButton; |
67 |
|
import org.jsampler.view.fantasia.basic.PixmapPane; |
68 |
import org.jsampler.view.std.JSNewAudioDeviceDlg; |
import org.jsampler.view.std.JSNewAudioDeviceDlg; |
69 |
|
|
70 |
import org.linuxsampler.lscp.AudioOutputDriver; |
import org.linuxsampler.lscp.AudioOutputDriver; |
71 |
|
|
|
import static org.jsampler.view.fantasia.A4n.a4n; |
|
72 |
import static org.jsampler.view.fantasia.FantasiaI18n.i18n; |
import static org.jsampler.view.fantasia.FantasiaI18n.i18n; |
73 |
import static org.jsampler.view.fantasia.FantasiaPrefs.*; |
import static org.jsampler.view.fantasia.FantasiaPrefs.*; |
74 |
|
|
100 |
} |
} |
101 |
} |
} |
102 |
|
|
103 |
|
public int |
104 |
|
getDevicePaneCount() { return listModel.size(); } |
105 |
|
|
106 |
|
public AudioDevicePane |
107 |
|
getDevicePaneAt(int index) { return listModel.get(index); } |
108 |
|
|
109 |
private void |
private void |
110 |
addDevice(AudioDeviceModel model) { |
addDevice(AudioDeviceModel model) { |
111 |
for(int i = 0; i < listModel.getSize(); i++) { |
for(int i = 0; i < listModel.getSize(); i++) { |
115 |
} |
} |
116 |
} |
} |
117 |
|
|
118 |
listModel.add(new AudioDevicePane(model)); |
AudioDevicePane dev = new AudioDevicePane(model); |
119 |
|
DeviceConfig config = null; |
120 |
|
JSViewConfig viewConfig = CC.getViewConfig(); |
121 |
|
if(viewConfig != null && viewConfig.getSessionViewConfig() != null) { |
122 |
|
config = viewConfig.getSessionViewConfig().pollAudioDeviceConfig(); |
123 |
|
} |
124 |
|
|
125 |
|
if(config != null && config.expanded) dev.showOptionsPane(true); |
126 |
|
|
127 |
|
listModel.add(dev); |
128 |
} |
} |
129 |
|
|
130 |
private void |
private void |
142 |
class DeviceListPane extends ComponentList { |
class DeviceListPane extends ComponentList { |
143 |
private Dimension maxSize = new Dimension(); |
private Dimension maxSize = new Dimension(); |
144 |
|
|
145 |
|
@Override |
146 |
public Dimension |
public Dimension |
147 |
getMaximumSize() { |
getMaximumSize() { |
148 |
maxSize.width = Short.MAX_VALUE; |
maxSize.width = Short.MAX_VALUE; |
345 |
getHandler() { return eventHandler; } |
getHandler() { return eventHandler; } |
346 |
|
|
347 |
private class EventHandler implements ListListener<AudioDeviceModel> { |
private class EventHandler implements ListListener<AudioDeviceModel> { |
348 |
|
@Override |
349 |
public void |
public void |
350 |
entryAdded(ListEvent<AudioDeviceModel> e) { |
entryAdded(ListEvent<AudioDeviceModel> e) { |
351 |
addDevice(e.getEntry()); |
addDevice(e.getEntry()); |
352 |
} |
} |
353 |
|
|
354 |
|
@Override |
355 |
public void |
public void |
356 |
entryRemoved(ListEvent<AudioDeviceModel> e) { |
entryRemoved(ListEvent<AudioDeviceModel> e) { |
357 |
removeDevice(e.getEntry()); |
removeDevice(e.getEntry()); |