gosu 0.14.6.pre1 → 1.0.0.pre2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (242) hide show
  1. checksums.yaml +4 -4
  2. data/.yardopts +1 -0
  3. data/COPYING +1 -1
  4. data/dependencies/SDL/include/SDL.h +138 -0
  5. data/dependencies/SDL/include/SDL_assert.h +293 -0
  6. data/dependencies/SDL/include/SDL_atomic.h +295 -0
  7. data/dependencies/SDL/include/SDL_audio.h +859 -0
  8. data/dependencies/SDL/include/SDL_bits.h +121 -0
  9. data/dependencies/SDL/include/SDL_blendmode.h +123 -0
  10. data/dependencies/SDL/include/SDL_clipboard.h +71 -0
  11. data/dependencies/SDL/include/SDL_config.h +55 -0
  12. data/dependencies/SDL/include/SDL_config_android.h +182 -0
  13. data/dependencies/SDL/include/SDL_config_iphoneos.h +207 -0
  14. data/dependencies/SDL/include/SDL_config_macosx.h +266 -0
  15. data/dependencies/SDL/include/SDL_config_minimal.h +85 -0
  16. data/dependencies/SDL/include/SDL_config_os2.h +188 -0
  17. data/dependencies/SDL/include/SDL_config_pandora.h +135 -0
  18. data/dependencies/SDL/include/SDL_config_psp.h +165 -0
  19. data/dependencies/SDL/include/SDL_config_windows.h +288 -0
  20. data/dependencies/SDL/include/SDL_config_winrt.h +243 -0
  21. data/dependencies/SDL/include/SDL_config_wiz.h +149 -0
  22. data/dependencies/SDL/include/SDL_copying.h +20 -0
  23. data/dependencies/SDL/include/SDL_cpuinfo.h +299 -0
  24. data/dependencies/SDL/include/SDL_egl.h +1676 -0
  25. data/dependencies/SDL/include/SDL_endian.h +263 -0
  26. data/dependencies/SDL/include/SDL_error.h +112 -0
  27. data/dependencies/SDL/include/SDL_events.h +827 -0
  28. data/dependencies/SDL/include/SDL_filesystem.h +136 -0
  29. data/dependencies/SDL/include/SDL_gamecontroller.h +541 -0
  30. data/dependencies/SDL/include/SDL_gesture.h +87 -0
  31. data/dependencies/SDL/include/SDL_haptic.h +1247 -0
  32. data/dependencies/SDL/include/SDL_hints.h +1578 -0
  33. data/dependencies/SDL/include/SDL_joystick.h +499 -0
  34. data/dependencies/SDL/include/SDL_keyboard.h +217 -0
  35. data/dependencies/SDL/include/SDL_keycode.h +351 -0
  36. data/dependencies/SDL/include/SDL_loadso.h +81 -0
  37. data/dependencies/SDL/include/SDL_locale.h +101 -0
  38. data/dependencies/SDL/include/SDL_log.h +211 -0
  39. data/dependencies/SDL/include/SDL_main.h +180 -0
  40. data/dependencies/SDL/include/SDL_messagebox.h +146 -0
  41. data/dependencies/SDL/include/SDL_metal.h +117 -0
  42. data/dependencies/SDL/include/SDL_misc.h +75 -0
  43. data/dependencies/SDL/include/SDL_mouse.h +302 -0
  44. data/dependencies/SDL/include/SDL_mutex.h +251 -0
  45. data/dependencies/SDL/include/SDL_name.h +33 -0
  46. data/dependencies/SDL/include/SDL_opengl.h +2183 -0
  47. data/dependencies/SDL/include/SDL_opengl_glext.h +11180 -0
  48. data/dependencies/SDL/include/SDL_opengles.h +39 -0
  49. data/dependencies/SDL/include/SDL_opengles2.h +52 -0
  50. data/dependencies/SDL/include/SDL_opengles2_gl2.h +621 -0
  51. data/dependencies/SDL/include/SDL_opengles2_gl2ext.h +2050 -0
  52. data/dependencies/SDL/include/SDL_opengles2_gl2platform.h +30 -0
  53. data/dependencies/SDL/include/SDL_opengles2_khrplatform.h +282 -0
  54. data/dependencies/SDL/include/SDL_pixels.h +479 -0
  55. data/dependencies/SDL/include/SDL_platform.h +198 -0
  56. data/dependencies/SDL/include/SDL_power.h +75 -0
  57. data/dependencies/SDL/include/SDL_quit.h +58 -0
  58. data/dependencies/SDL/include/SDL_rect.h +174 -0
  59. data/dependencies/SDL/include/SDL_render.h +1158 -0
  60. data/dependencies/SDL/include/SDL_revision.h +2 -0
  61. data/dependencies/SDL/include/SDL_rwops.h +283 -0
  62. data/dependencies/SDL/include/SDL_scancode.h +413 -0
  63. data/dependencies/SDL/include/SDL_sensor.h +267 -0
  64. data/dependencies/SDL/include/SDL_shape.h +144 -0
  65. data/dependencies/SDL/include/SDL_stdinc.h +647 -0
  66. data/dependencies/SDL/include/SDL_surface.h +563 -0
  67. data/dependencies/SDL/include/SDL_system.h +325 -0
  68. data/dependencies/SDL/include/SDL_syswm.h +354 -0
  69. data/dependencies/SDL/include/SDL_test.h +69 -0
  70. data/dependencies/SDL/include/SDL_test_assert.h +105 -0
  71. data/dependencies/SDL/include/SDL_test_common.h +218 -0
  72. data/dependencies/SDL/include/SDL_test_compare.h +69 -0
  73. data/dependencies/SDL/include/SDL_test_crc32.h +124 -0
  74. data/dependencies/SDL/include/SDL_test_font.h +81 -0
  75. data/dependencies/SDL/include/SDL_test_fuzzer.h +384 -0
  76. data/dependencies/SDL/include/SDL_test_harness.h +134 -0
  77. data/dependencies/SDL/include/SDL_test_images.h +78 -0
  78. data/dependencies/SDL/include/SDL_test_log.h +67 -0
  79. data/dependencies/SDL/include/SDL_test_md5.h +129 -0
  80. data/dependencies/SDL/include/SDL_test_memory.h +63 -0
  81. data/dependencies/SDL/include/SDL_test_random.h +115 -0
  82. data/dependencies/SDL/include/SDL_thread.h +366 -0
  83. data/dependencies/SDL/include/SDL_timer.h +115 -0
  84. data/dependencies/SDL/include/SDL_touch.h +102 -0
  85. data/dependencies/SDL/include/SDL_types.h +29 -0
  86. data/dependencies/SDL/include/SDL_version.h +162 -0
  87. data/dependencies/SDL/include/SDL_video.h +1282 -0
  88. data/dependencies/SDL/include/SDL_vulkan.h +276 -0
  89. data/dependencies/SDL/include/begin_code.h +166 -0
  90. data/dependencies/SDL/include/close_code.h +40 -0
  91. data/dependencies/SDL/lib/x64/libSDL2.dll.a +0 -0
  92. data/dependencies/SDL/lib/x86/libSDL2.dll.a +0 -0
  93. data/dependencies/SDL_sound/SDL_sound.c +795 -0
  94. data/dependencies/SDL_sound/SDL_sound.h +725 -0
  95. data/dependencies/SDL_sound/SDL_sound_aiff.c +537 -0
  96. data/dependencies/SDL_sound/SDL_sound_au.c +352 -0
  97. data/dependencies/SDL_sound/SDL_sound_coreaudio.c +747 -0
  98. data/dependencies/SDL_sound/SDL_sound_flac.c +182 -0
  99. data/dependencies/SDL_sound/SDL_sound_internal.h +304 -0
  100. data/dependencies/SDL_sound/SDL_sound_modplug.c +228 -0
  101. data/dependencies/SDL_sound/SDL_sound_mp3.c +184 -0
  102. data/dependencies/SDL_sound/SDL_sound_raw.c +164 -0
  103. data/dependencies/SDL_sound/SDL_sound_shn.c +1309 -0
  104. data/dependencies/SDL_sound/SDL_sound_voc.c +550 -0
  105. data/dependencies/SDL_sound/SDL_sound_vorbis.c +223 -0
  106. data/dependencies/SDL_sound/SDL_sound_wav.c +783 -0
  107. data/dependencies/SDL_sound/dr_flac.h +5906 -0
  108. data/dependencies/SDL_sound/dr_mp3.h +2832 -0
  109. data/dependencies/SDL_sound/libmodplug/fastmix.c +1748 -0
  110. data/dependencies/SDL_sound/libmodplug/libmodplug.h +1001 -0
  111. data/dependencies/SDL_sound/libmodplug/load_669.c +188 -0
  112. data/dependencies/SDL_sound/libmodplug/load_abc.c +4725 -0
  113. data/dependencies/SDL_sound/libmodplug/load_amf.c +403 -0
  114. data/dependencies/SDL_sound/libmodplug/load_ams.c +587 -0
  115. data/dependencies/SDL_sound/libmodplug/load_dbm.c +357 -0
  116. data/dependencies/SDL_sound/libmodplug/load_dmf.c +531 -0
  117. data/dependencies/SDL_sound/libmodplug/load_dsm.c +232 -0
  118. data/dependencies/SDL_sound/libmodplug/load_far.c +253 -0
  119. data/dependencies/SDL_sound/libmodplug/load_it.c +796 -0
  120. data/dependencies/SDL_sound/libmodplug/load_mdl.c +488 -0
  121. data/dependencies/SDL_sound/libmodplug/load_med.c +757 -0
  122. data/dependencies/SDL_sound/libmodplug/load_mid.c +1405 -0
  123. data/dependencies/SDL_sound/libmodplug/load_mod.c +269 -0
  124. data/dependencies/SDL_sound/libmodplug/load_mt2.c +546 -0
  125. data/dependencies/SDL_sound/libmodplug/load_mtm.c +142 -0
  126. data/dependencies/SDL_sound/libmodplug/load_okt.c +192 -0
  127. data/dependencies/SDL_sound/libmodplug/load_pat.c +1143 -0
  128. data/dependencies/SDL_sound/libmodplug/load_pat.h +25 -0
  129. data/dependencies/SDL_sound/libmodplug/load_psm.c +350 -0
  130. data/dependencies/SDL_sound/libmodplug/load_ptm.c +204 -0
  131. data/dependencies/SDL_sound/libmodplug/load_s3m.c +325 -0
  132. data/dependencies/SDL_sound/libmodplug/load_stm.c +180 -0
  133. data/dependencies/SDL_sound/libmodplug/load_ult.c +206 -0
  134. data/dependencies/SDL_sound/libmodplug/load_umx.c +51 -0
  135. data/dependencies/SDL_sound/libmodplug/load_xm.c +554 -0
  136. data/dependencies/SDL_sound/libmodplug/mmcmp.c +382 -0
  137. data/dependencies/SDL_sound/libmodplug/modplug.c +170 -0
  138. data/dependencies/SDL_sound/libmodplug/modplug.h +90 -0
  139. data/dependencies/SDL_sound/libmodplug/snd_dsp.c +301 -0
  140. data/dependencies/SDL_sound/libmodplug/snd_flt.c +63 -0
  141. data/dependencies/SDL_sound/libmodplug/snd_fx.c +2350 -0
  142. data/dependencies/SDL_sound/libmodplug/sndfile.c +1169 -0
  143. data/dependencies/SDL_sound/libmodplug/sndmix.c +1034 -0
  144. data/dependencies/SDL_sound/libmodplug/tables.h +371 -0
  145. data/{src/stb_vorbis.c → dependencies/SDL_sound/stb_vorbis.h} +128 -23
  146. data/dependencies/al_soft/AL/al.h +655 -0
  147. data/dependencies/al_soft/AL/alc.h +270 -0
  148. data/dependencies/al_soft/AL/alext.h +585 -0
  149. data/dependencies/al_soft/AL/efx-creative.h +3 -0
  150. data/dependencies/al_soft/AL/efx-presets.h +402 -0
  151. data/dependencies/al_soft/AL/efx.h +762 -0
  152. data/dependencies/al_soft/x64/libOpenAL32.dll.a +0 -0
  153. data/dependencies/al_soft/x86/libOpenAL32.dll.a +0 -0
  154. data/{src → dependencies/stb}/stb_image.h +476 -176
  155. data/{src → dependencies/stb}/stb_image_write.h +253 -131
  156. data/{src → dependencies/stb}/stb_truetype.h +262 -104
  157. data/{src → dependencies/utf8proc}/utf8proc.c +47 -29
  158. data/{src → dependencies/utf8proc}/utf8proc.h +46 -24
  159. data/{src → dependencies/utf8proc}/utf8proc_data.h +10043 -9609
  160. data/ext/gosu/extconf.rb +53 -39
  161. data/{Gosu → include/Gosu}/Audio.hpp +6 -8
  162. data/include/Gosu/Bitmap.hpp +100 -0
  163. data/{Gosu → include/Gosu}/Buttons.hpp +104 -44
  164. data/include/Gosu/Channel.h +25 -0
  165. data/include/Gosu/Color.h +38 -0
  166. data/{Gosu → include/Gosu}/Color.hpp +0 -0
  167. data/{Gosu → include/Gosu}/Directories.hpp +0 -0
  168. data/include/Gosu/Font.h +36 -0
  169. data/{Gosu → include/Gosu}/Font.hpp +0 -0
  170. data/{Gosu → include/Gosu}/Fwd.hpp +0 -5
  171. data/include/Gosu/Gosu.h +82 -0
  172. data/{Gosu → include/Gosu}/Gosu.hpp +0 -0
  173. data/{Gosu → include/Gosu}/Graphics.hpp +0 -0
  174. data/{Gosu → include/Gosu}/GraphicsBase.hpp +0 -0
  175. data/{Gosu → include/Gosu}/IO.hpp +0 -0
  176. data/include/Gosu/Image.h +54 -0
  177. data/{Gosu → include/Gosu}/Image.hpp +7 -6
  178. data/{Gosu → include/Gosu}/ImageData.hpp +0 -0
  179. data/{Gosu → include/Gosu}/Input.hpp +39 -51
  180. data/{Gosu → include/Gosu}/Inspection.hpp +0 -0
  181. data/{Gosu → include/Gosu}/Math.hpp +0 -0
  182. data/{Gosu → include/Gosu}/Platform.hpp +0 -0
  183. data/include/Gosu/Sample.h +19 -0
  184. data/include/Gosu/Song.h +24 -0
  185. data/{Gosu → include/Gosu}/Text.hpp +0 -0
  186. data/include/Gosu/TextInput.h +30 -0
  187. data/{Gosu → include/Gosu}/TextInput.hpp +0 -0
  188. data/{Gosu → include/Gosu}/Timing.hpp +0 -0
  189. data/{Gosu → include/Gosu}/Utility.hpp +15 -4
  190. data/{Gosu → include/Gosu}/Version.hpp +3 -3
  191. data/include/Gosu/Window.h +63 -0
  192. data/{Gosu → include/Gosu}/Window.hpp +23 -25
  193. data/lib/OpenAL32.dll +0 -0
  194. data/lib/SDL2.dll +0 -0
  195. data/lib/gosu.rb +0 -3
  196. data/lib/gosu/compat.rb +9 -4
  197. data/lib/gosu/patches.rb +8 -11
  198. data/lib/gosu/swig_patches.rb +13 -6
  199. data/lib64/OpenAL32.dll +0 -0
  200. data/lib64/SDL2.dll +0 -0
  201. data/rdoc/gosu.rb +114 -21
  202. data/src/Audio.cpp +50 -224
  203. data/src/AudioFile.hpp +20 -37
  204. data/src/AudioFileAudioToolbox.cpp +237 -0
  205. data/src/AudioFileSDLSound.cpp +147 -0
  206. data/src/AudioImpl.cpp +3 -12
  207. data/src/AudioImpl.hpp +3 -1
  208. data/src/Bitmap.cpp +85 -83
  209. data/src/BitmapIO.cpp +52 -58
  210. data/src/ChannelWrapper.cpp +50 -0
  211. data/src/ColorWrapper.cpp +126 -0
  212. data/src/Constants.cpp +338 -0
  213. data/src/Font.cpp +4 -1
  214. data/src/FontWrapper.cpp +74 -0
  215. data/src/GosuWrapper.cpp +251 -0
  216. data/src/Graphics.cpp +11 -5
  217. data/src/GraphicsImpl.hpp +0 -1
  218. data/src/Image.cpp +13 -16
  219. data/src/ImageWrapper.cpp +168 -0
  220. data/src/Input.cpp +412 -164
  221. data/src/LargeImageData.cpp +2 -1
  222. data/src/MarkupParser.cpp +13 -4
  223. data/src/RubyGosu.cxx +502 -219
  224. data/src/RubyGosu.h +4 -2
  225. data/src/SampleWrapper.cpp +30 -0
  226. data/src/SongWrapper.cpp +52 -0
  227. data/src/TexChunk.cpp +29 -19
  228. data/src/Text.cpp +2 -0
  229. data/src/TextBuilder.cpp +6 -4
  230. data/src/TextInputWrapper.cpp +101 -0
  231. data/src/Texture.cpp +1 -1
  232. data/src/TrueTypeFont.cpp +2 -1
  233. data/src/Utility.cpp +11 -7
  234. data/src/Window.cpp +30 -39
  235. data/src/WindowWrapper.cpp +317 -0
  236. metadata +212 -42
  237. data/Gosu/AutoLink.hpp +0 -14
  238. data/Gosu/Bitmap.hpp +0 -113
  239. data/src/AudioToolboxFile.hpp +0 -210
  240. data/src/OggFile.hpp +0 -92
  241. data/src/SndFile.hpp +0 -174
  242. data/src/WinMain.cpp +0 -64
@@ -0,0 +1,371 @@
1
+ /*
2
+ * This source code is public domain.
3
+ *
4
+ * Authors: Olivier Lapicque <olivierl@jps.net>
5
+ */
6
+
7
+ #include "libmodplug.h"
8
+
9
+ static const BYTE ImpulseTrackerPortaVolCmd[16] =
10
+ {
11
+ 0x00, 0x01, 0x04, 0x08, 0x10, 0x20, 0x40, 0x60,
12
+ 0x80, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF
13
+ };
14
+
15
+ // Period table for Protracker octaves 0-5:
16
+ static const WORD ProTrackerPeriodTable[6*12] =
17
+ {
18
+ 1712,1616,1524,1440,1356,1280,1208,1140,1076,1016,960,907,
19
+ 856,808,762,720,678,640,604,570,538,508,480,453,
20
+ 428,404,381,360,339,320,302,285,269,254,240,226,
21
+ 214,202,190,180,170,160,151,143,135,127,120,113,
22
+ 107,101,95,90,85,80,75,71,67,63,60,56,
23
+ 53,50,47,45,42,40,37,35,33,31,30,28
24
+ };
25
+
26
+
27
+ static const WORD ProTrackerTunedPeriods[16*12] =
28
+ {
29
+ 1712,1616,1524,1440,1356,1280,1208,1140,1076,1016,960,907,
30
+ 1700,1604,1514,1430,1348,1274,1202,1134,1070,1010,954,900,
31
+ 1688,1592,1504,1418,1340,1264,1194,1126,1064,1004,948,894,
32
+ 1676,1582,1492,1408,1330,1256,1184,1118,1056,996,940,888,
33
+ 1664,1570,1482,1398,1320,1246,1176,1110,1048,990,934,882,
34
+ 1652,1558,1472,1388,1310,1238,1168,1102,1040,982,926,874,
35
+ 1640,1548,1460,1378,1302,1228,1160,1094,1032,974,920,868,
36
+ 1628,1536,1450,1368,1292,1220,1150,1086,1026,968,914,862,
37
+ 1814,1712,1616,1524,1440,1356,1280,1208,1140,1076,1016,960,
38
+ 1800,1700,1604,1514,1430,1350,1272,1202,1134,1070,1010,954,
39
+ 1788,1688,1592,1504,1418,1340,1264,1194,1126,1064,1004,948,
40
+ 1774,1676,1582,1492,1408,1330,1256,1184,1118,1056,996,940,
41
+ 1762,1664,1570,1482,1398,1320,1246,1176,1110,1048,988,934,
42
+ 1750,1652,1558,1472,1388,1310,1238,1168,1102,1040,982,926,
43
+ 1736,1640,1548,1460,1378,1302,1228,1160,1094,1032,974,920,
44
+ 1724,1628,1536,1450,1368,1292,1220,1150,1086,1026,968,914
45
+ };
46
+
47
+
48
+ // S3M C-4 periods
49
+ static const WORD FreqS3MTable[16] =
50
+ {
51
+ 1712,1616,1524,1440,1356,1280,
52
+ 1208,1140,1076,1016,960,907,
53
+ 0,0,0,0
54
+ };
55
+
56
+
57
+ // S3M FineTune frequencies
58
+ static const WORD S3MFineTuneTable[16] =
59
+ {
60
+ 7895,7941,7985,8046,8107,8169,8232,8280,
61
+ 8363,8413,8463,8529,8581,8651,8723,8757, // 8363*2^((i-8)/(12*8))
62
+ };
63
+
64
+
65
+ // Sinus table
66
+ static const int16_t ModSinusTable[64] =
67
+ {
68
+ 0,12,25,37,49,60,71,81,90,98,106,112,117,122,125,126,
69
+ 127,126,125,122,117,112,106,98,90,81,71,60,49,37,25,12,
70
+ 0,-12,-25,-37,-49,-60,-71,-81,-90,-98,-106,-112,-117,-122,-125,-126,
71
+ -127,-126,-125,-122,-117,-112,-106,-98,-90,-81,-71,-60,-49,-37,-25,-12
72
+ };
73
+
74
+ // Triangle wave table (ramp down)
75
+ static const int16_t ModRampDownTable[64] =
76
+ {
77
+ 0,-4,-8,-12,-16,-20,-24,-28,-32,-36,-40,-44,-48,-52,-56,-60,
78
+ -64,-68,-72,-76,-80,-84,-88,-92,-96,-100,-104,-108,-112,-116,-120,-124,
79
+ 127,123,119,115,111,107,103,99,95,91,87,83,79,75,71,67,
80
+ 63,59,55,51,47,43,39,35,31,27,23,19,15,11,7,3
81
+ };
82
+
83
+ // Square wave table
84
+ static const int16_t ModSquareTable[64] =
85
+ {
86
+ 127,127,127,127,127,127,127,127,127,127,127,127,127,127,127,127,
87
+ 127,127,127,127,127,127,127,127,127,127,127,127,127,127,127,127,
88
+ -127,-127,-127,-127,-127,-127,-127,-127,-127,-127,-127,-127,-127,-127,-127,-127,
89
+ -127,-127,-127,-127,-127,-127,-127,-127,-127,-127,-127,-127,-127,-127,-127,-127
90
+ };
91
+
92
+ // Random wave table
93
+ static const int16_t ModRandomTable[64] =
94
+ {
95
+ 98,-127,-43,88,102,41,-65,-94,125,20,-71,-86,-70,-32,-16,-96,
96
+ 17,72,107,-5,116,-69,-62,-40,10,-61,65,109,-18,-38,-13,-76,
97
+ -23,88,21,-94,8,106,21,-112,6,109,20,-88,-30,9,-127,118,
98
+ 42,-34,89,-4,-51,-72,21,-29,112,123,84,-101,-92,98,-54,-95
99
+ };
100
+
101
+
102
+ // volume fade tables for Retrig Note:
103
+ static const int8_t retrigTable1[16] =
104
+ { 0, 0, 0, 0, 0, 0, 10, 8, 0, 0, 0, 0, 0, 0, 24, 32 };
105
+
106
+ static const int8_t retrigTable2[16] =
107
+ { 0, -1, -2, -4, -8, -16, 0, 0, 0, 1, 2, 4, 8, 16, 0, 0 };
108
+
109
+
110
+
111
+ static const WORD XMPeriodTable[104] =
112
+ {
113
+ 907,900,894,887,881,875,868,862,856,850,844,838,832,826,820,814,
114
+ 808,802,796,791,785,779,774,768,762,757,752,746,741,736,730,725,
115
+ 720,715,709,704,699,694,689,684,678,675,670,665,660,655,651,646,
116
+ 640,636,632,628,623,619,614,610,604,601,597,592,588,584,580,575,
117
+ 570,567,563,559,555,551,547,543,538,535,532,528,524,520,516,513,
118
+ 508,505,502,498,494,491,487,484,480,477,474,470,467,463,460,457,
119
+ 453,450,447,443,440,437,434,431
120
+ };
121
+
122
+
123
+ static const uint32_t XMLinearTable[768] =
124
+ {
125
+ 535232,534749,534266,533784,533303,532822,532341,531861,
126
+ 531381,530902,530423,529944,529466,528988,528511,528034,
127
+ 527558,527082,526607,526131,525657,525183,524709,524236,
128
+ 523763,523290,522818,522346,521875,521404,520934,520464,
129
+ 519994,519525,519057,518588,518121,517653,517186,516720,
130
+ 516253,515788,515322,514858,514393,513929,513465,513002,
131
+ 512539,512077,511615,511154,510692,510232,509771,509312,
132
+ 508852,508393,507934,507476,507018,506561,506104,505647,
133
+ 505191,504735,504280,503825,503371,502917,502463,502010,
134
+ 501557,501104,500652,500201,499749,499298,498848,498398,
135
+ 497948,497499,497050,496602,496154,495706,495259,494812,
136
+ 494366,493920,493474,493029,492585,492140,491696,491253,
137
+ 490809,490367,489924,489482,489041,488600,488159,487718,
138
+ 487278,486839,486400,485961,485522,485084,484647,484210,
139
+ 483773,483336,482900,482465,482029,481595,481160,480726,
140
+ 480292,479859,479426,478994,478562,478130,477699,477268,
141
+ 476837,476407,475977,475548,475119,474690,474262,473834,
142
+ 473407,472979,472553,472126,471701,471275,470850,470425,
143
+ 470001,469577,469153,468730,468307,467884,467462,467041,
144
+ 466619,466198,465778,465358,464938,464518,464099,463681,
145
+ 463262,462844,462427,462010,461593,461177,460760,460345,
146
+ 459930,459515,459100,458686,458272,457859,457446,457033,
147
+ 456621,456209,455797,455386,454975,454565,454155,453745,
148
+ 453336,452927,452518,452110,451702,451294,450887,450481,
149
+ 450074,449668,449262,448857,448452,448048,447644,447240,
150
+ 446836,446433,446030,445628,445226,444824,444423,444022,
151
+ 443622,443221,442821,442422,442023,441624,441226,440828,
152
+ 440430,440033,439636,439239,438843,438447,438051,437656,
153
+ 437261,436867,436473,436079,435686,435293,434900,434508,
154
+ 434116,433724,433333,432942,432551,432161,431771,431382,
155
+ 430992,430604,430215,429827,429439,429052,428665,428278,
156
+ 427892,427506,427120,426735,426350,425965,425581,425197,
157
+ 424813,424430,424047,423665,423283,422901,422519,422138,
158
+ 421757,421377,420997,420617,420237,419858,419479,419101,
159
+ 418723,418345,417968,417591,417214,416838,416462,416086,
160
+ 415711,415336,414961,414586,414212,413839,413465,413092,
161
+ 412720,412347,411975,411604,411232,410862,410491,410121,
162
+ 409751,409381,409012,408643,408274,407906,407538,407170,
163
+ 406803,406436,406069,405703,405337,404971,404606,404241,
164
+ 403876,403512,403148,402784,402421,402058,401695,401333,
165
+ 400970,400609,400247,399886,399525,399165,398805,398445,
166
+ 398086,397727,397368,397009,396651,396293,395936,395579,
167
+ 395222,394865,394509,394153,393798,393442,393087,392733,
168
+ 392378,392024,391671,391317,390964,390612,390259,389907,
169
+ 389556,389204,388853,388502,388152,387802,387452,387102,
170
+ 386753,386404,386056,385707,385359,385012,384664,384317,
171
+ 383971,383624,383278,382932,382587,382242,381897,381552,
172
+ 381208,380864,380521,380177,379834,379492,379149,378807,
173
+
174
+ 378466,378124,377783,377442,377102,376762,376422,376082,
175
+ 375743,375404,375065,374727,374389,374051,373714,373377,
176
+ 373040,372703,372367,372031,371695,371360,371025,370690,
177
+ 370356,370022,369688,369355,369021,368688,368356,368023,
178
+ 367691,367360,367028,366697,366366,366036,365706,365376,
179
+ 365046,364717,364388,364059,363731,363403,363075,362747,
180
+ 362420,362093,361766,361440,361114,360788,360463,360137,
181
+ 359813,359488,359164,358840,358516,358193,357869,357547,
182
+ 357224,356902,356580,356258,355937,355616,355295,354974,
183
+ 354654,354334,354014,353695,353376,353057,352739,352420,
184
+ 352103,351785,351468,351150,350834,350517,350201,349885,
185
+ 349569,349254,348939,348624,348310,347995,347682,347368,
186
+ 347055,346741,346429,346116,345804,345492,345180,344869,
187
+ 344558,344247,343936,343626,343316,343006,342697,342388,
188
+ 342079,341770,341462,341154,340846,340539,340231,339924,
189
+ 339618,339311,339005,338700,338394,338089,337784,337479,
190
+ 337175,336870,336566,336263,335959,335656,335354,335051,
191
+ 334749,334447,334145,333844,333542,333242,332941,332641,
192
+ 332341,332041,331741,331442,331143,330844,330546,330247,
193
+ 329950,329652,329355,329057,328761,328464,328168,327872,
194
+ 327576,327280,326985,326690,326395,326101,325807,325513,
195
+ 325219,324926,324633,324340,324047,323755,323463,323171,
196
+ 322879,322588,322297,322006,321716,321426,321136,320846,
197
+ 320557,320267,319978,319690,319401,319113,318825,318538,
198
+ 318250,317963,317676,317390,317103,316817,316532,316246,
199
+ 315961,315676,315391,315106,314822,314538,314254,313971,
200
+ 313688,313405,313122,312839,312557,312275,311994,311712,
201
+ 311431,311150,310869,310589,310309,310029,309749,309470,
202
+ 309190,308911,308633,308354,308076,307798,307521,307243,
203
+ 306966,306689,306412,306136,305860,305584,305308,305033,
204
+ 304758,304483,304208,303934,303659,303385,303112,302838,
205
+ 302565,302292,302019,301747,301475,301203,300931,300660,
206
+ 300388,300117,299847,299576,299306,299036,298766,298497,
207
+ 298227,297958,297689,297421,297153,296884,296617,296349,
208
+ 296082,295815,295548,295281,295015,294749,294483,294217,
209
+ 293952,293686,293421,293157,292892,292628,292364,292100,
210
+ 291837,291574,291311,291048,290785,290523,290261,289999,
211
+ 289737,289476,289215,288954,288693,288433,288173,287913,
212
+ 287653,287393,287134,286875,286616,286358,286099,285841,
213
+ 285583,285326,285068,284811,284554,284298,284041,283785,
214
+ 283529,283273,283017,282762,282507,282252,281998,281743,
215
+ 281489,281235,280981,280728,280475,280222,279969,279716,
216
+ 279464,279212,278960,278708,278457,278206,277955,277704,
217
+ 277453,277203,276953,276703,276453,276204,275955,275706,
218
+ 275457,275209,274960,274712,274465,274217,273970,273722,
219
+ 273476,273229,272982,272736,272490,272244,271999,271753,
220
+ 271508,271263,271018,270774,270530,270286,270042,269798,
221
+ 269555,269312,269069,268826,268583,268341,268099,267857
222
+ };
223
+
224
+
225
+ static const int8_t ft2VibratoTable[256] =
226
+ {
227
+ 0,-2,-3,-5,-6,-8,-9,-11,-12,-14,-16,-17,-19,-20,-22,-23,
228
+ -24,-26,-27,-29,-30,-32,-33,-34,-36,-37,-38,-39,-41,-42,
229
+ -43,-44,-45,-46,-47,-48,-49,-50,-51,-52,-53,-54,-55,-56,
230
+ -56,-57,-58,-59,-59,-60,-60,-61,-61,-62,-62,-62,-63,-63,
231
+ -63,-64,-64,-64,-64,-64,-64,-64,-64,-64,-64,-64,-63,-63,
232
+ -63,-62,-62,-62,-61,-61,-60,-60,-59,-59,-58,-57,-56,-56,
233
+ -55,-54,-53,-52,-51,-50,-49,-48,-47,-46,-45,-44,-43,-42,
234
+ -41,-39,-38,-37,-36,-34,-33,-32,-30,-29,-27,-26,-24,-23,
235
+ -22,-20,-19,-17,-16,-14,-12,-11,-9,-8,-6,-5,-3,-2,0,
236
+ 2,3,5,6,8,9,11,12,14,16,17,19,20,22,23,24,26,27,29,30,
237
+ 32,33,34,36,37,38,39,41,42,43,44,45,46,47,48,49,50,51,
238
+ 52,53,54,55,56,56,57,58,59,59,60,60,61,61,62,62,62,63,
239
+ 63,63,64,64,64,64,64,64,64,64,64,64,64,63,63,63,62,62,
240
+ 62,61,61,60,60,59,59,58,57,56,56,55,54,53,52,51,50,49,
241
+ 48,47,46,45,44,43,42,41,39,38,37,36,34,33,32,30,29,27,
242
+ 26,24,23,22,20,19,17,16,14,12,11,9,8,6,5,3,2
243
+ };
244
+
245
+
246
+
247
+ static const DWORD FineLinearSlideUpTable[16] =
248
+ {
249
+ 65536, 65595, 65654, 65714, 65773, 65832, 65892, 65951,
250
+ 66011, 66071, 66130, 66190, 66250, 66309, 66369, 66429
251
+ };
252
+
253
+
254
+ static const DWORD FineLinearSlideDownTable[16] =
255
+ {
256
+ 65535, 65477, 65418, 65359, 65300, 65241, 65182, 65123,
257
+ 65065, 65006, 64947, 64888, 64830, 64772, 64713, 64645
258
+ };
259
+
260
+
261
+ static const DWORD LinearSlideUpTable[256] =
262
+ {
263
+ 65536, 65773, 66010, 66249, 66489, 66729, 66971, 67213,
264
+ 67456, 67700, 67945, 68190, 68437, 68685, 68933, 69182,
265
+ 69432, 69684, 69936, 70189, 70442, 70697, 70953, 71209,
266
+ 71467, 71725, 71985, 72245, 72507, 72769, 73032, 73296,
267
+ 73561, 73827, 74094, 74362, 74631, 74901, 75172, 75444,
268
+ 75717, 75991, 76265, 76541, 76818, 77096, 77375, 77655,
269
+ 77935, 78217, 78500, 78784, 79069, 79355, 79642, 79930,
270
+ 80219, 80509, 80800, 81093, 81386, 81680, 81976, 82272,
271
+ 82570, 82868, 83168, 83469, 83771, 84074, 84378, 84683,
272
+ 84989, 85297, 85605, 85915, 86225, 86537, 86850, 87164,
273
+ 87480, 87796, 88113, 88432, 88752, 89073, 89395, 89718,
274
+ 90043, 90369, 90695, 91023, 91353, 91683, 92015, 92347,
275
+ 92681, 93017, 93353, 93691, 94029, 94370, 94711, 95053,
276
+ 95397, 95742, 96088, 96436, 96785, 97135, 97486, 97839,
277
+ 98193, 98548, 98904, 99262, 99621, 99981, 100343, 100706,
278
+ 101070, 101435, 101802, 102170, 102540, 102911, 103283, 103657,
279
+ 104031, 104408, 104785, 105164, 105545, 105926, 106309, 106694,
280
+ 107080, 107467, 107856, 108246, 108637, 109030, 109425, 109820,
281
+ 110217, 110616, 111016, 111418, 111821, 112225, 112631, 113038,
282
+ 113447, 113857, 114269, 114682, 115097, 115514, 115931, 116351,
283
+ 116771, 117194, 117618, 118043, 118470, 118898, 119328, 119760,
284
+ 120193, 120628, 121064, 121502, 121941, 122382, 122825, 123269,
285
+ 123715, 124162, 124611, 125062, 125514, 125968, 126424, 126881,
286
+ 127340, 127801, 128263, 128727, 129192, 129660, 130129, 130599,
287
+ 131072, 131546, 132021, 132499, 132978, 133459, 133942, 134426,
288
+ 134912, 135400, 135890, 136381, 136875, 137370, 137866, 138365,
289
+ 138865, 139368, 139872, 140378, 140885, 141395, 141906, 142419,
290
+ 142935, 143451, 143970, 144491, 145014, 145538, 146064, 146593,
291
+ 147123, 147655, 148189, 148725, 149263, 149803, 150344, 150888,
292
+ 151434, 151982, 152531, 153083, 153637, 154192, 154750, 155310,
293
+ 155871, 156435, 157001, 157569, 158138, 158710, 159284, 159860,
294
+ 160439, 161019, 161601, 162186, 162772, 163361, 163952, 164545,
295
+ };
296
+
297
+
298
+ static const DWORD LinearSlideDownTable[256] =
299
+ {
300
+ 65536, 65299, 65064, 64830, 64596, 64363, 64131, 63900,
301
+ 63670, 63440, 63212, 62984, 62757, 62531, 62305, 62081,
302
+ 61857, 61634, 61412, 61191, 60970, 60751, 60532, 60314,
303
+ 60096, 59880, 59664, 59449, 59235, 59021, 58809, 58597,
304
+ 58385, 58175, 57965, 57757, 57548, 57341, 57134, 56928,
305
+ 56723, 56519, 56315, 56112, 55910, 55709, 55508, 55308,
306
+ 55108, 54910, 54712, 54515, 54318, 54123, 53928, 53733,
307
+
308
+ 53540, 53347, 53154, 52963, 52772, 52582, 52392, 52204,
309
+ 52015, 51828, 51641, 51455, 51270, 51085, 50901, 50717,
310
+ 50535, 50353, 50171, 49990, 49810, 49631, 49452, 49274,
311
+ 49096, 48919, 48743, 48567, 48392, 48218, 48044, 47871,
312
+ 47698, 47526, 47355, 47185, 47014, 46845, 46676, 46508,
313
+ 46340, 46173, 46007, 45841, 45676, 45511, 45347, 45184,
314
+ 45021, 44859, 44697, 44536, 44376, 44216, 44056, 43898,
315
+ 43740, 43582, 43425, 43268, 43112, 42957, 42802, 42648,
316
+ 42494, 42341, 42189, 42037, 41885, 41734, 41584, 41434,
317
+ 41285, 41136, 40988, 40840, 40693, 40546, 40400, 40254,
318
+ 40109, 39965, 39821, 39677, 39534, 39392, 39250, 39108,
319
+ 38967, 38827, 38687, 38548, 38409, 38270, 38132, 37995,
320
+ 37858, 37722, 37586, 37450, 37315, 37181, 37047, 36913,
321
+ 36780, 36648, 36516, 36384, 36253, 36122, 35992, 35862,
322
+ 35733, 35604, 35476, 35348, 35221, 35094, 34968, 34842,
323
+ 34716, 34591, 34466, 34342, 34218, 34095, 33972, 33850,
324
+ 33728, 33606, 33485, 33364, 33244, 33124, 33005, 32886,
325
+ 32768, 32649, 32532, 32415, 32298, 32181, 32065, 31950,
326
+ 31835, 31720, 31606, 31492, 31378, 31265, 31152, 31040,
327
+ 30928, 30817, 30706, 30595, 30485, 30375, 30266, 30157,
328
+ 30048, 29940, 29832, 29724, 29617, 29510, 29404, 29298,
329
+ 29192, 29087, 28982, 28878, 28774, 28670, 28567, 28464,
330
+ 28361, 28259, 28157, 28056, 27955, 27854, 27754, 27654,
331
+ 27554, 27455, 27356, 27257, 27159, 27061, 26964, 26866,
332
+ 26770, 26673, 26577, 26481, 26386, 26291, 26196, 26102,
333
+ };
334
+
335
+
336
+ static const int SpectrumSinusTable[256*2] =
337
+ {
338
+ 0, 1, 1, 2, 3, 3, 4, 5, 6, 7, 7, 8, 9, 10, 10, 11,
339
+ 12, 13, 14, 14, 15, 16, 17, 17, 18, 19, 20, 20, 21, 22, 22, 23,
340
+ 24, 25, 25, 26, 27, 28, 28, 29, 30, 30, 31, 32, 32, 33, 34, 34,
341
+ 35, 36, 36, 37, 38, 38, 39, 39, 40, 41, 41, 42, 42, 43, 44, 44,
342
+ 45, 45, 46, 46, 47, 47, 48, 48, 49, 49, 50, 50, 51, 51, 52, 52,
343
+ 53, 53, 53, 54, 54, 55, 55, 55, 56, 56, 57, 57, 57, 58, 58, 58,
344
+ 59, 59, 59, 59, 60, 60, 60, 60, 61, 61, 61, 61, 61, 62, 62, 62,
345
+ 62, 62, 62, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63,
346
+ 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 62, 62,
347
+ 62, 62, 62, 62, 61, 61, 61, 61, 61, 60, 60, 60, 60, 59, 59, 59,
348
+ 59, 58, 58, 58, 57, 57, 57, 56, 56, 55, 55, 55, 54, 54, 53, 53,
349
+ 53, 52, 52, 51, 51, 50, 50, 49, 49, 48, 48, 47, 47, 46, 46, 45,
350
+ 45, 44, 44, 43, 42, 42, 41, 41, 40, 39, 39, 38, 38, 37, 36, 36,
351
+ 35, 34, 34, 33, 32, 32, 31, 30, 30, 29, 28, 28, 27, 26, 25, 25,
352
+ 24, 23, 22, 22, 21, 20, 20, 19, 18, 17, 17, 16, 15, 14, 14, 13,
353
+ 12, 11, 10, 10, 9, 8, 7, 7, 6, 5, 4, 3, 3, 2, 1, 0,
354
+ 0, -1, -1, -2, -3, -3, -4, -5, -6, -7, -7, -8, -9, -10, -10, -11,
355
+ -12, -13, -14, -14, -15, -16, -17, -17, -18, -19, -20, -20, -21, -22, -22, -23,
356
+ -24, -25, -25, -26, -27, -28, -28, -29, -30, -30, -31, -32, -32, -33, -34, -34,
357
+ -35, -36, -36, -37, -38, -38, -39, -39, -40, -41, -41, -42, -42, -43, -44, -44,
358
+ -45, -45, -46, -46, -47, -47, -48, -48, -49, -49, -50, -50, -51, -51, -52, -52,
359
+ -53, -53, -53, -54, -54, -55, -55, -55, -56, -56, -57, -57, -57, -58, -58, -58,
360
+ -59, -59, -59, -59, -60, -60, -60, -60, -61, -61, -61, -61, -61, -62, -62, -62,
361
+ -62, -62, -62, -63, -63, -63, -63, -63, -63, -63, -63, -63, -63, -63, -63, -63,
362
+ -63, -63, -63, -63, -63, -63, -63, -63, -63, -63, -63, -63, -63, -63, -62, -62,
363
+ -62, -62, -62, -62, -61, -61, -61, -61, -61, -60, -60, -60, -60, -59, -59, -59,
364
+ -59, -58, -58, -58, -57, -57, -57, -56, -56, -55, -55, -55, -54, -54, -53, -53,
365
+ -53, -52, -52, -51, -51, -50, -50, -49, -49, -48, -48, -47, -47, -46, -46, -45,
366
+ -45, -44, -44, -43, -42, -42, -41, -41, -40, -39, -39, -38, -38, -37, -36, -36,
367
+ -35, -34, -34, -33, -32, -32, -31, -30, -30, -29, -28, -28, -27, -26, -25, -25,
368
+ -24, -23, -22, -22, -21, -20, -20, -19, -18, -17, -17, -16, -15, -14, -14, -13,
369
+ -12, -11, -10, -10, -9, -8, -7, -7, -6, -5, -4, -3, -3, -2, -1, 0,
370
+ };
371
+
@@ -267,6 +267,11 @@ extern stb_vorbis * stb_vorbis_open_file_section(FILE *f, int close_handle_on_cl
267
267
  // confused.
268
268
  #endif
269
269
 
270
+ #ifdef __SDL_SOUND_INTERNAL__
271
+ extern stb_vorbis * stb_vorbis_open_rwops_section(SDL_RWops *rwops, int close_on_free, int *error, const stb_vorbis_alloc *alloc, unsigned int length);
272
+ extern stb_vorbis * stb_vorbis_open_rwops(SDL_RWops *rwops, int close_on_free, int *error, const stb_vorbis_alloc *alloc);
273
+ #endif
274
+
270
275
  extern int stb_vorbis_seek_frame(stb_vorbis *f, unsigned int sample_number);
271
276
  extern int stb_vorbis_seek(stb_vorbis *f, unsigned int sample_number);
272
277
  // these functions seek in the Vorbis file to (approximately) 'sample_number'.
@@ -563,31 +568,34 @@ enum STBVorbisError
563
568
  #include <alloca.h>
564
569
  #endif
565
570
  #else // STB_VORBIS_NO_CRT
571
+ #ifndef NULL
566
572
  #define NULL 0
573
+ #endif
574
+ #ifndef malloc
567
575
  #define malloc(s) 0
576
+ #endif
577
+ #ifndef free
568
578
  #define free(s) ((void) 0)
579
+ #endif
580
+ #ifndef realloc
569
581
  #define realloc(s) 0
582
+ #endif
570
583
  #endif // STB_VORBIS_NO_CRT
571
584
 
572
585
  #include <limits.h>
573
586
 
574
587
  #ifdef __MINGW32__
575
- // eff you mingw:
576
- // "fixed":
577
- // http://sourceforge.net/p/mingw-w64/mailman/message/32882927/
578
- // "no that broke the build, reverted, who cares about C":
579
- // http://sourceforge.net/p/mingw-w64/mailman/message/32890381/
580
- #ifdef __forceinline
581
- #undef __forceinline
582
- #endif
583
- #define __forceinline
584
588
  #define alloca __builtin_alloca
585
- #elif !defined(_MSC_VER)
586
- #if __GNUC__
587
- #define __forceinline inline
588
- #else
589
- #define __forceinline
590
- #endif
589
+ #endif
590
+
591
+ #ifndef STB_FORCEINLINE
592
+ #if defined(_MSC_VER)
593
+ #define STB_FORCEINLINE __forceinline
594
+ #elif defined(__GNUC__) || defined(__clang__)
595
+ #define STB_FORCEINLINE __attribute__((always_inline))
596
+ #else
597
+ #define STB_FORCEINLINE
598
+ #endif
591
599
  #endif
592
600
 
593
601
  #if STB_VORBIS_MAX_CHANNELS > 256
@@ -609,13 +617,21 @@ enum STBVorbisError
609
617
  #define MAX_BLOCKSIZE_LOG 13 // from specification
610
618
  #define MAX_BLOCKSIZE (1 << MAX_BLOCKSIZE_LOG)
611
619
 
612
-
620
+ #ifdef __SDL_SOUND_INTERNAL__
621
+ typedef Uint8 uint8;
622
+ typedef Sint8 int8;
623
+ typedef Uint16 uint16;
624
+ typedef Sint16 int16;
625
+ typedef Uint32 uint32;
626
+ typedef Sint32 int32;
627
+ #else
613
628
  typedef unsigned char uint8;
614
629
  typedef signed char int8;
615
630
  typedef unsigned short uint16;
616
631
  typedef signed short int16;
617
632
  typedef unsigned int uint32;
618
633
  typedef signed int int32;
634
+ #endif
619
635
 
620
636
  #ifndef TRUE
621
637
  #define TRUE 1
@@ -762,6 +778,12 @@ struct stb_vorbis
762
778
  int close_on_free;
763
779
  #endif
764
780
 
781
+ #ifdef __SDL_SOUND_INTERNAL__
782
+ SDL_RWops *rwops;
783
+ uint32 rwops_start;
784
+ int close_on_free;
785
+ #endif
786
+
765
787
  uint8 *stream;
766
788
  uint8 *stream_start;
767
789
  uint8 *stream_end;
@@ -956,7 +978,7 @@ static void crc32_init(void)
956
978
  }
957
979
  }
958
980
 
959
- static __forceinline uint32 crc32_update(uint32 crc, uint8 byte)
981
+ STB_FORCEINLINE uint32 crc32_update(uint32 crc, uint8 byte)
960
982
  {
961
983
  return (crc << 8) ^ crc_table[byte ^ (crc >> 24)];
962
984
  }
@@ -1109,11 +1131,13 @@ static void compute_accelerated_huffman(Codebook *c)
1109
1131
  }
1110
1132
  }
1111
1133
 
1134
+ #ifndef STBV_CDECL
1112
1135
  #ifdef _MSC_VER
1113
1136
  #define STBV_CDECL __cdecl
1114
1137
  #else
1115
1138
  #define STBV_CDECL
1116
1139
  #endif
1140
+ #endif
1117
1141
 
1118
1142
  static int STBV_CDECL uint32_compare(const void *p, const void *q)
1119
1143
  {
@@ -1282,7 +1306,9 @@ static int STBV_CDECL point_compare(const void *p, const void *q)
1282
1306
  /////////////////////// END LEAF SETUP FUNCTIONS //////////////////////////
1283
1307
 
1284
1308
 
1285
- #if defined(STB_VORBIS_NO_STDIO)
1309
+ #ifdef __SDL_SOUND_INTERNAL__
1310
+ #define USE_MEMORY(z) FALSE
1311
+ #elif defined(STB_VORBIS_NO_STDIO)
1286
1312
  #define USE_MEMORY(z) TRUE
1287
1313
  #else
1288
1314
  #define USE_MEMORY(z) ((z)->stream)
@@ -1295,6 +1321,14 @@ static uint8 get8(vorb *z)
1295
1321
  return *z->stream++;
1296
1322
  }
1297
1323
 
1324
+ #ifdef __SDL_SOUND_INTERNAL__
1325
+ {
1326
+ uint8 c;
1327
+ if (SDL_RWread(z->rwops, &c, 1, 1) != 1) { z->eof = TRUE; return 0; }
1328
+ return c;
1329
+ }
1330
+ #endif
1331
+
1298
1332
  #ifndef STB_VORBIS_NO_STDIO
1299
1333
  {
1300
1334
  int c = fgetc(z->f);
@@ -1323,6 +1357,14 @@ static int getn(vorb *z, uint8 *data, int n)
1323
1357
  return 1;
1324
1358
  }
1325
1359
 
1360
+ #ifdef __SDL_SOUND_INTERNAL__
1361
+ {
1362
+ if (SDL_RWread(z->rwops, data, n, 1) == 1) { return 1; }
1363
+ z->eof = 1;
1364
+ return 0;
1365
+ }
1366
+ #endif
1367
+
1326
1368
  #ifndef STB_VORBIS_NO_STDIO
1327
1369
  if (fread(data, n, 1, z->f) == 1)
1328
1370
  return 1;
@@ -1340,6 +1382,12 @@ static void skip(vorb *z, int n)
1340
1382
  if (z->stream >= z->stream_end) z->eof = 1;
1341
1383
  return;
1342
1384
  }
1385
+ #ifdef __SDL_SOUND_INTERNAL__
1386
+ {
1387
+ SDL_RWseek(z->rwops, n, RW_SEEK_CUR);
1388
+ }
1389
+ #endif
1390
+
1343
1391
  #ifndef STB_VORBIS_NO_STDIO
1344
1392
  {
1345
1393
  long x = ftell(z->f);
@@ -1364,6 +1412,23 @@ static int set_file_offset(stb_vorbis *f, unsigned int loc)
1364
1412
  return 1;
1365
1413
  }
1366
1414
  }
1415
+
1416
+ #ifdef __SDL_SOUND_INTERNAL__
1417
+ {
1418
+ if (loc + f->rwops_start < loc || loc >= 0x80000000) {
1419
+ loc = 0x7fffffff;
1420
+ f->eof = 1;
1421
+ } else {
1422
+ loc += f->rwops_start;
1423
+ }
1424
+ if (SDL_RWseek(f->rwops, loc, RW_SEEK_SET) != -1)
1425
+ return 1;
1426
+ f->eof = 1;
1427
+ SDL_RWseek(f->rwops, f->rwops_start, RW_SEEK_END);
1428
+ return 0;
1429
+ }
1430
+ #endif
1431
+
1367
1432
  #ifndef STB_VORBIS_NO_STDIO
1368
1433
  if (loc + f->f_start < loc || loc >= 0x80000000) {
1369
1434
  loc = 0x7fffffff;
@@ -1574,7 +1639,7 @@ static uint32 get_bits(vorb *f, int n)
1574
1639
  // expand the buffer to as many bits as possible without reading off end of packet
1575
1640
  // it might be nice to allow f->valid_bits and f->acc to be stored in registers,
1576
1641
  // e.g. cache them locally and decode locally
1577
- static __forceinline void prep_huffman(vorb *f)
1642
+ STB_FORCEINLINE void prep_huffman(vorb *f)
1578
1643
  {
1579
1644
  if (f->valid_bits <= 24) {
1580
1645
  if (f->valid_bits == 0) f->acc = 0;
@@ -1974,7 +2039,7 @@ static float inverse_db_table[256] =
1974
2039
  int8 integer_divide_table[DIVTAB_NUMER][DIVTAB_DENOM]; // 2KB
1975
2040
  #endif
1976
2041
 
1977
- static __forceinline void draw_line(float *output, int x0, int y0, int x1, int y1, int n)
2042
+ STB_FORCEINLINE void draw_line(float *output, int x0, int y0, int x1, int y1, int n)
1978
2043
  {
1979
2044
  int dy = y1 - y0;
1980
2045
  int adx = x1 - x0;
@@ -2386,7 +2451,7 @@ void inverse_mdct(float *buffer, int n, vorb *f, int blocktype)
2386
2451
 
2387
2452
 
2388
2453
  // the following were split out into separate functions while optimizing;
2389
- // they could be pushed back up but eh. __forceinline showed no change;
2454
+ // they could be pushed back up but eh. STB_FORCEINLINE showed no change;
2390
2455
  // they're probably already being inlined.
2391
2456
  static void imdct_step3_iter0_loop(int n, float *e, int i_off, int k_off, float *A)
2392
2457
  {
@@ -2534,7 +2599,7 @@ static void imdct_step3_inner_s_loop(int n, float *e, int i_off, int k_off, floa
2534
2599
  }
2535
2600
  }
2536
2601
 
2537
- static __forceinline void iter_54(float *z)
2602
+ STB_FORCEINLINE void iter_54(float *z)
2538
2603
  {
2539
2604
  float k00,k11,k22,k33;
2540
2605
  float y0,y1,y2,y3;
@@ -4169,6 +4234,9 @@ static void vorbis_deinit(stb_vorbis *p)
4169
4234
  setup_free(p, p->window[i]);
4170
4235
  setup_free(p, p->bit_reverse[i]);
4171
4236
  }
4237
+ #ifdef __SDL_SOUND_INTERNAL__
4238
+ if (p->close_on_free) SDL_RWclose(p->rwops);
4239
+ #endif
4172
4240
  #ifndef STB_VORBIS_NO_STDIO
4173
4241
  if (p->close_on_free) fclose(p->f);
4174
4242
  #endif
@@ -4194,6 +4262,10 @@ static void vorbis_init(stb_vorbis *p, const stb_vorbis_alloc *z)
4194
4262
  p->stream = NULL;
4195
4263
  p->codebooks = NULL;
4196
4264
  p->page_crc_tests = -1;
4265
+ #ifdef __SDL_SOUND_INTERNAL__
4266
+ p->close_on_free = FALSE;
4267
+ p->rwops = NULL;
4268
+ #endif
4197
4269
  #ifndef STB_VORBIS_NO_STDIO
4198
4270
  p->close_on_free = FALSE;
4199
4271
  p->f = NULL;
@@ -4444,6 +4516,9 @@ unsigned int stb_vorbis_get_file_offset(stb_vorbis *f)
4444
4516
  if (f->push_mode) return 0;
4445
4517
  #endif
4446
4518
  if (USE_MEMORY(f)) return (unsigned int) (f->stream - f->stream_start);
4519
+ #ifdef __SDL_SOUND_INTERNAL__
4520
+ return (unsigned int) (SDL_RWtell(f->rwops) - f->rwops_start);
4521
+ #endif
4447
4522
  #ifndef STB_VORBIS_NO_STDIO
4448
4523
  return (unsigned int) (ftell(f->f) - f->f_start);
4449
4524
  #endif
@@ -4981,6 +5056,36 @@ stb_vorbis * stb_vorbis_open_filename(const char *filename, int *error, const st
4981
5056
  }
4982
5057
  #endif // STB_VORBIS_NO_STDIO
4983
5058
 
5059
+ #ifdef __SDL_SOUND_INTERNAL__
5060
+ stb_vorbis * stb_vorbis_open_rwops_section(SDL_RWops *rwops, int close_on_free, int *error, const stb_vorbis_alloc *alloc, unsigned int length)
5061
+ {
5062
+ stb_vorbis *f, p;
5063
+ vorbis_init(&p, alloc);
5064
+ p.rwops = rwops;
5065
+ p.rwops_start = (uint32) SDL_RWtell(rwops);
5066
+ p.stream_len = length;
5067
+ p.close_on_free = close_on_free;
5068
+ if (start_decoder(&p)) {
5069
+ f = vorbis_alloc(&p);
5070
+ if (f) {
5071
+ memcpy(f, &p, sizeof (stb_vorbis));
5072
+ vorbis_pump_first_frame(f);
5073
+ return f;
5074
+ }
5075
+ }
5076
+ if (error) *error = p.error;
5077
+ vorbis_deinit(&p);
5078
+ return NULL;
5079
+ }
5080
+
5081
+ stb_vorbis * stb_vorbis_open_rwops(SDL_RWops *rwops, int close_on_free, int *error, const stb_vorbis_alloc *alloc)
5082
+ {
5083
+ const unsigned int start = (unsigned int) SDL_RWtell(rwops);
5084
+ const unsigned int len = (unsigned int) (SDL_RWsize(rwops) - start);
5085
+ return stb_vorbis_open_rwops_section(rwops, close_on_free, error, alloc, len);
5086
+ }
5087
+ #endif
5088
+
4984
5089
  stb_vorbis * stb_vorbis_open_memory(const unsigned char *data, int len, int *error, const stb_vorbis_alloc *alloc)
4985
5090
  {
4986
5091
  stb_vorbis *f, p;
@@ -4994,7 +5099,7 @@ stb_vorbis * stb_vorbis_open_memory(const unsigned char *data, int len, int *err
4994
5099
  if (start_decoder(&p)) {
4995
5100
  f = vorbis_alloc(&p);
4996
5101
  if (f) {
4997
- *f = p;
5102
+ memcpy(f, &p, sizeof (stb_vorbis));
4998
5103
  vorbis_pump_first_frame(f);
4999
5104
  if (error) *error = VORBIS__no_error;
5000
5105
  return f;