X-Git-Url: http://git.maemo.org/git/?p=aic34-eq;a=blobdiff_plain;f=setcoeffs.c;fp=setcoeffs.c;h=1ea5b10ef55ff855d1d4f6362be5f9fa2699d46e;hp=0000000000000000000000000000000000000000;hb=6a695ce87cc9f1642ae6a7cf432a5dd804e5a21e;hpb=73b3a14c93124179fea8d9e83f0ebac429e850ab diff --git a/setcoeffs.c b/setcoeffs.c new file mode 100644 index 0000000..1ea5b10 --- /dev/null +++ b/setcoeffs.c @@ -0,0 +1,34 @@ +#include +#include +#include +#include +#include + +struct iir_coeffs { + int16_t N0, N1, N2, D1, D2; + int16_t N3, N4, N5, D4, D5; +}; + +int main(){ + struct iir_coeffs coeffs = { + .N0 = 32767, .N1 = 4265, .N2 = -10472, .D1 = -6269, .D2 = 0, + .N3 = 32027, .N4 = -31187, .N5 = 30352, .D4 = 31187, .D5 = -29613 + }; + + snd_hwdep_t *hwdep; + int ret; int arg; + + ret = snd_hwdep_open(&hwdep, "hw:0,0", SND_HWDEP_OPEN_DUPLEX); + printf("open: %i\n", ret); + if(ret) return 1; + + ret = snd_hwdep_write(hwdep, (void*)&coeffs, sizeof(coeffs)); + printf("write: %i\n", ret); + + /* Set state to 2, which is 'Custom'. This writes coeffs to hardware + * and enables filter */ + arg = 2; + ret = snd_hwdep_ioctl(hwdep, 1, &arg); + printf("ioctl: %i\n", ret); + return 0; +}