Include mini_al directly, no separate module

This commit is contained in:
Ray 2019-02-12 12:18:01 +01:00
parent e7466eb0c4
commit 944a388b1b
13 changed files with 103 additions and 41 deletions

View File

@ -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
*

View File

@ -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
:: -----------------------------

View File

@ -232,9 +232,8 @@
<Text Include="ReadMe.txt" />
</ItemGroup>
<ItemGroup>
<ClCompile Include="..\..\..\src\audio.c" />
<ClCompile Include="..\..\..\src\raudio.c" />
<ClCompile Include="..\..\..\src\core.c" />
<ClCompile Include="..\..\..\src\external\mini_al.c" />
<ClCompile Include="..\..\..\src\models.c" />
<ClCompile Include="..\..\..\src\rglfw.c" />
<ClCompile Include="..\..\..\src\shapes.c" />
@ -247,6 +246,7 @@
<ClInclude Include="..\..\..\src\external\glad.h" />
<ClInclude Include="..\..\..\src\external\jar_mod.h" />
<ClInclude Include="..\..\..\src\external\jar_xm.h" />
<ClInclude Include="..\..\..\src\external\mini_al.h" />
<ClInclude Include="..\..\..\src\external\stb_image.h" />
<ClInclude Include="..\..\..\src\external\stb_image_resize.h" />
<ClInclude Include="..\..\..\src\external\stb_image_write.h" />

View File

@ -159,9 +159,8 @@
<Text Include="ReadMe.txt" />
</ItemGroup>
<ItemGroup>
<ClCompile Include="..\..\..\src\audio.c" />
<ClCompile Include="..\..\..\src\raudio.c" />
<ClCompile Include="..\..\..\src\core.c" />
<ClCompile Include="..\..\..\src\external\mini_al.c" />
<ClCompile Include="..\..\..\src\models.c" />
<ClCompile Include="..\..\..\src\rglfw.c" />
<ClCompile Include="..\..\..\src\shapes.c" />

View File

@ -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)

View File

@ -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)

View File

@ -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"

View File

@ -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()

Binary file not shown.

View File

@ -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);

View File

@ -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):