Changeset 883:c2c34287619c in roaraudio for libroardsp/filter_highp.c


Ignore:
Timestamp:
11/19/08 21:24:35 (15 years ago)
Author:
phi
Branch:
default
Phase:
public
Message:

ha, found the bug and gut the filter working!

File:
1 edited

Legend:

Unmodified
Added
Removed
  • libroardsp/filter_highp.c

    r684 r883  
    5050 struct roardsp_highp * self = (struct roardsp_highp *) filter->inst; 
    5151 int16_t * samp = (int16_t *) data; 
    52  register int32_t s; 
     52 register int32_t s, h; 
    5353 int i, c; 
    5454 int channels = filter->channels; 
     
    6666 for (i = 0; i < samples; i++) { 
    6767  for (c = 0; c < channels; c++) { 
     68   h = samp[i*channels + c]; 
    6869   s = samp[i*channels + c] * self->a + self->oldin[c] * self->b + self->oldout[c] * self->c; 
    6970 
    7071   s /= 65536; 
    7172 
    72    self->oldin[      c] = s; 
     73   self->oldin[      c] = h; 
    7374   samp[i*channels + c] = s; 
    7475   self->oldout[     c] = s; 
     
    9091 newfreq = *(float*)data; 
    9192 
    92  lp = exp(-2 * M_PI * newfreq / filter->rate) * 65536; 
     93 lp = exp(-2.0 * M_PI * newfreq / (float) filter->rate) * 65536; 
    9394 
    94  self->a =  (65536 + lp)/2; 
    95  self->b = -(65536 + lp)/2; 
     95 self->a =  (65536 + lp)/2.0; 
     96 self->b = -(65536 + lp)/2.0; 
    9697 self->c =           lp; 
    9798 
Note: See TracChangeset for help on using the changeset viewer.