summaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
authorRay <[email protected]>2019-02-12 12:18:01 +0100
committerRay <[email protected]>2019-02-12 12:18:01 +0100
commit944a388b1bfee6048528c29719c5a78d4888bfa5 (patch)
tree950e70cdb956484807b8221bddeabc51200858c5 /src
parente7466eb0c4d2337d939cc7149e4e0eb8d5effd68 (diff)
downloadraylib-944a388b1bfee6048528c29719c5a78d4888bfa5.tar.gz
raylib-944a388b1bfee6048528c29719c5a78d4888bfa5.zip
Include mini_al directly, no separate module
Diffstat (limited to 'src')
-rw-r--r--src/CMakeLists.txt2
-rw-r--r--src/Makefile5
-rw-r--r--src/external/mini_al.c8
-rw-r--r--src/external/mini_al.h72
-rw-r--r--src/libraylib.abin1293606 -> 1642396 bytes
-rw-r--r--src/raudio.c23
-rw-r--r--src/raudio.h12
7 files changed, 93 insertions, 29 deletions
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 504930d4..2983948b 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -45,9 +45,7 @@ endif()
add_definitions("-DRAYLIB_CMAKE=1")
if(USE_AUDIO)
- file(GLOB mini_al external/mini_al.c)
MESSAGE(STATUS "Audio Backend: mini_al")
- set(sources ${raylib_sources} ${mini_al})
else()
MESSAGE(STATUS "Audio Backend: None (-DUSE_AUDIO=OFF)")
set(INCLUDE_AUDIO_MODULE 0)
diff --git a/src/Makefile b/src/Makefile
index b99ff711..ff9dc99e 100644
--- a/src/Makefile
+++ b/src/Makefile
@@ -404,7 +404,6 @@ endif
ifeq ($(INCLUDE_AUDIO_MODULE),TRUE)
OBJS += raudio.o
- OBJS += mini_al.o
endif
ifeq ($(PLATFORM),PLATFORM_ANDROID)
@@ -532,10 +531,6 @@ models.o : models.c raylib.h rlgl.h raymath.h
raudio.o : raudio.c raylib.h
$(CC) -c $< $(CFLAGS) $(INCLUDE_PATHS) -D$(PLATFORM)
-# Compile mini_al audio library
-mini_al.o : external/mini_al.c external/mini_al.h
- $(CC) -c $< $(CFLAGS) $(INCLUDE_PATHS) -D$(PLATFORM)
-
# Compile utils module
utils.o : utils.c utils.h
$(CC) -c $< $(CFLAGS) $(INCLUDE_PATHS) -D$(PLATFORM)
diff --git a/src/external/mini_al.c b/src/external/mini_al.c
deleted file mode 100644
index d52789a7..00000000
--- a/src/external/mini_al.c
+++ /dev/null
@@ -1,8 +0,0 @@
-// The implementation of mini_al needs to #include windows.h which means it needs to go into
-// it's own translation unit. Not doing this will cause conflicts with CloseWindow(), etc.
-#define MINI_AL_IMPLEMENTATION
-#define MAL_NO_JACK
-#define MAL_NO_OPENAL
-#define MAL_NO_SDL
-//#define MAL_NO_NULL
-#include "mini_al.h"
diff --git a/src/external/mini_al.h b/src/external/mini_al.h
index e892b031..4444be6f 100644
--- a/src/external/mini_al.h
+++ b/src/external/mini_al.h
@@ -2775,7 +2775,79 @@ mal_uint64 mal_sine_wave_read_ex(mal_sine_wave* pSineWave, mal_uint64 frameCount
#endif
#ifdef MAL_WIN32
+
+// @raysan5: To avoid conflicting windows.h symbols with raylib, so flags are defined
+// WARNING: Those flags avoid inclusion of some Win32 headers that could be required
+// by user at some point and won't be included...
+//-------------------------------------------------------------------------------------
+
+// If defined, the following flags inhibit definition of the indicated items.
+#define NOGDICAPMASKS // CC_*, LC_*, PC_*, CP_*, TC_*, RC_
+#define NOVIRTUALKEYCODES // VK_*
+#define NOWINMESSAGES // WM_*, EM_*, LB_*, CB_*
+#define NOWINSTYLES // WS_*, CS_*, ES_*, LBS_*, SBS_*, CBS_*
+#define NOSYSMETRICS // SM_*
+#define NOMENUS // MF_*
+#define NOICONS // IDI_*
+#define NOKEYSTATES // MK_*
+#define NOSYSCOMMANDS // SC_*
+#define NORASTEROPS // Binary and Tertiary raster ops
+#define NOSHOWWINDOW // SW_*
+#define OEMRESOURCE // OEM Resource values
+#define NOATOM // Atom Manager routines
+#define NOCLIPBOARD // Clipboard routines
+#define NOCOLOR // Screen colors
+#define NOCTLMGR // Control and Dialog routines
+#define NODRAWTEXT // DrawText() and DT_*
+#define NOGDI // All GDI defines and routines
+#define NOKERNEL // All KERNEL defines and routines
+#define NOUSER // All USER defines and routines
+//#define NONLS // All NLS defines and routines
+#define NOMB // MB_* and MessageBox()
+#define NOMEMMGR // GMEM_*, LMEM_*, GHND, LHND, associated routines
+#define NOMETAFILE // typedef METAFILEPICT
+#define NOMINMAX // Macros min(a,b) and max(a,b)
+#define NOMSG // typedef MSG and associated routines
+#define NOOPENFILE // OpenFile(), OemToAnsi, AnsiToOem, and OF_*
+#define NOSCROLL // SB_* and scrolling routines
+#define NOSERVICE // All Service Controller routines, SERVICE_ equates, etc.
+#define NOSOUND // Sound driver routines
+#define NOTEXTMETRIC // typedef TEXTMETRIC and associated routines
+#define NOWH // SetWindowsHook and WH_*
+#define NOWINOFFSETS // GWL_*, GCL_*, associated routines
+#define NOCOMM // COMM driver routines
+#define NOKANJI // Kanji support stuff.
+#define NOHELP // Help engine interface.
+#define NOPROFILER // Profiler interface.
+#define NODEFERWINDOWPOS // DeferWindowPos routines
+#define NOMCX // Modem Configuration Extensions
+
+// Type required before windows.h inclusion
+typedef struct tagMSG *LPMSG;
+
#include <windows.h>
+
+// Type required by some unused function...
+typedef struct tagBITMAPINFOHEADER {
+ DWORD biSize;
+ LONG biWidth;
+ LONG biHeight;
+ WORD biPlanes;
+ WORD biBitCount;
+ DWORD biCompression;
+ DWORD biSizeImage;
+ LONG biXPelsPerMeter;
+ LONG biYPelsPerMeter;
+ DWORD biClrUsed;
+ DWORD biClrImportant;
+} BITMAPINFOHEADER, *PBITMAPINFOHEADER;
+
+// @raysan5: Some required types defined for TinyC compiler
+#if defined(__TINYC__)
+ #include "propidl.h"
+#endif
+//----------------------------------------------------------------------------------
+
#else
#include <stdlib.h> // For malloc()/free()
#include <string.h> // For memset()
diff --git a/src/libraylib.a b/src/libraylib.a
index 223fbf0d..4ba420da 100644
--- a/src/libraylib.a
+++ b/src/libraylib.a
Binary files differ
diff --git a/src/raudio.c b/src/raudio.c
index 1194e76a..53f3f25f 100644
--- a/src/raudio.c
+++ b/src/raudio.c
@@ -26,12 +26,12 @@
* supported by default, to remove support, just comment unrequired #define in this module
*
* DEPENDENCIES:
-* mini_al - Audio device/context management (https://github.com/dr-soft/mini_al)
-* stb_vorbis - OGG audio files loading (http://www.nothings.org/stb_vorbis/)
-* jar_xm - XM module file loading
-* jar_mod - MOD audio file loading
-* dr_flac - FLAC audio file loading
-* dr_mp3 - MP3 audio file loading
+* mini_al.h - Audio device management lib (https://github.com/dr-soft/mini_al)
+* stb_vorbis.h - Ogg audio files loading (http://www.nothings.org/stb_vorbis/)
+* dr_mp3.h - MP3 audio file loading (https://github.com/mackron/dr_libs)
+* dr_flac.h - FLAC audio file loading (https://github.com/mackron/dr_libs)
+* jar_xm.h - XM module file loading
+* jar_mod.h - MOD audio file loading
*
* CONTRIBUTORS:
* David Reid (github: @mackron) (Nov. 2017):
@@ -77,9 +77,12 @@
#include "utils.h" // Required for: fopen() Android mapping
#endif
+#define MAL_NO_SDL
+#define MAL_NO_JACK
+#define MAL_NO_OPENAL
+#define MINI_AL_IMPLEMENTATION
#include "external/mini_al.h" // mini_al audio library
- // NOTE: Cannot be implement here because it conflicts with
- // Win32 APIs: Rectangle, CloseWindow(), ShowCursor(), PlaySoundA()
+#undef PlaySound // Win32 API: windows.h > mmsystem.h defines PlaySound macro
#include <stdlib.h> // Required for: malloc(), free()
#include <string.h> // Required for: strcmp(), strncmp()
@@ -915,9 +918,13 @@ void ExportWaveAsCode(Wave wave, const char *fileName)
fprintf(txtFile, "// //\n");
fprintf(txtFile, "//////////////////////////////////////////////////////////////////////////////////\n\n");
+#if !defined(RAUDIO_STANDALONE)
// Get file name from path and convert variable name to uppercase
strcpy(varFileName, GetFileNameWithoutExt(fileName));
for (int i = 0; varFileName[i] != '\0'; i++) if (varFileName[i] >= 'a' && varFileName[i] <= 'z') { varFileName[i] = varFileName[i] - 32; }
+#else
+ strcpy(varFileName, fileName);
+#endif
fprintf(txtFile, "// Wave data information\n");
fprintf(txtFile, "#define %s_SAMPLE_COUNT %i\n", varFileName, wave.sampleCount);
diff --git a/src/raudio.h b/src/raudio.h
index 24669d76..f9c22ff2 100644
--- a/src/raudio.h
+++ b/src/raudio.h
@@ -11,12 +11,12 @@
* - Manage raw audio context
*
* DEPENDENCIES:
-* mini_al - Audio device/context management (https://github.com/dr-soft/mini_al)
-* stb_vorbis - OGG audio files loading (http://www.nothings.org/stb_vorbis/)
-* jar_xm - XM module file loading
-* jar_mod - MOD audio file loading
-* dr_flac - FLAC audio file loading
-* dr_mp3 - MP3 audio file loading
+* mini_al.h - Audio device management lib (https://github.com/dr-soft/mini_al)
+* stb_vorbis.h - Ogg audio files loading (http://www.nothings.org/stb_vorbis/)
+* dr_mp3.h - MP3 audio file loading (https://github.com/mackron/dr_libs)
+* dr_flac.h - FLAC audio file loading (https://github.com/mackron/dr_libs)
+* jar_xm.h - XM module file loading
+* jar_mod.h - MOD audio file loading
*
* CONTRIBUTORS:
* David Reid (github: @mackron) (Nov. 2017):