comparison libaf/af_equalizer.c @ 24900:9079c9745ff9

A/V sync: take audio filter buffers into account Substract the delay caused by filter buffering when calculating currently playing audio position. This matters for af_scaletempo which buffers significant and varying amounts of data. For other current filters the effect is normally insignificant. Instead of the old time-based filter delay field (which was ignored) this version stores the per-filter delay in units of bytes input read without corresponding output. This allows the current scaletempo behavior where other filters before and after it can see the same nominal samplerate even though the real duration of the data varies; in this case the other filters can not know the delay they're causing in terms of real time.
author uau
date Thu, 01 Nov 2007 06:52:50 +0000
parents b2402b4f0afa
children 72d0b1444141
comparison
equal deleted inserted replaced
24899:3245638ab801 24900:9079c9745ff9
104 // Generate filter taps 104 // Generate filter taps
105 for(k=0;k<s->K;k++) 105 for(k=0;k<s->K;k++)
106 bp2(s->a[k],s->b[k],F[k]/((float)af->data->rate),Q); 106 bp2(s->a[k],s->b[k],F[k]/((float)af->data->rate),Q);
107 107
108 // Calculate how much this plugin adds to the overall time delay 108 // Calculate how much this plugin adds to the overall time delay
109 af->delay += 2000.0/((float)af->data->rate); 109 af->delay = 2 * af->data->nch * af->data->bps;
110 110
111 // Calculate gain factor to prevent clipping at output 111 // Calculate gain factor to prevent clipping at output
112 for(k=0;k<AF_NCH;k++) 112 for(k=0;k<AF_NCH;k++)
113 { 113 {
114 for(i=0;i<KM;i++) 114 for(i=0;i<KM;i++)