#include #include #include "af.h" /* Convert to gain value from dB. Returns AF_OK if of and AF_ERROR if fail */ int af_from_dB(int n, float* in, float* out, float k, float mi, float ma) { int i = 0; // Sanity check if(!in || !out) return AF_ERROR; for(i=0;idata->format != out->format) || (af->data->bps != out->bps) || (af->data->rate != out->rate) || (af->data->nch != out->nch)){ memcpy(out,af->data,sizeof(af_data_t)); return AF_FALSE; } return AF_OK; } /* Soft clipping, the sound of a dream, thanks to Jon Wattes post to Musicdsp.org */ float af_softclip(float a) { if (a >= M_PI/2) return 1.0; else if (a <= -M_PI/2) return -1.0; else return sin(a); }