~ubuntu-branches/ubuntu/maverick/alsa-lib/maverick-proposed

« back to all changes in this revision

Viewing changes to src/pcm/pcm_softvol.c

  • Committer: Bazaar Package Importer
  • Author(s): Luke Yelavich
  • Date: 2010-05-19 11:04:50 UTC
  • mfrom: (1.1.14 upstream) (2.2.6 sid)
  • Revision ID: james.westby@ubuntu.com-20100519110450-79ixzqrupz0ylqjb
Tags: 1.0.23-0ubuntu1
* New upstream release
  - debian/patches/:
    + Dont_leak_timer_fd_on_pcm_slave_close.patch
    + Fix-S24_3LE-softvol-distortion.patc
    + Fix-modem-on-hook.patch
    + Fix-stream-state-updates.patch
    + Fix-pcm-timer-open-subdevice-pcm_hw.patch
    + b9dbee6-Fix-threading-drain.patch
      - Dropped
    + Fix-str-lit-no-format.patch
    + lp433573-Support-Echo3G.patch
      - retained, need to be sent upstream
* Merge from debian unstable, remaining changes:
  - debian/rules:
    + Don't bail when removing include/alsa
  - debian/control: Add Vcs-Bzr URI
  - Add configuration files for bluetooth/bluez-alsa and pulseaudio
  - debian/libasound2.install: Ship smixer plugins for native and bi-arch
    packages
  - drop libcxxtools-dev build dependency, its in universe
  - add --with-plugindir=\$${prefix}/lib/alsa-lib to configure-stamp
  - Demote libc6-i386 pre-depends to depends for lib32asound2

Show diffs side-by-side

added added

removed removed

Lines of Context:
107
107
        v.i = a;
108
108
        y.i = 0;
109
109
#if __BYTE_ORDER == __LITTLE_ENDIAN
110
 
        x.i = (unsigned int)v.s[0] * b;
 
110
        x.i = (unsigned short)v.s[0];
 
111
        x.i *= b;
111
112
        y.s[0] = x.s[1];
112
113
        y.i += (int)v.s[1] * b;
113
114
#else
135
136
        return swap ? (int)bswap_32(fraction) : fraction;
136
137
}
137
138
 
 
139
/* always little endian */
 
140
static inline int MULTI_DIV_24(int a, unsigned int b)
 
141
{
 
142
        unsigned int gain = b >> VOL_SCALE_SHIFT;
 
143
        int fraction;
 
144
        fraction = MULTI_DIV_32x16(a, b & VOL_SCALE_MASK);
 
145
        if (gain) {
 
146
                long long amp = (long long)a * gain + fraction;
 
147
                if (amp > (int)0x7fffff)
 
148
                        amp = (int)0x7fffff;
 
149
                else if (amp < (int)0x800000)
 
150
                        amp = (int)0x800000;
 
151
                return (int)amp;
 
152
        }
 
153
        return fraction;
 
154
}
 
155
 
138
156
static inline short MULTI_DIV_short(short a, unsigned int b, int swap)
139
157
{
140
158
        unsigned int gain = b >> VOL_SCALE_SHIFT;
223
241
                                tmp = src[0] |                          \
224
242
                                      (src[1] << 8) |                   \
225
243
                                      (((signed char *) src)[2] << 16); \
226
 
                                tmp = MULTI_DIV_int(tmp, vol_scale, 0); \
 
244
                                tmp = MULTI_DIV_24(tmp, vol_scale);     \
227
245
                                dst[0] = tmp;                           \
228
246
                                dst[1] = tmp >> 8;                      \
229
247
                                dst[2] = tmp >> 16;                     \