@@ -826,19 +826,14 @@ The resampler supports multiple channels and is always interleaved (both input a
...
@@ -826,19 +826,14 @@ The resampler supports multiple channels and is always interleaved (both input a
The sample rates can be anything other than zero, and are always specified in hertz. They should be set to something like 44100, etc. The sample rate is the
The sample rates can be anything other than zero, and are always specified in hertz. They should be set to something like 44100, etc. The sample rate is the
only configuration property that can be changed after initialization.
only configuration property that can be changed after initialization.
The miniaudio resampler supports multiple algorithms:
The miniaudio resampler has built-in support for the following algorithms:
+-----------+------------------------------+
+-----------+------------------------------+
| Algorithm | Enum Token |
| Algorithm | Enum Token |
+-----------+------------------------------+
+-----------+------------------------------+
| Linear | ma_resample_algorithm_linear |
| Linear | ma_resample_algorithm_linear |
| Speex | ma_resample_algorithm_speex |
+-----------+------------------------------+
+-----------+------------------------------+
Because Speex is not public domain it is strictly opt-in and the code is stored in separate files. if you opt-in to the Speex backend you will need to consider
it's license, the text of which can be found in it's source files in "extras/speex_resampler". Details on how to opt-in to the Speex resampler is explained in
the Speex Resampler section below.
The algorithm cannot be changed after initialization.
The algorithm cannot be changed after initialization.
Processing always happens on a per PCM frame basis and always assumes interleaved input and output. De-interleaved processing is not supported. To process
Processing always happens on a per PCM frame basis and always assumes interleaved input and output. De-interleaved processing is not supported. To process
...
@@ -860,9 +855,7 @@ with `ma_resampler_get_input_latency()` and `ma_resampler_get_output_latency()`.
...
@@ -860,9 +855,7 @@ with `ma_resampler_get_input_latency()` and `ma_resampler_get_output_latency()`.
6.3.1. Resampling Algorithms
6.3.1. Resampling Algorithms
----------------------------
----------------------------
The choice of resampling algorithm depends on your situation and requirements. The linear resampler is the most efficient and has the least amount of latency,
The choice of resampling algorithm depends on your situation and requirements.
but at the expense of poorer quality. The Speex resampler is higher quality, but slower with more latency. It also performs several heap allocations internally
for memory management.
6.3.1.1. Linear Resampling
6.3.1.1. Linear Resampling
...
@@ -883,30 +876,6 @@ and is a purely perceptual configuration.
...
@@ -883,30 +876,6 @@ and is a purely perceptual configuration.
The API for the linear resampler is the same as the main resampler API, only it's called `ma_linear_resampler`.
The API for the linear resampler is the same as the main resampler API, only it's called `ma_linear_resampler`.
6.3.1.2. Speex Resampling
-------------------------
The Speex resampler is made up of third party code which is released under the BSD license. Because it is licensed differently to miniaudio, which is public
domain, it is strictly opt-in and all of it's code is stored in separate files. If you opt-in to the Speex resampler you must consider the license text in it's
source files. To opt-in, you must first `#include` the following file before the implementation of miniaudio.h:
Note that even if you opt-in to the Speex backend, miniaudio won't use it unless you explicitly ask for it in the respective config of the object you are
initializing. If you try to use the Speex resampler without opting in, initialization of the `ma_resampler` object will fail with `MA_NO_BACKEND`.
The only configuration option to consider with the Speex resampler is the `speex.quality` config variable. This is a value between 0 and 10, with 0 being
the fastest with the poorest quality and 10 being the slowest with the highest quality. The default value is 3.
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. */
Note about Speex resampling. If you decide to enable the Speex resampler with ENABLE_SPEEX, this program will use licensed third party code. If you compile and
redistribute this program you need to include a copy of the license which can be found at https://github.com/xiph/opus-tools/blob/master/COPYING. You can also
find a copy of this text in extras/speex_resampler/README.md in the miniaudio repository.
*/
*/
#define _CRT_SECURE_NO_WARNINGS /* For stb_vorbis' usage of fopen() instead of fopen_s(). */
#define _CRT_SECURE_NO_WARNINGS /* For stb_vorbis' usage of fopen() instead of fopen_s(). */