/** Updates the MIDI device list. */ private void updateMidiDevices() { SamplerModel sm = CC.getSamplerModel(); SamplerChannel sc = getModel().getChannelInfo(); setUpdate(true); try { cbMidiDevice.removeAllItems(); for (MidiDeviceModel m : sm.getMidiDeviceModels()) cbMidiDevice.addItem(m.getDeviceInfo()); MidiDeviceModel mm = sm.getMidiDeviceModel(sc.getMidiInputDevice()); cbMidiDevice.setSelectedItem(mm == null ? null : mm.getDeviceInfo()); } catch (Exception x) { CC.getLogger().log(Level.WARNING, "Unkown error", x); } setUpdate(false); }
/** Updates the channel settings. This method is invoked when changes to the channel were made. */ private void updateChannelProperties() { SamplerModel sm = CC.getSamplerModel(); SamplerChannel sc = getModel().getChannelInfo(); MidiDeviceModel mm = sm.getMidiDeviceModel(sc.getMidiInputDevice()); AudioDeviceModel am = sm.getAudioDeviceModel(sc.getAudioOutputDevice()); if (isUpdate()) CC.getLogger().warning("Unexpected update state!"); setUpdate(true); try { cbMidiDevice.setSelectedItem(mm == null ? null : mm.getDeviceInfo()); cbEngines.setSelectedItem(sc.getEngine()); cbAudioDevice.setSelectedItem(am == null ? null : am.getDeviceInfo()); } catch (Exception x) { CC.getLogger().log(Level.WARNING, "Unkown error", x); } setUpdate(false); }