gosu 1.5.0 → 2.0.0.pre6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (241) hide show
  1. checksums.yaml +4 -4
  2. data/dependencies/SDL/include/SDL.h +233 -0
  3. data/dependencies/SDL/include/SDL_assert.h +320 -0
  4. data/dependencies/SDL/include/SDL_atomic.h +414 -0
  5. data/dependencies/SDL/include/SDL_audio.h +1500 -0
  6. data/dependencies/SDL/include/{SDL3/SDL_bits.h → SDL_bits.h} +27 -47
  7. data/dependencies/SDL/include/{SDL3/SDL_blendmode.h → SDL_blendmode.h} +55 -59
  8. data/dependencies/SDL/include/SDL_clipboard.h +141 -0
  9. data/dependencies/SDL/include/SDL_config.h +331 -0
  10. data/dependencies/SDL/include/SDL_cpuinfo.h +594 -0
  11. data/dependencies/SDL/include/{SDL3/SDL_egl.h → SDL_egl.h} +8 -11
  12. data/dependencies/SDL/include/SDL_endian.h +348 -0
  13. data/dependencies/SDL/include/SDL_error.h +163 -0
  14. data/dependencies/SDL/include/SDL_events.h +1166 -0
  15. data/dependencies/SDL/include/SDL_filesystem.h +149 -0
  16. data/dependencies/SDL/include/SDL_gamecontroller.h +1074 -0
  17. data/dependencies/SDL/include/SDL_gesture.h +117 -0
  18. data/dependencies/SDL/include/SDL_guid.h +100 -0
  19. data/dependencies/SDL/include/SDL_haptic.h +1341 -0
  20. data/dependencies/SDL/include/SDL_hidapi.h +451 -0
  21. data/dependencies/SDL/include/SDL_hints.h +2613 -0
  22. data/dependencies/SDL/include/SDL_joystick.h +1069 -0
  23. data/dependencies/SDL/include/SDL_keyboard.h +353 -0
  24. data/dependencies/SDL/include/SDL_keycode.h +358 -0
  25. data/dependencies/SDL/include/SDL_loadso.h +115 -0
  26. data/dependencies/SDL/include/{SDL3/SDL_locale.h → SDL_locale.h} +24 -40
  27. data/dependencies/SDL/include/SDL_log.h +404 -0
  28. data/dependencies/SDL/include/SDL_main.h +282 -0
  29. data/dependencies/SDL/include/{SDL3/SDL_messagebox.h → SDL_messagebox.h} +48 -85
  30. data/dependencies/SDL/include/{SDL3/SDL_metal.h → SDL_metal.h} +29 -29
  31. data/dependencies/SDL/include/{SDL3/SDL_misc.h → SDL_misc.h} +12 -13
  32. data/dependencies/SDL/include/SDL_mouse.h +464 -0
  33. data/dependencies/SDL/include/SDL_mutex.h +545 -0
  34. data/dependencies/SDL/include/SDL_name.h +33 -0
  35. data/dependencies/SDL/include/{SDL3/SDL_opengl.h → SDL_opengl.h} +252 -1221
  36. data/dependencies/SDL/include/{SDL3/SDL_opengles.h → SDL_opengles.h} +7 -6
  37. data/dependencies/SDL/include/{SDL3/SDL_opengles2.h → SDL_opengles2.h} +11 -10
  38. data/dependencies/SDL/include/SDL_pixels.h +644 -0
  39. data/dependencies/SDL/include/SDL_platform.h +261 -0
  40. data/dependencies/SDL/include/{SDL3/SDL_power.h → SDL_power.h} +19 -40
  41. data/dependencies/SDL/include/SDL_quit.h +58 -0
  42. data/dependencies/SDL/include/SDL_rect.h +376 -0
  43. data/dependencies/SDL/include/SDL_render.h +1924 -0
  44. data/dependencies/SDL/include/SDL_revision.h +7 -0
  45. data/dependencies/SDL/include/SDL_rwops.h +841 -0
  46. data/dependencies/SDL/include/{SDL3/SDL_scancode.h → SDL_scancode.h} +68 -60
  47. data/dependencies/SDL/include/SDL_sensor.h +322 -0
  48. data/dependencies/SDL/include/SDL_shape.h +155 -0
  49. data/dependencies/SDL/include/SDL_stdinc.h +838 -0
  50. data/dependencies/SDL/include/SDL_surface.h +997 -0
  51. data/dependencies/SDL/include/SDL_system.h +623 -0
  52. data/dependencies/SDL/include/SDL_syswm.h +386 -0
  53. data/dependencies/SDL/include/{SDL3/SDL_test.h → SDL_test.h} +22 -16
  54. data/dependencies/SDL/include/{SDL3/SDL_test_assert.h → SDL_test_assert.h} +34 -27
  55. data/dependencies/SDL/include/{SDL3/SDL_test_common.h → SDL_test_common.h} +52 -109
  56. data/dependencies/SDL/include/{SDL3/SDL_test_compare.h → SDL_test_compare.h} +14 -22
  57. data/dependencies/SDL/include/{SDL3/SDL_test_crc32.h → SDL_test_crc32.h} +30 -27
  58. data/dependencies/SDL/include/{SDL3/SDL_test_font.h → SDL_test_font.h} +49 -50
  59. data/dependencies/SDL/include/{SDL3/SDL_test_fuzzer.h → SDL_test_fuzzer.h} +79 -64
  60. data/dependencies/SDL/include/{SDL3/SDL_test_harness.h → SDL_test_harness.h} +30 -47
  61. data/dependencies/SDL/include/SDL_test_images.h +78 -0
  62. data/dependencies/SDL/include/{SDL3/SDL_platform.h → SDL_test_log.h} +26 -25
  63. data/dependencies/SDL/include/{SDL3/SDL_test_md5.h → SDL_test_md5.h} +28 -21
  64. data/dependencies/SDL/include/{SDL3/SDL_test_memory.h → SDL_test_memory.h} +16 -19
  65. data/dependencies/SDL/include/SDL_test_random.h +115 -0
  66. data/dependencies/SDL/include/SDL_thread.h +464 -0
  67. data/dependencies/SDL/include/SDL_timer.h +222 -0
  68. data/dependencies/SDL/include/SDL_touch.h +150 -0
  69. data/dependencies/SDL/include/{SDL3/SDL_copying.h → SDL_types.h} +9 -2
  70. data/dependencies/SDL/include/SDL_version.h +204 -0
  71. data/dependencies/SDL/include/SDL_video.h +2178 -0
  72. data/dependencies/SDL/include/SDL_vulkan.h +215 -0
  73. data/dependencies/SDL/include/begin_code.h +187 -0
  74. data/dependencies/SDL/include/{SDL3/SDL_close_code.h → close_code.h} +6 -7
  75. data/dependencies/SDL/lib/x64/libSDL2.dll.a +0 -0
  76. data/dependencies/SDL/lib/x86/libSDL2.dll.a +0 -0
  77. data/dependencies/SDL_sound/SDL_sound.c +215 -136
  78. data/dependencies/SDL_sound/SDL_sound.h +725 -0
  79. data/dependencies/SDL_sound/SDL_sound_aiff.c +54 -55
  80. data/dependencies/SDL_sound/SDL_sound_au.c +32 -32
  81. data/dependencies/SDL_sound/SDL_sound_coreaudio.c +41 -24
  82. data/dependencies/SDL_sound/SDL_sound_flac.c +12 -32
  83. data/dependencies/SDL_sound/SDL_sound_internal.h +48 -33
  84. data/dependencies/SDL_sound/SDL_sound_modplug.c +29 -21
  85. data/dependencies/SDL_sound/SDL_sound_mp3.c +13 -35
  86. data/dependencies/SDL_sound/SDL_sound_raw.c +15 -14
  87. data/dependencies/SDL_sound/SDL_sound_shn.c +82 -82
  88. data/dependencies/SDL_sound/SDL_sound_voc.c +30 -30
  89. data/dependencies/SDL_sound/SDL_sound_vorbis.c +25 -34
  90. data/dependencies/SDL_sound/SDL_sound_wav.c +82 -86
  91. data/dependencies/SDL_sound/dr_flac.h +1281 -1845
  92. data/dependencies/SDL_sound/dr_mp3.h +617 -1035
  93. data/dependencies/SDL_sound/libmodplug/fastmix.c +1 -1
  94. data/dependencies/SDL_sound/libmodplug/libmodplug.h +4 -5
  95. data/dependencies/SDL_sound/libmodplug/load_ams.c +3 -6
  96. data/dependencies/SDL_sound/libmodplug/load_dsm.c +1 -2
  97. data/dependencies/SDL_sound/libmodplug/load_mt2.c +2 -2
  98. data/dependencies/SDL_sound/libmodplug/modplug.h +1 -2
  99. data/dependencies/SDL_sound/libmodplug/snd_fx.c +3 -3
  100. data/dependencies/SDL_sound/libmodplug/sndfile.c +0 -3
  101. data/dependencies/SDL_sound/libmodplug/sndmix.c +3 -7
  102. data/dependencies/SDL_sound/stb_vorbis.h +343 -397
  103. data/dependencies/mojoAL/AL/alc.h +2 -2
  104. data/dependencies/mojoAL/mojoal.c +1878 -2113
  105. data/dependencies/stb/stb_image.h +1381 -1192
  106. data/dependencies/stb/stb_image_write.h +129 -329
  107. data/dependencies/stb/stb_truetype.h +60 -304
  108. data/dependencies/utf8proc/utf8proc.c +75 -133
  109. data/dependencies/utf8proc/utf8proc.h +50 -131
  110. data/dependencies/utf8proc/utf8proc_data.h +15658 -16213
  111. data/ext/gosu-ffi/extconf.rb +28 -11
  112. data/ext/gosu-ffi/gosu-ffi.def +0 -3
  113. data/ffi/Gosu.cpp +29 -52
  114. data/ffi/Gosu.h +4 -4
  115. data/ffi/Gosu_Color.cpp +36 -80
  116. data/ffi/Gosu_FFI_internal.h +13 -12
  117. data/ffi/Gosu_Font.cpp +11 -16
  118. data/ffi/Gosu_Font.h +4 -4
  119. data/ffi/Gosu_Image.cpp +36 -69
  120. data/ffi/Gosu_Image.h +5 -16
  121. data/include/Gosu/Bitmap.hpp +1 -1
  122. data/include/Gosu/Color.hpp +4 -5
  123. data/include/Gosu/Graphics.hpp +0 -2
  124. data/include/Gosu/Image.hpp +1 -1
  125. data/include/Gosu/Math.hpp +5 -5
  126. data/include/Gosu/Utility.hpp +1 -27
  127. data/include/Gosu/Version.hpp +2 -2
  128. data/lib/SDL2.dll +0 -0
  129. data/lib/gosu/channel.rb +0 -1
  130. data/lib/gosu/color.rb +13 -36
  131. data/lib/gosu/compat.rb +14 -106
  132. data/lib/gosu/constants.rb +24 -24
  133. data/lib/gosu/ffi.rb +13 -24
  134. data/lib/gosu/font.rb +13 -19
  135. data/lib/gosu/gosu.rb +61 -101
  136. data/lib/gosu/image.rb +34 -72
  137. data/lib/gosu/sample.rb +0 -1
  138. data/lib/gosu/song.rb +0 -1
  139. data/lib/gosu/text_input.rb +1 -15
  140. data/lib/gosu/window.rb +10 -31
  141. data/lib64/SDL2.dll +0 -0
  142. data/rdoc/gosu.rb +0 -2
  143. data/src/Audio.cpp +16 -22
  144. data/src/AudioFileSDLSound.cpp +5 -5
  145. data/src/BinPacker.cpp +4 -5
  146. data/src/Bitmap.cpp +9 -16
  147. data/src/Buffer.cpp +14 -5
  148. data/src/ClipRectStack.hpp +83 -17
  149. data/src/Directories.cpp +1 -1
  150. data/src/DrawOp.hpp +17 -14
  151. data/src/DrawOpQueue.hpp +31 -25
  152. data/src/Font.cpp +1 -1
  153. data/src/GosuGLView.cpp +7 -1
  154. data/src/Graphics.cpp +25 -32
  155. data/src/GraphicsImpl.hpp +24 -0
  156. data/src/Image.cpp +2 -2
  157. data/src/Input.cpp +70 -66
  158. data/src/Macro.cpp +26 -43
  159. data/src/Macro.hpp +16 -22
  160. data/src/Math.cpp +7 -20
  161. data/src/OffScreenTarget.cpp +10 -3
  162. data/src/OpenGLContext.cpp +8 -7
  163. data/src/OpenGLContext.hpp +2 -2
  164. data/src/RenderState.hpp +54 -30
  165. data/src/Resolution.cpp +38 -48
  166. data/src/TexChunk.cpp +2 -2
  167. data/src/TextInput.cpp +9 -9
  168. data/src/Texture.cpp +1 -1
  169. data/src/TiledDrawable.cpp +7 -6
  170. data/src/TrueTypeFontUnix.cpp +9 -12
  171. data/src/Utility.cpp +26 -39
  172. data/src/UtilityWin.cpp +2 -6
  173. data/src/Window.cpp +34 -54
  174. metadata +93 -99
  175. data/dependencies/SDL/include/SDL3/SDL.h +0 -91
  176. data/dependencies/SDL/include/SDL3/SDL_assert.h +0 -710
  177. data/dependencies/SDL/include/SDL3/SDL_asyncio.h +0 -550
  178. data/dependencies/SDL/include/SDL3/SDL_atomic.h +0 -692
  179. data/dependencies/SDL/include/SDL3/SDL_audio.h +0 -2382
  180. data/dependencies/SDL/include/SDL3/SDL_begin_code.h +0 -553
  181. data/dependencies/SDL/include/SDL3/SDL_camera.h +0 -535
  182. data/dependencies/SDL/include/SDL3/SDL_clipboard.h +0 -331
  183. data/dependencies/SDL/include/SDL3/SDL_cpuinfo.h +0 -374
  184. data/dependencies/SDL/include/SDL3/SDL_dialog.h +0 -343
  185. data/dependencies/SDL/include/SDL3/SDL_dlopennote.h +0 -234
  186. data/dependencies/SDL/include/SDL3/SDL_endian.h +0 -645
  187. data/dependencies/SDL/include/SDL3/SDL_error.h +0 -226
  188. data/dependencies/SDL/include/SDL3/SDL_events.h +0 -1651
  189. data/dependencies/SDL/include/SDL3/SDL_filesystem.h +0 -537
  190. data/dependencies/SDL/include/SDL3/SDL_gamepad.h +0 -1657
  191. data/dependencies/SDL/include/SDL3/SDL_gpu.h +0 -4637
  192. data/dependencies/SDL/include/SDL3/SDL_guid.h +0 -106
  193. data/dependencies/SDL/include/SDL3/SDL_haptic.h +0 -1461
  194. data/dependencies/SDL/include/SDL3/SDL_hidapi.h +0 -571
  195. data/dependencies/SDL/include/SDL3/SDL_hints.h +0 -5041
  196. data/dependencies/SDL/include/SDL3/SDL_init.h +0 -508
  197. data/dependencies/SDL/include/SDL3/SDL_intrin.h +0 -410
  198. data/dependencies/SDL/include/SDL3/SDL_iostream.h +0 -1379
  199. data/dependencies/SDL/include/SDL3/SDL_joystick.h +0 -1385
  200. data/dependencies/SDL/include/SDL3/SDL_keyboard.h +0 -615
  201. data/dependencies/SDL/include/SDL3/SDL_keycode.h +0 -348
  202. data/dependencies/SDL/include/SDL3/SDL_loadso.h +0 -145
  203. data/dependencies/SDL/include/SDL3/SDL_log.h +0 -541
  204. data/dependencies/SDL/include/SDL3/SDL_main.h +0 -704
  205. data/dependencies/SDL/include/SDL3/SDL_main_impl.h +0 -149
  206. data/dependencies/SDL/include/SDL3/SDL_mouse.h +0 -813
  207. data/dependencies/SDL/include/SDL3/SDL_mutex.h +0 -1117
  208. data/dependencies/SDL/include/SDL3/SDL_oldnames.h +0 -1339
  209. data/dependencies/SDL/include/SDL3/SDL_pen.h +0 -198
  210. data/dependencies/SDL/include/SDL3/SDL_pixels.h +0 -1441
  211. data/dependencies/SDL/include/SDL3/SDL_platform_defines.h +0 -497
  212. data/dependencies/SDL/include/SDL3/SDL_process.h +0 -441
  213. data/dependencies/SDL/include/SDL3/SDL_properties.h +0 -572
  214. data/dependencies/SDL/include/SDL3/SDL_rect.h +0 -528
  215. data/dependencies/SDL/include/SDL3/SDL_render.h +0 -3034
  216. data/dependencies/SDL/include/SDL3/SDL_revision.h +0 -56
  217. data/dependencies/SDL/include/SDL3/SDL_sensor.h +0 -321
  218. data/dependencies/SDL/include/SDL3/SDL_stdinc.h +0 -6186
  219. data/dependencies/SDL/include/SDL3/SDL_storage.h +0 -686
  220. data/dependencies/SDL/include/SDL3/SDL_surface.h +0 -1769
  221. data/dependencies/SDL/include/SDL3/SDL_system.h +0 -840
  222. data/dependencies/SDL/include/SDL3/SDL_test_log.h +0 -83
  223. data/dependencies/SDL/include/SDL3/SDL_thread.h +0 -602
  224. data/dependencies/SDL/include/SDL3/SDL_time.h +0 -249
  225. data/dependencies/SDL/include/SDL3/SDL_timer.h +0 -454
  226. data/dependencies/SDL/include/SDL3/SDL_touch.h +0 -184
  227. data/dependencies/SDL/include/SDL3/SDL_tray.h +0 -544
  228. data/dependencies/SDL/include/SDL3/SDL_version.h +0 -198
  229. data/dependencies/SDL/include/SDL3/SDL_video.h +0 -3497
  230. data/dependencies/SDL/include/SDL3/SDL_vulkan.h +0 -287
  231. data/dependencies/SDL/lib/x64/libSDL3.dll.a +0 -0
  232. data/dependencies/SDL/lib/x86/libSDL3.dll.a +0 -0
  233. data/dependencies/SDL_sound/SDL3_sound/SDL_sound.h +0 -755
  234. data/lib/SDL3.dll +0 -0
  235. data/lib64/SDL3.dll +0 -0
  236. data/src/ClipRectStack.cpp +0 -38
  237. /data/dependencies/SDL/include/{SDL3/SDL_opengl_glext.h → SDL_opengl_glext.h} +0 -0
  238. /data/dependencies/SDL/include/{SDL3/SDL_opengles2_gl2.h → SDL_opengles2_gl2.h} +0 -0
  239. /data/dependencies/SDL/include/{SDL3/SDL_opengles2_gl2ext.h → SDL_opengles2_gl2ext.h} +0 -0
  240. /data/dependencies/SDL/include/{SDL3/SDL_opengles2_gl2platform.h → SDL_opengles2_gl2platform.h} +0 -0
  241. /data/dependencies/SDL/include/{SDL3/SDL_opengles2_khrplatform.h → SDL_opengles2_khrplatform.h} +0 -0
@@ -44,13 +44,13 @@ static size_t flac_read(void* pUserData, void* pBufferOut, size_t bytesToRead)
44
44
  Uint8 *ptr = (Uint8 *) pBufferOut;
45
45
  Sound_Sample *sample = (Sound_Sample *) pUserData;
46
46
  Sound_SampleInternal *internal = (Sound_SampleInternal *) sample->opaque;
47
- SDL_IOStream *io = internal->io;
47
+ SDL_RWops *rwops = internal->rw;
48
48
  size_t retval = 0;
49
49
 
50
50
  /* !!! FIXME: dr_flac treats returning less than bytesToRead as EOF. So we can't EAGAIN. */
51
51
  while (bytesToRead)
52
52
  {
53
- const size_t rc = SDL_ReadIO(io, ptr, bytesToRead);
53
+ const size_t rc = SDL_RWread(rwops, ptr, 1, bytesToRead);
54
54
  if (rc == 0) break;
55
55
  bytesToRead -= rc;
56
56
  retval += rc;
@@ -62,36 +62,16 @@ static size_t flac_read(void* pUserData, void* pBufferOut, size_t bytesToRead)
62
62
 
63
63
  static drflac_bool32 flac_seek(void* pUserData, int offset, drflac_seek_origin origin)
64
64
  {
65
+ const int whence = (origin == drflac_seek_origin_start) ? RW_SEEK_SET : RW_SEEK_CUR;
65
66
  Sound_Sample *sample = (Sound_Sample *) pUserData;
66
67
  Sound_SampleInternal *internal = (Sound_SampleInternal *) sample->opaque;
67
- int whence;
68
- switch (origin) {
69
- case DRFLAC_SEEK_SET:
70
- whence = SDL_IO_SEEK_SET;
71
- break;
72
- case DRFLAC_SEEK_CUR:
73
- whence = SDL_IO_SEEK_CUR;
74
- break;
75
- case DRFLAC_SEEK_END:
76
- whence = SDL_IO_SEEK_END;
77
- break;
78
- default:
79
- return DRFLAC_FALSE;
80
- }
81
- return (SDL_SeekIO(internal->io, offset, whence) != -1) ? DRFLAC_TRUE : DRFLAC_FALSE;
68
+ return (SDL_RWseek(internal->rw, offset, whence) != -1) ? DRFLAC_TRUE : DRFLAC_FALSE;
82
69
  } /* flac_seek */
83
70
 
84
- static drflac_bool32 flac_tell(void* pUserData, drflac_int64* pCursor)
85
- {
86
- Sound_Sample *sample = (Sound_Sample *) pUserData;
87
- Sound_SampleInternal *internal = (Sound_SampleInternal *) sample->opaque;
88
- *pCursor = SDL_TellIO(internal->io);
89
- return (*pCursor != -1) ? DRFLAC_TRUE : DRFLAC_FALSE;
90
- } /* flac_tell */
91
71
 
92
- static bool FLAC_init(void)
72
+ static SDL_bool FLAC_init(void)
93
73
  {
94
- return true; /* always succeeds. */
74
+ return SDL_TRUE; /* always succeeds. */
95
75
  } /* FLAC_init */
96
76
 
97
77
 
@@ -104,7 +84,7 @@ static void FLAC_quit(void)
104
84
  static int FLAC_open(Sound_Sample *sample, const char *ext)
105
85
  {
106
86
  Sound_SampleInternal *internal = (Sound_SampleInternal *) sample->opaque;
107
- drflac *dr = drflac_open(flac_read, flac_seek, flac_tell, sample, NULL);
87
+ drflac *dr = drflac_open(flac_read, flac_seek, sample, NULL);
108
88
 
109
89
  if (!dr)
110
90
  {
@@ -116,16 +96,16 @@ static int FLAC_open(Sound_Sample *sample, const char *ext)
116
96
  sample->flags = SOUND_SAMPLEFLAG_CANSEEK;
117
97
 
118
98
  sample->actual.channels = dr->channels;
119
- sample->actual.freq = dr->sampleRate;
120
- sample->actual.format = SDL_AUDIO_S32; /* dr_flac only does Sint32. */
99
+ sample->actual.rate = dr->sampleRate;
100
+ sample->actual.format = AUDIO_S32SYS; /* dr_flac only does Sint32. */
121
101
 
122
102
  if (dr->totalPCMFrameCount == 0)
123
103
  internal->total_time = -1;
124
104
  else
125
105
  {
126
- const Uint32 freq = (Uint32) dr->sampleRate;
106
+ const Uint32 rate = (Uint32) dr->sampleRate;
127
107
  const Uint64 frames = (Uint64) dr->totalPCMFrameCount;
128
- internal->total_time = (frames / freq) * 1000;
108
+ internal->total_time = (frames / rate) * 1000;
129
109
  internal->total_time += ((dr->totalPCMFrameCount % dr->sampleRate) * 1000) / dr->sampleRate;
130
110
  } /* else */
131
111
 
@@ -165,7 +145,7 @@ static int FLAC_seek(Sound_Sample *sample, Uint32 ms)
165
145
  {
166
146
  Sound_SampleInternal *internal = (Sound_SampleInternal *) sample->opaque;
167
147
  drflac *dr = (drflac *) internal->decoder_private;
168
- const float frames_per_ms = ((float) sample->actual.freq) / 1000.0f;
148
+ const float frames_per_ms = ((float) sample->actual.rate) / 1000.0f;
169
149
  const drflac_uint64 frame_offset = (drflac_uint64) (frames_per_ms * ((float) ms));
170
150
  return (drflac_seek_to_pcm_frame(dr, frame_offset) == DRFLAC_TRUE);
171
151
  } /* FLAC_seek */
@@ -11,14 +11,27 @@
11
11
  * application.
12
12
  */
13
13
 
14
- #ifndef SDL_SOUND_INTERNAL_H_
15
- #define SDL_SOUND_INTERNAL_H_
14
+ #ifndef _INCLUDE_SDL_SOUND_INTERNAL_H_
15
+ #define _INCLUDE_SDL_SOUND_INTERNAL_H_
16
16
 
17
17
  #ifndef __SDL_SOUND_INTERNAL__
18
18
  #error Do not include this header from your applications.
19
19
  #endif
20
20
 
21
- #include <SDL3_sound/SDL_sound.h>
21
+ #include "SDL_sound.h"
22
+
23
+ /* SDL_AudioStream, which we use internally, didn't arrive until SDL 2.0.7. */
24
+ #if !SDL_VERSION_ATLEAST(2, 0, 7)
25
+ #error SDL_sound requires SDL 2.0.7 or later. Please upgrade.
26
+ #endif
27
+
28
+ #if ((defined(__GNUC__) && (__GNUC__ >= 4)) || defined(__clang__)) && !(defined(_WIN32) || defined(__OS2__))
29
+ #define SOUND_HAVE_PRAGMA_VISIBILITY 1
30
+ #endif
31
+
32
+ #if SOUND_HAVE_PRAGMA_VISIBILITY
33
+ #pragma GCC visibility push(hidden)
34
+ #endif
22
35
 
23
36
  #if (defined DEBUG_CHATTER)
24
37
  #define SNDDBG(x) SDL_Log x
@@ -26,17 +39,6 @@
26
39
  #define SNDDBG(x)
27
40
  #endif
28
41
 
29
- /* disable several MS Visual Studio warnings: */
30
- #ifdef _MSC_VER
31
- #pragma warning(disable:4100) /* unreferenced formal parameter */
32
- #pragma warning(disable:4389) /* signed/unsigned mismatch ( <, <=, >, >= ) */
33
- #pragma warning(disable:4018) /* signed/unsigned mismatch ( ==, != ) */
34
- #pragma warning(disable:4127) /* conditional expression is constant. */
35
- #pragma warning(disable:4761) /* integral size mismatch in argument; conversion supplied (for MSVC6 and older.) */
36
- #pragma warning(disable:4244) /* conversion from 'type' to 'int', possible loss of data */
37
- #pragma warning(disable:4267) /* conversion from 'size_t' to 'type', possible loss of data */
38
- #endif
39
-
40
42
  #ifndef SOUND_SUPPORTS_MIDI
41
43
  #define SOUND_SUPPORTS_MIDI 0
42
44
  #endif
@@ -85,7 +87,7 @@
85
87
  * SDL itself only supports mono and stereo output, but hopefully we can
86
88
  * raise this value someday...there's probably a lot of assumptions in
87
89
  * SDL_sound that rely on it, though.
88
- * !!! FIXME: SDL3 supports more channels.
90
+ * !!! FIXME: SDL2 supports more channels.
89
91
  */
90
92
  #define SOUND_MAX_CHANNELS 2
91
93
 
@@ -100,7 +102,7 @@ typedef struct __SOUND_DECODERFUNCTIONS__
100
102
  * set up any global state that your decoder needs, such as
101
103
  * initializing an external library, etc.
102
104
  *
103
- * Return true if initialization is successful, false if
105
+ * Return SDL_TRUE if initialization is successful, SDL_FALSE if
104
106
  * there's a fatal error. If this method fails, then this decoder
105
107
  * is flagged as unavailable until SDL_sound() is shut down and
106
108
  * reinitialized, in which case this method will be tried again.
@@ -109,7 +111,7 @@ typedef struct __SOUND_DECODERFUNCTIONS__
109
111
  * method fails, so if you can't intialize, you'll have to clean
110
112
  * up the half-initialized state in this method.
111
113
  */
112
- bool (*init)(void);
114
+ SDL_bool (*init)(void);
113
115
 
114
116
  /*
115
117
  * This is called during the Sound_Quit() function. Use this to
@@ -141,11 +143,11 @@ typedef struct __SOUND_DECODERFUNCTIONS__
141
143
  * in Sound_SampleInternal section:
142
144
  * Sound_Sample *next; (offlimits)
143
145
  * Sound_Sample *prev; (offlimits)
144
- * SDL_IOStream *io; (can use, but do NOT close it)
146
+ * SDL_RWops *rw; (can use, but do NOT close it)
145
147
  * const Sound_DecoderFunctions *funcs; (that's this structure)
146
148
  * SDL_AudioStream stream; (offlimits)
147
- * bool pending_eof; (offlimits)
148
- * bool pending_error; (offlimits)
149
+ * SDL_bool pending_eof; (offlimits)
150
+ * SDL_bool pending_error; (offlimits)
149
151
  * void *buffer; (offlimits until read() method)
150
152
  * Uint32 buffer_size; (offlimits until read() method)
151
153
  * void *decoder_private; (read and write access)
@@ -153,8 +155,8 @@ typedef struct __SOUND_DECODERFUNCTIONS__
153
155
  * in rest of Sound_Sample:
154
156
  * void *opaque; (this was internal section, above)
155
157
  * const Sound_DecoderInfo *decoder; (read only)
156
- * SDL_AudioSpec desired; (read only, usually not needed here)
157
- * SDL_AudioSpec actual; (please fill this in)
158
+ * Sound_AudioInfo desired; (read only, usually not needed here)
159
+ * Sound_AudioInfo actual; (please fill this in)
158
160
  * void *buffer; (offlimits)
159
161
  * Uint32 buffer_size; (offlimits)
160
162
  * Sound_SampleFlags flags; (set appropriately)
@@ -178,7 +180,7 @@ typedef struct __SOUND_DECODERFUNCTIONS__
178
180
  *
179
181
  * ...and then start decoding. Fill in up to internal->buffer_size
180
182
  * bytes of decoded sound in the space pointed to by
181
- * internal->buffer. The encoded data is read in from internal->io.
183
+ * internal->buffer. The encoded data is read in from internal->rw.
182
184
  * Data should be decoded in the format specified during the
183
185
  * decoder's open() method in the sample->actual field. The
184
186
  * conversion to the desired format is done at a higher level.
@@ -210,17 +212,17 @@ typedef struct __SOUND_DECODERFUNCTIONS__
210
212
  /*
211
213
  * Reset the decoding to the beginning of the stream. Nonzero on
212
214
  * success, zero on failure.
213
- *
215
+ *
214
216
  * The purpose of this method is to allow for higher efficiency than
215
217
  * an application could get by just recreating the sample externally;
216
- * not only do they not have to reopen the SDL_IOStream, reallocate buffers,
218
+ * not only do they not have to reopen the RWops, reallocate buffers,
217
219
  * and potentially pass the data through several rejecting decoders,
218
220
  * but certain decoders will not have to recreate their existing
219
221
  * state (search for metadata, etc) since they already know they
220
222
  * have a valid audio stream with a given set of characteristics.
221
223
  *
222
224
  * The decoder is responsible for calling seek() on the associated
223
- * SDL_IOStream. A failing call to seek() should be the ONLY reason that
225
+ * SDL_RWops. A failing call to seek() should be the ONLY reason that
224
226
  * this method should ever fail!
225
227
  */
226
228
  int (*rewind)(Sound_Sample *sample);
@@ -234,7 +236,7 @@ typedef struct __SOUND_DECODERFUNCTIONS__
234
236
  * decoding to a given point.
235
237
  *
236
238
  * The decoder is responsible for calling seek() on the associated
237
- * SDL_IOStream.
239
+ * SDL_RWops.
238
240
  *
239
241
  * If there is an error, try to recover so that the next read will
240
242
  * continue as if nothing happened.
@@ -249,11 +251,11 @@ typedef struct __SOUND_SAMPLEINTERNAL__
249
251
  {
250
252
  Sound_Sample *next;
251
253
  Sound_Sample *prev;
252
- SDL_IOStream *io;
254
+ SDL_RWops *rw;
253
255
  const Sound_DecoderFunctions *funcs;
254
256
  SDL_AudioStream *stream;
255
- bool pending_eof;
256
- bool pending_error;
257
+ SDL_bool pending_eof;
258
+ SDL_bool pending_error;
257
259
  void *buffer;
258
260
  Uint32 buffer_size;
259
261
  void *decoder_private;
@@ -296,14 +298,27 @@ void __Sound_SetError(const char *err);
296
298
  * Call this to convert milliseconds to an actual byte position, based on
297
299
  * audio data characteristics.
298
300
  */
299
- Uint32 __Sound_convertMsToBytePos(SDL_AudioSpec *info, Uint32 ms);
301
+ Uint32 __Sound_convertMsToBytePos(Sound_AudioInfo *info, Uint32 ms);
300
302
 
301
303
 
302
304
  /* These get used all over for lessening code clutter. */
303
305
  #define BAIL_MACRO(e, r) { __Sound_SetError(e); return r; }
304
306
  #define BAIL_IF_MACRO(c, e, r) if (c) { __Sound_SetError(e); return r; }
305
307
 
306
- /* Wrappers around SDL versions. SDL3 doesn't provide a SIMDRealloc() */
308
+ #if SDL_VERSION_ATLEAST(2,0,12)
309
+ #define HAVE_SDL_STRTOKR
310
+ #else
311
+ #define SDL_strtokr __Sound_strtokr
312
+ extern char *SDL_strtokr(char *s1, const char *s2, char **saveptr);
313
+ #endif
314
+
315
+ /* SDL doesn't provide a rand() replacement */
316
+ #define SDL_rand __Sound_rand
317
+ #define SDL_srand __Sound_srand
318
+ extern int SDL_rand(void);
319
+ extern void SDL_srand(unsigned int seed);
320
+
321
+ /* Wrappers around the SDL versions of these in case you're on an older SDL */
307
322
  extern void *__Sound_SIMDAlloc(const size_t len);
308
323
  extern void *__Sound_SIMDRealloc(void *mem, const size_t len);
309
324
  extern void __Sound_SIMDFree(void *ptr);
@@ -312,7 +327,7 @@ extern void __Sound_SIMDFree(void *ptr);
312
327
  }
313
328
  #endif
314
329
 
315
- #endif /* defined SDL_SOUND_INTERNAL_H_ */
330
+ #endif /* defined _INCLUDE_SDL_SOUND_INTERNAL_H_ */
316
331
 
317
332
  /* end of SDL_sound_internal.h ... */
318
333
 
@@ -56,7 +56,7 @@ static const char *extensions_modplug[] =
56
56
 
57
57
 
58
58
 
59
- static bool MODPLUG_init(void)
59
+ static SDL_bool MODPLUG_init(void)
60
60
  {
61
61
  return ModPlug_Init(); /* success. */
62
62
  } /* MODPLUG_init */
@@ -102,33 +102,41 @@ static int MODPLUG_open(Sound_Sample *sample, const char *ext)
102
102
 
103
103
  /* ModPlug needs the entire stream in one big chunk. I don't like it,
104
104
  but I don't think there's any way around it. !!! FIXME: rework modplug? */
105
- size = SDL_GetIOSize(internal->io);
105
+ size = SDL_RWsize(internal->rw);
106
106
  BAIL_IF_MACRO(size <= 0 || size > (Sint64)0x7fffffff, "MODPLUG: Not a module file.", 0);
107
107
 
108
- data = SDL_malloc((size_t) size);
109
- BAIL_IF_MACRO(data == NULL, ERR_OUT_OF_MEMORY, 0);
110
- retval = SDL_ReadIO(internal->io, data, size);
111
- if (retval != (size_t)size) SDL_free(data);
112
- BAIL_IF_MACRO(retval != (size_t)size, ERR_IO_ERROR, 0);
108
+ if (internal->rw->type == SDL_RWOPS_MEMORY || internal->rw->type == SDL_RWOPS_MEMORY_RO)
109
+ {
110
+ data = internal->rw->hidden.mem.base;
111
+ retval = 0;
112
+ }
113
+ else
114
+ {
115
+ data = SDL_malloc((size_t) size);
116
+ BAIL_IF_MACRO(data == NULL, ERR_OUT_OF_MEMORY, 0);
117
+ retval = SDL_RWread(internal->rw, data, 1, size);
118
+ if (retval != (size_t)size) SDL_free(data);
119
+ BAIL_IF_MACRO(retval != (size_t)size, ERR_IO_ERROR, 0);
120
+ }
113
121
 
114
- SDL_copyp(&sample->actual, &sample->desired);
115
- if (sample->actual.freq == 0) sample->actual.freq = 44100;
122
+ SDL_memcpy(&sample->actual, &sample->desired, sizeof (Sound_AudioInfo));
123
+ if (sample->actual.rate == 0) sample->actual.rate = 44100;
116
124
  if (sample->actual.channels != 1) sample->actual.channels = 2;
117
- if (sample->actual.format == 0) sample->actual.format = SDL_AUDIO_S16;
125
+ if (sample->actual.format == 0) sample->actual.format = AUDIO_S16SYS;
118
126
 
119
127
  switch (sample->actual.format) {
120
- case SDL_AUDIO_U8:
121
- case SDL_AUDIO_S8:
122
- sample->actual.format = SDL_AUDIO_U8;
128
+ case AUDIO_U8:
129
+ case AUDIO_S8:
130
+ sample->actual.format = AUDIO_U8;
123
131
  break;
124
- case SDL_AUDIO_S32BE:
125
- case SDL_AUDIO_S32LE:
126
- case SDL_AUDIO_F32BE:
127
- case SDL_AUDIO_F32LE:
128
- sample->actual.format = SDL_AUDIO_S32;
132
+ case AUDIO_S32MSB:
133
+ case AUDIO_S32LSB:
134
+ case AUDIO_F32MSB:
135
+ case AUDIO_F32LSB:
136
+ sample->actual.format = AUDIO_S32SYS;
129
137
  break;
130
138
  default:
131
- sample->actual.format = SDL_AUDIO_S16;
139
+ sample->actual.format = AUDIO_S16SYS;
132
140
  break;
133
141
  }
134
142
 
@@ -149,7 +157,7 @@ static int MODPLUG_open(Sound_Sample *sample, const char *ext)
149
157
  settings.mSurroundDelay = 20;
150
158
  settings.mChannels = sample->actual.channels;
151
159
  settings.mBits = SDL_AUDIO_BITSIZE(sample->actual.format);
152
- settings.mFrequency = sample->actual.freq;
160
+ settings.mFrequency = sample->actual.rate;
153
161
  settings.mResamplingMode = MODPLUG_RESAMPLE_FIR;
154
162
  settings.mLoopCount = 0;
155
163
 
@@ -212,7 +220,7 @@ const Sound_DecoderFunctions __Sound_DecoderFunctions_MODPLUG =
212
220
  extensions_modplug,
213
221
  "Play modules through ModPlug",
214
222
  "Torbjörn Andersson <d91tan@Update.UU.SE>",
215
- "https://modplug-xmms.sourceforge.net/"
223
+ "http://modplug-xmms.sourceforge.net/"
216
224
  },
217
225
 
218
226
  MODPLUG_init, /* init() method */
@@ -28,7 +28,6 @@
28
28
  #define DRMP3_FREE(p) SDL_free((p))
29
29
  #define DRMP3_COPY_MEMORY(dst, src, sz) SDL_memcpy((dst), (src), (sz))
30
30
  #define DRMP3_MOVE_MEMORY(dst, src, sz) SDL_memmove((dst), (src), (sz))
31
- #define DRMP3_CMP_MEMORY(src1,src2, sz) SDL_memcmp((src1),(src2), (sz))
32
31
  #define DRMP3_ZERO_MEMORY(p, sz) SDL_memset((p), 0, (sz))
33
32
 
34
33
  #include "dr_mp3.h"
@@ -38,13 +37,13 @@ static size_t mp3_read(void* pUserData, void* pBufferOut, size_t bytesToRead)
38
37
  Uint8 *ptr = (Uint8 *) pBufferOut;
39
38
  Sound_Sample *sample = (Sound_Sample *) pUserData;
40
39
  Sound_SampleInternal *internal = (Sound_SampleInternal *) sample->opaque;
41
- SDL_IOStream *io = internal->io;
40
+ SDL_RWops *rwops = internal->rw;
42
41
  size_t retval = 0;
43
42
 
44
43
  /* !!! FIXME: dr_mp3 treats returning less than bytesToRead as EOF. So we can't EAGAIN. */
45
44
  while (bytesToRead)
46
45
  {
47
- const size_t rc = SDL_ReadIO(io, ptr, bytesToRead);
46
+ const size_t rc = SDL_RWread(rwops, ptr, 1, bytesToRead);
48
47
  if (rc == 0) break;
49
48
  bytesToRead -= rc;
50
49
  retval += rc;
@@ -56,37 +55,16 @@ static size_t mp3_read(void* pUserData, void* pBufferOut, size_t bytesToRead)
56
55
 
57
56
  static drmp3_bool32 mp3_seek(void* pUserData, int offset, drmp3_seek_origin origin)
58
57
  {
58
+ const int whence = (origin == drmp3_seek_origin_start) ? RW_SEEK_SET : RW_SEEK_CUR;
59
59
  Sound_Sample *sample = (Sound_Sample *) pUserData;
60
60
  Sound_SampleInternal *internal = (Sound_SampleInternal *) sample->opaque;
61
- int whence;
62
- switch (origin) {
63
- case DRMP3_SEEK_SET:
64
- whence = SDL_IO_SEEK_SET;
65
- break;
66
- case DRMP3_SEEK_CUR:
67
- whence = SDL_IO_SEEK_CUR;
68
- break;
69
- case DRMP3_SEEK_END:
70
- whence = SDL_IO_SEEK_END;
71
- break;
72
- default:
73
- return DRMP3_FALSE;
74
- }
75
- return (SDL_SeekIO(internal->io, offset, whence) != -1) ? DRMP3_TRUE : DRMP3_FALSE;
61
+ return (SDL_RWseek(internal->rw, offset, whence) != -1) ? DRMP3_TRUE : DRMP3_FALSE;
76
62
  } /* mp3_seek */
77
63
 
78
- static drmp3_bool32 mp3_tell(void* pUserData, drmp3_int64* pCursor)
79
- {
80
- Sound_Sample *sample = (Sound_Sample *) pUserData;
81
- Sound_SampleInternal *internal = (Sound_SampleInternal *) sample->opaque;
82
- *pCursor = SDL_TellIO(internal->io);
83
- return (*pCursor != -1) ? DRMP3_TRUE : DRMP3_FALSE;
84
- } /* mp3_tell */
85
-
86
64
 
87
- static bool MP3_init(void)
65
+ static SDL_bool MP3_init(void)
88
66
  {
89
- return true; /* always succeeds. */
67
+ return SDL_TRUE; /* always succeeds. */
90
68
  } /* MP3_init */
91
69
 
92
70
 
@@ -102,7 +80,7 @@ static int MP3_open(Sound_Sample *sample, const char *ext)
102
80
  Uint64 frames;
103
81
 
104
82
  BAIL_IF_MACRO(!dr, ERR_OUT_OF_MEMORY, 0);
105
- if (drmp3_init(dr, mp3_read, mp3_seek, mp3_tell, NULL, sample, NULL) != DRMP3_TRUE)
83
+ if (drmp3_init(dr, mp3_read, mp3_seek, sample, NULL) != DRMP3_TRUE)
106
84
  {
107
85
  SDL_free(dr);
108
86
  BAIL_IF_MACRO(sample->flags & SOUND_SAMPLEFLAG_ERROR, ERR_IO_ERROR, 0);
@@ -113,17 +91,17 @@ static int MP3_open(Sound_Sample *sample, const char *ext)
113
91
  sample->flags = SOUND_SAMPLEFLAG_CANSEEK;
114
92
 
115
93
  sample->actual.channels = dr->channels;
116
- sample->actual.freq = dr->sampleRate;
117
- sample->actual.format = SDL_AUDIO_F32; /* dr_mp3 only does float. */
94
+ sample->actual.rate = dr->sampleRate;
95
+ sample->actual.format = AUDIO_F32SYS; /* dr_mp3 only does float. */
118
96
 
119
97
  frames = drmp3_get_pcm_frame_count(dr);
120
98
  if (frames == 0) /* ever possible ??? */
121
99
  internal->total_time = -1;
122
100
  else
123
101
  {
124
- const Uint32 freq = dr->sampleRate;
125
- internal->total_time = (frames / freq) * 1000;
126
- internal->total_time += ((frames % freq) * 1000) / freq;
102
+ const Uint32 rate = dr->sampleRate;
103
+ internal->total_time = (frames / rate) * 1000;
104
+ internal->total_time += ((frames % rate) * 1000) / rate;
127
105
  } /* else */
128
106
 
129
107
  internal->decoder_private = dr;
@@ -163,7 +141,7 @@ static int MP3_seek(Sound_Sample *sample, Uint32 ms)
163
141
  {
164
142
  Sound_SampleInternal *internal = (Sound_SampleInternal *) sample->opaque;
165
143
  drmp3 *dr = (drmp3 *) internal->decoder_private;
166
- const float frames_per_ms = ((float) sample->actual.freq) / 1000.0f;
144
+ const float frames_per_ms = ((float) sample->actual.rate) / 1000.0f;
167
145
  const drmp3_uint64 frame_offset = (drmp3_uint64) (frames_per_ms * ((float) ms));
168
146
  return (drmp3_seek_to_pcm_frame(dr, frame_offset) == DRMP3_TRUE);
169
147
  } /* MP3_seek */
@@ -28,9 +28,9 @@
28
28
 
29
29
  #if SOUND_SUPPORTS_RAW
30
30
 
31
- static bool RAW_init(void)
31
+ static SDL_bool RAW_init(void)
32
32
  {
33
- return true; /* always succeeds. */
33
+ return SDL_TRUE; /* always succeeds. */
34
34
  } /* RAW_init */
35
35
 
36
36
 
@@ -44,7 +44,7 @@ static int RAW_open(Sound_Sample *sample, const char *ext)
44
44
  {
45
45
  Sound_SampleInternal *internal = sample->opaque;
46
46
  Sint64 pos;
47
- Uint32 sample_freq;
47
+ Uint32 sample_rate;
48
48
 
49
49
  /*
50
50
  * We check this explicitly, since we have no other way to
@@ -59,7 +59,7 @@ static int RAW_open(Sound_Sample *sample, const char *ext)
59
59
  */
60
60
  if ( (sample->desired.channels < 1) ||
61
61
  (sample->desired.channels > 2) ||
62
- (sample->desired.freq == 0) ||
62
+ (sample->desired.rate == 0) ||
63
63
  (sample->desired.format == 0) )
64
64
  {
65
65
  BAIL_MACRO("RAW: invalid desired format.", 0);
@@ -70,19 +70,19 @@ static int RAW_open(Sound_Sample *sample, const char *ext)
70
70
  /*
71
71
  * We never convert raw samples; what you ask for is what you get.
72
72
  */
73
- SDL_copyp(&sample->actual, &sample->desired);
73
+ SDL_memcpy(&sample->actual, &sample->desired, sizeof (Sound_AudioInfo));
74
74
  sample->flags = SOUND_SAMPLEFLAG_CANSEEK;
75
75
 
76
- if ((pos = SDL_SeekIO(internal->io, 0, SDL_IO_SEEK_END)) <= 0) {
76
+ if ((pos = SDL_RWseek(internal->rw, 0, RW_SEEK_END)) <= 0) {
77
77
  BAIL_MACRO("RAW: can't seek to the end of the file.", 0);
78
78
  }
79
- if (SDL_SeekIO(internal->io, 0, SDL_IO_SEEK_SET) != 0) {
79
+ if ( SDL_RWseek(internal->rw, 0, RW_SEEK_SET) != 0) {
80
80
  BAIL_MACRO("RAW: can't reset file.", 0);
81
81
  }
82
82
 
83
- sample_freq = (sample->actual.freq * sample->actual.channels * ((sample->actual.format & 0x0018) >> 3));
84
- internal->total_time = ( pos ) / sample_freq * 1000;
85
- internal->total_time += (pos % sample_freq) * 1000 / sample_freq;
83
+ sample_rate = (sample->actual.rate * sample->actual.channels * ((sample->actual.format & 0x0018) >> 3));
84
+ internal->total_time = ( pos ) / sample_rate * 1000;
85
+ internal->total_time += (pos % sample_rate) * 1000 / sample_rate;
86
86
 
87
87
  return 1; /* we'll handle this data. */
88
88
  } /* RAW_open */
@@ -103,8 +103,8 @@ static Uint32 RAW_read(Sound_Sample *sample)
103
103
  * We don't actually do any decoding, so we read the raw data
104
104
  * directly into the internal buffer...
105
105
  */
106
- retval = SDL_ReadIO(internal->io, internal->buffer,
107
- internal->buffer_size);
106
+ retval = SDL_RWread(internal->rw, internal->buffer,
107
+ 1, internal->buffer_size);
108
108
 
109
109
  /* Make sure the read went smoothly... */
110
110
  if (retval == 0)
@@ -124,15 +124,16 @@ static Uint32 RAW_read(Sound_Sample *sample)
124
124
  static int RAW_rewind(Sound_Sample *sample)
125
125
  {
126
126
  Sound_SampleInternal *internal = (Sound_SampleInternal *) sample->opaque;
127
- BAIL_IF_MACRO(SDL_SeekIO(internal->io, 0, SDL_IO_SEEK_SET) != 0, ERR_IO_ERROR, 0);
127
+ BAIL_IF_MACRO(SDL_RWseek(internal->rw, 0, RW_SEEK_SET) != 0, ERR_IO_ERROR, 0);
128
128
  return 1;
129
129
  } /* RAW_rewind */
130
130
 
131
+
131
132
  static int RAW_seek(Sound_Sample *sample, Uint32 ms)
132
133
  {
133
134
  Sound_SampleInternal *internal = (Sound_SampleInternal *) sample->opaque;
134
135
  const Sint64 pos = __Sound_convertMsToBytePos(&sample->actual, ms);
135
- const int err = (SDL_SeekIO(internal->io, pos, SDL_IO_SEEK_SET) != pos);
136
+ const int err = (SDL_RWseek(internal->rw, pos, RW_SEEK_SET) != pos);
136
137
  BAIL_IF_MACRO(err, ERR_IO_ERROR, 0);
137
138
  return 1;
138
139
  } /* RAW_seek */