Exemple #1
0
  public void setEqualizer(Equalizer eq) {
    if (eq == null) eq = Equalizer.PASS_THRU_EQ;

    equalizer.setFrom(eq);

    float[] factors = equalizer.getBandFactors();

    if (filter1 != null) filter1.setEQ(factors);

    if (filter2 != null) filter2.setEQ(factors);
  }
  private void initializeSynthesizer() {
    float af[] = equalizer.getBands();

    filter1 = new Synthesizer(0, af);
    if (outputChannels == 2) {
      filter2 = new Synthesizer(1, af);
    }
  }
Exemple #3
0
  /**
   * Creates a new <code>Decoder</code> instance with default parameters.
   *
   * @param params The <code>Params</code> instance that describes the customizable aspects of the
   *     decoder.
   */
  public Decoder(Params params0) {
    if (params0 == null) params0 = DEFAULT_PARAMS;

    params = params0;

    Equalizer eq = params.getInitialEqualizerSettings();
    if (eq != null) {
      equalizer.setFrom(eq);
    }
  }
  /**
   * Sets the equalizer.
   *
   * @param f the equalizer
   */
  final void setEqualizer(Object f) {

    if (spline == null) {
      spline = new Spline();
    }

    equalizer = new Equalizer(f, spline, information);

    float af[] = equalizer.getBands();

    if (filter1 != null) {
      filter1.setEQ(af);
    }
    if (filter2 != null) {
      filter2.setEQ(af);
    }
    information.put(FA_EQUALIZE, f);
  }
 /** Frees all system resources, which are bounded to this object. */
 @Override
 public void close() {
   super.close();
   if (filter1 != null) {
     filter1.close();
   }
   filter1 = null;
   if (filter2 != null) {
     filter2.close();
   }
   filter2 = null;
   if (equalizer != null) {
     equalizer.close();
   }
   equalizer = null;
   if (spline != null) {
     spline.close();
   }
   spline = null;
 }
Exemple #6
0
  private void initialize(Header header) throws DecoderException {

    // REVIEW: allow customizable scale factor
    float scalefactor = 32700.0f;

    int mode = header.mode();
    int layer = header.layer();
    int channels = mode == Header.SINGLE_CHANNEL ? 1 : 2;

    // set up output buffer if not set up by client.
    if (output == null) output = new SampleBuffer(header.frequency(), channels);

    float[] factors = equalizer.getBandFactors();
    filter1 = new SynthesisFilter(0, scalefactor, factors);

    // REVIEW: allow mono output for stereo
    if (channels == 2) filter2 = new SynthesisFilter(1, scalefactor, factors);

    outputChannels = channels;
    outputFrequency = header.frequency();

    initialized = true;
  }