Revision 00e07679 audio/mixeng_template.h

b/audio/mixeng_template.h
31 31
#define HALF (IN_MAX >> 1)
32 32
#endif
33 33

  
34
#ifdef CONFIG_MIXEMU
35
#ifdef FLOAT_MIXENG
36
#define VOL(a, b) ((a) * (b))
37
#else
38
#define VOL(a, b) ((a) * (b)) >> 32
39
#endif
40
#else
41
#define VOL(a, b) a
42
#endif
43

  
44 34
#define ET glue (ENDIAN_CONVERSION, glue (_, IN_T))
45 35

  
46 36
#ifdef FLOAT_MIXENG
......
109 99
#endif
110 100

  
111 101
static void glue (glue (conv_, ET), _to_stereo)
112
    (struct st_sample *dst, const void *src, int samples, struct mixeng_volume *vol)
102
    (struct st_sample *dst, const void *src, int samples)
113 103
{
114 104
    struct st_sample *out = dst;
115 105
    IN_T *in = (IN_T *) src;
116
#ifdef CONFIG_MIXEMU
117
    if (vol->mute) {
118
        mixeng_clear (dst, samples);
119
        return;
120
    }
121
#else
122
    (void) vol;
123
#endif
106

  
124 107
    while (samples--) {
125
        out->l = VOL (glue (conv_, ET) (*in++), vol->l);
126
        out->r = VOL (glue (conv_, ET) (*in++), vol->r);
108
        out->l = glue (conv_, ET) (*in++);
109
        out->r = glue (conv_, ET) (*in++);
127 110
        out += 1;
128 111
    }
129 112
}
130 113

  
131 114
static void glue (glue (conv_, ET), _to_mono)
132
    (struct st_sample *dst, const void *src, int samples, struct mixeng_volume *vol)
115
    (struct st_sample *dst, const void *src, int samples)
133 116
{
134 117
    struct st_sample *out = dst;
135 118
    IN_T *in = (IN_T *) src;
136
#ifdef CONFIG_MIXEMU
137
    if (vol->mute) {
138
        mixeng_clear (dst, samples);
139
        return;
140
    }
141
#else
142
    (void) vol;
143
#endif
119

  
144 120
    while (samples--) {
145
        out->l = VOL (glue (conv_, ET) (in[0]), vol->l);
121
        out->l = glue (conv_, ET) (in[0]);
146 122
        out->r = out->l;
147 123
        out += 1;
148 124
        in += 1;
......
174 150

  
175 151
#undef ET
176 152
#undef HALF
177
#undef VOL

Also available in: Unified diff