// The implementation of this library will try #include-ing necessary headers for each backend. If you do not have
// the development packages for any particular backend you can disable it by #define-ing the appropriate MAL_NO_*
// option before #include-ing the implementation.
// option before the implementation.
//
//
// Building (Windows)
...
...
@@ -128,6 +129,9 @@
// #define MAL_NO_WASAPI
// Disables the WASAPI backend.
//
// #define MAL_NO_WINMM
// Disables the WinMM backend.
//
// #define MAL_NO_ALSA
// Disables the ALSA backend.
//
...
...
@@ -335,12 +339,13 @@ typedef int mal_result;
#define MAL_FAILED_TO_READ_DATA_FROM_DEVICE -17
#define MAL_FAILED_TO_SEND_DATA_TO_CLIENT -18
#define MAL_FAILED_TO_SEND_DATA_TO_DEVICE -19
#define MAL_FAILED_TO_START_BACKEND_DEVICE -20
#define MAL_FAILED_TO_STOP_BACKEND_DEVICE -21
#define MAL_FAILED_TO_CREATE_MUTEX -22
#define MAL_FAILED_TO_CREATE_EVENT -23
#define MAL_FAILED_TO_CREATE_THREAD -24
#define MAL_INVALID_DEVICE_CONFIG -25
#define MAL_FAILED_TO_OPEN_BACKEND_DEVICE -20
#define MAL_FAILED_TO_START_BACKEND_DEVICE -21
#define MAL_FAILED_TO_STOP_BACKEND_DEVICE -22
#define MAL_FAILED_TO_CREATE_MUTEX -23
#define MAL_FAILED_TO_CREATE_EVENT -24
#define MAL_FAILED_TO_CREATE_THREAD -25
#define MAL_INVALID_DEVICE_CONFIG -26
#define MAL_DSOUND_FAILED_TO_CREATE_DEVICE -1024
#define MAL_DSOUND_FAILED_TO_SET_COOP_LEVEL -1025
#define MAL_DSOUND_FAILED_TO_CREATE_BUFFER -1026
...
...
@@ -367,6 +372,7 @@ typedef enum
mal_backend_null,
mal_backend_wasapi,
mal_backend_dsound,
mal_backend_winmm,
mal_backend_alsa,
mal_backend_oss,
mal_backend_opensl,
...
...
@@ -399,31 +405,31 @@ typedef enum
typedefunion
{
#ifdef MAL_SUPPORT_WASAPI
wchar_twasapi[64];// WASAPI uses a wchar_t string for identification which is also annoyingly long...
wchar_twasapi[64];// WASAPI uses a wchar_t string for identification which is also annoyingly long...
#endif
#ifdef MAL_SUPPORT_DSOUND
mal_uint8dsound[16];// DirectSound uses a GUID for identification.
mal_uint8dsound[16];// DirectSound uses a GUID for identification.
#endif
#ifdef MAL_SUPPORT_WINMM
// TODO: Implement me.
/*UINT_PTR*/mal_uint32winmm;// When creating a device, WinMM expects a Win32 UINT_PTR for device identification. In practice it's actually just a UINT.
#endif
#ifdef MAL_SUPPORT_ALSA
charalsa[32];// ALSA uses a name string for identification.
charalsa[32];// ALSA uses a name string for identification.
#endif
#ifdef MAL_SUPPORT_COREAUDIO
// TODO: Implement me.
#endif
#ifdef MAL_SUPPORT_OSS
chaross[64];// "dev/dsp0", etc. "dev/dsp" for the default device.
chaross[64];// "dev/dsp0", etc. "dev/dsp" for the default device.
#endif
#ifdef MAL_SUPPORT_OPENSL
mal_uint32opensl;// OpenSL|ES uses a 32-bit unsigned integer for identification.
mal_uint32opensl;// OpenSL|ES uses a 32-bit unsigned integer for identification.
#endif
#ifdef MAL_SUPPORT_OPENAL
charopenal[256];// OpenAL seems to use human-readable device names as the ID.
charopenal[256];// OpenAL seems to use human-readable device names as the ID.
#endif
#ifdef MAL_SUPPORT_NULL
intnullbackend;// Always 0. TODO: Check that this is indeed always set to 0 or just undefined. If undefined, change this to always be 0.
intnullbackend;// Always 0. TODO: Check that this is indeed always set to 0 or just undefined. If undefined, change this to always be 0.
#endif
}mal_device_id;
...
...
@@ -552,7 +558,24 @@ typedef struct
#ifdef MAL_SUPPORT_WINMM
struct
{
int_unused;
/*HMODULE*/mal_handlehWinMM;
mal_procwaveOutGetNumDevs;
mal_procwaveOutGetDevCapsA;
mal_procwaveOutOpen;
mal_procwaveOutClose;
mal_procwaveOutPrepareHeader;
mal_procwaveOutUnprepareHeader;
mal_procwaveOutWrite;
mal_procwaveOutReset;
mal_procwaveInGetNumDevs;
mal_procwaveInGetDevCapsA;
mal_procwaveInOpen;
mal_procwaveInClose;
mal_procwaveInPrepareHeader;
mal_procwaveInUnprepareHeader;
mal_procwaveInAddBuffer;
mal_procwaveInStart;
mal_procwaveInReset;
}winmm;
#endif
#ifdef MAL_SUPPORT_ALSA
...
...
@@ -756,7 +779,15 @@ struct mal_device
#ifdef MAL_SUPPORT_WINMM
struct
{
int_unused;
/*HWAVEOUT, HWAVEIN*/mal_handlehDevice;
/*HANDLE*/mal_handlehEvent;
mal_uint32fragmentSizeInFrames;
mal_uint32fragmentSizeInBytes;
mal_uint32iNextHeader;// [0,periods). Used as an index into pWAVEHDR.
/*WAVEHDR**/mal_uint8*pWAVEHDR;// One instantiation for each period.
mal_uint8*pIntermediaryBuffer;
mal_uint8*_pHeapData;// Used internally and is used for the heap allocated data for the intermediary buffer and the WAVEHDR structures.
mal_bool32breakFromMainLoop;
}winmm;
#endif
#ifdef MAL_SUPPORT_ALSA
...
...
@@ -839,6 +870,7 @@ struct mal_device
// requirements. This can be null in which case it uses the default priority, which is as follows: