22 |
|
|
23 |
package org.jsampler.view.fantasia; |
package org.jsampler.view.fantasia; |
24 |
|
|
25 |
import java.awt.BorderLayout; |
import java.awt.AlphaComposite; |
26 |
|
import java.awt.Color; |
27 |
|
import java.awt.Composite; |
28 |
|
import java.awt.Dimension; |
29 |
|
import java.awt.GradientPaint; |
30 |
|
import java.awt.Graphics; |
31 |
|
import java.awt.Graphics2D; |
32 |
|
import java.awt.GridBagConstraints; |
33 |
|
import java.awt.GridBagLayout; |
34 |
import java.awt.Insets; |
import java.awt.Insets; |
35 |
|
import java.awt.Paint; |
36 |
|
import java.awt.RenderingHints; |
37 |
|
|
38 |
|
import java.awt.event.ActionEvent; |
39 |
|
import java.awt.event.ActionListener; |
40 |
|
import java.awt.event.FocusEvent; |
41 |
|
import java.awt.event.FocusListener; |
42 |
|
import java.awt.event.MouseEvent; |
43 |
|
import java.awt.event.MouseAdapter; |
44 |
|
|
45 |
|
import java.awt.geom.Line2D; |
46 |
|
import java.awt.geom.Rectangle2D; |
47 |
|
|
48 |
import java.beans.PropertyChangeEvent; |
import java.beans.PropertyChangeEvent; |
49 |
import java.beans.PropertyChangeListener; |
import java.beans.PropertyChangeListener; |
50 |
|
|
51 |
import javax.swing.BorderFactory; |
import javax.swing.BorderFactory; |
52 |
|
import javax.swing.Box; |
53 |
|
import javax.swing.BoxLayout; |
54 |
|
import javax.swing.ImageIcon; |
55 |
|
import javax.swing.JButton; |
56 |
|
import javax.swing.JPanel; |
57 |
|
import javax.swing.JToggleButton; |
58 |
|
|
59 |
import javax.swing.event.ListSelectionEvent; |
import javax.swing.event.ListSelectionEvent; |
60 |
import javax.swing.event.ListSelectionListener; |
import javax.swing.event.ListSelectionListener; |
74 |
import org.jsampler.view.std.JSPianoRoll; |
import org.jsampler.view.std.JSPianoRoll; |
75 |
|
|
76 |
import org.linuxsampler.lscp.Instrument; |
import org.linuxsampler.lscp.Instrument; |
77 |
|
import org.linuxsampler.lscp.SamplerChannel; |
78 |
|
|
79 |
import org.linuxsampler.lscp.event.MidiDataEvent; |
import org.linuxsampler.lscp.event.MidiDataEvent; |
80 |
import org.linuxsampler.lscp.event.MidiDataListener; |
import org.linuxsampler.lscp.event.MidiDataListener; |
81 |
|
|
82 |
|
import static javax.swing.Action.SMALL_ICON; |
83 |
import static org.jsampler.task.Global.GetFileInstrument; |
import static org.jsampler.task.Global.GetFileInstrument; |
84 |
|
import static org.jsampler.view.fantasia.FantasiaI18n.i18n; |
85 |
|
|
86 |
/** |
/** |
87 |
* |
* |
88 |
* @author Grigor Iliev |
* @author Grigor Iliev |
89 |
*/ |
*/ |
90 |
public class PianoKeyboardPane extends PixmapPane |
public class PianoKeyboardPane extends FantasiaPanel |
91 |
implements ListSelectionListener, SamplerChannelListListener { |
implements ListSelectionListener, SamplerChannelListListener { |
92 |
|
|
93 |
|
protected final JToggleButton btnPower = new PowerButton(); |
94 |
|
private final FantasiaLabel lDisplay = new FantasiaLabel(" ", true); |
95 |
private final JSPianoRoll pianoRoll = new JSPianoRoll(); |
private final JSPianoRoll pianoRoll = new JSPianoRoll(); |
96 |
private SamplerChannelModel channel = null; |
private SamplerChannelModel channel = null; |
97 |
|
|
100 |
|
|
101 |
public |
public |
102 |
PianoKeyboardPane() { |
PianoKeyboardPane() { |
103 |
super(Res.gfxDeviceBg); |
pianoRoll.actionDecreaseKeyNumber.putValue(SMALL_ICON, Res.gfxBtnDecrease); |
104 |
setPixmapInsets(new java.awt.Insets(1, 1, 1, 1)); |
pianoRoll.actionIncreaseKeyNumber.putValue(SMALL_ICON, Res.gfxBtnIncrease); |
105 |
|
pianoRoll.actionScrollLeft.putValue(SMALL_ICON, Res.gfxBtnScrollLeft); |
106 |
|
pianoRoll.actionScrollRight.putValue(SMALL_ICON, Res.gfxBtnScrollRight); |
107 |
|
|
108 |
setOpaque(false); |
setOpaque(false); |
109 |
|
|
110 |
setLayout(new BorderLayout()); |
GridBagLayout gridbag = new GridBagLayout(); |
111 |
setBorder(BorderFactory.createEmptyBorder(3, 3, 3, 3)); |
GridBagConstraints c = new GridBagConstraints(); |
112 |
|
|
113 |
|
setLayout(gridbag); |
114 |
|
|
115 |
PixmapPane p2 = new PixmapPane(Res.gfxBorder); |
setBorder(BorderFactory.createEmptyBorder(0, 3, 5, 3)); |
116 |
p2.setPixmapInsets(new Insets(1, 1, 1, 1)); |
|
117 |
p2.setLayout(new BorderLayout()); |
c.fill = GridBagConstraints.NONE; |
118 |
p2.setBorder(BorderFactory.createEmptyBorder(0, 1, 0, 1)); |
|
119 |
p2.add(pianoRoll); |
c.gridx = 0; |
120 |
add(p2); |
c.gridy = 0; |
121 |
|
c.anchor = GridBagConstraints.NORTHWEST; |
122 |
|
c.insets = new Insets(3, 3, 3, 3); |
123 |
|
gridbag.setConstraints(btnPower, c); |
124 |
|
add(btnPower); |
125 |
|
|
126 |
|
JPanel p = createVSeparator(); |
127 |
|
c.gridx = 1; |
128 |
|
c.gridy = 0; |
129 |
|
c.gridheight = 2; |
130 |
|
c.insets = new Insets(3, 0, 5, 3); |
131 |
|
c.fill = GridBagConstraints.VERTICAL; |
132 |
|
c.weighty = 1.0; |
133 |
|
gridbag.setConstraints(p, c); |
134 |
|
add(p); |
135 |
|
|
136 |
|
p = new KeyRangePropsPane(); |
137 |
|
|
138 |
|
c.gridx = 2; |
139 |
|
c.gridy = 0; |
140 |
|
c.gridheight = 1; |
141 |
|
c.insets = new Insets(0, 0, 0, 0); |
142 |
|
c.fill = GridBagConstraints.NONE; |
143 |
|
c.weighty = 0.0; |
144 |
|
c.anchor = GridBagConstraints.WEST; |
145 |
|
gridbag.setConstraints(p, c); |
146 |
|
add(p); |
147 |
|
|
148 |
|
p = new KeyRangePropsPane(); |
149 |
|
|
150 |
|
c.gridx = 6; |
151 |
|
c.gridy = 0; |
152 |
|
c.anchor = GridBagConstraints.EAST; |
153 |
|
c.insets = new Insets(0, 0, 0, 10); |
154 |
|
gridbag.setConstraints(p, c); |
155 |
|
add(p); |
156 |
|
|
157 |
|
lDisplay.setPreferredSize(new Dimension(300, lDisplay.getPreferredSize().height)); |
158 |
|
|
159 |
|
c.gridx = 4; |
160 |
|
c.gridy = 0; |
161 |
|
c.insets = new Insets(3, 3, 3, 12); |
162 |
|
c.fill = GridBagConstraints.NONE; |
163 |
|
c.weightx = 0.0; |
164 |
|
gridbag.setConstraints(lDisplay, c); |
165 |
|
add(lDisplay); |
166 |
|
|
167 |
|
p = new JPanel(); |
168 |
|
p.setOpaque(false); |
169 |
|
c.gridx = 3; |
170 |
|
c.gridy = 0; |
171 |
|
c.insets = new Insets(0, 0, 0, 0); |
172 |
|
c.fill = GridBagConstraints.HORIZONTAL; |
173 |
|
c.weightx = 1.0; |
174 |
|
gridbag.setConstraints(p, c); |
175 |
|
add(p); |
176 |
|
|
177 |
|
p = new JPanel(); |
178 |
|
p.setOpaque(false); |
179 |
|
c.gridx = 5; |
180 |
|
c.gridy = 0; |
181 |
|
gridbag.setConstraints(p, c); |
182 |
|
add(p); |
183 |
|
|
184 |
|
pianoRoll.setFocusable(false); |
185 |
|
pianoRoll.setBackground(new Color(0x2e2e2e)); |
186 |
|
//pianoRoll.setOpaque(false); |
187 |
|
|
|
pianoRoll.setOpaque(false); |
|
188 |
disablePianoRoll(); |
disablePianoRoll(); |
189 |
add(p2); |
|
190 |
|
c.gridx = 2; |
191 |
|
c.gridy = 1; |
192 |
|
c.gridwidth = 5; |
193 |
|
c.insets = new Insets(0, 3, 0, 12); |
194 |
|
c.fill = GridBagConstraints.BOTH; |
195 |
|
c.weightx = 1.0; |
196 |
|
c.weighty = 1.0; |
197 |
|
gridbag.setConstraints(pianoRoll, c); |
198 |
|
add(pianoRoll); |
199 |
|
|
200 |
CC.getSamplerModel().addSamplerChannelListListener(this); |
CC.getSamplerModel().addSamplerChannelListListener(this); |
201 |
pianoRoll.addMidiDataListener(getHandler()); |
pianoRoll.addMidiDataListener(getHandler()); |
211 |
|
|
212 |
CC.preferences().addPropertyChangeListener("midiKeyboard.firstKey", l); |
CC.preferences().addPropertyChangeListener("midiKeyboard.firstKey", l); |
213 |
CC.preferences().addPropertyChangeListener("midiKeyboard.lastKey", l); |
CC.preferences().addPropertyChangeListener("midiKeyboard.lastKey", l); |
214 |
|
|
215 |
|
addFocusListener(getHandler()); |
216 |
|
|
217 |
|
MouseAdapter l2 = new MouseAdapter() { |
218 |
|
public void |
219 |
|
mouseClicked(MouseEvent e) { requestFocusInWindow(); } |
220 |
|
}; |
221 |
|
|
222 |
|
addKeyListener(pianoRoll.getKeyListener()); |
223 |
|
pianoRoll.registerKeys(this); |
224 |
|
|
225 |
|
addMouseListener(l2); |
226 |
|
pianoRoll.addMouseListener(l2); |
227 |
|
lDisplay.addMouseListener(l2); |
228 |
} |
} |
229 |
|
|
230 |
public JSPianoRoll |
public JSPianoRoll |
235 |
int firstKey = CC.preferences().getIntProperty("midiKeyboard.firstKey"); |
int firstKey = CC.preferences().getIntProperty("midiKeyboard.firstKey"); |
236 |
int lastKey = CC.preferences().getIntProperty("midiKeyboard.lastKey"); |
int lastKey = CC.preferences().getIntProperty("midiKeyboard.lastKey"); |
237 |
pianoRoll.setKeyRange(firstKey, lastKey); |
pianoRoll.setKeyRange(firstKey, lastKey); |
|
pianoRoll.setAllKeysDisabled(true); |
|
|
updateInstrumentInfo(); |
|
238 |
} |
} |
239 |
|
|
240 |
@Override public void |
@Override public void |
298 |
channel.addMidiDataListener(pianoRoll); |
channel.addMidiDataListener(pianoRoll); |
299 |
channel.addSamplerChannelListener(getHandler()); |
channel.addSamplerChannelListener(getHandler()); |
300 |
|
|
301 |
|
updateDisplay(); |
302 |
|
|
303 |
file = channel.getChannelInfo().getInstrumentFile(); |
file = channel.getChannelInfo().getInstrumentFile(); |
304 |
if(file == null) { |
if(file == null) { |
305 |
disablePianoRoll(); |
disablePianoRoll(); |
319 |
index = -1; |
index = -1; |
320 |
disablePianoRoll(); |
disablePianoRoll(); |
321 |
} |
} |
322 |
|
|
323 |
|
updateDisplay(); |
324 |
} |
} |
325 |
|
|
326 |
@Override public void |
@Override public void |
327 |
channelAdded(SamplerChannelListEvent e) { } |
channelAdded(SamplerChannelListEvent e) { |
328 |
|
updateDisplay(); |
329 |
|
} |
330 |
|
|
331 |
@Override public void |
@Override public void |
332 |
channelRemoved(SamplerChannelListEvent e) { |
channelRemoved(SamplerChannelListEvent e) { |
333 |
if(e.getChannelModel() == channel) { |
if(e.getChannelModel() == channel) { |
334 |
disconnectChannel(); |
disconnectChannel(); |
335 |
} |
} |
336 |
|
|
337 |
|
updateDisplay(); |
338 |
|
} |
339 |
|
|
340 |
|
private JPanel |
341 |
|
createVSeparator() { |
342 |
|
PixmapPane p = new PixmapPane(Res.gfxVLine); |
343 |
|
p.setAlignmentY(JPanel.TOP_ALIGNMENT); |
344 |
|
p.setPreferredSize(new Dimension(2, 60)); |
345 |
|
p.setMaximumSize(new Dimension(2, Short.MAX_VALUE)); |
346 |
|
return p; |
347 |
|
} |
348 |
|
|
349 |
|
private Color color1 = new Color(0x7a7a7a); |
350 |
|
private Color color2 = new Color(0x5e5e5e); |
351 |
|
private Color color3 = new Color(0x2e2e2e); |
352 |
|
|
353 |
|
@Override |
354 |
|
public void |
355 |
|
paintComponent(Graphics g) { |
356 |
|
Graphics2D g2 = (Graphics2D)g; |
357 |
|
|
358 |
|
Paint oldPaint = g2.getPaint(); |
359 |
|
Composite oldComposite = g2.getComposite(); |
360 |
|
|
361 |
|
Insets insets = this.getInsets(); |
362 |
|
double x1 = insets.left; |
363 |
|
double y1 = insets.top; |
364 |
|
|
365 |
|
double w = getSize().getWidth(); |
366 |
|
double x2 = w - insets.right - 1; |
367 |
|
double h = getSize().getHeight(); |
368 |
|
double y2 = h - insets.bottom - 1; |
369 |
|
|
370 |
|
FantasiaPainter.paintGradient(g2, x1, y1, x2, y2 - 10, color1, color2); |
371 |
|
|
372 |
|
g2.setRenderingHint ( |
373 |
|
RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_OFF |
374 |
|
); |
375 |
|
|
376 |
|
double y3 = y2 - 10; |
377 |
|
if(y3 < 0) y3 = 0; |
378 |
|
|
379 |
|
Rectangle2D.Double rect = new Rectangle2D.Double(x1, y3, x2 - x1 + 1, 11); |
380 |
|
|
381 |
|
GradientPaint gr = new GradientPaint ( |
382 |
|
0.0f, (float)y3, color2, |
383 |
|
0.0f, (float)h, color3 |
384 |
|
); |
385 |
|
|
386 |
|
g2.setPaint(gr); |
387 |
|
g2.fill(rect); |
388 |
|
|
389 |
|
drawOutBorder(g2, x1, y1, x2, y2); |
390 |
|
|
391 |
|
double prX = pianoRoll.getLocation().getX(); |
392 |
|
double prY = pianoRoll.getLocation().getY(); |
393 |
|
drawInBorder ( |
394 |
|
g2, prX - 2, prY - 2, |
395 |
|
prX + pianoRoll.getSize().getWidth() + 1, prY + pianoRoll.getSize().getHeight() - 3 |
396 |
|
); |
397 |
|
|
398 |
|
g2.setPaint(oldPaint); |
399 |
|
g2.setComposite(oldComposite); |
400 |
|
} |
401 |
|
|
402 |
|
private void |
403 |
|
drawOutBorder(Graphics2D g2, double x1, double y1, double x2, double y2) { |
404 |
|
AlphaComposite ac = AlphaComposite.getInstance(AlphaComposite.SRC_OVER, 0.40f); |
405 |
|
g2.setComposite(ac); |
406 |
|
|
407 |
|
g2.setPaint(Color.WHITE); |
408 |
|
Line2D.Double l = new Line2D.Double(x1, y1, x2, y1); |
409 |
|
g2.draw(l); |
410 |
|
|
411 |
|
g2.setComposite(ac.derive(0.20f)); |
412 |
|
l = new Line2D.Double(x1, y1 + 1, x2, y1 + 1); |
413 |
|
g2.draw(l); |
414 |
|
|
415 |
|
g2.setComposite(ac.derive(0.255f)); |
416 |
|
|
417 |
|
l = new Line2D.Double(x1, y1, x1, y2); |
418 |
|
g2.draw(l); |
419 |
|
|
420 |
|
g2.setComposite(ac.derive(0.40f)); |
421 |
|
g2.setPaint(Color.BLACK); |
422 |
|
|
423 |
|
//l = new Line2D.Double(x1, y2, x2, y2); |
424 |
|
//g2.draw(l); |
425 |
|
|
426 |
|
g2.setComposite(ac.derive(0.20f)); |
427 |
|
|
428 |
|
l = new Line2D.Double(x2, y1, x2, y2); |
429 |
|
g2.draw(l); |
430 |
|
} |
431 |
|
|
432 |
|
private void |
433 |
|
drawInBorder(Graphics2D g2, double x1, double y1, double x2, double y2) { |
434 |
|
AlphaComposite ac = AlphaComposite.getInstance(AlphaComposite.SRC_OVER, 0.40f); |
435 |
|
g2.setComposite(ac); |
436 |
|
|
437 |
|
g2.setPaint(Color.WHITE); |
438 |
|
Line2D.Double l = new Line2D.Double(x1, y2, x2, y2); |
439 |
|
//g2.draw(l); |
440 |
|
|
441 |
|
g2.setComposite(ac.derive(0.255f)); |
442 |
|
|
443 |
|
l = new Line2D.Double(x2 - 1, y1 + 1, x2 - 1, y2 + 1); |
444 |
|
g2.draw(l); |
445 |
|
|
446 |
|
g2.setComposite(ac.derive(0.13f)); |
447 |
|
|
448 |
|
l = new Line2D.Double(x2, y1, x2, y2); |
449 |
|
g2.draw(l); |
450 |
|
|
451 |
|
g2.setComposite(ac.derive(0.20f)); |
452 |
|
g2.setPaint(Color.BLACK); |
453 |
|
|
454 |
|
l = new Line2D.Double(x1, y1, x2, y1); |
455 |
|
g2.draw(l); |
456 |
|
|
457 |
|
g2.setComposite(ac.derive(0.40f)); |
458 |
|
g2.setPaint(Color.BLACK); |
459 |
|
|
460 |
|
l = new Line2D.Double(x1 + 1, y1 + 1, x2 - 1, y1 + 1); |
461 |
|
g2.draw(l); |
462 |
|
|
463 |
|
g2.setComposite(ac.derive(0.20f)); |
464 |
|
|
465 |
|
l = new Line2D.Double(x1, y1, x1, y2); |
466 |
|
g2.draw(l); |
467 |
|
|
468 |
|
g2.setComposite(ac.derive(0.40f)); |
469 |
|
|
470 |
|
l = new Line2D.Double(x1 + 1, y1 + 1, x1 + 1, y2 + 1); |
471 |
|
g2.draw(l); |
472 |
|
} |
473 |
|
|
474 |
|
private void |
475 |
|
updateDisplay() { |
476 |
|
// TODO: called too often? |
477 |
|
if(channel == null) { |
478 |
|
lDisplay.setText(i18n.getLabel("PianoKeyboardPane.noChannel")); |
479 |
|
return; |
480 |
|
} |
481 |
|
|
482 |
|
SamplerChannel sc = channel.getChannelInfo(); |
483 |
|
int i = CC.getSamplerModel().getChannelIndex(channel) + 1; |
484 |
|
|
485 |
|
StringBuffer sb = new StringBuffer(); |
486 |
|
sb.append(i18n.getLabel("PianoKeyboardPane.channel", i)).append(" - "); |
487 |
|
|
488 |
|
int status = sc.getInstrumentStatus(); |
489 |
|
if(status >= 0 && status < 100) { |
490 |
|
sb.append(i18n.getLabel("ChannelScreen.loadingInstrument", status)); |
491 |
|
} else if(status == -1) { |
492 |
|
sb.append(i18n.getLabel("PianoKeyboardPane.noInstrument")); |
493 |
|
} else if(status < -1) { |
494 |
|
sb.append(i18n.getLabel("ChannelScreen.errorLoadingInstrument")); |
495 |
|
} else { |
496 |
|
if(sc.getInstrumentName() != null) sb.append(sc.getInstrumentName()); |
497 |
|
} |
498 |
|
|
499 |
|
lDisplay.setText(sb.toString()); |
500 |
|
} |
501 |
|
|
502 |
|
|
503 |
|
class KeyRangePropsPane extends JPanel { |
504 |
|
private final JButton btnIncrease = |
505 |
|
new PixmapButton(pianoRoll.actionIncreaseKeyNumber, Res.gfxBtnIncrease); |
506 |
|
|
507 |
|
private final JButton btnDecrease = |
508 |
|
new PixmapButton(pianoRoll.actionDecreaseKeyNumber, Res.gfxBtnDecrease); |
509 |
|
|
510 |
|
private final JButton btnScrollLeft = |
511 |
|
new PixmapButton(pianoRoll.actionScrollLeft, Res.gfxBtnScrollLeft); |
512 |
|
|
513 |
|
private final JButton btnScrollRight = |
514 |
|
new PixmapButton(pianoRoll.actionScrollRight, Res.gfxBtnScrollRight); |
515 |
|
|
516 |
|
KeyRangePropsPane() { |
517 |
|
setOpaque(false); |
518 |
|
setLayout(new BoxLayout(this, BoxLayout.X_AXIS)); |
519 |
|
|
520 |
|
btnIncrease.setFocusable(false); |
521 |
|
btnDecrease.setFocusable(false); |
522 |
|
btnScrollLeft.setFocusable(false); |
523 |
|
btnScrollRight.setFocusable(false); |
524 |
|
|
525 |
|
|
526 |
|
btnDecrease.setPressedIcon(Res.gfxBtnDecreaseRO); |
527 |
|
add(btnDecrease); |
528 |
|
|
529 |
|
btnIncrease.setPressedIcon(Res.gfxBtnIncreaseRO); |
530 |
|
add(btnIncrease); |
531 |
|
|
532 |
|
add(Box.createRigidArea(new Dimension(6, 0))); |
533 |
|
|
534 |
|
btnScrollLeft.setPressedIcon(Res.gfxBtnScrollLeftRO); |
535 |
|
add(btnScrollLeft); |
536 |
|
|
537 |
|
btnScrollRight.setPressedIcon(Res.gfxBtnScrollRightRO); |
538 |
|
add(btnScrollRight); |
539 |
|
} |
540 |
|
} |
541 |
|
|
542 |
|
|
543 |
|
public static class PowerButton extends PixmapToggleButton implements ActionListener { |
544 |
|
PowerButton() { |
545 |
|
this(Res.gfxPowerOff, Res.gfxPowerOn); |
546 |
|
} |
547 |
|
|
548 |
|
PowerButton(ImageIcon defaultIcon, ImageIcon selectedIcon) { |
549 |
|
super(defaultIcon, selectedIcon); |
550 |
|
|
551 |
|
setSelected(true); |
552 |
|
addActionListener(this); |
553 |
|
} |
554 |
|
|
555 |
|
@Override |
556 |
|
public void |
557 |
|
actionPerformed(ActionEvent e) { |
558 |
|
boolean b = isSelected(); |
559 |
|
MainFrame frm = (MainFrame)CC.getMainFrame(); |
560 |
|
if(frm == null) return; |
561 |
|
frm.setMidiKeyboardVisible(b); |
562 |
|
} |
563 |
|
|
564 |
|
@Override |
565 |
|
public boolean |
566 |
|
contains(int x, int y) { return (x - 11)*(x - 11) + (y - 11)*(y - 11) < 71; } |
567 |
} |
} |
568 |
|
|
569 |
private final Handler handler = new Handler(); |
private final Handler handler = new Handler(); |
571 |
private Handler |
private Handler |
572 |
getHandler() { return handler; } |
getHandler() { return handler; } |
573 |
|
|
574 |
private class Handler extends SamplerChannelAdapter implements MidiDataListener { |
private class Handler extends SamplerChannelAdapter implements FocusListener, MidiDataListener { |
575 |
|
@Override |
576 |
public void |
public void |
577 |
midiDataArrived(MidiDataEvent e) { |
midiDataArrived(MidiDataEvent e) { |
578 |
if(channel == null) return; |
if(channel == null) return; |
579 |
channel.sendBackendMidiData(e); |
channel.sendBackendMidiData(e); |
580 |
} |
} |
581 |
|
|
582 |
|
@Override |
583 |
public void |
public void |
584 |
channelChanged(SamplerChannelEvent e) { |
channelChanged(SamplerChannelEvent e) { |
585 |
|
updateDisplay(); |
586 |
|
|
587 |
String newFile = channel.getChannelInfo().getInstrumentFile(); |
String newFile = channel.getChannelInfo().getInstrumentFile(); |
588 |
int newIndex = channel.getChannelInfo().getInstrumentIndex(); |
int newIndex = channel.getChannelInfo().getInstrumentIndex(); |
589 |
|
|
609 |
index = newIndex; |
index = newIndex; |
610 |
updateInstrumentInfo(); |
updateInstrumentInfo(); |
611 |
} |
} |
612 |
|
|
613 |
|
@Override |
614 |
|
public void |
615 |
|
focusGained(FocusEvent e) { |
616 |
|
|
617 |
|
} |
618 |
|
|
619 |
|
@Override |
620 |
|
public void |
621 |
|
focusLost(FocusEvent e) { |
622 |
|
|
623 |
|
} |
624 |
} |
} |
625 |
} |
} |