Example #1
0
  /** Updates the channel settings. This method is invoked when changes to the channel were made. */
  private void updateChannelInfo() {
    SamplerChannel sc = getChannelInfo();

    int status = sc.getInstrumentStatus();
    if (status >= 0 && status < 100) {
      btnInstr.setText(i18n.getLabel("Channel.loadingInstrument", status));
    } else if (status == -1) {
      btnInstr.setText(i18n.getLabel("Channel.btnInstr"));
    } else if (status < -1) {
      btnInstr.setText(i18n.getLabel("Channel.errorLoadingInstrument"));
    } else {
      if (sc.getInstrumentName() != null) btnInstr.setText(sc.getInstrumentName());
      else btnInstr.setText(i18n.getLabel("Channel.btnInstr"));
    }

    updateMuteIcon(sc);

    if (sc.isSoloChannel()) btnSolo.setIcon(iconSoloOn);
    else btnSolo.setIcon(iconSoloOff);

    slVolume.setValue((int) (sc.getVolume() * 100));

    boolean b = sc.getEngine() != null;
    slVolume.setEnabled(b);
    btnSolo.setEnabled(b);
    btnMute.setEnabled(b);
  }
Example #2
0
  /** Invoked when the user clicks the mute button. */
  private void changeMute() {
    SamplerChannel sc = getChannelInfo();
    boolean b = true;

    /*
     * Changing the mute button icon now instead of
     * leaving the work to the notification mechanism of the LinuxSampler.
     */
    if (sc.isMuted() && !sc.isMutedBySolo()) {
      b = false;
      boolean hasSolo = CC.getSamplerModel().hasSoloChannel();

      if (sc.isSoloChannel() || !hasSolo) btnMute.setIcon(iconMuteOff);
      else btnMute.setIcon(iconMutedBySolo);
    } else btnMute.setIcon(iconMuteOn);

    getModel().setMute(b);
  }
Example #3
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);
  }
Example #4
0
  /** Invoked when the user clicks the solo button. */
  private void changeSolo() {
    SamplerChannel sc = getChannelInfo();
    boolean b = !sc.isSoloChannel();

    /*
     * Changing the solo button icon (and related) now instead of
     * leaving the work to the notification mechanism of the LinuxSampler.
     */
    if (b) {
      btnSolo.setIcon(iconSoloOn);
      if (sc.isMutedBySolo()) btnMute.setIcon(iconMuteOff);
    } else {
      btnSolo.setIcon(iconSoloOff);
      if (!sc.isMuted() && CC.getSamplerModel().getSoloChannelCount() > 1)
        btnMute.setIcon(iconMutedBySolo);
    }

    getModel().setSolo(b);
  }
Example #5
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);
  }
Example #6
0
    public String getInstrument() {
      SamplerChannel sc = Channel.this.getChannelInfo();

      if (sc.getInstrumentName() == null || sc.getInstrumentStatus() < 0) return null;

      Instrument instr = new Instrument();
      instr.setName(sc.getInstrumentName());
      instr.setInstrumentIndex(sc.getInstrumentIndex());
      instr.setPath(sc.getInstrumentFile());
      return instr.getDnDString();
    }
Example #7
0
 /**
  * Updates the mute button with the proper icon regarding to information obtained from <code>
  * channel</code>.
  *
  * @param channel A <code>SamplerChannel</code> instance containing the new settings for this
  *     channel.
  */
 private void updateMuteIcon(SamplerChannel channel) {
   if (channel.isMutedBySolo()) btnMute.setIcon(iconMutedBySolo);
   else if (channel.isMuted()) btnMute.setIcon(iconMuteOn);
   else btnMute.setIcon(iconMuteOff);
 }