- Must have different modes on how to handle the last of the input samples. Certain situations (streaming) requires
- Must have different modes on how to handle the last of the input samples. Certain situations (streaming) requires
the last input samples to be cached in the internal structure for the windowing algorithm. Other situations require
the last input samples to be cached in the internal structure for the windowing algorithm. Other situations require
all of the input samples to be consumed in order to output the correct total sample count.
all of the input samples to be consumed in order to output the correct total sample count.
- Pointers passed into the onRead() callback must be guaranteed to be aligned to MAL_SIMD_ALIGNMENT.
Other Notes:
Other Notes:
...
@@ -38,8 +37,9 @@ Other Notes:
...
@@ -38,8 +37,9 @@ Other Notes:
Random Notes:
Random Notes:
- You cannot change the algorithm after initialization.
- You cannot change the algorithm after initialization.
- It is recommended to keep the mal_resampler object aligned to MAL_SIMD_ALIGNMENT, though it is not necessary.
- It is recommended to keep the mal_resampler object aligned to MAL_SIMD_ALIGNMENT, though it is not necessary.
- Ratios need to be in the range of MAL_RESAMPLER_MIN_RATIO and MAL_RESAMPLER_MAX_RATIO. If you need extreme ratios
- Ratios need to be in the range of MAL_RESAMPLER_MIN_RATIO and MAL_RESAMPLER_MAX_RATIO. This is enough to convert
then you will need to chain resamplers together.
to and from 8000 and 384000, which is the smallest and largest standard rates supported by mini_al. If you need
extreme ratios then you will need to chain resamplers together.
*/
*/
#ifndef mal_resampler_h
#ifndef mal_resampler_h
#define mal_resampler_h
#define mal_resampler_h
...
@@ -47,7 +47,9 @@ Random Notes:
...
@@ -47,7 +47,9 @@ Random Notes:
#define MAL_RESAMPLER_SEEK_NO_CLIENT_READ (1 << 0) /* When set, does not read anything from the client when seeking. This does _not_ call onRead(). */
#define MAL_RESAMPLER_SEEK_NO_CLIENT_READ (1 << 0) /* When set, does not read anything from the client when seeking. This does _not_ call onRead(). */
#define MAL_RESAMPLER_SEEK_INPUT_RATE (1 << 1) /* When set, treats the specified frame count based on the input sample rate rather than the output sample rate. */
#define MAL_RESAMPLER_SEEK_INPUT_RATE (1 << 1) /* When set, treats the specified frame count based on the input sample rate rather than the output sample rate. */
}cache;/* Do not use directly. Keep this as the first member of this structure for SIMD alignment purposes. */
}cache;/* Keep this as the first member of this structure for SIMD alignment purposes. */
mal_uint16firstCachedFrameOffset;
mal_uint32cacheStrideInFrames;/* The number of the samples between channels in the cache. The first sample for channel 0 is cacheStrideInFrames*0. The first sample for channel 1 is cacheStrideInFrames*1, etc. */
mal_uint16cacheLengthInFrames;/* The number of valid frames sitting in the cache. May be less than the cache's capacity. */
mal_uint16cacheLengthInFrames;/* The number of valid frames sitting in the cache, including the filter window. May be less than the cache's capacity. */
mal_uint16windowLength;
mal_uint16windowLength;
doublewindowTime;/* By input rate. Relative to the start of the cache. */
doublewindowTime;/* By input rate. Relative to the start of the cache. */