Пример #1
0
  /** Updates the audio device list. */
  private void updateAudioDevices() {
    SamplerModel sm = CC.getSamplerModel();
    SamplerChannel sc = getModel().getChannelInfo();

    setUpdate(true);

    try {
      cbAudioDevice.removeAllItems();

      for (AudioDeviceModel m : sm.getAudioDeviceModels()) cbAudioDevice.addItem(m.getDeviceInfo());

      AudioDeviceModel am = sm.getAudioDeviceModel(sc.getAudioOutputDevice());
      cbAudioDevice.setSelectedItem(am == null ? null : am.getDeviceInfo());
    } catch (Exception x) {
      CC.getLogger().log(Level.WARNING, "Unkown error", x);
    }

    setUpdate(false);
  }
    ChannelRoutingTable() {
      super(new ChannelRoutingTableModel());

      JComboBox cb = new JComboBox();
      int devId = channel.getAudioOutputDevice();
      AudioDeviceModel adm = CC.getSamplerModel().getAudioDeviceModel(devId);

      if (adm == null) {
        setEnabled(false);
      } else {
        int chns = adm.getDeviceInfo().getAudioChannelCount();
        for (Integer i = 0; i < chns; i++) cb.addItem(i);
      }

      TableColumn column = getColumnModel().getColumn(1);
      column.setCellEditor(new DefaultCellEditor(cb));
    }
Пример #3
0
  /** 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);
  }