Esempio n. 1
0
  /**
   * Add filters according to the current emulation and chip model of the currently played tune.
   *
   * @param tune currently played tune
   * @param num SID chip number
   * @param filters resulting filter list to add matching filter names to
   * @param filter combo box to select currently selected filter
   */
  private void addFilters(
      final SidTune tune, int num, ObservableList<String> filters, ComboBox<String> filter) {
    EmulationSection emulationSection = util.getConfig().getEmulationSection();

    boolean filterEnable = emulationSection.isFilterEnable(num);

    Emulation emulation = Emulation.getEmulation(emulationSection, tune, num);
    ChipModel model = ChipModel.getChipModel(emulationSection, tune, num);
    String filterName = filterEnable ? emulationSection.getFilterName(num, emulation, model) : null;

    filters.clear();
    filters.add("");
    for (IFilterSection filterSection : util.getConfig().getFilterSection()) {
      if (emulation.equals(Emulation.RESIDFP)) {
        if (filterSection.isReSIDfpFilter6581() && model == ChipModel.MOS6581) {
          filters.add(filterSection.getName());
        } else if (filterSection.isReSIDfpFilter8580() && model == ChipModel.MOS8580) {
          filters.add(filterSection.getName());
        }
      } else {
        if (filterSection.isReSIDFilter6581() && model == ChipModel.MOS6581) {
          filters.add(filterSection.getName());
        } else if (filterSection.isReSIDFilter8580() && model == ChipModel.MOS8580) {
          filters.add(filterSection.getName());
        }
      }
    }
    if (filterEnable) {
      filter.getSelectionModel().select(filterName);
    } else {
      filter.getSelectionModel().select(0);
    }
  }
Esempio n. 2
0
  /**
   * Set filter name of the specified SID number according to the current emulation and chip model
   *
   * @param sidNum SID chip number
   * @param filterBox filter combo box
   */
  private void setFilter(int sidNum, ComboBox<String> filterBox) {
    IEmulationSection emulationSection = util.getConfig().getEmulationSection();

    String filterName = filterBox.getSelectionModel().getSelectedItem();
    boolean filterDisabled = "".equals(filterName);
    emulationSection.setFilterEnable(sidNum, !filterDisabled);

    SidTune tune = util.getPlayer().getTune();
    Emulation emulation = Emulation.getEmulation(emulationSection, tune, sidNum);
    ChipModel model = ChipModel.getChipModel(emulationSection, tune, sidNum);
    emulationSection.setFilterName(sidNum, emulation, model, !filterDisabled ? filterName : null);
  }