mirror of
https://github.com/libretro/mame2003-plus-libretro.git
synced 2024-11-27 10:30:29 +00:00
Update sound filter to MAME91 needed by the Namco sound changes
This commit is contained in:
parent
87e9241898
commit
99dfc6d319
@ -53,4 +53,64 @@ static INLINE void filter_insert(filter* f, filter_state* s, filter_real x) {
|
||||
/* Compute the filter output */
|
||||
filter_real filter_compute(filter* f, filter_state* s);
|
||||
|
||||
|
||||
/* Filter types */
|
||||
#define FILTER_LOWPASS 0
|
||||
#define FILTER_HIGHPASS 1
|
||||
#define FILTER_BANDPASS 2
|
||||
|
||||
#define Q_TO_DAMP(q) (1.0/q)
|
||||
|
||||
|
||||
struct filter2_context
|
||||
{
|
||||
double x0, x1, x2; /* x[k], x[k-1], x[k-2], current and previous 2 input values */
|
||||
double y0, y1, y2; /* y[k], y[k-1], y[k-2], current and previous 2 output values */
|
||||
double a1, a2; /* digital filter coefficients, denominator */
|
||||
double b0, b1, b2; /* digital filter coefficients, numerator */
|
||||
};
|
||||
|
||||
|
||||
/* Setup the filter context based on the passed filter type info.
|
||||
* type - 1 of the 3 defined filter types
|
||||
* fc - center frequency
|
||||
* d - damp = 1/Q
|
||||
* gain - overall filter gain. Set to 1 if not needed.
|
||||
*/
|
||||
void filter2_setup(int type, double fc, double d, double gain,
|
||||
struct filter2_context *filter);
|
||||
|
||||
|
||||
/* Reset the input/output voltages to 0. */
|
||||
void filter2_reset(struct filter2_context *filter);
|
||||
|
||||
|
||||
/* Step the filter.
|
||||
* x0 is the new input, which needs to be set before stepping.
|
||||
* y0 is the new filter output.
|
||||
*/
|
||||
void filter2_step(struct filter2_context *filter);
|
||||
|
||||
|
||||
/* Setup a filter2 structure based on an op-amp multipole bandpass circuit.
|
||||
* NOTE: If r2 is not used then set to 0.
|
||||
* vRef is not needed to setup filter.
|
||||
*
|
||||
* .--------+---------.
|
||||
* | | |
|
||||
* --- c1 Z |
|
||||
* --- Z r3 |
|
||||
* | Z |
|
||||
* r1 | c2 | |\ |
|
||||
* In >----ZZZZ----+---------+--||----+ | \ |
|
||||
* Z '--|- \ |
|
||||
* Z r2 | >--+------> out
|
||||
* Z .--|+ /
|
||||
* | | | /
|
||||
* gnd vRef >---' |/
|
||||
*
|
||||
*/
|
||||
void filter_opamp_m_bandpass_setup(double r1, double r2, double r3, double c1, double c2,
|
||||
struct filter2_context *filter);
|
||||
|
||||
#endif
|
||||
|
Loading…
Reference in New Issue
Block a user