audio.html 76 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979
  1. <?xml version="1.0" encoding="utf-8" ?>
  2. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
  3. "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  4. <!-- This file is generated by Nim. -->
  5. <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
  6. <head>
  7. <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  8. <meta name="viewport" content="width=device-width, initial-scale=1.0">
  9. <!-- Favicon -->
  10. <link rel="shortcut icon" href="data:image/x-icon;base64,AAABAAEAEBAAAAEAIABoBAAAFgAAACgAAAAQAAAAIAAAAAEAIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AAAAAAUAAAAF////AP///wD///8A////AP///wD///8A////AP///wD///8A////AAAAAAIAAABbAAAAlQAAAKIAAACbAAAAmwAAAKIAAACVAAAAWwAAAAL///8A////AP///wD///8A////AAAAABQAAADAAAAAYwAAAA3///8A////AP///wD///8AAAAADQAAAGMAAADAAAAAFP///wD///8A////AP///wAAAACdAAAAOv///wD///8A////AP///wD///8A////AP///wD///8AAAAAOgAAAJ3///8A////AP///wAAAAAnAAAAcP///wAAAAAoAAAASv///wD///8A////AP///wAAAABKAAAAKP///wAAAABwAAAAJ////wD///8AAAAAgQAAABwAAACIAAAAkAAAAJMAAACtAAAAFQAAABUAAACtAAAAkwAAAJAAAACIAAAAHAAAAIH///8A////AAAAAKQAAACrAAAAaP///wD///8AAAAARQAAANIAAADSAAAARf///wD///8AAAAAaAAAAKsAAACk////AAAAADMAAACcAAAAnQAAABj///8A////AP///wAAAAAYAAAAGP///wD///8A////AAAAABgAAACdAAAAnAAAADMAAAB1AAAAwwAAAP8AAADpAAAAsQAAAE4AAAAb////AP///wAAAAAbAAAATgAAALEAAADpAAAA/wAAAMMAAAB1AAAAtwAAAOkAAAD/AAAA/wAAAP8AAADvAAAA3gAAAN4AAADeAAAA3gAAAO8AAAD/AAAA/wAAAP8AAADpAAAAtwAAAGUAAAA/AAAA3wAAAP8AAAD/AAAA/wAAAP8AAAD/AAAA/wAAAP8AAAD/AAAA/wAAAP8AAADfAAAAPwAAAGX///8A////AAAAAEgAAADtAAAAvwAAAL0AAADGAAAA7wAAAO8AAADGAAAAvQAAAL8AAADtAAAASP///wD///8A////AP///wD///8AAAAAO////wD///8A////AAAAAIcAAACH////AP///wD///8AAAAAO////wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A//8AAP//AAD4HwAA7/cAAN/7AAD//wAAoYUAAJ55AACf+QAAh+EAAAAAAADAAwAA4AcAAP5/AAD//wAA//8AAA=="/>
  11. <link rel="icon" type="image/png" sizes="32x32" href="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAABmJLR0QA/wD/AP+gvaeTAAAACXBIWXMAAA3XAAAN1wFCKJt4AAAAB3RJTUUH4QQQEwksSS9ZWwAAAk1JREFUWMPtll2ITVEUx39nn/O7Y5qR8f05wtCUUr6ZIS++8pEnkZInPImneaCQ5METNdOkeFBKUhMPRIkHKfEuUZSUlGlKPN2TrgfncpvmnntnmlEyq1Z7t89/rf9a6+y99oZxGZf/XeIq61EdtgKXgdXA0xrYAvBjOIF1AI9zvjcC74BSpndrJPkBWDScTF8Aa4E3wDlgHbASaANmVqlcCnwHvgDvgVfAJ+AikAAvgfVZwLnSVZHZaOuKoQi3ZOMi4NkYkpe1p4J7A8BpYAD49hfIy/oqG0+hLomiKP2L5L+1ubn5115S+3OAn4EnwBlgMzCjyt6ZAnQCJ4A7wOs88iRJHvw50HoujuPBoCKwHWiosy8MdfZnAdcHk8dxXFJ3VQbQlCTJvRBCGdRbD4M6uc5glpY3eAihpN5S5w12diSEcCCEcKUO4ljdr15T76ur1FDDLIQQ3qv71EdDOe3Kxj3leRXyk+pxdWnFWod6Wt2bY3de3aSuUHcPBVimHs7mK9WrmeOF6lR1o9qnzskh2ar2qm1qizpfXaPeVGdlmGN5pb09qMxz1Xb1kLqgzn1RyH7JUXW52lr5e/Kqi9qpto7V1atuUzfnARrV7jEib1T76gG2qxdGmXyiekkt1GswPTtek0aBfJp6YySGBfWg2tPQ0FAYgf1stUfdmdcjarbYJEniKIq6gY/Aw+zWHAC+p2labGpqiorFYgGYCEzN7oQdQClN07O1/EfDyGgC0ALMBdYAi4FyK+4H3gLPsxfR1zRNi+NP7nH5J+QntnXe5B5mpfQAAAAASUVORK5CYII=">
  12. <!-- Google fonts -->
  13. <link href='https://fonts.googleapis.com/css?family=Lato:400,600,900' rel='stylesheet' type='text/css'/>
  14. <link href='https://fonts.googleapis.com/css?family=Source+Code+Pro:400,500,600' rel='stylesheet' type='text/css'/>
  15. <!-- CSS -->
  16. <title>nodesnim/thirdparty/sdl2/audio</title>
  17. <link rel="stylesheet" type="text/css" href="../../../nimdoc.out.css">
  18. <script type="text/javascript" src="dochack.js"></script>
  19. <script type="text/javascript">
  20. function main() {
  21. var pragmaDots = document.getElementsByClassName("pragmadots");
  22. for (var i = 0; i < pragmaDots.length; i++) {
  23. pragmaDots[i].onclick = function(event) {
  24. // Hide tease
  25. event.target.parentNode.style.display = "none";
  26. // Show actual
  27. event.target.parentNode.nextElementSibling.style.display = "inline";
  28. }
  29. }
  30. const toggleSwitch = document.querySelector('.theme-switch input[type="checkbox"]');
  31. function switchTheme(e) {
  32. if (e.target.checked) {
  33. document.documentElement.setAttribute('data-theme', 'dark');
  34. localStorage.setItem('theme', 'dark');
  35. } else {
  36. document.documentElement.setAttribute('data-theme', 'light');
  37. localStorage.setItem('theme', 'light');
  38. }
  39. }
  40. toggleSwitch.addEventListener('change', switchTheme, false);
  41. if (window.matchMedia && window.matchMedia('(prefers-color-scheme: dark)').matches) {
  42. document.documentElement.setAttribute('data-theme', "dark");
  43. toggleSwitch.checked = true;
  44. } else if (window.matchMedia && window.matchMedia('(prefers-color-scheme: light)').matches) {
  45. document.documentElement.setAttribute('data-theme', "light");
  46. toggleSwitch.checked = false;
  47. } else {
  48. const currentTheme = localStorage.getItem('theme') ? localStorage.getItem('theme') : null;
  49. if (currentTheme) {
  50. document.documentElement.setAttribute('data-theme', currentTheme);
  51. if (currentTheme === 'dark') {
  52. toggleSwitch.checked = true;
  53. }
  54. }
  55. }
  56. }
  57. </script>
  58. </head>
  59. <body onload="main()">
  60. <div class="document" id="documentId">
  61. <div class="container">
  62. <h1 class="title">nodesnim/thirdparty/sdl2/audio</h1>
  63. <div class="row">
  64. <div class="three columns">
  65. <div class="theme-switch-wrapper">
  66. <label class="theme-switch" for="checkbox">
  67. <input type="checkbox" id="checkbox" />
  68. <div class="slider round"></div>
  69. </label>
  70. &nbsp;&nbsp;&nbsp; <em>Dark Mode</em>
  71. </div>
  72. <div id="global-links">
  73. <ul class="simple">
  74. </ul>
  75. </div>
  76. <div id="searchInputDiv">
  77. Search: <input type="text" id="searchInput"
  78. onkeyup="search()" />
  79. </div>
  80. <div>
  81. Group by:
  82. <select onchange="groupBy(this.value)">
  83. <option value="section">Section</option>
  84. <option value="type">Type</option>
  85. </select>
  86. </div>
  87. <ul class="simple simple-toc" id="toc-list">
  88. <li>
  89. <a class="reference reference-toplevel" href="#6" id="56">Imports</a>
  90. <ul class="simple simple-toc-section">
  91. </ul>
  92. </li>
  93. <li>
  94. <a class="reference reference-toplevel" href="#7" id="57">Types</a>
  95. <ul class="simple simple-toc-section">
  96. <li><a class="reference" href="#AudioFormat"
  97. title="AudioFormat = uint16"><wbr />Audio<wbr />Format<span class="attachedType"></span></a></li>
  98. <li><a class="reference" href="#AudioCallback"
  99. title="AudioCallback = proc (userdata: pointer; stream: ptr uint8; len: cint) {.cdecl.}"><wbr />Audio<wbr />Callback<span class="attachedType"></span></a></li>
  100. <li><a class="reference" href="#AudioSpec"
  101. title="AudioSpec = object
  102. freq*: cint
  103. format*: AudioFormat
  104. channels*: uint8
  105. silence*: uint8
  106. samples*: uint16
  107. padding*: uint16
  108. size*: uint32
  109. callback*: AudioCallback
  110. userdata*: pointer"><wbr />Audio<wbr />Spec<span class="attachedType"></span></a></li>
  111. <li><a class="reference" href="#AudioCVT"
  112. title="AudioCVT {.packed.} = object
  113. needed*: cint
  114. src_format*: AudioFormat
  115. dst_format*: AudioFormat
  116. rate_incr*: cdouble
  117. buf*: ptr uint8
  118. len*: cint
  119. len_cvt*: cint
  120. len_mult*: cint
  121. len_ratio*: cdouble
  122. filters*: array[10, AudioFilter]
  123. filter_index*: cint"><wbr />Audio<wbr />CVT<span class="attachedType"></span></a></li>
  124. <li><a class="reference" href="#AudioFilter"
  125. title="AudioFilter = proc (cvt: ptr AudioCVT; format: AudioFormat) {.cdecl.}"><wbr />Audio<wbr />Filter<span class="attachedType"></span></a></li>
  126. <li><a class="reference" href="#AudioStreamPtr"
  127. title="AudioStreamPtr = ptr AudioStream"><wbr />Audio<wbr />Stream<wbr />Ptr<span class="attachedType"></span></a></li>
  128. <li><a class="reference" href="#AudioDeviceID"
  129. title="AudioDeviceID = uint32"><wbr />Audio<wbr />Device<wbr />ID<span class="attachedType"></span></a></li>
  130. <li><a class="reference" href="#AudioStatus"
  131. title="AudioStatus {.size: 4.} = enum
  132. SDL_AUDIO_STOPPED = 0, SDL_AUDIO_PLAYING, SDL_AUDIO_PAUSED"><wbr />Audio<wbr />Status<span class="attachedType"></span></a></li>
  133. </ul>
  134. </li>
  135. <li>
  136. <a class="reference reference-toplevel" href="#10" id="60">Consts</a>
  137. <ul class="simple simple-toc-section">
  138. <li><a class="reference" href="#SDL_AUDIO_MASK_BITSIZE"
  139. title="SDL_AUDIO_MASK_BITSIZE = 255&apos;u"><wbr />SDL_<wbr />AUDIO_<wbr />MASK_<wbr />BITSIZE<span class="attachedType"></span></a></li>
  140. <li><a class="reference" href="#SDL_AUDIO_MASK_DATATYPE"
  141. title="SDL_AUDIO_MASK_DATATYPE = 256&apos;u"><wbr />SDL_<wbr />AUDIO_<wbr />MASK_<wbr />DATATYPE<span class="attachedType"></span></a></li>
  142. <li><a class="reference" href="#SDL_AUDIO_MASK_ENDIAN"
  143. title="SDL_AUDIO_MASK_ENDIAN = 4096&apos;u"><wbr />SDL_<wbr />AUDIO_<wbr />MASK_<wbr />ENDIAN<span class="attachedType"></span></a></li>
  144. <li><a class="reference" href="#SDL_AUDIO_MASK_SIGNED"
  145. title="SDL_AUDIO_MASK_SIGNED = 32768&apos;u"><wbr />SDL_<wbr />AUDIO_<wbr />MASK_<wbr />SIGNED<span class="attachedType"></span></a></li>
  146. <li><a class="reference" href="#AUDIO_U8"
  147. title="AUDIO_U8 = 0x00000008"><wbr />AUDIO_<wbr />U8<span class="attachedType"></span></a></li>
  148. <li><a class="reference" href="#AUDIO_S8"
  149. title="AUDIO_S8 = 0x00008008"><wbr />AUDIO_<wbr />S8<span class="attachedType"></span></a></li>
  150. <li><a class="reference" href="#AUDIO_U16LSB"
  151. title="AUDIO_U16LSB = 0x00000010"><wbr />AUDIO_<wbr />U16LSB<span class="attachedType"></span></a></li>
  152. <li><a class="reference" href="#AUDIO_S16LSB"
  153. title="AUDIO_S16LSB = 0x00008010"><wbr />AUDIO_<wbr />S16LSB<span class="attachedType"></span></a></li>
  154. <li><a class="reference" href="#AUDIO_U16MSB"
  155. title="AUDIO_U16MSB = 0x00001010"><wbr />AUDIO_<wbr />U16MSB<span class="attachedType"></span></a></li>
  156. <li><a class="reference" href="#AUDIO_S16MSB"
  157. title="AUDIO_S16MSB = 0x00009010"><wbr />AUDIO_<wbr />S16MSB<span class="attachedType"></span></a></li>
  158. <li><a class="reference" href="#AUDIO_U16"
  159. title="AUDIO_U16 = 0x00000010"><wbr />AUDIO_<wbr />U16<span class="attachedType"></span></a></li>
  160. <li><a class="reference" href="#AUDIO_S16"
  161. title="AUDIO_S16 = 0x00008010"><wbr />AUDIO_<wbr />S16<span class="attachedType"></span></a></li>
  162. <li><a class="reference" href="#AUDIO_S32LSB"
  163. title="AUDIO_S32LSB = 0x00008020"><wbr />AUDIO_<wbr />S32LSB<span class="attachedType"></span></a></li>
  164. <li><a class="reference" href="#AUDIO_S32MSB"
  165. title="AUDIO_S32MSB = 0x00009020"><wbr />AUDIO_<wbr />S32MSB<span class="attachedType"></span></a></li>
  166. <li><a class="reference" href="#AUDIO_S32"
  167. title="AUDIO_S32 = 0x00008020"><wbr />AUDIO_<wbr />S32<span class="attachedType"></span></a></li>
  168. <li><a class="reference" href="#AUDIO_F32LSB"
  169. title="AUDIO_F32LSB = 0x00008120"><wbr />AUDIO_<wbr />F32LSB<span class="attachedType"></span></a></li>
  170. <li><a class="reference" href="#AUDIO_F32MSB"
  171. title="AUDIO_F32MSB = 0x00009120"><wbr />AUDIO_<wbr />F32MSB<span class="attachedType"></span></a></li>
  172. <li><a class="reference" href="#AUDIO_F32"
  173. title="AUDIO_F32 = 0x00008120"><wbr />AUDIO_<wbr />F32<span class="attachedType"></span></a></li>
  174. <li><a class="reference" href="#SDL_AUDIO_ALLOW_FREQUENCY_CHANGE"
  175. title="SDL_AUDIO_ALLOW_FREQUENCY_CHANGE = 0x00000001"><wbr />SDL_<wbr />AUDIO_<wbr />ALLOW_<wbr />FREQUENCY_<wbr />CHANGE<span class="attachedType"></span></a></li>
  176. <li><a class="reference" href="#SDL_AUDIO_ALLOW_FORMAT_CHANGE"
  177. title="SDL_AUDIO_ALLOW_FORMAT_CHANGE = 0x00000002"><wbr />SDL_<wbr />AUDIO_<wbr />ALLOW_<wbr />FORMAT_<wbr />CHANGE<span class="attachedType"></span></a></li>
  178. <li><a class="reference" href="#SDL_AUDIO_ALLOW_CHANNELS_CHANGE"
  179. title="SDL_AUDIO_ALLOW_CHANNELS_CHANGE = 0x00000004"><wbr />SDL_<wbr />AUDIO_<wbr />ALLOW_<wbr />CHANNELS_<wbr />CHANGE<span class="attachedType"></span></a></li>
  180. <li><a class="reference" href="#SDL_AUDIO_ALLOW_ANY_CHANGE"
  181. title="SDL_AUDIO_ALLOW_ANY_CHANGE = 7"><wbr />SDL_<wbr />AUDIO_<wbr />ALLOW_<wbr />ANY_<wbr />CHANGE<span class="attachedType"></span></a></li>
  182. <li><a class="reference" href="#SDL_MIX_MAXVOLUME"
  183. title="SDL_MIX_MAXVOLUME = 128"><wbr />SDL_<wbr />MIX_<wbr />MAXVOLUME<span class="attachedType"></span></a></li>
  184. </ul>
  185. </li>
  186. <li>
  187. <a class="reference reference-toplevel" href="#12" id="62">Procs</a>
  188. <ul class="simple simple-toc-section">
  189. <li><a class="reference" href="#getNumAudioDrivers"
  190. title="getNumAudioDrivers(): cint"><wbr />get<wbr />Num<wbr />Audio<wbr />Drivers<span class="attachedType"></span></a></li>
  191. <li><a class="reference" href="#getAudioDriver%2Ccint"
  192. title="getAudioDriver(index: cint): cstring"><wbr />get<wbr />Audio<wbr />Driver<span class="attachedType"></span></a></li>
  193. <li><a class="reference" href="#audioInit%2Ccstring"
  194. title="audioInit(driver_name: cstring): cint"><wbr />audio<wbr />Init<span class="attachedType"></span></a></li>
  195. <li><a class="reference" href="#audioQuit"
  196. title="audioQuit()"><wbr />audio<wbr />Quit<span class="attachedType"></span></a></li>
  197. <li><a class="reference" href="#getCurrentAudioDriver"
  198. title="getCurrentAudioDriver(): cstring"><wbr />get<wbr />Current<wbr />Audio<wbr />Driver<span class="attachedType"></span></a></li>
  199. <li><a class="reference" href="#openAudio%2Cptr.AudioSpec%2Cptr.AudioSpec"
  200. title="openAudio(desired: ptr AudioSpec; obtained: ptr AudioSpec): cint"><wbr />open<wbr />Audio<span class="attachedType">AudioSpec</span></a></li>
  201. <li><a class="reference" href="#getNumAudioDevices%2Ccint"
  202. title="getNumAudioDevices(iscapture: cint): cint"><wbr />get<wbr />Num<wbr />Audio<wbr />Devices<span class="attachedType"></span></a></li>
  203. <li><a class="reference" href="#getAudioDeviceName%2Ccint%2Ccint"
  204. title="getAudioDeviceName(index: cint; iscapture: cint): cstring"><wbr />get<wbr />Audio<wbr />Device<wbr />Name<span class="attachedType"></span></a></li>
  205. <li><a class="reference" href="#openAudioDevice%2Ccstring%2Ccint%2Cptr.AudioSpec%2Cptr.AudioSpec%2Ccint"
  206. title="openAudioDevice(device: cstring; iscapture: cint; desired: ptr AudioSpec;
  207. obtained: ptr AudioSpec; allowed_changes: cint): AudioDeviceID"><wbr />open<wbr />Audio<wbr />Device<span class="attachedType">AudioDeviceID</span></a></li>
  208. <li><a class="reference" href="#getAudioStatus"
  209. title="getAudioStatus(): AudioStatus"><wbr />get<wbr />Audio<wbr />Status<span class="attachedType"></span></a></li>
  210. <li><a class="reference" href="#getAudioDeviceStatus%2CAudioDeviceID"
  211. title="getAudioDeviceStatus(dev: AudioDeviceID): AudioStatus"><wbr />get<wbr />Audio<wbr />Device<wbr />Status<span class="attachedType">AudioDeviceID</span></a></li>
  212. <li><a class="reference" href="#getQueuedAudioSize%2CAudioDeviceID"
  213. title="getQueuedAudioSize(dev: AudioDeviceID): uint32"><wbr />get<wbr />Queued<wbr />Audio<wbr />Size<span class="attachedType">AudioDeviceID</span></a></li>
  214. <li><a class="reference" href="#queueAudio%2CAudioDeviceID%2Cpointer%2Cuint32"
  215. title="queueAudio(dev: AudioDeviceID; data: pointer; len: uint32): cint"><wbr />queue<wbr />Audio<span class="attachedType">AudioDeviceID</span></a></li>
  216. <li><a class="reference" href="#pauseAudio%2Ccint"
  217. title="pauseAudio(pause_on: cint)"><wbr />pause<wbr />Audio<span class="attachedType"></span></a></li>
  218. <li><a class="reference" href="#pauseAudioDevice%2CAudioDeviceID%2Ccint"
  219. title="pauseAudioDevice(dev: AudioDeviceID; pause_on: cint)"><wbr />pause<wbr />Audio<wbr />Device<span class="attachedType">AudioDeviceID</span></a></li>
  220. <li><a class="reference" href="#loadWAV_RW%2Cptr.RWops%2Ccint%2Cptr.AudioSpec%2Cptr.ptr.uint8%2Cptr.uint32"
  221. title="loadWAV_RW(src: ptr RWops; freesrc: cint; spec: ptr AudioSpec; audio_buf: ptr ptr uint8;
  222. audio_len: ptr uint32): ptr AudioSpec"><wbr />load<wbr />WAV_<wbr />RW<span class="attachedType">AudioSpec</span></a></li>
  223. <li><a class="reference" href="#freeWAV%2Cptr.uint8"
  224. title="freeWAV(audio_buf: ptr uint8)"><wbr />free<wbr />WAV<span class="attachedType"></span></a></li>
  225. <li><a class="reference" href="#buildAudioCVT%2Cptr.AudioCVT%2CAudioFormat%2Cuint8%2Ccint%2CAudioFormat%2Cuint8%2Ccint"
  226. title="buildAudioCVT(cvt: ptr AudioCVT; src_format: AudioFormat; src_channels: uint8;
  227. src_rate: cint; dst_format: AudioFormat; dst_channels: uint8;
  228. dst_rate: cint): cint"><wbr />build<wbr />Audio<wbr />CVT<span class="attachedType">AudioFormat</span></a></li>
  229. <li><a class="reference" href="#convertAudio%2Cptr.AudioCVT"
  230. title="convertAudio(cvt: ptr AudioCVT): cint"><wbr />convert<wbr />Audio<span class="attachedType"></span></a></li>
  231. <li><a class="reference" href="#mixAudio%2Cptr.uint8%2Cptr.uint8%2Cuint32%2Ccint"
  232. title="mixAudio(dst: ptr uint8; src: ptr uint8; len: uint32; volume: cint)"><wbr />mix<wbr />Audio<span class="attachedType"></span></a></li>
  233. <li><a class="reference" href="#mixAudioFormat%2Cptr.uint8%2Cptr.uint8%2CAudioFormat%2Cuint32%2Ccint"
  234. title="mixAudioFormat(dst: ptr uint8; src: ptr uint8; format: AudioFormat; len: uint32;
  235. volume: cint)"><wbr />mix<wbr />Audio<wbr />Format<span class="attachedType">AudioFormat</span></a></li>
  236. <li><a class="reference" href="#lockAudio"
  237. title="lockAudio()"><wbr />lock<wbr />Audio<span class="attachedType"></span></a></li>
  238. <li><a class="reference" href="#lockAudioDevice%2CAudioDeviceID"
  239. title="lockAudioDevice(dev: AudioDeviceID)"><wbr />lock<wbr />Audio<wbr />Device<span class="attachedType">AudioDeviceID</span></a></li>
  240. <li><a class="reference" href="#unlockAudio"
  241. title="unlockAudio()"><wbr />unlock<wbr />Audio<span class="attachedType"></span></a></li>
  242. <li><a class="reference" href="#unlockAudioDevice%2CAudioDeviceID"
  243. title="unlockAudioDevice(dev: AudioDeviceID)"><wbr />unlock<wbr />Audio<wbr />Device<span class="attachedType">AudioDeviceID</span></a></li>
  244. <li><a class="reference" href="#closeAudio"
  245. title="closeAudio()"><wbr />close<wbr />Audio<span class="attachedType"></span></a></li>
  246. <li><a class="reference" href="#closeAudioDevice%2CAudioDeviceID"
  247. title="closeAudioDevice(dev: AudioDeviceID)"><wbr />close<wbr />Audio<wbr />Device<span class="attachedType">AudioDeviceID</span></a></li>
  248. <li><a class="reference" href="#newAudioStream%2CAudioFormat%2Cuint8%2Ccint%2CAudioFormat%2Cuint8%2Ccint"
  249. title="newAudioStream(src_format: AudioFormat; src_channels: uint8; src_rate: cint;
  250. dst_format: AudioFormat; dst_channels: uint8; dst_rate: cint): AudioStreamPtr"><wbr />new<wbr />Audio<wbr />Stream<span class="attachedType">AudioFormat</span></a></li>
  251. <li><a class="reference" href="#newAudioStream%2CAudioSpec%2CAudioSpec"
  252. title="newAudioStream(srcSpec, destSpec: AudioSpec): AudioStreamPtr"><wbr />new<wbr />Audio<wbr />Stream<span class="attachedType">AudioSpec</span></a></li>
  253. <li><a class="reference" href="#put%2CAudioStreamPtr%2Cpointer%2Ccint"
  254. title="put(stream: AudioStreamPtr; buf: pointer; len: cint): cint"><wbr />put<span class="attachedType">AudioStreamPtr</span></a></li>
  255. <li><a class="reference" href="#get%2CAudioStreamPtr%2Cpointer%2Ccint"
  256. title="get(stream: AudioStreamPtr; buf: pointer; len: cint): cint"><wbr />get<span class="attachedType">AudioStreamPtr</span></a></li>
  257. <li><a class="reference" href="#available%2CAudioStreamPtr"
  258. title="available(stream: AudioStreamPtr): cint"><wbr />available<span class="attachedType">AudioStreamPtr</span></a></li>
  259. <li><a class="reference" href="#flush%2CAudioStreamPtr"
  260. title="flush(stream: AudioStreamPtr): cint"><wbr />flush<span class="attachedType">AudioStreamPtr</span></a></li>
  261. <li><a class="reference" href="#clear%2CAudioStreamPtr"
  262. title="clear(stream: AudioStreamPtr)"><wbr />clear<span class="attachedType">AudioStreamPtr</span></a></li>
  263. <li><a class="reference" href="#destroy%2CAudioStreamPtr"
  264. title="destroy(stream: AudioStreamPtr)"><wbr />destroy<span class="attachedType">AudioStreamPtr</span></a></li>
  265. </ul>
  266. </li>
  267. <li>
  268. <a class="reference reference-toplevel" href="#18" id="68">Templates</a>
  269. <ul class="simple simple-toc-section">
  270. <li><a class="reference" href="#SDL_AUDIO_BITSIZE.t%2Cuint32"
  271. title="SDL_AUDIO_BITSIZE(x: uint32): uint32"><wbr />SDL_<wbr />AUDIO_<wbr />BITSIZE<span class="attachedType"></span></a></li>
  272. <li><a class="reference" href="#SDL_AUDIO_ISFLOAT.t%2Cuint32"
  273. title="SDL_AUDIO_ISFLOAT(x: uint32): bool"><wbr />SDL_<wbr />AUDIO_<wbr />ISFLOAT<span class="attachedType"></span></a></li>
  274. <li><a class="reference" href="#SDL_AUDIO_ISBIGENDIAN.t%2Cuint32"
  275. title="SDL_AUDIO_ISBIGENDIAN(x: uint32): bool"><wbr />SDL_<wbr />AUDIO_<wbr />ISBIGENDIAN<span class="attachedType"></span></a></li>
  276. <li><a class="reference" href="#SDL_AUDIO_ISSIGNED.t%2Cuint32"
  277. title="SDL_AUDIO_ISSIGNED(x: uint32): bool"><wbr />SDL_<wbr />AUDIO_<wbr />ISSIGNED<span class="attachedType"></span></a></li>
  278. <li><a class="reference" href="#SDL_AUDIO_ISINT.t%2Cuint32"
  279. title="SDL_AUDIO_ISINT(x: uint32): bool"><wbr />SDL_<wbr />AUDIO_<wbr />ISINT<span class="attachedType"></span></a></li>
  280. <li><a class="reference" href="#SDL_AUDIO_ISLITTLEENDIAN.t%2Cuint32"
  281. title="SDL_AUDIO_ISLITTLEENDIAN(x: uint32): bool"><wbr />SDL_<wbr />AUDIO_<wbr />ISLITTLEENDIAN<span class="attachedType"></span></a></li>
  282. <li><a class="reference" href="#SDL_AUDIO_ISUNSIGNED.t%2Cuint32"
  283. title="SDL_AUDIO_ISUNSIGNED(x: uint32): bool"><wbr />SDL_<wbr />AUDIO_<wbr />ISUNSIGNED<span class="attachedType"></span></a></li>
  284. <li><a class="reference" href="#loadWAV.t%2Cstring%2Cptr.AudioSpec%2Cptr.ptr.uint8%2Cptr.uint32"
  285. title="loadWAV(file: string; spec: ptr AudioSpec; audio_buf: ptr ptr uint8;
  286. audio_len: ptr uint32): ptr AudioSpec"><wbr />load<wbr />WAV<span class="attachedType">AudioSpec</span></a></li>
  287. </ul>
  288. </li>
  289. </ul>
  290. </div>
  291. <div class="nine columns" id="content">
  292. <div id="tocRoot"></div>
  293. <p class="module-desc"></p>
  294. <div class="section" id="6">
  295. <h1><a class="toc-backref" href="#6">Imports</a></h1>
  296. <dl class="item">
  297. <a class="reference external" href="../sdl2.html">../sdl2</a>
  298. </dl></div>
  299. <div class="section" id="7">
  300. <h1><a class="toc-backref" href="#7">Types</a></h1>
  301. <dl class="item">
  302. <a id="AudioFormat"></a>
  303. <dt><pre><a href="audio.html#AudioFormat"><span class="Identifier">AudioFormat</span></a> <span class="Other">=</span> <span class="Identifier">uint16</span></pre></dt>
  304. <dd>
  305. </dd>
  306. <a id="AudioCallback"></a>
  307. <dt><pre><a href="audio.html#AudioCallback"><span class="Identifier">AudioCallback</span></a> <span class="Other">=</span> <span class="Keyword">proc</span> <span class="Other">(</span><span class="Identifier">userdata</span><span class="Other">:</span> <span class="Identifier">pointer</span><span class="Other">;</span> <span class="Identifier">stream</span><span class="Other">:</span> <span class="Keyword">ptr</span> <span class="Identifier">uint8</span><span class="Other">;</span> <span class="Identifier">len</span><span class="Other">:</span> <span class="Identifier">cint</span><span class="Other">)</span> <span><span class="Other">{</span><span class="Other pragmadots">...</span><span class="Other">}</span></span><span class="pragmawrap"><span class="Other">{.</span><span class="pragma"><span class="Identifier">cdecl</span></span><span class="Other">.}</span></span></pre></dt>
  308. <dd>
  309. </dd>
  310. <a id="AudioSpec"></a>
  311. <dt><pre><a href="audio.html#AudioSpec"><span class="Identifier">AudioSpec</span></a> <span class="Other">=</span> <span class="Keyword">object</span>
  312. <span class="Identifier">freq</span><span class="Operator">*</span><span class="Other">:</span> <span class="Identifier">cint</span>
  313. <span class="Identifier">format</span><span class="Operator">*</span><span class="Other">:</span> <a href="audio.html#AudioFormat"><span class="Identifier">AudioFormat</span></a>
  314. <span class="Identifier">channels</span><span class="Operator">*</span><span class="Other">:</span> <span class="Identifier">uint8</span>
  315. <span class="Identifier">silence</span><span class="Operator">*</span><span class="Other">:</span> <span class="Identifier">uint8</span>
  316. <span class="Identifier">samples</span><span class="Operator">*</span><span class="Other">:</span> <span class="Identifier">uint16</span>
  317. <span class="Identifier">padding</span><span class="Operator">*</span><span class="Other">:</span> <span class="Identifier">uint16</span>
  318. <span class="Identifier">size</span><span class="Operator">*</span><span class="Other">:</span> <span class="Identifier">uint32</span>
  319. <span class="Identifier">callback</span><span class="Operator">*</span><span class="Other">:</span> <a href="audio.html#AudioCallback"><span class="Identifier">AudioCallback</span></a>
  320. <span class="Identifier">userdata</span><span class="Operator">*</span><span class="Other">:</span> <span class="Identifier">pointer</span>
  321. </pre></dt>
  322. <dd>
  323. </dd>
  324. <a id="AudioCVT"></a>
  325. <dt><pre><a href="audio.html#AudioCVT"><span class="Identifier">AudioCVT</span></a> <span><span class="Other">{</span><span class="Other pragmadots">...</span><span class="Other">}</span></span><span class="pragmawrap"><span class="Other">{.</span><span class="pragma"><span class="Identifier">packed</span></span><span class="Other">.}</span></span> <span class="Other">=</span> <span class="Keyword">object</span>
  326. <span class="Identifier">needed</span><span class="Operator">*</span><span class="Other">:</span> <span class="Identifier">cint</span>
  327. <span class="Identifier">src_format</span><span class="Operator">*</span><span class="Other">:</span> <a href="audio.html#AudioFormat"><span class="Identifier">AudioFormat</span></a>
  328. <span class="Identifier">dst_format</span><span class="Operator">*</span><span class="Other">:</span> <a href="audio.html#AudioFormat"><span class="Identifier">AudioFormat</span></a>
  329. <span class="Identifier">rate_incr</span><span class="Operator">*</span><span class="Other">:</span> <span class="Identifier">cdouble</span>
  330. <span class="Identifier">buf</span><span class="Operator">*</span><span class="Other">:</span> <span class="Keyword">ptr</span> <span class="Identifier">uint8</span>
  331. <span class="Identifier">len</span><span class="Operator">*</span><span class="Other">:</span> <span class="Identifier">cint</span>
  332. <span class="Identifier">len_cvt</span><span class="Operator">*</span><span class="Other">:</span> <span class="Identifier">cint</span>
  333. <span class="Identifier">len_mult</span><span class="Operator">*</span><span class="Other">:</span> <span class="Identifier">cint</span>
  334. <span class="Identifier">len_ratio</span><span class="Operator">*</span><span class="Other">:</span> <span class="Identifier">cdouble</span>
  335. <span class="Identifier">filters</span><span class="Operator">*</span><span class="Other">:</span> <span class="Identifier">array</span><span class="Other">[</span><span class="DecNumber">10</span><span class="Other">,</span> <a href="audio.html#AudioFilter"><span class="Identifier">AudioFilter</span></a><span class="Other">]</span>
  336. <span class="Identifier">filter_index</span><span class="Operator">*</span><span class="Other">:</span> <span class="Identifier">cint</span>
  337. </pre></dt>
  338. <dd>
  339. </dd>
  340. <a id="AudioFilter"></a>
  341. <dt><pre><a href="audio.html#AudioFilter"><span class="Identifier">AudioFilter</span></a> <span class="Other">=</span> <span class="Keyword">proc</span> <span class="Other">(</span><span class="Identifier">cvt</span><span class="Other">:</span> <span class="Keyword">ptr</span> <a href="audio.html#AudioCVT"><span class="Identifier">AudioCVT</span></a><span class="Other">;</span> <span class="Identifier">format</span><span class="Other">:</span> <a href="audio.html#AudioFormat"><span class="Identifier">AudioFormat</span></a><span class="Other">)</span> <span><span class="Other">{</span><span class="Other pragmadots">...</span><span class="Other">}</span></span><span class="pragmawrap"><span class="Other">{.</span><span class="pragma"><span class="Identifier">cdecl</span></span><span class="Other">.}</span></span></pre></dt>
  342. <dd>
  343. </dd>
  344. <a id="AudioStreamPtr"></a>
  345. <dt><pre><a href="audio.html#AudioStreamPtr"><span class="Identifier">AudioStreamPtr</span></a> <span class="Other">=</span> <span class="Keyword">ptr</span> <span class="Identifier">AudioStream</span></pre></dt>
  346. <dd>
  347. <p>(Available since SDL 2.0.7) A pointer to an <a class="reference external" href="https://wiki.libsdl.org/Tutorials/AudioStream">SDL_AudioStream</a>. Audio streams were added to SDL2 in version 2.0.7, to provide an easier-to-use alternative to <a class="reference external" href="https://wiki.libsdl.org/SDL_AudioCVT">SDL_AudioCVT</a>.</p>
  348. <p>See Also:</p>
  349. <ul class="simple"><li><a class="reference external" href="#newAudioStream,AudioFormat,uint8,cint,AudioFormat,uint8,cint">newAudioStream proc</a></li>
  350. <li><a class="reference external" href="#newAudioStream,AudioSpec,AudioSpec">newAudioStream proc</a></li>
  351. <li><a class="reference external" href="#put,AudioStreamPtr,pointer,cint">put proc</a></li>
  352. <li><a class="reference external" href="#get,AudioStreamPtr,pointer,cint">get proc</a></li>
  353. <li><a class="reference external" href="#available,AudioStreamPtr">available proc</a></li>
  354. <li><a class="reference external" href="#flush,AudioStreamPtr">flush proc</a></li>
  355. <li><a class="reference external" href="#clear,AudioStreamPtr">clear proc</a></li>
  356. <li><a class="reference external" href="#destroy,AudioStreamPtr">destroy proc</a></li>
  357. </ul>
  358. </dd>
  359. <a id="AudioDeviceID"></a>
  360. <dt><pre><a href="audio.html#AudioDeviceID"><span class="Identifier">AudioDeviceID</span></a> <span class="Other">=</span> <span class="Identifier">uint32</span></pre></dt>
  361. <dd>
  362. </dd>
  363. <a id="AudioStatus"></a>
  364. <dt><pre><a href="audio.html#AudioStatus"><span class="Identifier">AudioStatus</span></a> <span><span class="Other">{</span><span class="Other pragmadots">...</span><span class="Other">}</span></span><span class="pragmawrap"><span class="Other">{.</span><span class="pragma"><span class="Identifier">size</span><span class="Other">:</span> <span class="DecNumber">4</span></span><span class="Other">.}</span></span> <span class="Other">=</span> <span class="Keyword">enum</span>
  365. <span class="Identifier">SDL_AUDIO_STOPPED</span> <span class="Other">=</span> <span class="DecNumber">0</span><span class="Other">,</span> <span class="Identifier">SDL_AUDIO_PLAYING</span><span class="Other">,</span> <span class="Identifier">SDL_AUDIO_PAUSED</span></pre></dt>
  366. <dd>
  367. </dd>
  368. </dl></div>
  369. <div class="section" id="10">
  370. <h1><a class="toc-backref" href="#10">Consts</a></h1>
  371. <dl class="item">
  372. <a id="SDL_AUDIO_MASK_BITSIZE"></a>
  373. <dt><pre><a href="audio.html#SDL_AUDIO_MASK_BITSIZE"><span class="Identifier">SDL_AUDIO_MASK_BITSIZE</span></a> <span class="Other">=</span> <span class="DecNumber">255'u</span></pre></dt>
  374. <dd>
  375. </dd>
  376. <a id="SDL_AUDIO_MASK_DATATYPE"></a>
  377. <dt><pre><a href="audio.html#SDL_AUDIO_MASK_DATATYPE"><span class="Identifier">SDL_AUDIO_MASK_DATATYPE</span></a> <span class="Other">=</span> <span class="DecNumber">256'u</span></pre></dt>
  378. <dd>
  379. </dd>
  380. <a id="SDL_AUDIO_MASK_ENDIAN"></a>
  381. <dt><pre><a href="audio.html#SDL_AUDIO_MASK_ENDIAN"><span class="Identifier">SDL_AUDIO_MASK_ENDIAN</span></a> <span class="Other">=</span> <span class="DecNumber">4096'u</span></pre></dt>
  382. <dd>
  383. </dd>
  384. <a id="SDL_AUDIO_MASK_SIGNED"></a>
  385. <dt><pre><a href="audio.html#SDL_AUDIO_MASK_SIGNED"><span class="Identifier">SDL_AUDIO_MASK_SIGNED</span></a> <span class="Other">=</span> <span class="DecNumber">32768'u</span></pre></dt>
  386. <dd>
  387. </dd>
  388. <a id="AUDIO_U8"></a>
  389. <dt><pre><a href="audio.html#AUDIO_U8"><span class="Identifier">AUDIO_U8</span></a> <span class="Other">=</span> <span class="DecNumber">0x00000008</span></pre></dt>
  390. <dd>
  391. </dd>
  392. <a id="AUDIO_S8"></a>
  393. <dt><pre><a href="audio.html#AUDIO_S8"><span class="Identifier">AUDIO_S8</span></a> <span class="Other">=</span> <span class="DecNumber">0x00008008</span></pre></dt>
  394. <dd>
  395. </dd>
  396. <a id="AUDIO_U16LSB"></a>
  397. <dt><pre><a href="audio.html#AUDIO_U16LSB"><span class="Identifier">AUDIO_U16LSB</span></a> <span class="Other">=</span> <span class="DecNumber">0x00000010</span></pre></dt>
  398. <dd>
  399. </dd>
  400. <a id="AUDIO_S16LSB"></a>
  401. <dt><pre><a href="audio.html#AUDIO_S16LSB"><span class="Identifier">AUDIO_S16LSB</span></a> <span class="Other">=</span> <span class="DecNumber">0x00008010</span></pre></dt>
  402. <dd>
  403. </dd>
  404. <a id="AUDIO_U16MSB"></a>
  405. <dt><pre><a href="audio.html#AUDIO_U16MSB"><span class="Identifier">AUDIO_U16MSB</span></a> <span class="Other">=</span> <span class="DecNumber">0x00001010</span></pre></dt>
  406. <dd>
  407. </dd>
  408. <a id="AUDIO_S16MSB"></a>
  409. <dt><pre><a href="audio.html#AUDIO_S16MSB"><span class="Identifier">AUDIO_S16MSB</span></a> <span class="Other">=</span> <span class="DecNumber">0x00009010</span></pre></dt>
  410. <dd>
  411. </dd>
  412. <a id="AUDIO_U16"></a>
  413. <dt><pre><a href="audio.html#AUDIO_U16"><span class="Identifier">AUDIO_U16</span></a> <span class="Other">=</span> <span class="DecNumber">0x00000010</span></pre></dt>
  414. <dd>
  415. </dd>
  416. <a id="AUDIO_S16"></a>
  417. <dt><pre><a href="audio.html#AUDIO_S16"><span class="Identifier">AUDIO_S16</span></a> <span class="Other">=</span> <span class="DecNumber">0x00008010</span></pre></dt>
  418. <dd>
  419. </dd>
  420. <a id="AUDIO_S32LSB"></a>
  421. <dt><pre><a href="audio.html#AUDIO_S32LSB"><span class="Identifier">AUDIO_S32LSB</span></a> <span class="Other">=</span> <span class="DecNumber">0x00008020</span></pre></dt>
  422. <dd>
  423. </dd>
  424. <a id="AUDIO_S32MSB"></a>
  425. <dt><pre><a href="audio.html#AUDIO_S32MSB"><span class="Identifier">AUDIO_S32MSB</span></a> <span class="Other">=</span> <span class="DecNumber">0x00009020</span></pre></dt>
  426. <dd>
  427. </dd>
  428. <a id="AUDIO_S32"></a>
  429. <dt><pre><a href="audio.html#AUDIO_S32"><span class="Identifier">AUDIO_S32</span></a> <span class="Other">=</span> <span class="DecNumber">0x00008020</span></pre></dt>
  430. <dd>
  431. </dd>
  432. <a id="AUDIO_F32LSB"></a>
  433. <dt><pre><a href="audio.html#AUDIO_F32LSB"><span class="Identifier">AUDIO_F32LSB</span></a> <span class="Other">=</span> <span class="DecNumber">0x00008120</span></pre></dt>
  434. <dd>
  435. </dd>
  436. <a id="AUDIO_F32MSB"></a>
  437. <dt><pre><a href="audio.html#AUDIO_F32MSB"><span class="Identifier">AUDIO_F32MSB</span></a> <span class="Other">=</span> <span class="DecNumber">0x00009120</span></pre></dt>
  438. <dd>
  439. </dd>
  440. <a id="AUDIO_F32"></a>
  441. <dt><pre><a href="audio.html#AUDIO_F32"><span class="Identifier">AUDIO_F32</span></a> <span class="Other">=</span> <span class="DecNumber">0x00008120</span></pre></dt>
  442. <dd>
  443. </dd>
  444. <a id="SDL_AUDIO_ALLOW_FREQUENCY_CHANGE"></a>
  445. <dt><pre><a href="audio.html#SDL_AUDIO_ALLOW_FREQUENCY_CHANGE"><span class="Identifier">SDL_AUDIO_ALLOW_FREQUENCY_CHANGE</span></a> <span class="Other">=</span> <span class="DecNumber">0x00000001</span></pre></dt>
  446. <dd>
  447. </dd>
  448. <a id="SDL_AUDIO_ALLOW_FORMAT_CHANGE"></a>
  449. <dt><pre><a href="audio.html#SDL_AUDIO_ALLOW_FORMAT_CHANGE"><span class="Identifier">SDL_AUDIO_ALLOW_FORMAT_CHANGE</span></a> <span class="Other">=</span> <span class="DecNumber">0x00000002</span></pre></dt>
  450. <dd>
  451. </dd>
  452. <a id="SDL_AUDIO_ALLOW_CHANNELS_CHANGE"></a>
  453. <dt><pre><a href="audio.html#SDL_AUDIO_ALLOW_CHANNELS_CHANGE"><span class="Identifier">SDL_AUDIO_ALLOW_CHANNELS_CHANGE</span></a> <span class="Other">=</span> <span class="DecNumber">0x00000004</span></pre></dt>
  454. <dd>
  455. </dd>
  456. <a id="SDL_AUDIO_ALLOW_ANY_CHANGE"></a>
  457. <dt><pre><a href="audio.html#SDL_AUDIO_ALLOW_ANY_CHANGE"><span class="Identifier">SDL_AUDIO_ALLOW_ANY_CHANGE</span></a> <span class="Other">=</span> <span class="DecNumber">7</span></pre></dt>
  458. <dd>
  459. </dd>
  460. <a id="SDL_MIX_MAXVOLUME"></a>
  461. <dt><pre><a href="audio.html#SDL_MIX_MAXVOLUME"><span class="Identifier">SDL_MIX_MAXVOLUME</span></a> <span class="Other">=</span> <span class="DecNumber">128</span></pre></dt>
  462. <dd>
  463. </dd>
  464. </dl></div>
  465. <div class="section" id="12">
  466. <h1><a class="toc-backref" href="#12">Procs</a></h1>
  467. <dl class="item">
  468. <a id="getNumAudioDrivers"></a>
  469. <dt><pre><span class="Keyword">proc</span> <a href="#getNumAudioDrivers"><span class="Identifier">getNumAudioDrivers</span></a><span class="Other">(</span><span class="Other">)</span><span class="Other">:</span> <span class="Identifier">cint</span> <span><span class="Other">{</span><span class="Other pragmadots">...</span><span class="Other">}</span></span><span class="pragmawrap"><span class="Other">{.</span><span class="pragma"><span class="Identifier">importc</span><span class="Other">:</span> <span class="StringLit">&quot;SDL_GetNumAudioDrivers&quot;</span></span><span class="Other">.}</span></span></pre></dt>
  470. <dd>
  471. </dd>
  472. <a id="getAudioDriver,cint"></a>
  473. <dt><pre><span class="Keyword">proc</span> <a href="#getAudioDriver%2Ccint"><span class="Identifier">getAudioDriver</span></a><span class="Other">(</span><span class="Identifier">index</span><span class="Other">:</span> <span class="Identifier">cint</span><span class="Other">)</span><span class="Other">:</span> <span class="Identifier">cstring</span> <span><span class="Other">{</span><span class="Other pragmadots">...</span><span class="Other">}</span></span><span class="pragmawrap"><span class="Other">{.</span><span class="pragma"><span class="Identifier">importc</span><span class="Other">:</span> <span class="StringLit">&quot;SDL_GetAudioDriver&quot;</span></span><span class="Other">.}</span></span></pre></dt>
  474. <dd>
  475. </dd>
  476. <a id="audioInit,cstring"></a>
  477. <dt><pre><span class="Keyword">proc</span> <a href="#audioInit%2Ccstring"><span class="Identifier">audioInit</span></a><span class="Other">(</span><span class="Identifier">driver_name</span><span class="Other">:</span> <span class="Identifier">cstring</span><span class="Other">)</span><span class="Other">:</span> <span class="Identifier">cint</span> <span><span class="Other">{</span><span class="Other pragmadots">...</span><span class="Other">}</span></span><span class="pragmawrap"><span class="Other">{.</span><span class="pragma"><span class="Identifier">importc</span><span class="Other">:</span> <span class="StringLit">&quot;SDL_AudioInit&quot;</span></span><span class="Other">.}</span></span></pre></dt>
  478. <dd>
  479. </dd>
  480. <a id="audioQuit"></a>
  481. <dt><pre><span class="Keyword">proc</span> <a href="#audioQuit"><span class="Identifier">audioQuit</span></a><span class="Other">(</span><span class="Other">)</span> <span><span class="Other">{</span><span class="Other pragmadots">...</span><span class="Other">}</span></span><span class="pragmawrap"><span class="Other">{.</span><span class="pragma"><span class="Identifier">importc</span><span class="Other">:</span> <span class="StringLit">&quot;SDL_AudioQuit&quot;</span></span><span class="Other">.}</span></span></pre></dt>
  482. <dd>
  483. </dd>
  484. <a id="getCurrentAudioDriver"></a>
  485. <dt><pre><span class="Keyword">proc</span> <a href="#getCurrentAudioDriver"><span class="Identifier">getCurrentAudioDriver</span></a><span class="Other">(</span><span class="Other">)</span><span class="Other">:</span> <span class="Identifier">cstring</span> <span><span class="Other">{</span><span class="Other pragmadots">...</span><span class="Other">}</span></span><span class="pragmawrap"><span class="Other">{.</span><span class="pragma"><span class="Identifier">importc</span><span class="Other">:</span> <span class="StringLit">&quot;SDL_GetCurrentAudioDriver&quot;</span></span><span class="Other">.}</span></span></pre></dt>
  486. <dd>
  487. </dd>
  488. <a id="openAudio,ptr.AudioSpec,ptr.AudioSpec"></a>
  489. <dt><pre><span class="Keyword">proc</span> <a href="#openAudio%2Cptr.AudioSpec%2Cptr.AudioSpec"><span class="Identifier">openAudio</span></a><span class="Other">(</span><span class="Identifier">desired</span><span class="Other">:</span> <span class="Keyword">ptr</span> <a href="audio.html#AudioSpec"><span class="Identifier">AudioSpec</span></a><span class="Other">;</span> <span class="Identifier">obtained</span><span class="Other">:</span> <span class="Keyword">ptr</span> <a href="audio.html#AudioSpec"><span class="Identifier">AudioSpec</span></a><span class="Other">)</span><span class="Other">:</span> <span class="Identifier">cint</span> <span><span class="Other">{</span><span class="Other pragmadots">...</span><span class="Other">}</span></span><span class="pragmawrap"><span class="Other">{.</span><span class="pragma">
  490. <span class="Identifier">importc</span><span class="Other">:</span> <span class="StringLit">&quot;SDL_OpenAudio&quot;</span></span><span class="Other">.}</span></span></pre></dt>
  491. <dd>
  492. </dd>
  493. <a id="getNumAudioDevices,cint"></a>
  494. <dt><pre><span class="Keyword">proc</span> <a href="#getNumAudioDevices%2Ccint"><span class="Identifier">getNumAudioDevices</span></a><span class="Other">(</span><span class="Identifier">iscapture</span><span class="Other">:</span> <span class="Identifier">cint</span><span class="Other">)</span><span class="Other">:</span> <span class="Identifier">cint</span> <span><span class="Other">{</span><span class="Other pragmadots">...</span><span class="Other">}</span></span><span class="pragmawrap"><span class="Other">{.</span><span class="pragma"><span class="Identifier">importc</span><span class="Other">:</span> <span class="StringLit">&quot;SDL_GetNumAudioDevices&quot;</span></span><span class="Other">.}</span></span></pre></dt>
  495. <dd>
  496. </dd>
  497. <a id="getAudioDeviceName,cint,cint"></a>
  498. <dt><pre><span class="Keyword">proc</span> <a href="#getAudioDeviceName%2Ccint%2Ccint"><span class="Identifier">getAudioDeviceName</span></a><span class="Other">(</span><span class="Identifier">index</span><span class="Other">:</span> <span class="Identifier">cint</span><span class="Other">;</span> <span class="Identifier">iscapture</span><span class="Other">:</span> <span class="Identifier">cint</span><span class="Other">)</span><span class="Other">:</span> <span class="Identifier">cstring</span> <span><span class="Other">{</span><span class="Other pragmadots">...</span><span class="Other">}</span></span><span class="pragmawrap"><span class="Other">{.</span><span class="pragma">
  499. <span class="Identifier">importc</span><span class="Other">:</span> <span class="StringLit">&quot;SDL_GetAudioDeviceName&quot;</span></span><span class="Other">.}</span></span></pre></dt>
  500. <dd>
  501. </dd>
  502. <a id="openAudioDevice,cstring,cint,ptr.AudioSpec,ptr.AudioSpec,cint"></a>
  503. <dt><pre><span class="Keyword">proc</span> <a href="#openAudioDevice%2Ccstring%2Ccint%2Cptr.AudioSpec%2Cptr.AudioSpec%2Ccint"><span class="Identifier">openAudioDevice</span></a><span class="Other">(</span><span class="Identifier">device</span><span class="Other">:</span> <span class="Identifier">cstring</span><span class="Other">;</span> <span class="Identifier">iscapture</span><span class="Other">:</span> <span class="Identifier">cint</span><span class="Other">;</span> <span class="Identifier">desired</span><span class="Other">:</span> <span class="Keyword">ptr</span> <a href="audio.html#AudioSpec"><span class="Identifier">AudioSpec</span></a><span class="Other">;</span>
  504. <span class="Identifier">obtained</span><span class="Other">:</span> <span class="Keyword">ptr</span> <a href="audio.html#AudioSpec"><span class="Identifier">AudioSpec</span></a><span class="Other">;</span> <span class="Identifier">allowed_changes</span><span class="Other">:</span> <span class="Identifier">cint</span><span class="Other">)</span><span class="Other">:</span> <a href="audio.html#AudioDeviceID"><span class="Identifier">AudioDeviceID</span></a> <span><span class="Other">{</span><span class="Other pragmadots">...</span><span class="Other">}</span></span><span class="pragmawrap"><span class="Other">{.</span><span class="pragma">
  505. <span class="Identifier">importc</span><span class="Other">:</span> <span class="StringLit">&quot;SDL_OpenAudioDevice&quot;</span></span><span class="Other">.}</span></span></pre></dt>
  506. <dd>
  507. </dd>
  508. <a id="getAudioStatus"></a>
  509. <dt><pre><span class="Keyword">proc</span> <a href="#getAudioStatus"><span class="Identifier">getAudioStatus</span></a><span class="Other">(</span><span class="Other">)</span><span class="Other">:</span> <a href="audio.html#AudioStatus"><span class="Identifier">AudioStatus</span></a> <span><span class="Other">{</span><span class="Other pragmadots">...</span><span class="Other">}</span></span><span class="pragmawrap"><span class="Other">{.</span><span class="pragma"><span class="Identifier">importc</span><span class="Other">:</span> <span class="StringLit">&quot;SDL_GetAudioStatus&quot;</span></span><span class="Other">.}</span></span></pre></dt>
  510. <dd>
  511. </dd>
  512. <a id="getAudioDeviceStatus,AudioDeviceID"></a>
  513. <dt><pre><span class="Keyword">proc</span> <a href="#getAudioDeviceStatus%2CAudioDeviceID"><span class="Identifier">getAudioDeviceStatus</span></a><span class="Other">(</span><span class="Identifier">dev</span><span class="Other">:</span> <a href="audio.html#AudioDeviceID"><span class="Identifier">AudioDeviceID</span></a><span class="Other">)</span><span class="Other">:</span> <a href="audio.html#AudioStatus"><span class="Identifier">AudioStatus</span></a> <span><span class="Other">{</span><span class="Other pragmadots">...</span><span class="Other">}</span></span><span class="pragmawrap"><span class="Other">{.</span><span class="pragma">
  514. <span class="Identifier">importc</span><span class="Other">:</span> <span class="StringLit">&quot;SDL_GetAudioDeviceStatus&quot;</span></span><span class="Other">.}</span></span></pre></dt>
  515. <dd>
  516. </dd>
  517. <a id="getQueuedAudioSize,AudioDeviceID"></a>
  518. <dt><pre><span class="Keyword">proc</span> <a href="#getQueuedAudioSize%2CAudioDeviceID"><span class="Identifier">getQueuedAudioSize</span></a><span class="Other">(</span><span class="Identifier">dev</span><span class="Other">:</span> <a href="audio.html#AudioDeviceID"><span class="Identifier">AudioDeviceID</span></a><span class="Other">)</span><span class="Other">:</span> <span class="Identifier">uint32</span> <span><span class="Other">{</span><span class="Other pragmadots">...</span><span class="Other">}</span></span><span class="pragmawrap"><span class="Other">{.</span><span class="pragma">
  519. <span class="Identifier">importc</span><span class="Other">:</span> <span class="StringLit">&quot;SDL_GetQueuedAudioSize&quot;</span></span><span class="Other">.}</span></span></pre></dt>
  520. <dd>
  521. </dd>
  522. <a id="queueAudio,AudioDeviceID,pointer,uint32"></a>
  523. <dt><pre><span class="Keyword">proc</span> <a href="#queueAudio%2CAudioDeviceID%2Cpointer%2Cuint32"><span class="Identifier">queueAudio</span></a><span class="Other">(</span><span class="Identifier">dev</span><span class="Other">:</span> <a href="audio.html#AudioDeviceID"><span class="Identifier">AudioDeviceID</span></a><span class="Other">;</span> <span class="Identifier">data</span><span class="Other">:</span> <span class="Identifier">pointer</span><span class="Other">;</span> <span class="Identifier">len</span><span class="Other">:</span> <span class="Identifier">uint32</span><span class="Other">)</span><span class="Other">:</span> <span class="Identifier">cint</span> <span><span class="Other">{</span><span class="Other pragmadots">...</span><span class="Other">}</span></span><span class="pragmawrap"><span class="Other">{.</span><span class="pragma">
  524. <span class="Identifier">importc</span><span class="Other">:</span> <span class="StringLit">&quot;SDL_QueueAudio&quot;</span></span><span class="Other">.}</span></span></pre></dt>
  525. <dd>
  526. </dd>
  527. <a id="pauseAudio,cint"></a>
  528. <dt><pre><span class="Keyword">proc</span> <a href="#pauseAudio%2Ccint"><span class="Identifier">pauseAudio</span></a><span class="Other">(</span><span class="Identifier">pause_on</span><span class="Other">:</span> <span class="Identifier">cint</span><span class="Other">)</span> <span><span class="Other">{</span><span class="Other pragmadots">...</span><span class="Other">}</span></span><span class="pragmawrap"><span class="Other">{.</span><span class="pragma"><span class="Identifier">importc</span><span class="Other">:</span> <span class="StringLit">&quot;SDL_PauseAudio&quot;</span></span><span class="Other">.}</span></span></pre></dt>
  529. <dd>
  530. </dd>
  531. <a id="pauseAudioDevice,AudioDeviceID,cint"></a>
  532. <dt><pre><span class="Keyword">proc</span> <a href="#pauseAudioDevice%2CAudioDeviceID%2Ccint"><span class="Identifier">pauseAudioDevice</span></a><span class="Other">(</span><span class="Identifier">dev</span><span class="Other">:</span> <a href="audio.html#AudioDeviceID"><span class="Identifier">AudioDeviceID</span></a><span class="Other">;</span> <span class="Identifier">pause_on</span><span class="Other">:</span> <span class="Identifier">cint</span><span class="Other">)</span> <span><span class="Other">{</span><span class="Other pragmadots">...</span><span class="Other">}</span></span><span class="pragmawrap"><span class="Other">{.</span><span class="pragma">
  533. <span class="Identifier">importc</span><span class="Other">:</span> <span class="StringLit">&quot;SDL_PauseAudioDevice&quot;</span></span><span class="Other">.}</span></span></pre></dt>
  534. <dd>
  535. </dd>
  536. <a id="loadWAV_RW,ptr.RWops,cint,ptr.AudioSpec,ptr.ptr.uint8,ptr.uint32"></a>
  537. <dt><pre><span class="Keyword">proc</span> <a href="#loadWAV_RW%2Cptr.RWops%2Ccint%2Cptr.AudioSpec%2Cptr.ptr.uint8%2Cptr.uint32"><span class="Identifier">loadWAV_RW</span></a><span class="Other">(</span><span class="Identifier">src</span><span class="Other">:</span> <span class="Keyword">ptr</span> <a href="../sdl2.html#RWops"><span class="Identifier">RWops</span></a><span class="Other">;</span> <span class="Identifier">freesrc</span><span class="Other">:</span> <span class="Identifier">cint</span><span class="Other">;</span> <span class="Identifier">spec</span><span class="Other">:</span> <span class="Keyword">ptr</span> <a href="audio.html#AudioSpec"><span class="Identifier">AudioSpec</span></a><span class="Other">;</span>
  538. <span class="Identifier">audio_buf</span><span class="Other">:</span> <span class="Keyword">ptr</span> <span class="Keyword">ptr</span> <span class="Identifier">uint8</span><span class="Other">;</span> <span class="Identifier">audio_len</span><span class="Other">:</span> <span class="Keyword">ptr</span> <span class="Identifier">uint32</span><span class="Other">)</span><span class="Other">:</span> <span class="Keyword">ptr</span> <a href="audio.html#AudioSpec"><span class="Identifier">AudioSpec</span></a> <span><span class="Other">{</span><span class="Other pragmadots">...</span><span class="Other">}</span></span><span class="pragmawrap"><span class="Other">{.</span><span class="pragma">
  539. <span class="Identifier">importc</span><span class="Other">:</span> <span class="StringLit">&quot;SDL_LoadWAV_RW&quot;</span></span><span class="Other">.}</span></span></pre></dt>
  540. <dd>
  541. </dd>
  542. <a id="freeWAV,ptr.uint8"></a>
  543. <dt><pre><span class="Keyword">proc</span> <a href="#freeWAV%2Cptr.uint8"><span class="Identifier">freeWAV</span></a><span class="Other">(</span><span class="Identifier">audio_buf</span><span class="Other">:</span> <span class="Keyword">ptr</span> <span class="Identifier">uint8</span><span class="Other">)</span> <span><span class="Other">{</span><span class="Other pragmadots">...</span><span class="Other">}</span></span><span class="pragmawrap"><span class="Other">{.</span><span class="pragma"><span class="Identifier">importc</span><span class="Other">:</span> <span class="StringLit">&quot;SDL_FreeWAV&quot;</span></span><span class="Other">.}</span></span></pre></dt>
  544. <dd>
  545. </dd>
  546. <a id="buildAudioCVT,ptr.AudioCVT,AudioFormat,uint8,cint,AudioFormat,uint8,cint"></a>
  547. <dt><pre><span class="Keyword">proc</span> <a href="#buildAudioCVT%2Cptr.AudioCVT%2CAudioFormat%2Cuint8%2Ccint%2CAudioFormat%2Cuint8%2Ccint"><span class="Identifier">buildAudioCVT</span></a><span class="Other">(</span><span class="Identifier">cvt</span><span class="Other">:</span> <span class="Keyword">ptr</span> <a href="audio.html#AudioCVT"><span class="Identifier">AudioCVT</span></a><span class="Other">;</span> <span class="Identifier">src_format</span><span class="Other">:</span> <a href="audio.html#AudioFormat"><span class="Identifier">AudioFormat</span></a><span class="Other">;</span> <span class="Identifier">src_channels</span><span class="Other">:</span> <span class="Identifier">uint8</span><span class="Other">;</span>
  548. <span class="Identifier">src_rate</span><span class="Other">:</span> <span class="Identifier">cint</span><span class="Other">;</span> <span class="Identifier">dst_format</span><span class="Other">:</span> <a href="audio.html#AudioFormat"><span class="Identifier">AudioFormat</span></a><span class="Other">;</span> <span class="Identifier">dst_channels</span><span class="Other">:</span> <span class="Identifier">uint8</span><span class="Other">;</span>
  549. <span class="Identifier">dst_rate</span><span class="Other">:</span> <span class="Identifier">cint</span><span class="Other">)</span><span class="Other">:</span> <span class="Identifier">cint</span> <span><span class="Other">{</span><span class="Other pragmadots">...</span><span class="Other">}</span></span><span class="pragmawrap"><span class="Other">{.</span><span class="pragma"><span class="Identifier">importc</span><span class="Other">:</span> <span class="StringLit">&quot;SDL_BuildAudioCVT&quot;</span></span><span class="Other">.}</span></span></pre></dt>
  550. <dd>
  551. </dd>
  552. <a id="convertAudio,ptr.AudioCVT"></a>
  553. <dt><pre><span class="Keyword">proc</span> <a href="#convertAudio%2Cptr.AudioCVT"><span class="Identifier">convertAudio</span></a><span class="Other">(</span><span class="Identifier">cvt</span><span class="Other">:</span> <span class="Keyword">ptr</span> <a href="audio.html#AudioCVT"><span class="Identifier">AudioCVT</span></a><span class="Other">)</span><span class="Other">:</span> <span class="Identifier">cint</span> <span><span class="Other">{</span><span class="Other pragmadots">...</span><span class="Other">}</span></span><span class="pragmawrap"><span class="Other">{.</span><span class="pragma"><span class="Identifier">importc</span><span class="Other">:</span> <span class="StringLit">&quot;SDL_ConvertAudio&quot;</span></span><span class="Other">.}</span></span></pre></dt>
  554. <dd>
  555. </dd>
  556. <a id="mixAudio,ptr.uint8,ptr.uint8,uint32,cint"></a>
  557. <dt><pre><span class="Keyword">proc</span> <a href="#mixAudio%2Cptr.uint8%2Cptr.uint8%2Cuint32%2Ccint"><span class="Identifier">mixAudio</span></a><span class="Other">(</span><span class="Identifier">dst</span><span class="Other">:</span> <span class="Keyword">ptr</span> <span class="Identifier">uint8</span><span class="Other">;</span> <span class="Identifier">src</span><span class="Other">:</span> <span class="Keyword">ptr</span> <span class="Identifier">uint8</span><span class="Other">;</span> <span class="Identifier">len</span><span class="Other">:</span> <span class="Identifier">uint32</span><span class="Other">;</span> <span class="Identifier">volume</span><span class="Other">:</span> <span class="Identifier">cint</span><span class="Other">)</span> <span><span class="Other">{</span><span class="Other pragmadots">...</span><span class="Other">}</span></span><span class="pragmawrap"><span class="Other">{.</span><span class="pragma">
  558. <span class="Identifier">importc</span><span class="Other">:</span> <span class="StringLit">&quot;SDL_MixAudio&quot;</span></span><span class="Other">.}</span></span></pre></dt>
  559. <dd>
  560. </dd>
  561. <a id="mixAudioFormat,ptr.uint8,ptr.uint8,AudioFormat,uint32,cint"></a>
  562. <dt><pre><span class="Keyword">proc</span> <a href="#mixAudioFormat%2Cptr.uint8%2Cptr.uint8%2CAudioFormat%2Cuint32%2Ccint"><span class="Identifier">mixAudioFormat</span></a><span class="Other">(</span><span class="Identifier">dst</span><span class="Other">:</span> <span class="Keyword">ptr</span> <span class="Identifier">uint8</span><span class="Other">;</span> <span class="Identifier">src</span><span class="Other">:</span> <span class="Keyword">ptr</span> <span class="Identifier">uint8</span><span class="Other">;</span> <span class="Identifier">format</span><span class="Other">:</span> <a href="audio.html#AudioFormat"><span class="Identifier">AudioFormat</span></a><span class="Other">;</span> <span class="Identifier">len</span><span class="Other">:</span> <span class="Identifier">uint32</span><span class="Other">;</span>
  563. <span class="Identifier">volume</span><span class="Other">:</span> <span class="Identifier">cint</span><span class="Other">)</span> <span><span class="Other">{</span><span class="Other pragmadots">...</span><span class="Other">}</span></span><span class="pragmawrap"><span class="Other">{.</span><span class="pragma"><span class="Identifier">importc</span><span class="Other">:</span> <span class="StringLit">&quot;SDL_MixAudioFormat&quot;</span></span><span class="Other">.}</span></span></pre></dt>
  564. <dd>
  565. </dd>
  566. <a id="lockAudio"></a>
  567. <dt><pre><span class="Keyword">proc</span> <a href="#lockAudio"><span class="Identifier">lockAudio</span></a><span class="Other">(</span><span class="Other">)</span> <span><span class="Other">{</span><span class="Other pragmadots">...</span><span class="Other">}</span></span><span class="pragmawrap"><span class="Other">{.</span><span class="pragma"><span class="Identifier">importc</span><span class="Other">:</span> <span class="StringLit">&quot;SDL_LockAudio&quot;</span></span><span class="Other">.}</span></span></pre></dt>
  568. <dd>
  569. </dd>
  570. <a id="lockAudioDevice,AudioDeviceID"></a>
  571. <dt><pre><span class="Keyword">proc</span> <a href="#lockAudioDevice%2CAudioDeviceID"><span class="Identifier">lockAudioDevice</span></a><span class="Other">(</span><span class="Identifier">dev</span><span class="Other">:</span> <a href="audio.html#AudioDeviceID"><span class="Identifier">AudioDeviceID</span></a><span class="Other">)</span> <span><span class="Other">{</span><span class="Other pragmadots">...</span><span class="Other">}</span></span><span class="pragmawrap"><span class="Other">{.</span><span class="pragma"><span class="Identifier">importc</span><span class="Other">:</span> <span class="StringLit">&quot;SDL_LockAudioDevice&quot;</span></span><span class="Other">.}</span></span></pre></dt>
  572. <dd>
  573. </dd>
  574. <a id="unlockAudio"></a>
  575. <dt><pre><span class="Keyword">proc</span> <a href="#unlockAudio"><span class="Identifier">unlockAudio</span></a><span class="Other">(</span><span class="Other">)</span> <span><span class="Other">{</span><span class="Other pragmadots">...</span><span class="Other">}</span></span><span class="pragmawrap"><span class="Other">{.</span><span class="pragma"><span class="Identifier">importc</span><span class="Other">:</span> <span class="StringLit">&quot;SDL_UnlockAudio&quot;</span></span><span class="Other">.}</span></span></pre></dt>
  576. <dd>
  577. </dd>
  578. <a id="unlockAudioDevice,AudioDeviceID"></a>
  579. <dt><pre><span class="Keyword">proc</span> <a href="#unlockAudioDevice%2CAudioDeviceID"><span class="Identifier">unlockAudioDevice</span></a><span class="Other">(</span><span class="Identifier">dev</span><span class="Other">:</span> <a href="audio.html#AudioDeviceID"><span class="Identifier">AudioDeviceID</span></a><span class="Other">)</span> <span><span class="Other">{</span><span class="Other pragmadots">...</span><span class="Other">}</span></span><span class="pragmawrap"><span class="Other">{.</span><span class="pragma"><span class="Identifier">importc</span><span class="Other">:</span> <span class="StringLit">&quot;SDL_UnlockAudioDevice&quot;</span></span><span class="Other">.}</span></span></pre></dt>
  580. <dd>
  581. </dd>
  582. <a id="closeAudio"></a>
  583. <dt><pre><span class="Keyword">proc</span> <a href="#closeAudio"><span class="Identifier">closeAudio</span></a><span class="Other">(</span><span class="Other">)</span> <span><span class="Other">{</span><span class="Other pragmadots">...</span><span class="Other">}</span></span><span class="pragmawrap"><span class="Other">{.</span><span class="pragma"><span class="Identifier">importc</span><span class="Other">:</span> <span class="StringLit">&quot;SDL_CloseAudio&quot;</span></span><span class="Other">.}</span></span></pre></dt>
  584. <dd>
  585. </dd>
  586. <a id="closeAudioDevice,AudioDeviceID"></a>
  587. <dt><pre><span class="Keyword">proc</span> <a href="#closeAudioDevice%2CAudioDeviceID"><span class="Identifier">closeAudioDevice</span></a><span class="Other">(</span><span class="Identifier">dev</span><span class="Other">:</span> <a href="audio.html#AudioDeviceID"><span class="Identifier">AudioDeviceID</span></a><span class="Other">)</span> <span><span class="Other">{</span><span class="Other pragmadots">...</span><span class="Other">}</span></span><span class="pragmawrap"><span class="Other">{.</span><span class="pragma"><span class="Identifier">importc</span><span class="Other">:</span> <span class="StringLit">&quot;SDL_CloseAudioDevice&quot;</span></span><span class="Other">.}</span></span></pre></dt>
  588. <dd>
  589. </dd>
  590. <a id="newAudioStream,AudioFormat,uint8,cint,AudioFormat,uint8,cint"></a>
  591. <dt><pre><span class="Keyword">proc</span> <a href="#newAudioStream%2CAudioFormat%2Cuint8%2Ccint%2CAudioFormat%2Cuint8%2Ccint"><span class="Identifier">newAudioStream</span></a><span class="Other">(</span><span class="Identifier">src_format</span><span class="Other">:</span> <a href="audio.html#AudioFormat"><span class="Identifier">AudioFormat</span></a><span class="Other">;</span> <span class="Identifier">src_channels</span><span class="Other">:</span> <span class="Identifier">uint8</span><span class="Other">;</span> <span class="Identifier">src_rate</span><span class="Other">:</span> <span class="Identifier">cint</span><span class="Other">;</span>
  592. <span class="Identifier">dst_format</span><span class="Other">:</span> <a href="audio.html#AudioFormat"><span class="Identifier">AudioFormat</span></a><span class="Other">;</span> <span class="Identifier">dst_channels</span><span class="Other">:</span> <span class="Identifier">uint8</span><span class="Other">;</span> <span class="Identifier">dst_rate</span><span class="Other">:</span> <span class="Identifier">cint</span><span class="Other">)</span><span class="Other">:</span> <a href="audio.html#AudioStreamPtr"><span class="Identifier">AudioStreamPtr</span></a> <span><span class="Other">{</span><span class="Other pragmadots">...</span><span class="Other">}</span></span><span class="pragmawrap"><span class="Other">{.</span><span class="pragma">
  593. <span class="Identifier">importc</span><span class="Other">:</span> <span class="StringLit">&quot;SDL_NewAudioStream&quot;</span></span><span class="Other">.}</span></span></pre></dt>
  594. <dd>
  595. <p>(Available since SDL 2.0.7) Create a new audio stream. return 0 on success, or -1 on error.</p>
  596. <p>Parameters:</p>
  597. <ul class="simple"><li><tt class="docutils literal"><span class="pre">src_format</span></tt> The format of the source audio</li>
  598. <li><tt class="docutils literal"><span class="pre">src_channels</span></tt> The number of channels of the source audio</li>
  599. <li><tt class="docutils literal"><span class="pre">src_rate</span></tt> The sampling rate of the source audio</li>
  600. <li><tt class="docutils literal"><span class="pre">dst_format</span></tt> The format of the desired audio output</li>
  601. <li><tt class="docutils literal"><span class="pre">dst_channels</span></tt> The number of channels of the desired audio output</li>
  602. <li><tt class="docutils literal"><span class="pre">dst_rate The</span></tt> sampling rate of the desired audio output</li>
  603. </ul>
  604. <p>See also:</p>
  605. <ul class="simple"><li><a class="reference external" href="#AudioStreamPtr">AudioStreamPtr type</a></li>
  606. <li><a class="reference external" href="#newAudioStream,AudioSpec,AudioSpec">newAudioStream proc</a></li>
  607. </ul>
  608. </dd>
  609. <a id="newAudioStream,AudioSpec,AudioSpec"></a>
  610. <dt><pre><span class="Keyword">proc</span> <a href="#newAudioStream%2CAudioSpec%2CAudioSpec"><span class="Identifier">newAudioStream</span></a><span class="Other">(</span><span class="Identifier">srcSpec</span><span class="Other">,</span> <span class="Identifier">destSpec</span><span class="Other">:</span> <a href="audio.html#AudioSpec"><span class="Identifier">AudioSpec</span></a><span class="Other">)</span><span class="Other">:</span> <a href="audio.html#AudioStreamPtr"><span class="Identifier">AudioStreamPtr</span></a> <span><span class="Other">{</span><span class="Other pragmadots">...</span><span class="Other">}</span></span><span class="pragmawrap"><span class="Other">{.</span><span class="pragma"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span>
  611. <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span><span class="Other">.}</span></span></pre></dt>
  612. <dd>
  613. <p>(Available since SDL 2.0.7) Create a new audio stream that converts from <tt class="docutils literal"><span class="pre">srcSpec</span></tt> to <tt class="docutils literal"><span class="pre">destSpec</span></tt>.</p>
  614. <p>See also:</p>
  615. <ul class="simple"><li><a class="reference external" href="#AudioStreamPtr">AudioStreamPtr type</a></li>
  616. <li><a class="reference external" href="#newAudioStream,AudioFormat,uint8,cint,AudioFormat,uint8,cint">newAudioStream proc</a></li>
  617. </ul>
  618. </dd>
  619. <a id="put,AudioStreamPtr,pointer,cint"></a>
  620. <dt><pre><span class="Keyword">proc</span> <a href="#put%2CAudioStreamPtr%2Cpointer%2Ccint"><span class="Identifier">put</span></a><span class="Other">(</span><span class="Identifier">stream</span><span class="Other">:</span> <a href="audio.html#AudioStreamPtr"><span class="Identifier">AudioStreamPtr</span></a><span class="Other">;</span> <span class="Identifier">buf</span><span class="Other">:</span> <span class="Identifier">pointer</span><span class="Other">;</span> <span class="Identifier">len</span><span class="Other">:</span> <span class="Identifier">cint</span><span class="Other">)</span><span class="Other">:</span> <span class="Identifier">cint</span> <span><span class="Other">{</span><span class="Other pragmadots">...</span><span class="Other">}</span></span><span class="pragmawrap"><span class="Other">{.</span><span class="pragma">
  621. <span class="Identifier">importc</span><span class="Other">:</span> <span class="StringLit">&quot;SDL_AudioStreamPut&quot;</span></span><span class="Other">.}</span></span></pre></dt>
  622. <dd>
  623. <p>(Available since SDL 2.0.7) Add data to be converted/resampled to the stream. Returns 0 on success, or -1 on error.</p>
  624. <p>Parameters:</p>
  625. <ul class="simple"><li><tt class="docutils literal"><span class="pre">stream</span></tt> The stream the audio data is being added to</li>
  626. <li><tt class="docutils literal"><span class="pre">buf</span></tt> A pointer to the audio data to add</li>
  627. <li><tt class="docutils literal"><span class="pre">len</span></tt> The number of bytes to write to the stream</li>
  628. </ul>
  629. <p>See also:</p>
  630. <ul class="simple"><li><a class="reference external" href="#AudioStreamPtr">AudioStreamPtr type</a></li>
  631. </ul>
  632. </dd>
  633. <a id="get,AudioStreamPtr,pointer,cint"></a>
  634. <dt><pre><span class="Keyword">proc</span> <a href="#get%2CAudioStreamPtr%2Cpointer%2Ccint"><span class="Identifier">get</span></a><span class="Other">(</span><span class="Identifier">stream</span><span class="Other">:</span> <a href="audio.html#AudioStreamPtr"><span class="Identifier">AudioStreamPtr</span></a><span class="Other">;</span> <span class="Identifier">buf</span><span class="Other">:</span> <span class="Identifier">pointer</span><span class="Other">;</span> <span class="Identifier">len</span><span class="Other">:</span> <span class="Identifier">cint</span><span class="Other">)</span><span class="Other">:</span> <span class="Identifier">cint</span> <span><span class="Other">{</span><span class="Other pragmadots">...</span><span class="Other">}</span></span><span class="pragmawrap"><span class="Other">{.</span><span class="pragma">
  635. <span class="Identifier">importc</span><span class="Other">:</span> <span class="StringLit">&quot;SDL_AudioStreamGet&quot;</span></span><span class="Other">.}</span></span></pre></dt>
  636. <dd>
  637. <p>(Available since SDL 2.0.7) Get converted/resampled data from the stream. Returns the number of bytes read from the stream, or -1 on error.</p>
  638. <p>Parameters:</p>
  639. <ul class="simple"><li><tt class="docutils literal"><span class="pre">stream</span></tt> The stream the audio is being requested from</li>
  640. <li><tt class="docutils literal"><span class="pre">buf</span></tt> A buffer to fill with audio data</li>
  641. <li><tt class="docutils literal"><span class="pre">len</span></tt> The maximum number of bytes to fill</li>
  642. </ul>
  643. <p>See also:</p>
  644. <ul class="simple"><li><a class="reference external" href="#AudioStreamPtr">AudioStreamPtr type</a></li>
  645. </ul>
  646. </dd>
  647. <a id="available,AudioStreamPtr"></a>
  648. <dt><pre><span class="Keyword">proc</span> <a href="#available%2CAudioStreamPtr"><span class="Identifier">available</span></a><span class="Other">(</span><span class="Identifier">stream</span><span class="Other">:</span> <a href="audio.html#AudioStreamPtr"><span class="Identifier">AudioStreamPtr</span></a><span class="Other">)</span><span class="Other">:</span> <span class="Identifier">cint</span> <span><span class="Other">{</span><span class="Other pragmadots">...</span><span class="Other">}</span></span><span class="pragmawrap"><span class="Other">{.</span><span class="pragma"><span class="Identifier">importc</span><span class="Other">:</span> <span class="StringLit">&quot;SDL_AudioStreamAvailable&quot;</span></span><span class="Other">.}</span></span></pre></dt>
  649. <dd>
  650. <p>(Available since SDL 2.0.7) Get the number of converted/resampled bytes available (BYTES, not samples!). The stream may be buffering data behind the scenes until it has enough to resample correctly, so this number might be lower than what you expect, or even be zero. Add more data or flush the stream if you need the data now.</p>
  651. <p>See also:</p>
  652. <ul class="simple"><li><a class="reference external" href="#AudioStreamPtr">AudioStreamPtr type</a></li>
  653. </ul>
  654. </dd>
  655. <a id="flush,AudioStreamPtr"></a>
  656. <dt><pre><span class="Keyword">proc</span> <a href="#flush%2CAudioStreamPtr"><span class="Identifier">flush</span></a><span class="Other">(</span><span class="Identifier">stream</span><span class="Other">:</span> <a href="audio.html#AudioStreamPtr"><span class="Identifier">AudioStreamPtr</span></a><span class="Other">)</span><span class="Other">:</span> <span class="Identifier">cint</span> <span><span class="Other">{</span><span class="Other pragmadots">...</span><span class="Other">}</span></span><span class="pragmawrap"><span class="Other">{.</span><span class="pragma"><span class="Identifier">importc</span><span class="Other">:</span> <span class="StringLit">&quot;SDL_AudioStreamFlush&quot;</span></span><span class="Other">.}</span></span></pre></dt>
  657. <dd>
  658. <p>(Available since SDL 2.0.7) Tell the stream that you're done sending data, and anything being buffered should be converted/resampled and made available immediately. Returns 0 on success, -1 on error.</p>
  659. <p>It is legal to add more data to a stream after flushing, but there will be audio gaps in the output. Generally this is intended to signal the end of input, so the complete output becomes available.</p>
  660. <p>See also:</p>
  661. <ul class="simple"><li><a class="reference external" href="#AudioStreamPtr">AudioStreamPtr type</a></li>
  662. </ul>
  663. </dd>
  664. <a id="clear,AudioStreamPtr"></a>
  665. <dt><pre><span class="Keyword">proc</span> <a href="#clear%2CAudioStreamPtr"><span class="Identifier">clear</span></a><span class="Other">(</span><span class="Identifier">stream</span><span class="Other">:</span> <a href="audio.html#AudioStreamPtr"><span class="Identifier">AudioStreamPtr</span></a><span class="Other">)</span> <span><span class="Other">{</span><span class="Other pragmadots">...</span><span class="Other">}</span></span><span class="pragmawrap"><span class="Other">{.</span><span class="pragma"><span class="Identifier">importc</span><span class="Other">:</span> <span class="StringLit">&quot;SDL_AudioStreamClear&quot;</span></span><span class="Other">.}</span></span></pre></dt>
  666. <dd>
  667. <p>(Available since SDL 2.0.7) Clear any pending data in the stream without converting it.</p>
  668. <p>See also:</p>
  669. <ul class="simple"><li><a class="reference external" href="#AudioStreamPtr">AudioStreamPtr type</a></li>
  670. </ul>
  671. </dd>
  672. <a id="destroy,AudioStreamPtr"></a>
  673. <dt><pre><span class="Keyword">proc</span> <a href="#destroy%2CAudioStreamPtr"><span class="Identifier">destroy</span></a><span class="Other">(</span><span class="Identifier">stream</span><span class="Other">:</span> <a href="audio.html#AudioStreamPtr"><span class="Identifier">AudioStreamPtr</span></a><span class="Other">)</span> <span><span class="Other">{</span><span class="Other pragmadots">...</span><span class="Other">}</span></span><span class="pragmawrap"><span class="Other">{.</span><span class="pragma"><span class="Identifier">importc</span><span class="Other">:</span> <span class="StringLit">&quot;SDL_FreeAudioStream&quot;</span></span><span class="Other">.}</span></span></pre></dt>
  674. <dd>
  675. <p>(Available since SDL 2.0.7) Free an audio stream.</p>
  676. <p>See also:</p>
  677. <ul class="simple"><li><a class="reference external" href="#AudioStreamPtr">AudioStreamPtr type</a></li>
  678. </ul>
  679. </dd>
  680. </dl></div>
  681. <div class="section" id="18">
  682. <h1><a class="toc-backref" href="#18">Templates</a></h1>
  683. <dl class="item">
  684. <a id="SDL_AUDIO_BITSIZE.t,uint32"></a>
  685. <dt><pre><span class="Keyword">template</span> <a href="#SDL_AUDIO_BITSIZE.t%2Cuint32"><span class="Identifier">SDL_AUDIO_BITSIZE</span></a><span class="Other">(</span><span class="Identifier">x</span><span class="Other">:</span> <span class="Identifier">uint32</span><span class="Other">)</span><span class="Other">:</span> <span class="Identifier">uint32</span></pre></dt>
  686. <dd>
  687. </dd>
  688. <a id="SDL_AUDIO_ISFLOAT.t,uint32"></a>
  689. <dt><pre><span class="Keyword">template</span> <a href="#SDL_AUDIO_ISFLOAT.t%2Cuint32"><span class="Identifier">SDL_AUDIO_ISFLOAT</span></a><span class="Other">(</span><span class="Identifier">x</span><span class="Other">:</span> <span class="Identifier">uint32</span><span class="Other">)</span><span class="Other">:</span> <span class="Identifier">bool</span></pre></dt>
  690. <dd>
  691. </dd>
  692. <a id="SDL_AUDIO_ISBIGENDIAN.t,uint32"></a>
  693. <dt><pre><span class="Keyword">template</span> <a href="#SDL_AUDIO_ISBIGENDIAN.t%2Cuint32"><span class="Identifier">SDL_AUDIO_ISBIGENDIAN</span></a><span class="Other">(</span><span class="Identifier">x</span><span class="Other">:</span> <span class="Identifier">uint32</span><span class="Other">)</span><span class="Other">:</span> <span class="Identifier">bool</span></pre></dt>
  694. <dd>
  695. </dd>
  696. <a id="SDL_AUDIO_ISSIGNED.t,uint32"></a>
  697. <dt><pre><span class="Keyword">template</span> <a href="#SDL_AUDIO_ISSIGNED.t%2Cuint32"><span class="Identifier">SDL_AUDIO_ISSIGNED</span></a><span class="Other">(</span><span class="Identifier">x</span><span class="Other">:</span> <span class="Identifier">uint32</span><span class="Other">)</span><span class="Other">:</span> <span class="Identifier">bool</span></pre></dt>
  698. <dd>
  699. </dd>
  700. <a id="SDL_AUDIO_ISINT.t,uint32"></a>
  701. <dt><pre><span class="Keyword">template</span> <a href="#SDL_AUDIO_ISINT.t%2Cuint32"><span class="Identifier">SDL_AUDIO_ISINT</span></a><span class="Other">(</span><span class="Identifier">x</span><span class="Other">:</span> <span class="Identifier">uint32</span><span class="Other">)</span><span class="Other">:</span> <span class="Identifier">bool</span></pre></dt>
  702. <dd>
  703. </dd>
  704. <a id="SDL_AUDIO_ISLITTLEENDIAN.t,uint32"></a>
  705. <dt><pre><span class="Keyword">template</span> <a href="#SDL_AUDIO_ISLITTLEENDIAN.t%2Cuint32"><span class="Identifier">SDL_AUDIO_ISLITTLEENDIAN</span></a><span class="Other">(</span><span class="Identifier">x</span><span class="Other">:</span> <span class="Identifier">uint32</span><span class="Other">)</span><span class="Other">:</span> <span class="Identifier">bool</span></pre></dt>
  706. <dd>
  707. </dd>
  708. <a id="SDL_AUDIO_ISUNSIGNED.t,uint32"></a>
  709. <dt><pre><span class="Keyword">template</span> <a href="#SDL_AUDIO_ISUNSIGNED.t%2Cuint32"><span class="Identifier">SDL_AUDIO_ISUNSIGNED</span></a><span class="Other">(</span><span class="Identifier">x</span><span class="Other">:</span> <span class="Identifier">uint32</span><span class="Other">)</span><span class="Other">:</span> <span class="Identifier">bool</span></pre></dt>
  710. <dd>
  711. </dd>
  712. <a id="loadWAV.t,string,ptr.AudioSpec,ptr.ptr.uint8,ptr.uint32"></a>
  713. <dt><pre><span class="Keyword">template</span> <a href="#loadWAV.t%2Cstring%2Cptr.AudioSpec%2Cptr.ptr.uint8%2Cptr.uint32"><span class="Identifier">loadWAV</span></a><span class="Other">(</span><span class="Identifier">file</span><span class="Other">:</span> <span class="Identifier">string</span><span class="Other">;</span> <span class="Identifier">spec</span><span class="Other">:</span> <span class="Keyword">ptr</span> <a href="audio.html#AudioSpec"><span class="Identifier">AudioSpec</span></a><span class="Other">;</span> <span class="Identifier">audio_buf</span><span class="Other">:</span> <span class="Keyword">ptr</span> <span class="Keyword">ptr</span> <span class="Identifier">uint8</span><span class="Other">;</span>
  714. <span class="Identifier">audio_len</span><span class="Other">:</span> <span class="Keyword">ptr</span> <span class="Identifier">uint32</span><span class="Other">)</span><span class="Other">:</span> <span class="Keyword">ptr</span> <a href="audio.html#AudioSpec"><span class="Identifier">AudioSpec</span></a></pre></dt>
  715. <dd>
  716. </dd>
  717. </dl></div>
  718. </div>
  719. </div>
  720. <div class="row">
  721. <div class="twelve-columns footer">
  722. <span class="nim-sprite"></span>
  723. <br/>
  724. <small style="color: var(--hint);">Made with Nim. Generated: 2020-05-29 14:35:12 UTC</small>
  725. </div>
  726. </div>
  727. </div>
  728. </div>
  729. </body>
  730. </html>