gosu 1.4.4 → 1.4.5

Sign up to get free protection for your applications and to get access to all the features.
Files changed (103) hide show
  1. checksums.yaml +4 -4
  2. data/dependencies/SDL/include/SDL.h +1 -0
  3. data/dependencies/SDL/include/SDL_assert.h +4 -2
  4. data/dependencies/SDL/include/SDL_atomic.h +20 -0
  5. data/dependencies/SDL/include/SDL_audio.h +40 -4
  6. data/dependencies/SDL/include/SDL_blendmode.h +4 -6
  7. data/dependencies/SDL/include/SDL_clipboard.h +47 -0
  8. data/dependencies/SDL/include/SDL_config.h +71 -45
  9. data/dependencies/SDL/include/SDL_cpuinfo.h +39 -4
  10. data/dependencies/SDL/include/SDL_egl.h +59 -9
  11. data/dependencies/SDL/include/SDL_endian.h +34 -3
  12. data/dependencies/SDL/include/SDL_events.h +32 -1
  13. data/dependencies/SDL/include/SDL_filesystem.h +5 -1
  14. data/dependencies/SDL/include/SDL_gamecontroller.h +78 -5
  15. data/dependencies/SDL/include/SDL_guid.h +100 -0
  16. data/dependencies/SDL/include/SDL_hints.h +645 -43
  17. data/dependencies/SDL/include/SDL_joystick.h +127 -7
  18. data/dependencies/SDL/include/SDL_keyboard.h +38 -1
  19. data/dependencies/SDL/include/SDL_keycode.h +6 -1
  20. data/dependencies/SDL/include/SDL_log.h +2 -2
  21. data/dependencies/SDL/include/SDL_main.h +42 -2
  22. data/dependencies/SDL/include/SDL_metal.h +2 -1
  23. data/dependencies/SDL/include/SDL_mouse.h +12 -1
  24. data/dependencies/SDL/include/SDL_opengl.h +0 -51
  25. data/dependencies/SDL/include/SDL_opengl_glext.h +2260 -231
  26. data/dependencies/SDL/include/SDL_opengles2_gl2.h +374 -339
  27. data/dependencies/SDL/include/SDL_opengles2_gl2ext.h +3479 -1496
  28. data/dependencies/SDL/include/SDL_opengles2_gl2platform.h +6 -9
  29. data/dependencies/SDL/include/SDL_opengles2_khrplatform.h +43 -14
  30. data/dependencies/SDL/include/SDL_platform.h +32 -6
  31. data/dependencies/SDL/include/SDL_rect.h +154 -2
  32. data/dependencies/SDL/include/SDL_render.h +46 -17
  33. data/dependencies/SDL/include/SDL_revision.h +6 -1
  34. data/dependencies/SDL/include/SDL_rwops.h +1 -15
  35. data/dependencies/SDL/include/SDL_scancode.h +46 -21
  36. data/dependencies/SDL/include/SDL_sensor.h +24 -3
  37. data/dependencies/SDL/include/SDL_stdinc.h +119 -8
  38. data/dependencies/SDL/include/SDL_surface.h +3 -1
  39. data/dependencies/SDL/include/SDL_system.h +66 -6
  40. data/dependencies/SDL/include/SDL_syswm.h +2 -0
  41. data/dependencies/SDL/include/SDL_test_common.h +1 -0
  42. data/dependencies/SDL/include/SDL_test_font.h +90 -3
  43. data/dependencies/SDL/include/SDL_thread.h +3 -3
  44. data/dependencies/SDL/include/SDL_touch.h +8 -0
  45. data/dependencies/SDL/include/SDL_version.h +19 -3
  46. data/dependencies/SDL/include/SDL_video.h +71 -9
  47. data/dependencies/SDL/include/begin_code.h +4 -4
  48. data/dependencies/SDL/lib/x64/libSDL2.dll.a +0 -0
  49. data/dependencies/SDL/lib/x86/libSDL2.dll.a +0 -0
  50. data/dependencies/SDL_sound/SDL_sound.c +210 -71
  51. data/dependencies/SDL_sound/SDL_sound.h +1 -1
  52. data/dependencies/SDL_sound/SDL_sound_coreaudio.c +111 -168
  53. data/dependencies/SDL_sound/SDL_sound_flac.c +0 -6
  54. data/dependencies/SDL_sound/SDL_sound_internal.h +27 -5
  55. data/dependencies/SDL_sound/SDL_sound_modplug.c +20 -8
  56. data/dependencies/SDL_sound/SDL_sound_mp3.c +11 -7
  57. data/dependencies/SDL_sound/SDL_sound_raw.c +1 -1
  58. data/dependencies/SDL_sound/SDL_sound_shn.c +1 -5
  59. data/dependencies/SDL_sound/SDL_sound_voc.c +1 -1
  60. data/dependencies/SDL_sound/SDL_sound_vorbis.c +2 -4
  61. data/dependencies/SDL_sound/SDL_sound_wav.c +44 -20
  62. data/dependencies/SDL_sound/dr_flac.h +237 -95
  63. data/dependencies/SDL_sound/dr_mp3.h +46 -33
  64. data/dependencies/SDL_sound/libmodplug/fastmix.c +53 -39
  65. data/dependencies/SDL_sound/libmodplug/libmodplug.h +0 -12
  66. data/dependencies/SDL_sound/libmodplug/load_669.c +37 -32
  67. data/dependencies/SDL_sound/libmodplug/load_amf.c +57 -44
  68. data/dependencies/SDL_sound/libmodplug/load_ams.c +127 -100
  69. data/dependencies/SDL_sound/libmodplug/load_dbm.c +40 -37
  70. data/dependencies/SDL_sound/libmodplug/load_dmf.c +61 -49
  71. data/dependencies/SDL_sound/libmodplug/load_dsm.c +18 -13
  72. data/dependencies/SDL_sound/libmodplug/load_far.c +31 -24
  73. data/dependencies/SDL_sound/libmodplug/load_gdm.c +27 -21
  74. data/dependencies/SDL_sound/libmodplug/load_it.c +106 -91
  75. data/dependencies/SDL_sound/libmodplug/load_mdl.c +43 -35
  76. data/dependencies/SDL_sound/libmodplug/load_med.c +66 -52
  77. data/dependencies/SDL_sound/libmodplug/load_mod.c +30 -26
  78. data/dependencies/SDL_sound/libmodplug/load_mt2.c +61 -50
  79. data/dependencies/SDL_sound/libmodplug/load_mtm.c +23 -17
  80. data/dependencies/SDL_sound/libmodplug/load_okt.c +18 -16
  81. data/dependencies/SDL_sound/libmodplug/load_psm.c +44 -32
  82. data/dependencies/SDL_sound/libmodplug/load_ptm.c +18 -14
  83. data/dependencies/SDL_sound/libmodplug/load_s3m.c +59 -53
  84. data/dependencies/SDL_sound/libmodplug/load_stm.c +23 -18
  85. data/dependencies/SDL_sound/libmodplug/load_ult.c +33 -29
  86. data/dependencies/SDL_sound/libmodplug/load_xm.c +64 -57
  87. data/dependencies/SDL_sound/libmodplug/mmcmp.c +2 -1
  88. data/dependencies/SDL_sound/libmodplug/snd_dsp.c +30 -20
  89. data/dependencies/SDL_sound/libmodplug/snd_flt.c +6 -4
  90. data/dependencies/SDL_sound/libmodplug/snd_fx.c +91 -65
  91. data/dependencies/SDL_sound/libmodplug/sndfile.c +91 -66
  92. data/dependencies/SDL_sound/libmodplug/sndmix.c +58 -35
  93. data/dependencies/SDL_sound/stb_vorbis.h +14 -9
  94. data/dependencies/mojoAL/mojoal.c +41 -24
  95. data/dependencies/utf8proc/utf8proc.c +1 -1
  96. data/dependencies/utf8proc/utf8proc.h +1 -1
  97. data/dependencies/utf8proc/utf8proc_data.h +3366 -3184
  98. data/include/Gosu/Version.hpp +1 -1
  99. data/lib/SDL2.dll +0 -0
  100. data/lib64/SDL2.dll +0 -0
  101. data/src/RubyGosu.cxx +1 -1
  102. data/src/Window.cpp +6 -4
  103. metadata +3 -2
@@ -76,12 +76,14 @@ BOOL CSoundFile_FadeSong(CSoundFile *_this, UINT msec)
76
76
  //----------------------------------
77
77
  {
78
78
  LONG nsamples = _muldiv(msec, _this->gdwMixingFreq, 1000);
79
+ LONG nRampLength;
80
+ UINT noff;
79
81
  if (nsamples <= 0) return FALSE;
80
82
  if (nsamples > 0x100000) nsamples = 0x100000;
81
83
  _this->m_nBufferCount = nsamples;
82
- LONG nRampLength = _this->m_nBufferCount;
84
+ nRampLength = _this->m_nBufferCount;
83
85
  // Ramp everything down
84
- for (UINT noff=0; noff < _this->m_nMixChannels; noff++)
86
+ for (noff=0; noff < _this->m_nMixChannels; noff++)
85
87
  {
86
88
  MODCHANNEL *pramp = &_this->Chn[_this->ChnMix[noff]];
87
89
  if (!pramp) continue;
@@ -128,6 +130,7 @@ UINT CSoundFile_Read(CSoundFile *_this, LPVOID lpDestBuffer, UINT cbBuffer)
128
130
  if (_this->m_dwSongFlags & SONG_ENDREACHED) goto MixDone;
129
131
  while (lRead > 0)
130
132
  {
133
+ UINT lTotalSampleCount;
131
134
  // Update Channel Data
132
135
  if (!_this->m_nBufferCount)
133
136
  {
@@ -168,7 +171,7 @@ UINT CSoundFile_Read(CSoundFile *_this, LPVOID lpDestBuffer, UINT cbBuffer)
168
171
  X86_MonoFromStereo(_this->MixSoundBuffer, lCount);
169
172
  }
170
173
  nStat++;
171
- UINT lTotalSampleCount = lSampleCount;
174
+ lTotalSampleCount = lSampleCount;
172
175
  // Multichannel
173
176
  if (_this->gnChannels > 2)
174
177
  {
@@ -196,6 +199,10 @@ BOOL CSoundFile_ProcessRow(CSoundFile *_this)
196
199
  {
197
200
  if (++_this->m_nTickCount >= _this->m_nMusicSpeed * (_this->m_nPatternDelay+1) + _this->m_nFrameDelay)
198
201
  {
202
+ MODCHANNEL *pChn;
203
+ MODCOMMAND *m;
204
+ UINT nChn;
205
+
199
206
  _this->m_nPatternDelay = 0;
200
207
  _this->m_nFrameDelay = 0;
201
208
  _this->m_nTickCount = 0;
@@ -216,10 +223,11 @@ BOOL CSoundFile_ProcessRow(CSoundFile *_this)
216
223
  return FALSE; //never repeat entire song
217
224
  if (!_this->m_nRestartPos)
218
225
  {
226
+ UINT i;
219
227
  _this->m_nMusicSpeed = _this->m_nDefaultSpeed;
220
228
  _this->m_nMusicTempo = _this->m_nDefaultTempo;
221
229
  _this->m_nGlobalVolume = _this->m_nDefaultGlobalVolume;
222
- for (UINT i=0; i<MAX_CHANNELS; i++)
230
+ for (i=0; i<MAX_CHANNELS; i++)
223
231
  {
224
232
  _this->Chn[i].dwFlags |= CHN_NOTEFADE | CHN_KEYOFF;
225
233
  _this->Chn[i].nFadeOutVol = 0;
@@ -271,9 +279,9 @@ BOOL CSoundFile_ProcessRow(CSoundFile *_this)
271
279
  _this->m_nNextStartRow = 0;
272
280
  }
273
281
  // Reset channel values
274
- MODCHANNEL *pChn = _this->Chn;
275
- MODCOMMAND *m = _this->Patterns[_this->m_nPattern] + _this->m_nRow * _this->m_nChannels;
276
- for (UINT nChn=0; nChn<_this->m_nChannels; pChn++, nChn++, m++)
282
+ pChn = _this->Chn;
283
+ m = _this->Patterns[_this->m_nPattern] + _this->m_nRow * _this->m_nChannels;
284
+ for (nChn=0; nChn<_this->m_nChannels; pChn++, nChn++, m++)
277
285
  {
278
286
  pChn->nRowNote = m->note;
279
287
  pChn->nRowInstr = m->instr;
@@ -311,23 +319,29 @@ BOOL CSoundFile_ProcessRow(CSoundFile *_this)
311
319
  BOOL CSoundFile_ReadNote(CSoundFile *_this)
312
320
  //-------------------------
313
321
  {
322
+ DWORD nMasterVol;
323
+ MODCHANNEL *pChn;
324
+ UINT nChn;
325
+
314
326
  if (!CSoundFile_ProcessRow(_this)) return FALSE;
315
327
  ////////////////////////////////////////////////////////////////////////////////////
316
328
  _this->m_nTotalCount++;
317
329
  if (!_this->m_nMusicTempo) return FALSE;
318
330
  _this->m_nBufferCount = (_this->gdwMixingFreq * 5 * _this->m_nTempoFactor) / (_this->m_nMusicTempo << 8);
319
331
  // Master Volume + Pre-Amplification / Attenuation setup
320
- DWORD nMasterVol;
321
332
  {
322
333
  int nchn32 = (_this->m_nChannels < 32) ? _this->m_nChannels : 31;
334
+ int realmastervol;
335
+ UINT attenuation;
336
+ DWORD mastervol;
323
337
  if ((_this->m_nType & MOD_TYPE_IT) && (_this->m_nInstruments) && (nchn32 < 6)) nchn32 = 6;
324
- int realmastervol = _this->m_nMasterVolume;
338
+ realmastervol = _this->m_nMasterVolume;
325
339
  if (realmastervol > 0x80)
326
340
  {
327
341
  realmastervol = 0x80 + ((realmastervol - 0x80) * (nchn32+4)) / 16;
328
342
  }
329
- UINT attenuation = (_this->gdwSoundSetup & SNDMIX_AGC) ? PreAmpAGCTable[nchn32>>1] : PreAmpTable[nchn32>>1];
330
- DWORD mastervol = (realmastervol * (_this->m_nSongPreAmp + 0x10)) >> 6;
343
+ attenuation = (_this->gdwSoundSetup & SNDMIX_AGC) ? PreAmpAGCTable[nchn32>>1] : PreAmpTable[nchn32>>1];
344
+ mastervol = (realmastervol * (_this->m_nSongPreAmp + 0x10)) >> 6;
331
345
  if (mastervol > 0x200) mastervol = 0x200;
332
346
  if ((_this->m_dwSongFlags & SONG_GLOBALFADE) && (_this->m_nGlobalFadeMaxSamples))
333
347
  {
@@ -339,8 +353,8 @@ BOOL CSoundFile_ReadNote(CSoundFile *_this)
339
353
  ////////////////////////////////////////////////////////////////////////////////////
340
354
  // Update channels data
341
355
  _this->m_nMixChannels = 0;
342
- MODCHANNEL *pChn = _this->Chn;
343
- for (UINT nChn=0; nChn<MAX_CHANNELS; nChn++,pChn++)
356
+ pChn = _this->Chn;
357
+ for (nChn=0; nChn<MAX_CHANNELS; nChn++,pChn++)
344
358
  {
345
359
  if ((pChn->dwFlags & CHN_NOTEFADE) && (!(pChn->nFadeOutVol|pChn->nRightVol|pChn->nLeftVol)))
346
360
  {
@@ -363,6 +377,8 @@ BOOL CSoundFile_ReadNote(CSoundFile *_this)
363
377
  if ((pChn->nPeriod) && (pChn->nLength))
364
378
  {
365
379
  int vol = pChn->nVolume + pChn->nVolSwing;
380
+ int period, nPeriodFrac;
381
+ UINT freq, ninc;
366
382
 
367
383
  if (vol < 0) vol = 0;
368
384
  if (vol > 256) vol = 256;
@@ -398,8 +414,8 @@ BOOL CSoundFile_ReadNote(CSoundFile *_this)
398
414
  {
399
415
  UINT n = (pChn->nTremorParam >> 4) + (pChn->nTremorParam & 0x0F);
400
416
  UINT ontime = pChn->nTremorParam >> 4;
401
- if ((!(_this->m_nType & MOD_TYPE_IT)) || (_this->m_dwSongFlags & SONG_ITOLDEFFECTS)) { n += 2; ontime++; }
402
417
  UINT tremcount = (UINT)pChn->nTremorCount;
418
+ if ((!(_this->m_nType & MOD_TYPE_IT)) || (_this->m_dwSongFlags & SONG_ITOLDEFFECTS)) { n += 2; ontime++; }
403
419
  if (tremcount >= n) tremcount = 0;
404
420
  if ((_this->m_nTickCount) || (_this->m_nType & (MOD_TYPE_S3M|MOD_TYPE_IT)))
405
421
  {
@@ -420,8 +436,10 @@ BOOL CSoundFile_ReadNote(CSoundFile *_this)
420
436
  if ((pChn->dwFlags & CHN_VOLENV) && (penv->nVolEnv))
421
437
  {
422
438
  int envpos = pChn->nVolEnvPosition;
439
+ int x1, x2, envvol;
423
440
  UINT pt = penv->nVolEnv - 1;
424
- for (UINT i=0; i<(UINT)(penv->nVolEnv-1); i++)
441
+ UINT i;
442
+ for (i=0; i<(UINT)(penv->nVolEnv-1); i++)
425
443
  {
426
444
  if (envpos <= penv->VolPoints[i])
427
445
  {
@@ -429,8 +447,7 @@ BOOL CSoundFile_ReadNote(CSoundFile *_this)
429
447
  break;
430
448
  }
431
449
  }
432
- int x2 = penv->VolPoints[pt];
433
- int x1, envvol;
450
+ x2 = penv->VolPoints[pt];
434
451
  if (envpos >= x2)
435
452
  {
436
453
  envvol = penv->VolEnv[pt] << 2;
@@ -458,8 +475,10 @@ BOOL CSoundFile_ReadNote(CSoundFile *_this)
458
475
  if ((pChn->dwFlags & CHN_PANENV) && (penv->nPanEnv))
459
476
  {
460
477
  int envpos = pChn->nPanEnvPosition;
478
+ int x1, x2, y2, envpan, pan;
461
479
  UINT pt = penv->nPanEnv - 1;
462
- for (UINT i=0; i<(UINT)(penv->nPanEnv-1); i++)
480
+ UINT i;
481
+ for (i=0; i<(UINT)(penv->nPanEnv-1); i++)
463
482
  {
464
483
  if (envpos <= penv->PanPoints[i])
465
484
  {
@@ -467,8 +486,7 @@ BOOL CSoundFile_ReadNote(CSoundFile *_this)
467
486
  break;
468
487
  }
469
488
  }
470
- int x2 = penv->PanPoints[pt], y2 = penv->PanEnv[pt];
471
- int x1, envpan;
489
+ x2 = penv->PanPoints[pt], y2 = penv->PanEnv[pt];
472
490
  if (envpos >= x2)
473
491
  {
474
492
  envpan = y2;
@@ -489,7 +507,7 @@ BOOL CSoundFile_ReadNote(CSoundFile *_this)
489
507
  }
490
508
  if (envpan < 0) envpan = 0;
491
509
  if (envpan > 64) envpan = 64;
492
- int pan = pChn->nPan;
510
+ pan = pChn->nPan;
493
511
  if (pan >= 128)
494
512
  {
495
513
  pan += ((envpan - 32) * (256 - pan)) / 32;
@@ -541,7 +559,7 @@ BOOL CSoundFile_ReadNote(CSoundFile *_this)
541
559
  pChn->nRealVolume = _muldiv(vol * _this->m_nGlobalVolume, pChn->nGlobalVol * pChn->nInsVol, 1 << 20);
542
560
  }
543
561
  if (pChn->nPeriod < _this->m_nMinPeriod) pChn->nPeriod = _this->m_nMinPeriod;
544
- int period = pChn->nPeriod;
562
+ period = pChn->nPeriod;
545
563
  if ((pChn->dwFlags & (CHN_GLISSANDO|CHN_PORTAMENTO)) == (CHN_GLISSANDO|CHN_PORTAMENTO))
546
564
  {
547
565
  period = CSoundFile_GetPeriodFromNote(_this, CSoundFile_GetNoteFromPeriod(_this, period), pChn->nFineTune, pChn->nC4Speed);
@@ -568,8 +586,10 @@ BOOL CSoundFile_ReadNote(CSoundFile *_this)
568
586
  {
569
587
  INSTRUMENTHEADER *penv = pChn->pHeader;
570
588
  int envpos = pChn->nPitchEnvPosition;
589
+ int x1, x2, envpitch;
571
590
  UINT pt = penv->nPitchEnv - 1;
572
- for (UINT i=0; i<(UINT)(penv->nPitchEnv-1); i++)
591
+ UINT i;
592
+ for (i=0; i<(UINT)(penv->nPitchEnv-1); i++)
573
593
  {
574
594
  if (envpos <= penv->PitchPoints[i])
575
595
  {
@@ -577,8 +597,7 @@ BOOL CSoundFile_ReadNote(CSoundFile *_this)
577
597
  break;
578
598
  }
579
599
  }
580
- int x2 = penv->PitchPoints[pt];
581
- int x1, envpitch;
600
+ x2 = penv->PitchPoints[pt];
582
601
  if (envpos >= x2)
583
602
  {
584
603
  envpitch = (((int)penv->PitchEnv[pt]) - 32) * 8;
@@ -629,6 +648,7 @@ BOOL CSoundFile_ReadNote(CSoundFile *_this)
629
648
  {
630
649
  UINT vibpos = pChn->nVibratoPos;
631
650
  LONG vdelta;
651
+ UINT vdepth;
632
652
  switch (pChn->nVibratoType & 0x03)
633
653
  {
634
654
  case 1:
@@ -643,7 +663,7 @@ BOOL CSoundFile_ReadNote(CSoundFile *_this)
643
663
  default:
644
664
  vdelta = ModSinusTable[vibpos];
645
665
  }
646
- UINT vdepth = ((_this->m_nType != MOD_TYPE_IT) || (_this->m_dwSongFlags & SONG_ITOLDEFFECTS)) ? 6 : 7;
666
+ vdepth = ((_this->m_nType != MOD_TYPE_IT) || (_this->m_dwSongFlags & SONG_ITOLDEFFECTS)) ? 6 : 7;
647
667
  vdelta = (vdelta * (int)pChn->nVibratoDepth) >> vdepth;
648
668
  if ((_this->m_dwSongFlags & SONG_LINEARSLIDES) && (_this->m_nType & MOD_TYPE_IT))
649
669
  {
@@ -693,11 +713,12 @@ BOOL CSoundFile_ReadNote(CSoundFile *_this)
693
713
  if (pdelta > 256) pdelta = 256;
694
714
  pChn->nRealPan = pdelta;
695
715
  }
696
- int nPeriodFrac = 0;
716
+ nPeriodFrac = 0;
697
717
  // Instrument Auto-Vibrato
698
718
  if ((pChn->pInstrument) && (pChn->pInstrument->nVibDepth))
699
719
  {
700
720
  MODINSTRUMENT *pins = pChn->pInstrument;
721
+ int val, n;
701
722
  if (pins->nVibSweep == 0)
702
723
  {
703
724
  pChn->nAutoVibDepth = pins->nVibDepth << 8;
@@ -715,7 +736,6 @@ BOOL CSoundFile_ReadNote(CSoundFile *_this)
715
736
  pChn->nAutoVibDepth = pins->nVibDepth << 8;
716
737
  }
717
738
  pChn->nAutoVibPos += pins->nVibRate;
718
- int val;
719
739
  switch(pins->nVibType)
720
740
  {
721
741
  case 4: // Random
@@ -734,19 +754,20 @@ BOOL CSoundFile_ReadNote(CSoundFile *_this)
734
754
  default: // Sine
735
755
  val = ft2VibratoTable[pChn->nAutoVibPos & 255];
736
756
  }
737
- int n = ((val * pChn->nAutoVibDepth) >> 8);
757
+ n = ((val * pChn->nAutoVibDepth) >> 8);
738
758
  if (_this->m_nType & MOD_TYPE_IT)
739
759
  {
740
760
  int df1, df2;
761
+ UINT n1;
741
762
  if (n < 0)
742
763
  {
743
764
  n = -n;
744
- UINT n1 = n >> 8;
765
+ n1 = n >> 8;
745
766
  df1 = LinearSlideUpTable[n1];
746
767
  df2 = LinearSlideUpTable[n1+1];
747
768
  } else
748
769
  {
749
- UINT n1 = n >> 8;
770
+ n1 = n >> 8;
750
771
  df1 = LinearSlideDownTable[n1];
751
772
  df2 = LinearSlideDownTable[n1+1];
752
773
  }
@@ -776,14 +797,14 @@ BOOL CSoundFile_ReadNote(CSoundFile *_this)
776
797
  period = _this->m_nMaxPeriod;
777
798
  nPeriodFrac = 0;
778
799
  }
779
- UINT freq = CSoundFile_GetFreqFromPeriod(_this, period, pChn->nC4Speed, nPeriodFrac);
800
+ freq = CSoundFile_GetFreqFromPeriod(_this, period, pChn->nC4Speed, nPeriodFrac);
780
801
  if ((_this->m_nType & MOD_TYPE_IT) && (freq < 256))
781
802
  {
782
803
  pChn->nFadeOutVol = 0;
783
804
  pChn->dwFlags |= CHN_NOTEFADE;
784
805
  pChn->nRealVolume = 0;
785
806
  }
786
- UINT ninc = _muldiv(freq, 0x10000, _this->gdwMixingFreq);
807
+ ninc = _muldiv(freq, 0x10000, _this->gdwMixingFreq);
787
808
  if ((ninc >= 0xFFB0) && (ninc <= 0x10090)) ninc = 0x10000;
788
809
  if (_this->m_nFreqFactor != 128) ninc = (ninc * _this->m_nFreqFactor) >> 7;
789
810
  if (ninc > 0xFF0000) ninc = 0xFF0000;
@@ -895,6 +916,7 @@ BOOL CSoundFile_ReadNote(CSoundFile *_this)
895
916
  // Adjusting volumes
896
917
  if (_this->gnChannels >= 2)
897
918
  {
919
+ LONG realvol;
898
920
  int pan = ((int)pChn->nRealPan) - 128;
899
921
  pan *= (int)_this->m_nStereoSeparation;
900
922
  pan /= 128;
@@ -903,7 +925,7 @@ BOOL CSoundFile_ReadNote(CSoundFile *_this)
903
925
  if (pan < 0) pan = 0;
904
926
  if (pan > 256) pan = 256;
905
927
  if (_this->gdwSoundSetup & SNDMIX_REVERSESTEREO) pan = 256 - pan;
906
- LONG realvol = (pChn->nRealVolume * kChnMasterVol) >> (8-1);
928
+ realvol = (pChn->nRealVolume * kChnMasterVol) >> (8-1);
907
929
  if (_this->gdwSoundSetup & SNDMIX_SOFTPANNING)
908
930
  {
909
931
  if (pan < 128)
@@ -1001,7 +1023,8 @@ BOOL CSoundFile_ReadNote(CSoundFile *_this)
1001
1023
  // Checking Max Mix Channels reached: ordering by volume
1002
1024
  if ((_this->m_nMixChannels >= _this->m_nMaxMixChannels) && (!(_this->gdwSoundSetup & SNDMIX_DIRECTTODISK)))
1003
1025
  {
1004
- for (UINT i=0; i<_this->m_nMixChannels; i++)
1026
+ UINT i=0;
1027
+ for (; i<_this->m_nMixChannels; i++)
1005
1028
  {
1006
1029
  UINT j=i;
1007
1030
  while ((j+1<_this->m_nMixChannels) && (_this->Chn[_this->ChnMix[j]].nRealVolume < _this->Chn[_this->ChnMix[j+1]].nRealVolume))
@@ -768,11 +768,12 @@ typedef struct
768
768
 
769
769
  typedef struct
770
770
  {
771
- uint16 coupling_steps;
771
+ // https://github.com/nothings/stb/pull/1312
772
772
  MappingChannel *chan;
773
+ uint16 coupling_steps;
773
774
  uint8 submaps;
774
- uint8 submap_floor[15]; // varies
775
- uint8 submap_residue[15]; // varies
775
+ uint8 submap_floor[16]; // varies
776
+ uint8 submap_residue[16]; // varies
776
777
  } Mapping;
777
778
 
778
779
  typedef struct
@@ -1275,8 +1276,8 @@ static int vorbis_validate(uint8 *data)
1275
1276
  // called from setup only, once per code book
1276
1277
  // (formula implied by specification)
1277
1278
  //
1278
- // hack: suppress an UBSan error caused by invalid input data.
1279
- // see upstream: https://github.com/nothings/stb/issues/1168.
1279
+ // suppress an UBSan error caused by invalid input data.
1280
+ // upstream: https://github.com/nothings/stb/issues/1168.
1280
1281
  STB_NO_SANITIZE("float-cast-overflow")
1281
1282
  static int lookup1_values(int entries, int dim)
1282
1283
  {
@@ -1777,7 +1778,9 @@ static int codebook_decode_scalar_raw(vorb *f, Codebook *c)
1777
1778
  assert(!c->sparse);
1778
1779
  for (i=0; i < c->entries; ++i) {
1779
1780
  if (c->codeword_lengths[i] == NO_CODE) continue;
1780
- if (c->codewords[i] == (f->acc & ((1 << c->codeword_lengths[i])-1))) {
1781
+ /* unsigned left shift for 32-bit codewords.
1782
+ * https://github.com/nothings/stb/issues/1168 */
1783
+ if (c->codewords[i] == (f->acc & ((1U << c->codeword_lengths[i])-1))) {
1781
1784
  if (f->valid_bits >= c->codeword_lengths[i]) {
1782
1785
  f->acc >>= c->codeword_lengths[i];
1783
1786
  f->valid_bits -= c->codeword_lengths[i];
@@ -3945,7 +3948,9 @@ static int start_decoder(vorb *f)
3945
3948
  if (values < 0) return error(f, VORBIS_invalid_setup);
3946
3949
  c->lookup_values = (uint32) values;
3947
3950
  } else {
3948
- c->lookup_values = c->entries * c->dimensions;
3951
+ /* unsigned multiply to suppress (legitimate) warning.
3952
+ * https://github.com/nothings/stb/issues/1168 */
3953
+ c->lookup_values = (unsigned)c->entries * (unsigned)c->dimensions;
3949
3954
  }
3950
3955
  if (c->lookup_values == 0) return error(f, VORBIS_invalid_setup);
3951
3956
  mults = (uint16 *) setup_temp_malloc(f, sizeof(mults[0]) * c->lookup_values);
@@ -5303,8 +5308,8 @@ static int8 channel_position[7][6] =
5303
5308
  #ifndef STB_VORBIS_NO_FAST_SCALED_FLOAT
5304
5309
  typedef union {
5305
5310
  float f;
5306
- // hack: changed this to unsigned to suppress an UBSan error.
5307
- // see upstream: https://github.com/nothings/stb/issues/1168.
5311
+ // changed this to unsigned to suppress an UBSan error.
5312
+ // upstream: https://github.com/nothings/stb/issues/1168.
5308
5313
  unsigned int i;
5309
5314
  } float_conv;
5310
5315
  typedef char stb_vorbis_float_size_test[sizeof(float)==4 && sizeof(int) == 4];
@@ -470,6 +470,7 @@ SIMDALIGNEDSTRUCT ALsource
470
470
  ALfloat cone_outer_gain;
471
471
  ALbuffer *buffer;
472
472
  SDL_AudioStream *stream; /* for resampling. */
473
+ SDL_atomic_t total_queued_buffers; /* everything queued, playing and processed. AL_BUFFERS_QUEUED value. */
473
474
  BufferQueue buffer_queue;
474
475
  BufferQueue buffer_queue_processed;
475
476
  ALsizei offset; /* offset in bytes for converted stream! */
@@ -567,7 +568,7 @@ static void queue_new_buffer_items_recursive(BufferQueue *queue, BufferQueueItem
567
568
  return;
568
569
  }
569
570
 
570
- queue_new_buffer_items_recursive(queue, items->next);
571
+ queue_new_buffer_items_recursive(queue, (BufferQueueItem*)items->next);
571
572
  items->next = NULL;
572
573
  if (queue->tail) {
573
574
  queue->tail->next = items;
@@ -599,7 +600,7 @@ static void source_mark_all_buffers_processed(ALsource *src)
599
600
  while (src->buffer_queue.head) {
600
601
  void *ptr;
601
602
  BufferQueueItem *item = src->buffer_queue.head;
602
- src->buffer_queue.head = item->next;
603
+ src->buffer_queue.head = (BufferQueueItem*)item->next;
603
604
  SDL_AtomicAdd(&src->buffer_queue.num_items, -1);
604
605
 
605
606
  /* Move it to the processed queue for alSourceUnqueueBuffers() to pick up. */
@@ -619,7 +620,7 @@ static void source_release_buffer_queue(ALCcontext *ctx, ALsource *src)
619
620
  obtain_newly_queued_buffers(&src->buffer_queue);
620
621
  if (src->buffer_queue.tail != NULL) {
621
622
  BufferQueueItem *i;
622
- for (i = src->buffer_queue.head; i; i = i->next) {
623
+ for (i = src->buffer_queue.head; i; i = (BufferQueueItem*)i->next) {
623
624
  (void) SDL_AtomicDecRef(&i->buffer->refcount);
624
625
  }
625
626
  src->buffer_queue.tail->next = ctx->device->playback.buffer_queue_pool;
@@ -631,7 +632,7 @@ static void source_release_buffer_queue(ALCcontext *ctx, ALsource *src)
631
632
  obtain_newly_queued_buffers(&src->buffer_queue_processed);
632
633
  if (src->buffer_queue_processed.tail != NULL) {
633
634
  BufferQueueItem *i;
634
- for (i = src->buffer_queue_processed.head; i; i = i->next) {
635
+ for (i = src->buffer_queue_processed.head; i; i = (BufferQueueItem*)i->next) {
635
636
  (void) SDL_AtomicDecRef(&i->buffer->refcount);
636
637
  }
637
638
  src->buffer_queue_processed.tail->next = ctx->device->playback.buffer_queue_pool;
@@ -764,7 +765,7 @@ ALCboolean alcCloseDevice(ALCdevice *device)
764
765
 
765
766
  item = device->playback.buffer_queue_pool;
766
767
  while (item) {
767
- BufferQueueItem *next = item->next;
768
+ BufferQueueItem *next = (BufferQueueItem*)item->next;
768
769
  SDL_free(item);
769
770
  item = next;
770
771
  }
@@ -1165,11 +1166,11 @@ static void mix_float32_c2_neon(const ALfloat * restrict panning, const float *
1165
1166
  *
1166
1167
  * Permission to use, copy, modify, distribute and sell this software and its
1167
1168
  * documentation for any purpose is hereby granted without fee, provided that
1168
- * the above copyright notice and this license appear in all source copies.
1169
+ * the above copyright notice and this license appear in all source copies.
1169
1170
  * THIS SOFTWARE IS PROVIDED "AS IS" WITHOUT EXPRESS OR IMPLIED WARRANTY OF
1170
1171
  * ANY KIND. See http://www.dspguru.com/wol.htm for more information.
1171
1172
  *
1172
- *****************************************************************************/
1173
+ *****************************************************************************/
1173
1174
 
1174
1175
  /* FFT routine, (C)1996 S.M.Bernsee. */
1175
1176
  static void pitch_fft(float *fftBuffer, int fftFrameSize, int sign)
@@ -1300,12 +1301,12 @@ static void pitch_shift(ALsource *src, const ALbuffer *buffer, int numSampsToPro
1300
1301
  SDL_memset(state->synmagn, '\0', sizeof (state->synmagn));
1301
1302
  for (k = 0; k <= pitch_framesize2; k++) {
1302
1303
  index = k*pitchShift;
1303
- if (index <= pitch_framesize2) {
1304
+ if (index <= pitch_framesize2) {
1304
1305
  state->synmagn[index] += state->workspace[2*k];
1305
1306
  state->synfreq[index] = state->workspace[2*k+1] * pitchShift;
1306
- }
1307
+ }
1307
1308
  }
1308
-
1309
+
1309
1310
  /* ***************** SYNTHESIS ******************* */
1310
1311
  /* this is the synthesis step */
1311
1312
  for (k = 0; k <= pitch_framesize2; k++) {
@@ -1333,7 +1334,7 @@ static void pitch_shift(ALsource *src, const ALbuffer *buffer, int numSampsToPro
1333
1334
  /* get real and imag part and re-interleave */
1334
1335
  state->workspace[2*k] = magn*SDL_cos(phase);
1335
1336
  state->workspace[2*k+1] = magn*SDL_sin(phase);
1336
- }
1337
+ }
1337
1338
 
1338
1339
  /* zero negative frequencies */
1339
1340
  for (k = pitch_framesize+2; k < 2*pitch_framesize; k++) state->workspace[k] = 0.;
@@ -1341,7 +1342,7 @@ static void pitch_shift(ALsource *src, const ALbuffer *buffer, int numSampsToPro
1341
1342
  /* do inverse transform */
1342
1343
  pitch_fft(state->workspace, pitch_framesize, 1);
1343
1344
 
1344
- /* do windowing and add to output accumulator */
1345
+ /* do windowing and add to output accumulator */
1345
1346
  for(k=0; k < pitch_framesize; k++) {
1346
1347
  window = -.5*SDL_cos(2.*M_PI*(double)k/(double)pitch_framesize)+.5;
1347
1348
  state->outputaccum[k] += 2.*window*state->workspace[2*k]/(pitch_framesize2*osamp);
@@ -1466,7 +1467,7 @@ static ALCboolean mix_source_buffer_queue(ALCcontext *ctx, ALsource *src, Buffer
1466
1467
  while ((len > 0) && (mix_source_buffer(ctx, src, queue, &stream, &len))) {
1467
1468
  /* Finished this buffer! */
1468
1469
  BufferQueueItem *item = queue;
1469
- BufferQueueItem *next = queue ? queue->next : NULL;
1470
+ BufferQueueItem *next = queue ? (BufferQueueItem*)queue->next : NULL;
1470
1471
  void *ptr;
1471
1472
 
1472
1473
  if (queue) {
@@ -2569,6 +2570,16 @@ static void _alcGetIntegerv(ALCdevice *device, const ALCenum param, const ALCsiz
2569
2570
  *values = OPENAL_VERSION_MINOR;
2570
2571
  return;
2571
2572
 
2573
+ case ALC_FREQUENCY:
2574
+ if (!device) {
2575
+ *values = 0;
2576
+ set_alc_error(device, ALC_INVALID_DEVICE);
2577
+ return;
2578
+ }
2579
+
2580
+ *values = device->frequency;
2581
+ return;
2582
+
2572
2583
  default: break;
2573
2584
  }
2574
2585
 
@@ -3589,6 +3600,7 @@ static void _alGenSources(const ALsizei n, ALuint *names)
3589
3600
 
3590
3601
  SDL_zerop(src);
3591
3602
  SDL_AtomicSet(&src->state, AL_INITIAL);
3603
+ SDL_AtomicSet(&src->total_queued_buffers, 0);
3592
3604
  src->name = names[i];
3593
3605
  src->type = AL_UNDETERMINED;
3594
3606
  src->recalc = AL_TRUE;
@@ -3906,7 +3918,7 @@ static void _alGetSourcefv(const ALuint name, const ALenum param, ALfloat *value
3906
3918
  case AL_REFERENCE_DISTANCE: *values = src->reference_distance; break;
3907
3919
  case AL_ROLLOFF_FACTOR: *values = src->rolloff_factor; break;
3908
3920
  case AL_MAX_DISTANCE: *values = src->max_distance; break;
3909
- case AL_PITCH: source_set_pitch(ctx, src, *values); break;
3921
+ case AL_PITCH: *values = src->pitch; break;
3910
3922
  case AL_CONE_INNER_ANGLE: *values = src->cone_inner_angle; break;
3911
3923
  case AL_CONE_OUTER_ANGLE: *values = src->cone_outer_angle; break;
3912
3924
  case AL_CONE_OUTER_GAIN: *values = src->cone_outer_gain; break;
@@ -3973,8 +3985,7 @@ static void _alGetSourceiv(const ALuint name, const ALenum param, ALint *values)
3973
3985
  case AL_SOURCE_STATE: *values = (ALint) SDL_AtomicGet(&src->state); break;
3974
3986
  case AL_SOURCE_TYPE: *values = (ALint) src->type; break;
3975
3987
  case AL_BUFFER: *values = (ALint) (src->buffer ? src->buffer->name : 0); break;
3976
- /* !!! FIXME: AL_BUFFERS_QUEUED is the total number of buffers pending, playing, and processed, so this is wrong. It might also have to be 1 if there's a static buffer, but I'm not sure. */
3977
- case AL_BUFFERS_QUEUED: *values = (ALint) SDL_AtomicGet(&src->buffer_queue.num_items); break;
3988
+ case AL_BUFFERS_QUEUED: *values = (ALint) SDL_AtomicGet(&src->total_queued_buffers); break;
3978
3989
  case AL_BUFFERS_PROCESSED: *values = (ALint) SDL_AtomicGet(&src->buffer_queue_processed.num_items); break;
3979
3990
  case AL_SOURCE_RELATIVE: *values = (ALint) src->source_relative; break;
3980
3991
  case AL_LOOPING: *values = (ALint) src->looping; break;
@@ -4134,7 +4145,7 @@ static void source_play(ALCcontext *ctx, const ALsizei n, const ALuint *names)
4134
4145
  with it, as nothing else owns the pointers in that list. */
4135
4146
  do {
4136
4147
  ptr = SDL_AtomicGetPtr(&ctx->playlist_todo);
4137
- todoend->next = ptr;
4148
+ todoend->next = (SourcePlayTodo*)ptr;
4138
4149
  } while (!SDL_AtomicCASPtr(&ctx->playlist_todo, ptr, todo.next));
4139
4150
  }
4140
4151
 
@@ -4162,6 +4173,9 @@ static void source_stop(ALCcontext *ctx, const ALuint name)
4162
4173
  }
4163
4174
  SDL_AtomicSet(&src->state, AL_STOPPED);
4164
4175
  source_mark_all_buffers_processed(src);
4176
+ if (src->stream) {
4177
+ SDL_AudioStreamClear(src->stream);
4178
+ }
4165
4179
  if (must_lock) {
4166
4180
  SDL_UnlockMutex(ctx->source_lock);
4167
4181
  }
@@ -4228,9 +4242,10 @@ static void source_set_offset(ALsource *src, ALenum param, ALfloat value)
4228
4242
  if (!ctx) {
4229
4243
  set_al_error(ctx, AL_INVALID_OPERATION);
4230
4244
  return;
4231
- }
4232
-
4233
- if (src->type == AL_STREAMING) {
4245
+ } else if (src->type == AL_UNDETERMINED) { /* no buffer to seek in */
4246
+ set_al_error(ctx, AL_INVALID_OPERATION);
4247
+ return;
4248
+ } else if (src->type == AL_STREAMING) {
4234
4249
  FIXME("set_offset for streaming sources not implemented");
4235
4250
  return;
4236
4251
  }
@@ -4347,7 +4362,7 @@ static void _alSourceQueueBuffers(const ALuint name, const ALsizei nb, const ALu
4347
4362
 
4348
4363
  item = ctx->device->playback.buffer_queue_pool;
4349
4364
  if (item) {
4350
- ctx->device->playback.buffer_queue_pool = item->next;
4365
+ ctx->device->playback.buffer_queue_pool = (BufferQueueItem*)item->next;
4351
4366
  } else { /* allocate a new item */
4352
4367
  item = (BufferQueueItem *) SDL_calloc(1, sizeof (BufferQueueItem));
4353
4368
  if (!item) {
@@ -4400,7 +4415,7 @@ static void _alSourceQueueBuffers(const ALuint name, const ALsizei nb, const ALu
4400
4415
  if (queue) {
4401
4416
  /* Drop our claim on any buffers we planned to queue. */
4402
4417
  BufferQueueItem *item;
4403
- for (item = queue; item != NULL; item = item->next) {
4418
+ for (item = queue; item != NULL; item = (BufferQueueItem*)item->next) {
4404
4419
  if (item->buffer) {
4405
4420
  (void) SDL_AtomicDecRef(&item->buffer->refcount);
4406
4421
  }
@@ -4446,6 +4461,7 @@ static void _alSourceQueueBuffers(const ALuint name, const ALsizei nb, const ALu
4446
4461
  SDL_AtomicSetPtr(&queueend->next, ptr);
4447
4462
  } while (!SDL_AtomicCASPtr(&src->buffer_queue.just_queued, ptr, queue));
4448
4463
 
4464
+ SDL_AtomicAdd(&src->total_queued_buffers, (int) nb);
4449
4465
  SDL_AtomicAdd(&src->buffer_queue.num_items, (int) nb);
4450
4466
  }
4451
4467
  ENTRYPOINTVOID(alSourceQueueBuffers,(ALuint name, ALsizei nb, const ALuint *bufnames),(name,nb,bufnames))
@@ -4477,6 +4493,7 @@ static void _alSourceUnqueueBuffers(const ALuint name, const ALsizei nb, ALuint
4477
4493
  }
4478
4494
 
4479
4495
  SDL_AtomicAdd(&src->buffer_queue_processed.num_items, -((int) nb));
4496
+ SDL_AtomicAdd(&src->total_queued_buffers, -((int) nb));
4480
4497
 
4481
4498
  obtain_newly_queued_buffers(&src->buffer_queue_processed);
4482
4499
 
@@ -4484,7 +4501,7 @@ static void _alSourceUnqueueBuffers(const ALuint name, const ALsizei nb, ALuint
4484
4501
  for (i = 0; i < nb; i++) {
4485
4502
  /* buffer_queue_processed.num_items said list was long enough. */
4486
4503
  SDL_assert(item != NULL);
4487
- item = item->next;
4504
+ item = (BufferQueueItem*)item->next;
4488
4505
  }
4489
4506
  src->buffer_queue_processed.head = item;
4490
4507
  if (!item) {
@@ -4498,7 +4515,7 @@ static void _alSourceUnqueueBuffers(const ALuint name, const ALsizei nb, ALuint
4498
4515
  }
4499
4516
  bufnames[i] = item->buffer ? item->buffer->name : 0;
4500
4517
  queueend = item;
4501
- item = item->next;
4518
+ item = (BufferQueueItem*)item->next;
4502
4519
  }
4503
4520
 
4504
4521
  /* put the whole new queue back in the pool for reuse later. */
@@ -101,7 +101,7 @@ UTF8PROC_DLLEXPORT const char *utf8proc_version(void) {
101
101
  }
102
102
 
103
103
  UTF8PROC_DLLEXPORT const char *utf8proc_unicode_version(void) {
104
- return "14.0.0";
104
+ return "15.0.0";
105
105
  }
106
106
 
107
107
  UTF8PROC_DLLEXPORT const char *utf8proc_errmsg(utf8proc_ssize_t errcode) {
@@ -71,7 +71,7 @@
71
71
  /** The MAJOR version number (increased when backwards API compatibility is broken). */
72
72
  #define UTF8PROC_VERSION_MAJOR 2
73
73
  /** The MINOR version number (increased when new functionality is added in a backwards-compatible manner). */
74
- #define UTF8PROC_VERSION_MINOR 7
74
+ #define UTF8PROC_VERSION_MINOR 8
75
75
  /** The PATCH version (increased for fixes that do not change the API). */
76
76
  #define UTF8PROC_VERSION_PATCH 0
77
77
  /** @} */