gosu 1.3.0 → 1.4.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/dependencies/SDL/include/SDL.h +108 -14
- data/dependencies/SDL/include/SDL_assert.h +81 -50
- data/dependencies/SDL/include/SDL_atomic.h +135 -35
- data/dependencies/SDL/include/SDL_audio.h +960 -355
- data/dependencies/SDL/include/SDL_bits.h +11 -6
- data/dependencies/SDL/include/SDL_blendmode.h +91 -14
- data/dependencies/SDL/include/SDL_clipboard.h +30 -7
- data/dependencies/SDL/include/SDL_config.h +277 -27
- data/dependencies/SDL/include/SDL_config_android.h +13 -38
- data/dependencies/SDL/include/SDL_config_iphoneos.h +21 -62
- data/dependencies/SDL/include/SDL_config_macosx.h +23 -92
- data/dependencies/SDL/include/SDL_config_minimal.h +1 -4
- data/dependencies/SDL/include/SDL_config_pandora.h +15 -22
- data/dependencies/SDL/include/SDL_config_psp.h +16 -37
- data/dependencies/SDL/include/SDL_config_windows.h +28 -91
- data/dependencies/SDL/include/SDL_config_winrt.h +33 -61
- data/dependencies/SDL/include/SDL_config_wiz.h +28 -56
- data/dependencies/SDL/include/SDL_copying.h +1 -1
- data/dependencies/SDL/include/SDL_cpuinfo.h +331 -71
- data/dependencies/SDL/include/SDL_egl.h +906 -280
- data/dependencies/SDL/include/SDL_endian.h +101 -47
- data/dependencies/SDL/include/SDL_error.h +70 -19
- data/dependencies/SDL/include/SDL_events.h +387 -79
- data/dependencies/SDL/include/SDL_filesystem.h +73 -64
- data/dependencies/SDL/include/SDL_gamecontroller.h +585 -125
- data/dependencies/SDL/include/SDL_gesture.h +36 -6
- data/dependencies/SDL/include/SDL_haptic.h +304 -210
- data/dependencies/SDL/include/SDL_hidapi.h +451 -0
- data/dependencies/SDL/include/SDL_hints.h +1286 -897
- data/dependencies/SDL/include/SDL_joystick.h +577 -130
- data/dependencies/SDL/include/SDL_keyboard.h +162 -63
- data/dependencies/SDL/include/SDL_keycode.h +7 -5
- data/dependencies/SDL/include/SDL_loadso.h +42 -8
- data/dependencies/SDL/include/SDL_locale.h +34 -32
- data/dependencies/SDL/include/SDL_log.h +212 -19
- data/dependencies/SDL/include/SDL_main.h +72 -17
- data/dependencies/SDL/include/SDL_messagebox.h +70 -23
- data/dependencies/SDL/include/SDL_metal.h +27 -32
- data/dependencies/SDL/include/SDL_misc.h +19 -15
- data/dependencies/SDL/include/SDL_mouse.h +262 -110
- data/dependencies/SDL/include/SDL_mutex.h +286 -66
- data/dependencies/SDL/include/SDL_name.h +1 -1
- data/dependencies/SDL/include/SDL_opengl.h +1 -1
- data/dependencies/SDL/include/SDL_opengles.h +1 -1
- data/dependencies/SDL/include/SDL_opengles2.h +2 -2
- data/dependencies/SDL/include/SDL_pixels.h +199 -34
- data/dependencies/SDL/include/SDL_platform.h +39 -2
- data/dependencies/SDL/include/SDL_power.h +23 -10
- data/dependencies/SDL/include/SDL_quit.h +1 -1
- data/dependencies/SDL/include/SDL_rect.h +78 -28
- data/dependencies/SDL/include/SDL_render.h +1204 -472
- data/dependencies/SDL/include/SDL_revision.h +2 -2
- data/dependencies/SDL/include/SDL_rwops.h +605 -33
- data/dependencies/SDL/include/SDL_scancode.h +1 -1
- data/dependencies/SDL/include/SDL_sensor.h +76 -42
- data/dependencies/SDL/include/SDL_shape.h +38 -27
- data/dependencies/SDL/include/SDL_stdinc.h +96 -24
- data/dependencies/SDL/include/SDL_surface.h +571 -139
- data/dependencies/SDL/include/SDL_system.h +339 -101
- data/dependencies/SDL/include/SDL_syswm.h +50 -20
- data/dependencies/SDL/include/SDL_test.h +1 -1
- data/dependencies/SDL/include/SDL_test_assert.h +2 -2
- data/dependencies/SDL/include/SDL_test_common.h +23 -6
- data/dependencies/SDL/include/SDL_test_compare.h +1 -1
- data/dependencies/SDL/include/SDL_test_crc32.h +1 -1
- data/dependencies/SDL/include/SDL_test_font.h +3 -3
- data/dependencies/SDL/include/SDL_test_fuzzer.h +28 -26
- data/dependencies/SDL/include/SDL_test_harness.h +6 -6
- data/dependencies/SDL/include/SDL_test_images.h +1 -1
- data/dependencies/SDL/include/SDL_test_log.h +1 -1
- data/dependencies/SDL/include/SDL_test_md5.h +1 -1
- data/dependencies/SDL/include/SDL_test_memory.h +1 -1
- data/dependencies/SDL/include/SDL_test_random.h +2 -2
- data/dependencies/SDL/include/SDL_thread.h +226 -128
- data/dependencies/SDL/include/SDL_timer.h +129 -22
- data/dependencies/SDL/include/SDL_touch.h +48 -8
- data/dependencies/SDL/include/SDL_types.h +1 -1
- data/dependencies/SDL/include/SDL_version.h +72 -46
- data/dependencies/SDL/include/SDL_video.h +1266 -460
- data/dependencies/SDL/include/SDL_vulkan.h +100 -161
- data/dependencies/SDL/include/begin_code.h +22 -1
- data/dependencies/SDL/include/close_code.h +1 -1
- data/dependencies/SDL/lib/x64/libSDL2.dll.a +0 -0
- data/dependencies/SDL/lib/x86/libSDL2.dll.a +0 -0
- data/dependencies/SDL_sound/SDL_sound.c +104 -70
- data/dependencies/SDL_sound/SDL_sound.h +6 -6
- data/dependencies/SDL_sound/SDL_sound_aiff.c +32 -32
- data/dependencies/SDL_sound/SDL_sound_au.c +14 -14
- data/dependencies/SDL_sound/SDL_sound_coreaudio.c +6 -7
- data/dependencies/SDL_sound/SDL_sound_flac.c +28 -30
- data/dependencies/SDL_sound/SDL_sound_internal.h +21 -14
- data/dependencies/SDL_sound/SDL_sound_modplug.c +26 -28
- data/dependencies/SDL_sound/SDL_sound_mp3.c +20 -36
- data/dependencies/SDL_sound/SDL_sound_raw.c +15 -16
- data/dependencies/SDL_sound/SDL_sound_shn.c +11 -10
- data/dependencies/SDL_sound/SDL_sound_voc.c +20 -18
- data/dependencies/SDL_sound/SDL_sound_vorbis.c +11 -9
- data/dependencies/SDL_sound/SDL_sound_wav.c +49 -43
- data/dependencies/SDL_sound/dr_flac.h +10925 -4466
- data/dependencies/SDL_sound/dr_mp3.h +2802 -844
- data/dependencies/SDL_sound/libmodplug/fastmix.c +63 -64
- data/dependencies/SDL_sound/libmodplug/libmodplug.h +25 -103
- data/dependencies/SDL_sound/libmodplug/load_669.c +14 -17
- data/dependencies/SDL_sound/libmodplug/load_amf.c +12 -7
- data/dependencies/SDL_sound/libmodplug/load_ams.c +103 -44
- data/dependencies/SDL_sound/libmodplug/load_dbm.c +8 -4
- data/dependencies/SDL_sound/libmodplug/load_dmf.c +55 -25
- data/dependencies/SDL_sound/libmodplug/load_far.c +9 -13
- data/dependencies/SDL_sound/libmodplug/load_gdm.c +448 -0
- data/dependencies/SDL_sound/libmodplug/load_it.c +61 -61
- data/dependencies/SDL_sound/libmodplug/load_mdl.c +94 -58
- data/dependencies/SDL_sound/libmodplug/load_med.c +20 -11
- data/dependencies/SDL_sound/libmodplug/load_mod.c +40 -15
- data/dependencies/SDL_sound/libmodplug/load_mt2.c +50 -19
- data/dependencies/SDL_sound/libmodplug/load_okt.c +59 -28
- data/dependencies/SDL_sound/libmodplug/load_psm.c +104 -79
- data/dependencies/SDL_sound/libmodplug/load_ptm.c +18 -17
- data/dependencies/SDL_sound/libmodplug/load_s3m.c +9 -7
- data/dependencies/SDL_sound/libmodplug/load_stm.c +3 -2
- data/dependencies/SDL_sound/libmodplug/load_ult.c +4 -3
- data/dependencies/SDL_sound/libmodplug/load_umx.c +315 -35
- data/dependencies/SDL_sound/libmodplug/load_xm.c +25 -21
- data/dependencies/SDL_sound/libmodplug/mmcmp.c +295 -149
- data/dependencies/SDL_sound/libmodplug/modplug.c +7 -123
- data/dependencies/SDL_sound/libmodplug/modplug.h +32 -29
- data/dependencies/SDL_sound/libmodplug/snd_dsp.c +0 -1
- data/dependencies/SDL_sound/libmodplug/snd_flt.c +2 -2
- data/dependencies/SDL_sound/libmodplug/snd_fx.c +32 -19
- data/dependencies/SDL_sound/libmodplug/sndfile.c +76 -160
- data/dependencies/SDL_sound/libmodplug/sndmix.c +7 -12
- data/dependencies/SDL_sound/libmodplug/tables.h +10 -15
- data/dependencies/SDL_sound/stb_vorbis.h +504 -329
- data/dependencies/{al_soft → mojoAL}/AL/al.h +38 -30
- data/dependencies/{al_soft → mojoAL}/AL/alc.h +27 -56
- data/dependencies/mojoAL/mojoal.c +4848 -0
- data/dependencies/stb/stb_image.h +208 -73
- data/dependencies/stb/stb_image_write.h +57 -23
- data/dependencies/stb/stb_truetype.h +345 -279
- data/dependencies/utf8proc/utf8proc.c +37 -18
- data/dependencies/utf8proc/utf8proc.h +17 -5
- data/dependencies/utf8proc/utf8proc_data.h +12012 -10089
- data/ext/gosu/extconf.rb +29 -30
- data/include/Gosu/Audio.hpp +70 -85
- data/include/Gosu/Buttons.hpp +103 -103
- data/include/Gosu/Color.hpp +19 -11
- data/include/Gosu/Directories.hpp +31 -24
- data/include/Gosu/Font.hpp +42 -44
- data/include/Gosu/Gosu.hpp +5 -8
- data/include/Gosu/Graphics.hpp +58 -71
- data/include/Gosu/GraphicsBase.hpp +26 -33
- data/include/Gosu/IO.hpp +0 -3
- data/include/Gosu/Image.hpp +56 -62
- data/include/Gosu/ImageData.hpp +23 -27
- data/include/Gosu/Inspection.hpp +1 -4
- data/include/Gosu/Math.hpp +0 -3
- data/include/Gosu/TextInput.hpp +34 -40
- data/include/Gosu/Timing.hpp +2 -8
- data/include/Gosu/Version.hpp +2 -2
- data/include/Gosu/Window.hpp +71 -70
- data/lib/SDL2.dll +0 -0
- data/lib/gosu/compat.rb +24 -37
- data/lib/gosu.rb +2 -2
- data/lib64/SDL2.dll +0 -0
- data/src/Audio.cpp +88 -86
- data/src/AudioFile.hpp +6 -6
- data/src/AudioFileAudioToolbox.cpp +1 -1
- data/src/AudioFileSDLSound.cpp +1 -1
- data/src/AudioImpl.cpp +0 -7
- data/src/AudioImpl.hpp +6 -8
- data/src/BitmapIO.cpp +23 -22
- data/src/BlockAllocator.cpp +2 -1
- data/src/Channel.cpp +22 -20
- data/src/Color.cpp +12 -9
- data/src/DirectoriesApple.cpp +25 -24
- data/src/DirectoriesUnix.cpp +14 -12
- data/src/DirectoriesWin.cpp +26 -30
- data/src/EmptyImageData.hpp +15 -17
- data/src/FileUnix.cpp +1 -1
- data/src/FileWin.cpp +1 -1
- data/src/Font.cpp +59 -54
- data/src/Graphics.cpp +135 -143
- data/src/Image.cpp +41 -47
- data/src/Input.cpp +1 -1
- data/src/InputUIKit.cpp +1 -1
- data/src/LargeImageData.cpp +108 -101
- data/src/LargeImageData.hpp +17 -15
- data/src/Log.hpp +6 -6
- data/src/Macro.cpp +35 -37
- data/src/Macro.hpp +11 -11
- data/src/Math.cpp +8 -1
- data/src/Resolution.cpp +12 -7
- data/src/RubyGosu.cxx +11 -39
- data/src/TexChunk.cpp +50 -41
- data/src/TexChunk.hpp +22 -22
- data/src/Text.cpp +37 -37
- data/src/TextBuilder.cpp +60 -57
- data/src/TextBuilder.hpp +20 -20
- data/src/TextInput.cpp +127 -135
- data/src/TimingApple.cpp +1 -7
- data/src/TimingUnix.cpp +0 -6
- data/src/TimingWin.cpp +0 -6
- data/src/TrueTypeFont.cpp +107 -107
- data/src/TrueTypeFont.hpp +39 -38
- data/src/TrueTypeFontApple.cpp +19 -22
- data/src/TrueTypeFontUnix.cpp +21 -26
- data/src/TrueTypeFontWin.cpp +30 -30
- data/src/Window.cpp +97 -87
- data/src/WindowUIKit.cpp +46 -49
- metadata +7 -17
- data/dependencies/SDL/include/SDL_config_os2.h +0 -188
- data/dependencies/SDL_sound/libmodplug/load_abc.c +0 -4725
- data/dependencies/SDL_sound/libmodplug/load_mid.c +0 -1405
- data/dependencies/SDL_sound/libmodplug/load_pat.c +0 -1143
- data/dependencies/SDL_sound/libmodplug/load_pat.h +0 -25
- data/dependencies/al_soft/AL/alext.h +0 -585
- data/dependencies/al_soft/AL/efx-creative.h +0 -3
- data/dependencies/al_soft/AL/efx-presets.h +0 -402
- data/dependencies/al_soft/AL/efx.h +0 -762
- data/dependencies/al_soft/x64/libOpenAL32.dll.a +0 -0
- data/dependencies/al_soft/x86/libOpenAL32.dll.a +0 -0
- data/lib/OpenAL32.dll +0 -0
- data/lib64/OpenAL32.dll +0 -0
@@ -19,6 +19,7 @@
|
|
19
19
|
/* The various decoder drivers... */
|
20
20
|
|
21
21
|
/* All these externs may be missing; we check SOUND_SUPPORTS_xxx before use. */
|
22
|
+
extern const Sound_DecoderFunctions __Sound_DecoderFunctions_MIDI;
|
22
23
|
extern const Sound_DecoderFunctions __Sound_DecoderFunctions_MODPLUG;
|
23
24
|
extern const Sound_DecoderFunctions __Sound_DecoderFunctions_MP3;
|
24
25
|
extern const Sound_DecoderFunctions __Sound_DecoderFunctions_WAV;
|
@@ -29,17 +30,19 @@ extern const Sound_DecoderFunctions __Sound_DecoderFunctions_VOC;
|
|
29
30
|
extern const Sound_DecoderFunctions __Sound_DecoderFunctions_RAW;
|
30
31
|
extern const Sound_DecoderFunctions __Sound_DecoderFunctions_SHN;
|
31
32
|
extern const Sound_DecoderFunctions __Sound_DecoderFunctions_FLAC;
|
32
|
-
extern const Sound_DecoderFunctions __Sound_DecoderFunctions_QuickTime;
|
33
33
|
extern const Sound_DecoderFunctions __Sound_DecoderFunctions_CoreAudio;
|
34
34
|
|
35
35
|
typedef struct
|
36
36
|
{
|
37
|
-
|
37
|
+
SDL_bool available;
|
38
38
|
const Sound_DecoderFunctions *funcs;
|
39
39
|
} decoder_element;
|
40
40
|
|
41
41
|
static decoder_element decoders[] =
|
42
42
|
{
|
43
|
+
#if SOUND_SUPPORTS_MIDI
|
44
|
+
{ 0, &__Sound_DecoderFunctions_MIDI },
|
45
|
+
#endif
|
43
46
|
#if SOUND_SUPPORTS_MODPLUG
|
44
47
|
{ 0, &__Sound_DecoderFunctions_MODPLUG },
|
45
48
|
#endif
|
@@ -81,17 +84,14 @@ static decoder_element decoders[] =
|
|
81
84
|
|
82
85
|
/* General SDL_sound state ... */
|
83
86
|
|
84
|
-
|
87
|
+
static SDL_TLSID tlsid_errmsg = 0;
|
88
|
+
|
89
|
+
typedef struct
|
85
90
|
{
|
86
|
-
|
87
|
-
int error_available;
|
91
|
+
SDL_bool error_available;
|
88
92
|
char error_string[128];
|
89
|
-
struct __SOUND_ERRMSGTYPE__ *next;
|
90
93
|
} ErrMsg;
|
91
94
|
|
92
|
-
static ErrMsg *error_msgs = NULL;
|
93
|
-
static SDL_mutex *errorlist_mutex = NULL;
|
94
|
-
|
95
95
|
static Sound_Sample *sample_list = NULL; /* this is a linked list. */
|
96
96
|
static SDL_mutex *samplelist_mutex = NULL;
|
97
97
|
|
@@ -120,7 +120,6 @@ int Sound_Init(void)
|
|
120
120
|
BAIL_IF_MACRO(initialized, ERR_IS_INITIALIZED, 0);
|
121
121
|
|
122
122
|
sample_list = NULL;
|
123
|
-
error_msgs = NULL;
|
124
123
|
|
125
124
|
available_decoders = (const Sound_DecoderInfo **)
|
126
125
|
SDL_calloc(total, sizeof (Sound_DecoderInfo *));
|
@@ -128,7 +127,8 @@ int Sound_Init(void)
|
|
128
127
|
|
129
128
|
SDL_InitSubSystem(SDL_INIT_AUDIO);
|
130
129
|
|
131
|
-
|
130
|
+
tlsid_errmsg = SDL_TLSCreate();
|
131
|
+
|
132
132
|
samplelist_mutex = SDL_CreateMutex();
|
133
133
|
|
134
134
|
for (i = 0; decoders[i].funcs != NULL; i++)
|
@@ -148,8 +148,6 @@ int Sound_Init(void)
|
|
148
148
|
|
149
149
|
int Sound_Quit(void)
|
150
150
|
{
|
151
|
-
ErrMsg *err;
|
152
|
-
ErrMsg *nexterr = NULL;
|
153
151
|
size_t i;
|
154
152
|
|
155
153
|
BAIL_IF_MACRO(!initialized, ERR_NOT_INITIALIZED, 0);
|
@@ -176,17 +174,7 @@ int Sound_Quit(void)
|
|
176
174
|
SDL_free((void *) available_decoders);
|
177
175
|
available_decoders = NULL;
|
178
176
|
|
179
|
-
|
180
|
-
SDL_LockMutex(errorlist_mutex);
|
181
|
-
for (err = error_msgs; err != NULL; err = nexterr)
|
182
|
-
{
|
183
|
-
nexterr = err->next;
|
184
|
-
SDL_free(err);
|
185
|
-
} /* for */
|
186
|
-
error_msgs = NULL;
|
187
|
-
SDL_UnlockMutex(errorlist_mutex);
|
188
|
-
SDL_DestroyMutex(errorlist_mutex);
|
189
|
-
errorlist_mutex = NULL;
|
177
|
+
tlsid_errmsg = 0;
|
190
178
|
|
191
179
|
return 1;
|
192
180
|
} /* Sound_Quit */
|
@@ -200,27 +188,8 @@ const Sound_DecoderInfo **Sound_AvailableDecoders(void)
|
|
200
188
|
|
201
189
|
static ErrMsg *findErrorForCurrentThread(void)
|
202
190
|
{
|
203
|
-
ErrMsg *
|
204
|
-
|
205
|
-
|
206
|
-
if (error_msgs != NULL)
|
207
|
-
{
|
208
|
-
tid = SDL_ThreadID();
|
209
|
-
|
210
|
-
SDL_LockMutex(errorlist_mutex);
|
211
|
-
for (i = error_msgs; i != NULL; i = i->next)
|
212
|
-
{
|
213
|
-
if (i->tid == tid)
|
214
|
-
{
|
215
|
-
SDL_UnlockMutex(errorlist_mutex);
|
216
|
-
return i;
|
217
|
-
} /* if */
|
218
|
-
} /* for */
|
219
|
-
SDL_UnlockMutex(errorlist_mutex);
|
220
|
-
} /* if */
|
221
|
-
|
222
|
-
return NULL; /* no error available. */
|
223
|
-
} /* findErrorForCurrentThread */
|
191
|
+
return (ErrMsg *) SDL_TLSGet(tlsid_errmsg);
|
192
|
+
}
|
224
193
|
|
225
194
|
|
226
195
|
const char *Sound_GetError(void)
|
@@ -235,7 +204,7 @@ const char *Sound_GetError(void)
|
|
235
204
|
if ((err != NULL) && (err->error_available))
|
236
205
|
{
|
237
206
|
retval = err->error_string;
|
238
|
-
err->error_available =
|
207
|
+
err->error_available = SDL_FALSE;
|
239
208
|
} /* if */
|
240
209
|
|
241
210
|
return retval;
|
@@ -244,15 +213,14 @@ const char *Sound_GetError(void)
|
|
244
213
|
|
245
214
|
void Sound_ClearError(void)
|
246
215
|
{
|
247
|
-
|
216
|
+
Sound_GetError(); /* this will set error_available to SDL_FALSE */
|
217
|
+
} /* Sound_ClearError */
|
248
218
|
|
249
|
-
if (!initialized)
|
250
|
-
return;
|
251
219
|
|
252
|
-
|
253
|
-
|
254
|
-
|
255
|
-
} /*
|
220
|
+
static void SDLCALL free_errmsg(void *errmsg)
|
221
|
+
{
|
222
|
+
SDL_free(errmsg);
|
223
|
+
} /* free_errmsg */
|
256
224
|
|
257
225
|
|
258
226
|
/*
|
@@ -265,8 +233,7 @@ void __Sound_SetError(const char *str)
|
|
265
233
|
if (str == NULL)
|
266
234
|
return;
|
267
235
|
|
268
|
-
SNDDBG(("__Sound_SetError(\"%s\");%s\n", str,
|
269
|
-
(initialized) ? "" : " [NOT INITIALIZED!]"));
|
236
|
+
SNDDBG(("__Sound_SetError(\"%s\");%s\n", str, (initialized) ? "" : " [NOT INITIALIZED!]"));
|
270
237
|
|
271
238
|
if (!initialized)
|
272
239
|
return;
|
@@ -278,15 +245,10 @@ void __Sound_SetError(const char *str)
|
|
278
245
|
if (err == NULL)
|
279
246
|
return; /* uhh...? */
|
280
247
|
|
281
|
-
err
|
282
|
-
|
283
|
-
SDL_LockMutex(errorlist_mutex);
|
284
|
-
err->next = error_msgs;
|
285
|
-
error_msgs = err;
|
286
|
-
SDL_UnlockMutex(errorlist_mutex);
|
248
|
+
SDL_TLSSet(tlsid_errmsg, err, free_errmsg);
|
287
249
|
} /* if */
|
288
250
|
|
289
|
-
err->error_available =
|
251
|
+
err->error_available = SDL_TRUE;
|
290
252
|
SDL_strlcpy(err->error_string, str, sizeof (err->error_string));
|
291
253
|
} /* __Sound_SetError */
|
292
254
|
|
@@ -348,8 +310,7 @@ static Sound_Sample *alloc_sample(SDL_RWops *rw, Sound_AudioInfo *desired,
|
|
348
310
|
#if (defined DEBUG_CHATTER)
|
349
311
|
static SDL_INLINE const char *fmt_to_str(Uint16 fmt)
|
350
312
|
{
|
351
|
-
switch(fmt)
|
352
|
-
{
|
313
|
+
switch(fmt) {
|
353
314
|
case AUDIO_U8:
|
354
315
|
return "U8";
|
355
316
|
case AUDIO_S8:
|
@@ -371,7 +332,6 @@ static SDL_INLINE const char *fmt_to_str(Uint16 fmt)
|
|
371
332
|
case AUDIO_F32MSB:
|
372
333
|
return "F32MSB";
|
373
334
|
} /* switch */
|
374
|
-
|
375
335
|
return "Unknown";
|
376
336
|
} /* fmt_to_str */
|
377
337
|
#endif
|
@@ -389,14 +349,14 @@ static int init_sample(const Sound_DecoderFunctions *funcs,
|
|
389
349
|
{
|
390
350
|
Sound_SampleInternal *internal = (Sound_SampleInternal *) sample->opaque;
|
391
351
|
Sound_AudioInfo desired;
|
392
|
-
|
352
|
+
const Sint64 pos = SDL_RWtell(internal->rw);
|
393
353
|
|
394
354
|
/* fill in the funcs for this decoder... */
|
395
355
|
sample->decoder = &funcs->info;
|
396
356
|
internal->funcs = funcs;
|
397
357
|
if (!funcs->open(sample, ext))
|
398
358
|
{
|
399
|
-
SDL_RWseek(internal->rw, pos,
|
359
|
+
SDL_RWseek(internal->rw, pos, RW_SEEK_SET); /* set for next try... */
|
400
360
|
return 0;
|
401
361
|
} /* if */
|
402
362
|
|
@@ -423,7 +383,7 @@ static int init_sample(const Sound_DecoderFunctions *funcs,
|
|
423
383
|
{
|
424
384
|
__Sound_SetError(SDL_GetError());
|
425
385
|
funcs->close(sample);
|
426
|
-
SDL_RWseek(internal->rw, pos,
|
386
|
+
SDL_RWseek(internal->rw, pos, RW_SEEK_SET); /* set for next try... */
|
427
387
|
return 0;
|
428
388
|
} /* if */
|
429
389
|
|
@@ -433,7 +393,7 @@ static int init_sample(const Sound_DecoderFunctions *funcs,
|
|
433
393
|
if (rc == NULL)
|
434
394
|
{
|
435
395
|
funcs->close(sample);
|
436
|
-
SDL_RWseek(internal->rw, pos,
|
396
|
+
SDL_RWseek(internal->rw, pos, RW_SEEK_SET); /* set for next try... */
|
437
397
|
return 0;
|
438
398
|
} /* if */
|
439
399
|
|
@@ -517,7 +477,7 @@ Sound_Sample *Sound_NewSample(SDL_RWops *rw, const char *ext,
|
|
517
477
|
/* skip if we would have tried decoder above... */
|
518
478
|
while (*decoderExt)
|
519
479
|
{
|
520
|
-
if (SDL_strcasecmp(*decoderExt, ext) == 0)
|
480
|
+
if (ext && SDL_strcasecmp(*decoderExt, ext) == 0)
|
521
481
|
{
|
522
482
|
should_try = 0;
|
523
483
|
break;
|
@@ -791,5 +751,79 @@ Sint32 Sound_GetDuration(Sound_Sample *sample)
|
|
791
751
|
return internal->total_time;
|
792
752
|
} /* Sound_GetDuration */
|
793
753
|
|
754
|
+
|
755
|
+
/* Utility functions ... */
|
756
|
+
|
757
|
+
/* The following uses the implementation suggested by
|
758
|
+
* the standard document, assumes RAND_MAX == 32767 */
|
759
|
+
static unsigned long __Sound_seed = 1;
|
760
|
+
int __Sound_rand(void)
|
761
|
+
{
|
762
|
+
__Sound_seed = __Sound_seed * 1103515245 + 12345;
|
763
|
+
return (__Sound_seed / 65536) % 32768;
|
764
|
+
}
|
765
|
+
void __Sound_srand(unsigned int seed)
|
766
|
+
{
|
767
|
+
__Sound_seed = seed;
|
768
|
+
}
|
769
|
+
|
770
|
+
#if !defined(HAVE_SDL_STRTOKR)
|
771
|
+
/* Adapted from _PDCLIB_strtok() of PDClib library at
|
772
|
+
* https://github.com/DevSolar/pdclib.git
|
773
|
+
*
|
774
|
+
* The code was under CC0 license:
|
775
|
+
* https://creativecommons.org/publicdomain/zero/1.0/legalcode
|
776
|
+
*/
|
777
|
+
char *__Sound_strtokr(char *s1, const char *s2, char **ptr)
|
778
|
+
{
|
779
|
+
const char *p = s2;
|
780
|
+
|
781
|
+
if (!s2 || !ptr || (!s1 && !*ptr)) return NULL;
|
782
|
+
|
783
|
+
if (s1 != NULL) { /* new string */
|
784
|
+
*ptr = s1;
|
785
|
+
} else { /* old string continued */
|
786
|
+
if (*ptr == NULL) {
|
787
|
+
/* No old string, no new string, nothing to do */
|
788
|
+
return NULL;
|
789
|
+
}
|
790
|
+
s1 = *ptr;
|
791
|
+
}
|
792
|
+
|
793
|
+
/* skip leading s2 characters */
|
794
|
+
while (*p && *s1) {
|
795
|
+
if (*s1 == *p) {
|
796
|
+
/* found separator; skip and start over */
|
797
|
+
++s1;
|
798
|
+
p = s2;
|
799
|
+
continue;
|
800
|
+
}
|
801
|
+
++p;
|
802
|
+
}
|
803
|
+
|
804
|
+
if (! *s1) { /* no more to parse */
|
805
|
+
*ptr = s1;
|
806
|
+
return NULL;
|
807
|
+
}
|
808
|
+
|
809
|
+
/* skipping non-s2 characters */
|
810
|
+
*ptr = s1;
|
811
|
+
while (**ptr) {
|
812
|
+
p = s2;
|
813
|
+
while (*p) {
|
814
|
+
if (**ptr == *p++) {
|
815
|
+
/* found separator; overwrite with '\0', position *ptr, return */
|
816
|
+
*((*ptr)++) = '\0';
|
817
|
+
return s1;
|
818
|
+
}
|
819
|
+
}
|
820
|
+
++(*ptr);
|
821
|
+
}
|
822
|
+
|
823
|
+
/* parsed to end of string */
|
824
|
+
return s1;
|
825
|
+
}
|
826
|
+
#endif
|
827
|
+
|
794
828
|
/* end of SDL_sound.c ... */
|
795
829
|
|
@@ -62,16 +62,16 @@ extern "C" {
|
|
62
62
|
|
63
63
|
#ifndef DOXYGEN_SHOULD_IGNORE_THIS
|
64
64
|
|
65
|
-
#
|
65
|
+
#if defined(SDL_SOUND_DLL_EXPORTS) && (defined(_WIN32) || defined(__OS2__))
|
66
66
|
# define SNDDECLSPEC __declspec(dllexport)
|
67
|
-
#elif (__GNUC__ >=
|
67
|
+
#elif ((defined(__GNUC__) && (__GNUC__ >= 4)) || defined(__clang__)) && !(defined(_WIN32) || defined(__OS2__))
|
68
68
|
# define SNDDECLSPEC __attribute__((visibility("default")))
|
69
69
|
#else
|
70
70
|
# define SNDDECLSPEC
|
71
71
|
#endif
|
72
72
|
|
73
|
-
#define SOUND_VER_MAJOR
|
74
|
-
#define SOUND_VER_MINOR
|
73
|
+
#define SOUND_VER_MAJOR 2
|
74
|
+
#define SOUND_VER_MINOR 0
|
75
75
|
#define SOUND_VER_PATCH 0
|
76
76
|
#endif
|
77
77
|
|
@@ -696,8 +696,8 @@ SNDDECLSPEC int SDLCALL Sound_Rewind(Sound_Sample *sample);
|
|
696
696
|
*
|
697
697
|
* This function can be emulated in the application with Sound_Rewind()
|
698
698
|
* and predecoding a specific amount of the sample, but this can be
|
699
|
-
* extremely inefficient. Sound_Seek() accelerates the seek
|
700
|
-
*
|
699
|
+
* extremely inefficient. Sound_Seek() accelerates the seek with
|
700
|
+
* decoder-specific code.
|
701
701
|
*
|
702
702
|
* If this function fails, the sample should continue to function as if
|
703
703
|
* this call was never made. If there was an unrecoverable error,
|
@@ -38,8 +38,8 @@ typedef struct S_AIFF_FMT_T
|
|
38
38
|
{
|
39
39
|
Uint32 type;
|
40
40
|
|
41
|
-
|
42
|
-
|
41
|
+
Sint64 total_bytes;
|
42
|
+
Sint64 data_starting_offset;
|
43
43
|
|
44
44
|
void (*free)(struct S_AIFF_FMT_T *fmt);
|
45
45
|
Uint32 (*read_sample)(Sound_Sample *sample);
|
@@ -49,7 +49,7 @@ typedef struct S_AIFF_FMT_T
|
|
49
49
|
|
50
50
|
#if 0
|
51
51
|
/*
|
52
|
-
this is ripped from wav.c as
|
52
|
+
this is ripped from wav.c as an example of format-specific data.
|
53
53
|
please replace with something more appropriate when the need arises.
|
54
54
|
*/
|
55
55
|
union
|
@@ -177,8 +177,7 @@ static int read_comm_chunk(SDL_RWops *rw, comm_t *comm)
|
|
177
177
|
return 0;
|
178
178
|
comm->numChannels = SDL_SwapBE16(comm->numChannels);
|
179
179
|
|
180
|
-
if (SDL_RWread(rw, &comm->numSampleFrames,
|
181
|
-
sizeof (comm->numSampleFrames), 1) != 1)
|
180
|
+
if (SDL_RWread(rw, &comm->numSampleFrames, sizeof (comm->numSampleFrames), 1) != 1)
|
182
181
|
return 0;
|
183
182
|
comm->numSampleFrames = SDL_SwapBE32(comm->numSampleFrames);
|
184
183
|
|
@@ -245,7 +244,7 @@ static int read_ssnd_chunk(SDL_RWops *rw, ssnd_t *ssnd)
|
|
245
244
|
ssnd->blockSize = SDL_SwapBE32(ssnd->blockSize);
|
246
245
|
|
247
246
|
/* Leave the SDL_RWops position indicator at the start of the samples */
|
248
|
-
if (SDL_RWseek(rw,
|
247
|
+
if (SDL_RWseek(rw, ssnd->offset, RW_SEEK_CUR) == -1)
|
249
248
|
return 0;
|
250
249
|
|
251
250
|
return 1;
|
@@ -262,8 +261,7 @@ static Uint32 read_sample_fmt_normal(Sound_Sample *sample)
|
|
262
261
|
Uint32 retval;
|
263
262
|
Sound_SampleInternal *internal = (Sound_SampleInternal *) sample->opaque;
|
264
263
|
aiff_t *a = (aiff_t *) internal->decoder_private;
|
265
|
-
Uint32 max = (internal->buffer_size
|
266
|
-
internal->buffer_size : (Uint32) a->bytesLeft;
|
264
|
+
const Uint32 max = SDL_min(internal->buffer_size, (Uint32) a->bytesLeft);
|
267
265
|
|
268
266
|
SDL_assert(max > 0);
|
269
267
|
|
@@ -279,7 +277,7 @@ static Uint32 read_sample_fmt_normal(Sound_Sample *sample)
|
|
279
277
|
if ((retval == 0) || (a->bytesLeft == 0))
|
280
278
|
sample->flags |= SOUND_SAMPLEFLAG_EOF;
|
281
279
|
|
282
|
-
else if (retval == -1)
|
280
|
+
else if (retval == -1) /** FIXME: this error check is broken **/
|
283
281
|
sample->flags |= SOUND_SAMPLEFLAG_ERROR;
|
284
282
|
|
285
283
|
/* (next call this EAGAIN may turn into an EOF or error.) */
|
@@ -301,10 +299,10 @@ static int seek_sample_fmt_normal(Sound_Sample *sample, Uint32 ms)
|
|
301
299
|
{
|
302
300
|
Sound_SampleInternal *internal = (Sound_SampleInternal *) sample->opaque;
|
303
301
|
aiff_t *a = (aiff_t *) internal->decoder_private;
|
304
|
-
fmt_t *fmt = &a->fmt;
|
305
|
-
|
306
|
-
|
307
|
-
|
302
|
+
const fmt_t *fmt = &a->fmt;
|
303
|
+
const Uint32 offset = __Sound_convertMsToBytePos(&sample->actual, ms);
|
304
|
+
const Sint64 pos = (Sint64) (fmt->data_starting_offset + offset);
|
305
|
+
const Sint64 rc = SDL_RWseek(internal->rw, pos, RW_SEEK_SET);
|
308
306
|
BAIL_IF_MACRO(rc != pos, ERR_IO_ERROR, 0);
|
309
307
|
a->bytesLeft = fmt->total_bytes - offset;
|
310
308
|
return 1; /* success. */
|
@@ -334,9 +332,9 @@ static int read_fmt_normal(SDL_RWops *rw, fmt_t *fmt)
|
|
334
332
|
* Everything else... *
|
335
333
|
*****************************************************************************/
|
336
334
|
|
337
|
-
static
|
335
|
+
static SDL_bool AIFF_init(void)
|
338
336
|
{
|
339
|
-
return
|
337
|
+
return SDL_TRUE; /* always succeeds. */
|
340
338
|
} /* AIFF_init */
|
341
339
|
|
342
340
|
|
@@ -360,7 +358,7 @@ static int find_chunk(SDL_RWops *rw, Uint32 id)
|
|
360
358
|
BAIL_IF_MACRO(SDL_RWread(rw, &siz, sizeof (siz), 1) != 1, NULL, 0);
|
361
359
|
siz = SDL_SwapBE32(siz);
|
362
360
|
SDL_assert(siz > 0);
|
363
|
-
BAIL_IF_MACRO(SDL_RWseek(rw, siz,
|
361
|
+
BAIL_IF_MACRO(SDL_RWseek(rw, siz, RW_SEEK_CUR) == -1, NULL, 0);
|
364
362
|
} /* while */
|
365
363
|
|
366
364
|
return 0; /* shouldn't hit this, but just in case... */
|
@@ -380,14 +378,11 @@ static int read_fmt(SDL_RWops *rw, comm_t *c, fmt_t *fmt)
|
|
380
378
|
|
381
379
|
/* add other types here. */
|
382
380
|
|
383
|
-
default:
|
384
|
-
SNDDBG(("AIFF: Format %lu is unknown.\n",
|
385
|
-
(unsigned int) fmt->type));
|
386
|
-
BAIL_MACRO("AIFF: Unsupported format", 0);
|
387
381
|
} /* switch */
|
388
382
|
|
389
|
-
|
390
|
-
|
383
|
+
SNDDBG(("AIFF: Format %u is unknown.\n",
|
384
|
+
(unsigned int) fmt->type));
|
385
|
+
BAIL_MACRO("AIFF: Unsupported format", 0);
|
391
386
|
} /* read_fmt */
|
392
387
|
|
393
388
|
|
@@ -396,8 +391,8 @@ static int AIFF_open(Sound_Sample *sample, const char *ext)
|
|
396
391
|
Sound_SampleInternal *internal = (Sound_SampleInternal *) sample->opaque;
|
397
392
|
SDL_RWops *rw = internal->rw;
|
398
393
|
Uint32 chunk_id;
|
399
|
-
|
400
|
-
|
394
|
+
Uint32 bytes_per_sample;
|
395
|
+
Sint64 pos;
|
401
396
|
comm_t c;
|
402
397
|
ssnd_t s;
|
403
398
|
aiff_t *a;
|
@@ -416,14 +411,11 @@ static int AIFF_open(Sound_Sample *sample, const char *ext)
|
|
416
411
|
BAIL_IF_MACRO(!read_comm_chunk(rw, &c),
|
417
412
|
"AIFF: Can't read common chunk.", 0);
|
418
413
|
|
414
|
+
BAIL_IF_MACRO(c.numChannels == 0, "AIFF: no channels specified.", 0);
|
415
|
+
|
419
416
|
sample->actual.channels = (Uint8) c.numChannels;
|
420
417
|
sample->actual.rate = c.sampleRate;
|
421
418
|
|
422
|
-
/* Really, sample->total_time = (c.numSampleFrames*1000) c.sampleRate */
|
423
|
-
internal->total_time = (c.numSampleFrames / c.sampleRate) * 1000;
|
424
|
-
internal->total_time += (c.numSampleFrames % c.sampleRate)
|
425
|
-
* 1000 / c.sampleRate;
|
426
|
-
|
427
419
|
if (c.sampleSize <= 8)
|
428
420
|
{
|
429
421
|
sample->actual.format = AUDIO_S8;
|
@@ -450,7 +442,7 @@ static int AIFF_open(Sound_Sample *sample, const char *ext)
|
|
450
442
|
return 0;
|
451
443
|
} /* if */
|
452
444
|
|
453
|
-
SDL_RWseek(rw, pos,
|
445
|
+
SDL_RWseek(rw, pos, RW_SEEK_SET); /* if the seek fails, let it go... */
|
454
446
|
|
455
447
|
if (!find_chunk(rw, ssndID))
|
456
448
|
{
|
@@ -464,6 +456,14 @@ static int AIFF_open(Sound_Sample *sample, const char *ext)
|
|
464
456
|
BAIL_MACRO("AIFF: Can't read sound data chunk.", 0);
|
465
457
|
} /* if */
|
466
458
|
|
459
|
+
if (c.numSampleFrames == 0)
|
460
|
+
c.numSampleFrames = (s.ckDataSize - 8) / bytes_per_sample;
|
461
|
+
|
462
|
+
/* Really, sample->total_time = (c.numSampleFrames*1000) c.sampleRate */
|
463
|
+
internal->total_time = (c.numSampleFrames / c.sampleRate) * 1000;
|
464
|
+
internal->total_time += (c.numSampleFrames % c.sampleRate) * 1000 / c.sampleRate;
|
465
|
+
|
466
|
+
|
467
467
|
a->fmt.total_bytes = a->bytesLeft = bytes_per_sample * c.numSampleFrames;
|
468
468
|
a->fmt.data_starting_offset = SDL_RWtell(rw);
|
469
469
|
internal->decoder_private = (void *) a;
|
@@ -496,8 +496,8 @@ static int AIFF_rewind(Sound_Sample *sample)
|
|
496
496
|
{
|
497
497
|
Sound_SampleInternal *internal = (Sound_SampleInternal *) sample->opaque;
|
498
498
|
aiff_t *a = (aiff_t *) internal->decoder_private;
|
499
|
-
fmt_t *fmt = &a->fmt;
|
500
|
-
|
499
|
+
const fmt_t *fmt = &a->fmt;
|
500
|
+
const Sint64 rc = SDL_RWseek(internal->rw, fmt->data_starting_offset, RW_SEEK_SET);
|
501
501
|
BAIL_IF_MACRO(rc != fmt->data_starting_offset, ERR_IO_ERROR, 0);
|
502
502
|
a->bytesLeft = fmt->total_bytes;
|
503
503
|
return fmt->rewind_sample(sample);
|
@@ -18,9 +18,9 @@
|
|
18
18
|
#if SOUND_SUPPORTS_AU
|
19
19
|
|
20
20
|
/* no init/deinit needed */
|
21
|
-
static
|
21
|
+
static SDL_bool AU_init(void)
|
22
22
|
{
|
23
|
-
return
|
23
|
+
return SDL_TRUE;
|
24
24
|
} /* AU_init */
|
25
25
|
|
26
26
|
static void AU_quit(void)
|
@@ -63,7 +63,7 @@ struct audec
|
|
63
63
|
{
|
64
64
|
Uint32 total;
|
65
65
|
Uint32 remaining;
|
66
|
-
|
66
|
+
Sint64 start_offset;
|
67
67
|
int encoding;
|
68
68
|
};
|
69
69
|
|
@@ -109,7 +109,7 @@ static int AU_open(Sound_Sample *sample, const char *ext)
|
|
109
109
|
{
|
110
110
|
Sound_SampleInternal *internal = sample->opaque;
|
111
111
|
SDL_RWops *rw = internal->rw;
|
112
|
-
int
|
112
|
+
int hsize, i, bytes_per_second;
|
113
113
|
struct au_file_hdr hdr;
|
114
114
|
struct audec *dec;
|
115
115
|
char c;
|
@@ -163,7 +163,7 @@ static int AU_open(Sound_Sample *sample, const char *ext)
|
|
163
163
|
} /* for */
|
164
164
|
} /* if */
|
165
165
|
|
166
|
-
else if (SDL_strcasecmp(ext, "au") == 0)
|
166
|
+
else if (ext && SDL_strcasecmp(ext, "au") == 0)
|
167
167
|
{
|
168
168
|
/*
|
169
169
|
* A number of files in the wild have the .au extension but no valid
|
@@ -173,9 +173,9 @@ static int AU_open(Sound_Sample *sample, const char *ext)
|
|
173
173
|
|
174
174
|
SNDDBG(("AU: Invalid header, assuming raw 8kHz µ-law.\n"));
|
175
175
|
/* if seeking fails, we lose 24 samples. big deal */
|
176
|
-
SDL_RWseek(rw, -HDR_SIZE,
|
176
|
+
SDL_RWseek(rw, -HDR_SIZE, RW_SEEK_CUR);
|
177
177
|
dec->encoding = AU_ENC_ULAW_8;
|
178
|
-
dec->remaining = (Uint32)-1;
|
178
|
+
dec->remaining = (Uint32)-1; /* no limit */
|
179
179
|
sample->actual.format = AUDIO_S16SYS;
|
180
180
|
sample->actual.rate = 8000;
|
181
181
|
sample->actual.channels = 1;
|
@@ -271,7 +271,7 @@ static Uint32 AU_read(Sound_Sample *sample)
|
|
271
271
|
ret = SDL_RWread(internal->rw, buf, 1, maxlen);
|
272
272
|
if (ret == 0)
|
273
273
|
sample->flags |= SOUND_SAMPLEFLAG_EOF;
|
274
|
-
else if (ret == -1)
|
274
|
+
else if (ret == -1) /** FIXME: this error check is broken **/
|
275
275
|
sample->flags |= SOUND_SAMPLEFLAG_ERROR;
|
276
276
|
else
|
277
277
|
{
|
@@ -297,7 +297,7 @@ static int AU_rewind(Sound_Sample *sample)
|
|
297
297
|
{
|
298
298
|
Sound_SampleInternal *internal = (Sound_SampleInternal *) sample->opaque;
|
299
299
|
struct audec *dec = (struct audec *) internal->decoder_private;
|
300
|
-
|
300
|
+
const Sint64 rc = SDL_RWseek(internal->rw, dec->start_offset, RW_SEEK_SET);
|
301
301
|
BAIL_IF_MACRO(rc != dec->start_offset, ERR_IO_ERROR, 0);
|
302
302
|
dec->remaining = dec->total;
|
303
303
|
return 1;
|
@@ -308,15 +308,15 @@ static int AU_seek(Sound_Sample *sample, Uint32 ms)
|
|
308
308
|
{
|
309
309
|
Sound_SampleInternal *internal = (Sound_SampleInternal *) sample->opaque;
|
310
310
|
struct audec *dec = (struct audec *) internal->decoder_private;
|
311
|
-
|
312
|
-
|
313
|
-
|
311
|
+
Sint64 offset = __Sound_convertMsToBytePos(&sample->actual, ms);
|
312
|
+
Sint64 rc;
|
313
|
+
Sint64 pos;
|
314
314
|
|
315
315
|
if (dec->encoding == AU_ENC_ULAW_8)
|
316
316
|
offset >>= 1; /* halve the byte offset for compression. */
|
317
317
|
|
318
|
-
pos = (
|
319
|
-
rc = SDL_RWseek(internal->rw, pos,
|
318
|
+
pos = (dec->start_offset + offset);
|
319
|
+
rc = SDL_RWseek(internal->rw, pos, RW_SEEK_SET);
|
320
320
|
BAIL_IF_MACRO(rc != pos, ERR_IO_ERROR, 0);
|
321
321
|
dec->remaining = dec->total - offset;
|
322
322
|
return 1;
|
@@ -23,9 +23,9 @@ typedef struct CoreAudioFileContainer
|
|
23
23
|
} CoreAudioFileContainer;
|
24
24
|
|
25
25
|
|
26
|
-
static
|
26
|
+
static SDL_bool CoreAudio_init(void)
|
27
27
|
{
|
28
|
-
return
|
28
|
+
return SDL_TRUE; /* always succeeds. */
|
29
29
|
} /* CoreAudio_init */
|
30
30
|
|
31
31
|
|
@@ -193,11 +193,10 @@ static const char* CoreAudio_FourCCToString(int32_t error_code)
|
|
193
193
|
SInt64 CoreAudio_SizeCallback(void* inClientData)
|
194
194
|
{
|
195
195
|
SDL_RWops* rw_ops = (SDL_RWops*)inClientData;
|
196
|
-
|
197
|
-
|
198
|
-
SDL_RWseek(rw_ops, current_position,
|
196
|
+
const Sint64 current_position = SDL_RWtell(rw_ops);
|
197
|
+
const Sint64 end_position = SDL_RWseek(rw_ops, 0, RW_SEEK_END);
|
198
|
+
SDL_RWseek(rw_ops, current_position, RW_SEEK_SET);
|
199
199
|
// fprintf(stderr, "CoreAudio_SizeCallback:%d\n", end_position);
|
200
|
-
|
201
200
|
return end_position;
|
202
201
|
}
|
203
202
|
|
@@ -210,7 +209,7 @@ OSStatus CoreAudio_ReadCallback(
|
|
210
209
|
)
|
211
210
|
{
|
212
211
|
SDL_RWops* rw_ops = (SDL_RWops*)inClientData;
|
213
|
-
SDL_RWseek(rw_ops, inPosition,
|
212
|
+
SDL_RWseek(rw_ops, inPosition, RW_SEEK_SET);
|
214
213
|
size_t bytes_actually_read = SDL_RWread(rw_ops, data_buffer, 1, requestCount);
|
215
214
|
// Not sure how to test for a read error with SDL_RWops
|
216
215
|
// fprintf(stderr, "CoreAudio_ReadCallback:%d, %d\n", requestCount, bytes_actually_read);
|