74 |
new JLabel(i18n.getLabel("JSAddMidiInstrumentDlg.lLoadMode")); |
new JLabel(i18n.getLabel("JSAddMidiInstrumentDlg.lLoadMode")); |
75 |
|
|
76 |
private final JTextField tfName = new JTextField(); |
private final JTextField tfName = new JTextField(); |
77 |
private final JSpinner spinnerBank = new JSpinner(new SpinnerNumberModel(0, 0, 16383, 1)); |
private JSpinner spinnerBank; |
78 |
private final JComboBox cbProgram = new JComboBox(); |
private final JComboBox cbProgram = new JComboBox(); |
79 |
private final JSlider slVolume = new JSlider(0, 100, 100); |
private final JSlider slVolume = new JSlider(0, 100, 100); |
80 |
private final JComboBox cbLoadMode = new JComboBox(); |
private final JComboBox cbLoadMode = new JComboBox(); |
82 |
private MidiInstrumentMap map; |
private MidiInstrumentMap map; |
83 |
private Instrument instr; |
private Instrument instr; |
84 |
|
|
85 |
|
private int mbBase; |
86 |
|
private int mpBase; |
87 |
|
|
88 |
/** |
/** |
89 |
* Creates a new instance of <code>JSAddMidiInstrumentDlg</code> |
* Creates a new instance of <code>JSAddMidiInstrumentDlg</code> |
90 |
*/ |
*/ |
105 |
|
|
106 |
private void |
private void |
107 |
initAddMidiInstrumentDlg(final MidiInstrumentMap map, Instrument instr) { |
initAddMidiInstrumentDlg(final MidiInstrumentMap map, Instrument instr) { |
108 |
|
mbBase = CC.getViewConfig().getFirstMidiBankNumber(); |
109 |
|
mpBase = CC.getViewConfig().getFirstMidiProgramNumber(); |
110 |
|
|
111 |
|
spinnerBank = new JSpinner(new SpinnerNumberModel(mbBase, mbBase, 16383 + mbBase, 1)); |
112 |
|
|
113 |
this.map = map; |
this.map = map; |
114 |
this.instr = instr; |
this.instr = instr; |
115 |
|
|
184 |
setResizable(true); |
setResizable(true); |
185 |
setMinimumSize(getPreferredSize()); |
setMinimumSize(getPreferredSize()); |
186 |
|
|
187 |
for(int i = 0; i < 128; i++) cbProgram.addItem(new Integer(i)); |
for(int i = 0; i < 128; i++) cbProgram.addItem(new Integer(i + mpBase)); |
188 |
|
|
189 |
cbLoadMode.addItem(MidiInstrumentInfo.LoadMode.DEFAULT); |
cbLoadMode.addItem(MidiInstrumentInfo.LoadMode.DEFAULT); |
190 |
cbLoadMode.addItem(MidiInstrumentInfo.LoadMode.ON_DEMAND); |
cbLoadMode.addItem(MidiInstrumentInfo.LoadMode.ON_DEMAND); |
228 |
} |
} |
229 |
|
|
230 |
/** |
/** |
231 |
* Gets the selected MIDI bank. |
* Gets the selected MIDI bank (always zero-based). |
232 |
*/ |
*/ |
233 |
public int |
public int |
234 |
getMidiBank() { return Integer.parseInt(spinnerBank.getValue().toString()); } |
getMidiBank() { return Integer.parseInt(spinnerBank.getValue().toString()) - mbBase; } |
235 |
|
|
236 |
/** |
/** |
237 |
* Sets the selected MIDI bank. |
* Sets the selected MIDI bank (always zero-based). |
238 |
*/ |
*/ |
239 |
public void |
public void |
240 |
setMidiBank(int bank) { spinnerBank.setValue(bank); } |
setMidiBank(int bank) { spinnerBank.setValue(mbBase + bank); } |
241 |
|
|
242 |
/** |
/** |
243 |
* Gets the selected MIDI program. |
* Gets the selected MIDI program (always zero-based). |
244 |
*/ |
*/ |
245 |
public int |
public int |
246 |
getMidiProgram() { return cbProgram.getSelectedIndex(); } |
getMidiProgram() { return cbProgram.getSelectedIndex(); } |
247 |
|
|
248 |
/** |
/** |
249 |
* Sets the selected MIDI program. |
* Sets the selected MIDI program (always zero-based). |
250 |
*/ |
*/ |
251 |
public void |
public void |
252 |
setMidiProgram(int program) { cbProgram.setSelectedIndex(program); } |
setMidiProgram(int program) { cbProgram.setSelectedIndex(program); } |