SISOFilter
public class InPlace extends ConsoleObj implements SISOFilter
Constructor | Description |
---|---|
InPlace() |
Modifier and Type | Method | Description |
---|---|---|
int |
extraN() |
|
float[] |
outIn(float[] sig,
int nzero) |
|
void |
setCascade(SISOFilter filter) |
|
void |
setConsoleOut(long consoleH) |
|
void |
setMs(double sample_ms) |
|
void |
setParallel(SISOFilter filter) |
|
void |
setParams(double[] params) |
|
void |
setSystemOut(boolean use_System_out) |
public void setCascade(SISOFilter filter)
public void setParallel(SISOFilter filter)
public void setParams(double[] params)
setParams
in interface SISOFilter
params
- is an array of double-precision floating-point values
configuring the filter. These values of type double have sufficient
precision to pass integer values as required. Implementation of this
method typically checks the length of the params array: if params.length
is less than the required number of parameters, default values are used.public void setMs(double sample_ms)
setMs
in interface SISOFilter
sample_ms
- is the time interval between input samples to the filter,
expressed in milliseconds (ms).
Invoking this method computes filter coefficients from the parameters specified in a prior call to setParams(). This action prepares the filter for processing a sequence of input samples supplied to outIn() below.
Reinvoking setMs() not only recalculates the filter coefficients, which is needed if another call is made to setParams. It also reinitializes any buffers holding samples in the "memory" of the filter.
public int extraN()
extraN
in interface SISOFilter
To output nBuf samples of from the filter, for example, nBuf + extraN() samples of input are required. For a non-causal filter that needs to look ahead to input x[n+M] to compute output y[n], extraN() == M immediately after setMs() is called to initialize the filter.
public float[] outIn(float[] sig, int nzero)
outIn
in interface SISOFilter
sig
- is the array of input samples.nzero
- extends the input with zero-valued samples. This "padding"
is useful if sig contains a pulse waveform and you want to compute the
"tail" of the filter response past the end of that pulse.You can call outIn(sig, 0) repeatedly and the filter will keep track of the state of the filter between successive calls. A call to setMs() resets the state of the filter to the initial condition, typically that where the input to the filter has been zero until supplying the next values in sig as input.
If you want to apply a non-causal filter with M-sample look ahead to an array sig in one step, and if you want sig.length samples of output to match the sig.length samples of input, invoke
float[] out = mySISOFilter.inOut(sig, mySISOFilter.extraN());
to properly extend input sig with extraN() zeroes to obtain the required number of output samples.
public void setConsoleOut(long consoleH)
setConsoleOut
in interface SISOFilter
setConsoleOut
in class ConsoleObj
consoleH
- is a native-code "handle" for tracing/loggingpublic void setSystemOut(boolean use_System_out)
setSystemOut
in interface SISOFilter
setSystemOut
in class ConsoleObj