~ubuntu-branches/ubuntu/quantal/openal-soft/quantal

« back to all changes in this revision

Viewing changes to Alc/bs2b.c

  • Committer: Package Import Robot
  • Author(s): Michael Terry
  • Date: 2012-05-22 10:14:53 UTC
  • mfrom: (7.1.9 sid)
  • Revision ID: package-import@ubuntu.com-20120522101453-knsv1m1m8vl5ccfp
Tags: 1:1.14-3ubuntu1
* Merge from Debian testing.  Remaining changes:
  - Add a symbols file for libopenal1
* debian/libopenal1.symbols:
  - Update for 1.14

Show diffs side-by-side

added added

removed removed

Lines of Context:
24
24
#include "config.h"
25
25
 
26
26
#include <math.h>
 
27
#include <string.h>
27
28
 
28
29
#include "bs2b.h"
29
30
 
112
113
    bs2b->a0_hi = 1.0 - G_hi * (1.0 - x);
113
114
    bs2b->a1_hi = -x;
114
115
 
115
 
    bs2b->gain  = 1.0 / (1.0 - G_hi + G_lo);
 
116
    bs2b->gain  = 1.0f / (float)(1.0 - G_hi + G_lo);
116
117
} /* init */
117
118
 
118
119
/* Exported functions.
147
148
 
148
149
void bs2b_clear(struct bs2b *bs2b)
149
150
{
150
 
    int loopv = sizeof(bs2b->last_sample);
151
 
 
152
 
    while (loopv)
153
 
    {
154
 
        ((char *)&bs2b->last_sample)[--loopv] = 0;
155
 
    }
 
151
    memset(&bs2b->last_sample, 0, sizeof(bs2b->last_sample));
156
152
} /* bs2b_clear */
157
153
 
158
 
int bs2b_is_clear(struct bs2b *bs2b)
159
 
{
160
 
    int loopv = sizeof(bs2b->last_sample);
161
 
 
162
 
    while (loopv)
163
 
    {
164
 
        if (((char *)&bs2b->last_sample)[--loopv] != 0)
165
 
            return 0;
166
 
    }
167
 
    return 1;
168
 
} /* bs2b_is_clear */
169
 
 
170
154
void bs2b_cross_feed(struct bs2b *bs2b, float *sample)
171
155
{
172
156
    /* Lowpass filter */
180
164
    bs2b->last_sample.asis[1] = sample[1];
181
165
 
182
166
    /* Crossfeed */
183
 
    sample[0] = bs2b->last_sample.hi[0] + bs2b->last_sample.lo[1];
184
 
    sample[1] = bs2b->last_sample.hi[1] + bs2b->last_sample.lo[0];
 
167
    sample[0] = (float)(bs2b->last_sample.hi[0] + bs2b->last_sample.lo[1]);
 
168
    sample[1] = (float)(bs2b->last_sample.hi[1] + bs2b->last_sample.lo[0]);
185
169
 
186
170
    /* Bass boost cause allpass attenuation */
187
171
    sample[0] *= bs2b->gain;