xref: /qemu/audio/mixeng.h (revision 1ea879e5)
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  */
2485571bc7Sbellard #ifndef QEMU_MIXENG_H
2585571bc7Sbellard #define QEMU_MIXENG_H
2685571bc7Sbellard 
271d14ffa9Sbellard #ifdef FLOAT_MIXENG
28*1ea879e5Smalc typedef float mixeng_real;
29*1ea879e5Smalc struct mixeng_volume { int mute; mixeng_real r; mixeng_real l; };
30*1ea879e5Smalc struct mixeng_sample { mixeng_real l; mixeng_real r; };
311d14ffa9Sbellard #else
32*1ea879e5Smalc struct mixeng_volume { int mute; int64_t r; int64_t l; };
33*1ea879e5Smalc struct st_sample { int64_t l; int64_t r; };
341d14ffa9Sbellard #endif
3585571bc7Sbellard 
36*1ea879e5Smalc typedef void (t_sample) (struct st_sample *dst, const void *src,
37*1ea879e5Smalc                          int samples, struct mixeng_volume *vol);
38*1ea879e5Smalc 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);
44*1ea879e5Smalc void st_rate_flow (void *opaque, struct st_sample *ibuf, struct st_sample *obuf,
4585571bc7Sbellard                    int *isamp, int *osamp);
46*1ea879e5Smalc 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);
49*1ea879e5Smalc void mixeng_clear (struct st_sample *buf, int len);
5085571bc7Sbellard 
5185571bc7Sbellard #endif  /* mixeng.h */
52