30 |
import java.awt.event.ItemEvent; |
import java.awt.event.ItemEvent; |
31 |
import java.awt.event.ItemListener; |
import java.awt.event.ItemListener; |
32 |
|
|
33 |
|
import java.beans.PropertyChangeEvent; |
34 |
|
import java.beans.PropertyChangeListener; |
35 |
|
|
36 |
import javax.swing.BorderFactory; |
import javax.swing.BorderFactory; |
37 |
import javax.swing.Box; |
import javax.swing.Box; |
38 |
import javax.swing.BoxLayout; |
import javax.swing.BoxLayout; |
67 |
import org.linuxsampler.lscp.Parameter; |
import org.linuxsampler.lscp.Parameter; |
68 |
|
|
69 |
import static org.jsampler.view.fantasia.FantasiaI18n.i18n; |
import static org.jsampler.view.fantasia.FantasiaI18n.i18n; |
70 |
|
import static org.jsampler.view.fantasia.FantasiaPrefs.preferences; |
71 |
|
|
72 |
/** |
/** |
73 |
* |
* |
125 |
|
|
126 |
private final JComboBox cbChannel = new JComboBox(); |
private final JComboBox cbChannel = new JComboBox(); |
127 |
|
|
128 |
|
private final ParameterTable additionalParamsTable = new ParameterTable(); |
129 |
|
private final JPanel additionalParamsPane = new JPanel(); |
130 |
|
|
131 |
OptionsPane() { |
OptionsPane() { |
132 |
super(Res.gfxChannelOptions); |
super(Res.gfxChannelOptions); |
133 |
|
|
159 |
mainPane.add(p); |
mainPane.add(p); |
160 |
mainPane.add(Box.createRigidArea(new Dimension(0, 5))); |
mainPane.add(Box.createRigidArea(new Dimension(0, 5))); |
161 |
|
|
162 |
|
JPanel p2 = additionalParamsPane; |
163 |
|
p2.setLayout(new BoxLayout(p2, BoxLayout.Y_AXIS)); |
164 |
|
p2.setOpaque(false); |
165 |
|
|
166 |
|
p2.add(createHSeparator()); |
167 |
|
p2.add(Box.createRigidArea(new Dimension(0, 5))); |
168 |
|
|
169 |
|
JScrollPane sp = new JScrollPane(additionalParamsTable); |
170 |
|
|
171 |
|
sp.setPreferredSize(new Dimension(77, 90)); |
172 |
|
p2.add(sp); |
173 |
|
mainPane.add(p2); |
174 |
|
|
175 |
|
mainPane.add(Box.createRigidArea(new Dimension(0, 5))); |
176 |
|
|
177 |
mainPane.add(createHSeparator()); |
mainPane.add(createHSeparator()); |
178 |
mainPane.add(Box.createRigidArea(new Dimension(0, 5))); |
mainPane.add(Box.createRigidArea(new Dimension(0, 5))); |
179 |
|
|
181 |
p.setLayout(new BoxLayout(p, BoxLayout.Y_AXIS)); |
p.setLayout(new BoxLayout(p, BoxLayout.Y_AXIS)); |
182 |
p.setOpaque(false); |
p.setOpaque(false); |
183 |
|
|
184 |
JPanel p2 = new JPanel(); |
p2 = new JPanel(); |
185 |
p2.setLayout(new BoxLayout(p2, BoxLayout.X_AXIS)); |
p2.setLayout(new BoxLayout(p2, BoxLayout.X_AXIS)); |
186 |
p2.add(lChannel); |
p2.add(lChannel); |
187 |
p2.add(Box.createRigidArea(new Dimension(5, 0))); |
p2.add(Box.createRigidArea(new Dimension(5, 0))); |
191 |
|
|
192 |
p.add(Box.createRigidArea(new Dimension(0, 5))); |
p.add(Box.createRigidArea(new Dimension(0, 5))); |
193 |
|
|
194 |
JScrollPane sp = new JScrollPane(channelParamTable); |
sp = new JScrollPane(channelParamTable); |
195 |
sp.setPreferredSize(new Dimension(77, 90)); |
sp.setPreferredSize(new Dimension(77, 90)); |
196 |
p.add(sp); |
p.add(sp); |
197 |
|
|
211 |
for(AudioOutputChannel chn : m.getDeviceInfo().getAudioChannels()) { |
for(AudioOutputChannel chn : m.getDeviceInfo().getAudioChannels()) { |
212 |
cbChannel.addItem(chn); |
cbChannel.addItem(chn); |
213 |
} |
} |
214 |
|
|
215 |
|
Parameter[] pS = audioDeviceModel.getDeviceInfo().getAdditionalParameters(); |
216 |
|
additionalParamsTable.getModel().setParameters(pS); |
217 |
|
additionalParamsTable.getModel().addParameterListener(new ParameterListener() { |
218 |
|
public void |
219 |
|
parameterChanged(ParameterEvent e) { |
220 |
|
audioDeviceModel.setBackendDeviceParameter(e.getParameter()); |
221 |
|
} |
222 |
|
}); |
223 |
|
|
224 |
|
updateAdditionalParamsViewState(); |
225 |
|
String s = "AudioDevice.showAdditionalParameters"; |
226 |
|
preferences().addPropertyChangeListener(s, new PropertyChangeListener() { |
227 |
|
public void |
228 |
|
propertyChange(PropertyChangeEvent e) { |
229 |
|
updateAdditionalParamsViewState(); |
230 |
|
} |
231 |
|
}); |
232 |
|
} |
233 |
|
|
234 |
|
private void |
235 |
|
updateAdditionalParamsViewState() { |
236 |
|
String s = "AudioDevice.showAdditionalParameters"; |
237 |
|
additionalParamsPane.setVisible(preferences().getBoolProperty(s)); |
238 |
|
validate(); |
239 |
} |
} |
240 |
|
|
241 |
public void |
public void |
277 |
|
|
278 |
AudioOutputDevice d = e.getAudioDeviceModel().getDeviceInfo(); |
AudioOutputDevice d = e.getAudioDeviceModel().getDeviceInfo(); |
279 |
|
|
280 |
|
Parameter[] params = d.getAdditionalParameters(); |
281 |
|
additionalParamsTable.getModel().setParameters(params); |
282 |
|
|
283 |
int idx = cbChannel.getSelectedIndex(); |
int idx = cbChannel.getSelectedIndex(); |
284 |
cbChannel.removeAllItems(); |
cbChannel.removeAllItems(); |
285 |
for(AudioOutputChannel chn : d.getAudioChannels()) cbChannel.addItem(chn); |
for(AudioOutputChannel chn : d.getAudioChannels()) cbChannel.addItem(chn); |