/[svn]/jsampler/trunk/src/org/jsampler/view/std/JSAddMidiInstrumentDlg.java
ViewVC logotype

Diff of /jsampler/trunk/src/org/jsampler/view/std/JSAddMidiInstrumentDlg.java

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1766 by iliev, Tue Aug 12 16:31:35 2008 UTC revision 1767 by iliev, Mon Sep 8 00:19:27 2008 UTC
# Line 74  public class JSAddMidiInstrumentDlg exte Line 74  public class JSAddMidiInstrumentDlg exte
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();
# Line 82  public class JSAddMidiInstrumentDlg exte Line 82  public class JSAddMidiInstrumentDlg exte
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           */           */
# Line 102  public class JSAddMidiInstrumentDlg exte Line 105  public class JSAddMidiInstrumentDlg exte
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                                    
# Line 176  public class JSAddMidiInstrumentDlg exte Line 184  public class JSAddMidiInstrumentDlg exte
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);
# Line 220  public class JSAddMidiInstrumentDlg exte Line 228  public class JSAddMidiInstrumentDlg exte
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); }

Legend:
Removed from v.1766  
changed lines
  Added in v.1767

  ViewVC Help
Powered by ViewVC