diff options
-rw-r--r-- | arts/modules/synth/c_filter_stuff.c | 138 | ||||
-rw-r--r-- | arts/modules/synth/c_filter_stuff.h | 60 | ||||
-rw-r--r-- | kscd/libwm/cddb.c | 2 | ||||
-rw-r--r-- | kscd/libwm/include/wm_struct.h | 33 |
4 files changed, 85 insertions, 148 deletions
diff --git a/arts/modules/synth/c_filter_stuff.c b/arts/modules/synth/c_filter_stuff.c index 531d5015..c3a42697 100644 --- a/arts/modules/synth/c_filter_stuff.c +++ b/arts/modules/synth/c_filter_stuff.c @@ -42,8 +42,7 @@ /*#define SPN MINDOUBLE*/ #define SPN 0.00001 -double bw2angle(a,bw) -double a,bw; +double bw2angle(double a, double bw) { double T,d,sn,cs,mag,delta,theta,tmp,a2,a4,asnd; @@ -63,8 +62,8 @@ double a,bw; return(theta/(2.0*PI)); } -void presence(cf,boost,bw,a0,a1,a2,b1,b2) -double cf,boost,bw,*a0,*a1,*a2,*b1,*b2; +void presence(double cf, double boost, double bw, double *a0, + double *a1, double *a2, double *b1, double *b2) { double a,A,F,xfmbw,C,tmp,alphan,alphad,b0,recipb0,asq,F2,a2plus1,ma2plus1; @@ -100,8 +99,8 @@ double cf,boost,bw,*a0,*a1,*a2,*b1,*b2; *b2 *= recipb0; } -void shelve(cf,boost,a0,a1,a2,b1,b2) -double cf,boost,*a0,*a1,*a2,*b1,*b2; +void shelve(double cf, double boost, double *a0, double *a1, + double *a2, double *b1, double *b2) { double a,A,F,tmp,b0,recipb0,asq,F2,gamma2,siggam2,gam2p1; double gamman,gammad,ta0,ta1,ta2,tb0,tb1,tb2,aa1,ab1; @@ -160,9 +159,7 @@ void initfilter(filter *f) f->y = 0.0; } -void setfilter_presence(f,freq,boost,bw) -filter *f; -double freq,boost,bw; +void setfilter_presence(filter *f, double freq, double boost, double bw) { presence(freq/(double)SR,boost,bw/(double)SR, &f->cx,&f->cx1,&f->cx2,&f->cy1,&f->cy2); @@ -196,9 +193,7 @@ void setfilter_shelvelowpass(filter *f, double freq, double boost) * As in ''An introduction to digital filter theory'' by Julius O. Smith * and in Moore's book; I use the normalized version in Moore's book. */ -void setfilter_2polebp(f,freq,R) -filter *f; -double freq,R; +void setfilter_2polebp(filter *f, double freq, double R) { double theta; @@ -217,9 +212,7 @@ double freq,R; * for digital audio equalization * JAES, Vol. 34, No. 6, 1986 June */ -void setfilter_peaknotch(f,freq,M,bw) -filter *f; -double freq,M,bw; +void setfilter_peaknotch(filter *f, double freq, double M, double bw) { double w0,om,ta,d, p=0.0 /* prevents compiler warning */; @@ -244,9 +237,7 @@ double freq,M,bw; * Some JAES's article on ladder filter. * freq (Hz), gdb (dB), bw (Hz) */ -void setfilter_peaknotch2(f,freq,gdb,bw) -filter *f; -double freq,gdb,bw; +void setfilter_peaknotch2(filter *f, double freq, double gdb, double bw) { double k,w,bwr,abw,gain; @@ -262,9 +253,7 @@ double freq,gdb,bw; f->cy2 = -abw; } -double applyfilter(f,x) -filter *f; -double x; +double applyfilter(filter *f, double x) { f->x = x; f->y = f->cx * f->x + f->cx1 * f->x1 + f->cx2 * f->x2 @@ -281,8 +270,7 @@ double x; */ #if 0 -int saturate16(x) -double x; +int saturate16(double x) { if (x > 32765.0) { return(32765); @@ -291,9 +279,7 @@ double x; } else return((int)x); } -void initdelay(d,n) -delay *d; -int n; +void initdelay(delay *d, int n) { int i; @@ -304,8 +290,7 @@ int n; for(i = 0; i < n; i++) d->buf[i] = 0.0; } -double readdelay(d) -delay *d; +double readdelay(delay *d) { double y; @@ -315,18 +300,14 @@ delay *d; return(y); } -void writedelay(d,x) -delay *d; -double x; +void writedelay(delay *d, double x) { d->buf[d->wloc] = x; d->wloc++; if (d->wloc == d->len) d->wloc = 0; } -void initringbufferd(rb,n) -ringbufferd *rb; -int n; +void initringbufferd(ringbufferd *rb, int n) { int i; @@ -336,9 +317,7 @@ int n; for(i = 0; i < n; i++) rb->buf[i] = 0.0; } -double readringbufferd(rb,n) -ringbufferd *rb; -int n; +double readringbufferd(ringbufferd *rb, int n) { int i; @@ -348,18 +327,14 @@ int n; return(rb->buf[i]); } -void writeringbufferd(rb,x) -ringbufferd *rb; -double x; +void writeringbufferd(ringbufferd *rb, double x) { rb->buf[rb->wloc] = x; rb->wloc++; if (rb->wloc == rb->len) rb->wloc = 0; } -void initringbufferi(rb,n) -ringbufferi *rb; -int n; +void initringbufferi(ringbufferd *rb, int n) { int i; @@ -369,9 +344,7 @@ int n; for(i = 0; i < n; i++) rb->buf[i] = 0; } -int readringbufferi(rb,n) -ringbufferi *rb; -int n; +int readringbufferi(ringbufferd *rb, int n) { int i; @@ -381,9 +354,7 @@ int n; return(rb->buf[i]); } -void writeringbufferi(rb,x) -ringbufferi *rb; -int x; +void writeringbufferi(ringbufferd *rb, int x) { rb->buf[rb->wloc] = x; rb->wloc++; @@ -396,8 +367,7 @@ int buffi[BUFFSIZE]; int **buffs; -int makenodes(n) -int n; +int makenodes(int n) { int *p; int i; @@ -407,8 +377,7 @@ int n; return((int)p); } -int makeints(n) -int n; +int makeints(int n) { int *p; int i; @@ -419,13 +388,9 @@ int n; } /* - constant memory size: (i) one big malloc (ii) many mallocs, upper limit in doing mallocs - - - */ @@ -461,10 +426,7 @@ constant memory size: * */ /* -int newfreadbufs(buf,n,p) -short **buf; -int n; -ty_audiofile *p; +int newfreadbufs(short **buf, int n, ty_audiofile *p) { if (n*p->afsc > BUFFSIZE) { fprintf(stderr,"freadbufi: reading too many samples\n"); @@ -475,10 +437,7 @@ ty_audiofile *p; return(m); } -int newfreadbufi(buf,n,p) -int **buf; -int n; -ty_audiofile *p; +int newfreadbufi(int **buf, int n, ty_audiofile *p) { if (n*p->afsc > BUFFSIZE) { fprintf(stderr,"freadbufi: reading too many samples\n"); @@ -489,10 +448,7 @@ ty_audiofile *p; return(m); } -int newfreadbuff(buf,n,p) -float **buf; -int n; -ty_audiofile *p; +int newfreadbuff(float **buf, int n, ty_audiofile *p) { if (n*p->afsc > BUFFSIZE) { fprintf(stderr,"freadbufi: reading too many samples\n"); @@ -504,9 +460,7 @@ ty_audiofile *p; } -int newfreadbuf(buf,p) -ty_buffer *buf; -ty_audiofile *p; +int newfreadbuf(ty_buffer **buf, ty_audiofile *p) { } @@ -519,10 +473,7 @@ ty_audiofile *p; * Return value is the number of the samples read. */ -int freadbuf(buf,n,p) -int **buf; -int n; -ty_audiofile *p; +int freadbuf(int **buf, int n, ty_audiofile *p) { int h,i,j,k,l,s; unsigned int us; @@ -571,10 +522,7 @@ ty_audiofile *p; } -int fwritebuf(buf,n,p) -int **buf; -int n; -ty_audiofile *p; +int fwritebuf(int **buf, int n, ty_audiofile *p) { int h,i,j,k,l,s; unsigned int us1,us2; @@ -640,10 +588,7 @@ ty_audiofile *p; } -ty_audiofile *initaf(afm,afn,aft) -ty_afmethod *afm; -ty_afname *afn; -ty_aftype *aft; +ty_audiofile *initaf(ty_afmethod *afm, ty_afname *afn, ty_aftype *aft) { ty_audiofile *p; int i,j,k,n,s; @@ -769,8 +714,7 @@ void bye() } -ty_sample *makesample(sc) -int sc; +ty_sample *makesample(int sc) { ty_sample *p; @@ -780,10 +724,7 @@ int sc; } -int readsample(p,n,s) -ty_audiofile *p; -int n; -ty_sample *s; +int readsample(ty_audiofile *p, int n, ty_sample *s) { int i,j,k,dt,l; FILE *fp; @@ -839,10 +780,7 @@ ty_sample *s; } -int writesample(p,n,s) -ty_audiofile *p; -int n; -ty_sample *s; +int writesample(ty_audiofile *p, int n, ty_sample *s) { int i,j,k,dt,l; FILE *fp; @@ -878,8 +816,7 @@ ty_afmethod *afmethod_flowout() return(p); } -ty_afmethod *afmethod_rb(n) -int n; +ty_afmethod *afmethod_rb(int n) { ty_afmethod *p; @@ -902,8 +839,7 @@ ty_afmethod *afmethod_aimro() return(p); } -ty_afname *afname(s) -char *s; +ty_afname *afname(char *s) { ty_afname *p; @@ -936,8 +872,7 @@ ty_afname *afname_stdout() return(p); } -ty_aftype *aftype(sr,sc,stype) -int sr,sc,stype; +ty_aftype *aftype(int sr, int sc, int stype) { ty_aftype *p; @@ -954,8 +889,7 @@ ty_aftype *aftype_defstereo() } -ty_audiofile *initaf_aimdefstereo(filename) -char *filename; +ty_audiofile *initaf_aimdefstereo(char *filename) { return(initaf(afmethod_aimro(),afname(filename),aftype_defstereo())); } diff --git a/arts/modules/synth/c_filter_stuff.h b/arts/modules/synth/c_filter_stuff.h index 89e93de3..4f3d7f6a 100644 --- a/arts/modules/synth/c_filter_stuff.h +++ b/arts/modules/synth/c_filter_stuff.h @@ -40,16 +40,18 @@ typedef struct { double x,x1,x2,y,y1,y2; } filter; -void presence(); -void shelve(); +void presence(double cf, double boost, double bw, double *a0, + double *a1, double *a2, double *b1, double *b2); +void shelve(double cf, double boost, double *a0, double *a1, + double *a2, double *b1, double *b2); void initfilter(filter *f); -void setfilter_presence(); +void setfilter_presence(filter *f, double freq, double boost, double bw); void setfilter_shelve(filter *f, double freq, double boost); void setfilter_shelvelowpass(filter *f, double freq, double boost); -void setfilter_2polebp(); -void setfilter_peaknotch(); -void setfilter_peaknotch2(); -double applyfilter(); +void setfilter_2polebp(filter *f, double freq, double R); +void setfilter_peaknotch(filter *f, double freq, double M, double bw); +void setfilter_peaknotch2(filter *f, double freq, double gdb, double bw); +double applyfilter(filter *f, double x); #ifdef __cplusplus } @@ -208,38 +210,38 @@ typedef struct { ty_audiofile *gaf[C_MAXAUDIOFILES]; -int makenodes(); -int makeints(); +int makenodes(int n); +int makeints(int n); /* -int freadbuf(); -int fwritebuf(); +int freadbuf(int **buf, int n, ty_audiofile *p); +int fwritebuf(int **buf, int n, ty_audiofile *p); */ -ty_audiofile *initaf(); +ty_audiofile *initaf(ty_afmethod *afm, ty_afname *afn, ty_aftype *aft); void bye(); -ty_sample *makesample(); -int readsample(); -int writesample(); +ty_sample *makesample(int sc); +int readsample(ty_audiofile *p, int n, ty_sample *s); +int writesample(ty_audiofile *p, int n, ty_sample *s); ty_afmethod *afmethod_flowout(); -ty_afmethod *afmethod_rb(); +ty_afmethod *afmethod_rb(int n); ty_afmethod *afmethod_aimro(); -ty_afname *afname(); +ty_afname *afname(char *s); ty_afname *afname_stdin(); ty_afname *afname_stdout(); -ty_aftype *aftype(); +ty_aftype *aftype(int sr, int sc, int stype); ty_aftype *aftype_defstereo(); -ty_audiofile *initaf_aimdefstereo(); +ty_audiofile *initaf_aimdefstereo(char *filename); ty_audiofile *initaf_stdin(); void init(); -int saturate16(); -void initdelay(); -double readdelay(); -void writedelay(); -void initringbufferd(); -double readringbufferd(); -void writeringbufferd(); -void initringbufferi(); -int readringbufferi(); -void writeringbufferi(); +int saturate16(double x); +void initdelay(delay *d, int n); +double readdelay(delay *d); +void writedelay(delay *d, double x); +void initringbufferd(ringbufferd *rb, int n); +double readringbufferd(ringbufferd *rb, int n); +void writeringbufferd(ringbufferd *rb, double x); +void initringbufferi(ringbufferd *rb, int n); +int readringbufferi(ringbufferd *rb, int n); +void writeringbufferi(ringbufferd *rb, int x); #endif #endif // C_FILTER_STUFF_H diff --git a/kscd/libwm/cddb.c b/kscd/libwm/cddb.c index e972ef0d..1d6e7026 100644 --- a/kscd/libwm/cddb.c +++ b/kscd/libwm/cddb.c @@ -41,6 +41,7 @@ #include <sys/time.h> #include <sys/socket.h> #include <netinet/in.h> +#include <arpa/inet.h> #include <netdb.h> #include "include/wm_config.h" @@ -234,7 +235,6 @@ connect_open(void) static struct in_addr defaddr; static char *alist[1]; static char namebuf[128]; - int inet_addr(); defaddr.s_addr = inet_addr(host); if ((int) defaddr.s_addr == -1) diff --git a/kscd/libwm/include/wm_struct.h b/kscd/libwm/include/wm_struct.h index 71afce07..4369c925 100644 --- a/kscd/libwm/include/wm_struct.h +++ b/kscd/libwm/include/wm_struct.h @@ -104,33 +104,34 @@ struct wm_cdinfo /* The global variable "cd" points to the struct for the CD that's playing. */ extern struct wm_cdinfo *cd; -extern struct wm_playlist *new_playlist(); +extern struct wm_playlist *new_playlist(struct wm_cdinfo*, char*); #define WM_STR_GENVENDOR "Generic" #define WM_STR_GENMODEL "drive" #define WM_STR_GENREV "type" +struct wm_drive; /* * Drive descriptor structure. Used for access to low-level routines. */ struct wm_drive_proto { - int (*gen_init)(); - int (*gen_close)(); - int (*gen_get_trackcount)(); - int (*gen_get_cdlen)(); - int (*gen_get_trackinfo)(); - int (*gen_get_drive_status)(); - int (*gen_get_volume)(); - int (*gen_set_volume)(); - int (*gen_pause)(); - int (*gen_resume)(); - int (*gen_stop)(); - int (*gen_play)(); - int (*gen_eject)(); - int (*gen_closetray)(); - int (*gen_get_cdtext)(); + int (*gen_init)(struct wm_drive*); + int (*gen_close)(struct wm_drive*); + int (*gen_get_trackcount)(struct wm_drive*, int*); + int (*gen_get_cdlen)(struct wm_drive*, int*); + int (*gen_get_trackinfo)(struct wm_drive*, int, int*, int*); + int (*gen_get_drive_status)(struct wm_drive*, int, int*, int*, int*, int*); + int (*gen_get_volume)( struct wm_drive*, int*, int*); + int (*gen_set_volume)( struct wm_drive*, int, int); + int (*gen_pause)(struct wm_drive*); + int (*gen_resume)(struct wm_drive*); + int (*gen_stop)(struct wm_drive*); + int (*gen_play)(struct wm_drive*, int, int, int); + int (*gen_eject)(struct wm_drive*); + int (*gen_closetray)(struct wm_drive*); + int (*gen_get_cdtext)(struct wm_drive*, unsigned char**, int*); }; struct wm_drive |