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 */ 24175de524SMarkus 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 367520462bSKővágó, Zoltán typedef struct st_sample st_sample; 3785571bc7Sbellard 3800e07679SMichael Walle typedef void (t_sample) (struct st_sample *dst, const void *src, int samples); 391ea879e5Smalc typedef void (f_sample) (void *dst, const struct st_sample *src, int samples); 401d14ffa9Sbellard 41*528ea579SMichael Tokarev /* indices: [stereo][signed][swap endianness][8, 16 or 32-bits] */ 42f941aa25Sths extern t_sample *mixeng_conv[2][2][2][3]; 43f941aa25Sths extern f_sample *mixeng_clip[2][2][2][3]; 4485571bc7Sbellard 45ed2a4a79SKővágó, Zoltán /* indices: [stereo] */ 46ed2a4a79SKővágó, Zoltán extern t_sample *mixeng_conv_float[2]; 47ed2a4a79SKővágó, Zoltán extern f_sample *mixeng_clip_float[2]; 48180b044fSVolker Rümelin 4985571bc7Sbellard void *st_rate_start (int inrate, int outrate); 507520462bSKővágó, Zoltán void st_rate_flow(void *opaque, st_sample *ibuf, st_sample *obuf, 517520462bSKővágó, Zoltán size_t *isamp, size_t *osamp); 527520462bSKővágó, Zoltán void st_rate_flow_mix(void *opaque, st_sample *ibuf, st_sample *obuf, 537520462bSKővágó, Zoltán size_t *isamp, size_t *osamp); 5485571bc7Sbellard void st_rate_stop (void *opaque); 55a9ea5678SVolker Rümelin uint32_t st_rate_frames_out(void *opaque, uint32_t frames_in); 561a01df3dSVolker Rümelin uint32_t st_rate_frames_in(void *opaque, uint32_t frames_out); 571ea879e5Smalc void mixeng_clear (struct st_sample *buf, int len); 5800e07679SMichael Walle void mixeng_volume (struct st_sample *buf, int len, struct mixeng_volume *vol); 5985571bc7Sbellard 60175de524SMarkus Armbruster #endif /* QEMU_MIXENG_H */ 61