xref: /qemu/audio/mixeng.h (revision 1d14ffa9)
185571bc7Sbellard /*
285571bc7Sbellard  * QEMU Mixing engine header
385571bc7Sbellard  *
4*1d14ffa9Sbellard  * 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 
27*1d14ffa9Sbellard #ifdef FLOAT_MIXENG
28*1d14ffa9Sbellard typedef float real_t;
29*1d14ffa9Sbellard typedef struct { int mute; real_t r; real_t l; } volume_t;
30*1d14ffa9Sbellard typedef struct { real_t l; real_t r; } st_sample_t;
31*1d14ffa9Sbellard #else
32*1d14ffa9Sbellard typedef struct { int mute; int64_t r; int64_t l; } volume_t;
3385571bc7Sbellard typedef struct { int64_t l; int64_t r; } st_sample_t;
34*1d14ffa9Sbellard #endif
3585571bc7Sbellard 
36*1d14ffa9Sbellard typedef void (t_sample) (st_sample_t *dst, const void *src,
37*1d14ffa9Sbellard                          int samples, volume_t *vol);
38*1d14ffa9Sbellard typedef void (f_sample) (void *dst, const st_sample_t *src, int samples);
39*1d14ffa9Sbellard 
40*1d14ffa9Sbellard extern t_sample *mixeng_conv[2][2][2][2];
41*1d14ffa9Sbellard extern f_sample *mixeng_clip[2][2][2][2];
4285571bc7Sbellard 
4385571bc7Sbellard void *st_rate_start (int inrate, int outrate);
4485571bc7Sbellard void st_rate_flow (void *opaque, st_sample_t *ibuf, st_sample_t *obuf,
4585571bc7Sbellard                    int *isamp, int *osamp);
46*1d14ffa9Sbellard void st_rate_flow_mix (void *opaque, st_sample_t *ibuf, st_sample_t *obuf,
47*1d14ffa9Sbellard                        int *isamp, int *osamp);
4885571bc7Sbellard void st_rate_stop (void *opaque);
49*1d14ffa9Sbellard void mixeng_clear (st_sample_t *buf, int len);
5085571bc7Sbellard 
5185571bc7Sbellard #endif  /* mixeng.h */
52