diff --git a/examples/others/raudio_standalone.c b/examples/others/raudio_standalone.c index 930bde85..02720837 100644 --- a/examples/others/raudio_standalone.c +++ b/examples/others/raudio_standalone.c @@ -5,17 +5,17 @@ * NOTE: This example does not require any graphic device, it can run directly on console. * * DEPENDENCIES: -* mini_al.h - Audio device management lib (http://kcat.strangesoft.net/openal.html) +* 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 -* dr_flac.h - FLAC audio file loading * * COMPILATION: -* gcc -c ..\..\src\external\mini_al.c -Wall -I. -* gcc -o audio_standalone.exe audio_standalone.c ..\..\src\raudio.c mini_al.o / -* -I..\..\src -I..\..\src\external -L. -Wall -std=c99 / -* -DAUDIO_STANDALONE -DSUPPORT_FILEFORMAT_WAV -DSUPPORT_FILEFORMAT_OGG +* gcc -o raudio_standalone.exe raudio_standalone.c ..\..\src\raudio.c / +* -I..\..\src -I..\..\src\external -L. -Wall -std=c99 -DRAUDIO_STANDALONE / +* -DSUPPORT_FILEFORMAT_WAV -DSUPPORT_FILEFORMAT_OGG -DSUPPORT_FILEFORMAT_MP3 * * LICENSE: zlib/libpng * diff --git a/projects/Geany/raylib_compile_sources.bat b/projects/Geany/raylib_compile_sources.bat index 708873c2..f0090990 100644 --- a/projects/Geany/raylib_compile_sources.bat +++ b/projects/Geany/raylib_compile_sources.bat @@ -24,13 +24,12 @@ gcc -O2 -c textures.c -std=c99 -Wall -DPLATFORM_DESKTOP gcc -O2 -c text.c -std=c99 -Wall -DPLATFORM_DESKTOP gcc -O2 -c models.c -std=c99 -Wall -DPLATFORM_DESKTOP gcc -O2 -c raudio.c -std=c99 -Wall -DPLATFORM_DESKTOP -gcc -O2 -c external/mini_al.c -Wall -I. gcc -O2 -c utils.c -std=c99 -Wall -DPLATFORM_DESKTOP :: . :: . > Generate raylib library :: ------------------------------ -ar rcs libraylib.a core.o rglfw.o shapes.o textures.o text.o models.o raudio.o mini_al.o utils.o +ar rcs libraylib.a core.o rglfw.o shapes.o textures.o text.o models.o raudio.o utils.o :: . :: > Installing raylib library :: ----------------------------- diff --git a/projects/Notepad++/npes_saved_mingw.txt b/projects/Notepad++/npes_saved_mingw.txt index 6d10a1b0..41e25823 100644 Binary files a/projects/Notepad++/npes_saved_mingw.txt and b/projects/Notepad++/npes_saved_mingw.txt differ diff --git a/projects/Notepad++/npes_saved_tcc.txt b/projects/Notepad++/npes_saved_tcc.txt index 32d72c2f..419e4af6 100644 Binary files a/projects/Notepad++/npes_saved_tcc.txt and b/projects/Notepad++/npes_saved_tcc.txt differ diff --git a/projects/VS2015/raylib/raylib.vcxproj b/projects/VS2015/raylib/raylib.vcxproj index 5d592146..2c63f382 100644 --- a/projects/VS2015/raylib/raylib.vcxproj +++ b/projects/VS2015/raylib/raylib.vcxproj @@ -232,9 +232,8 @@ - + - @@ -247,6 +246,7 @@ + diff --git a/projects/VS2017/raylib/raylib.vcxproj b/projects/VS2017/raylib/raylib.vcxproj index df745e16..8db1e511 100644 --- a/projects/VS2017/raylib/raylib.vcxproj +++ b/projects/VS2017/raylib/raylib.vcxproj @@ -159,9 +159,8 @@ - + - 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 + +// 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 // For malloc()/free() #include // For memset() diff --git a/src/libraylib.a b/src/libraylib.a index 223fbf0d..4ba420da 100644 Binary files a/src/libraylib.a and b/src/libraylib.a 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 // Required for: malloc(), free() #include // 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):