- 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 MA_SIMD_ALIGNMENT, though it is not necessary.
- Ratios need to be in the range of MAL_RESAMPLER_MIN_RATIO and MAL_RESAMPLER_MAX_RATIO. This is enough to convert
- Ratios need to be in the range of MA_RESAMPLER_MIN_RATIO and MA_RESAMPLER_MAX_RATIO. This is enough to convert
to and from 8000 and 384000, which is the smallest and largest standard rates supported by miniaudio. If you need
to and from 8000 and 384000, which is the smallest and largest standard rates supported by miniaudio. If you need
extreme ratios then you will need to chain resamplers together.
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
#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 MA_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 MA_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;/* 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_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_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, including the filter window. 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. */
/* Not reading from the client. This is a fast-ish path, though I'm not doing this in constant time like when seeking by input rate. It's easier to just loop. */
/* Not reading from the client. This is a fast-ish path, though I'm not doing this in constant time like when seeking by input rate. It's easier to just loop. */
}else{
}else{
/* Reading from the client. This case is basically the same as reading, but without the filtering. */
/* Reading from the client. This case is basically the same as reading, but without the filtering. */
/* I'm cheating here and just using the f32 implementation and converting to s16. This will be changed later - for now just focusing on getting it working. */
/* I'm cheating here and just using the f32 implementation and converting to s16. This will be changed later - for now just focusing on getting it working. */
/* I'm cheating here and just using the f32 implementation and converting to s16. This will be changed later - for now just focusing on getting it working. */
/* I'm cheating here and just using the f32 implementation and converting to s16. This will be changed later - for now just focusing on getting it working. */