@@ -129,7 +129,7 @@ pipeline. Both formats use transposed direct form 2.
...
@@ -129,7 +129,7 @@ pipeline. Both formats use transposed direct form 2.
Low-Pass, High-Pass and Band-Pass Filters
Low-Pass, High-Pass and Band-Pass Filters
-----------------------------------------
-----------------------------------------
APIs for low-pass, high-pass and band-pass filtering has been added. By themselves they are second order filters, but can be extended to higher orders by
APIs for low-pass, high-pass and band-pass filtering has been added. By themselves they are second order filters, but can be extended to higher orders by
chaining them together. Low-pass, high-pass and band-pass filtering is achieved via the `ma_lpf`, `ma_hpf` and `ma_bpf` APIs respectively. Since these filters
chaining them together. Low-pass, high-pass and band-pass filtering is achieved via the `ma_lpf2`, `ma_hpf` and `ma_bpf` APIs respectively. Since these filters
are just biquad filters, they support both 32-bit floating point and 16-bit signed integer formats.
are just biquad filters, they support both 32-bit floating point and 16-bit signed integer formats.
...
@@ -1000,18 +1000,18 @@ and will result in an error.
...
@@ -1000,18 +1000,18 @@ and will result in an error.
Low-Pass, High-Pass and Band-Pass Filtering
Low-Pass, High-Pass and Band-Pass Filtering
===========================================
===========================================
Low-pass, high-pass and band-pass filtering is achieved with the `ma_lpf`, `ma_hpf` and `ma_bpf` APIs respective. Low-pass filter example:
Low-pass, high-pass and band-pass filtering is achieved with the `ma_lpf2`, `ma_hpf` and `ma_bpf` APIs respective. Low-pass filter example:
Supported formats are `ma_format_s16` and` ma_format_f32`. If you need to use a different format you need to convert it yourself beforehand. Input and output
Supported formats are `ma_format_s16` and` ma_format_f32`. If you need to use a different format you need to convert it yourself beforehand. Input and output
...
@@ -1020,18 +1020,18 @@ frames are always interleaved.
...
@@ -1020,18 +1020,18 @@ frames are always interleaved.
Filtering can be applied in-place by passing in the same pointer for both the input and output buffers, like so:
Filtering can be applied in-place by passing in the same pointer for both the input and output buffers, like so:
If you need to change the configuration of the filter, but need to maintain the state of internal registers you can do so with `ma_lpf_reinit()`. This may be
If you need to change the configuration of the filter, but need to maintain the state of internal registers you can do so with `ma_lpf2_reinit()`. This may be
useful if you need to change the sample rate and/or cutoff frequency dynamically while maintaing smooth transitions. Note that changing the format or channel
useful if you need to change the sample rate and/or cutoff frequency dynamically while maintaing smooth transitions. Note that changing the format or channel
count after initialization is invalid and will result in an error.
count after initialization is invalid and will result in an error.
...
@@ -1662,10 +1662,10 @@ typedef struct
...
@@ -1662,10 +1662,10 @@ typedef struct
ma_uint32 channels;
ma_uint32 channels;
ma_uint32 sampleRate;
ma_uint32 sampleRate;
double cutoffFrequency;
double cutoffFrequency;
} ma_lpf_config, ma_lpf1_config;
} ma_lpf1_config, ma_lpf2_config;
ma_lpf_config ma_lpf_config_init(ma_format format, ma_uint32 channels, ma_uint32 sampleRate, double cutoffFrequency);
ma_lpf1_config ma_lpf1_config_init(ma_format format, ma_uint32 channels, ma_uint32 sampleRate, double cutoffFrequency);
ma_lpf1_config ma_lpf1_config_init(ma_format format, ma_uint32 channels, ma_uint32 sampleRate, double cutoffFrequency);
ma_lpf2_config ma_lpf2_config_init(ma_format format, ma_uint32 channels, ma_uint32 sampleRate, double cutoffFrequency);