X-Git-Url: http://demsky.eecs.uci.edu/git/?a=blobdiff_plain;f=Robust%2Fsrc%2FBenchmarks%2FSSJava%2FMP3Decoder%2FDecoder.java;h=368a28e8f7724d78a5e056835c4231fee3a1430d;hb=15e12c52c54314d14b860b578c46251adb3e8625;hp=ae6e87a667b0bbb11b8acab03c3b13923b353ae6;hpb=47cc527f574f19b71e92fceac668fb8c0655b13b;p=IRC.git diff --git a/Robust/src/Benchmarks/SSJava/MP3Decoder/Decoder.java b/Robust/src/Benchmarks/SSJava/MP3Decoder/Decoder.java index ae6e87a6..368a28e8 100644 --- a/Robust/src/Benchmarks/SSJava/MP3Decoder/Decoder.java +++ b/Robust/src/Benchmarks/SSJava/MP3Decoder/Decoder.java @@ -1,300 +1,300 @@ -/* - * 11/19/04 1.0 moved to LGPL. - * 01/12/99 Initial version. mdm@techie.com - *----------------------------------------------------------------------- - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU Library General Public License as published - * by the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public - * License along with this program; if not, write to the Free Software - * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - *---------------------------------------------------------------------- - */ - -/** - * The Decoder class encapsulates the details of decoding an MPEG - * audio frame. - * - * @author MDM - * @version 0.0.7 12/12/99 - * @since 0.0.5 - */ -@LATTICE("OUTDecoder instance with default parameters. - */ - - public Decoder() { - this(null); - } - - /** - * Creates a new Decoder instance with default parameters. - * - * @param params - * The Params instance that describes the customizable - * aspects of the decoder. - */ - public Decoder(@DELEGATE Params params0) { - - if (params0 == null) { - params0 = getDefaultParams(); - } - - params = params0; - - Equalizer eq = params.getInitialEqualizerSettings(); - if (eq != null) { - equalizer.setFrom(eq); - } - } - - static public Params getDefaultParams() { - return (Params) DEFAULT_PARAMS.clone(); - } - - // 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); - // } - @LATTICE("THISParams class presents the customizable aspects of the - * decoder. - *

- * Instances of this class are not thread safe. - */ - public class Params implements Cloneable { - - // private OutputChannels outputChannels = OutputChannels.BOTH; - private OutputChannels outputChannels = new OutputChannels(0); - - private Equalizer equalizer = new Equalizer(); - - public Params() { - } - - public Object clone() { - // TODO: need to have better clone method - Params clone = new Params(); - clone.outputChannels = new OutputChannels(outputChannels.getChannelsOutputCode()); - clone.equalizer = new Equalizer(); - return clone; - // try - // { - // return super.clone(); - // } - // catch (CloneNotSupportedException ex) - // { - // throw new InternalError(this+": "+ex); - // } - } - - public void setOutputChannels(OutputChannels out) { - if (out == null) - throw new NullPointerException("out"); - - outputChannels = out; - } - - public OutputChannels getOutputChannels() { - return outputChannels; - } - - /** - * Retrieves the equalizer settings that the decoder's equalizer will be - * initialized from. - *

- * The Equalizer instance returned cannot be changed in real - * time to affect the decoder output as it is used only to initialize the - * decoders EQ settings. To affect the decoder's output in realtime, use the - * Equalizer returned from the getEqualizer() method on the decoder. - * - * @return The Equalizer used to initialize the EQ settings of - * the decoder. - */ - public Equalizer getInitialEqualizerSettings() { - return equalizer; - } - +/* + * 11/19/04 1.0 moved to LGPL. + * 01/12/99 Initial version. mdm@techie.com + *----------------------------------------------------------------------- + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU Library General Public License as published + * by the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + *---------------------------------------------------------------------- + */ + +/** + * The Decoder class encapsulates the details of decoding an MPEG + * audio frame. + * + * @author MDM + * @version 0.0.7 12/12/99 + * @since 0.0.5 + */ +@LATTICE("OUTDecoder instance with default parameters. + */ + + public Decoder() { + this(null); + } + + /** + * Creates a new Decoder instance with default parameters. + * + * @param params + * The Params instance that describes the customizable + * aspects of the decoder. + */ + public Decoder(@DELEGATE Params params0) { + + if (params0 == null) { + params0 = getDefaultParams(); + } + + params = params0; + + Equalizer eq = params.getInitialEqualizerSettings(); + if (eq != null) { + equalizer.setFrom(eq); + } + } + + static public Params getDefaultParams() { + return (Params) DEFAULT_PARAMS.clone(); + } + + // 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); + // } + @LATTICE("THISParams class presents the customizable aspects of the + * decoder. + *

+ * Instances of this class are not thread safe. + */ + public class Params implements Cloneable { + + // private OutputChannels outputChannels = OutputChannels.BOTH; + private OutputChannels outputChannels = new OutputChannels(0); + + private Equalizer equalizer = new Equalizer(); + + public Params() { + } + + public Object clone() { + // TODO: need to have better clone method + Params clone = new Params(); + clone.outputChannels = new OutputChannels(outputChannels.getChannelsOutputCode()); + clone.equalizer = new Equalizer(); + return clone; + // try + // { + // return super.clone(); + // } + // catch (CloneNotSupportedException ex) + // { + // throw new InternalError(this+": "+ex); + // } + } + + public void setOutputChannels(OutputChannels out) { + if (out == null) + throw new NullPointerException("out"); + + outputChannels = out; + } + + public OutputChannels getOutputChannels() { + return outputChannels; + } + + /** + * Retrieves the equalizer settings that the decoder's equalizer will be + * initialized from. + *

+ * The Equalizer instance returned cannot be changed in real + * time to affect the decoder output as it is used only to initialize the + * decoders EQ settings. To affect the decoder's output in realtime, use the + * Equalizer returned from the getEqualizer() method on the decoder. + * + * @return The Equalizer used to initialize the EQ settings of + * the decoder. + */ + public Equalizer getInitialEqualizerSettings() { + return equalizer; + } + } \ No newline at end of file