Skip to content

Instantly share code, notes, and snippets.

@kode54
Created August 26, 2013 05:24
Show Gist options
  • Save kode54/6338317 to your computer and use it in GitHub Desktop.
Save kode54/6338317 to your computer and use it in GitHub Desktop.
Lanczos FIR filter resampler, import header
#ifndef _LANCZOS_RESAMPLER_H_
#define _LANCZOS_RESAMPLER_H_
#ifdef __cplusplus
extern "C" {
#endif
/* Call this once on startup */
void lanczos_init();
/* Create or destroy individual resamplers */
void * lanczos_resampler_create();
void lanczos_resampler_delete(void *);
/* Clear the input and output buffers */
void lanczos_resampler_clear(void *);
/* Write a single input sample */
void lanczos_resampler_write_sample(void *, float s);
/* Set the resampling ratio, which is a ratio of output rate divided by input rate,
or how many input samples to advance for each output sample */
void lanczos_resampler_set_rate( void *, double new_factor );
/* Returns non-zero if the input buffer has been filled enough to produce at least
one output sample */
int lanczos_resampler_ready(void *);
/* Returns the count of how many samples may yet be written to the input buffer */
int lanczos_resampler_write_avail(void *);
/* Returns a count of how many output samples are waiting to be retrieved and removed */
int midi_lanczos_resampler_get_sample_count(void *);
/* Returns the current output sample. May be called repeatedly. */
float midi_lanczos_resampler_get_sample(void *);
/* Removes the current output sample from the buffer and advances the pointer to the next
output sample */
void midi_lanczos_resampler_remove_sample(void *);
#ifdef __cplusplus
}
#endif
#endif
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment