private void initialize(Header header) { // 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; }
/** * Changes the output buffer. This will take effect the next time * decodeFrame() is called. */ public void setOutputBuffer(Obuffer _out) { output = _out; }