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