Changeset 19123e6624236b0f9c97a3e13df1a493436350c2

Show
Ignore:
Timestamp:
06/10/09 02:47:39 (3 years ago)
Author:
Nedko Arnaudov <nedko@…>
Children:
430899e583d1ce72d6fb3fbf929006c61f7fdc23
Parents:
e7c6b41ac5a2552147e83c248b26252f2841a35e
git-committer:
Nedko Arnaudov <nedko@arnaudov.name> / 2009-06-10T02:47:39Z+0300
Message:

Apply updates in FIL-plugins between 0.1.0 and 0.3.0

The new filter will 'feel' different in particular
the interaction between gain and bandwidth. This
version is much closer to what you'll find in the
best analog (and digital) mixers. But it's still
the same filter, only the mapping of parameter
values to responses has changed.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • filter.c

    r4a9e3e0 r19123e6  
    5252  struct param_sect * sect_ptr) 
    5353{ 
    54   sect_ptr->f = 0.25; 
    55   sect_ptr->b = sect_ptr->g = 1.0; 
    56   sect_ptr->a = sect_ptr->s1 = sect_ptr->s2 = sect_ptr->z1 = sect_ptr->z2 = 0.0; 
     54  sect_ptr->f = 0.25f; 
     55  sect_ptr->b = sect_ptr->g = 1.0f; 
     56  sect_ptr->a = sect_ptr->s1 = sect_ptr->s2 = sect_ptr->z1 = sect_ptr->z2 = 0.0f; 
    5757} 
    5858 
     
    7979  if (f != sect_ptr->f) 
    8080  { 
    81     if      (f < 0.5 * sect_ptr->f) f = 0.5 * sect_ptr->f; 
    82     else if (f > 2.0 * sect_ptr->f) f = 2.0 * sect_ptr->f; 
     81    if      (f < 0.5f * sect_ptr->f) f = 0.5f * sect_ptr->f; 
     82    else if (f > 2.0f * sect_ptr->f) f = 2.0f * sect_ptr->f; 
    8383    sect_ptr->f = f; 
    84     sect_ptr->s1 = -cos(2 * M_PI * f); 
     84    sect_ptr->s1 = -cosf(6.283185f * f); 
    8585    d1 = (sect_ptr->s1 - s1) / k; 
    8686    u2 = true; 
     
    8989  if (g != sect_ptr->g) 
    9090  { 
    91     if      (g < 0.5 * sect_ptr->g) g = 0.5 * sect_ptr->g; 
    92     else if (g > 2.0 * sect_ptr->g) g = 2.0 * sect_ptr->g; 
     91    if      (g < 0.5f * sect_ptr->g) g = 0.5f * sect_ptr->g; 
     92    else if (g > 2.0f * sect_ptr->g) g = 2.0f * sect_ptr->g; 
    9393    sect_ptr->g = g; 
    94     sect_ptr->a = 0.5 * (g - 1.0); 
     94    sect_ptr->a = 0.5f * (g - 1.0f); 
    9595    da = (sect_ptr->a - a) / k; 
    9696    u2 = true; 
     
    9999  if (b != sect_ptr->b) 
    100100  { 
    101     if      (b < 0.5 * sect_ptr->b) b = 0.5 * sect_ptr->b; 
    102     else if (b > 2.0 * sect_ptr->b) b = 2.0 * sect_ptr->b; 
     101    if      (b < 0.5f * sect_ptr->b) b = 0.5f * sect_ptr->b; 
     102    else if (b > 2.0f * sect_ptr->b) b = 2.0f * sect_ptr->b; 
    103103    sect_ptr->b = b; 
    104104    u2 = true; 
     
    107107  if (u2) 
    108108  { 
    109     b *= 4 * f; 
    110     sect_ptr->s2 = (1 + sect_ptr->a - b) / (1 + sect_ptr->a + b); 
     109    b *= 7 * f / sqrtf(g);          
     110    sect_ptr->s2 = (1 - b) / (1 + b); 
    111111    d2 = (sect_ptr->s2 - s2) / k; 
    112112  } 
     
    122122    y -= s1 * sect_ptr->z1; 
    123123    sect_ptr->z2 = sect_ptr->z1 + s1 * y; 
    124     sect_ptr->z1 = y + 1e-10; 
     124    sect_ptr->z1 = y + 1e-10f; 
    125125  } 
    126126}