@@ -46,7 +46,7 @@ In addition to changes to the API design, a few other changes have been made to
...
@@ -46,7 +46,7 @@ In addition to changes to the API design, a few other changes have been made to
- The sinc resampler has been removed. This was completely broken and never actually worked properly.
- The sinc resampler has been removed. This was completely broken and never actually worked properly.
- The linear resampler now uses low-pass filtering to remove aliasing. The quality of the low-pass filter can be controlled via the resampler config with the
- The linear resampler now uses low-pass filtering to remove aliasing. The quality of the low-pass filter can be controlled via the resampler config with the
`lpfPoles` option, which has a maximum value of MA_MAX_FILTER_POLES.
`lpfOrder` option, which has a maximum value of MA_MAX_FILTER_ORDER.
- Data conversion now supports s16 natively which runs through a fixed point pipeline. Previously everything needed to be converted to floating point before
- Data conversion now supports s16 natively which runs through a fixed point pipeline. Previously everything needed to be converted to floating point before
processing, whereas now both s16 and f32 are natively supported. Other formats still require conversion to either s16 or f32 prior to processing, however
processing, whereas now both s16 and f32 are natively supported. Other formats still require conversion to either s16 or f32 prior to processing, however
`ma_data_converter` will handle this for you.
`ma_data_converter` will handle this for you.
...
@@ -926,7 +926,7 @@ may make it a suitable option depending on your requirements.
...
@@ -926,7 +926,7 @@ may make it a suitable option depending on your requirements.
The linear resampler performs low-pass filtering before or after downsampling or upsampling, depending on the sample rates you're converting between. When
The linear resampler performs low-pass filtering before or after downsampling or upsampling, depending on the sample rates you're converting between. When
decreasing the sample rate, the low-pass filter will be applied before downsampling. When increasing the rate it will be performed after upsampling. By default
decreasing the sample rate, the low-pass filter will be applied before downsampling. When increasing the rate it will be performed after upsampling. By default
a 4-pole low-pass filter will be applied. This can be configured via the `lpfPoles` configuration variable. Setting this to 0 will disable filtering.
a fourth order low-pass filter will be applied. This can be configured via the `lpfOrder` configuration variable. Setting this to 0 will disable filtering.
The low-pass filter has a cutoff frequency which defaults to half the sample rate of the lowest of the input and output sample rates (Nyquist Frequency). This
The low-pass filter has a cutoff frequency which defaults to half the sample rate of the lowest of the input and output sample rates (Nyquist Frequency). This
can be controlled with the `lpfNyquistFactor` config variable. This defaults to 1, and should be in the range of 0..1, although a value of 0 does not make
can be controlled with the `lpfNyquistFactor` config variable. This defaults to 1, and should be in the range of 0..1, although a value of 0 does not make
...
@@ -985,7 +985,7 @@ channel maps and resampling quality. Something like the following may be more su
...
@@ -985,7 +985,7 @@ channel maps and resampling quality. Something like the following may be more su
@@ -1115,11 +1115,11 @@ If you need to change the configuration of the filter, but need to maintain the
...
@@ -1115,11 +1115,11 @@ If you need to change the configuration of the filter, but need to maintain the
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.
The `ma_lpf` object supports a configurable number of poles, but if you only need a 1-pole filter you may want to consider using `ma_lpf1`. Likewise, if you
The `ma_lpf` object supports a configurable order, but if you only need a first order filter you may want to consider using `ma_lpf1`. Likewise, if you only
only need a 2-pole filter you can use `ma_lpf2`. The advantage of this is that they're lighter weight and a bit more efficient.
need a second order filter you can use `ma_lpf2`. The advantage of this is that they're lighter weight and a bit more efficient.
If an even number of poles are specified, a series of 2-pole filters will be processed in a chain. If an odd number of poles are specified, a series of 2-pole
If an even filter order is specified, a series of second order filters will be processed in a chain. If an odd filter order is specified, a first order filter
filters will be processed in a chain, followed by a final 1-pole filter.
will be applied, followed by a series of second order filters in a chain.
ma_uint32 lpfPoles; /* The low-pass filter pole count. Setting this to 0 will disable low-pass filtering. */
ma_uint32 lpfOrder; /* The low-pass filter order. Setting this to 0 will disable low-pass filtering. */
double lpfNyquistFactor; /* 0..1. Defaults to 1. 1 = Half the sampling frequency (Nyquist Frequency), 0.5 = Quarter the sampling frequency (half Nyquest Frequency), etc. */
double lpfNyquistFactor; /* 0..1. Defaults to 1. 1 = Half the sampling frequency (Nyquist Frequency), 0.5 = Quarter the sampling frequency (half Nyquest Frequency), etc. */
} ma_linear_resampler_config;
} ma_linear_resampler_config;
...
@@ -2210,7 +2210,7 @@ typedef struct
...
@@ -2210,7 +2210,7 @@ typedef struct
ma_resample_algorithm algorithm;
ma_resample_algorithm algorithm;
struct
struct
{
{
ma_uint32 lpfPoles;
ma_uint32 lpfOrder;
double lpfNyquistFactor;
double lpfNyquistFactor;
} linear;
} linear;
struct
struct
...
@@ -2377,7 +2377,7 @@ typedef struct
...
@@ -2377,7 +2377,7 @@ typedef struct
ma_bool32 allowDynamicSampleRate;
ma_bool32 allowDynamicSampleRate;
struct
struct
{
{
ma_uint32 lpfPoles;
ma_uint32 lpfOrder;
double lpfNyquistFactor;
double lpfNyquistFactor;
} linear;
} linear;
struct
struct
...
@@ -3075,7 +3075,7 @@ typedef struct
...
@@ -3075,7 +3075,7 @@ typedef struct
ma_resample_algorithm algorithm;
ma_resample_algorithm algorithm;
struct
struct
{
{
ma_uint32 lpfPoles;
ma_uint32 lpfOrder;
} linear;
} linear;
struct
struct
{
{
...
@@ -3568,7 +3568,7 @@ struct ma_device
...
@@ -3568,7 +3568,7 @@ struct ma_device
ma_resample_algorithm algorithm;
ma_resample_algorithm algorithm;
struct
struct
{
{
ma_uint32 lpfPoles;
ma_uint32 lpfOrder;
} linear;
} linear;
struct
struct
{
{
...
@@ -4415,12 +4415,12 @@ then be set directly on the structure. Below are the members of the `ma_device_c
...
@@ -4415,12 +4415,12 @@ then be set directly on the structure. Below are the members of the `ma_device_c
resampling.algorithm
resampling.algorithm
The resampling algorithm to use when miniaudio needs to perform resampling between the rate specified by `sampleRate` and the device's native rate. The
The resampling algorithm to use when miniaudio needs to perform resampling between the rate specified by `sampleRate` and the device's native rate. The
default value is `ma_resample_algorithm_linear`, and the quality can be configured with `resampling.linear.lpfPoles`.
default value is `ma_resample_algorithm_linear`, and the quality can be configured with `resampling.linear.lpfOrder`.
resampling.linear.lpfPoles
resampling.linear.lpfOrder
The linear resampler applies a low-pass filter as part of it's procesing for anti-aliasing. This setting controls the pole count of the filter. The
The linear resampler applies a low-pass filter as part of it's procesing for anti-aliasing. This setting controls the order of the filter. The higher
higher the value, the better the quality, in general. Setting this to 0 will disable low-pass filtering altogether. The maximum value is
the value, the better the quality, in general. Setting this to 0 will disable low-pass filtering altogether. The maximum value is
`MA_MAX_FILTER_POLES`. The default value is `min(4, MA_MAX_FILTER_POLES)`.
`MA_MAX_FILTER_ORDER`. The default value is `min(4, MA_MAX_FILTER_ORDER)`.
playback.pDeviceID
playback.pDeviceID
A pointer to a `ma_device_id` structure containing the ID of the playback device to initialize. Setting this NULL (default) will use the system's
A pointer to a `ma_device_id` structure containing the ID of the playback device to initialize. Setting this NULL (default) will use the system's
config.resampling.allowDynamicSampleRate = MA_FALSE; /* Disable dynamic sample rates by default because dynamic rate adjustments should be quite rare and it allows an optimization for cases when the in and out sample rates are the same. */
config.resampling.allowDynamicSampleRate = MA_FALSE; /* Disable dynamic sample rates by default because dynamic rate adjustments should be quite rare and it allows an optimization for cases when the in and out sample rates are the same. */
converterConfig.resampling.allowDynamicSampleRate = MA_FALSE; /* Never allow dynamic sample rate conversion. Setting this to true will disable passthrough optimizations. */
converterConfig.resampling.allowDynamicSampleRate = MA_FALSE; /* Never allow dynamic sample rate conversion. Setting this to true will disable passthrough optimizations. */