gosu 1.4.5 → 1.4.6

Sign up to get free protection for your applications and to get access to all the features.
Files changed (101) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +0 -8
  3. data/dependencies/SDL/include/SDL.h +1 -1
  4. data/dependencies/SDL/include/SDL_assert.h +4 -10
  5. data/dependencies/SDL/include/SDL_atomic.h +1 -1
  6. data/dependencies/SDL/include/SDL_audio.h +1 -1
  7. data/dependencies/SDL/include/SDL_bits.h +1 -1
  8. data/dependencies/SDL/include/SDL_blendmode.h +1 -1
  9. data/dependencies/SDL/include/SDL_clipboard.h +1 -1
  10. data/dependencies/SDL/include/SDL_config.h +2 -2
  11. data/dependencies/SDL/include/SDL_cpuinfo.h +1 -1
  12. data/dependencies/SDL/include/SDL_egl.h +1 -1
  13. data/dependencies/SDL/include/SDL_endian.h +1 -1
  14. data/dependencies/SDL/include/SDL_error.h +1 -1
  15. data/dependencies/SDL/include/SDL_events.h +1 -1
  16. data/dependencies/SDL/include/SDL_filesystem.h +1 -1
  17. data/dependencies/SDL/include/SDL_gamecontroller.h +1 -1
  18. data/dependencies/SDL/include/SDL_gesture.h +1 -1
  19. data/dependencies/SDL/include/SDL_guid.h +1 -1
  20. data/dependencies/SDL/include/SDL_haptic.h +1 -1
  21. data/dependencies/SDL/include/SDL_hidapi.h +1 -1
  22. data/dependencies/SDL/include/SDL_hints.h +1 -1
  23. data/dependencies/SDL/include/SDL_joystick.h +1 -1
  24. data/dependencies/SDL/include/SDL_keyboard.h +1 -1
  25. data/dependencies/SDL/include/SDL_keycode.h +1 -1
  26. data/dependencies/SDL/include/SDL_loadso.h +1 -1
  27. data/dependencies/SDL/include/SDL_locale.h +1 -1
  28. data/dependencies/SDL/include/SDL_log.h +1 -1
  29. data/dependencies/SDL/include/SDL_main.h +1 -1
  30. data/dependencies/SDL/include/SDL_messagebox.h +1 -1
  31. data/dependencies/SDL/include/SDL_metal.h +1 -1
  32. data/dependencies/SDL/include/SDL_misc.h +1 -1
  33. data/dependencies/SDL/include/SDL_mouse.h +1 -1
  34. data/dependencies/SDL/include/SDL_mutex.h +1 -1
  35. data/dependencies/SDL/include/SDL_name.h +1 -1
  36. data/dependencies/SDL/include/SDL_opengl.h +1 -1
  37. data/dependencies/SDL/include/SDL_opengles.h +1 -1
  38. data/dependencies/SDL/include/SDL_opengles2.h +1 -1
  39. data/dependencies/SDL/include/SDL_pixels.h +1 -1
  40. data/dependencies/SDL/include/SDL_platform.h +1 -1
  41. data/dependencies/SDL/include/SDL_power.h +1 -1
  42. data/dependencies/SDL/include/SDL_quit.h +1 -1
  43. data/dependencies/SDL/include/SDL_rect.h +1 -1
  44. data/dependencies/SDL/include/SDL_render.h +1 -1
  45. data/dependencies/SDL/include/SDL_revision.h +2 -2
  46. data/dependencies/SDL/include/SDL_rwops.h +1 -1
  47. data/dependencies/SDL/include/SDL_scancode.h +1 -1
  48. data/dependencies/SDL/include/SDL_sensor.h +1 -1
  49. data/dependencies/SDL/include/SDL_shape.h +1 -1
  50. data/dependencies/SDL/include/SDL_stdinc.h +1 -1
  51. data/dependencies/SDL/include/SDL_surface.h +1 -1
  52. data/dependencies/SDL/include/SDL_system.h +1 -1
  53. data/dependencies/SDL/include/SDL_syswm.h +1 -1
  54. data/dependencies/SDL/include/SDL_test.h +1 -1
  55. data/dependencies/SDL/include/SDL_test_assert.h +1 -1
  56. data/dependencies/SDL/include/SDL_test_common.h +1 -1
  57. data/dependencies/SDL/include/SDL_test_compare.h +1 -1
  58. data/dependencies/SDL/include/SDL_test_crc32.h +1 -1
  59. data/dependencies/SDL/include/SDL_test_font.h +1 -1
  60. data/dependencies/SDL/include/SDL_test_fuzzer.h +1 -1
  61. data/dependencies/SDL/include/SDL_test_harness.h +1 -1
  62. data/dependencies/SDL/include/SDL_test_images.h +1 -1
  63. data/dependencies/SDL/include/SDL_test_log.h +1 -1
  64. data/dependencies/SDL/include/SDL_test_md5.h +1 -1
  65. data/dependencies/SDL/include/SDL_test_memory.h +1 -1
  66. data/dependencies/SDL/include/SDL_test_random.h +1 -1
  67. data/dependencies/SDL/include/SDL_thread.h +3 -3
  68. data/dependencies/SDL/include/SDL_timer.h +1 -1
  69. data/dependencies/SDL/include/SDL_touch.h +1 -1
  70. data/dependencies/SDL/include/SDL_types.h +1 -1
  71. data/dependencies/SDL/include/SDL_version.h +2 -2
  72. data/dependencies/SDL/include/SDL_video.h +1 -1
  73. data/dependencies/SDL/include/begin_code.h +1 -1
  74. data/dependencies/SDL/include/close_code.h +1 -1
  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_internal.h +3 -3
  78. data/dependencies/SDL_sound/SDL_sound_wav.c +5 -0
  79. data/dependencies/mojoAL/mojoal.c +41 -30
  80. data/dependencies/stb/stb_image.h +117 -27
  81. data/ext/gosu/extconf.rb +1 -1
  82. data/include/Gosu/Version.hpp +1 -1
  83. data/lib/SDL2.dll +0 -0
  84. data/lib64/SDL2.dll +0 -0
  85. data/src/AudioFile.hpp +1 -1
  86. data/src/AudioFileSDLSound.cpp +2 -0
  87. data/src/AudioImpl.hpp +2 -2
  88. data/src/Input.cpp +30 -26
  89. data/src/RubyGosu.cxx +146 -93
  90. data/src/RubyGosu.h +5 -7
  91. metadata +3 -13
  92. data/dependencies/SDL/include/SDL_config_android.h +0 -157
  93. data/dependencies/SDL/include/SDL_config_iphoneos.h +0 -166
  94. data/dependencies/SDL/include/SDL_config_macosx.h +0 -197
  95. data/dependencies/SDL/include/SDL_config_minimal.h +0 -82
  96. data/dependencies/SDL/include/SDL_config_pandora.h +0 -128
  97. data/dependencies/SDL/include/SDL_config_psp.h +0 -144
  98. data/dependencies/SDL/include/SDL_config_windows.h +0 -225
  99. data/dependencies/SDL/include/SDL_config_winrt.h +0 -215
  100. data/dependencies/SDL/include/SDL_config_wiz.h +0 -121
  101. data/dependencies/SDL/include/SDL_copying.h +0 -20
@@ -1,6 +1,6 @@
1
1
  /*
2
2
  Simple DirectMedia Layer
3
- Copyright (C) 1997-2022 Sam Lantinga <slouken@libsdl.org>
3
+ Copyright (C) 1997-2023 Sam Lantinga <slouken@libsdl.org>
4
4
 
5
5
  This software is provided 'as-is', without any express or implied
6
6
  warranty. In no event will the authors be held liable for any damages
@@ -1,6 +1,6 @@
1
1
  /*
2
2
  Simple DirectMedia Layer
3
- Copyright (C) 1997-2022 Sam Lantinga <slouken@libsdl.org>
3
+ Copyright (C) 1997-2023 Sam Lantinga <slouken@libsdl.org>
4
4
 
5
5
  This software is provided 'as-is', without any express or implied
6
6
  warranty. In no event will the authors be held liable for any damages
@@ -1,6 +1,6 @@
1
1
  /*
2
2
  Simple DirectMedia Layer
3
- Copyright (C) 1997-2022 Sam Lantinga <slouken@libsdl.org>
3
+ Copyright (C) 1997-2023 Sam Lantinga <slouken@libsdl.org>
4
4
 
5
5
  This software is provided 'as-is', without any express or implied
6
6
  warranty. In no event will the authors be held liable for any damages
@@ -1,6 +1,6 @@
1
1
  /*
2
2
  Simple DirectMedia Layer
3
- Copyright (C) 1997-2022 Sam Lantinga <slouken@libsdl.org>
3
+ Copyright (C) 1997-2023 Sam Lantinga <slouken@libsdl.org>
4
4
 
5
5
  This software is provided 'as-is', without any express or implied
6
6
  warranty. In no event will the authors be held liable for any damages
@@ -1,6 +1,6 @@
1
1
  /*
2
2
  Simple DirectMedia Layer
3
- Copyright (C) 1997-2022 Sam Lantinga <slouken@libsdl.org>
3
+ Copyright (C) 1997-2023 Sam Lantinga <slouken@libsdl.org>
4
4
 
5
5
  This software is provided 'as-is', without any express or implied
6
6
  warranty. In no event will the authors be held liable for any damages
@@ -142,7 +142,7 @@ SDL_CreateThreadWithStackSize(SDL_ThreadFunction fn,
142
142
  #define SDL_CreateThreadWithStackSize(fn, name, stacksize, data) SDL_CreateThreadWithStackSize_REAL(fn, name, stacksize, data, (pfnSDL_CurrentBeginThread)SDL_beginthread, (pfnSDL_CurrentEndThread)SDL_endthread)
143
143
  #else
144
144
  #define SDL_CreateThread(fn, name, data) SDL_CreateThread(fn, name, data, (pfnSDL_CurrentBeginThread)SDL_beginthread, (pfnSDL_CurrentEndThread)SDL_endthread)
145
- #define SDL_CreateThreadWithStackSize(fn, name, stacksize, data) SDL_CreateThreadWithStackSize(fn, name, data, (pfnSDL_CurrentBeginThread)_beginthreadex, (pfnSDL_CurrentEndThread)SDL_endthread)
145
+ #define SDL_CreateThreadWithStackSize(fn, name, stacksize, data) SDL_CreateThreadWithStackSize(fn, name, stacksize, data, (pfnSDL_CurrentBeginThread)SDL_beginthread, (pfnSDL_CurrentEndThread)SDL_endthread)
146
146
  #endif
147
147
 
148
148
  #elif defined(__OS2__)
@@ -175,7 +175,7 @@ SDL_CreateThreadWithStackSize(SDL_ThreadFunction fn, const char *name, const siz
175
175
  #undef SDL_CreateThread
176
176
  #define SDL_CreateThread(fn, name, data) SDL_CreateThread_REAL(fn, name, data, (pfnSDL_CurrentBeginThread)SDL_beginthread, (pfnSDL_CurrentEndThread)SDL_endthread)
177
177
  #undef SDL_CreateThreadWithStackSize
178
- #define SDL_CreateThreadWithStackSize(fn, name, stacksize, data) SDL_CreateThreadWithStackSize_REAL(fn, name, data, (pfnSDL_CurrentBeginThread)SDL_beginthread, (pfnSDL_CurrentEndThread)SDL_endthread)
178
+ #define SDL_CreateThreadWithStackSize(fn, name, stacksize, data) SDL_CreateThreadWithStackSize_REAL(fn, name, stacksize, data, (pfnSDL_CurrentBeginThread)SDL_beginthread, (pfnSDL_CurrentEndThread)SDL_endthread)
179
179
  #else
180
180
  #define SDL_CreateThread(fn, name, data) SDL_CreateThread(fn, name, data, (pfnSDL_CurrentBeginThread)SDL_beginthread, (pfnSDL_CurrentEndThread)SDL_endthread)
181
181
  #define SDL_CreateThreadWithStackSize(fn, name, stacksize, data) SDL_CreateThreadWithStackSize(fn, name, stacksize, data, (pfnSDL_CurrentBeginThread)SDL_beginthread, (pfnSDL_CurrentEndThread)SDL_endthread)
@@ -1,6 +1,6 @@
1
1
  /*
2
2
  Simple DirectMedia Layer
3
- Copyright (C) 1997-2022 Sam Lantinga <slouken@libsdl.org>
3
+ Copyright (C) 1997-2023 Sam Lantinga <slouken@libsdl.org>
4
4
 
5
5
  This software is provided 'as-is', without any express or implied
6
6
  warranty. In no event will the authors be held liable for any damages
@@ -1,6 +1,6 @@
1
1
  /*
2
2
  Simple DirectMedia Layer
3
- Copyright (C) 1997-2022 Sam Lantinga <slouken@libsdl.org>
3
+ Copyright (C) 1997-2023 Sam Lantinga <slouken@libsdl.org>
4
4
 
5
5
  This software is provided 'as-is', without any express or implied
6
6
  warranty. In no event will the authors be held liable for any damages
@@ -1,6 +1,6 @@
1
1
  /*
2
2
  Simple DirectMedia Layer
3
- Copyright (C) 1997-2022 Sam Lantinga <slouken@libsdl.org>
3
+ Copyright (C) 1997-2023 Sam Lantinga <slouken@libsdl.org>
4
4
 
5
5
  This software is provided 'as-is', without any express or implied
6
6
  warranty. In no event will the authors be held liable for any damages
@@ -1,6 +1,6 @@
1
1
  /*
2
2
  Simple DirectMedia Layer
3
- Copyright (C) 1997-2022 Sam Lantinga <slouken@libsdl.org>
3
+ Copyright (C) 1997-2023 Sam Lantinga <slouken@libsdl.org>
4
4
 
5
5
  This software is provided 'as-is', without any express or implied
6
6
  warranty. In no event will the authors be held liable for any damages
@@ -59,7 +59,7 @@ typedef struct SDL_version
59
59
  */
60
60
  #define SDL_MAJOR_VERSION 2
61
61
  #define SDL_MINOR_VERSION 26
62
- #define SDL_PATCHLEVEL 1
62
+ #define SDL_PATCHLEVEL 5
63
63
 
64
64
  /**
65
65
  * Macro to determine SDL version program was compiled against.
@@ -1,6 +1,6 @@
1
1
  /*
2
2
  Simple DirectMedia Layer
3
- Copyright (C) 1997-2022 Sam Lantinga <slouken@libsdl.org>
3
+ Copyright (C) 1997-2023 Sam Lantinga <slouken@libsdl.org>
4
4
 
5
5
  This software is provided 'as-is', without any express or implied
6
6
  warranty. In no event will the authors be held liable for any damages
@@ -1,6 +1,6 @@
1
1
  /*
2
2
  Simple DirectMedia Layer
3
- Copyright (C) 1997-2022 Sam Lantinga <slouken@libsdl.org>
3
+ Copyright (C) 1997-2023 Sam Lantinga <slouken@libsdl.org>
4
4
 
5
5
  This software is provided 'as-is', without any express or implied
6
6
  warranty. In no event will the authors be held liable for any damages
@@ -1,6 +1,6 @@
1
1
  /*
2
2
  Simple DirectMedia Layer
3
- Copyright (C) 1997-2022 Sam Lantinga <slouken@libsdl.org>
3
+ Copyright (C) 1997-2023 Sam Lantinga <slouken@libsdl.org>
4
4
 
5
5
  This software is provided 'as-is', without any express or implied
6
6
  warranty. In no event will the authors be held liable for any damages
Binary file
Binary file
@@ -212,7 +212,7 @@ typedef struct __SOUND_DECODERFUNCTIONS__
212
212
  /*
213
213
  * Reset the decoding to the beginning of the stream. Nonzero on
214
214
  * success, zero on failure.
215
- *
215
+ *
216
216
  * The purpose of this method is to allow for higher efficiency than
217
217
  * an application could get by just recreating the sample externally;
218
218
  * not only do they not have to reopen the RWops, reallocate buffers,
@@ -230,9 +230,9 @@ typedef struct __SOUND_DECODERFUNCTIONS__
230
230
  /*
231
231
  * Reposition the decoding to an arbitrary point. Nonzero on
232
232
  * success, zero on failure.
233
- *
233
+ *
234
234
  * The purpose of this method is to allow for higher efficiency than
235
- * an application could get by just rewinding the sample and
235
+ * an application could get by just rewinding the sample and
236
236
  * decoding to a given point.
237
237
  *
238
238
  * The decoder is responsible for calling seek() on the associated
@@ -715,6 +715,11 @@ static int WAV_open_internal(Sound_Sample *sample, const char *ext, fmt_t *fmt)
715
715
  sample->actual.channels );
716
716
  internal->decoder_private = (void *) w;
717
717
 
718
+ if (fmt->dwAvgBytesPerSec == 0) { /* we assume data is uncompressed if this field is unset. */
719
+ fmt->dwAvgBytesPerSec = fmt->sample_frame_size * sample->actual.rate;
720
+ BAIL_IF_MACRO(fmt->dwAvgBytesPerSec == 0, "WAV: corrupt format chunk?", 0);
721
+ }
722
+
718
723
  internal->total_time = (fmt->total_bytes / fmt->dwAvgBytesPerSec) * 1000;
719
724
  internal->total_time += (fmt->total_bytes % fmt->dwAvgBytesPerSec)
720
725
  * 1000 / fmt->dwAvgBytesPerSec;
@@ -11,7 +11,10 @@
11
11
  #include <math.h>
12
12
  #include <float.h>
13
13
 
14
- #ifdef _WIN32
14
+ /* Unless compiling statically into another app, we want the public API
15
+ to export on Windows. Define these before including al.h, so we override
16
+ its attempt to mark these as `dllimport`. */
17
+ #if defined(_WIN32) && !defined(AL_LIBTYPE_STATIC)
15
18
  #define AL_API __declspec(dllexport)
16
19
  #define ALC_API __declspec(dllexport)
17
20
  #endif
@@ -20,8 +23,8 @@
20
23
  #define M_PI (3.14159265358979323846264338327950288)
21
24
  #endif
22
25
 
23
- #include "AL/al.h"
24
- #include "AL/alc.h"
26
+ #include "al.h"
27
+ #include "alc.h"
25
28
  #include "SDL.h"
26
29
 
27
30
  #ifdef __SSE__ /* if you are on x86 or x86-64, we assume you have SSE1 by now. */
@@ -1166,11 +1169,11 @@ static void mix_float32_c2_neon(const ALfloat * restrict panning, const float *
1166
1169
  *
1167
1170
  * Permission to use, copy, modify, distribute and sell this software and its
1168
1171
  * documentation for any purpose is hereby granted without fee, provided that
1169
- * the above copyright notice and this license appear in all source copies.
1172
+ * the above copyright notice and this license appear in all source copies.
1170
1173
  * THIS SOFTWARE IS PROVIDED "AS IS" WITHOUT EXPRESS OR IMPLIED WARRANTY OF
1171
1174
  * ANY KIND. See http://www.dspguru.com/wol.htm for more information.
1172
1175
  *
1173
- *****************************************************************************/
1176
+ *****************************************************************************/
1174
1177
 
1175
1178
  /* FFT routine, (C)1996 S.M.Bernsee. */
1176
1179
  static void pitch_fft(float *fftBuffer, int fftFrameSize, int sign)
@@ -1195,11 +1198,11 @@ static void pitch_fft(float *fftBuffer, int fftFrameSize, int sign)
1195
1198
  for (k = 0, le = 2; k < endval; k++) {
1196
1199
  le <<= 1;
1197
1200
  le2 = le>>1;
1198
- ur = 1.0;
1199
- ui = 0.0;
1200
- arg = M_PI / (le2>>1);
1201
- wr = SDL_cos(arg);
1202
- wi = sign*SDL_sin(arg);
1201
+ ur = 1.0f;
1202
+ ui = 0.0f;
1203
+ arg = (float) (M_PI / (le2>>1));
1204
+ wr = SDL_cosf(arg);
1205
+ wi = sign*SDL_sinf(arg);
1203
1206
  for (j = 0; j < le2; j += 2) {
1204
1207
  p1r = fftBuffer+j; p1i = p1r+1;
1205
1208
  p2r = p1r+le2; p2i = p2r+1;
@@ -1251,8 +1254,8 @@ static void pitch_shift(ALsource *src, const ALbuffer *buffer, int numSampsToPro
1251
1254
  /* do windowing and re,im interleave */
1252
1255
  for (k = 0; k < pitch_framesize;k++) {
1253
1256
  window = -.5*SDL_cos(2.*M_PI*(double)k/(double)pitch_framesize)+.5;
1254
- state->workspace[2*k] = state->infifo[k] * window;
1255
- state->workspace[2*k+1] = 0.;
1257
+ state->workspace[2*k] = (ALfloat) state->infifo[k] * window;
1258
+ state->workspace[2*k+1] = 0.0f;
1256
1259
  }
1257
1260
 
1258
1261
 
@@ -1273,13 +1276,13 @@ static void pitch_shift(ALsource *src, const ALbuffer *buffer, int numSampsToPro
1273
1276
 
1274
1277
  /* compute phase difference */
1275
1278
  tmp = phase - state->lastphase[k];
1276
- state->lastphase[k] = phase;
1279
+ state->lastphase[k] = (ALfloat) phase;
1277
1280
 
1278
1281
  /* subtract expected phase difference */
1279
1282
  tmp -= (double)k*expct;
1280
1283
 
1281
1284
  /* map delta phase into +/- Pi interval */
1282
- qpd = tmp/M_PI;
1285
+ qpd = (int) (tmp/M_PI);
1283
1286
  if (qpd >= 0) qpd += qpd&1;
1284
1287
  else qpd -= qpd&1;
1285
1288
  tmp -= M_PI*(double)qpd;
@@ -1291,8 +1294,8 @@ static void pitch_shift(ALsource *src, const ALbuffer *buffer, int numSampsToPro
1291
1294
  tmp = (double)k*freqPerBin + tmp*freqPerBin;
1292
1295
 
1293
1296
  /* store magnitude and true frequency in analysis arrays */
1294
- state->workspace[2*k] = magn;
1295
- state->workspace[2*k+1] = tmp;
1297
+ state->workspace[2*k] = (ALfloat) magn;
1298
+ state->workspace[2*k+1] = (ALfloat) tmp;
1296
1299
 
1297
1300
  }
1298
1301
 
@@ -1300,13 +1303,13 @@ static void pitch_shift(ALsource *src, const ALbuffer *buffer, int numSampsToPro
1300
1303
  /* this does the actual pitch shifting */
1301
1304
  SDL_memset(state->synmagn, '\0', sizeof (state->synmagn));
1302
1305
  for (k = 0; k <= pitch_framesize2; k++) {
1303
- index = k*pitchShift;
1304
- if (index <= pitch_framesize2) {
1306
+ index = (int) (k*pitchShift);
1307
+ if (index <= pitch_framesize2) {
1305
1308
  state->synmagn[index] += state->workspace[2*k];
1306
1309
  state->synfreq[index] = state->workspace[2*k+1] * pitchShift;
1307
- }
1310
+ }
1308
1311
  }
1309
-
1312
+
1310
1313
  /* ***************** SYNTHESIS ******************* */
1311
1314
  /* this is the synthesis step */
1312
1315
  for (k = 0; k <= pitch_framesize2; k++) {
@@ -1328,13 +1331,13 @@ static void pitch_shift(ALsource *src, const ALbuffer *buffer, int numSampsToPro
1328
1331
  tmp += (double)k*expct;
1329
1332
 
1330
1333
  /* accumulate delta phase to get bin phase */
1331
- state->sumphase[k] += tmp;
1334
+ state->sumphase[k] += (ALfloat) tmp;
1332
1335
  phase = state->sumphase[k];
1333
1336
 
1334
1337
  /* get real and imag part and re-interleave */
1335
- state->workspace[2*k] = magn*SDL_cos(phase);
1336
- state->workspace[2*k+1] = magn*SDL_sin(phase);
1337
- }
1338
+ state->workspace[2*k] = (ALfloat) (magn*SDL_cos(phase));
1339
+ state->workspace[2*k+1] = (ALfloat) (magn*SDL_sin(phase));
1340
+ }
1338
1341
 
1339
1342
  /* zero negative frequencies */
1340
1343
  for (k = pitch_framesize+2; k < 2*pitch_framesize; k++) state->workspace[k] = 0.;
@@ -1342,10 +1345,10 @@ static void pitch_shift(ALsource *src, const ALbuffer *buffer, int numSampsToPro
1342
1345
  /* do inverse transform */
1343
1346
  pitch_fft(state->workspace, pitch_framesize, 1);
1344
1347
 
1345
- /* do windowing and add to output accumulator */
1348
+ /* do windowing and add to output accumulator */
1346
1349
  for(k=0; k < pitch_framesize; k++) {
1347
1350
  window = -.5*SDL_cos(2.*M_PI*(double)k/(double)pitch_framesize)+.5;
1348
- state->outputaccum[k] += 2.*window*state->workspace[2*k]/(pitch_framesize2*osamp);
1351
+ state->outputaccum[k] += (ALfloat) (2.*window*state->workspace[2*k]/(pitch_framesize2*osamp));
1349
1352
  }
1350
1353
  for (k = 0; k < stepSize; k++) state->outfifo[k] = state->outputaccum[k];
1351
1354
 
@@ -2932,7 +2935,7 @@ static const ALchar *_alGetString(const ALenum param)
2932
2935
 
2933
2936
  return NULL;
2934
2937
  }
2935
- ENTRYPOINT(const ALchar *,alGetString,(const ALenum param),(param))
2938
+ ENTRYPOINT(const ALchar *,alGetString,(ALenum param),(param))
2936
2939
 
2937
2940
  static void _alGetBooleanv(const ALenum param, ALboolean *values)
2938
2941
  {
@@ -4257,14 +4260,18 @@ static void source_set_offset(ALsource *src, ALenum param, ALfloat value)
4257
4260
 
4258
4261
  switch (param) {
4259
4262
  case AL_SAMPLE_OFFSET:
4260
- offset = value * framesize;
4263
+ offset = ((int) value) * framesize;
4261
4264
  break;
4262
4265
  case AL_SEC_OFFSET:
4263
- offset = value * freq * framesize;
4266
+ offset = ((int) value) * freq * framesize;
4264
4267
  break;
4265
4268
  case AL_BYTE_OFFSET:
4266
- offset = ((int)value / framesize) * framesize;
4269
+ offset = (((int) value) / framesize) * framesize;
4267
4270
  break;
4271
+ default:
4272
+ SDL_assert(!"Unexpected source offset type!");
4273
+ set_al_error(ctx, AL_INVALID_ENUM); /* this is a MojoAL bug, not an app bug, but we'll try to recover. */
4274
+ return;
4268
4275
  }
4269
4276
 
4270
4277
  if ((offset < 0) || (offset > bufflen)) {
@@ -4282,6 +4289,10 @@ static void source_set_offset(ALsource *src, ALenum param, ALfloat value)
4282
4289
  src->offset = offset;
4283
4290
  SDL_UnlockMutex(ctx->source_lock);
4284
4291
  }
4292
+
4293
+ if (SDL_AtomicGet(&src->state) != AL_PLAYING) {
4294
+ src->offset_latched = SDL_TRUE;
4295
+ }
4285
4296
  }
4286
4297
 
4287
4298
  /* deal with alSourcePlay and alSourcePlayv (etc) boiler plate... */