gosu 1.4.6 → 2.0.0.pre6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/COPYING +2 -1
- data/dependencies/SDL/include/SDL_atomic.h +2 -3
- data/dependencies/SDL/include/SDL_audio.h +7 -7
- data/dependencies/SDL/include/SDL_blendmode.h +1 -1
- data/dependencies/SDL/include/SDL_endian.h +3 -3
- data/dependencies/SDL/include/SDL_gamecontroller.h +4 -4
- data/dependencies/SDL/include/SDL_hints.h +72 -28
- data/dependencies/SDL/include/SDL_joystick.h +8 -5
- data/dependencies/SDL/include/SDL_keycode.h +1 -1
- data/dependencies/SDL/include/SDL_main.h +7 -0
- data/dependencies/SDL/include/SDL_mouse.h +6 -7
- data/dependencies/SDL/include/SDL_mutex.h +79 -5
- data/dependencies/SDL/include/SDL_opengl_glext.h +5 -1
- data/dependencies/SDL/include/SDL_power.h +7 -8
- data/dependencies/SDL/include/SDL_render.h +5 -0
- data/dependencies/SDL/include/SDL_revision.h +2 -2
- data/dependencies/SDL/include/SDL_sensor.h +1 -1
- data/dependencies/SDL/include/SDL_stdinc.h +19 -11
- data/dependencies/SDL/include/SDL_thread.h +2 -2
- data/dependencies/SDL/include/SDL_version.h +2 -2
- data/dependencies/SDL/include/SDL_video.h +30 -2
- data/dependencies/SDL/include/begin_code.h +7 -7
- data/dependencies/SDL/include/close_code.h +2 -2
- 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.h +1 -1
- data/dependencies/SDL_sound/dr_flac.h +48 -23
- data/dependencies/SDL_sound/dr_mp3.h +34 -14
- data/dependencies/SDL_sound/stb_vorbis.h +3 -2
- data/dependencies/mojoAL/mojoal.c +1 -1
- data/ext/{gosu → gosu-ffi}/extconf.rb +34 -33
- data/ext/gosu-ffi/gosu-ffi.def +464 -0
- data/ffi/Gosu.cpp +307 -0
- data/ffi/Gosu.h +84 -0
- data/ffi/Gosu_Channel.cpp +62 -0
- data/ffi/Gosu_Channel.h +17 -0
- data/ffi/Gosu_Color.cpp +132 -0
- data/ffi/Gosu_Color.h +31 -0
- data/ffi/Gosu_Constants.cpp +334 -0
- data/ffi/Gosu_FFI.h +34 -0
- data/ffi/Gosu_FFI_internal.h +161 -0
- data/ffi/Gosu_Font.cpp +92 -0
- data/ffi/Gosu_Font.h +32 -0
- data/ffi/Gosu_Image.cpp +206 -0
- data/ffi/Gosu_Image.h +60 -0
- data/ffi/Gosu_Sample.cpp +29 -0
- data/ffi/Gosu_Sample.h +14 -0
- data/ffi/Gosu_Song.cpp +69 -0
- data/ffi/Gosu_Song.h +18 -0
- data/ffi/Gosu_TextInput.cpp +94 -0
- data/ffi/Gosu_TextInput.h +25 -0
- data/ffi/Gosu_Window.cpp +314 -0
- data/ffi/Gosu_Window.h +78 -0
- data/include/Gosu/Audio.hpp +6 -11
- data/include/Gosu/Bitmap.hpp +38 -53
- data/include/Gosu/Buffer.hpp +54 -0
- data/include/Gosu/Color.hpp +27 -35
- data/include/Gosu/Directories.hpp +25 -28
- data/include/Gosu/Drawable.hpp +58 -0
- data/include/Gosu/Font.hpp +6 -5
- data/include/Gosu/Fwd.hpp +4 -6
- data/include/Gosu/Gosu.hpp +5 -5
- data/include/Gosu/Graphics.hpp +51 -61
- data/include/Gosu/GraphicsBase.hpp +1 -11
- data/include/Gosu/Image.hpp +11 -14
- data/include/Gosu/Math.hpp +50 -72
- data/include/Gosu/Transform.hpp +32 -0
- data/include/Gosu/Utility.hpp +51 -1
- data/include/Gosu/Version.hpp +3 -3
- data/include/Gosu/Window.hpp +15 -9
- data/lib/SDL2.dll +0 -0
- data/lib/gosu/channel.rb +49 -0
- data/lib/gosu/color.rb +150 -0
- data/lib/gosu/compat.rb +29 -8
- data/lib/gosu/constants.rb +386 -0
- data/lib/gosu/ffi.rb +258 -0
- data/lib/gosu/font.rb +56 -0
- data/lib/gosu/gl_tex_info.rb +33 -0
- data/lib/gosu/gosu.rb +210 -0
- data/lib/gosu/image.rb +141 -0
- data/lib/gosu/numeric.rb +17 -0
- data/lib/gosu/preview.rb +6 -6
- data/lib/gosu/sample.rb +24 -0
- data/lib/gosu/song.rb +56 -0
- data/lib/gosu/text_input.rb +69 -0
- data/lib/gosu/window.rb +228 -0
- data/lib/gosu.rb +29 -8
- data/lib64/SDL2.dll +0 -0
- data/rdoc/gosu.rb +0 -2
- data/src/Audio.cpp +12 -12
- data/src/AudioFile.hpp +5 -4
- data/src/AudioFileAudioToolbox.cpp +8 -8
- data/src/AudioFileSDLSound.cpp +7 -10
- data/src/BinPacker.cpp +187 -0
- data/src/BinPacker.hpp +55 -0
- data/src/Bitmap.cpp +166 -144
- data/src/BitmapIO.cpp +60 -86
- data/src/Buffer.cpp +159 -0
- data/src/Color.cpp +75 -80
- data/src/Directories.cpp +47 -0
- data/src/DirectoriesUIKit.cpp +50 -0
- data/src/DrawOp.hpp +9 -4
- data/src/DrawOpQueue.hpp +2 -2
- data/src/Drawable.cpp +95 -0
- data/src/EmptyDrawable.hpp +38 -0
- data/src/FPS.cpp +31 -0
- data/src/Font.cpp +104 -74
- data/src/GosuGLView.cpp +14 -6
- data/src/GosuViewController.cpp +2 -10
- data/src/Graphics.cpp +60 -126
- data/src/GraphicsImpl.hpp +17 -47
- data/src/Image.cpp +41 -35
- data/src/Input.cpp +7 -8
- data/src/Macro.cpp +6 -6
- data/src/Macro.hpp +4 -4
- data/src/MarkupParser.cpp +5 -5
- data/src/Math.cpp +35 -22
- data/src/OffScreenTarget.cpp +53 -49
- data/src/OffScreenTarget.hpp +13 -11
- data/src/OpenGLContext.cpp +117 -0
- data/src/OpenGLContext.hpp +41 -0
- data/src/RenderState.hpp +21 -19
- data/src/Resolution.cpp +23 -21
- data/src/TexChunk.cpp +35 -80
- data/src/TexChunk.hpp +44 -35
- data/src/Text.cpp +1 -1
- data/src/TextBuilder.cpp +35 -21
- data/src/TextBuilder.hpp +6 -9
- data/src/Texture.cpp +62 -80
- data/src/Texture.hpp +25 -23
- data/src/TiledDrawable.cpp +150 -0
- data/src/TiledDrawable.hpp +47 -0
- data/src/TimingApple.cpp +1 -1
- data/src/Transform.cpp +45 -50
- data/src/TransformStack.hpp +16 -16
- data/src/TrueTypeFont.cpp +59 -51
- data/src/TrueTypeFont.hpp +6 -7
- data/src/TrueTypeFontApple.cpp +28 -19
- data/src/TrueTypeFontUnix.cpp +27 -23
- data/src/TrueTypeFontWin.cpp +30 -30
- data/src/Utility.cpp +84 -21
- data/src/UtilityWin.cpp +45 -0
- data/src/Window.cpp +92 -142
- data/src/WindowUIKit.cpp +14 -14
- metadata +72 -31
- data/include/Gosu/IO.hpp +0 -254
- data/include/Gosu/ImageData.hpp +0 -53
- data/include/Gosu/Inspection.hpp +0 -7
- data/lib/gosu/patches.rb +0 -66
- data/lib/gosu/run.rb +0 -20
- data/lib/gosu/swig_patches.rb +0 -110
- data/src/BlockAllocator.cpp +0 -131
- data/src/BlockAllocator.hpp +0 -32
- data/src/DirectoriesApple.cpp +0 -69
- data/src/DirectoriesUnix.cpp +0 -46
- data/src/DirectoriesWin.cpp +0 -65
- data/src/EmptyImageData.hpp +0 -52
- data/src/FileUnix.cpp +0 -99
- data/src/FileWin.cpp +0 -88
- data/src/IO.cpp +0 -60
- data/src/Iconv.hpp +0 -51
- data/src/Inspection.cpp +0 -27
- data/src/LargeImageData.cpp +0 -215
- data/src/LargeImageData.hpp +0 -39
- data/src/Log.hpp +0 -19
- data/src/RubyGosu.cxx +0 -13100
- data/src/RubyGosu.h +0 -49
- data/src/WinUtility.cpp +0 -61
- data/src/WinUtility.hpp +0 -27
@@ -1731,6 +1731,11 @@ extern DECLSPEC int SDLCALL SDL_RenderReadPixels(SDL_Renderer * renderer,
|
|
1731
1731
|
*
|
1732
1732
|
* \param renderer the rendering context
|
1733
1733
|
*
|
1734
|
+
* \threadsafety You may only call this function on the main thread. If this
|
1735
|
+
* happens to work on a background thread on any given platform
|
1736
|
+
* or backend, it's purely by luck and you should not rely on it
|
1737
|
+
* to work next time.
|
1738
|
+
*
|
1734
1739
|
* \since This function is available since SDL 2.0.0.
|
1735
1740
|
*
|
1736
1741
|
* \sa SDL_RenderClear
|
@@ -1,7 +1,7 @@
|
|
1
1
|
/* Generated by updaterev.sh, do not edit */
|
2
2
|
#ifdef SDL_VENDOR_INFO
|
3
|
-
#define SDL_REVISION "SDL-release-2.
|
3
|
+
#define SDL_REVISION "SDL-release-2.28.2-0-g031912c4b (" SDL_VENDOR_INFO ")"
|
4
4
|
#else
|
5
|
-
#define SDL_REVISION "SDL-release-2.
|
5
|
+
#define SDL_REVISION "SDL-release-2.28.2-0-g031912c4b"
|
6
6
|
#endif
|
7
7
|
#define SDL_REVISION_NUMBER 0
|
@@ -84,7 +84,7 @@ typedef enum
|
|
84
84
|
* The accelerometer returns the current acceleration in SI meters per
|
85
85
|
* second squared. This measurement includes the force of gravity, so
|
86
86
|
* a device at rest will have an value of SDL_STANDARD_GRAVITY away
|
87
|
-
* from the center of the earth.
|
87
|
+
* from the center of the earth, which is a positive Y value.
|
88
88
|
*
|
89
89
|
* values[0]: Acceleration on the x axis
|
90
90
|
* values[1]: Acceleration on the y axis
|
@@ -30,12 +30,6 @@
|
|
30
30
|
|
31
31
|
#include "SDL_config.h"
|
32
32
|
|
33
|
-
#ifdef __APPLE__
|
34
|
-
#ifndef _DARWIN_C_SOURCE
|
35
|
-
#define _DARWIN_C_SOURCE 1 /* for memset_pattern4() */
|
36
|
-
#endif
|
37
|
-
#endif
|
38
|
-
|
39
33
|
#ifdef HAVE_SYS_TYPES_H
|
40
34
|
#include <sys/types.h>
|
41
35
|
#endif
|
@@ -85,7 +79,9 @@
|
|
85
79
|
Visual Studio. See http://msdn.microsoft.com/en-us/library/4hwaceh6.aspx
|
86
80
|
for more information.
|
87
81
|
*/
|
88
|
-
#
|
82
|
+
# ifndef _USE_MATH_DEFINES
|
83
|
+
# define _USE_MATH_DEFINES
|
84
|
+
# endif
|
89
85
|
# endif
|
90
86
|
# include <math.h>
|
91
87
|
#endif
|
@@ -528,9 +524,7 @@ extern DECLSPEC void *SDLCALL SDL_memset(SDL_OUT_BYTECAP(len) void *dst, int c,
|
|
528
524
|
/* Note that memset() is a byte assignment and this is a 32-bit assignment, so they're not directly equivalent. */
|
529
525
|
SDL_FORCE_INLINE void SDL_memset4(void *dst, Uint32 val, size_t dwords)
|
530
526
|
{
|
531
|
-
#
|
532
|
-
memset_pattern4(dst, &val, dwords * 4);
|
533
|
-
#elif defined(__GNUC__) && defined(__i386__)
|
527
|
+
#if defined(__GNUC__) && defined(__i386__)
|
534
528
|
int u0, u1, u2;
|
535
529
|
__asm__ __volatile__ (
|
536
530
|
"cld \n\t"
|
@@ -694,7 +688,7 @@ extern DECLSPEC size_t SDLCALL SDL_iconv(SDL_iconv_t cd, const char **inbuf,
|
|
694
688
|
size_t * outbytesleft);
|
695
689
|
|
696
690
|
/**
|
697
|
-
* This function converts a string between encodings in one pass, returning a
|
691
|
+
* This function converts a buffer or string between encodings in one pass, returning a
|
698
692
|
* string that must be freed with SDL_free() or NULL on error.
|
699
693
|
*
|
700
694
|
* \since This function is available since SDL 2.0.0.
|
@@ -722,6 +716,20 @@ size_t strlcpy(char* dst, const char* src, size_t size);
|
|
722
716
|
size_t strlcat(char* dst, const char* src, size_t size);
|
723
717
|
#endif
|
724
718
|
|
719
|
+
#ifndef HAVE_WCSLCPY
|
720
|
+
size_t wcslcpy(wchar_t *dst, const wchar_t *src, size_t size);
|
721
|
+
#endif
|
722
|
+
|
723
|
+
#ifndef HAVE_WCSLCAT
|
724
|
+
size_t wcslcat(wchar_t *dst, const wchar_t *src, size_t size);
|
725
|
+
#endif
|
726
|
+
|
727
|
+
/* Starting LLVM 16, the analyser errors out if these functions do not have
|
728
|
+
their prototype defined (clang-diagnostic-implicit-function-declaration) */
|
729
|
+
#include <stdlib.h>
|
730
|
+
#include <string.h>
|
731
|
+
#include <stdio.h>
|
732
|
+
|
725
733
|
#define SDL_malloc malloc
|
726
734
|
#define SDL_calloc calloc
|
727
735
|
#define SDL_realloc realloc
|
@@ -35,7 +35,7 @@
|
|
35
35
|
#include "SDL_atomic.h"
|
36
36
|
#include "SDL_mutex.h"
|
37
37
|
|
38
|
-
#if defined(__WIN32__) || defined(__GDK__)
|
38
|
+
#if (defined(__WIN32__) || defined(__GDK__)) && !defined(__WINRT__)
|
39
39
|
#include <process.h> /* _beginthreadex() and _endthreadex() */
|
40
40
|
#endif
|
41
41
|
#if defined(__OS2__) /* for _beginthread() and _endthread() */
|
@@ -88,7 +88,7 @@ typedef enum {
|
|
88
88
|
typedef int (SDLCALL * SDL_ThreadFunction) (void *data);
|
89
89
|
|
90
90
|
|
91
|
-
#if defined(__WIN32__) || defined(__GDK__)
|
91
|
+
#if (defined(__WIN32__) || defined(__GDK__)) && !defined(__WINRT__)
|
92
92
|
/**
|
93
93
|
* \file SDL_thread.h
|
94
94
|
*
|
@@ -58,8 +58,8 @@ typedef struct SDL_version
|
|
58
58
|
/* Printable format: "%d.%d.%d", MAJOR, MINOR, PATCHLEVEL
|
59
59
|
*/
|
60
60
|
#define SDL_MAJOR_VERSION 2
|
61
|
-
#define SDL_MINOR_VERSION
|
62
|
-
#define SDL_PATCHLEVEL
|
61
|
+
#define SDL_MINOR_VERSION 28
|
62
|
+
#define SDL_PATCHLEVEL 2
|
63
63
|
|
64
64
|
/**
|
65
65
|
* Macro to determine SDL version program was compiled against.
|
@@ -187,7 +187,8 @@ typedef enum
|
|
187
187
|
SDL_DISPLAYEVENT_NONE, /**< Never used */
|
188
188
|
SDL_DISPLAYEVENT_ORIENTATION, /**< Display orientation has changed to data1 */
|
189
189
|
SDL_DISPLAYEVENT_CONNECTED, /**< Display has been added to the system */
|
190
|
-
SDL_DISPLAYEVENT_DISCONNECTED
|
190
|
+
SDL_DISPLAYEVENT_DISCONNECTED, /**< Display has been removed from the system */
|
191
|
+
SDL_DISPLAYEVENT_MOVED /**< Display has changed position */
|
191
192
|
} SDL_DisplayEventID;
|
192
193
|
|
193
194
|
/**
|
@@ -1274,6 +1275,17 @@ extern DECLSPEC void SDLCALL SDL_RestoreWindow(SDL_Window * window);
|
|
1274
1275
|
extern DECLSPEC int SDLCALL SDL_SetWindowFullscreen(SDL_Window * window,
|
1275
1276
|
Uint32 flags);
|
1276
1277
|
|
1278
|
+
/**
|
1279
|
+
* Return whether the window has a surface associated with it.
|
1280
|
+
*
|
1281
|
+
* \returns SDL_TRUE if there is a surface associated with the window, or SDL_FALSE otherwise.
|
1282
|
+
*
|
1283
|
+
* \since This function is available since SDL 2.28.0.
|
1284
|
+
*
|
1285
|
+
* \sa SDL_GetWindowSurface
|
1286
|
+
*/
|
1287
|
+
extern DECLSPEC SDL_bool SDLCALL SDL_HasWindowSurface(SDL_Window *window);
|
1288
|
+
|
1277
1289
|
/**
|
1278
1290
|
* Get the SDL surface associated with the window.
|
1279
1291
|
*
|
@@ -1294,6 +1306,8 @@ extern DECLSPEC int SDLCALL SDL_SetWindowFullscreen(SDL_Window * window,
|
|
1294
1306
|
*
|
1295
1307
|
* \since This function is available since SDL 2.0.0.
|
1296
1308
|
*
|
1309
|
+
* \sa SDL_DestroyWindowSurface
|
1310
|
+
* \sa SDL_HasWindowSurface
|
1297
1311
|
* \sa SDL_UpdateWindowSurface
|
1298
1312
|
* \sa SDL_UpdateWindowSurfaceRects
|
1299
1313
|
*/
|
@@ -1328,7 +1342,7 @@ extern DECLSPEC int SDLCALL SDL_UpdateWindowSurface(SDL_Window * window);
|
|
1328
1342
|
*
|
1329
1343
|
* \param window the window to update
|
1330
1344
|
* \param rects an array of SDL_Rect structures representing areas of the
|
1331
|
-
* surface to copy
|
1345
|
+
* surface to copy, in pixels
|
1332
1346
|
* \param numrects the number of rectangles
|
1333
1347
|
* \returns 0 on success or a negative error code on failure; call
|
1334
1348
|
* SDL_GetError() for more information.
|
@@ -1342,6 +1356,20 @@ extern DECLSPEC int SDLCALL SDL_UpdateWindowSurfaceRects(SDL_Window * window,
|
|
1342
1356
|
const SDL_Rect * rects,
|
1343
1357
|
int numrects);
|
1344
1358
|
|
1359
|
+
/**
|
1360
|
+
* Destroy the surface associated with the window.
|
1361
|
+
*
|
1362
|
+
* \param window the window to update
|
1363
|
+
* \returns 0 on success or a negative error code on failure; call
|
1364
|
+
* SDL_GetError() for more information.
|
1365
|
+
*
|
1366
|
+
* \since This function is available since SDL 2.28.0.
|
1367
|
+
*
|
1368
|
+
* \sa SDL_GetWindowSurface
|
1369
|
+
* \sa SDL_HasWindowSurface
|
1370
|
+
*/
|
1371
|
+
extern DECLSPEC int SDLCALL SDL_DestroyWindowSurface(SDL_Window *window);
|
1372
|
+
|
1345
1373
|
/**
|
1346
1374
|
* Set a window's input grab mode.
|
1347
1375
|
*
|
@@ -28,10 +28,10 @@
|
|
28
28
|
*/
|
29
29
|
|
30
30
|
/* This shouldn't be nested -- included it around code only. */
|
31
|
-
#ifdef
|
31
|
+
#ifdef SDL_begin_code_h
|
32
32
|
#error Nested inclusion of begin_code.h
|
33
33
|
#endif
|
34
|
-
#define
|
34
|
+
#define SDL_begin_code_h
|
35
35
|
|
36
36
|
#ifndef SDL_DEPRECATED
|
37
37
|
# if defined(__GNUC__) && (__GNUC__ >= 4) /* technically, this arrived in gcc 3.1, but oh well. */
|
@@ -171,17 +171,17 @@
|
|
171
171
|
#define SDL_FALLTHROUGH [[fallthrough]]
|
172
172
|
#else
|
173
173
|
#if defined(__has_attribute)
|
174
|
-
#define
|
174
|
+
#define SDL_HAS_FALLTHROUGH __has_attribute(__fallthrough__)
|
175
175
|
#else
|
176
|
-
#define
|
176
|
+
#define SDL_HAS_FALLTHROUGH 0
|
177
177
|
#endif /* __has_attribute */
|
178
|
-
#if
|
178
|
+
#if SDL_HAS_FALLTHROUGH && \
|
179
179
|
((defined(__GNUC__) && __GNUC__ >= 7) || \
|
180
180
|
(defined(__clang_major__) && __clang_major__ >= 10))
|
181
181
|
#define SDL_FALLTHROUGH __attribute__((__fallthrough__))
|
182
182
|
#else
|
183
183
|
#define SDL_FALLTHROUGH do {} while (0) /* fallthrough */
|
184
|
-
#endif /*
|
185
|
-
#undef
|
184
|
+
#endif /* SDL_HAS_FALLTHROUGH */
|
185
|
+
#undef SDL_HAS_FALLTHROUGH
|
186
186
|
#endif /* C++17 or C2x */
|
187
187
|
#endif /* SDL_FALLTHROUGH not defined */
|
@@ -26,10 +26,10 @@
|
|
26
26
|
* after you finish any function and structure declarations in your headers
|
27
27
|
*/
|
28
28
|
|
29
|
-
#ifndef
|
29
|
+
#ifndef SDL_begin_code_h
|
30
30
|
#error close_code.h included without matching begin_code.h
|
31
31
|
#endif
|
32
|
-
#undef
|
32
|
+
#undef SDL_begin_code_h
|
33
33
|
|
34
34
|
/* Reset structure packing at previous byte alignment */
|
35
35
|
#if defined(_MSC_VER) || defined(__MWERKS__) || defined(__BORLANDC__)
|
Binary file
|
Binary file
|
@@ -1,6 +1,6 @@
|
|
1
1
|
/*
|
2
2
|
FLAC audio decoder. Choice of public domain or MIT-0. See license statements at the end of this file.
|
3
|
-
dr_flac - v0.12.
|
3
|
+
dr_flac - v0.12.41 - 2023-06-17
|
4
4
|
|
5
5
|
David Reid - mackron@gmail.com
|
6
6
|
|
@@ -235,12 +235,12 @@ extern "C" {
|
|
235
235
|
|
236
236
|
#define DRFLAC_VERSION_MAJOR 0
|
237
237
|
#define DRFLAC_VERSION_MINOR 12
|
238
|
-
#define DRFLAC_VERSION_REVISION
|
238
|
+
#define DRFLAC_VERSION_REVISION 41
|
239
239
|
#define DRFLAC_VERSION_STRING DRFLAC_XSTRINGIFY(DRFLAC_VERSION_MAJOR) "." DRFLAC_XSTRINGIFY(DRFLAC_VERSION_MINOR) "." DRFLAC_XSTRINGIFY(DRFLAC_VERSION_REVISION)
|
240
240
|
|
241
241
|
#include <stddef.h> /* For size_t. */
|
242
242
|
|
243
|
-
/* Sized
|
243
|
+
/* Sized Types */
|
244
244
|
typedef signed char drflac_int8;
|
245
245
|
typedef unsigned char drflac_uint8;
|
246
246
|
typedef signed short drflac_int16;
|
@@ -273,7 +273,9 @@ typedef drflac_uint8 drflac_bool8;
|
|
273
273
|
typedef drflac_uint32 drflac_bool32;
|
274
274
|
#define DRFLAC_TRUE 1
|
275
275
|
#define DRFLAC_FALSE 0
|
276
|
+
/* End Sized Types */
|
276
277
|
|
278
|
+
/* Decorations */
|
277
279
|
#if !defined(DRFLAC_API)
|
278
280
|
#if defined(DRFLAC_DLL)
|
279
281
|
#if defined(_WIN32)
|
@@ -303,6 +305,7 @@ typedef drflac_uint32 drflac_bool32;
|
|
303
305
|
#define DRFLAC_PRIVATE static
|
304
306
|
#endif
|
305
307
|
#endif
|
308
|
+
/* End Decorations */
|
306
309
|
|
307
310
|
#if defined(_MSC_VER) && _MSC_VER >= 1700 /* Visual Studio 2012 */
|
308
311
|
#define DRFLAC_DEPRECATED __declspec(deprecated)
|
@@ -321,6 +324,16 @@ typedef drflac_uint32 drflac_bool32;
|
|
321
324
|
DRFLAC_API void drflac_version(drflac_uint32* pMajor, drflac_uint32* pMinor, drflac_uint32* pRevision);
|
322
325
|
DRFLAC_API const char* drflac_version_string(void);
|
323
326
|
|
327
|
+
/* Allocation Callbacks */
|
328
|
+
typedef struct
|
329
|
+
{
|
330
|
+
void* pUserData;
|
331
|
+
void* (* onMalloc)(size_t sz, void* pUserData);
|
332
|
+
void* (* onRealloc)(void* p, size_t sz, void* pUserData);
|
333
|
+
void (* onFree)(void* p, void* pUserData);
|
334
|
+
} drflac_allocation_callbacks;
|
335
|
+
/* End Allocation Callbacks */
|
336
|
+
|
324
337
|
/*
|
325
338
|
As data is read from the client it is placed into an internal buffer for fast access. This controls the size of that buffer. Larger values means more speed,
|
326
339
|
but also more memory. In my testing there is diminishing returns after about 4KB, but you can fiddle with this to suit your own needs. Must be a multiple of 8.
|
@@ -329,11 +342,22 @@ but also more memory. In my testing there is diminishing returns after about 4KB
|
|
329
342
|
#define DR_FLAC_BUFFER_SIZE 4096
|
330
343
|
#endif
|
331
344
|
|
332
|
-
|
345
|
+
|
346
|
+
/* Architecture Detection */
|
333
347
|
#if defined(_WIN64) || defined(_LP64) || defined(__LP64__)
|
334
348
|
#define DRFLAC_64BIT
|
335
349
|
#endif
|
336
350
|
|
351
|
+
#if defined(__x86_64__) || defined(_M_X64)
|
352
|
+
#define DRFLAC_X64
|
353
|
+
#elif defined(__i386) || defined(_M_IX86)
|
354
|
+
#define DRFLAC_X86
|
355
|
+
#elif defined(__arm__) || defined(_M_ARM) || defined(__arm64) || defined(__arm64__) || defined(__aarch64__) || defined(_M_ARM64)
|
356
|
+
#define DRFLAC_ARM
|
357
|
+
#endif
|
358
|
+
/* End Architecture Detection */
|
359
|
+
|
360
|
+
|
337
361
|
#ifdef DRFLAC_64BIT
|
338
362
|
typedef drflac_uint64 drflac_cache_t;
|
339
363
|
#else
|
@@ -562,14 +586,6 @@ will be set to one of the DRFLAC_METADATA_BLOCK_TYPE_* tokens.
|
|
562
586
|
typedef void (* drflac_meta_proc)(void* pUserData, drflac_metadata* pMetadata);
|
563
587
|
|
564
588
|
|
565
|
-
typedef struct
|
566
|
-
{
|
567
|
-
void* pUserData;
|
568
|
-
void* (* onMalloc)(size_t sz, void* pUserData);
|
569
|
-
void* (* onRealloc)(void* p, size_t sz, void* pUserData);
|
570
|
-
void (* onFree)(void* p, void* pUserData);
|
571
|
-
} drflac_allocation_callbacks;
|
572
|
-
|
573
589
|
/* Structure for internal use. Only used for decoders opened with drflac_open_memory. */
|
574
590
|
typedef struct
|
575
591
|
{
|
@@ -1351,6 +1367,7 @@ DRFLAC_API drflac_bool32 drflac_next_cuesheet_track(drflac_cuesheet_track_iterat
|
|
1351
1367
|
#include <stdlib.h>
|
1352
1368
|
#include <string.h>
|
1353
1369
|
|
1370
|
+
/* Inline */
|
1354
1371
|
#ifdef _MSC_VER
|
1355
1372
|
#define DRFLAC_INLINE __forceinline
|
1356
1373
|
#elif defined(__GNUC__)
|
@@ -1377,15 +1394,7 @@ DRFLAC_API drflac_bool32 drflac_next_cuesheet_track(drflac_cuesheet_track_iterat
|
|
1377
1394
|
#else
|
1378
1395
|
#define DRFLAC_INLINE
|
1379
1396
|
#endif
|
1380
|
-
|
1381
|
-
/* CPU architecture. */
|
1382
|
-
#if defined(__x86_64__) || defined(_M_X64)
|
1383
|
-
#define DRFLAC_X64
|
1384
|
-
#elif defined(__i386) || defined(_M_IX86)
|
1385
|
-
#define DRFLAC_X86
|
1386
|
-
#elif defined(__arm__) || defined(_M_ARM) || defined(__arm64) || defined(__arm64__) || defined(__aarch64__) || defined(_M_ARM64)
|
1387
|
-
#define DRFLAC_ARM
|
1388
|
-
#endif
|
1397
|
+
/* End Inline */
|
1389
1398
|
|
1390
1399
|
/*
|
1391
1400
|
Intrinsics Support
|
@@ -1623,6 +1632,7 @@ static DRFLAC_INLINE drflac_bool32 drflac_has_sse41(void)
|
|
1623
1632
|
|
1624
1633
|
#define DRFLAC_MAX_SIMD_VECTOR_SIZE 64 /* 64 for AVX-512 in the future. */
|
1625
1634
|
|
1635
|
+
/* Result Codes */
|
1626
1636
|
typedef drflac_int32 drflac_result;
|
1627
1637
|
#define DRFLAC_SUCCESS 0
|
1628
1638
|
#define DRFLAC_ERROR -1 /* A generic error. */
|
@@ -1678,7 +1688,10 @@ typedef drflac_int32 drflac_result;
|
|
1678
1688
|
#define DRFLAC_CANCELLED -51
|
1679
1689
|
#define DRFLAC_MEMORY_ALREADY_MAPPED -52
|
1680
1690
|
#define DRFLAC_AT_END -53
|
1681
|
-
|
1691
|
+
|
1692
|
+
#define DRFLAC_CRC_MISMATCH -100
|
1693
|
+
/* End Result Codes */
|
1694
|
+
|
1682
1695
|
|
1683
1696
|
#define DRFLAC_SUBFRAME_CONSTANT 0
|
1684
1697
|
#define DRFLAC_SUBFRAME_VERBATIM 1
|
@@ -8141,6 +8154,7 @@ static drflac* drflac_open_with_metadata_private(drflac_read_proc onRead, drflac
|
|
8141
8154
|
#include <wchar.h> /* For wcslen(), wcsrtombs() */
|
8142
8155
|
#endif
|
8143
8156
|
|
8157
|
+
/* Errno */
|
8144
8158
|
/* drflac_result_from_errno() is only used for fopen() and wfopen() so putting it inside DR_WAV_NO_STDIO for now. If something else needs this later we can move it out. */
|
8145
8159
|
#include <errno.h>
|
8146
8160
|
static drflac_result drflac_result_from_errno(int e)
|
@@ -8544,7 +8558,9 @@ static drflac_result drflac_result_from_errno(int e)
|
|
8544
8558
|
default: return DRFLAC_ERROR;
|
8545
8559
|
}
|
8546
8560
|
}
|
8561
|
+
/* End Errno */
|
8547
8562
|
|
8563
|
+
/* fopen */
|
8548
8564
|
static drflac_result drflac_fopen(FILE** ppFile, const char* pFilePath, const char* pOpenMode)
|
8549
8565
|
{
|
8550
8566
|
#if defined(_MSC_VER) && _MSC_VER >= 1400
|
@@ -8702,6 +8718,7 @@ static drflac_result drflac_wfopen(FILE** ppFile, const wchar_t* pFilePath, cons
|
|
8702
8718
|
return DRFLAC_SUCCESS;
|
8703
8719
|
}
|
8704
8720
|
#endif
|
8721
|
+
/* End fopen */
|
8705
8722
|
|
8706
8723
|
static size_t drflac__on_read_stdio(void* pUserData, void* bufferOut, size_t bytesToRead)
|
8707
8724
|
{
|
@@ -11666,6 +11683,7 @@ DRFLAC_API drflac_bool32 drflac_seek_to_pcm_frame(drflac* pFlac, drflac_uint64 p
|
|
11666
11683
|
|
11667
11684
|
/* High Level APIs */
|
11668
11685
|
|
11686
|
+
/* SIZE_MAX */
|
11669
11687
|
#if defined(SIZE_MAX)
|
11670
11688
|
#define DRFLAC_SIZE_MAX SIZE_MAX
|
11671
11689
|
#else
|
@@ -11675,6 +11693,7 @@ DRFLAC_API drflac_bool32 drflac_seek_to_pcm_frame(drflac* pFlac, drflac_uint64 p
|
|
11675
11693
|
#define DRFLAC_SIZE_MAX 0xFFFFFFFF
|
11676
11694
|
#endif
|
11677
11695
|
#endif
|
11696
|
+
/* End SIZE_MAX */
|
11678
11697
|
|
11679
11698
|
|
11680
11699
|
/* Using a macro as the definition of the drflac__full_decode_and_close_*() API family. Sue me. */
|
@@ -12058,6 +12077,12 @@ DRFLAC_API drflac_bool32 drflac_next_cuesheet_track(drflac_cuesheet_track_iterat
|
|
12058
12077
|
/*
|
12059
12078
|
REVISION HISTORY
|
12060
12079
|
================
|
12080
|
+
v0.12.41 - 2023-06-17
|
12081
|
+
- Fix an incorrect date in revision history. No functional change.
|
12082
|
+
|
12083
|
+
v0.12.40 - 2023-05-22
|
12084
|
+
- Minor code restructure. No functional change.
|
12085
|
+
|
12061
12086
|
v0.12.39 - 2022-09-17
|
12062
12087
|
- Fix compilation with DJGPP.
|
12063
12088
|
- Fix compilation error with Visual Studio 2019 and the ARM build.
|
@@ -12488,7 +12513,7 @@ For more information, please refer to <http://unlicense.org/>
|
|
12488
12513
|
===============================================================================
|
12489
12514
|
ALTERNATIVE 2 - MIT No Attribution
|
12490
12515
|
===============================================================================
|
12491
|
-
Copyright
|
12516
|
+
Copyright 2023 David Reid
|
12492
12517
|
|
12493
12518
|
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
12494
12519
|
this software and associated documentation files (the "Software"), to deal in
|
@@ -1,6 +1,6 @@
|
|
1
1
|
/*
|
2
2
|
MP3 audio decoder. Choice of public domain or MIT-0. See license statements at the end of this file.
|
3
|
-
dr_mp3 - v0.6.
|
3
|
+
dr_mp3 - v0.6.36 - 2023-06-17
|
4
4
|
|
5
5
|
David Reid - mackron@gmail.com
|
6
6
|
|
@@ -95,12 +95,12 @@ extern "C" {
|
|
95
95
|
|
96
96
|
#define DRMP3_VERSION_MAJOR 0
|
97
97
|
#define DRMP3_VERSION_MINOR 6
|
98
|
-
#define DRMP3_VERSION_REVISION
|
98
|
+
#define DRMP3_VERSION_REVISION 36
|
99
99
|
#define DRMP3_VERSION_STRING DRMP3_XSTRINGIFY(DRMP3_VERSION_MAJOR) "." DRMP3_XSTRINGIFY(DRMP3_VERSION_MINOR) "." DRMP3_XSTRINGIFY(DRMP3_VERSION_REVISION)
|
100
100
|
|
101
101
|
#include <stddef.h> /* For size_t. */
|
102
102
|
|
103
|
-
/* Sized
|
103
|
+
/* Sized Types */
|
104
104
|
typedef signed char drmp3_int8;
|
105
105
|
typedef unsigned char drmp3_uint8;
|
106
106
|
typedef signed short drmp3_int16;
|
@@ -133,7 +133,9 @@ typedef drmp3_uint8 drmp3_bool8;
|
|
133
133
|
typedef drmp3_uint32 drmp3_bool32;
|
134
134
|
#define DRMP3_TRUE 1
|
135
135
|
#define DRMP3_FALSE 0
|
136
|
+
/* End Sized Types */
|
136
137
|
|
138
|
+
/* Decorations */
|
137
139
|
#if !defined(DRMP3_API)
|
138
140
|
#if defined(DRMP3_DLL)
|
139
141
|
#if defined(_WIN32)
|
@@ -163,7 +165,9 @@ typedef drmp3_uint32 drmp3_bool32;
|
|
163
165
|
#define DRMP3_PRIVATE static
|
164
166
|
#endif
|
165
167
|
#endif
|
168
|
+
/* End Decorations */
|
166
169
|
|
170
|
+
/* Result Codes */
|
167
171
|
typedef drmp3_int32 drmp3_result;
|
168
172
|
#define DRMP3_SUCCESS 0
|
169
173
|
#define DRMP3_ERROR -1 /* A generic error. */
|
@@ -219,11 +223,12 @@ typedef drmp3_int32 drmp3_result;
|
|
219
223
|
#define DRMP3_CANCELLED -51
|
220
224
|
#define DRMP3_MEMORY_ALREADY_MAPPED -52
|
221
225
|
#define DRMP3_AT_END -53
|
222
|
-
|
226
|
+
/* End Result Codes */
|
223
227
|
|
224
228
|
#define DRMP3_MAX_PCM_FRAMES_PER_MP3_FRAME 1152
|
225
229
|
#define DRMP3_MAX_SAMPLES_PER_FRAME (DRMP3_MAX_PCM_FRAMES_PER_MP3_FRAME*2)
|
226
230
|
|
231
|
+
/* Inline */
|
227
232
|
#ifdef _MSC_VER
|
228
233
|
#define DRMP3_INLINE __forceinline
|
229
234
|
#elif defined(__GNUC__)
|
@@ -250,12 +255,24 @@ typedef drmp3_int32 drmp3_result;
|
|
250
255
|
#else
|
251
256
|
#define DRMP3_INLINE
|
252
257
|
#endif
|
258
|
+
/* End Inline */
|
253
259
|
|
254
260
|
|
255
261
|
DRMP3_API void drmp3_version(drmp3_uint32* pMajor, drmp3_uint32* pMinor, drmp3_uint32* pRevision);
|
256
262
|
DRMP3_API const char* drmp3_version_string(void);
|
257
263
|
|
258
264
|
|
265
|
+
/* Allocation Callbacks */
|
266
|
+
typedef struct
|
267
|
+
{
|
268
|
+
void* pUserData;
|
269
|
+
void* (* onMalloc)(size_t sz, void* pUserData);
|
270
|
+
void* (* onRealloc)(void* p, size_t sz, void* pUserData);
|
271
|
+
void (* onFree)(void* p, void* pUserData);
|
272
|
+
} drmp3_allocation_callbacks;
|
273
|
+
/* End Allocation Callbacks */
|
274
|
+
|
275
|
+
|
259
276
|
/*
|
260
277
|
Low Level Push API
|
261
278
|
==================
|
@@ -329,14 +346,6 @@ will be either drmp3_seek_origin_start or drmp3_seek_origin_current.
|
|
329
346
|
*/
|
330
347
|
typedef drmp3_bool32 (* drmp3_seek_proc)(void* pUserData, int offset, drmp3_seek_origin origin);
|
331
348
|
|
332
|
-
typedef struct
|
333
|
-
{
|
334
|
-
void* pUserData;
|
335
|
-
void* (* onMalloc)(size_t sz, void* pUserData);
|
336
|
-
void* (* onRealloc)(void* p, size_t sz, void* pUserData);
|
337
|
-
void (* onFree)(void* p, void* pUserData);
|
338
|
-
} drmp3_allocation_callbacks;
|
339
|
-
|
340
349
|
typedef struct
|
341
350
|
{
|
342
351
|
drmp3_uint32 channels;
|
@@ -2415,6 +2424,7 @@ DRMP3_API void drmp3dec_f32_to_s16(const float *in, drmp3_int16 *out, size_t num
|
|
2415
2424
|
Main Public API
|
2416
2425
|
|
2417
2426
|
************************************************************************************************************************************************************/
|
2427
|
+
/* SIZE_MAX */
|
2418
2428
|
#if defined(SIZE_MAX)
|
2419
2429
|
#define DRMP3_SIZE_MAX SIZE_MAX
|
2420
2430
|
#else
|
@@ -2424,6 +2434,7 @@ DRMP3_API void drmp3dec_f32_to_s16(const float *in, drmp3_int16 *out, size_t num
|
|
2424
2434
|
#define DRMP3_SIZE_MAX 0xFFFFFFFF
|
2425
2435
|
#endif
|
2426
2436
|
#endif
|
2437
|
+
/* End SIZE_MAX */
|
2427
2438
|
|
2428
2439
|
/* Options. */
|
2429
2440
|
#ifndef DRMP3_SEEK_LEADING_MP3_FRAMES
|
@@ -2931,6 +2942,7 @@ DRMP3_API drmp3_bool32 drmp3_init_memory(drmp3* pMP3, const void* pData, size_t
|
|
2931
2942
|
#include <stdio.h>
|
2932
2943
|
#include <wchar.h> /* For wcslen(), wcsrtombs() */
|
2933
2944
|
|
2945
|
+
/* Errno */
|
2934
2946
|
/* drmp3_result_from_errno() is only used inside DR_MP3_NO_STDIO for now. Move this out if it's ever used elsewhere. */
|
2935
2947
|
#include <errno.h>
|
2936
2948
|
static drmp3_result drmp3_result_from_errno(int e)
|
@@ -3334,7 +3346,9 @@ static drmp3_result drmp3_result_from_errno(int e)
|
|
3334
3346
|
default: return DRMP3_ERROR;
|
3335
3347
|
}
|
3336
3348
|
}
|
3349
|
+
/* End Errno */
|
3337
3350
|
|
3351
|
+
/* fopen */
|
3338
3352
|
static drmp3_result drmp3_fopen(FILE** ppFile, const char* pFilePath, const char* pOpenMode)
|
3339
3353
|
{
|
3340
3354
|
#if defined(_MSC_VER) && _MSC_VER >= 1400
|
@@ -3490,7 +3504,7 @@ static drmp3_result drmp3_wfopen(FILE** ppFile, const wchar_t* pFilePath, const
|
|
3490
3504
|
|
3491
3505
|
return DRMP3_SUCCESS;
|
3492
3506
|
}
|
3493
|
-
|
3507
|
+
/* End fopen */
|
3494
3508
|
|
3495
3509
|
|
3496
3510
|
static size_t drmp3__on_read_stdio(void* pUserData, void* pBufferOut, size_t bytesToRead)
|
@@ -4476,6 +4490,12 @@ counts rather than sample counts.
|
|
4476
4490
|
/*
|
4477
4491
|
REVISION HISTORY
|
4478
4492
|
================
|
4493
|
+
v0.6.36 - 2023-06-17
|
4494
|
+
- Fix an incorrect date in revision history. No functional change.
|
4495
|
+
|
4496
|
+
v0.6.35 - 2023-05-22
|
4497
|
+
- Minor code restructure. No functional change.
|
4498
|
+
|
4479
4499
|
v0.6.34 - 2022-09-17
|
4480
4500
|
- Fix compilation with DJGPP.
|
4481
4501
|
- Fix compilation when compiling with x86 with no SSE2.
|
@@ -4777,7 +4797,7 @@ For more information, please refer to <http://unlicense.org/>
|
|
4777
4797
|
===============================================================================
|
4778
4798
|
ALTERNATIVE 2 - MIT No Attribution
|
4779
4799
|
===============================================================================
|
4780
|
-
Copyright
|
4800
|
+
Copyright 2023 David Reid
|
4781
4801
|
|
4782
4802
|
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
4783
4803
|
this software and associated documentation files (the "Software"), to deal in
|
@@ -1972,7 +1972,7 @@ static int codebook_decode_deinterleave_repeat(vorb *f, Codebook *c, float **out
|
|
1972
1972
|
// buffer (len*ch), our current offset within it (p_inter*ch)+(c_inter),
|
1973
1973
|
// and the length we'll be using (effective)
|
1974
1974
|
if (c_inter + p_inter*ch + effective > len * ch) {
|
1975
|
-
effective = len*ch - (p_inter*ch
|
1975
|
+
effective = len*ch - (p_inter*ch + c_inter);
|
1976
1976
|
}
|
1977
1977
|
|
1978
1978
|
#ifdef STB_VORBIS_DIVIDES_IN_CODEBOOK
|
@@ -4263,7 +4263,8 @@ static int start_decoder(vorb *f)
|
|
4263
4263
|
int i,max_part_read=0;
|
4264
4264
|
for (i=0; i < f->residue_count; ++i) {
|
4265
4265
|
Residue *r = f->residue_config + i;
|
4266
|
-
unsigned int
|
4266
|
+
unsigned int rtype = f->residue_types[i];
|
4267
|
+
unsigned int actual_size = rtype == 2 ? f->blocksize_1 : f->blocksize_1 / 2;
|
4267
4268
|
unsigned int limit_r_begin = r->begin < actual_size ? r->begin : actual_size;
|
4268
4269
|
unsigned int limit_r_end = r->end < actual_size ? r->end : actual_size;
|
4269
4270
|
int n_read = limit_r_end - limit_r_begin;
|
@@ -1254,7 +1254,7 @@ static void pitch_shift(ALsource *src, const ALbuffer *buffer, int numSampsToPro
|
|
1254
1254
|
/* do windowing and re,im interleave */
|
1255
1255
|
for (k = 0; k < pitch_framesize;k++) {
|
1256
1256
|
window = -.5*SDL_cos(2.*M_PI*(double)k/(double)pitch_framesize)+.5;
|
1257
|
-
state->workspace[2*k] = (ALfloat) state->infifo[k] * window;
|
1257
|
+
state->workspace[2*k] = (ALfloat) (state->infifo[k] * window);
|
1258
1258
|
state->workspace[2*k+1] = 0.0f;
|
1259
1259
|
}
|
1260
1260
|
|