#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 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 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. */
#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. */
ma_resampler_end_of_input_mode_consume=0,/* When the end of the input stream is reached, consume the last input PCM frames (do not leave them in the internal cache). Default. */
ma_resampler_end_of_input_mode_consume=0,/* When the end of the input stream is reached, consume the last input PCM frames (do not leave them in the internal cache). Default. */
ma_resampler_end_of_input_mode_no_consume/* When the end of the input stream is reached, do _not_ consume the last input PCM frames (leave them in the internal cache). Use this in streaming situations. */
ma_resampler_end_of_input_mode_no_consume/* When the end of the input stream is reached, do _not_ consume the last input PCM frames (leave them in the internal cache). Use this in streaming situations. */
}ma_resampler_end_of_input_mode;
}ma_resampler_end_of_input_mode;
enumma_resampler_seek_mode
{
ma_resampler_seek_mode_none=0,/* No seeking (normal read). */
ma_resampler_seek_mode_output,/* Seek by output rate. */
ma_resampler_seek_mode_input/* Seek by input rate. */
}cache;/* Keep this as the first member of this structure for SIMD alignment purposes. */
}window;/* Keep this as the first member of this structure for SIMD alignment purposes. */
ma_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. */
/*ma_uint32 cacheStrideInFrames;*//* 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. */
ma_uint16cacheLengthInFrames;/* The number of valid frames sitting in the cache, including the filter window. May be less than the cache's capacity. */
/*ma_uint16 cacheLengthInFrames;*//* The number of valid frames sitting in the cache, including the filter window. May be less than the cache's capacity. */
ma_uint16windowLength;
ma_uint16windowLength;
doublewindowTime;/* By input rate. Relative to the start of the cache. */
doublewindowTime;/* By input rate. Relative to the start of the cache. */
ma_resampler_configconfig;
ma_resampler_configconfig;
ma_resampler_init_procinit;
ma_resampler_init_procinit;
ma_resampler_process_procprocess;
ma_resampler_read_f32_procreadF32;
ma_resampler_read_f32_procreadF32;
ma_resampler_read_s16_procreadS16;
ma_resampler_read_s16_procreadS16;
ma_resampler_seek_procseek;
ma_resampler_seek_procseek;
...
@@ -149,7 +168,7 @@ you should provide for a given number of output frames.
...
@@ -149,7 +168,7 @@ you should provide for a given number of output frames.
You can pass NULL to [ppFramesOut], in which case a seek will be performed. When [pFrameCountOut] is not NULL, it will seek past that
You can pass NULL to [ppFramesOut], in which case a seek will be performed. When [pFrameCountOut] is not NULL, it will seek past that
number of output frames. Otherwise, if [pFrameCountOut] is NULL and [pFrameCountIn] is not NULL, it will seek by the specified number
number of output frames. Otherwise, if [pFrameCountOut] is NULL and [pFrameCountIn] is not NULL, it will seek by the specified number
of input frames. When seeking, [ppFramesIn] is allowed to NULL, in which case the internal timing state will be updated, but not input
of input frames. When seeking, [ppFramesIn] is allowed to NULL, in which case the internal timing state will be updated, but no input
will be processed.
will be processed.
It is an error for both [pFrameCountOut] and [pFrameCountIn] to be NULL.
It is an error for both [pFrameCountOut] and [pFrameCountIn] to be NULL.
...
@@ -163,8 +182,8 @@ Reads a number of PCM frames from the resampler.
...
@@ -163,8 +182,8 @@ Reads a number of PCM frames from the resampler.
Passing in NULL for ppFrames is equivalent to calling ma_resampler_seek(pResampler, frameCount, 0).
Passing in NULL for ppFrames is equivalent to calling ma_resampler_seek(pResampler, frameCount, 0).
inputFrameCount=onRead(pResampler,targetInputFrameCount,&ppInputFrames[0]);/* Don't check if inputFrameCount is 0 and break from the loop. May want to extract the last bit that's sitting in the window. */