66 |
|
|
67 |
import org.jsampler.CC; |
import org.jsampler.CC; |
68 |
import org.jsampler.HF; |
import org.jsampler.HF; |
69 |
import org.jsampler.Instrument; |
import org.jsampler.OrchestraInstrument; |
70 |
import org.jsampler.MidiInstrumentMap; |
import org.jsampler.MidiInstrumentMap; |
71 |
import org.jsampler.OrchestraModel; |
import org.jsampler.OrchestraModel; |
72 |
import org.jsampler.SamplerChannelModel; |
import org.jsampler.SamplerChannelModel; |
422 |
actionPerformed(ActionEvent e) { |
actionPerformed(ActionEvent e) { |
423 |
DbDirectoryTreeNode n = instrumentsDbTree.getSelectedDirectoryNode(); |
DbDirectoryTreeNode n = instrumentsDbTree.getSelectedDirectoryNode(); |
424 |
if(n == null) return; |
if(n == null) return; |
425 |
instrumentsDbTree.refreshDirectoryContent(n.getInfo().getDirectoryPath()); |
final String path = n.getInfo().getDirectoryPath(); |
426 |
|
instrumentsDbTree.refreshDirectoryContent(path); |
427 |
|
CC.scheduleInTaskQueue(new Runnable() { |
428 |
|
public void |
429 |
|
run() { instrumentsDbTree.setSelectedDirectory(path); } |
430 |
|
}); |
431 |
} |
} |
432 |
|
|
433 |
public void |
public void |
651 |
|
|
652 |
public void |
public void |
653 |
actionPerformed(ActionEvent e) { |
actionPerformed(ActionEvent e) { |
654 |
Object obj = getLeadObject(); |
DbInstrumentInfo[] instruments = getSelectedInstruments(); |
655 |
if(obj == null || !(obj instanceof DbInstrumentInfo)) return; |
int l = instruments.length; |
656 |
|
if(l == 0) return; |
657 |
DbInstrumentInfo info = (DbInstrumentInfo)obj; |
|
658 |
|
if(l > 4) { |
659 |
|
String s = "JSInstrumentsDbTable.confirmAddToMidiMap"; |
660 |
|
s = i18n.getMessage(s, l, midiMap.getName()); |
661 |
|
if(!HF.showYesNoDialog(JSInstrumentsDbTable.this, s)) return; |
662 |
|
} |
663 |
|
|
664 |
JSAddMidiInstrumentDlg dlg; |
JSAddMidiInstrumentDlg dlg; |
665 |
Window w = JuifeUtils.getWindow(JSInstrumentsDbTable.this); |
Window w = JuifeUtils.getWindow(JSInstrumentsDbTable.this); |
666 |
if(w instanceof Dialog) { |
|
667 |
dlg = new JSAddMidiInstrumentDlg((Dialog)w); |
for(DbInstrumentInfo i : instruments) { |
668 |
} else if(w instanceof Frame) { |
if(w instanceof Dialog) { |
669 |
dlg = new JSAddMidiInstrumentDlg((Frame)w); |
dlg = new JSAddMidiInstrumentDlg((Dialog)w, midiMap, i); |
670 |
} else { |
} else if(w instanceof Frame) { |
671 |
dlg = new JSAddMidiInstrumentDlg((Frame)null); |
dlg = new JSAddMidiInstrumentDlg((Frame)w, midiMap, i); |
672 |
|
} else { |
673 |
|
dlg = new JSAddMidiInstrumentDlg((Frame)null, midiMap, i); |
674 |
|
} |
675 |
|
|
676 |
|
dlg.setVisible(true); |
677 |
} |
} |
|
|
|
|
dlg.setInstrumentName(info.getName()); |
|
|
dlg.setVisible(true); |
|
|
if(dlg.isCancelled()) return; |
|
|
|
|
|
MidiInstrumentInfo instrInfo = new MidiInstrumentInfo(); |
|
|
instrInfo.setName(dlg.getInstrumentName()); |
|
|
instrInfo.setFilePath(info.getFilePath()); |
|
|
instrInfo.setInstrumentIndex(info.getInstrumentIndex()); |
|
|
instrInfo.setEngine(info.getFormatFamily()); // TODO: this should be fixed |
|
|
instrInfo.setVolume(dlg.getVolume()); |
|
|
instrInfo.setLoadMode(dlg.getLoadMode()); |
|
|
|
|
|
int id = midiMap.getMapId(); |
|
|
int b = dlg.getMidiBank(); |
|
|
int p = dlg.getMidiProgram(); |
|
|
CC.getSamplerModel().mapBackendMidiInstrument(id, b, p, instrInfo); |
|
678 |
} |
} |
679 |
} |
} |
680 |
|
|
688 |
|
|
689 |
public void |
public void |
690 |
actionPerformed(ActionEvent e) { |
actionPerformed(ActionEvent e) { |
691 |
Object obj = getLeadObject(); |
DbInstrumentInfo[] instruments = getSelectedInstruments(); |
692 |
if(obj == null || !(obj instanceof DbInstrumentInfo)) return; |
int l = instruments.length; |
693 |
DbInstrumentInfo info = (DbInstrumentInfo)obj; |
if(l == 0) return; |
694 |
Instrument instr = new Instrument(); |
|
695 |
instr.setPath(info.getFilePath()); |
if(l > 1) { |
696 |
instr.setInstrumentIndex(info.getInstrumentIndex()); |
String s = "JSInstrumentsDbTable.confirmAddToOrchestra"; |
697 |
instr.setName(info.getName()); |
s = i18n.getMessage(s, l, orchestraModel.getName()); |
698 |
instr.setDescription(info.getDescription()); |
if(!HF.showYesNoDialog(JSInstrumentsDbTable.this, s)) return; |
699 |
instr.setEngine(info.getFormatFamily()); // TODO: this should be fixed |
} |
700 |
orchestraModel.addInstrument(instr); |
|
701 |
|
for(DbInstrumentInfo i : instruments) { |
702 |
|
OrchestraInstrument instr = new OrchestraInstrument(); |
703 |
|
instr.setFilePath(i.getFilePath()); |
704 |
|
instr.setInstrumentIndex(i.getInstrumentIndex()); |
705 |
|
instr.setName(i.getName()); |
706 |
|
instr.setDescription(i.getDescription()); |
707 |
|
instr.setEngine(i.getFormatFamily()); // TODO: this should be fixed |
708 |
|
orchestraModel.addInstrument(instr); |
709 |
|
} |
710 |
} |
} |
711 |
} |
} |
712 |
|
|