gosu 1.4.5.pre1 → 1.4.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +0 -8
- data/dependencies/SDL/include/SDL.h +2 -1
- data/dependencies/SDL/include/SDL_assert.h +8 -12
- data/dependencies/SDL/include/SDL_atomic.h +21 -1
- data/dependencies/SDL/include/SDL_audio.h +41 -5
- data/dependencies/SDL/include/SDL_bits.h +1 -1
- data/dependencies/SDL/include/SDL_blendmode.h +5 -7
- data/dependencies/SDL/include/SDL_clipboard.h +48 -1
- data/dependencies/SDL/include/SDL_config.h +73 -47
- data/dependencies/SDL/include/SDL_cpuinfo.h +40 -5
- data/dependencies/SDL/include/SDL_egl.h +60 -10
- data/dependencies/SDL/include/SDL_endian.h +35 -4
- data/dependencies/SDL/include/SDL_error.h +1 -1
- data/dependencies/SDL/include/SDL_events.h +33 -2
- data/dependencies/SDL/include/SDL_filesystem.h +6 -2
- data/dependencies/SDL/include/SDL_gamecontroller.h +79 -6
- data/dependencies/SDL/include/SDL_gesture.h +1 -1
- data/dependencies/SDL/include/SDL_guid.h +100 -0
- data/dependencies/SDL/include/SDL_haptic.h +1 -1
- data/dependencies/SDL/include/SDL_hidapi.h +1 -1
- data/dependencies/SDL/include/SDL_hints.h +646 -44
- data/dependencies/SDL/include/SDL_joystick.h +128 -8
- data/dependencies/SDL/include/SDL_keyboard.h +39 -2
- data/dependencies/SDL/include/SDL_keycode.h +7 -2
- data/dependencies/SDL/include/SDL_loadso.h +1 -1
- data/dependencies/SDL/include/SDL_locale.h +1 -1
- data/dependencies/SDL/include/SDL_log.h +3 -3
- data/dependencies/SDL/include/SDL_main.h +43 -3
- data/dependencies/SDL/include/SDL_messagebox.h +1 -1
- data/dependencies/SDL/include/SDL_metal.h +3 -2
- data/dependencies/SDL/include/SDL_misc.h +1 -1
- data/dependencies/SDL/include/SDL_mouse.h +13 -2
- data/dependencies/SDL/include/SDL_mutex.h +1 -1
- data/dependencies/SDL/include/SDL_name.h +1 -1
- data/dependencies/SDL/include/SDL_opengl.h +1 -52
- data/dependencies/SDL/include/SDL_opengl_glext.h +2260 -231
- data/dependencies/SDL/include/SDL_opengles.h +1 -1
- data/dependencies/SDL/include/SDL_opengles2.h +1 -1
- data/dependencies/SDL/include/SDL_opengles2_gl2.h +374 -339
- data/dependencies/SDL/include/SDL_opengles2_gl2ext.h +3479 -1496
- data/dependencies/SDL/include/SDL_opengles2_gl2platform.h +6 -9
- data/dependencies/SDL/include/SDL_opengles2_khrplatform.h +43 -14
- data/dependencies/SDL/include/SDL_pixels.h +1 -1
- data/dependencies/SDL/include/SDL_platform.h +33 -7
- data/dependencies/SDL/include/SDL_power.h +1 -1
- data/dependencies/SDL/include/SDL_quit.h +1 -1
- data/dependencies/SDL/include/SDL_rect.h +155 -3
- data/dependencies/SDL/include/SDL_render.h +47 -18
- data/dependencies/SDL/include/SDL_revision.h +6 -1
- data/dependencies/SDL/include/SDL_rwops.h +2 -16
- data/dependencies/SDL/include/SDL_scancode.h +47 -22
- data/dependencies/SDL/include/SDL_sensor.h +25 -4
- data/dependencies/SDL/include/SDL_shape.h +1 -1
- data/dependencies/SDL/include/SDL_stdinc.h +120 -9
- data/dependencies/SDL/include/SDL_surface.h +4 -2
- data/dependencies/SDL/include/SDL_system.h +67 -7
- data/dependencies/SDL/include/SDL_syswm.h +3 -1
- data/dependencies/SDL/include/SDL_test.h +1 -1
- data/dependencies/SDL/include/SDL_test_assert.h +1 -1
- data/dependencies/SDL/include/SDL_test_common.h +2 -1
- 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 +91 -4
- data/dependencies/SDL/include/SDL_test_fuzzer.h +1 -1
- data/dependencies/SDL/include/SDL_test_harness.h +1 -1
- 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 +1 -1
- data/dependencies/SDL/include/SDL_thread.h +6 -6
- data/dependencies/SDL/include/SDL_timer.h +1 -1
- data/dependencies/SDL/include/SDL_touch.h +9 -1
- data/dependencies/SDL/include/SDL_types.h +1 -1
- data/dependencies/SDL/include/SDL_version.h +20 -4
- data/dependencies/SDL/include/SDL_video.h +72 -10
- data/dependencies/SDL/include/begin_code.h +5 -5
- 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 +210 -71
- data/dependencies/SDL_sound/SDL_sound.h +1 -1
- data/dependencies/SDL_sound/SDL_sound_coreaudio.c +111 -168
- data/dependencies/SDL_sound/SDL_sound_flac.c +0 -6
- data/dependencies/SDL_sound/SDL_sound_internal.h +24 -2
- data/dependencies/SDL_sound/SDL_sound_modplug.c +20 -8
- data/dependencies/SDL_sound/SDL_sound_mp3.c +11 -7
- data/dependencies/SDL_sound/SDL_sound_raw.c +1 -1
- data/dependencies/SDL_sound/SDL_sound_shn.c +1 -5
- data/dependencies/SDL_sound/SDL_sound_voc.c +1 -1
- data/dependencies/SDL_sound/SDL_sound_vorbis.c +2 -4
- data/dependencies/SDL_sound/SDL_sound_wav.c +49 -20
- data/dependencies/SDL_sound/dr_flac.h +237 -95
- data/dependencies/SDL_sound/dr_mp3.h +46 -33
- data/dependencies/SDL_sound/libmodplug/fastmix.c +53 -39
- data/dependencies/SDL_sound/libmodplug/libmodplug.h +0 -12
- data/dependencies/SDL_sound/libmodplug/load_669.c +37 -32
- data/dependencies/SDL_sound/libmodplug/load_amf.c +57 -44
- data/dependencies/SDL_sound/libmodplug/load_ams.c +127 -100
- data/dependencies/SDL_sound/libmodplug/load_dbm.c +40 -37
- data/dependencies/SDL_sound/libmodplug/load_dmf.c +61 -49
- data/dependencies/SDL_sound/libmodplug/load_dsm.c +18 -13
- data/dependencies/SDL_sound/libmodplug/load_far.c +31 -24
- data/dependencies/SDL_sound/libmodplug/load_gdm.c +27 -21
- data/dependencies/SDL_sound/libmodplug/load_it.c +106 -91
- data/dependencies/SDL_sound/libmodplug/load_mdl.c +43 -35
- data/dependencies/SDL_sound/libmodplug/load_med.c +66 -52
- data/dependencies/SDL_sound/libmodplug/load_mod.c +30 -26
- data/dependencies/SDL_sound/libmodplug/load_mt2.c +61 -50
- data/dependencies/SDL_sound/libmodplug/load_mtm.c +23 -17
- data/dependencies/SDL_sound/libmodplug/load_okt.c +18 -16
- data/dependencies/SDL_sound/libmodplug/load_psm.c +44 -32
- data/dependencies/SDL_sound/libmodplug/load_ptm.c +18 -14
- data/dependencies/SDL_sound/libmodplug/load_s3m.c +59 -53
- data/dependencies/SDL_sound/libmodplug/load_stm.c +23 -18
- data/dependencies/SDL_sound/libmodplug/load_ult.c +33 -29
- data/dependencies/SDL_sound/libmodplug/load_xm.c +64 -57
- data/dependencies/SDL_sound/libmodplug/mmcmp.c +2 -1
- data/dependencies/SDL_sound/libmodplug/snd_dsp.c +30 -20
- data/dependencies/SDL_sound/libmodplug/snd_flt.c +6 -4
- data/dependencies/SDL_sound/libmodplug/snd_fx.c +91 -65
- data/dependencies/SDL_sound/libmodplug/sndfile.c +91 -66
- data/dependencies/SDL_sound/libmodplug/sndmix.c +58 -35
- data/dependencies/SDL_sound/stb_vorbis.h +14 -9
- data/dependencies/mojoAL/mojoal.c +68 -40
- data/dependencies/stb/stb_image.h +117 -27
- data/dependencies/utf8proc/utf8proc.c +1 -1
- data/dependencies/utf8proc/utf8proc.h +1 -1
- data/dependencies/utf8proc/utf8proc_data.h +3366 -3184
- data/ext/gosu/extconf.rb +1 -1
- data/include/Gosu/Version.hpp +1 -1
- data/lib/SDL2.dll +0 -0
- data/lib64/SDL2.dll +0 -0
- data/src/AudioFile.hpp +1 -1
- data/src/AudioFileSDLSound.cpp +2 -0
- data/src/AudioImpl.hpp +2 -2
- data/src/Input.cpp +30 -26
- data/src/RubyGosu.cxx +146 -93
- data/src/RubyGosu.h +5 -7
- data/src/Window.cpp +3 -0
- metadata +6 -15
- data/dependencies/SDL/include/SDL_config_android.h +0 -157
- data/dependencies/SDL/include/SDL_config_iphoneos.h +0 -166
- data/dependencies/SDL/include/SDL_config_macosx.h +0 -197
- data/dependencies/SDL/include/SDL_config_minimal.h +0 -82
- data/dependencies/SDL/include/SDL_config_pandora.h +0 -128
- data/dependencies/SDL/include/SDL_config_psp.h +0 -144
- data/dependencies/SDL/include/SDL_config_windows.h +0 -225
- data/dependencies/SDL/include/SDL_config_winrt.h +0 -215
- data/dependencies/SDL/include/SDL_config_wiz.h +0 -121
- data/dependencies/SDL/include/SDL_copying.h +0 -20
@@ -11,7 +11,10 @@
|
|
11
11
|
#include <math.h>
|
12
12
|
#include <float.h>
|
13
13
|
|
14
|
-
|
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 "
|
24
|
-
#include "
|
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. */
|
@@ -470,6 +473,7 @@ SIMDALIGNEDSTRUCT ALsource
|
|
470
473
|
ALfloat cone_outer_gain;
|
471
474
|
ALbuffer *buffer;
|
472
475
|
SDL_AudioStream *stream; /* for resampling. */
|
476
|
+
SDL_atomic_t total_queued_buffers; /* everything queued, playing and processed. AL_BUFFERS_QUEUED value. */
|
473
477
|
BufferQueue buffer_queue;
|
474
478
|
BufferQueue buffer_queue_processed;
|
475
479
|
ALsizei offset; /* offset in bytes for converted stream! */
|
@@ -567,7 +571,7 @@ static void queue_new_buffer_items_recursive(BufferQueue *queue, BufferQueueItem
|
|
567
571
|
return;
|
568
572
|
}
|
569
573
|
|
570
|
-
queue_new_buffer_items_recursive(queue, items->next);
|
574
|
+
queue_new_buffer_items_recursive(queue, (BufferQueueItem*)items->next);
|
571
575
|
items->next = NULL;
|
572
576
|
if (queue->tail) {
|
573
577
|
queue->tail->next = items;
|
@@ -599,7 +603,7 @@ static void source_mark_all_buffers_processed(ALsource *src)
|
|
599
603
|
while (src->buffer_queue.head) {
|
600
604
|
void *ptr;
|
601
605
|
BufferQueueItem *item = src->buffer_queue.head;
|
602
|
-
src->buffer_queue.head = item->next;
|
606
|
+
src->buffer_queue.head = (BufferQueueItem*)item->next;
|
603
607
|
SDL_AtomicAdd(&src->buffer_queue.num_items, -1);
|
604
608
|
|
605
609
|
/* Move it to the processed queue for alSourceUnqueueBuffers() to pick up. */
|
@@ -619,7 +623,7 @@ static void source_release_buffer_queue(ALCcontext *ctx, ALsource *src)
|
|
619
623
|
obtain_newly_queued_buffers(&src->buffer_queue);
|
620
624
|
if (src->buffer_queue.tail != NULL) {
|
621
625
|
BufferQueueItem *i;
|
622
|
-
for (i = src->buffer_queue.head; i; i = i->next) {
|
626
|
+
for (i = src->buffer_queue.head; i; i = (BufferQueueItem*)i->next) {
|
623
627
|
(void) SDL_AtomicDecRef(&i->buffer->refcount);
|
624
628
|
}
|
625
629
|
src->buffer_queue.tail->next = ctx->device->playback.buffer_queue_pool;
|
@@ -631,7 +635,7 @@ static void source_release_buffer_queue(ALCcontext *ctx, ALsource *src)
|
|
631
635
|
obtain_newly_queued_buffers(&src->buffer_queue_processed);
|
632
636
|
if (src->buffer_queue_processed.tail != NULL) {
|
633
637
|
BufferQueueItem *i;
|
634
|
-
for (i = src->buffer_queue_processed.head; i; i = i->next) {
|
638
|
+
for (i = src->buffer_queue_processed.head; i; i = (BufferQueueItem*)i->next) {
|
635
639
|
(void) SDL_AtomicDecRef(&i->buffer->refcount);
|
636
640
|
}
|
637
641
|
src->buffer_queue_processed.tail->next = ctx->device->playback.buffer_queue_pool;
|
@@ -764,7 +768,7 @@ ALCboolean alcCloseDevice(ALCdevice *device)
|
|
764
768
|
|
765
769
|
item = device->playback.buffer_queue_pool;
|
766
770
|
while (item) {
|
767
|
-
BufferQueueItem *next = item->next;
|
771
|
+
BufferQueueItem *next = (BufferQueueItem*)item->next;
|
768
772
|
SDL_free(item);
|
769
773
|
item = next;
|
770
774
|
}
|
@@ -1194,11 +1198,11 @@ static void pitch_fft(float *fftBuffer, int fftFrameSize, int sign)
|
|
1194
1198
|
for (k = 0, le = 2; k < endval; k++) {
|
1195
1199
|
le <<= 1;
|
1196
1200
|
le2 = le>>1;
|
1197
|
-
ur = 1.
|
1198
|
-
ui = 0.
|
1199
|
-
arg = M_PI / (le2>>1);
|
1200
|
-
wr =
|
1201
|
-
wi = sign*
|
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);
|
1202
1206
|
for (j = 0; j < le2; j += 2) {
|
1203
1207
|
p1r = fftBuffer+j; p1i = p1r+1;
|
1204
1208
|
p2r = p1r+le2; p2i = p2r+1;
|
@@ -1250,8 +1254,8 @@ static void pitch_shift(ALsource *src, const ALbuffer *buffer, int numSampsToPro
|
|
1250
1254
|
/* do windowing and re,im interleave */
|
1251
1255
|
for (k = 0; k < pitch_framesize;k++) {
|
1252
1256
|
window = -.5*SDL_cos(2.*M_PI*(double)k/(double)pitch_framesize)+.5;
|
1253
|
-
state->workspace[2*k] = state->infifo[k] * window;
|
1254
|
-
state->workspace[2*k+1] = 0
|
1257
|
+
state->workspace[2*k] = (ALfloat) state->infifo[k] * window;
|
1258
|
+
state->workspace[2*k+1] = 0.0f;
|
1255
1259
|
}
|
1256
1260
|
|
1257
1261
|
|
@@ -1272,13 +1276,13 @@ static void pitch_shift(ALsource *src, const ALbuffer *buffer, int numSampsToPro
|
|
1272
1276
|
|
1273
1277
|
/* compute phase difference */
|
1274
1278
|
tmp = phase - state->lastphase[k];
|
1275
|
-
state->lastphase[k] = phase;
|
1279
|
+
state->lastphase[k] = (ALfloat) phase;
|
1276
1280
|
|
1277
1281
|
/* subtract expected phase difference */
|
1278
1282
|
tmp -= (double)k*expct;
|
1279
1283
|
|
1280
1284
|
/* map delta phase into +/- Pi interval */
|
1281
|
-
qpd = tmp/M_PI;
|
1285
|
+
qpd = (int) (tmp/M_PI);
|
1282
1286
|
if (qpd >= 0) qpd += qpd&1;
|
1283
1287
|
else qpd -= qpd&1;
|
1284
1288
|
tmp -= M_PI*(double)qpd;
|
@@ -1290,8 +1294,8 @@ static void pitch_shift(ALsource *src, const ALbuffer *buffer, int numSampsToPro
|
|
1290
1294
|
tmp = (double)k*freqPerBin + tmp*freqPerBin;
|
1291
1295
|
|
1292
1296
|
/* store magnitude and true frequency in analysis arrays */
|
1293
|
-
state->workspace[2*k] = magn;
|
1294
|
-
state->workspace[2*k+1] = tmp;
|
1297
|
+
state->workspace[2*k] = (ALfloat) magn;
|
1298
|
+
state->workspace[2*k+1] = (ALfloat) tmp;
|
1295
1299
|
|
1296
1300
|
}
|
1297
1301
|
|
@@ -1299,7 +1303,7 @@ static void pitch_shift(ALsource *src, const ALbuffer *buffer, int numSampsToPro
|
|
1299
1303
|
/* this does the actual pitch shifting */
|
1300
1304
|
SDL_memset(state->synmagn, '\0', sizeof (state->synmagn));
|
1301
1305
|
for (k = 0; k <= pitch_framesize2; k++) {
|
1302
|
-
index = k*pitchShift;
|
1306
|
+
index = (int) (k*pitchShift);
|
1303
1307
|
if (index <= pitch_framesize2) {
|
1304
1308
|
state->synmagn[index] += state->workspace[2*k];
|
1305
1309
|
state->synfreq[index] = state->workspace[2*k+1] * pitchShift;
|
@@ -1327,12 +1331,12 @@ static void pitch_shift(ALsource *src, const ALbuffer *buffer, int numSampsToPro
|
|
1327
1331
|
tmp += (double)k*expct;
|
1328
1332
|
|
1329
1333
|
/* accumulate delta phase to get bin phase */
|
1330
|
-
state->sumphase[k] += tmp;
|
1334
|
+
state->sumphase[k] += (ALfloat) tmp;
|
1331
1335
|
phase = state->sumphase[k];
|
1332
1336
|
|
1333
1337
|
/* get real and imag part and re-interleave */
|
1334
|
-
state->workspace[2*k] = magn*SDL_cos(phase);
|
1335
|
-
state->workspace[2*k+1] = magn*SDL_sin(phase);
|
1338
|
+
state->workspace[2*k] = (ALfloat) (magn*SDL_cos(phase));
|
1339
|
+
state->workspace[2*k+1] = (ALfloat) (magn*SDL_sin(phase));
|
1336
1340
|
}
|
1337
1341
|
|
1338
1342
|
/* zero negative frequencies */
|
@@ -1344,7 +1348,7 @@ static void pitch_shift(ALsource *src, const ALbuffer *buffer, int numSampsToPro
|
|
1344
1348
|
/* do windowing and add to output accumulator */
|
1345
1349
|
for(k=0; k < pitch_framesize; k++) {
|
1346
1350
|
window = -.5*SDL_cos(2.*M_PI*(double)k/(double)pitch_framesize)+.5;
|
1347
|
-
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));
|
1348
1352
|
}
|
1349
1353
|
for (k = 0; k < stepSize; k++) state->outfifo[k] = state->outputaccum[k];
|
1350
1354
|
|
@@ -1466,7 +1470,7 @@ static ALCboolean mix_source_buffer_queue(ALCcontext *ctx, ALsource *src, Buffer
|
|
1466
1470
|
while ((len > 0) && (mix_source_buffer(ctx, src, queue, &stream, &len))) {
|
1467
1471
|
/* Finished this buffer! */
|
1468
1472
|
BufferQueueItem *item = queue;
|
1469
|
-
BufferQueueItem *next = queue ? queue->next : NULL;
|
1473
|
+
BufferQueueItem *next = queue ? (BufferQueueItem*)queue->next : NULL;
|
1470
1474
|
void *ptr;
|
1471
1475
|
|
1472
1476
|
if (queue) {
|
@@ -2569,6 +2573,16 @@ static void _alcGetIntegerv(ALCdevice *device, const ALCenum param, const ALCsiz
|
|
2569
2573
|
*values = OPENAL_VERSION_MINOR;
|
2570
2574
|
return;
|
2571
2575
|
|
2576
|
+
case ALC_FREQUENCY:
|
2577
|
+
if (!device) {
|
2578
|
+
*values = 0;
|
2579
|
+
set_alc_error(device, ALC_INVALID_DEVICE);
|
2580
|
+
return;
|
2581
|
+
}
|
2582
|
+
|
2583
|
+
*values = device->frequency;
|
2584
|
+
return;
|
2585
|
+
|
2572
2586
|
default: break;
|
2573
2587
|
}
|
2574
2588
|
|
@@ -2921,7 +2935,7 @@ static const ALchar *_alGetString(const ALenum param)
|
|
2921
2935
|
|
2922
2936
|
return NULL;
|
2923
2937
|
}
|
2924
|
-
ENTRYPOINT(const ALchar *,alGetString,(
|
2938
|
+
ENTRYPOINT(const ALchar *,alGetString,(ALenum param),(param))
|
2925
2939
|
|
2926
2940
|
static void _alGetBooleanv(const ALenum param, ALboolean *values)
|
2927
2941
|
{
|
@@ -3589,6 +3603,7 @@ static void _alGenSources(const ALsizei n, ALuint *names)
|
|
3589
3603
|
|
3590
3604
|
SDL_zerop(src);
|
3591
3605
|
SDL_AtomicSet(&src->state, AL_INITIAL);
|
3606
|
+
SDL_AtomicSet(&src->total_queued_buffers, 0);
|
3592
3607
|
src->name = names[i];
|
3593
3608
|
src->type = AL_UNDETERMINED;
|
3594
3609
|
src->recalc = AL_TRUE;
|
@@ -3906,7 +3921,7 @@ static void _alGetSourcefv(const ALuint name, const ALenum param, ALfloat *value
|
|
3906
3921
|
case AL_REFERENCE_DISTANCE: *values = src->reference_distance; break;
|
3907
3922
|
case AL_ROLLOFF_FACTOR: *values = src->rolloff_factor; break;
|
3908
3923
|
case AL_MAX_DISTANCE: *values = src->max_distance; break;
|
3909
|
-
case AL_PITCH:
|
3924
|
+
case AL_PITCH: *values = src->pitch; break;
|
3910
3925
|
case AL_CONE_INNER_ANGLE: *values = src->cone_inner_angle; break;
|
3911
3926
|
case AL_CONE_OUTER_ANGLE: *values = src->cone_outer_angle; break;
|
3912
3927
|
case AL_CONE_OUTER_GAIN: *values = src->cone_outer_gain; break;
|
@@ -3973,8 +3988,7 @@ static void _alGetSourceiv(const ALuint name, const ALenum param, ALint *values)
|
|
3973
3988
|
case AL_SOURCE_STATE: *values = (ALint) SDL_AtomicGet(&src->state); break;
|
3974
3989
|
case AL_SOURCE_TYPE: *values = (ALint) src->type; break;
|
3975
3990
|
case AL_BUFFER: *values = (ALint) (src->buffer ? src->buffer->name : 0); break;
|
3976
|
-
|
3977
|
-
case AL_BUFFERS_QUEUED: *values = (ALint) SDL_AtomicGet(&src->buffer_queue.num_items); break;
|
3991
|
+
case AL_BUFFERS_QUEUED: *values = (ALint) SDL_AtomicGet(&src->total_queued_buffers); break;
|
3978
3992
|
case AL_BUFFERS_PROCESSED: *values = (ALint) SDL_AtomicGet(&src->buffer_queue_processed.num_items); break;
|
3979
3993
|
case AL_SOURCE_RELATIVE: *values = (ALint) src->source_relative; break;
|
3980
3994
|
case AL_LOOPING: *values = (ALint) src->looping; break;
|
@@ -4134,7 +4148,7 @@ static void source_play(ALCcontext *ctx, const ALsizei n, const ALuint *names)
|
|
4134
4148
|
with it, as nothing else owns the pointers in that list. */
|
4135
4149
|
do {
|
4136
4150
|
ptr = SDL_AtomicGetPtr(&ctx->playlist_todo);
|
4137
|
-
todoend->next = ptr;
|
4151
|
+
todoend->next = (SourcePlayTodo*)ptr;
|
4138
4152
|
} while (!SDL_AtomicCASPtr(&ctx->playlist_todo, ptr, todo.next));
|
4139
4153
|
}
|
4140
4154
|
|
@@ -4162,6 +4176,9 @@ static void source_stop(ALCcontext *ctx, const ALuint name)
|
|
4162
4176
|
}
|
4163
4177
|
SDL_AtomicSet(&src->state, AL_STOPPED);
|
4164
4178
|
source_mark_all_buffers_processed(src);
|
4179
|
+
if (src->stream) {
|
4180
|
+
SDL_AudioStreamClear(src->stream);
|
4181
|
+
}
|
4165
4182
|
if (must_lock) {
|
4166
4183
|
SDL_UnlockMutex(ctx->source_lock);
|
4167
4184
|
}
|
@@ -4228,9 +4245,10 @@ static void source_set_offset(ALsource *src, ALenum param, ALfloat value)
|
|
4228
4245
|
if (!ctx) {
|
4229
4246
|
set_al_error(ctx, AL_INVALID_OPERATION);
|
4230
4247
|
return;
|
4231
|
-
}
|
4232
|
-
|
4233
|
-
|
4248
|
+
} else if (src->type == AL_UNDETERMINED) { /* no buffer to seek in */
|
4249
|
+
set_al_error(ctx, AL_INVALID_OPERATION);
|
4250
|
+
return;
|
4251
|
+
} else if (src->type == AL_STREAMING) {
|
4234
4252
|
FIXME("set_offset for streaming sources not implemented");
|
4235
4253
|
return;
|
4236
4254
|
}
|
@@ -4242,14 +4260,18 @@ static void source_set_offset(ALsource *src, ALenum param, ALfloat value)
|
|
4242
4260
|
|
4243
4261
|
switch (param) {
|
4244
4262
|
case AL_SAMPLE_OFFSET:
|
4245
|
-
offset = value * framesize;
|
4263
|
+
offset = ((int) value) * framesize;
|
4246
4264
|
break;
|
4247
4265
|
case AL_SEC_OFFSET:
|
4248
|
-
offset = value * freq * framesize;
|
4266
|
+
offset = ((int) value) * freq * framesize;
|
4249
4267
|
break;
|
4250
4268
|
case AL_BYTE_OFFSET:
|
4251
|
-
offset = ((int)value / framesize) * framesize;
|
4269
|
+
offset = (((int) value) / framesize) * framesize;
|
4252
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;
|
4253
4275
|
}
|
4254
4276
|
|
4255
4277
|
if ((offset < 0) || (offset > bufflen)) {
|
@@ -4267,6 +4289,10 @@ static void source_set_offset(ALsource *src, ALenum param, ALfloat value)
|
|
4267
4289
|
src->offset = offset;
|
4268
4290
|
SDL_UnlockMutex(ctx->source_lock);
|
4269
4291
|
}
|
4292
|
+
|
4293
|
+
if (SDL_AtomicGet(&src->state) != AL_PLAYING) {
|
4294
|
+
src->offset_latched = SDL_TRUE;
|
4295
|
+
}
|
4270
4296
|
}
|
4271
4297
|
|
4272
4298
|
/* deal with alSourcePlay and alSourcePlayv (etc) boiler plate... */
|
@@ -4347,7 +4373,7 @@ static void _alSourceQueueBuffers(const ALuint name, const ALsizei nb, const ALu
|
|
4347
4373
|
|
4348
4374
|
item = ctx->device->playback.buffer_queue_pool;
|
4349
4375
|
if (item) {
|
4350
|
-
ctx->device->playback.buffer_queue_pool = item->next;
|
4376
|
+
ctx->device->playback.buffer_queue_pool = (BufferQueueItem*)item->next;
|
4351
4377
|
} else { /* allocate a new item */
|
4352
4378
|
item = (BufferQueueItem *) SDL_calloc(1, sizeof (BufferQueueItem));
|
4353
4379
|
if (!item) {
|
@@ -4400,7 +4426,7 @@ static void _alSourceQueueBuffers(const ALuint name, const ALsizei nb, const ALu
|
|
4400
4426
|
if (queue) {
|
4401
4427
|
/* Drop our claim on any buffers we planned to queue. */
|
4402
4428
|
BufferQueueItem *item;
|
4403
|
-
for (item = queue; item != NULL; item = item->next) {
|
4429
|
+
for (item = queue; item != NULL; item = (BufferQueueItem*)item->next) {
|
4404
4430
|
if (item->buffer) {
|
4405
4431
|
(void) SDL_AtomicDecRef(&item->buffer->refcount);
|
4406
4432
|
}
|
@@ -4446,6 +4472,7 @@ static void _alSourceQueueBuffers(const ALuint name, const ALsizei nb, const ALu
|
|
4446
4472
|
SDL_AtomicSetPtr(&queueend->next, ptr);
|
4447
4473
|
} while (!SDL_AtomicCASPtr(&src->buffer_queue.just_queued, ptr, queue));
|
4448
4474
|
|
4475
|
+
SDL_AtomicAdd(&src->total_queued_buffers, (int) nb);
|
4449
4476
|
SDL_AtomicAdd(&src->buffer_queue.num_items, (int) nb);
|
4450
4477
|
}
|
4451
4478
|
ENTRYPOINTVOID(alSourceQueueBuffers,(ALuint name, ALsizei nb, const ALuint *bufnames),(name,nb,bufnames))
|
@@ -4477,6 +4504,7 @@ static void _alSourceUnqueueBuffers(const ALuint name, const ALsizei nb, ALuint
|
|
4477
4504
|
}
|
4478
4505
|
|
4479
4506
|
SDL_AtomicAdd(&src->buffer_queue_processed.num_items, -((int) nb));
|
4507
|
+
SDL_AtomicAdd(&src->total_queued_buffers, -((int) nb));
|
4480
4508
|
|
4481
4509
|
obtain_newly_queued_buffers(&src->buffer_queue_processed);
|
4482
4510
|
|
@@ -4484,7 +4512,7 @@ static void _alSourceUnqueueBuffers(const ALuint name, const ALsizei nb, ALuint
|
|
4484
4512
|
for (i = 0; i < nb; i++) {
|
4485
4513
|
/* buffer_queue_processed.num_items said list was long enough. */
|
4486
4514
|
SDL_assert(item != NULL);
|
4487
|
-
item = item->next;
|
4515
|
+
item = (BufferQueueItem*)item->next;
|
4488
4516
|
}
|
4489
4517
|
src->buffer_queue_processed.head = item;
|
4490
4518
|
if (!item) {
|
@@ -4498,7 +4526,7 @@ static void _alSourceUnqueueBuffers(const ALuint name, const ALsizei nb, ALuint
|
|
4498
4526
|
}
|
4499
4527
|
bufnames[i] = item->buffer ? item->buffer->name : 0;
|
4500
4528
|
queueend = item;
|
4501
|
-
item = item->next;
|
4529
|
+
item = (BufferQueueItem*)item->next;
|
4502
4530
|
}
|
4503
4531
|
|
4504
4532
|
/* put the whole new queue back in the pool for reuse later. */
|