~jderose/ubuntu/raring/qemu/vde-again

« back to all changes in this revision

Viewing changes to audio/mixeng_template.h

  • Committer: Bazaar Package Importer
  • Author(s): Aurelien Jarno, Aurelien Jarno
  • Date: 2009-03-22 10:13:17 UTC
  • mfrom: (1.2.1 upstream) (6.1.1 sid)
  • Revision ID: james.westby@ubuntu.com-20090322101317-iigjtnu5qil35dtb
Tags: 0.10.1-1
[ Aurelien Jarno ]
* New upstream stable release:
  - patches/80_stable-branch.patch: remove.
* debian/control: 
  - Remove depends on proll.
  - Move depends on device-tree-compiler to build-depends.
  - Bump Standards-Version to 3.8.1 (no changes).
* patches/82_qemu-img_decimal.patch: new patch from upstream to make
  qemu-img accept sizes with decimal values (closes: bug#501400).

Show diffs side-by-side

added added

removed removed

Lines of Context:
31
31
#define HALF (IN_MAX >> 1)
32
32
#endif
33
33
 
34
 
#ifdef NOVOL
35
 
#define VOL(a, b) a
36
 
#else
 
34
#ifdef CONFIG_MIXEMU
37
35
#ifdef FLOAT_MIXENG
38
36
#define VOL(a, b) ((a) * (b))
39
37
#else
40
38
#define VOL(a, b) ((a) * (b)) >> 32
41
39
#endif
 
40
#else
 
41
#define VOL(a, b) a
42
42
#endif
43
43
 
44
44
#define ET glue (ENDIAN_CONVERSION, glue (_, IN_T))
45
45
 
46
46
#ifdef FLOAT_MIXENG
47
 
static real_t inline glue (conv_, ET) (IN_T v)
 
47
static mixeng_real inline glue (conv_, ET) (IN_T v)
48
48
{
49
49
    IN_T nv = ENDIAN_CONVERT (v);
50
50
 
51
51
#ifdef RECIPROCAL
52
52
#ifdef SIGNED
53
 
    return nv * (1.f / (real_t) (IN_MAX - IN_MIN));
 
53
    return nv * (1.f / (mixeng_real) (IN_MAX - IN_MIN));
54
54
#else
55
 
    return (nv - HALF) * (1.f / (real_t) IN_MAX);
 
55
    return (nv - HALF) * (1.f / (mixeng_real) IN_MAX);
56
56
#endif
57
57
#else  /* !RECIPROCAL */
58
58
#ifdef SIGNED
59
 
    return nv / (real_t) (IN_MAX - IN_MIN);
 
59
    return nv / (mixeng_real) (IN_MAX - IN_MIN);
60
60
#else
61
 
    return (nv - HALF) / (real_t) IN_MAX;
 
61
    return (nv - HALF) / (mixeng_real) IN_MAX;
62
62
#endif
63
63
#endif
64
64
}
65
65
 
66
 
static IN_T inline glue (clip_, ET) (real_t v)
 
66
static IN_T inline glue (clip_, ET) (mixeng_real v)
67
67
{
68
68
    if (v >= 0.5) {
69
69
        return IN_MAX;
109
109
#endif
110
110
 
111
111
static void glue (glue (conv_, ET), _to_stereo)
112
 
    (st_sample_t *dst, const void *src, int samples, volume_t *vol)
 
112
    (struct st_sample *dst, const void *src, int samples, struct mixeng_volume *vol)
113
113
{
114
 
    st_sample_t *out = dst;
 
114
    struct st_sample *out = dst;
115
115
    IN_T *in = (IN_T *) src;
116
 
#ifndef NOVOL
 
116
#ifdef CONFIG_MIXEMU
117
117
    if (vol->mute) {
118
118
        mixeng_clear (dst, samples);
119
119
        return;
129
129
}
130
130
 
131
131
static void glue (glue (conv_, ET), _to_mono)
132
 
    (st_sample_t *dst, const void *src, int samples, volume_t *vol)
 
132
    (struct st_sample *dst, const void *src, int samples, struct mixeng_volume *vol)
133
133
{
134
 
    st_sample_t *out = dst;
 
134
    struct st_sample *out = dst;
135
135
    IN_T *in = (IN_T *) src;
136
 
#ifndef NOVOL
 
136
#ifdef CONFIG_MIXEMU
137
137
    if (vol->mute) {
138
138
        mixeng_clear (dst, samples);
139
139
        return;
150
150
}
151
151
 
152
152
static void glue (glue (clip_, ET), _from_stereo)
153
 
    (void *dst, const st_sample_t *src, int samples)
 
153
    (void *dst, const struct st_sample *src, int samples)
154
154
{
155
 
    const st_sample_t *in = src;
 
155
    const struct st_sample *in = src;
156
156
    IN_T *out = (IN_T *) dst;
157
157
    while (samples--) {
158
158
        *out++ = glue (clip_, ET) (in->l);
162
162
}
163
163
 
164
164
static void glue (glue (clip_, ET), _from_mono)
165
 
    (void *dst, const st_sample_t *src, int samples)
 
165
    (void *dst, const struct st_sample *src, int samples)
166
166
{
167
 
    const st_sample_t *in = src;
 
167
    const struct st_sample *in = src;
168
168
    IN_T *out = (IN_T *) dst;
169
169
    while (samples--) {
170
170
        *out++ = glue (clip_, ET) (in->l + in->r);