xref: /qemu/audio/mixeng.h (revision 175de524)
185571bc7Sbellard /*
285571bc7Sbellard  * QEMU Mixing engine header
385571bc7Sbellard  *
41d14ffa9Sbellard  * Copyright (c) 2004-2005 Vassili Karpov (malc)
585571bc7Sbellard  *
685571bc7Sbellard  * Permission is hereby granted, free of charge, to any person obtaining a copy
785571bc7Sbellard  * of this software and associated documentation files (the "Software"), to deal
885571bc7Sbellard  * in the Software without restriction, including without limitation the rights
985571bc7Sbellard  * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
1085571bc7Sbellard  * copies of the Software, and to permit persons to whom the Software is
1185571bc7Sbellard  * furnished to do so, subject to the following conditions:
1285571bc7Sbellard  *
1385571bc7Sbellard  * The above copyright notice and this permission notice shall be included in
1485571bc7Sbellard  * all copies or substantial portions of the Software.
1585571bc7Sbellard  *
1685571bc7Sbellard  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
1785571bc7Sbellard  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
1885571bc7Sbellard  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
1985571bc7Sbellard  * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
2085571bc7Sbellard  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
2185571bc7Sbellard  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
2285571bc7Sbellard  * THE SOFTWARE.
2385571bc7Sbellard  */
24*175de524SMarkus Armbruster 
2585571bc7Sbellard #ifndef QEMU_MIXENG_H
2685571bc7Sbellard #define QEMU_MIXENG_H
2785571bc7Sbellard 
281d14ffa9Sbellard #ifdef FLOAT_MIXENG
291ea879e5Smalc typedef float mixeng_real;
301ea879e5Smalc struct mixeng_volume { int mute; mixeng_real r; mixeng_real l; };
3168f6dc7eSmalc struct st_sample { mixeng_real l; mixeng_real r; };
321d14ffa9Sbellard #else
331ea879e5Smalc struct mixeng_volume { int mute; int64_t r; int64_t l; };
341ea879e5Smalc struct st_sample { int64_t l; int64_t r; };
351d14ffa9Sbellard #endif
3685571bc7Sbellard 
3700e07679SMichael Walle typedef void (t_sample) (struct st_sample *dst, const void *src, int samples);
381ea879e5Smalc typedef void (f_sample) (void *dst, const struct st_sample *src, int samples);
391d14ffa9Sbellard 
40f941aa25Sths extern t_sample *mixeng_conv[2][2][2][3];
41f941aa25Sths extern f_sample *mixeng_clip[2][2][2][3];
4285571bc7Sbellard 
4385571bc7Sbellard void *st_rate_start (int inrate, int outrate);
441ea879e5Smalc void st_rate_flow (void *opaque, struct st_sample *ibuf, struct st_sample *obuf,
4585571bc7Sbellard                    int *isamp, int *osamp);
461ea879e5Smalc void st_rate_flow_mix (void *opaque, struct st_sample *ibuf, struct st_sample *obuf,
471d14ffa9Sbellard                        int *isamp, int *osamp);
4885571bc7Sbellard void st_rate_stop (void *opaque);
491ea879e5Smalc void mixeng_clear (struct st_sample *buf, int len);
5000e07679SMichael Walle void mixeng_volume (struct st_sample *buf, int len, struct mixeng_volume *vol);
5185571bc7Sbellard 
52*175de524SMarkus Armbruster #endif /* QEMU_MIXENG_H */
53