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.
Files changed (152) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +0 -8
  3. data/dependencies/SDL/include/SDL.h +2 -1
  4. data/dependencies/SDL/include/SDL_assert.h +8 -12
  5. data/dependencies/SDL/include/SDL_atomic.h +21 -1
  6. data/dependencies/SDL/include/SDL_audio.h +41 -5
  7. data/dependencies/SDL/include/SDL_bits.h +1 -1
  8. data/dependencies/SDL/include/SDL_blendmode.h +5 -7
  9. data/dependencies/SDL/include/SDL_clipboard.h +48 -1
  10. data/dependencies/SDL/include/SDL_config.h +73 -47
  11. data/dependencies/SDL/include/SDL_cpuinfo.h +40 -5
  12. data/dependencies/SDL/include/SDL_egl.h +60 -10
  13. data/dependencies/SDL/include/SDL_endian.h +35 -4
  14. data/dependencies/SDL/include/SDL_error.h +1 -1
  15. data/dependencies/SDL/include/SDL_events.h +33 -2
  16. data/dependencies/SDL/include/SDL_filesystem.h +6 -2
  17. data/dependencies/SDL/include/SDL_gamecontroller.h +79 -6
  18. data/dependencies/SDL/include/SDL_gesture.h +1 -1
  19. data/dependencies/SDL/include/SDL_guid.h +100 -0
  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 +646 -44
  23. data/dependencies/SDL/include/SDL_joystick.h +128 -8
  24. data/dependencies/SDL/include/SDL_keyboard.h +39 -2
  25. data/dependencies/SDL/include/SDL_keycode.h +7 -2
  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 +3 -3
  29. data/dependencies/SDL/include/SDL_main.h +43 -3
  30. data/dependencies/SDL/include/SDL_messagebox.h +1 -1
  31. data/dependencies/SDL/include/SDL_metal.h +3 -2
  32. data/dependencies/SDL/include/SDL_misc.h +1 -1
  33. data/dependencies/SDL/include/SDL_mouse.h +13 -2
  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 -52
  37. data/dependencies/SDL/include/SDL_opengl_glext.h +2260 -231
  38. data/dependencies/SDL/include/SDL_opengles.h +1 -1
  39. data/dependencies/SDL/include/SDL_opengles2.h +1 -1
  40. data/dependencies/SDL/include/SDL_opengles2_gl2.h +374 -339
  41. data/dependencies/SDL/include/SDL_opengles2_gl2ext.h +3479 -1496
  42. data/dependencies/SDL/include/SDL_opengles2_gl2platform.h +6 -9
  43. data/dependencies/SDL/include/SDL_opengles2_khrplatform.h +43 -14
  44. data/dependencies/SDL/include/SDL_pixels.h +1 -1
  45. data/dependencies/SDL/include/SDL_platform.h +33 -7
  46. data/dependencies/SDL/include/SDL_power.h +1 -1
  47. data/dependencies/SDL/include/SDL_quit.h +1 -1
  48. data/dependencies/SDL/include/SDL_rect.h +155 -3
  49. data/dependencies/SDL/include/SDL_render.h +47 -18
  50. data/dependencies/SDL/include/SDL_revision.h +6 -1
  51. data/dependencies/SDL/include/SDL_rwops.h +2 -16
  52. data/dependencies/SDL/include/SDL_scancode.h +47 -22
  53. data/dependencies/SDL/include/SDL_sensor.h +25 -4
  54. data/dependencies/SDL/include/SDL_shape.h +1 -1
  55. data/dependencies/SDL/include/SDL_stdinc.h +120 -9
  56. data/dependencies/SDL/include/SDL_surface.h +4 -2
  57. data/dependencies/SDL/include/SDL_system.h +67 -7
  58. data/dependencies/SDL/include/SDL_syswm.h +3 -1
  59. data/dependencies/SDL/include/SDL_test.h +1 -1
  60. data/dependencies/SDL/include/SDL_test_assert.h +1 -1
  61. data/dependencies/SDL/include/SDL_test_common.h +2 -1
  62. data/dependencies/SDL/include/SDL_test_compare.h +1 -1
  63. data/dependencies/SDL/include/SDL_test_crc32.h +1 -1
  64. data/dependencies/SDL/include/SDL_test_font.h +91 -4
  65. data/dependencies/SDL/include/SDL_test_fuzzer.h +1 -1
  66. data/dependencies/SDL/include/SDL_test_harness.h +1 -1
  67. data/dependencies/SDL/include/SDL_test_images.h +1 -1
  68. data/dependencies/SDL/include/SDL_test_log.h +1 -1
  69. data/dependencies/SDL/include/SDL_test_md5.h +1 -1
  70. data/dependencies/SDL/include/SDL_test_memory.h +1 -1
  71. data/dependencies/SDL/include/SDL_test_random.h +1 -1
  72. data/dependencies/SDL/include/SDL_thread.h +6 -6
  73. data/dependencies/SDL/include/SDL_timer.h +1 -1
  74. data/dependencies/SDL/include/SDL_touch.h +9 -1
  75. data/dependencies/SDL/include/SDL_types.h +1 -1
  76. data/dependencies/SDL/include/SDL_version.h +20 -4
  77. data/dependencies/SDL/include/SDL_video.h +72 -10
  78. data/dependencies/SDL/include/begin_code.h +5 -5
  79. data/dependencies/SDL/include/close_code.h +1 -1
  80. data/dependencies/SDL/lib/x64/libSDL2.dll.a +0 -0
  81. data/dependencies/SDL/lib/x86/libSDL2.dll.a +0 -0
  82. data/dependencies/SDL_sound/SDL_sound.c +210 -71
  83. data/dependencies/SDL_sound/SDL_sound.h +1 -1
  84. data/dependencies/SDL_sound/SDL_sound_coreaudio.c +111 -168
  85. data/dependencies/SDL_sound/SDL_sound_flac.c +0 -6
  86. data/dependencies/SDL_sound/SDL_sound_internal.h +24 -2
  87. data/dependencies/SDL_sound/SDL_sound_modplug.c +20 -8
  88. data/dependencies/SDL_sound/SDL_sound_mp3.c +11 -7
  89. data/dependencies/SDL_sound/SDL_sound_raw.c +1 -1
  90. data/dependencies/SDL_sound/SDL_sound_shn.c +1 -5
  91. data/dependencies/SDL_sound/SDL_sound_voc.c +1 -1
  92. data/dependencies/SDL_sound/SDL_sound_vorbis.c +2 -4
  93. data/dependencies/SDL_sound/SDL_sound_wav.c +49 -20
  94. data/dependencies/SDL_sound/dr_flac.h +237 -95
  95. data/dependencies/SDL_sound/dr_mp3.h +46 -33
  96. data/dependencies/SDL_sound/libmodplug/fastmix.c +53 -39
  97. data/dependencies/SDL_sound/libmodplug/libmodplug.h +0 -12
  98. data/dependencies/SDL_sound/libmodplug/load_669.c +37 -32
  99. data/dependencies/SDL_sound/libmodplug/load_amf.c +57 -44
  100. data/dependencies/SDL_sound/libmodplug/load_ams.c +127 -100
  101. data/dependencies/SDL_sound/libmodplug/load_dbm.c +40 -37
  102. data/dependencies/SDL_sound/libmodplug/load_dmf.c +61 -49
  103. data/dependencies/SDL_sound/libmodplug/load_dsm.c +18 -13
  104. data/dependencies/SDL_sound/libmodplug/load_far.c +31 -24
  105. data/dependencies/SDL_sound/libmodplug/load_gdm.c +27 -21
  106. data/dependencies/SDL_sound/libmodplug/load_it.c +106 -91
  107. data/dependencies/SDL_sound/libmodplug/load_mdl.c +43 -35
  108. data/dependencies/SDL_sound/libmodplug/load_med.c +66 -52
  109. data/dependencies/SDL_sound/libmodplug/load_mod.c +30 -26
  110. data/dependencies/SDL_sound/libmodplug/load_mt2.c +61 -50
  111. data/dependencies/SDL_sound/libmodplug/load_mtm.c +23 -17
  112. data/dependencies/SDL_sound/libmodplug/load_okt.c +18 -16
  113. data/dependencies/SDL_sound/libmodplug/load_psm.c +44 -32
  114. data/dependencies/SDL_sound/libmodplug/load_ptm.c +18 -14
  115. data/dependencies/SDL_sound/libmodplug/load_s3m.c +59 -53
  116. data/dependencies/SDL_sound/libmodplug/load_stm.c +23 -18
  117. data/dependencies/SDL_sound/libmodplug/load_ult.c +33 -29
  118. data/dependencies/SDL_sound/libmodplug/load_xm.c +64 -57
  119. data/dependencies/SDL_sound/libmodplug/mmcmp.c +2 -1
  120. data/dependencies/SDL_sound/libmodplug/snd_dsp.c +30 -20
  121. data/dependencies/SDL_sound/libmodplug/snd_flt.c +6 -4
  122. data/dependencies/SDL_sound/libmodplug/snd_fx.c +91 -65
  123. data/dependencies/SDL_sound/libmodplug/sndfile.c +91 -66
  124. data/dependencies/SDL_sound/libmodplug/sndmix.c +58 -35
  125. data/dependencies/SDL_sound/stb_vorbis.h +14 -9
  126. data/dependencies/mojoAL/mojoal.c +68 -40
  127. data/dependencies/stb/stb_image.h +117 -27
  128. data/dependencies/utf8proc/utf8proc.c +1 -1
  129. data/dependencies/utf8proc/utf8proc.h +1 -1
  130. data/dependencies/utf8proc/utf8proc_data.h +3366 -3184
  131. data/ext/gosu/extconf.rb +1 -1
  132. data/include/Gosu/Version.hpp +1 -1
  133. data/lib/SDL2.dll +0 -0
  134. data/lib64/SDL2.dll +0 -0
  135. data/src/AudioFile.hpp +1 -1
  136. data/src/AudioFileSDLSound.cpp +2 -0
  137. data/src/AudioImpl.hpp +2 -2
  138. data/src/Input.cpp +30 -26
  139. data/src/RubyGosu.cxx +146 -93
  140. data/src/RubyGosu.h +5 -7
  141. data/src/Window.cpp +3 -0
  142. metadata +6 -15
  143. data/dependencies/SDL/include/SDL_config_android.h +0 -157
  144. data/dependencies/SDL/include/SDL_config_iphoneos.h +0 -166
  145. data/dependencies/SDL/include/SDL_config_macosx.h +0 -197
  146. data/dependencies/SDL/include/SDL_config_minimal.h +0 -82
  147. data/dependencies/SDL/include/SDL_config_pandora.h +0 -128
  148. data/dependencies/SDL/include/SDL_config_psp.h +0 -144
  149. data/dependencies/SDL/include/SDL_config_windows.h +0 -225
  150. data/dependencies/SDL/include/SDL_config_winrt.h +0 -215
  151. data/dependencies/SDL/include/SDL_config_wiz.h +0 -121
  152. data/dependencies/SDL/include/SDL_copying.h +0 -20
@@ -29,12 +29,6 @@
29
29
  #define DRMP3_COPY_MEMORY(dst, src, sz) SDL_memcpy((dst), (src), (sz))
30
30
  #define DRMP3_MOVE_MEMORY(dst, src, sz) SDL_memmove((dst), (src), (sz))
31
31
  #define DRMP3_ZERO_MEMORY(p, sz) SDL_memset((p), 0, (sz))
32
- #ifndef __WATCOMC__ /* #@!.!.. */
33
- #if SDL_VERSION_ATLEAST(2, 0, 9)
34
- #define exp SDL_exp
35
- #endif
36
- #define floor SDL_floor
37
- #endif
38
32
 
39
33
  #include "dr_mp3.h"
40
34
 
@@ -83,6 +77,7 @@ static int MP3_open(Sound_Sample *sample, const char *ext)
83
77
  {
84
78
  Sound_SampleInternal *internal = (Sound_SampleInternal *) sample->opaque;
85
79
  drmp3 *dr = (drmp3 *) SDL_calloc(1, sizeof (drmp3));
80
+ Uint64 frames;
86
81
 
87
82
  BAIL_IF_MACRO(!dr, ERR_OUT_OF_MEMORY, 0);
88
83
  if (drmp3_init(dr, mp3_read, mp3_seek, sample, NULL) != DRMP3_TRUE)
@@ -99,7 +94,16 @@ static int MP3_open(Sound_Sample *sample, const char *ext)
99
94
  sample->actual.rate = dr->sampleRate;
100
95
  sample->actual.format = AUDIO_F32SYS; /* dr_mp3 only does float. */
101
96
 
102
- internal->total_time = -1; /* !!! FIXME? */
97
+ frames = drmp3_get_pcm_frame_count(dr);
98
+ if (frames == 0) /* ever possible ??? */
99
+ internal->total_time = -1;
100
+ else
101
+ {
102
+ const Uint32 rate = dr->sampleRate;
103
+ internal->total_time = (frames / rate) * 1000;
104
+ internal->total_time += ((frames % rate) * 1000) / rate;
105
+ } /* else */
106
+
103
107
  internal->decoder_private = dr;
104
108
 
105
109
  return 1;
@@ -1,5 +1,5 @@
1
1
  /**
2
- * SDL_sound; A sound processing toolkit.
2
+ * SDL_sound; An abstract sound format decoding API.
3
3
  *
4
4
  * Please see the file LICENSE.txt in the source's root directory.
5
5
  *
@@ -1,5 +1,5 @@
1
1
  /**
2
- * SDL_sound; A sound processing toolkit.
2
+ * SDL_sound; An abstract sound format decoding API.
3
3
  *
4
4
  * Please see the file LICENSE.txt in the source's root directory.
5
5
  *
@@ -174,10 +174,6 @@ static const Uint8 ulaw_outward[13][256] = {
174
174
  #define M_PI 3.14159265358979323846
175
175
  #endif
176
176
 
177
- #if defined(HAVE_LIBC) && defined(__WATCOMC__) /* Watcom has issues... */
178
- #define SDL_log log
179
- #endif
180
-
181
177
 
182
178
  static int word_get(shn_t *shn, SDL_RWops *rw, Uint32 *word)
183
179
  {
@@ -1,5 +1,5 @@
1
1
  /**
2
- * SDL_sound; A sound processing toolkit.
2
+ * SDL_sound; An abstract sound format decoding API.
3
3
  *
4
4
  * Please see the file LICENSE.txt in the source's root directory.
5
5
  *
@@ -1,5 +1,5 @@
1
1
  /**
2
- * SDL_sound; A sound processing toolkit.
2
+ * SDL_sound; An abstract sound format decoding API.
3
3
  *
4
4
  * Please see the file LICENSE.txt in the source's root directory.
5
5
  *
@@ -27,12 +27,12 @@
27
27
  #define STB_VORBIS_NO_CRT 1
28
28
  #define STB_VORBIS_NO_PUSHDATA_API 1
29
29
  #define STB_VORBIS_MAX_CHANNELS 6
30
- #define STBV_CDECL
31
30
  #define STB_VORBIS_NO_COMMENTS 1
32
31
  #define STB_FORCEINLINE SDL_FORCE_INLINE
33
32
  #if SDL_BYTEORDER == SDL_BIG_ENDIAN
34
33
  #define STB_VORBIS_BIG_ENDIAN 1
35
34
  #endif
35
+ #define STBV_CDECL SDLCALL /* for SDL_qsort */
36
36
 
37
37
  #if !defined(__clang_analyzer__)
38
38
  #ifdef assert
@@ -52,7 +52,6 @@
52
52
  #define malloc SDL_malloc
53
53
  #define realloc SDL_realloc
54
54
  #define free SDL_free
55
- #ifndef __WATCOMC__ /* #@!.!.. */
56
55
  #define pow SDL_pow
57
56
  #define floor SDL_floor
58
57
  #define ldexp(v, e) SDL_scalbn((v), (e))
@@ -64,7 +63,6 @@
64
63
  #define exp SDL_exp
65
64
  #endif
66
65
  #endif
67
- #endif
68
66
 
69
67
  #include "stb_vorbis.h"
70
68
 
@@ -1,5 +1,5 @@
1
1
  /**
2
- * SDL_sound; A sound processing toolkit.
2
+ * SDL_sound; An abstract sound format decoding API.
3
3
  *
4
4
  * Please see the file LICENSE.txt in the source's root directory.
5
5
  *
@@ -70,9 +70,10 @@ static SDL_INLINE int read_uint8(SDL_RWops *rw, Uint8 *ui8)
70
70
 
71
71
  #define fmtID 0x20746D66 /* "fmt ", in ascii. */
72
72
 
73
- #define FMT_NORMAL 0x0001 /* Uncompressed waveform data. */
74
- #define FMT_ADPCM 0x0002 /* ADPCM compressed waveform data. */
75
- #define FMT_IEEE_FLOAT 0x0003 /* Uncompressed IEEE floating point waveform data. */
73
+ #define FMT_NORMAL 0x0001 /* Uncompressed waveform data. */
74
+ #define FMT_ADPCM 0x0002 /* ADPCM compressed waveform data. */
75
+ #define FMT_IEEE_FLOAT 0x0003 /* Uncompressed IEEE floating point waveform data. */
76
+ #define FMT_EXTENSIBLE 0xFFFE /* "Extensible" tag */
76
77
 
77
78
  typedef struct
78
79
  {
@@ -92,7 +93,7 @@ typedef struct S_WAV_FMT_T
92
93
  {
93
94
  Uint32 chunkID;
94
95
  Sint32 chunkSize;
95
- Sint16 wFormatTag;
96
+ Uint16 wFormatTag;
96
97
  Uint16 wChannels;
97
98
  Uint32 dwSamplesPerSec;
98
99
  Uint32 dwAvgBytesPerSec;
@@ -144,7 +145,7 @@ static int read_fmt_chunk(SDL_RWops *rw, fmt_t *fmt)
144
145
  BAIL_IF_MACRO(fmt->chunkSize < 16, "WAV: Invalid chunk size", 0);
145
146
  fmt->next_chunk_offset = SDL_RWtell(rw) + fmt->chunkSize;
146
147
 
147
- BAIL_IF_MACRO(!read_le16s(rw, &fmt->wFormatTag), NULL, 0);
148
+ BAIL_IF_MACRO(!read_le16(rw, &fmt->wFormatTag), NULL, 0);
148
149
  BAIL_IF_MACRO(!read_le16(rw, &fmt->wChannels), NULL, 0);
149
150
  BAIL_IF_MACRO(!read_le32(rw, &fmt->dwSamplesPerSec), NULL, 0);
150
151
  BAIL_IF_MACRO(!read_le32(rw, &fmt->dwAvgBytesPerSec), NULL, 0);
@@ -211,7 +212,19 @@ static Uint32 read_sample_fmt_normal(Sound_Sample *sample)
211
212
  Sound_SampleInternal *internal = (Sound_SampleInternal *) sample->opaque;
212
213
  wav_t *w = (wav_t *) internal->decoder_private;
213
214
  Uint32 max = (internal->buffer_size < (Uint32) w->bytesLeft) ?
214
- internal->buffer_size : (Uint32) w->bytesLeft;
215
+ internal->buffer_size : (Uint32) w->bytesLeft;
216
+
217
+ /* We need to convert 24-bit PCM to an SDL-friendly AUDIO_S32SYS ... */
218
+ if (w->fmt->wBitsPerSample == 24) {
219
+ const Uint32 num_samples = max / 3;
220
+
221
+ /* we're going to expand by 25%...3 bytes to 4. Make sure the buffer has room to expand. */
222
+ max = (num_samples - (num_samples / 4)) * 3;
223
+ if (max == 0) {
224
+ sample->flags |= SOUND_SAMPLEFLAG_EOF;
225
+ return 0;
226
+ }
227
+ }
215
228
 
216
229
  SDL_assert(max > 0);
217
230
 
@@ -234,6 +247,19 @@ static Uint32 read_sample_fmt_normal(Sound_Sample *sample)
234
247
  else if (retval < internal->buffer_size)
235
248
  sample->flags |= SOUND_SAMPLEFLAG_EAGAIN;
236
249
 
250
+ /* deal with 24-bit PCM. */
251
+ if ((retval > 0) && (w->fmt->wBitsPerSample == 24)) {
252
+ const Uint32 total = retval / 3;
253
+ const Uint8 *src = ((Uint8 *)internal->buffer + retval) - 3;
254
+ Uint32 *dst = (Uint32 *) (((Uint8 *)internal->buffer + (total * 4)) - 4);
255
+ Uint32 i;
256
+ for (i = 0; i < total; i++, dst--, src -= 3) {
257
+ const Uint32 sample = ((Uint32) src[0]) | (((Uint32) src[1]) << 8) | (((Uint32) src[2]) << 16);
258
+ *dst = sample << 8; /* shift it up so the most significant bits cover the 32-bit space. */
259
+ }
260
+ retval = total * 4;
261
+ }
262
+
237
263
  return retval;
238
264
  } /* read_sample_fmt_normal */
239
265
 
@@ -590,6 +616,7 @@ static int read_fmt(SDL_RWops *rw, fmt_t *fmt)
590
616
  /* if it's in this switch statement, we support the format. */
591
617
  switch (fmt->wFormatTag)
592
618
  {
619
+ case FMT_EXTENSIBLE: /* !!! FIXME: this isn't correct */
593
620
  case FMT_NORMAL:
594
621
  SNDDBG(("WAV: Appears to be uncompressed audio.\n"));
595
622
  return read_fmt_normal(rw, fmt);
@@ -603,7 +630,6 @@ static int read_fmt(SDL_RWops *rw, fmt_t *fmt)
603
630
  return read_fmt_normal(rw, fmt); /* just normal PCM, otherwise. */
604
631
 
605
632
  /* add other types here. */
606
-
607
633
  } /* switch */
608
634
 
609
635
  SNDDBG(("WAV: Format 0x%X is unknown.\n",
@@ -662,19 +688,17 @@ static int WAV_open_internal(Sound_Sample *sample, const char *ext, fmt_t *fmt)
662
688
  } /* if */
663
689
  else
664
690
  {
665
- if (fmt->wBitsPerSample == 4)
666
- sample->actual.format = AUDIO_S16SYS;
667
- else if (fmt->wBitsPerSample == 8)
668
- sample->actual.format = AUDIO_U8;
669
- else if (fmt->wBitsPerSample == 16)
670
- sample->actual.format = AUDIO_S16LSB;
671
- else if (fmt->wBitsPerSample == 32)
672
- sample->actual.format = AUDIO_S32LSB;
673
- else
691
+ switch (fmt->wBitsPerSample)
674
692
  {
675
- SNDDBG(("WAV: %d bits per sample!?\n", (int) fmt->wBitsPerSample));
676
- BAIL_MACRO("WAV: Unsupported sample size.", 0);
677
- } /* else */
693
+ case 4: sample->actual.format = AUDIO_S16SYS; break;
694
+ case 8: sample->actual.format = AUDIO_U8; break;
695
+ case 16: sample->actual.format = AUDIO_S16LSB; break;
696
+ case 24: sample->actual.format = AUDIO_S32SYS; break;
697
+ case 32: sample->actual.format = AUDIO_S32LSB; break;
698
+ default:
699
+ SNDDBG(("WAV: %d bits per sample!?\n", (int) fmt->wBitsPerSample));
700
+ BAIL_MACRO("WAV: Unsupported sample size.", 0);
701
+ } /* switch */
678
702
  } /* else */
679
703
 
680
704
  BAIL_IF_MACRO(!read_fmt(rw, fmt), NULL, 0);
@@ -691,6 +715,11 @@ static int WAV_open_internal(Sound_Sample *sample, const char *ext, fmt_t *fmt)
691
715
  sample->actual.channels );
692
716
  internal->decoder_private = (void *) w;
693
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
+
694
723
  internal->total_time = (fmt->total_bytes / fmt->dwAvgBytesPerSec) * 1000;
695
724
  internal->total_time += (fmt->total_bytes % fmt->dwAvgBytesPerSec)
696
725
  * 1000 / fmt->dwAvgBytesPerSec;