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 |
|
|
46 |
import org.jsampler.CC; |
import org.jsampler.CC; |
47 |
import org.jsampler.JSPrefs; |
import org.jsampler.JSPrefs; |
48 |
|
import org.jsampler.task.Global; |
49 |
|
|
50 |
import static org.jsampler.view.std.StdI18n.i18n; |
import static org.jsampler.view.std.StdI18n.i18n; |
51 |
import static org.jsampler.view.std.StdPrefs.*; |
import static org.jsampler.view.std.StdPrefs.*; |
64 |
preferences() { return CC.getViewConfig().preferences(); } |
preferences() { return CC.getViewConfig().preferences(); } |
65 |
|
|
66 |
|
|
67 |
|
public static class PolyphonyPane extends JPanel { |
68 |
|
private final JLabel lVoiceLimit = |
69 |
|
new JLabel(i18n.getLabel("JSGeneralProps.lVoiceLimit")); |
70 |
|
|
71 |
|
private final JLabel lStreamLimit = |
72 |
|
new JLabel(i18n.getLabel("JSGeneralProps.lStreamLimit")); |
73 |
|
|
74 |
|
private final JSpinner spVoiceLimit; |
75 |
|
private final JSpinner spStreamLimit; |
76 |
|
|
77 |
|
public |
78 |
|
PolyphonyPane() { |
79 |
|
int i = preferences().getIntProperty(GLOBAL_VOICE_LIMIT); |
80 |
|
spVoiceLimit = new JSpinner(new SpinnerNumberModel(i, 1, 32000, 1)); |
81 |
|
i = preferences().getIntProperty(GLOBAL_STREAM_LIMIT); |
82 |
|
spStreamLimit = new JSpinner(new SpinnerNumberModel(i, 10, 32000, 1)); |
83 |
|
|
84 |
|
GridBagLayout gridbag = new GridBagLayout(); |
85 |
|
GridBagConstraints c = new GridBagConstraints(); |
86 |
|
|
87 |
|
setLayout(gridbag); |
88 |
|
|
89 |
|
c.fill = GridBagConstraints.NONE; |
90 |
|
|
91 |
|
c.gridx = 0; |
92 |
|
c.gridy = 0; |
93 |
|
c.anchor = GridBagConstraints.EAST; |
94 |
|
c.insets = new Insets(3, 3, 3, 3); |
95 |
|
gridbag.setConstraints(lVoiceLimit, c); |
96 |
|
add(lVoiceLimit); |
97 |
|
|
98 |
|
c.gridx = 0; |
99 |
|
c.gridy = 1; |
100 |
|
gridbag.setConstraints(lStreamLimit, c); |
101 |
|
add(lStreamLimit); |
102 |
|
|
103 |
|
c.gridx = 1; |
104 |
|
c.gridy = 0; |
105 |
|
c.fill = GridBagConstraints.HORIZONTAL; |
106 |
|
c.anchor = GridBagConstraints.WEST; |
107 |
|
gridbag.setConstraints(spVoiceLimit, c); |
108 |
|
add(spVoiceLimit); |
109 |
|
|
110 |
|
c.gridx = 1; |
111 |
|
c.gridy = 1; |
112 |
|
gridbag.setConstraints(spStreamLimit, c); |
113 |
|
add(spStreamLimit); |
114 |
|
|
115 |
|
c.gridx = 2; |
116 |
|
c.gridy = 0; |
117 |
|
c.gridheight = 2; |
118 |
|
c.weightx = 1.0; |
119 |
|
JPanel p = new JPanel(); |
120 |
|
p.setOpaque(false); |
121 |
|
gridbag.setConstraints(p, c); |
122 |
|
add(p); |
123 |
|
|
124 |
|
setAlignmentX(JPanel.LEFT_ALIGNMENT); |
125 |
|
setOpaque(false); |
126 |
|
|
127 |
|
String s = i18n.getLabel("JSGeneralProps.PolyphonyPane"); |
128 |
|
setBorder(BorderFactory.createTitledBorder(s)); |
129 |
|
setMaximumSize(new Dimension(Short.MAX_VALUE, getPreferredSize().height)); |
130 |
|
setAlignmentX(JPanel.LEFT_ALIGNMENT); |
131 |
|
} |
132 |
|
|
133 |
|
public void |
134 |
|
apply() { |
135 |
|
int v = Integer.parseInt(spVoiceLimit.getValue().toString()); |
136 |
|
preferences().setIntProperty(GLOBAL_VOICE_LIMIT, v); |
137 |
|
|
138 |
|
int s = Integer.parseInt(spStreamLimit.getValue().toString()); |
139 |
|
preferences().setIntProperty(GLOBAL_STREAM_LIMIT, s); |
140 |
|
|
141 |
|
CC.getTaskQueue().add(new Global.SetPolyphony(v, s)); |
142 |
|
} |
143 |
|
} |
144 |
|
|
145 |
|
|
146 |
public static class MaxVolumePane extends JPanel { |
public static class MaxVolumePane extends JPanel { |
147 |
private final JLabel lMaxMasterVol = |
private final JLabel lMaxMasterVol = |
148 |
new JLabel(i18n.getLabel("JSGeneralProps.lMaxMasterVol")); |
new JLabel(i18n.getLabel("JSGeneralProps.lMaxMasterVol")); |