Skip to content

Commit

Permalink
MP3Player: Clean up and remove additional cruft.
Browse files Browse the repository at this point in the history
So it appears that the tree was failing the CI because of these
leftovers. That's what i get for running dirty builds without
clearing the classes folder when removing files...
  • Loading branch information
AShiningRay committed Nov 3, 2024
1 parent 5164160 commit cf674dd
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 127 deletions.
96 changes: 4 additions & 92 deletions src/javax/microedition/media/javazoom/jl/decoder/Decoder.java
Original file line number Diff line number Diff line change
Expand Up @@ -63,10 +63,6 @@ public class Decoder implements DecoderErrors
private int outputFrequency;
private int outputChannels;

private Equalizer equalizer = new Equalizer();

private Params params;

private boolean initialized;


Expand All @@ -91,35 +87,6 @@ public Decoder(Params params0)
{
if (params0==null)
params0 = DEFAULT_PARAMS;

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);
}

/**
Expand Down Expand Up @@ -186,24 +153,7 @@ public int getOutputChannels()
{
return outputChannels;
}

/**
* Retrieves the maximum number of samples that will be written to
* the output buffer when one frame is decoded. This can be used to
* help calculate the size of other buffers whose size is based upon
* the number of samples written to the output buffer. NB: this is
* an upper bound and fewer samples may actually be written, depending
* upon the sample rate and number of channels.
*
* @return The maximum number of samples that are written to the
* output buffer when decoding a single frame of MPEG audio.
*/
public int getOutputBlockSize()
{
return Obuffer.OBUFFERSIZE;
}



protected DecoderException newDecoderException(int errorcode)
{
return new DecoderException(errorcode, null);
Expand Down Expand Up @@ -279,12 +229,11 @@ private void initialize(Header header)
if (output==null)
output = new SampleBuffer(header.frequency(), channels);

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

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

outputChannels = channels;
outputFrequency = header.frequency();
Expand All @@ -299,11 +248,7 @@ private void initialize(Header header)
* Instances of this class are not thread safe.
*/
public static class Params implements Cloneable
{
private OutputChannels outputChannels = OutputChannels.BOTH;

private Equalizer equalizer = new Equalizer();

{
public Params()
{
}
Expand All @@ -319,39 +264,6 @@ public Object clone()
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.
* <p>
* The <code>Equalizer</code> 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 <code>Equalizer</code> used to initialize the
* EQ settings of the decoder.
*/
public Equalizer getInitialEqualizerSettings()
{
return equalizer;
}

};
}

Original file line number Diff line number Diff line change
Expand Up @@ -31,14 +31,12 @@

/**
* The JavaLayerUtils class is not strictly part of the JavaLayer API.
* It serves to provide useful methods and system-wide hooks.
* It serves to provide useful methods.
*
* @author MDM
*/
public class JavaLayerUtils
{
static private JavaLayerHook hook = null;

{
/**
* Deserializes the object contained in the given input stream.
* @param in The input stream to deserialize an object from.
Expand Down Expand Up @@ -152,17 +150,4 @@ static public void serialize(OutputStream out, Object obj)

}

/**
* Sets the system-wide JavaLayer hook.
*/
static synchronized public void setHook(JavaLayerHook hook0)
{
hook = hook0;
}

static synchronized public JavaLayerHook getHook()
{
return hook;
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ final class SynthesisFilter
* The scalefactor scales the calculated float pcm samples to short values
* (raw pcm samples are in [-1.0, 1.0], if no violations occur).
*/
public SynthesisFilter(int channelnumber, float factor, float[] eq0)
public SynthesisFilter(int channelnumber, float factor)
{
d16 = splitArray(d, 16);

Expand All @@ -77,28 +77,11 @@ public SynthesisFilter(int channelnumber, float factor, float[] eq0)
samples = new float[32];
channel = channelnumber;
scalefactor = factor;
setEQ(eq);
//setQuality(HIGH_QUALITY);

reset();
}

public void setEQ(float[] eq0)
{
this.eq = eq0;
if (eq==null)
{
eq = new float[32];
for (int i=0; i<32; i++)
eq[i] = 1.0f;
}
if (eq.length<32)
{
throw new IllegalArgumentException("eq0");
}

}

/*
private void setQuality(int quality0)
{
Expand Down

0 comments on commit cf674dd

Please sign in to comment.