1<HTML 2><HEAD 3><TITLE 4>SDL_MixAudio</TITLE 5><META 6NAME="GENERATOR" 7CONTENT="Modular DocBook HTML Stylesheet Version 1.76b+ 8"><LINK 9REL="HOME" 10TITLE="SDL Library Documentation" 11HREF="index.html"><LINK 12REL="UP" 13TITLE="Audio" 14HREF="audio.html"><LINK 15REL="PREVIOUS" 16TITLE="SDL_ConvertAudio" 17HREF="sdlconvertaudio.html"><LINK 18REL="NEXT" 19TITLE="SDL_LockAudio" 20HREF="sdllockaudio.html"></HEAD 21><BODY 22CLASS="REFENTRY" 23BGCOLOR="#FFF8DC" 24TEXT="#000000" 25LINK="#0000ee" 26VLINK="#551a8b" 27ALINK="#ff0000" 28><DIV 29CLASS="NAVHEADER" 30><TABLE 31SUMMARY="Header navigation table" 32WIDTH="100%" 33BORDER="0" 34CELLPADDING="0" 35CELLSPACING="0" 36><TR 37><TH 38COLSPAN="3" 39ALIGN="center" 40>SDL Library Documentation</TH 41></TR 42><TR 43><TD 44WIDTH="10%" 45ALIGN="left" 46VALIGN="bottom" 47><A 48HREF="sdlconvertaudio.html" 49ACCESSKEY="P" 50>Prev</A 51></TD 52><TD 53WIDTH="80%" 54ALIGN="center" 55VALIGN="bottom" 56></TD 57><TD 58WIDTH="10%" 59ALIGN="right" 60VALIGN="bottom" 61><A 62HREF="sdllockaudio.html" 63ACCESSKEY="N" 64>Next</A 65></TD 66></TR 67></TABLE 68><HR 69ALIGN="LEFT" 70WIDTH="100%"></DIV 71><H1 72><A 73NAME="SDLMIXAUDIO" 74></A 75>SDL_MixAudio</H1 76><DIV 77CLASS="REFNAMEDIV" 78><A 79NAME="AEN7107" 80></A 81><H2 82>Name</H2 83>SDL_MixAudio -- Mix audio data</DIV 84><DIV 85CLASS="REFSYNOPSISDIV" 86><A 87NAME="AEN7110" 88></A 89><H2 90>Synopsis</H2 91><DIV 92CLASS="FUNCSYNOPSIS" 93><A 94NAME="AEN7111" 95></A 96><P 97></P 98><PRE 99CLASS="FUNCSYNOPSISINFO" 100>#include "SDL.h"</PRE 101><P 102><CODE 103><CODE 104CLASS="FUNCDEF" 105>void <B 106CLASS="FSFUNC" 107>SDL_MixAudio</B 108></CODE 109>(Uint8 *dst, Uint8 *src, Uint32 len, int volume);</CODE 110></P 111><P 112></P 113></DIV 114></DIV 115><DIV 116CLASS="REFSECT1" 117><A 118NAME="AEN7117" 119></A 120><H2 121>Description</H2 122><P 123>This function takes two audio buffers of <TT 124CLASS="PARAMETER" 125><I 126>len</I 127></TT 128> bytes each 129of the playing audio format and mixes them, performing addition, volume 130adjustment, and overflow clipping. The <TT 131CLASS="PARAMETER" 132><I 133>volume</I 134></TT 135> ranges 136from 0 to <TT 137CLASS="LITERAL" 138>SDL_MIX_MAXVOLUME</TT 139> and should be set to the maximum 140value for full audio volume. Note this does not change hardware volume. This is 141provided for convenience -- you can mix your own audio data.</P 142><DIV 143CLASS="NOTE" 144><BLOCKQUOTE 145CLASS="NOTE" 146><P 147><B 148>Note: </B 149>Do not use this function for mixing together more than two streams of sample 150data. The output from repeated application of this function may be distorted 151by clipping, because there is no accumulator with greater range than the 152input (not to mention this being an inefficient way of doing it). 153Use mixing functions from SDL_mixer, OpenAL, or write your own mixer instead.</P 154></BLOCKQUOTE 155></DIV 156></DIV 157><DIV 158CLASS="REFSECT1" 159><A 160NAME="AEN7125" 161></A 162><H2 163>See Also</H2 164><P 165><A 166HREF="sdlopenaudio.html" 167><TT 168CLASS="FUNCTION" 169>SDL_OpenAudio</TT 170></A 171></P 172></DIV 173><DIV 174CLASS="NAVFOOTER" 175><HR 176ALIGN="LEFT" 177WIDTH="100%"><TABLE 178SUMMARY="Footer navigation table" 179WIDTH="100%" 180BORDER="0" 181CELLPADDING="0" 182CELLSPACING="0" 183><TR 184><TD 185WIDTH="33%" 186ALIGN="left" 187VALIGN="top" 188><A 189HREF="sdlconvertaudio.html" 190ACCESSKEY="P" 191>Prev</A 192></TD 193><TD 194WIDTH="34%" 195ALIGN="center" 196VALIGN="top" 197><A 198HREF="index.html" 199ACCESSKEY="H" 200>Home</A 201></TD 202><TD 203WIDTH="33%" 204ALIGN="right" 205VALIGN="top" 206><A 207HREF="sdllockaudio.html" 208ACCESSKEY="N" 209>Next</A 210></TD 211></TR 212><TR 213><TD 214WIDTH="33%" 215ALIGN="left" 216VALIGN="top" 217>SDL_ConvertAudio</TD 218><TD 219WIDTH="34%" 220ALIGN="center" 221VALIGN="top" 222><A 223HREF="audio.html" 224ACCESSKEY="U" 225>Up</A 226></TD 227><TD 228WIDTH="33%" 229ALIGN="right" 230VALIGN="top" 231>SDL_LockAudio</TD 232></TR 233></TABLE 234></DIV 235></BODY 236></HTML 237>