gosu 0.15.2 → 1.0.0.pre1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/dependencies/SDL/include/SDL.h +138 -0
- data/dependencies/SDL/include/SDL_assert.h +293 -0
- data/dependencies/SDL/include/SDL_atomic.h +295 -0
- data/dependencies/SDL/include/SDL_audio.h +859 -0
- data/dependencies/SDL/include/SDL_bits.h +121 -0
- data/dependencies/SDL/include/SDL_blendmode.h +123 -0
- data/dependencies/SDL/include/SDL_clipboard.h +71 -0
- data/dependencies/SDL/include/SDL_config.h +55 -0
- data/dependencies/SDL/include/SDL_config_android.h +182 -0
- data/dependencies/SDL/include/SDL_config_iphoneos.h +207 -0
- data/dependencies/SDL/include/SDL_config_macosx.h +266 -0
- data/dependencies/SDL/include/SDL_config_minimal.h +85 -0
- data/dependencies/SDL/include/SDL_config_os2.h +188 -0
- data/dependencies/SDL/include/SDL_config_pandora.h +135 -0
- data/dependencies/SDL/include/SDL_config_psp.h +165 -0
- data/dependencies/SDL/include/SDL_config_windows.h +288 -0
- data/dependencies/SDL/include/SDL_config_winrt.h +243 -0
- data/dependencies/SDL/include/SDL_config_wiz.h +149 -0
- data/dependencies/SDL/include/SDL_copying.h +20 -0
- data/dependencies/SDL/include/SDL_cpuinfo.h +299 -0
- data/dependencies/SDL/include/SDL_egl.h +1676 -0
- data/dependencies/SDL/include/SDL_endian.h +263 -0
- data/dependencies/SDL/include/SDL_error.h +112 -0
- data/dependencies/SDL/include/SDL_events.h +827 -0
- data/dependencies/SDL/include/SDL_filesystem.h +136 -0
- data/dependencies/SDL/include/SDL_gamecontroller.h +541 -0
- data/dependencies/SDL/include/SDL_gesture.h +87 -0
- data/dependencies/SDL/include/SDL_haptic.h +1247 -0
- data/dependencies/SDL/include/SDL_hints.h +1578 -0
- data/dependencies/SDL/include/SDL_joystick.h +499 -0
- data/dependencies/SDL/include/SDL_keyboard.h +217 -0
- data/dependencies/SDL/include/SDL_keycode.h +351 -0
- data/dependencies/SDL/include/SDL_loadso.h +81 -0
- data/dependencies/SDL/include/SDL_locale.h +101 -0
- data/dependencies/SDL/include/SDL_log.h +211 -0
- data/dependencies/SDL/include/SDL_main.h +180 -0
- data/dependencies/SDL/include/SDL_messagebox.h +146 -0
- data/dependencies/SDL/include/SDL_metal.h +117 -0
- data/dependencies/SDL/include/SDL_misc.h +75 -0
- data/dependencies/SDL/include/SDL_mouse.h +302 -0
- data/dependencies/SDL/include/SDL_mutex.h +251 -0
- data/dependencies/SDL/include/SDL_name.h +33 -0
- data/dependencies/SDL/include/SDL_opengl.h +2183 -0
- data/dependencies/SDL/include/SDL_opengl_glext.h +11180 -0
- data/dependencies/SDL/include/SDL_opengles.h +39 -0
- data/dependencies/SDL/include/SDL_opengles2.h +52 -0
- data/dependencies/SDL/include/SDL_opengles2_gl2.h +621 -0
- data/dependencies/SDL/include/SDL_opengles2_gl2ext.h +2050 -0
- data/dependencies/SDL/include/SDL_opengles2_gl2platform.h +30 -0
- data/dependencies/SDL/include/SDL_opengles2_khrplatform.h +282 -0
- data/dependencies/SDL/include/SDL_pixels.h +479 -0
- data/dependencies/SDL/include/SDL_platform.h +198 -0
- data/dependencies/SDL/include/SDL_power.h +75 -0
- data/dependencies/SDL/include/SDL_quit.h +58 -0
- data/dependencies/SDL/include/SDL_rect.h +174 -0
- data/dependencies/SDL/include/SDL_render.h +1158 -0
- data/dependencies/SDL/include/SDL_revision.h +2 -0
- data/dependencies/SDL/include/SDL_rwops.h +283 -0
- data/dependencies/SDL/include/SDL_scancode.h +413 -0
- data/dependencies/SDL/include/SDL_sensor.h +267 -0
- data/dependencies/SDL/include/SDL_shape.h +144 -0
- data/dependencies/SDL/include/SDL_stdinc.h +647 -0
- data/dependencies/SDL/include/SDL_surface.h +563 -0
- data/dependencies/SDL/include/SDL_system.h +325 -0
- data/dependencies/SDL/include/SDL_syswm.h +354 -0
- data/dependencies/SDL/include/SDL_test.h +69 -0
- data/dependencies/SDL/include/SDL_test_assert.h +105 -0
- data/dependencies/SDL/include/SDL_test_common.h +218 -0
- data/dependencies/SDL/include/SDL_test_compare.h +69 -0
- data/dependencies/SDL/include/SDL_test_crc32.h +124 -0
- data/dependencies/SDL/include/SDL_test_font.h +81 -0
- data/dependencies/SDL/include/SDL_test_fuzzer.h +384 -0
- data/dependencies/SDL/include/SDL_test_harness.h +134 -0
- data/dependencies/SDL/include/SDL_test_images.h +78 -0
- data/dependencies/SDL/include/SDL_test_log.h +67 -0
- data/dependencies/SDL/include/SDL_test_md5.h +129 -0
- data/dependencies/SDL/include/SDL_test_memory.h +63 -0
- data/dependencies/SDL/include/SDL_test_random.h +115 -0
- data/dependencies/SDL/include/SDL_thread.h +366 -0
- data/dependencies/SDL/include/SDL_timer.h +115 -0
- data/dependencies/SDL/include/SDL_touch.h +102 -0
- data/dependencies/SDL/include/SDL_types.h +29 -0
- data/dependencies/SDL/include/SDL_version.h +162 -0
- data/dependencies/SDL/include/SDL_video.h +1282 -0
- data/dependencies/SDL/include/SDL_vulkan.h +276 -0
- data/dependencies/SDL/include/begin_code.h +166 -0
- data/dependencies/SDL/include/close_code.h +40 -0
- 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 +795 -0
- data/dependencies/SDL_sound/SDL_sound.h +725 -0
- data/dependencies/SDL_sound/SDL_sound_aiff.c +537 -0
- data/dependencies/SDL_sound/SDL_sound_au.c +352 -0
- data/dependencies/SDL_sound/SDL_sound_coreaudio.c +747 -0
- data/dependencies/SDL_sound/SDL_sound_flac.c +182 -0
- data/dependencies/SDL_sound/SDL_sound_internal.h +304 -0
- data/dependencies/SDL_sound/SDL_sound_modplug.c +228 -0
- data/dependencies/SDL_sound/SDL_sound_mp3.c +184 -0
- data/dependencies/SDL_sound/SDL_sound_raw.c +164 -0
- data/dependencies/SDL_sound/SDL_sound_shn.c +1309 -0
- data/dependencies/SDL_sound/SDL_sound_voc.c +550 -0
- data/dependencies/SDL_sound/SDL_sound_vorbis.c +223 -0
- data/dependencies/SDL_sound/SDL_sound_wav.c +783 -0
- data/dependencies/SDL_sound/dr_flac.h +5906 -0
- data/dependencies/SDL_sound/dr_mp3.h +2832 -0
- data/dependencies/SDL_sound/libmodplug/fastmix.c +1748 -0
- data/dependencies/SDL_sound/libmodplug/libmodplug.h +1001 -0
- data/dependencies/SDL_sound/libmodplug/load_669.c +188 -0
- data/dependencies/SDL_sound/libmodplug/load_abc.c +4725 -0
- data/dependencies/SDL_sound/libmodplug/load_amf.c +403 -0
- data/dependencies/SDL_sound/libmodplug/load_ams.c +587 -0
- data/dependencies/SDL_sound/libmodplug/load_dbm.c +357 -0
- data/dependencies/SDL_sound/libmodplug/load_dmf.c +531 -0
- data/dependencies/SDL_sound/libmodplug/load_dsm.c +232 -0
- data/dependencies/SDL_sound/libmodplug/load_far.c +253 -0
- data/dependencies/SDL_sound/libmodplug/load_it.c +796 -0
- data/dependencies/SDL_sound/libmodplug/load_mdl.c +488 -0
- data/dependencies/SDL_sound/libmodplug/load_med.c +757 -0
- data/dependencies/SDL_sound/libmodplug/load_mid.c +1405 -0
- data/dependencies/SDL_sound/libmodplug/load_mod.c +269 -0
- data/dependencies/SDL_sound/libmodplug/load_mt2.c +546 -0
- data/dependencies/SDL_sound/libmodplug/load_mtm.c +142 -0
- data/dependencies/SDL_sound/libmodplug/load_okt.c +192 -0
- data/dependencies/SDL_sound/libmodplug/load_pat.c +1143 -0
- data/dependencies/SDL_sound/libmodplug/load_pat.h +25 -0
- data/dependencies/SDL_sound/libmodplug/load_psm.c +350 -0
- data/dependencies/SDL_sound/libmodplug/load_ptm.c +204 -0
- data/dependencies/SDL_sound/libmodplug/load_s3m.c +325 -0
- data/dependencies/SDL_sound/libmodplug/load_stm.c +180 -0
- data/dependencies/SDL_sound/libmodplug/load_ult.c +206 -0
- data/dependencies/SDL_sound/libmodplug/load_umx.c +51 -0
- data/dependencies/SDL_sound/libmodplug/load_xm.c +554 -0
- data/dependencies/SDL_sound/libmodplug/mmcmp.c +382 -0
- data/dependencies/SDL_sound/libmodplug/modplug.c +170 -0
- data/dependencies/SDL_sound/libmodplug/modplug.h +90 -0
- data/dependencies/SDL_sound/libmodplug/snd_dsp.c +301 -0
- data/dependencies/SDL_sound/libmodplug/snd_flt.c +63 -0
- data/dependencies/SDL_sound/libmodplug/snd_fx.c +2350 -0
- data/dependencies/SDL_sound/libmodplug/sndfile.c +1169 -0
- data/dependencies/SDL_sound/libmodplug/sndmix.c +1034 -0
- data/dependencies/SDL_sound/libmodplug/tables.h +371 -0
- data/{src/stb_vorbis.c → dependencies/SDL_sound/stb_vorbis.h} +143 -78
- data/dependencies/al_soft/AL/al.h +655 -0
- data/dependencies/al_soft/AL/alc.h +270 -0
- data/dependencies/al_soft/AL/alext.h +585 -0
- data/dependencies/al_soft/AL/efx-creative.h +3 -0
- data/dependencies/al_soft/AL/efx-presets.h +402 -0
- data/dependencies/al_soft/AL/efx.h +762 -0
- data/dependencies/al_soft/x64/libOpenAL32.dll.a +0 -0
- data/dependencies/al_soft/x86/libOpenAL32.dll.a +0 -0
- data/{src → dependencies/stb}/stb_image.h +330 -127
- data/{src → dependencies/stb}/stb_image_write.h +156 -85
- data/{src → dependencies/stb}/stb_truetype.h +192 -69
- data/{src → dependencies/utf8proc}/utf8proc.c +0 -0
- data/{src → dependencies/utf8proc}/utf8proc.h +0 -0
- data/{src → dependencies/utf8proc}/utf8proc_data.h +0 -0
- data/ext/gosu/extconf.rb +56 -22
- data/{Gosu → include/Gosu}/Audio.hpp +6 -8
- data/{Gosu → include/Gosu}/AutoLink.hpp +0 -0
- data/include/Gosu/Bitmap.hpp +100 -0
- data/{Gosu → include/Gosu}/Buttons.hpp +94 -35
- data/{Gosu → include/Gosu}/Channel.h +0 -0
- data/{Gosu → include/Gosu}/Color.h +0 -0
- data/{Gosu → include/Gosu}/Color.hpp +0 -0
- data/{Gosu → include/Gosu}/Directories.hpp +0 -0
- data/{Gosu → include/Gosu}/Font.h +0 -0
- data/{Gosu → include/Gosu}/Font.hpp +0 -0
- data/{Gosu → include/Gosu}/Fwd.hpp +0 -0
- data/{Gosu → include/Gosu}/Gosu.h +3 -0
- data/{Gosu → include/Gosu}/Gosu.hpp +0 -0
- data/{Gosu → include/Gosu}/Graphics.hpp +0 -0
- data/{Gosu → include/Gosu}/GraphicsBase.hpp +0 -0
- data/{Gosu → include/Gosu}/IO.hpp +0 -0
- data/{Gosu → include/Gosu}/Image.h +0 -0
- data/{Gosu → include/Gosu}/Image.hpp +7 -6
- data/{Gosu → include/Gosu}/ImageData.hpp +0 -0
- data/{Gosu → include/Gosu}/Input.hpp +30 -15
- data/{Gosu → include/Gosu}/Inspection.hpp +0 -0
- data/{Gosu → include/Gosu}/Math.hpp +0 -0
- data/{Gosu → include/Gosu}/Platform.hpp +0 -0
- data/{Gosu → include/Gosu}/Sample.h +0 -0
- data/{Gosu → include/Gosu}/Song.h +0 -0
- data/{Gosu → include/Gosu}/Text.hpp +0 -0
- data/{Gosu → include/Gosu}/TextInput.h +0 -0
- data/{Gosu → include/Gosu}/TextInput.hpp +0 -0
- data/{Gosu → include/Gosu}/Timing.hpp +0 -0
- data/{Gosu → include/Gosu}/Utility.hpp +1 -1
- data/{Gosu → include/Gosu}/Version.hpp +0 -0
- data/{Gosu → include/Gosu}/Window.h +2 -0
- data/{Gosu → include/Gosu}/Window.hpp +21 -13
- data/lib/OpenAL32.dll +0 -0
- data/lib/SDL2.dll +0 -0
- data/lib/gosu.rb +0 -3
- data/lib/gosu/patches.rb +0 -9
- data/lib/gosu/swig_patches.rb +3 -2
- data/lib/libmpg123.dll +0 -0
- data/lib/libsndfile.dll +0 -0
- data/lib64/OpenAL32.dll +0 -0
- data/lib64/SDL2.dll +0 -0
- data/lib64/libmpg123.dll +0 -0
- data/lib64/libsndfile.dll +0 -0
- data/rdoc/gosu.rb +95 -20
- data/src/Audio.cpp +50 -224
- data/src/AudioFile.hpp +17 -37
- data/src/AudioFileAudioToolbox.cpp +237 -0
- data/src/AudioFileSDLSound.cpp +147 -0
- data/src/AudioImpl.cpp +3 -12
- data/src/AudioImpl.hpp +3 -1
- data/src/Bitmap.cpp +85 -83
- data/src/BitmapIO.cpp +52 -58
- data/src/Constants.cpp +80 -33
- data/src/Font.cpp +3 -1
- data/src/GosuWrapper.cpp +19 -0
- data/src/Graphics.cpp +7 -4
- data/src/Image.cpp +13 -16
- data/src/Input.cpp +408 -159
- data/src/LargeImageData.cpp +1 -1
- data/src/MarkupParser.cpp +2 -1
- data/src/RubyGosu.cxx +349 -83
- data/src/RubyGosu.h +4 -2
- data/src/TexChunk.cpp +1 -1
- data/src/TextBuilder.cpp +3 -1
- data/src/Texture.cpp +1 -1
- data/src/TrueTypeFont.cpp +1 -1
- data/src/Utility.cpp +11 -7
- data/src/Window.cpp +30 -39
- data/src/WindowWrapper.cpp +28 -0
- metadata +207 -52
- data/Gosu/Bitmap.hpp +0 -113
- data/src/AudioToolboxFile.hpp +0 -210
- data/src/OggFile.hpp +0 -92
- data/src/SndFile.hpp +0 -174
- data/src/WinMain.cpp +0 -64
@@ -0,0 +1,371 @@
|
|
1
|
+
/*
|
2
|
+
* This source code is public domain.
|
3
|
+
*
|
4
|
+
* Authors: Olivier Lapicque <olivierl@jps.net>
|
5
|
+
*/
|
6
|
+
|
7
|
+
#include "libmodplug.h"
|
8
|
+
|
9
|
+
static const BYTE ImpulseTrackerPortaVolCmd[16] =
|
10
|
+
{
|
11
|
+
0x00, 0x01, 0x04, 0x08, 0x10, 0x20, 0x40, 0x60,
|
12
|
+
0x80, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF
|
13
|
+
};
|
14
|
+
|
15
|
+
// Period table for Protracker octaves 0-5:
|
16
|
+
static const WORD ProTrackerPeriodTable[6*12] =
|
17
|
+
{
|
18
|
+
1712,1616,1524,1440,1356,1280,1208,1140,1076,1016,960,907,
|
19
|
+
856,808,762,720,678,640,604,570,538,508,480,453,
|
20
|
+
428,404,381,360,339,320,302,285,269,254,240,226,
|
21
|
+
214,202,190,180,170,160,151,143,135,127,120,113,
|
22
|
+
107,101,95,90,85,80,75,71,67,63,60,56,
|
23
|
+
53,50,47,45,42,40,37,35,33,31,30,28
|
24
|
+
};
|
25
|
+
|
26
|
+
|
27
|
+
static const WORD ProTrackerTunedPeriods[16*12] =
|
28
|
+
{
|
29
|
+
1712,1616,1524,1440,1356,1280,1208,1140,1076,1016,960,907,
|
30
|
+
1700,1604,1514,1430,1348,1274,1202,1134,1070,1010,954,900,
|
31
|
+
1688,1592,1504,1418,1340,1264,1194,1126,1064,1004,948,894,
|
32
|
+
1676,1582,1492,1408,1330,1256,1184,1118,1056,996,940,888,
|
33
|
+
1664,1570,1482,1398,1320,1246,1176,1110,1048,990,934,882,
|
34
|
+
1652,1558,1472,1388,1310,1238,1168,1102,1040,982,926,874,
|
35
|
+
1640,1548,1460,1378,1302,1228,1160,1094,1032,974,920,868,
|
36
|
+
1628,1536,1450,1368,1292,1220,1150,1086,1026,968,914,862,
|
37
|
+
1814,1712,1616,1524,1440,1356,1280,1208,1140,1076,1016,960,
|
38
|
+
1800,1700,1604,1514,1430,1350,1272,1202,1134,1070,1010,954,
|
39
|
+
1788,1688,1592,1504,1418,1340,1264,1194,1126,1064,1004,948,
|
40
|
+
1774,1676,1582,1492,1408,1330,1256,1184,1118,1056,996,940,
|
41
|
+
1762,1664,1570,1482,1398,1320,1246,1176,1110,1048,988,934,
|
42
|
+
1750,1652,1558,1472,1388,1310,1238,1168,1102,1040,982,926,
|
43
|
+
1736,1640,1548,1460,1378,1302,1228,1160,1094,1032,974,920,
|
44
|
+
1724,1628,1536,1450,1368,1292,1220,1150,1086,1026,968,914
|
45
|
+
};
|
46
|
+
|
47
|
+
|
48
|
+
// S3M C-4 periods
|
49
|
+
static const WORD FreqS3MTable[16] =
|
50
|
+
{
|
51
|
+
1712,1616,1524,1440,1356,1280,
|
52
|
+
1208,1140,1076,1016,960,907,
|
53
|
+
0,0,0,0
|
54
|
+
};
|
55
|
+
|
56
|
+
|
57
|
+
// S3M FineTune frequencies
|
58
|
+
static const WORD S3MFineTuneTable[16] =
|
59
|
+
{
|
60
|
+
7895,7941,7985,8046,8107,8169,8232,8280,
|
61
|
+
8363,8413,8463,8529,8581,8651,8723,8757, // 8363*2^((i-8)/(12*8))
|
62
|
+
};
|
63
|
+
|
64
|
+
|
65
|
+
// Sinus table
|
66
|
+
static const int16_t ModSinusTable[64] =
|
67
|
+
{
|
68
|
+
0,12,25,37,49,60,71,81,90,98,106,112,117,122,125,126,
|
69
|
+
127,126,125,122,117,112,106,98,90,81,71,60,49,37,25,12,
|
70
|
+
0,-12,-25,-37,-49,-60,-71,-81,-90,-98,-106,-112,-117,-122,-125,-126,
|
71
|
+
-127,-126,-125,-122,-117,-112,-106,-98,-90,-81,-71,-60,-49,-37,-25,-12
|
72
|
+
};
|
73
|
+
|
74
|
+
// Triangle wave table (ramp down)
|
75
|
+
static const int16_t ModRampDownTable[64] =
|
76
|
+
{
|
77
|
+
0,-4,-8,-12,-16,-20,-24,-28,-32,-36,-40,-44,-48,-52,-56,-60,
|
78
|
+
-64,-68,-72,-76,-80,-84,-88,-92,-96,-100,-104,-108,-112,-116,-120,-124,
|
79
|
+
127,123,119,115,111,107,103,99,95,91,87,83,79,75,71,67,
|
80
|
+
63,59,55,51,47,43,39,35,31,27,23,19,15,11,7,3
|
81
|
+
};
|
82
|
+
|
83
|
+
// Square wave table
|
84
|
+
static const int16_t ModSquareTable[64] =
|
85
|
+
{
|
86
|
+
127,127,127,127,127,127,127,127,127,127,127,127,127,127,127,127,
|
87
|
+
127,127,127,127,127,127,127,127,127,127,127,127,127,127,127,127,
|
88
|
+
-127,-127,-127,-127,-127,-127,-127,-127,-127,-127,-127,-127,-127,-127,-127,-127,
|
89
|
+
-127,-127,-127,-127,-127,-127,-127,-127,-127,-127,-127,-127,-127,-127,-127,-127
|
90
|
+
};
|
91
|
+
|
92
|
+
// Random wave table
|
93
|
+
static const int16_t ModRandomTable[64] =
|
94
|
+
{
|
95
|
+
98,-127,-43,88,102,41,-65,-94,125,20,-71,-86,-70,-32,-16,-96,
|
96
|
+
17,72,107,-5,116,-69,-62,-40,10,-61,65,109,-18,-38,-13,-76,
|
97
|
+
-23,88,21,-94,8,106,21,-112,6,109,20,-88,-30,9,-127,118,
|
98
|
+
42,-34,89,-4,-51,-72,21,-29,112,123,84,-101,-92,98,-54,-95
|
99
|
+
};
|
100
|
+
|
101
|
+
|
102
|
+
// volume fade tables for Retrig Note:
|
103
|
+
static const int8_t retrigTable1[16] =
|
104
|
+
{ 0, 0, 0, 0, 0, 0, 10, 8, 0, 0, 0, 0, 0, 0, 24, 32 };
|
105
|
+
|
106
|
+
static const int8_t retrigTable2[16] =
|
107
|
+
{ 0, -1, -2, -4, -8, -16, 0, 0, 0, 1, 2, 4, 8, 16, 0, 0 };
|
108
|
+
|
109
|
+
|
110
|
+
|
111
|
+
static const WORD XMPeriodTable[104] =
|
112
|
+
{
|
113
|
+
907,900,894,887,881,875,868,862,856,850,844,838,832,826,820,814,
|
114
|
+
808,802,796,791,785,779,774,768,762,757,752,746,741,736,730,725,
|
115
|
+
720,715,709,704,699,694,689,684,678,675,670,665,660,655,651,646,
|
116
|
+
640,636,632,628,623,619,614,610,604,601,597,592,588,584,580,575,
|
117
|
+
570,567,563,559,555,551,547,543,538,535,532,528,524,520,516,513,
|
118
|
+
508,505,502,498,494,491,487,484,480,477,474,470,467,463,460,457,
|
119
|
+
453,450,447,443,440,437,434,431
|
120
|
+
};
|
121
|
+
|
122
|
+
|
123
|
+
static const uint32_t XMLinearTable[768] =
|
124
|
+
{
|
125
|
+
535232,534749,534266,533784,533303,532822,532341,531861,
|
126
|
+
531381,530902,530423,529944,529466,528988,528511,528034,
|
127
|
+
527558,527082,526607,526131,525657,525183,524709,524236,
|
128
|
+
523763,523290,522818,522346,521875,521404,520934,520464,
|
129
|
+
519994,519525,519057,518588,518121,517653,517186,516720,
|
130
|
+
516253,515788,515322,514858,514393,513929,513465,513002,
|
131
|
+
512539,512077,511615,511154,510692,510232,509771,509312,
|
132
|
+
508852,508393,507934,507476,507018,506561,506104,505647,
|
133
|
+
505191,504735,504280,503825,503371,502917,502463,502010,
|
134
|
+
501557,501104,500652,500201,499749,499298,498848,498398,
|
135
|
+
497948,497499,497050,496602,496154,495706,495259,494812,
|
136
|
+
494366,493920,493474,493029,492585,492140,491696,491253,
|
137
|
+
490809,490367,489924,489482,489041,488600,488159,487718,
|
138
|
+
487278,486839,486400,485961,485522,485084,484647,484210,
|
139
|
+
483773,483336,482900,482465,482029,481595,481160,480726,
|
140
|
+
480292,479859,479426,478994,478562,478130,477699,477268,
|
141
|
+
476837,476407,475977,475548,475119,474690,474262,473834,
|
142
|
+
473407,472979,472553,472126,471701,471275,470850,470425,
|
143
|
+
470001,469577,469153,468730,468307,467884,467462,467041,
|
144
|
+
466619,466198,465778,465358,464938,464518,464099,463681,
|
145
|
+
463262,462844,462427,462010,461593,461177,460760,460345,
|
146
|
+
459930,459515,459100,458686,458272,457859,457446,457033,
|
147
|
+
456621,456209,455797,455386,454975,454565,454155,453745,
|
148
|
+
453336,452927,452518,452110,451702,451294,450887,450481,
|
149
|
+
450074,449668,449262,448857,448452,448048,447644,447240,
|
150
|
+
446836,446433,446030,445628,445226,444824,444423,444022,
|
151
|
+
443622,443221,442821,442422,442023,441624,441226,440828,
|
152
|
+
440430,440033,439636,439239,438843,438447,438051,437656,
|
153
|
+
437261,436867,436473,436079,435686,435293,434900,434508,
|
154
|
+
434116,433724,433333,432942,432551,432161,431771,431382,
|
155
|
+
430992,430604,430215,429827,429439,429052,428665,428278,
|
156
|
+
427892,427506,427120,426735,426350,425965,425581,425197,
|
157
|
+
424813,424430,424047,423665,423283,422901,422519,422138,
|
158
|
+
421757,421377,420997,420617,420237,419858,419479,419101,
|
159
|
+
418723,418345,417968,417591,417214,416838,416462,416086,
|
160
|
+
415711,415336,414961,414586,414212,413839,413465,413092,
|
161
|
+
412720,412347,411975,411604,411232,410862,410491,410121,
|
162
|
+
409751,409381,409012,408643,408274,407906,407538,407170,
|
163
|
+
406803,406436,406069,405703,405337,404971,404606,404241,
|
164
|
+
403876,403512,403148,402784,402421,402058,401695,401333,
|
165
|
+
400970,400609,400247,399886,399525,399165,398805,398445,
|
166
|
+
398086,397727,397368,397009,396651,396293,395936,395579,
|
167
|
+
395222,394865,394509,394153,393798,393442,393087,392733,
|
168
|
+
392378,392024,391671,391317,390964,390612,390259,389907,
|
169
|
+
389556,389204,388853,388502,388152,387802,387452,387102,
|
170
|
+
386753,386404,386056,385707,385359,385012,384664,384317,
|
171
|
+
383971,383624,383278,382932,382587,382242,381897,381552,
|
172
|
+
381208,380864,380521,380177,379834,379492,379149,378807,
|
173
|
+
|
174
|
+
378466,378124,377783,377442,377102,376762,376422,376082,
|
175
|
+
375743,375404,375065,374727,374389,374051,373714,373377,
|
176
|
+
373040,372703,372367,372031,371695,371360,371025,370690,
|
177
|
+
370356,370022,369688,369355,369021,368688,368356,368023,
|
178
|
+
367691,367360,367028,366697,366366,366036,365706,365376,
|
179
|
+
365046,364717,364388,364059,363731,363403,363075,362747,
|
180
|
+
362420,362093,361766,361440,361114,360788,360463,360137,
|
181
|
+
359813,359488,359164,358840,358516,358193,357869,357547,
|
182
|
+
357224,356902,356580,356258,355937,355616,355295,354974,
|
183
|
+
354654,354334,354014,353695,353376,353057,352739,352420,
|
184
|
+
352103,351785,351468,351150,350834,350517,350201,349885,
|
185
|
+
349569,349254,348939,348624,348310,347995,347682,347368,
|
186
|
+
347055,346741,346429,346116,345804,345492,345180,344869,
|
187
|
+
344558,344247,343936,343626,343316,343006,342697,342388,
|
188
|
+
342079,341770,341462,341154,340846,340539,340231,339924,
|
189
|
+
339618,339311,339005,338700,338394,338089,337784,337479,
|
190
|
+
337175,336870,336566,336263,335959,335656,335354,335051,
|
191
|
+
334749,334447,334145,333844,333542,333242,332941,332641,
|
192
|
+
332341,332041,331741,331442,331143,330844,330546,330247,
|
193
|
+
329950,329652,329355,329057,328761,328464,328168,327872,
|
194
|
+
327576,327280,326985,326690,326395,326101,325807,325513,
|
195
|
+
325219,324926,324633,324340,324047,323755,323463,323171,
|
196
|
+
322879,322588,322297,322006,321716,321426,321136,320846,
|
197
|
+
320557,320267,319978,319690,319401,319113,318825,318538,
|
198
|
+
318250,317963,317676,317390,317103,316817,316532,316246,
|
199
|
+
315961,315676,315391,315106,314822,314538,314254,313971,
|
200
|
+
313688,313405,313122,312839,312557,312275,311994,311712,
|
201
|
+
311431,311150,310869,310589,310309,310029,309749,309470,
|
202
|
+
309190,308911,308633,308354,308076,307798,307521,307243,
|
203
|
+
306966,306689,306412,306136,305860,305584,305308,305033,
|
204
|
+
304758,304483,304208,303934,303659,303385,303112,302838,
|
205
|
+
302565,302292,302019,301747,301475,301203,300931,300660,
|
206
|
+
300388,300117,299847,299576,299306,299036,298766,298497,
|
207
|
+
298227,297958,297689,297421,297153,296884,296617,296349,
|
208
|
+
296082,295815,295548,295281,295015,294749,294483,294217,
|
209
|
+
293952,293686,293421,293157,292892,292628,292364,292100,
|
210
|
+
291837,291574,291311,291048,290785,290523,290261,289999,
|
211
|
+
289737,289476,289215,288954,288693,288433,288173,287913,
|
212
|
+
287653,287393,287134,286875,286616,286358,286099,285841,
|
213
|
+
285583,285326,285068,284811,284554,284298,284041,283785,
|
214
|
+
283529,283273,283017,282762,282507,282252,281998,281743,
|
215
|
+
281489,281235,280981,280728,280475,280222,279969,279716,
|
216
|
+
279464,279212,278960,278708,278457,278206,277955,277704,
|
217
|
+
277453,277203,276953,276703,276453,276204,275955,275706,
|
218
|
+
275457,275209,274960,274712,274465,274217,273970,273722,
|
219
|
+
273476,273229,272982,272736,272490,272244,271999,271753,
|
220
|
+
271508,271263,271018,270774,270530,270286,270042,269798,
|
221
|
+
269555,269312,269069,268826,268583,268341,268099,267857
|
222
|
+
};
|
223
|
+
|
224
|
+
|
225
|
+
static const int8_t ft2VibratoTable[256] =
|
226
|
+
{
|
227
|
+
0,-2,-3,-5,-6,-8,-9,-11,-12,-14,-16,-17,-19,-20,-22,-23,
|
228
|
+
-24,-26,-27,-29,-30,-32,-33,-34,-36,-37,-38,-39,-41,-42,
|
229
|
+
-43,-44,-45,-46,-47,-48,-49,-50,-51,-52,-53,-54,-55,-56,
|
230
|
+
-56,-57,-58,-59,-59,-60,-60,-61,-61,-62,-62,-62,-63,-63,
|
231
|
+
-63,-64,-64,-64,-64,-64,-64,-64,-64,-64,-64,-64,-63,-63,
|
232
|
+
-63,-62,-62,-62,-61,-61,-60,-60,-59,-59,-58,-57,-56,-56,
|
233
|
+
-55,-54,-53,-52,-51,-50,-49,-48,-47,-46,-45,-44,-43,-42,
|
234
|
+
-41,-39,-38,-37,-36,-34,-33,-32,-30,-29,-27,-26,-24,-23,
|
235
|
+
-22,-20,-19,-17,-16,-14,-12,-11,-9,-8,-6,-5,-3,-2,0,
|
236
|
+
2,3,5,6,8,9,11,12,14,16,17,19,20,22,23,24,26,27,29,30,
|
237
|
+
32,33,34,36,37,38,39,41,42,43,44,45,46,47,48,49,50,51,
|
238
|
+
52,53,54,55,56,56,57,58,59,59,60,60,61,61,62,62,62,63,
|
239
|
+
63,63,64,64,64,64,64,64,64,64,64,64,64,63,63,63,62,62,
|
240
|
+
62,61,61,60,60,59,59,58,57,56,56,55,54,53,52,51,50,49,
|
241
|
+
48,47,46,45,44,43,42,41,39,38,37,36,34,33,32,30,29,27,
|
242
|
+
26,24,23,22,20,19,17,16,14,12,11,9,8,6,5,3,2
|
243
|
+
};
|
244
|
+
|
245
|
+
|
246
|
+
|
247
|
+
static const DWORD FineLinearSlideUpTable[16] =
|
248
|
+
{
|
249
|
+
65536, 65595, 65654, 65714, 65773, 65832, 65892, 65951,
|
250
|
+
66011, 66071, 66130, 66190, 66250, 66309, 66369, 66429
|
251
|
+
};
|
252
|
+
|
253
|
+
|
254
|
+
static const DWORD FineLinearSlideDownTable[16] =
|
255
|
+
{
|
256
|
+
65535, 65477, 65418, 65359, 65300, 65241, 65182, 65123,
|
257
|
+
65065, 65006, 64947, 64888, 64830, 64772, 64713, 64645
|
258
|
+
};
|
259
|
+
|
260
|
+
|
261
|
+
static const DWORD LinearSlideUpTable[256] =
|
262
|
+
{
|
263
|
+
65536, 65773, 66010, 66249, 66489, 66729, 66971, 67213,
|
264
|
+
67456, 67700, 67945, 68190, 68437, 68685, 68933, 69182,
|
265
|
+
69432, 69684, 69936, 70189, 70442, 70697, 70953, 71209,
|
266
|
+
71467, 71725, 71985, 72245, 72507, 72769, 73032, 73296,
|
267
|
+
73561, 73827, 74094, 74362, 74631, 74901, 75172, 75444,
|
268
|
+
75717, 75991, 76265, 76541, 76818, 77096, 77375, 77655,
|
269
|
+
77935, 78217, 78500, 78784, 79069, 79355, 79642, 79930,
|
270
|
+
80219, 80509, 80800, 81093, 81386, 81680, 81976, 82272,
|
271
|
+
82570, 82868, 83168, 83469, 83771, 84074, 84378, 84683,
|
272
|
+
84989, 85297, 85605, 85915, 86225, 86537, 86850, 87164,
|
273
|
+
87480, 87796, 88113, 88432, 88752, 89073, 89395, 89718,
|
274
|
+
90043, 90369, 90695, 91023, 91353, 91683, 92015, 92347,
|
275
|
+
92681, 93017, 93353, 93691, 94029, 94370, 94711, 95053,
|
276
|
+
95397, 95742, 96088, 96436, 96785, 97135, 97486, 97839,
|
277
|
+
98193, 98548, 98904, 99262, 99621, 99981, 100343, 100706,
|
278
|
+
101070, 101435, 101802, 102170, 102540, 102911, 103283, 103657,
|
279
|
+
104031, 104408, 104785, 105164, 105545, 105926, 106309, 106694,
|
280
|
+
107080, 107467, 107856, 108246, 108637, 109030, 109425, 109820,
|
281
|
+
110217, 110616, 111016, 111418, 111821, 112225, 112631, 113038,
|
282
|
+
113447, 113857, 114269, 114682, 115097, 115514, 115931, 116351,
|
283
|
+
116771, 117194, 117618, 118043, 118470, 118898, 119328, 119760,
|
284
|
+
120193, 120628, 121064, 121502, 121941, 122382, 122825, 123269,
|
285
|
+
123715, 124162, 124611, 125062, 125514, 125968, 126424, 126881,
|
286
|
+
127340, 127801, 128263, 128727, 129192, 129660, 130129, 130599,
|
287
|
+
131072, 131546, 132021, 132499, 132978, 133459, 133942, 134426,
|
288
|
+
134912, 135400, 135890, 136381, 136875, 137370, 137866, 138365,
|
289
|
+
138865, 139368, 139872, 140378, 140885, 141395, 141906, 142419,
|
290
|
+
142935, 143451, 143970, 144491, 145014, 145538, 146064, 146593,
|
291
|
+
147123, 147655, 148189, 148725, 149263, 149803, 150344, 150888,
|
292
|
+
151434, 151982, 152531, 153083, 153637, 154192, 154750, 155310,
|
293
|
+
155871, 156435, 157001, 157569, 158138, 158710, 159284, 159860,
|
294
|
+
160439, 161019, 161601, 162186, 162772, 163361, 163952, 164545,
|
295
|
+
};
|
296
|
+
|
297
|
+
|
298
|
+
static const DWORD LinearSlideDownTable[256] =
|
299
|
+
{
|
300
|
+
65536, 65299, 65064, 64830, 64596, 64363, 64131, 63900,
|
301
|
+
63670, 63440, 63212, 62984, 62757, 62531, 62305, 62081,
|
302
|
+
61857, 61634, 61412, 61191, 60970, 60751, 60532, 60314,
|
303
|
+
60096, 59880, 59664, 59449, 59235, 59021, 58809, 58597,
|
304
|
+
58385, 58175, 57965, 57757, 57548, 57341, 57134, 56928,
|
305
|
+
56723, 56519, 56315, 56112, 55910, 55709, 55508, 55308,
|
306
|
+
55108, 54910, 54712, 54515, 54318, 54123, 53928, 53733,
|
307
|
+
|
308
|
+
53540, 53347, 53154, 52963, 52772, 52582, 52392, 52204,
|
309
|
+
52015, 51828, 51641, 51455, 51270, 51085, 50901, 50717,
|
310
|
+
50535, 50353, 50171, 49990, 49810, 49631, 49452, 49274,
|
311
|
+
49096, 48919, 48743, 48567, 48392, 48218, 48044, 47871,
|
312
|
+
47698, 47526, 47355, 47185, 47014, 46845, 46676, 46508,
|
313
|
+
46340, 46173, 46007, 45841, 45676, 45511, 45347, 45184,
|
314
|
+
45021, 44859, 44697, 44536, 44376, 44216, 44056, 43898,
|
315
|
+
43740, 43582, 43425, 43268, 43112, 42957, 42802, 42648,
|
316
|
+
42494, 42341, 42189, 42037, 41885, 41734, 41584, 41434,
|
317
|
+
41285, 41136, 40988, 40840, 40693, 40546, 40400, 40254,
|
318
|
+
40109, 39965, 39821, 39677, 39534, 39392, 39250, 39108,
|
319
|
+
38967, 38827, 38687, 38548, 38409, 38270, 38132, 37995,
|
320
|
+
37858, 37722, 37586, 37450, 37315, 37181, 37047, 36913,
|
321
|
+
36780, 36648, 36516, 36384, 36253, 36122, 35992, 35862,
|
322
|
+
35733, 35604, 35476, 35348, 35221, 35094, 34968, 34842,
|
323
|
+
34716, 34591, 34466, 34342, 34218, 34095, 33972, 33850,
|
324
|
+
33728, 33606, 33485, 33364, 33244, 33124, 33005, 32886,
|
325
|
+
32768, 32649, 32532, 32415, 32298, 32181, 32065, 31950,
|
326
|
+
31835, 31720, 31606, 31492, 31378, 31265, 31152, 31040,
|
327
|
+
30928, 30817, 30706, 30595, 30485, 30375, 30266, 30157,
|
328
|
+
30048, 29940, 29832, 29724, 29617, 29510, 29404, 29298,
|
329
|
+
29192, 29087, 28982, 28878, 28774, 28670, 28567, 28464,
|
330
|
+
28361, 28259, 28157, 28056, 27955, 27854, 27754, 27654,
|
331
|
+
27554, 27455, 27356, 27257, 27159, 27061, 26964, 26866,
|
332
|
+
26770, 26673, 26577, 26481, 26386, 26291, 26196, 26102,
|
333
|
+
};
|
334
|
+
|
335
|
+
|
336
|
+
static const int SpectrumSinusTable[256*2] =
|
337
|
+
{
|
338
|
+
0, 1, 1, 2, 3, 3, 4, 5, 6, 7, 7, 8, 9, 10, 10, 11,
|
339
|
+
12, 13, 14, 14, 15, 16, 17, 17, 18, 19, 20, 20, 21, 22, 22, 23,
|
340
|
+
24, 25, 25, 26, 27, 28, 28, 29, 30, 30, 31, 32, 32, 33, 34, 34,
|
341
|
+
35, 36, 36, 37, 38, 38, 39, 39, 40, 41, 41, 42, 42, 43, 44, 44,
|
342
|
+
45, 45, 46, 46, 47, 47, 48, 48, 49, 49, 50, 50, 51, 51, 52, 52,
|
343
|
+
53, 53, 53, 54, 54, 55, 55, 55, 56, 56, 57, 57, 57, 58, 58, 58,
|
344
|
+
59, 59, 59, 59, 60, 60, 60, 60, 61, 61, 61, 61, 61, 62, 62, 62,
|
345
|
+
62, 62, 62, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63,
|
346
|
+
63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 62, 62,
|
347
|
+
62, 62, 62, 62, 61, 61, 61, 61, 61, 60, 60, 60, 60, 59, 59, 59,
|
348
|
+
59, 58, 58, 58, 57, 57, 57, 56, 56, 55, 55, 55, 54, 54, 53, 53,
|
349
|
+
53, 52, 52, 51, 51, 50, 50, 49, 49, 48, 48, 47, 47, 46, 46, 45,
|
350
|
+
45, 44, 44, 43, 42, 42, 41, 41, 40, 39, 39, 38, 38, 37, 36, 36,
|
351
|
+
35, 34, 34, 33, 32, 32, 31, 30, 30, 29, 28, 28, 27, 26, 25, 25,
|
352
|
+
24, 23, 22, 22, 21, 20, 20, 19, 18, 17, 17, 16, 15, 14, 14, 13,
|
353
|
+
12, 11, 10, 10, 9, 8, 7, 7, 6, 5, 4, 3, 3, 2, 1, 0,
|
354
|
+
0, -1, -1, -2, -3, -3, -4, -5, -6, -7, -7, -8, -9, -10, -10, -11,
|
355
|
+
-12, -13, -14, -14, -15, -16, -17, -17, -18, -19, -20, -20, -21, -22, -22, -23,
|
356
|
+
-24, -25, -25, -26, -27, -28, -28, -29, -30, -30, -31, -32, -32, -33, -34, -34,
|
357
|
+
-35, -36, -36, -37, -38, -38, -39, -39, -40, -41, -41, -42, -42, -43, -44, -44,
|
358
|
+
-45, -45, -46, -46, -47, -47, -48, -48, -49, -49, -50, -50, -51, -51, -52, -52,
|
359
|
+
-53, -53, -53, -54, -54, -55, -55, -55, -56, -56, -57, -57, -57, -58, -58, -58,
|
360
|
+
-59, -59, -59, -59, -60, -60, -60, -60, -61, -61, -61, -61, -61, -62, -62, -62,
|
361
|
+
-62, -62, -62, -63, -63, -63, -63, -63, -63, -63, -63, -63, -63, -63, -63, -63,
|
362
|
+
-63, -63, -63, -63, -63, -63, -63, -63, -63, -63, -63, -63, -63, -63, -62, -62,
|
363
|
+
-62, -62, -62, -62, -61, -61, -61, -61, -61, -60, -60, -60, -60, -59, -59, -59,
|
364
|
+
-59, -58, -58, -58, -57, -57, -57, -56, -56, -55, -55, -55, -54, -54, -53, -53,
|
365
|
+
-53, -52, -52, -51, -51, -50, -50, -49, -49, -48, -48, -47, -47, -46, -46, -45,
|
366
|
+
-45, -44, -44, -43, -42, -42, -41, -41, -40, -39, -39, -38, -38, -37, -36, -36,
|
367
|
+
-35, -34, -34, -33, -32, -32, -31, -30, -30, -29, -28, -28, -27, -26, -25, -25,
|
368
|
+
-24, -23, -22, -22, -21, -20, -20, -19, -18, -17, -17, -16, -15, -14, -14, -13,
|
369
|
+
-12, -11, -10, -10, -9, -8, -7, -7, -6, -5, -4, -3, -3, -2, -1, 0,
|
370
|
+
};
|
371
|
+
|
@@ -1,4 +1,4 @@
|
|
1
|
-
// Ogg Vorbis audio decoder - v1.
|
1
|
+
// Ogg Vorbis audio decoder - v1.14 - public domain
|
2
2
|
// http://nothings.org/stb_vorbis/
|
3
3
|
//
|
4
4
|
// Original version written by Sean Barrett in 2007.
|
@@ -30,12 +30,9 @@
|
|
30
30
|
// Tom Beaumont Ingo Leitgeb Nicolas Guillemot
|
31
31
|
// Phillip Bennefall Rohit Thiago Goulart
|
32
32
|
// manxorist@github saga musix github:infatum
|
33
|
-
// Timur Gagiev
|
33
|
+
// Timur Gagiev
|
34
34
|
//
|
35
35
|
// Partial history:
|
36
|
-
// 1.17 - 2019-07-08 - fix CVE-2019-13217..CVE-2019-13223 (by ForAllSecure)
|
37
|
-
// 1.16 - 2019-03-04 - fix warnings
|
38
|
-
// 1.15 - 2019-02-07 - explicit failure if Ogg Skeleton data is found
|
39
36
|
// 1.14 - 2018-02-11 - delete bogus dealloca usage
|
40
37
|
// 1.13 - 2018-01-29 - fix truncation of last frame (hopefully)
|
41
38
|
// 1.12 - 2017-11-21 - limit residue begin/end to blocksize/2 to avoid large temp allocs in bad/corrupt files
|
@@ -256,7 +253,7 @@ extern stb_vorbis * stb_vorbis_open_file(FILE *f, int close_handle_on_close,
|
|
256
253
|
// create an ogg vorbis decoder from an open FILE *, looking for a stream at
|
257
254
|
// the _current_ seek point (ftell). on failure, returns NULL and sets *error.
|
258
255
|
// note that stb_vorbis must "own" this stream; if you seek it in between
|
259
|
-
// calls to stb_vorbis, it will become confused.
|
256
|
+
// calls to stb_vorbis, it will become confused. Morever, if you attempt to
|
260
257
|
// perform stb_vorbis_seek_*() operations on this file, it will assume it
|
261
258
|
// owns the _entire_ rest of the file after the start point. Use the next
|
262
259
|
// function, stb_vorbis_open_file_section(), to limit it.
|
@@ -270,6 +267,11 @@ extern stb_vorbis * stb_vorbis_open_file_section(FILE *f, int close_handle_on_cl
|
|
270
267
|
// confused.
|
271
268
|
#endif
|
272
269
|
|
270
|
+
#ifdef __SDL_SOUND_INTERNAL__
|
271
|
+
extern stb_vorbis * stb_vorbis_open_rwops_section(SDL_RWops *rwops, int close_on_free, int *error, const stb_vorbis_alloc *alloc, unsigned int length);
|
272
|
+
extern stb_vorbis * stb_vorbis_open_rwops(SDL_RWops *rwops, int close_on_free, int *error, const stb_vorbis_alloc *alloc);
|
273
|
+
#endif
|
274
|
+
|
273
275
|
extern int stb_vorbis_seek_frame(stb_vorbis *f, unsigned int sample_number);
|
274
276
|
extern int stb_vorbis_seek(stb_vorbis *f, unsigned int sample_number);
|
275
277
|
// these functions seek in the Vorbis file to (approximately) 'sample_number'.
|
@@ -377,8 +379,7 @@ enum STBVorbisError
|
|
377
379
|
VORBIS_invalid_first_page,
|
378
380
|
VORBIS_bad_packet_type,
|
379
381
|
VORBIS_cant_find_last_page,
|
380
|
-
VORBIS_seek_failed
|
381
|
-
VORBIS_ogg_skeleton_not_supported
|
382
|
+
VORBIS_seek_failed
|
382
383
|
};
|
383
384
|
|
384
385
|
|
@@ -567,31 +568,34 @@ enum STBVorbisError
|
|
567
568
|
#include <alloca.h>
|
568
569
|
#endif
|
569
570
|
#else // STB_VORBIS_NO_CRT
|
571
|
+
#ifndef NULL
|
570
572
|
#define NULL 0
|
573
|
+
#endif
|
574
|
+
#ifndef malloc
|
571
575
|
#define malloc(s) 0
|
576
|
+
#endif
|
577
|
+
#ifndef free
|
572
578
|
#define free(s) ((void) 0)
|
579
|
+
#endif
|
580
|
+
#ifndef realloc
|
573
581
|
#define realloc(s) 0
|
582
|
+
#endif
|
574
583
|
#endif // STB_VORBIS_NO_CRT
|
575
584
|
|
576
585
|
#include <limits.h>
|
577
586
|
|
578
587
|
#ifdef __MINGW32__
|
579
|
-
// eff you mingw:
|
580
|
-
// "fixed":
|
581
|
-
// http://sourceforge.net/p/mingw-w64/mailman/message/32882927/
|
582
|
-
// "no that broke the build, reverted, who cares about C":
|
583
|
-
// http://sourceforge.net/p/mingw-w64/mailman/message/32890381/
|
584
|
-
#ifdef __forceinline
|
585
|
-
#undef __forceinline
|
586
|
-
#endif
|
587
|
-
#define __forceinline
|
588
588
|
#define alloca __builtin_alloca
|
589
|
-
#
|
590
|
-
|
591
|
-
|
592
|
-
|
593
|
-
|
594
|
-
|
589
|
+
#endif
|
590
|
+
|
591
|
+
#ifndef STB_FORCEINLINE
|
592
|
+
#if defined(_MSC_VER)
|
593
|
+
#define STB_FORCEINLINE __forceinline
|
594
|
+
#elif defined(__GNUC__) || defined(__clang__)
|
595
|
+
#define STB_FORCEINLINE __attribute__((always_inline))
|
596
|
+
#else
|
597
|
+
#define STB_FORCEINLINE
|
598
|
+
#endif
|
595
599
|
#endif
|
596
600
|
|
597
601
|
#if STB_VORBIS_MAX_CHANNELS > 256
|
@@ -613,13 +617,21 @@ enum STBVorbisError
|
|
613
617
|
#define MAX_BLOCKSIZE_LOG 13 // from specification
|
614
618
|
#define MAX_BLOCKSIZE (1 << MAX_BLOCKSIZE_LOG)
|
615
619
|
|
616
|
-
|
620
|
+
#ifdef __SDL_SOUND_INTERNAL__
|
621
|
+
typedef Uint8 uint8;
|
622
|
+
typedef Sint8 int8;
|
623
|
+
typedef Uint16 uint16;
|
624
|
+
typedef Sint16 int16;
|
625
|
+
typedef Uint32 uint32;
|
626
|
+
typedef Sint32 int32;
|
627
|
+
#else
|
617
628
|
typedef unsigned char uint8;
|
618
629
|
typedef signed char int8;
|
619
630
|
typedef unsigned short uint16;
|
620
631
|
typedef signed short int16;
|
621
632
|
typedef unsigned int uint32;
|
622
633
|
typedef signed int int32;
|
634
|
+
#endif
|
623
635
|
|
624
636
|
#ifndef TRUE
|
625
637
|
#define TRUE 1
|
@@ -766,6 +778,12 @@ struct stb_vorbis
|
|
766
778
|
int close_on_free;
|
767
779
|
#endif
|
768
780
|
|
781
|
+
#ifdef __SDL_SOUND_INTERNAL__
|
782
|
+
SDL_RWops *rwops;
|
783
|
+
uint32 rwops_start;
|
784
|
+
int close_on_free;
|
785
|
+
#endif
|
786
|
+
|
769
787
|
uint8 *stream;
|
770
788
|
uint8 *stream_start;
|
771
789
|
uint8 *stream_end;
|
@@ -960,7 +978,7 @@ static void crc32_init(void)
|
|
960
978
|
}
|
961
979
|
}
|
962
980
|
|
963
|
-
|
981
|
+
STB_FORCEINLINE uint32 crc32_update(uint32 crc, uint8 byte)
|
964
982
|
{
|
965
983
|
return (crc << 8) ^ crc_table[byte ^ (crc >> 24)];
|
966
984
|
}
|
@@ -1077,7 +1095,7 @@ static int compute_codewords(Codebook *c, uint8 *len, int n, uint32 *values)
|
|
1077
1095
|
assert(z >= 0 && z < 32);
|
1078
1096
|
available[z] = 0;
|
1079
1097
|
add_entry(c, bit_reverse(res), i, m++, len[i], values);
|
1080
|
-
//
|
1098
|
+
// propogate availability up the tree
|
1081
1099
|
if (z != len[i]) {
|
1082
1100
|
assert(len[i] >= 0 && len[i] < 32);
|
1083
1101
|
for (y=len[i]; y > z; --y) {
|
@@ -1113,11 +1131,13 @@ static void compute_accelerated_huffman(Codebook *c)
|
|
1113
1131
|
}
|
1114
1132
|
}
|
1115
1133
|
|
1134
|
+
#ifndef STBV_CDECL
|
1116
1135
|
#ifdef _MSC_VER
|
1117
1136
|
#define STBV_CDECL __cdecl
|
1118
1137
|
#else
|
1119
1138
|
#define STBV_CDECL
|
1120
1139
|
#endif
|
1140
|
+
#endif
|
1121
1141
|
|
1122
1142
|
static int STBV_CDECL uint32_compare(const void *p, const void *q)
|
1123
1143
|
{
|
@@ -1203,10 +1223,8 @@ static int lookup1_values(int entries, int dim)
|
|
1203
1223
|
int r = (int) floor(exp((float) log((float) entries) / dim));
|
1204
1224
|
if ((int) floor(pow((float) r+1, dim)) <= entries) // (int) cast for MinGW warning;
|
1205
1225
|
++r; // floor() to avoid _ftol() when non-CRT
|
1206
|
-
|
1207
|
-
|
1208
|
-
if ((int) floor(pow((float) r, dim)) > entries)
|
1209
|
-
return -1;
|
1226
|
+
assert(pow((float) r+1, dim) > entries);
|
1227
|
+
assert((int) floor(pow((float) r, dim)) <= entries); // (int),floor() as above
|
1210
1228
|
return r;
|
1211
1229
|
}
|
1212
1230
|
|
@@ -1288,7 +1306,9 @@ static int STBV_CDECL point_compare(const void *p, const void *q)
|
|
1288
1306
|
/////////////////////// END LEAF SETUP FUNCTIONS //////////////////////////
|
1289
1307
|
|
1290
1308
|
|
1291
|
-
#
|
1309
|
+
#ifdef __SDL_SOUND_INTERNAL__
|
1310
|
+
#define USE_MEMORY(z) FALSE
|
1311
|
+
#elif defined(STB_VORBIS_NO_STDIO)
|
1292
1312
|
#define USE_MEMORY(z) TRUE
|
1293
1313
|
#else
|
1294
1314
|
#define USE_MEMORY(z) ((z)->stream)
|
@@ -1301,6 +1321,14 @@ static uint8 get8(vorb *z)
|
|
1301
1321
|
return *z->stream++;
|
1302
1322
|
}
|
1303
1323
|
|
1324
|
+
#ifdef __SDL_SOUND_INTERNAL__
|
1325
|
+
{
|
1326
|
+
uint8 c;
|
1327
|
+
if (SDL_RWread(z->rwops, &c, 1, 1) != 1) { z->eof = TRUE; return 0; }
|
1328
|
+
return c;
|
1329
|
+
}
|
1330
|
+
#endif
|
1331
|
+
|
1304
1332
|
#ifndef STB_VORBIS_NO_STDIO
|
1305
1333
|
{
|
1306
1334
|
int c = fgetc(z->f);
|
@@ -1329,6 +1357,14 @@ static int getn(vorb *z, uint8 *data, int n)
|
|
1329
1357
|
return 1;
|
1330
1358
|
}
|
1331
1359
|
|
1360
|
+
#ifdef __SDL_SOUND_INTERNAL__
|
1361
|
+
{
|
1362
|
+
if (SDL_RWread(z->rwops, data, n, 1) == 1) { return 1; }
|
1363
|
+
z->eof = 1;
|
1364
|
+
return 0;
|
1365
|
+
}
|
1366
|
+
#endif
|
1367
|
+
|
1332
1368
|
#ifndef STB_VORBIS_NO_STDIO
|
1333
1369
|
if (fread(data, n, 1, z->f) == 1)
|
1334
1370
|
return 1;
|
@@ -1346,6 +1382,12 @@ static void skip(vorb *z, int n)
|
|
1346
1382
|
if (z->stream >= z->stream_end) z->eof = 1;
|
1347
1383
|
return;
|
1348
1384
|
}
|
1385
|
+
#ifdef __SDL_SOUND_INTERNAL__
|
1386
|
+
{
|
1387
|
+
SDL_RWseek(z->rwops, n, RW_SEEK_CUR);
|
1388
|
+
}
|
1389
|
+
#endif
|
1390
|
+
|
1349
1391
|
#ifndef STB_VORBIS_NO_STDIO
|
1350
1392
|
{
|
1351
1393
|
long x = ftell(z->f);
|
@@ -1370,6 +1412,23 @@ static int set_file_offset(stb_vorbis *f, unsigned int loc)
|
|
1370
1412
|
return 1;
|
1371
1413
|
}
|
1372
1414
|
}
|
1415
|
+
|
1416
|
+
#ifdef __SDL_SOUND_INTERNAL__
|
1417
|
+
{
|
1418
|
+
if (loc + f->rwops_start < loc || loc >= 0x80000000) {
|
1419
|
+
loc = 0x7fffffff;
|
1420
|
+
f->eof = 1;
|
1421
|
+
} else {
|
1422
|
+
loc += f->rwops_start;
|
1423
|
+
}
|
1424
|
+
if (SDL_RWseek(f->rwops, loc, RW_SEEK_SET) != -1)
|
1425
|
+
return 1;
|
1426
|
+
f->eof = 1;
|
1427
|
+
SDL_RWseek(f->rwops, f->rwops_start, RW_SEEK_END);
|
1428
|
+
return 0;
|
1429
|
+
}
|
1430
|
+
#endif
|
1431
|
+
|
1373
1432
|
#ifndef STB_VORBIS_NO_STDIO
|
1374
1433
|
if (loc + f->f_start < loc || loc >= 0x80000000) {
|
1375
1434
|
loc = 0x7fffffff;
|
@@ -1580,7 +1639,7 @@ static uint32 get_bits(vorb *f, int n)
|
|
1580
1639
|
// expand the buffer to as many bits as possible without reading off end of packet
|
1581
1640
|
// it might be nice to allow f->valid_bits and f->acc to be stored in registers,
|
1582
1641
|
// e.g. cache them locally and decode locally
|
1583
|
-
|
1642
|
+
STB_FORCEINLINE void prep_huffman(vorb *f)
|
1584
1643
|
{
|
1585
1644
|
if (f->valid_bits <= 24) {
|
1586
1645
|
if (f->valid_bits == 0) f->acc = 0;
|
@@ -1980,7 +2039,7 @@ static float inverse_db_table[256] =
|
|
1980
2039
|
int8 integer_divide_table[DIVTAB_NUMER][DIVTAB_DENOM]; // 2KB
|
1981
2040
|
#endif
|
1982
2041
|
|
1983
|
-
|
2042
|
+
STB_FORCEINLINE void draw_line(float *output, int x0, int y0, int x1, int y1, int n)
|
1984
2043
|
{
|
1985
2044
|
int dy = y1 - y0;
|
1986
2045
|
int adx = x1 - x0;
|
@@ -2016,7 +2075,7 @@ static __forceinline void draw_line(float *output, int x0, int y0, int x1, int y
|
|
2016
2075
|
ady -= abs(base) * adx;
|
2017
2076
|
if (x1 > n) x1 = n;
|
2018
2077
|
if (x < x1) {
|
2019
|
-
LINE_OP(output[x], inverse_db_table[y
|
2078
|
+
LINE_OP(output[x], inverse_db_table[y]);
|
2020
2079
|
for (++x; x < x1; ++x) {
|
2021
2080
|
err += ady;
|
2022
2081
|
if (err >= adx) {
|
@@ -2024,7 +2083,7 @@ static __forceinline void draw_line(float *output, int x0, int y0, int x1, int y
|
|
2024
2083
|
y += sy;
|
2025
2084
|
} else
|
2026
2085
|
y += base;
|
2027
|
-
LINE_OP(output[x], inverse_db_table[y
|
2086
|
+
LINE_OP(output[x], inverse_db_table[y]);
|
2028
2087
|
}
|
2029
2088
|
}
|
2030
2089
|
}
|
@@ -2392,7 +2451,7 @@ void inverse_mdct(float *buffer, int n, vorb *f, int blocktype)
|
|
2392
2451
|
|
2393
2452
|
|
2394
2453
|
// the following were split out into separate functions while optimizing;
|
2395
|
-
// they could be pushed back up but eh.
|
2454
|
+
// they could be pushed back up but eh. STB_FORCEINLINE showed no change;
|
2396
2455
|
// they're probably already being inlined.
|
2397
2456
|
static void imdct_step3_iter0_loop(int n, float *e, int i_off, int k_off, float *A)
|
2398
2457
|
{
|
@@ -2540,7 +2599,7 @@ static void imdct_step3_inner_s_loop(int n, float *e, int i_off, int k_off, floa
|
|
2540
2599
|
}
|
2541
2600
|
}
|
2542
2601
|
|
2543
|
-
|
2602
|
+
STB_FORCEINLINE void iter_54(float *z)
|
2544
2603
|
{
|
2545
2604
|
float k00,k11,k22,k33;
|
2546
2605
|
float y0,y1,y2,y3;
|
@@ -2643,7 +2702,7 @@ static void inverse_mdct(float *buffer, int n, vorb *f, int blocktype)
|
|
2643
2702
|
// once I combined the passes.
|
2644
2703
|
|
2645
2704
|
// so there's a missing 'times 2' here (for adding X to itself).
|
2646
|
-
// this
|
2705
|
+
// this propogates through linearly to the end, where the numbers
|
2647
2706
|
// are 1/2 too small, and need to be compensated for.
|
2648
2707
|
|
2649
2708
|
{
|
@@ -3051,6 +3110,7 @@ static float *get_window(vorb *f, int len)
|
|
3051
3110
|
len <<= 1;
|
3052
3111
|
if (len == f->blocksize_0) return f->window[0];
|
3053
3112
|
if (len == f->blocksize_1) return f->window[1];
|
3113
|
+
assert(0);
|
3054
3114
|
return NULL;
|
3055
3115
|
}
|
3056
3116
|
|
@@ -3456,7 +3516,6 @@ static int vorbis_finish_frame(stb_vorbis *f, int len, int left, int right)
|
|
3456
3516
|
if (f->previous_length) {
|
3457
3517
|
int i,j, n = f->previous_length;
|
3458
3518
|
float *w = get_window(f, n);
|
3459
|
-
if (w == NULL) return 0;
|
3460
3519
|
for (i=0; i < f->channels; ++i) {
|
3461
3520
|
for (j=0; j < n; ++j)
|
3462
3521
|
f->channel_buffers[i][left+j] =
|
@@ -3584,22 +3643,7 @@ static int start_decoder(vorb *f)
|
|
3584
3643
|
if (f->page_flag & PAGEFLAG_continued_packet) return error(f, VORBIS_invalid_first_page);
|
3585
3644
|
// check for expected packet length
|
3586
3645
|
if (f->segment_count != 1) return error(f, VORBIS_invalid_first_page);
|
3587
|
-
if (f->segments[0] != 30)
|
3588
|
-
// check for the Ogg skeleton fishead identifying header to refine our error
|
3589
|
-
if (f->segments[0] == 64 &&
|
3590
|
-
getn(f, header, 6) &&
|
3591
|
-
header[0] == 'f' &&
|
3592
|
-
header[1] == 'i' &&
|
3593
|
-
header[2] == 's' &&
|
3594
|
-
header[3] == 'h' &&
|
3595
|
-
header[4] == 'e' &&
|
3596
|
-
header[5] == 'a' &&
|
3597
|
-
get8(f) == 'd' &&
|
3598
|
-
get8(f) == '\0') return error(f, VORBIS_ogg_skeleton_not_supported);
|
3599
|
-
else
|
3600
|
-
return error(f, VORBIS_invalid_first_page);
|
3601
|
-
}
|
3602
|
-
|
3646
|
+
if (f->segments[0] != 30) return error(f, VORBIS_invalid_first_page);
|
3603
3647
|
// read packet
|
3604
3648
|
// check packet header
|
3605
3649
|
if (get8(f) != VORBIS_packet_id) return error(f, VORBIS_invalid_first_page);
|
@@ -3698,7 +3742,6 @@ static int start_decoder(vorb *f)
|
|
3698
3742
|
while (current_entry < c->entries) {
|
3699
3743
|
int limit = c->entries - current_entry;
|
3700
3744
|
int n = get_bits(f, ilog(limit));
|
3701
|
-
if (current_length >= 32) return error(f, VORBIS_invalid_setup);
|
3702
3745
|
if (current_entry + n > (int) c->entries) { return error(f, VORBIS_invalid_setup); }
|
3703
3746
|
memset(lengths + current_entry, current_length, n);
|
3704
3747
|
current_entry += n;
|
@@ -3802,9 +3845,7 @@ static int start_decoder(vorb *f)
|
|
3802
3845
|
c->value_bits = get_bits(f, 4)+1;
|
3803
3846
|
c->sequence_p = get_bits(f,1);
|
3804
3847
|
if (c->lookup_type == 1) {
|
3805
|
-
|
3806
|
-
if (values < 0) return error(f, VORBIS_invalid_setup);
|
3807
|
-
c->lookup_values = (uint32) values;
|
3848
|
+
c->lookup_values = lookup1_values(c->entries, c->dimensions);
|
3808
3849
|
} else {
|
3809
3850
|
c->lookup_values = c->entries * c->dimensions;
|
3810
3851
|
}
|
@@ -3940,9 +3981,6 @@ static int start_decoder(vorb *f)
|
|
3940
3981
|
p[j].id = j;
|
3941
3982
|
}
|
3942
3983
|
qsort(p, g->values, sizeof(p[0]), point_compare);
|
3943
|
-
for (j=0; j < g->values-1; ++j)
|
3944
|
-
if (p[j].x == p[j+1].x)
|
3945
|
-
return error(f, VORBIS_invalid_setup);
|
3946
3984
|
for (j=0; j < g->values; ++j)
|
3947
3985
|
g->sorted_order[j] = (uint8) p[j].id;
|
3948
3986
|
// precompute the neighbors
|
@@ -4029,7 +4067,6 @@ static int start_decoder(vorb *f)
|
|
4029
4067
|
max_submaps = m->submaps;
|
4030
4068
|
if (get_bits(f,1)) {
|
4031
4069
|
m->coupling_steps = get_bits(f,8)+1;
|
4032
|
-
if (m->coupling_steps > f->channels) return error(f, VORBIS_invalid_setup);
|
4033
4070
|
for (k=0; k < m->coupling_steps; ++k) {
|
4034
4071
|
m->chan[k].magnitude = get_bits(f, ilog(f->channels-1));
|
4035
4072
|
m->chan[k].angle = get_bits(f, ilog(f->channels-1));
|
@@ -4197,6 +4234,9 @@ static void vorbis_deinit(stb_vorbis *p)
|
|
4197
4234
|
setup_free(p, p->window[i]);
|
4198
4235
|
setup_free(p, p->bit_reverse[i]);
|
4199
4236
|
}
|
4237
|
+
#ifdef __SDL_SOUND_INTERNAL__
|
4238
|
+
if (p->close_on_free) SDL_RWclose(p->rwops);
|
4239
|
+
#endif
|
4200
4240
|
#ifndef STB_VORBIS_NO_STDIO
|
4201
4241
|
if (p->close_on_free) fclose(p->f);
|
4202
4242
|
#endif
|
@@ -4222,6 +4262,10 @@ static void vorbis_init(stb_vorbis *p, const stb_vorbis_alloc *z)
|
|
4222
4262
|
p->stream = NULL;
|
4223
4263
|
p->codebooks = NULL;
|
4224
4264
|
p->page_crc_tests = -1;
|
4265
|
+
#ifdef __SDL_SOUND_INTERNAL__
|
4266
|
+
p->close_on_free = FALSE;
|
4267
|
+
p->rwops = NULL;
|
4268
|
+
#endif
|
4225
4269
|
#ifndef STB_VORBIS_NO_STDIO
|
4226
4270
|
p->close_on_free = FALSE;
|
4227
4271
|
p->f = NULL;
|
@@ -4472,6 +4516,9 @@ unsigned int stb_vorbis_get_file_offset(stb_vorbis *f)
|
|
4472
4516
|
if (f->push_mode) return 0;
|
4473
4517
|
#endif
|
4474
4518
|
if (USE_MEMORY(f)) return (unsigned int) (f->stream - f->stream_start);
|
4519
|
+
#ifdef __SDL_SOUND_INTERNAL__
|
4520
|
+
return (unsigned int) (SDL_RWtell(f->rwops) - f->rwops_start);
|
4521
|
+
#endif
|
4475
4522
|
#ifndef STB_VORBIS_NO_STDIO
|
4476
4523
|
return (unsigned int) (ftell(f->f) - f->f_start);
|
4477
4524
|
#endif
|
@@ -4594,7 +4641,7 @@ static int get_seek_page_info(stb_vorbis *f, ProbedPage *z)
|
|
4594
4641
|
return 1;
|
4595
4642
|
}
|
4596
4643
|
|
4597
|
-
// rarely used function to seek back to the
|
4644
|
+
// rarely used function to seek back to the preceeding page while finding the
|
4598
4645
|
// start of a packet
|
4599
4646
|
static int go_to_page_before(stb_vorbis *f, unsigned int limit_offset)
|
4600
4647
|
{
|
@@ -5001,13 +5048,7 @@ stb_vorbis * stb_vorbis_open_file(FILE *file, int close_on_free, int *error, con
|
|
5001
5048
|
|
5002
5049
|
stb_vorbis * stb_vorbis_open_filename(const char *filename, int *error, const stb_vorbis_alloc *alloc)
|
5003
5050
|
{
|
5004
|
-
FILE *f;
|
5005
|
-
#if defined(_WIN32) && defined(__STDC_WANT_SECURE_LIB__)
|
5006
|
-
if (0 != fopen_s(&f, filename, "rb"))
|
5007
|
-
f = NULL;
|
5008
|
-
#else
|
5009
|
-
f = fopen(filename, "rb");
|
5010
|
-
#endif
|
5051
|
+
FILE *f = fopen(filename, "rb");
|
5011
5052
|
if (f)
|
5012
5053
|
return stb_vorbis_open_file(f, TRUE, error, alloc);
|
5013
5054
|
if (error) *error = VORBIS_file_open_failure;
|
@@ -5015,6 +5056,36 @@ stb_vorbis * stb_vorbis_open_filename(const char *filename, int *error, const st
|
|
5015
5056
|
}
|
5016
5057
|
#endif // STB_VORBIS_NO_STDIO
|
5017
5058
|
|
5059
|
+
#ifdef __SDL_SOUND_INTERNAL__
|
5060
|
+
stb_vorbis * stb_vorbis_open_rwops_section(SDL_RWops *rwops, int close_on_free, int *error, const stb_vorbis_alloc *alloc, unsigned int length)
|
5061
|
+
{
|
5062
|
+
stb_vorbis *f, p;
|
5063
|
+
vorbis_init(&p, alloc);
|
5064
|
+
p.rwops = rwops;
|
5065
|
+
p.rwops_start = (uint32) SDL_RWtell(rwops);
|
5066
|
+
p.stream_len = length;
|
5067
|
+
p.close_on_free = close_on_free;
|
5068
|
+
if (start_decoder(&p)) {
|
5069
|
+
f = vorbis_alloc(&p);
|
5070
|
+
if (f) {
|
5071
|
+
memcpy(f, &p, sizeof (stb_vorbis));
|
5072
|
+
vorbis_pump_first_frame(f);
|
5073
|
+
return f;
|
5074
|
+
}
|
5075
|
+
}
|
5076
|
+
if (error) *error = p.error;
|
5077
|
+
vorbis_deinit(&p);
|
5078
|
+
return NULL;
|
5079
|
+
}
|
5080
|
+
|
5081
|
+
stb_vorbis * stb_vorbis_open_rwops(SDL_RWops *rwops, int close_on_free, int *error, const stb_vorbis_alloc *alloc)
|
5082
|
+
{
|
5083
|
+
const unsigned int start = (unsigned int) SDL_RWtell(rwops);
|
5084
|
+
const unsigned int len = (unsigned int) (SDL_RWsize(rwops) - start);
|
5085
|
+
return stb_vorbis_open_rwops_section(rwops, close_on_free, error, alloc, len);
|
5086
|
+
}
|
5087
|
+
#endif
|
5088
|
+
|
5018
5089
|
stb_vorbis * stb_vorbis_open_memory(const unsigned char *data, int len, int *error, const stb_vorbis_alloc *alloc)
|
5019
5090
|
{
|
5020
5091
|
stb_vorbis *f, p;
|
@@ -5028,7 +5099,7 @@ stb_vorbis * stb_vorbis_open_memory(const unsigned char *data, int len, int *err
|
|
5028
5099
|
if (start_decoder(&p)) {
|
5029
5100
|
f = vorbis_alloc(&p);
|
5030
5101
|
if (f) {
|
5031
|
-
|
5102
|
+
memcpy(f, &p, sizeof (stb_vorbis));
|
5032
5103
|
vorbis_pump_first_frame(f);
|
5033
5104
|
if (error) *error = VORBIS__no_error;
|
5034
5105
|
return f;
|
@@ -5396,12 +5467,6 @@ int stb_vorbis_get_samples_float(stb_vorbis *f, int channels, float **buffer, in
|
|
5396
5467
|
#endif // STB_VORBIS_NO_PULLDATA_API
|
5397
5468
|
|
5398
5469
|
/* Version history
|
5399
|
-
1.17 - 2019-07-08 - fix CVE-2019-13217, -13218, -13219, -13220, -13221, -13222, -13223
|
5400
|
-
found with Mayhem by ForAllSecure
|
5401
|
-
1.16 - 2019-03-04 - fix warnings
|
5402
|
-
1.15 - 2019-02-07 - explicit failure if Ogg Skeleton data is found
|
5403
|
-
1.14 - 2018-02-11 - delete bogus dealloca usage
|
5404
|
-
1.13 - 2018-01-29 - fix truncation of last frame (hopefully)
|
5405
5470
|
1.12 - 2017-11-21 - limit residue begin/end to blocksize/2 to avoid large temp allocs in bad/corrupt files
|
5406
5471
|
1.11 - 2017-07-23 - fix MinGW compilation
|
5407
5472
|
1.10 - 2017-03-03 - more robust seeking; fix negative ilog(); clear error in open_memory
|