Пример #1
0
  public MindmachineOp() {
    super();

    // initialize only in the first instance
    // preferences laden
    if (static_prefs == null) {
      static_prefs = new OpPrefs(getClass(), getDefaultPrefs());
    }
    // propertyarray defaults
    if (static_pr == null) {
      static_pr = new PropertyArray();

      //			static_pr.intg		= prIntg;
      //			static_pr.intgName	= prIntgName;
      static_pr.para = prPara;
      static_pr.para[PR_ANGLE] = new Param(25.0, Param.NONE);
      static_pr.paraName = prParaName;

      static_pr.superPr = Operator.op_static_pr;
    }
    // default preset
    if (static_presets == null) {
      static_presets = new Presets(getClass(), static_pr.toProperties(true));
    }

    // superclass-Felder uebertragen
    opName = "MindmachineOp";
    prefs = static_prefs;
    presets = static_presets;
    pr = (PropertyArray) static_pr.clone();

    // slots
    slots.addElement(new SpectStreamSlot(this, Slots.SLOTS_READER, "in1")); // SLOT_INPUT1
    slots.addElement(new SpectStreamSlot(this, Slots.SLOTS_READER, "in2")); // SLOT_INPUT2
    slots.addElement(new SpectStreamSlot(this, Slots.SLOTS_WRITER)); // SLOT_OUTPUT

    // icon						// XXX
    icon = new OpIcon(this, OpIcon.ID_FLIPFREQ, defaultName);
  }
Пример #2
0
  protected void buildGUI() {
    // einmalig PropertyArray initialisieren
    if (static_pr == null) {
      static_pr = new PropertyArray();
      static_pr.text = prText;
      static_pr.textName = prTextName;
      static_pr.intg = prIntg;
      static_pr.intgName = prIntgName;
      static_pr.bool = prBool;
      static_pr.boolName = prBoolName;
      static_pr.para = prPara;
      static_pr.para[PR_WARP] = new Param(-10.0, Param.FACTOR);
      static_pr.para[PR_WARPMODDEPTH] = new Param(20.0, Param.OFFSET_AMP);
      static_pr.para[PR_INFREQ] = new Param(1000.0, Param.ABS_HZ);
      static_pr.para[PR_OUTFREQ] = new Param(1000.0, Param.ABS_HZ);
      static_pr.paraName = prParaName;
      static_pr.envl = prEnvl;
      static_pr.envl[PR_WARPENV] = Envelope.createBasicEnvelope(Envelope.BASIC_TIME);
      static_pr.envlName = prEnvlName;
      //			static_pr.superPr	= DocumentFrame.static_pr;

      fillDefaultAudioDescr(static_pr.intg, PR_OUTPUTTYPE, PR_OUTPUTRES);
      fillDefaultGain(static_pr.para, PR_GAIN);
      static_presets = new Presets(getClass(), static_pr.toProperties(true));
    }
    presets = static_presets;
    pr = (PropertyArray) static_pr.clone();

    // -------- GUI bauen --------

    GridBagConstraints con;

    PathField ggInputFile, ggOutputFile;
    PathField[] ggParent1;
    ParamField ggWarp, ggWarpModDepth, ggInFreq, ggOutFreq;
    JCheckBox ggWarpMod;
    EnvIcon ggWarpEnv;
    Component[] ggGain;
    JComboBox ggFrameSize, ggOverlap;

    gui = new GUISupport();
    con = gui.getGridBagConstraints();
    con.insets = new Insets(1, 2, 1, 2);

    ParamListener paramL =
        new ParamListener() {
          public void paramChanged(ParamEvent e) {
            int ID = gui.getItemID(e);

            switch (ID) {
              case GG_WARP:
              case GG_INFREQ:
                pr.para[ID - GG_OFF_PARAMFIELD] = ((ParamField) e.getSource()).getParam();
                recalcOutFreq();
                break;

              case GG_OUTFREQ:
                pr.para[ID - GG_OFF_PARAMFIELD] = ((ParamField) e.getSource()).getParam();
                recalcWarpAmount();
                break;
            }
          }
        };

    ItemListener il =
        new ItemListener() {
          public void itemStateChanged(ItemEvent e) {
            int ID = gui.getItemID(e);

            switch (ID) {
              case GG_WARPMOD:
                pr.bool[ID - GG_OFF_CHECKBOX] = ((JCheckBox) e.getSource()).isSelected();
                reflectPropertyChanges();
                break;
            }
          }
        };

    PathListener pathL =
        new PathListener() {
          public void pathChanged(PathEvent e) {
            int ID = gui.getItemID(e);

            switch (ID) {
              case GG_INPUTFILE:
                setInput(((PathField) e.getSource()).getPath().getPath());
                break;
            }
          }
        };

    // -------- I/O-Gadgets --------
    con.fill = GridBagConstraints.BOTH;
    con.gridwidth = GridBagConstraints.REMAINDER;
    gui.addLabel(
        new GroupLabel("Waveform I/O", GroupLabel.ORIENT_HORIZONTAL, GroupLabel.BRACE_NONE));

    ggInputFile =
        new PathField(PathField.TYPE_INPUTFILE + PathField.TYPE_FORMATFIELD, "Select input file");
    ggInputFile.handleTypes(GenericFile.TYPES_SOUND);
    con.gridwidth = 1;
    con.weightx = 0.1;
    gui.addLabel(new JLabel("Input file", SwingConstants.RIGHT));
    con.gridwidth = GridBagConstraints.REMAINDER;
    con.weightx = 0.9;
    gui.addPathField(ggInputFile, GG_INPUTFILE, pathL);

    ggOutputFile =
        new PathField(
            PathField.TYPE_OUTPUTFILE + PathField.TYPE_FORMATFIELD + PathField.TYPE_RESFIELD,
            "Select output file");
    ggOutputFile.handleTypes(GenericFile.TYPES_SOUND);
    con.gridwidth = 1;
    con.weightx = 0.1;
    gui.addLabel(new JLabel("Output file", SwingConstants.RIGHT));
    con.gridwidth = GridBagConstraints.REMAINDER;
    con.weightx = 0.9;
    gui.addPathField(ggOutputFile, GG_OUTPUTFILE, pathL);
    gui.registerGadget(ggOutputFile.getTypeGadget(), GG_OUTPUTTYPE);
    gui.registerGadget(ggOutputFile.getResGadget(), GG_OUTPUTRES);

    ggParent1 = new PathField[1];
    ggParent1[0] = ggInputFile;
    ggOutputFile.deriveFrom(ggParent1, "$D0$F0Wrp$E");

    ggGain = createGadgets(GGTYPE_GAIN);
    con.weightx = 0.1;
    con.gridwidth = 1;
    gui.addLabel(new JLabel("Gain", SwingConstants.RIGHT));
    con.weightx = 0.4;
    gui.addParamField((ParamField) ggGain[0], GG_GAIN, paramL);
    con.weightx = 0.5;
    con.gridwidth = GridBagConstraints.REMAINDER;
    gui.addChoice((JComboBox) ggGain[1], GG_GAINTYPE, il);

    // -------- Settings-Gadgets --------
    gui.addLabel(
        new GroupLabel("Warp settings", GroupLabel.ORIENT_HORIZONTAL, GroupLabel.BRACE_NONE));

    ggWarp = new ParamField(Constants.spaces[Constants.modSpace]); // XXX
    con.weightx = 0.1;
    con.gridwidth = 1;
    gui.addLabel(new JLabel("Warp amount", SwingConstants.RIGHT));
    con.weightx = 0.4;
    gui.addParamField(ggWarp, GG_WARP, paramL);

    ggWarpModDepth = new ParamField(Constants.spaces[Constants.offsetAmpSpace]); // XXX
    ggWarpModDepth.setReference(ggWarp);
    ggWarpMod = new JCheckBox();
    con.weightx = 0.1;
    gui.addCheckbox(ggWarpMod, GG_WARPMOD, il);
    con.weightx = 0.4;
    gui.addParamField(ggWarpModDepth, GG_WARPMODDEPTH, paramL);

    ggWarpEnv = new EnvIcon(getComponent());
    con.weightx = 0.1;
    con.gridwidth = GridBagConstraints.REMAINDER;
    gui.addGadget(ggWarpEnv, GG_WARPENV);

    ggInFreq = new ParamField(Constants.spaces[Constants.absHzSpace]);
    con.weightx = 0.1;
    con.gridwidth = 1;
    gui.addLabel(new JLabel("Input freq.", SwingConstants.RIGHT));
    con.weightx = 0.4;
    gui.addParamField(ggInFreq, GG_INFREQ, paramL);
    ggOutFreq = new ParamField(Constants.spaces[Constants.absHzSpace]);
    con.weightx = 0.1;
    gui.addLabel(new JLabel("\u2192 Output freq.", SwingConstants.RIGHT));
    con.weightx = 0.4;
    con.gridwidth = GridBagConstraints.REMAINDER;
    gui.addParamField(ggOutFreq, GG_OUTFREQ, paramL);

    ggFrameSize = new JComboBox();
    for (int i = 32; i <= 32768; i <<= 1) {
      ggFrameSize.addItem(String.valueOf(i));
    }
    con.weightx = 0.1;
    con.gridwidth = 1;
    gui.addLabel(new JLabel("Frame size [smp]", SwingConstants.RIGHT));
    con.weightx = 0.4;
    gui.addChoice(ggFrameSize, GG_FRAMESIZE, il);

    ggOverlap = new JComboBox();
    for (int i = 1; i <= 16; i++) {
      ggOverlap.addItem(i + "x");
    }
    con.weightx = 0.1;
    gui.addLabel(new JLabel("Overlap", SwingConstants.RIGHT));
    con.weightx = 0.4;
    con.gridwidth = GridBagConstraints.REMAINDER;
    gui.addChoice(ggOverlap, GG_OVERLAP, il);

    initGUI(this, FLAGS_PRESETS | FLAGS_PROGBAR, gui);
  }
Пример #3
0
  protected void buildGUI() {
    // einmalig PropertyArray initialisieren
    if (static_pr == null) {
      static_pr = new PropertyArray();
      static_pr.text = prText;
      static_pr.textName = prTextName;
      static_pr.intg = prIntg;
      static_pr.intgName = prIntgName;
      static_pr.bool = prBool;
      static_pr.boolName = prBoolName;
      static_pr.para = prPara;
      static_pr.para[PR_MAXCHANGE] = new Param(96.0, Param.DECIBEL_AMP);
      static_pr.para[PR_AVERAGE] = new Param(1000.0, Param.ABS_MS);
      static_pr.paraName = prParaName;
      static_pr.envl = prEnvl;
      static_pr.envl[PR_ENV] = Envelope.createBasicEnvelope(Envelope.BASIC_UNSIGNED_TIME);
      static_pr.envl[PR_RIGHTCHANENV] = Envelope.createBasicEnvelope(Envelope.BASIC_UNSIGNED_TIME);
      static_pr.envlName = prEnvlName;
      //			static_pr.superPr	= DocumentFrame.static_pr;

      fillDefaultAudioDescr(static_pr.intg, PR_OUTPUTTYPE, PR_OUTPUTRES);
      fillDefaultAudioDescr(static_pr.intg, PR_ENVOUTTYPE, PR_ENVOUTRES);
      fillDefaultGain(static_pr.para, PR_GAIN);
      fillDefaultGain(static_pr.para, PR_ENVGAIN);
      static_presets = new Presets(getClass(), static_pr.toProperties(true));
    }
    presets = static_presets;
    pr = (PropertyArray) static_pr.clone();

    // -------- GUI bauen --------

    GridBagConstraints con;
    //		GridBagLayout		lay;

    PathField ggInputFile, ggOutputFile, ggEnvInFile, ggEnvOutFile;
    PathField[] ggInputs;
    JComboBox ggEnvSource, ggMode;
    ParamField ggMaxChange, ggAverage;
    JCheckBox ggEnvOutput, ggInvert, ggRightChan;
    EnvIcon ggEnv, ggRightChanEnv;
    Component[] ggGain, ggEnvGain;
    ParamSpace[] spcAverage;
    ParamSpace spcMaxChange;

    gui = new GUISupport();
    con = gui.getGridBagConstraints();
    //		lay				= gui.getGridBagLayout();
    con.insets = new Insets(1, 2, 1, 2);

    ItemListener il =
        new ItemListener() {
          public void itemStateChanged(ItemEvent e) {
            int ID = gui.getItemID(e);

            switch (ID) {
              case GG_ENVSOURCE:
                pr.intg[ID - GG_OFF_CHOICE] = ((JComboBox) e.getSource()).getSelectedIndex();
                reflectPropertyChanges();
                break;
              case GG_ENVOUTPUT:
              case GG_RIGHTCHAN:
                pr.bool[ID - GG_OFF_CHECKBOX] = ((JCheckBox) e.getSource()).isSelected();
                reflectPropertyChanges();
                break;
            }
          }
        };

    // -------- Input-Gadgets --------
    con.fill = GridBagConstraints.BOTH;
    con.gridwidth = GridBagConstraints.REMAINDER;
    gui.addLabel(
        new GroupLabel("Waveform I/O", GroupLabel.ORIENT_HORIZONTAL, GroupLabel.BRACE_NONE));

    ggInputFile =
        new PathField(PathField.TYPE_INPUTFILE + PathField.TYPE_FORMATFIELD, "Select input file");
    ggInputFile.handleTypes(GenericFile.TYPES_SOUND);
    con.gridwidth = 1;
    con.weightx = 0.1;
    gui.addLabel(new JLabel("Input file", SwingConstants.RIGHT));
    con.gridwidth = GridBagConstraints.REMAINDER;
    con.weightx = 0.9;
    gui.addPathField(ggInputFile, GG_INPUTFILE, null);

    ggEnvInFile =
        new PathField(
            PathField.TYPE_INPUTFILE + PathField.TYPE_FORMATFIELD, "Select input envelope file");
    ggEnvInFile.handleTypes(GenericFile.TYPES_SOUND);
    con.gridwidth = 1;
    con.weightx = 0.1;
    gui.addLabel(new JLabel("Env input", SwingConstants.RIGHT));
    con.gridwidth = GridBagConstraints.REMAINDER;
    con.weightx = 0.9;
    gui.addPathField(ggEnvInFile, GG_ENVINFILE, null);

    ggOutputFile =
        new PathField(
            PathField.TYPE_OUTPUTFILE + PathField.TYPE_FORMATFIELD + PathField.TYPE_RESFIELD,
            "Select output file");
    ggOutputFile.handleTypes(GenericFile.TYPES_SOUND);
    ggInputs = new PathField[1];
    ggInputs[0] = ggInputFile;
    ggOutputFile.deriveFrom(ggInputs, "$D0$F0Amp$E");
    con.gridwidth = 1;
    con.weightx = 0.1;
    gui.addLabel(new JLabel("Output file", SwingConstants.RIGHT));
    con.gridwidth = GridBagConstraints.REMAINDER;
    con.weightx = 0.9;
    gui.addPathField(ggOutputFile, GG_OUTPUTFILE, null);
    gui.registerGadget(ggOutputFile.getTypeGadget(), GG_OUTPUTTYPE);
    gui.registerGadget(ggOutputFile.getResGadget(), GG_OUTPUTRES);

    ggGain = createGadgets(GGTYPE_GAIN);
    con.weightx = 0.1;
    con.gridwidth = 1;
    gui.addLabel(new JLabel("Gain", SwingConstants.RIGHT));
    con.weightx = 0.4;
    gui.addParamField((ParamField) ggGain[0], GG_GAIN, null);
    con.weightx = 0.5;
    con.gridwidth = GridBagConstraints.REMAINDER;
    gui.addChoice((JComboBox) ggGain[1], GG_GAINTYPE, il);

    // -------- Env-Output-Gadgets --------
    gui.addLabel(
        new GroupLabel(
            "Separate envelope output", GroupLabel.ORIENT_HORIZONTAL, GroupLabel.BRACE_NONE));

    ggEnvOutFile =
        new PathField(
            PathField.TYPE_OUTPUTFILE + PathField.TYPE_FORMATFIELD + PathField.TYPE_RESFIELD,
            "Select output envelope file");
    ggEnvOutFile.handleTypes(GenericFile.TYPES_SOUND);
    ggEnvOutFile.deriveFrom(ggInputs, "$D0$F0Env$E");
    con.gridwidth = 1;
    con.weightx = 0.1;
    ggEnvOutput = new JCheckBox("Env output");
    gui.addCheckbox(ggEnvOutput, GG_ENVOUTPUT, il);
    con.gridwidth = GridBagConstraints.REMAINDER;
    con.weightx = 0.9;
    gui.addPathField(ggEnvOutFile, GG_ENVOUTFILE, null);
    gui.registerGadget(ggEnvOutFile.getTypeGadget(), GG_ENVOUTTYPE);
    gui.registerGadget(ggEnvOutFile.getResGadget(), GG_ENVOUTRES);

    // cannot call createGadgets twice (BUG!) XXX
    ggEnvGain = new Component[2]; // createGadgets( GGTYPE_GAIN );
    ggEnvGain[0] = new ParamField(Constants.spaces[Constants.decibelAmpSpace]);
    JComboBox ch = new JComboBox();
    ch.addItem("normalized");
    ch.addItem("immediate");
    ggEnvGain[1] = ch;

    con.weightx = 0.1;
    con.gridwidth = 1;
    gui.addLabel(new JLabel("Gain", SwingConstants.RIGHT));
    con.weightx = 0.4;
    gui.addParamField((ParamField) ggEnvGain[0], GG_ENVGAIN, null);
    con.weightx = 0.5;
    con.gridwidth = GridBagConstraints.REMAINDER;
    gui.addChoice((JComboBox) ggEnvGain[1], GG_ENVGAINTYPE, il);

    // -------- Settings --------
    gui.addLabel(
        new GroupLabel("Shaper Settings", GroupLabel.ORIENT_HORIZONTAL, GroupLabel.BRACE_NONE));

    ggEnvSource = new JComboBox();
    ggEnvSource.addItem("Input file");
    ggEnvSource.addItem("Sound file");
    ggEnvSource.addItem("Envelope file");
    ggEnvSource.addItem("Envelope");
    con.gridwidth = 1;
    con.weightx = 0.1;
    gui.addLabel(new JLabel("Source", SwingConstants.RIGHT));
    con.weightx = 0.4;
    gui.addChoice(ggEnvSource, GG_ENVSOURCE, il);

    ggInvert = new JCheckBox();
    con.weightx = 0.1;
    gui.addLabel(new JLabel("Inversion", SwingConstants.RIGHT));
    con.gridwidth = GridBagConstraints.REMAINDER;
    con.weightx = 0.4;
    gui.addCheckbox(ggInvert, GG_INVERT, il);

    ggMode = new JComboBox();
    ggMode.addItem("Superposition");
    ggMode.addItem("Replacement");
    con.gridwidth = 1;
    con.weightx = 0.1;
    gui.addLabel(new JLabel("Apply mode", SwingConstants.RIGHT));
    con.weightx = 0.4;
    con.gridwidth = GridBagConstraints.REMAINDER;
    gui.addChoice(ggMode, GG_MODE, il);

    ggEnv = new EnvIcon(getComponent());
    con.gridwidth = 1;
    con.weightx = 0.1;
    gui.addLabel(new JLabel("Envelope", SwingConstants.RIGHT));
    con.weightx = 0.4;
    gui.addGadget(ggEnv, GG_ENV);

    spcMaxChange = new ParamSpace(Constants.spaces[Constants.decibelAmpSpace]);
    //		spcMaxChange.min= spcMaxChange.inc;
    spcMaxChange =
        new ParamSpace(spcMaxChange.inc, spcMaxChange.max, spcMaxChange.inc, spcMaxChange.unit);
    ggMaxChange = new ParamField(spcMaxChange);
    con.weightx = 0.1;
    gui.addLabel(new JLabel("Max boost", SwingConstants.RIGHT));
    con.weightx = 0.4;
    con.gridwidth = GridBagConstraints.REMAINDER;
    gui.addParamField(ggMaxChange, GG_MAXCHANGE, null);

    ggRightChan = new JCheckBox("Right chan.");
    ggRightChanEnv = new EnvIcon(getComponent());
    con.weightx = 0.1;
    con.gridwidth = 1;
    gui.addCheckbox(ggRightChan, GG_RIGHTCHAN, il);
    con.weightx = 0.4;
    gui.addGadget(ggRightChanEnv, GG_RIGHTCHANENV);

    spcAverage = new ParamSpace[3];
    spcAverage[0] = Constants.spaces[Constants.absMsSpace];
    spcAverage[1] = Constants.spaces[Constants.absBeatsSpace];
    spcAverage[2] = Constants.spaces[Constants.ratioTimeSpace];
    ggAverage = new ParamField(spcAverage);
    con.weightx = 0.1;
    gui.addLabel(new JLabel("Smoothing", SwingConstants.RIGHT));
    con.weightx = 0.4;
    con.gridwidth = GridBagConstraints.REMAINDER;
    gui.addParamField(ggAverage, GG_AVERAGE, null);

    initGUI(this, FLAGS_PRESETS | FLAGS_PROGBAR, gui);
  }
Пример #4
0
  protected void buildGUI() {
    // einmalig PropertyArray initialisieren
    if (static_pr == null) {
      static_pr = new PropertyArray();
      static_pr.text = prText;
      static_pr.textName = prTextName;
      static_pr.intg = prIntg;
      static_pr.intgName = prIntgName;
      static_pr.para = prPara;
      static_pr.para[PR_INPUTGAIN] = new Param(0.0, Param.DECIBEL_AMP);
      static_pr.para[PR_OFFSET] = new Param(0.0, Param.ABS_MS);
      static_pr.para[PR_LENGTH] = new Param(100.0, Param.FACTOR_TIME);
      static_pr.para[PR_DRYMIX] = new Param(0.0, Param.FACTOR_AMP);
      static_pr.para[PR_WETMIX] = new Param(100.0, Param.FACTOR_AMP);
      static_pr.paraName = prParaName;
      static_pr.bool = prBool;
      static_pr.boolName = prBoolName;
      //			static_pr.superPr	= DocumentFrame.static_pr;

      fillDefaultAudioDescr(static_pr.intg, PR_OUTPUTTYPE, PR_OUTPUTRES);
      fillDefaultGain(static_pr.para, PR_GAIN);
      static_presets = new Presets(getClass(), static_pr.toProperties(true));
    }
    presets = static_presets;
    pr = (PropertyArray) static_pr.clone();

    // -------- build GUI --------

    GridBagConstraints con;

    PathField ggImInputFile, ggReInputFile, ggReOutputFile, ggImOutputFile;
    ParamField ggInputGain, ggOffset, ggLength, ggDryMix, ggWetMix;
    JComboBox ggOperator;
    JCheckBox ggHasImInput, ggHasImOutput, ggRectify, ggInvert, ggDryInvert, ggReverse;
    PathField[] ggParent1, ggParent2;
    Component[] ggGain;
    ParamSpace[] spcOffset, spcLength;
    int anchor;

    gui = new GUISupport();
    con = gui.getGridBagConstraints();
    con.insets = new Insets(1, 2, 1, 2);

    ItemListener il =
        new ItemListener() {
          public void itemStateChanged(ItemEvent e) {
            int ID = gui.getItemID(e);

            switch (ID) {
              case GG_HASIMINPUT:
              case GG_HASIMOUTPUT:
                pr.bool[ID - GG_OFF_CHECKBOX] = ((JCheckBox) e.getSource()).isSelected();
                reflectPropertyChanges();
                break;
            }
          }
        };

    PathListener pathL =
        new PathListener() {
          public void pathChanged(PathEvent e) {
            int ID = gui.getItemID(e);

            switch (ID) {
              case PR_REINPUTFILE:
                setInput(((PathField) e.getSource()).getPath().getPath());
                break;
            }
          }
        };

    // -------- Input-Gadgets --------
    spcOffset = new ParamSpace[3];
    spcOffset[0] =
        new ParamSpace(-36000000.0, 36000000.0, 0.1, Param.ABS_MS); // allow negative offset
    spcOffset[1] = new ParamSpace(-240000.0, 240000.0, 0.001, Param.ABS_BEATS);
    spcOffset[2] = new ParamSpace(-100.0, 100.0, 0.01, Param.FACTOR_TIME);
    //		spcOffset[0]	= Constants.spaces[ Constants.absMsSpace ];
    //		spcOffset[1]	= Constants.spaces[ Constants.absBeatsSpace ];
    //		spcOffset[2]	= Constants.spaces[ Constants.offsetTimeSpace ];
    spcLength = new ParamSpace[4];
    spcLength[0] = Constants.spaces[Constants.absMsSpace];
    spcLength[1] = Constants.spaces[Constants.absBeatsSpace];
    spcLength[2] = Constants.spaces[Constants.offsetTimeSpace];
    spcLength[3] = Constants.spaces[Constants.factorTimeSpace];

    con.fill = GridBagConstraints.BOTH;
    con.gridwidth = GridBagConstraints.REMAINDER;
    gui.addLabel(new GroupLabel("Input file", GroupLabel.ORIENT_HORIZONTAL, GroupLabel.BRACE_NONE));
    con.fill = GridBagConstraints.HORIZONTAL;

    ggReInputFile =
        new PathField(
            PathField.TYPE_INPUTFILE + PathField.TYPE_FORMATFIELD, "Select real part of input");
    ggReInputFile.handleTypes(GenericFile.TYPES_SOUND);
    con.gridwidth = 1;
    con.weightx = 0.1;
    gui.addLabel(new JLabel("Input [Real]", SwingConstants.RIGHT));
    con.gridwidth = 2;
    con.weightx = 3.0;
    gui.addPathField(ggReInputFile, GG_REINPUTFILE, pathL);

    ggOffset = new ParamField(spcOffset);
    con.weightx = 0.1;
    con.gridwidth = 1;
    gui.addLabel(new JLabel("Offset", SwingConstants.RIGHT));
    con.weightx = 0.4;
    con.gridwidth = GridBagConstraints.REMAINDER;
    gui.addParamField(ggOffset, GG_OFFSET, null);

    ggImInputFile =
        new PathField(
            PathField.TYPE_INPUTFILE + PathField.TYPE_FORMATFIELD,
            "Select imaginary part of input");
    ggImInputFile.handleTypes(GenericFile.TYPES_SOUND);
    ggHasImInput = new JCheckBox("Input [Imaginary]");
    con.gridwidth = 1;
    con.weightx = 0.1;
    anchor = con.anchor;
    con.anchor = GridBagConstraints.EAST;
    gui.addCheckbox(ggHasImInput, GG_HASIMINPUT, il);
    con.anchor = anchor;
    con.weightx = 3.0;
    con.gridwidth = 2;
    gui.addPathField(ggImInputFile, GG_IMINPUTFILE, pathL);

    ggLength = new ParamField(spcLength);
    con.weightx = 0.1;
    con.gridwidth = 1;
    gui.addLabel(new JLabel("Length", SwingConstants.RIGHT));
    con.weightx = 0.4;
    con.gridwidth = GridBagConstraints.REMAINDER;
    gui.addParamField(ggLength, GG_LENGTH, null);

    ggParent1 = new PathField[1];
    ggParent1[0] = ggReInputFile;
    ggParent2 = new PathField[1];
    ggParent2[0] = ggReInputFile;
    ggImInputFile.deriveFrom(ggParent2, "$D0$F0i$X0");

    ggInputGain = new ParamField(Constants.spaces[Constants.decibelAmpSpace]);
    con.gridwidth = 1;
    con.weightx = 0.1;
    gui.addLabel(new JLabel("Drive", SwingConstants.RIGHT));
    con.weightx = 0.4;
    gui.addParamField(ggInputGain, GG_INPUTGAIN, null);

    con.weightx = 0.1;
    con.gridwidth = 1;
    gui.addLabel(new JLabel(""));
    ggRectify = new JCheckBox("Rectify");
    con.gridwidth = 1;
    con.weightx = 0.4;
    gui.addCheckbox(ggRectify, GG_RECTIFY, il);
    ggInvert = new JCheckBox("Invert");
    gui.addCheckbox(ggInvert, GG_INVERT, il);
    ggReverse = new JCheckBox("Reverse");
    con.gridwidth = GridBagConstraints.REMAINDER;
    gui.addCheckbox(ggReverse, GG_REVERSE, il);

    // -------- Output-Gadgets --------
    gui.addLabel(new GroupLabel("Output", GroupLabel.ORIENT_HORIZONTAL, GroupLabel.BRACE_NONE));

    ggReOutputFile =
        new PathField(
            PathField.TYPE_OUTPUTFILE + PathField.TYPE_FORMATFIELD + PathField.TYPE_RESFIELD,
            "Select output for real part");
    ggReOutputFile.handleTypes(GenericFile.TYPES_SOUND);
    con.gridwidth = 1;
    con.weightx = 0.1;
    gui.addLabel(new JLabel("File [Real]", SwingConstants.RIGHT));
    con.gridwidth = GridBagConstraints.REMAINDER;
    con.weightx = 0.9;
    gui.addPathField(ggReOutputFile, GG_REOUTPUTFILE, pathL);
    gui.registerGadget(ggReOutputFile.getTypeGadget(), GG_OUTPUTTYPE);
    gui.registerGadget(ggReOutputFile.getResGadget(), GG_OUTPUTRES);

    ggImOutputFile = new PathField(PathField.TYPE_OUTPUTFILE, "Select output for imaginary part");
    //		ggImOutputFile.handleTypes( GenericFile.TYPES_SOUND );
    ggHasImOutput = new JCheckBox("File [Imaginary]");
    con.gridwidth = 1;
    con.weightx = 0.1;
    anchor = con.anchor;
    con.anchor = GridBagConstraints.EAST;
    gui.addCheckbox(ggHasImOutput, GG_HASIMOUTPUT, il);
    con.anchor = anchor;
    con.gridwidth = GridBagConstraints.REMAINDER;
    con.weightx = 0.9;
    gui.addPathField(ggImOutputFile, GG_IMOUTPUTFILE, pathL);

    ggParent2 = new PathField[1];
    ggParent2[0] = ggReOutputFile;
    ggReOutputFile.deriveFrom(ggParent1, "$D0$F0Op$E");
    ggImOutputFile.deriveFrom(ggParent2, "$D0$F0i$X0");

    ggGain = createGadgets(GGTYPE_GAIN);
    con.weightx = 0.1;
    con.gridwidth = 1;
    gui.addLabel(new JLabel("Gain", SwingConstants.RIGHT));
    con.weightx = 0.4;
    gui.addParamField((ParamField) ggGain[0], GG_GAIN, null);
    con.weightx = 0.5;
    con.gridwidth = GridBagConstraints.REMAINDER;
    gui.addChoice((JComboBox) ggGain[1], GG_GAINTYPE, il);

    // -------- Settings --------
    gui.addLabel(new GroupLabel("Operation", GroupLabel.ORIENT_HORIZONTAL, GroupLabel.BRACE_NONE));

    ggOperator = new JComboBox();
    for (int i = 0; i < OPNAMES.length; i++) {
      ggOperator.addItem(OPNAMES[i]);
    }
    con.gridwidth = 1;
    con.weightx = 0.1;
    gui.addLabel(new JLabel("Operator", SwingConstants.RIGHT));
    con.weightx = 0.4;
    gui.addChoice(ggOperator, GG_OPERATOR, il);

    //		con.weightx		= 0.1;
    //		gui.addLabel( new JLabel( "" ));
    ggDryMix = new ParamField(Constants.spaces[Constants.ratioAmpSpace]);
    gui.addLabel(new JLabel("Dry mix", SwingConstants.RIGHT));
    con.weightx = 0.4;
    con.gridwidth = 2;
    gui.addParamField(ggDryMix, GG_DRYMIX, null);

    ggDryInvert = new JCheckBox("Invert");
    con.weightx = 0.1;
    con.gridwidth = GridBagConstraints.REMAINDER;
    gui.addCheckbox(ggDryInvert, GG_DRYINVERT, il);

    //		con.gridwidth	= 3;
    con.gridwidth = 2;
    gui.addLabel(new JLabel(""));
    ggWetMix = new ParamField(Constants.spaces[Constants.ratioAmpSpace]);
    con.weightx = 0.1;
    con.gridwidth = 1;
    gui.addLabel(new JLabel("Wet mix", SwingConstants.RIGHT));
    con.weightx = 0.4;
    con.gridwidth = 2;
    gui.addParamField(ggWetMix, GG_WETMIX, null);
    con.weightx = 0.1;
    con.gridwidth = GridBagConstraints.REMAINDER;
    gui.addLabel(new JLabel(""));

    initGUI(this, FLAGS_PRESETS | FLAGS_PROGBAR, gui);
  }
Пример #5
0
  protected void buildGUI() {
    // einmalig PropertyArray initialisieren
    if (static_pr == null) {
      static_pr = new PropertyArray();
      static_pr.text = prText;
      static_pr.textName = prTextName;
      static_pr.intg = prIntg;
      static_pr.intgName = prIntgName;
      //			static_pr.bool		= prBool;
      //			static_pr.boolName	= prBoolName;
      static_pr.para = prPara;
      static_pr.para[PR_MINFREQ] = new Param(32.0, Param.ABS_HZ);
      static_pr.para[PR_MAXFREQ] = new Param(18000.0, Param.ABS_HZ);
      static_pr.para[PR_BANDSPEROCT] = new Param(12.0, Param.NONE);
      static_pr.para[PR_TIMERES] = new Param(20.0, Param.ABS_MS);
      static_pr.para[PR_SIGNALCEIL] = new Param(0.0, Param.DECIBEL_AMP);
      static_pr.para[PR_NOISEFLOOR] = new Param(-96.0, Param.DECIBEL_AMP);
      static_pr.paraName = prParaName;
      //			static_pr.superPr	= DocumentFrame.static_pr;
    }
    // default preset
    if (static_presets == null) {
      static_presets = new Presets(getClass(), static_pr.toProperties(true));
    }
    presets = static_presets;
    pr = (PropertyArray) static_pr.clone();

    // -------- build GUI --------

    final GridBagConstraints con;
    final PathField ggInputFile, ggOutputFile;
    final PathField[] ggInputs;
    final ParamField ggMinFreq, ggMaxFreq, ggBandsPerOct, ggTimeRes;
    final ParamField ggSignalCeil, ggNoiseFloor;
    final JComboBox ggMaxFFTSize;

    gui = new GUISupport();
    con = gui.getGridBagConstraints();
    con.insets = new Insets(1, 2, 1, 2);

    //		final ItemListener il = new ItemListener() {
    //			public void itemStateChanged( ItemEvent e )
    //			{
    //				int	ID = gui.getItemID( e );
    //
    //				switch( ID ) {
    //				case GG_READMARKERS:
    //					pr.bool[ ID - GG_OFF_CHECKBOX ] = ((JCheckBox) e.getSource()).isSelected();
    //					reflectPropertyChanges();
    //					break;
    //				}
    //			}
    //		};

    // -------- Input-Gadgets --------
    con.fill = GridBagConstraints.BOTH;
    con.gridwidth = GridBagConstraints.REMAINDER;

    gui.addLabel(
        new GroupLabel("Waveform I/O", GroupLabel.ORIENT_HORIZONTAL, GroupLabel.BRACE_NONE));

    ggInputFile =
        new PathField(
            PathField.TYPE_INPUTFILE + PathField.TYPE_FORMATFIELD, "Select input sound file");
    ggInputFile.handleTypes(GenericFile.TYPES_SOUND);
    con.gridwidth = 1;
    con.weightx = 0.1;
    gui.addLabel(new JLabel("Audio input", SwingConstants.RIGHT));
    con.gridwidth = GridBagConstraints.REMAINDER;
    con.weightx = 0.9;
    gui.addPathField(ggInputFile, GG_INPUTFILE, null);

    ggOutputFile =
        new PathField(
            PathField.TYPE_OUTPUTFILE + PathField.TYPE_FORMATFIELD + PathField.TYPE_RESFIELD,
            "Select output image file");
    ggOutputFile.handleTypes(GenericFile.TYPES_IMAGE);
    ggInputs = new PathField[1];
    ggInputs[0] = ggInputFile;
    ggOutputFile.deriveFrom(ggInputs, "$D0$F0Sono$E");
    con.gridwidth = 1;
    con.weightx = 0.1;
    gui.addLabel(new JLabel("Image output", SwingConstants.RIGHT));
    con.gridwidth = GridBagConstraints.REMAINDER;
    con.weightx = 0.9;
    gui.addPathField(ggOutputFile, GG_OUTPUTFILE, null);

    // -------- Plot Settings --------
    gui.addLabel(new GroupLabel("Settings", GroupLabel.ORIENT_HORIZONTAL, GroupLabel.BRACE_NONE));

    ggMinFreq = new ParamField(Constants.spaces[Constants.absHzSpace]);
    con.weightx = 0.1;
    con.gridwidth = 1;
    gui.addLabel(new JLabel("Lowest Frequency:", SwingConstants.RIGHT));
    con.weightx = 0.4;
    gui.addParamField(ggMinFreq, GG_MINFREQ, null);

    ggBandsPerOct = new ParamField(new ParamSpace(1, /* 96 */ 32768, 1, Param.NONE));
    con.weightx = 0.1;
    gui.addLabel(new JLabel("Bands Per Octave:", SwingConstants.RIGHT));
    con.weightx = 0.4;
    con.gridwidth = GridBagConstraints.REMAINDER;
    gui.addParamField(ggBandsPerOct, GG_BANDSPEROCT, null);

    ggMaxFreq = new ParamField(Constants.spaces[Constants.absHzSpace]);
    con.weightx = 0.1;
    con.gridwidth = 1;
    gui.addLabel(new JLabel("Highest Frequency:", SwingConstants.RIGHT));
    con.weightx = 0.4;
    gui.addParamField(ggMaxFreq, GG_MAXFREQ, null);

    ggTimeRes = new ParamField(Constants.spaces[Constants.absMsSpace]);
    con.weightx = 0.1;
    gui.addLabel(new JLabel("Max. Time Resolution:", SwingConstants.RIGHT));
    con.weightx = 0.4;
    con.gridwidth = GridBagConstraints.REMAINDER;
    gui.addParamField(ggTimeRes, GG_TIMERES, null);

    ggSignalCeil = new ParamField(Constants.spaces[Constants.decibelAmpSpace]);
    con.weightx = 0.1;
    con.gridwidth = 1;
    gui.addLabel(new JLabel("Signal Ceiling:", SwingConstants.RIGHT));
    con.weightx = 0.4;
    gui.addParamField(ggSignalCeil, GG_SIGNALCEIL, null);

    ggMaxFFTSize = new JComboBox();
    for (int i = 256; i <= 32768; i <<= 1) {
      ggMaxFFTSize.addItem(String.valueOf(i));
    }
    con.weightx = 0.1;
    gui.addLabel(new JLabel("Max. FFT Size:", SwingConstants.RIGHT));
    con.weightx = 0.4;
    con.gridwidth = GridBagConstraints.REMAINDER;
    gui.addChoice(ggMaxFFTSize, GG_MAXFFTSIZE, null);

    ggNoiseFloor = new ParamField(Constants.spaces[Constants.decibelAmpSpace]);
    con.weightx = 0.1;
    con.gridwidth = 1;
    gui.addLabel(new JLabel("Noise Floor:", SwingConstants.RIGHT));
    con.weightx = 0.4;
    //		con.gridwidth	= GridBagConstraints.REMAINDER;
    gui.addParamField(ggNoiseFloor, GG_NOISEFLOOR, null);

    initGUI(this, FLAGS_PRESETS | FLAGS_PROGBAR, gui);
  }
Пример #6
0
  protected void buildGUI() {
    // einmalig PropertyArray initialisieren
    if (static_pr == null) {
      static_pr = new PropertyArray();
      static_pr.text = prText;
      static_pr.textName = prTextName;
      static_pr.intg = prIntg;
      static_pr.intgName = prIntgName;
      //			static_pr.bool		= prBool;
      //			static_pr.boolName	= prBoolName;
      static_pr.para = prPara;
      static_pr.paraName = prParaName;
      //			static_pr.superPr	= DocumentFrame.static_pr;

      fillDefaultAudioDescr(static_pr.intg, PR_OUTPUTTYPE, PR_OUTPUTRES);
      fillDefaultGain(static_pr.para, PR_GAIN);
      static_presets = new Presets(getClass(), static_pr.toProperties(true));
    }
    presets = static_presets;
    pr = (PropertyArray) static_pr.clone();

    // -------- GUI bauen --------

    final GridBagConstraints con;
    final PathField ggInputFile, ggOutputFile;
    final JComboBox ggFilterType;
    final Component[] ggGain;
    final PathField[] ggInputs;

    gui = new GUISupport();
    con = gui.getGridBagConstraints();
    con.insets = new Insets(1, 2, 1, 2);

    // -------- Input-Gadgets --------
    con.fill = GridBagConstraints.BOTH;
    con.gridwidth = GridBagConstraints.REMAINDER;

    gui.addLabel(
        new GroupLabel("Waveform I/O", GroupLabel.ORIENT_HORIZONTAL, GroupLabel.BRACE_NONE));

    ggInputFile =
        new PathField(PathField.TYPE_INPUTFILE + PathField.TYPE_FORMATFIELD, "Select input file");
    ggInputFile.handleTypes(GenericFile.TYPES_SOUND);
    con.gridwidth = 1;
    con.weightx = 0.1;
    gui.addLabel(new JLabel("Input file", SwingConstants.RIGHT));
    con.gridwidth = GridBagConstraints.REMAINDER;
    con.weightx = 0.9;
    gui.addPathField(ggInputFile, GG_INPUTFILE, null);

    ggOutputFile =
        new PathField(
            PathField.TYPE_OUTPUTFILE + PathField.TYPE_FORMATFIELD + PathField.TYPE_RESFIELD,
            "Select output file");
    ggOutputFile.handleTypes(GenericFile.TYPES_SOUND);
    ggInputs = new PathField[1];
    ggInputs[0] = ggInputFile;
    ggOutputFile.deriveFrom(ggInputs, "$D0$F0IIR$E");
    con.gridwidth = 1;
    con.weightx = 0.1;
    gui.addLabel(new JLabel("Output file", SwingConstants.RIGHT));
    con.gridwidth = GridBagConstraints.REMAINDER;
    con.weightx = 0.9;
    gui.addPathField(ggOutputFile, GG_OUTPUTFILE, null);
    gui.registerGadget(ggOutputFile.getTypeGadget(), GG_OUTPUTTYPE);
    gui.registerGadget(ggOutputFile.getResGadget(), GG_OUTPUTRES);

    ggGain = createGadgets(GGTYPE_GAIN);
    con.weightx = 0.1;
    con.gridwidth = 1;
    gui.addLabel(new JLabel("Gain", SwingConstants.RIGHT));
    con.weightx = 0.4;
    gui.addParamField((ParamField) ggGain[0], GG_GAIN, null);
    con.weightx = 0.5;
    con.gridwidth = GridBagConstraints.REMAINDER;
    gui.addChoice((JComboBox) ggGain[1], GG_GAINTYPE, null);

    gui.addLabel(
        new GroupLabel("Filter Settings", GroupLabel.ORIENT_HORIZONTAL, GroupLabel.BRACE_NONE));

    ggFilterType = new JComboBox();
    ggFilterType.addItem("Differentiator");
    ggFilterType.addItem("Integrator");
    con.weightx = 0.1;
    con.gridwidth = 1;
    gui.addLabel(new JLabel("Filter Type", SwingConstants.RIGHT));
    con.weightx = 0.2;
    gui.addChoice(ggFilterType, GG_FILTERTYPE, null);

    initGUI(this, FLAGS_PRESETS | FLAGS_PROGBAR, gui);
  }