Commit e03d7985 authored by David Reid's avatar David Reid

Add compile-time and run-time version querying.

This adds the following:
  * MA_VERSION_MINOR
  * MA_VERSION_MAJOR
  * MA_VERSION_REVISION
  * MA_VERSION_STRING
  * ma_version()
  * ma_version_string()

Public issue https://github.com/dr-soft/miniaudio/issues/156
parent d429df4e
...@@ -1459,6 +1459,14 @@ Miscellaneous Notes ...@@ -1459,6 +1459,14 @@ Miscellaneous Notes
extern "C" { extern "C" {
#endif #endif
#define MA_STRINGIFY(x) #x
#define MA_XSTRINGIFY(x) MA_STRINGIFY(x)
#define MA_VERSION_MAJOR 0
#define MA_VERSION_MINOR 10
#define MA_VERSION_REVISION 6
#define MA_VERSION_STRING MA_XSTRINGIFY(MA_VERSION_MAJOR) "." MA_XSTRINGIFY(MA_VERSION_MINOR) "." MA_XSTRINGIFY(MA_VERSION_REVISION)
#if defined(_MSC_VER) && !defined(__clang__) #if defined(_MSC_VER) && !defined(__clang__)
#pragma warning(push) #pragma warning(push)
#pragma warning(disable:4201) /* nonstandard extension used: nameless struct/union */ #pragma warning(disable:4201) /* nonstandard extension used: nameless struct/union */
...@@ -1891,6 +1899,17 @@ typedef struct ...@@ -1891,6 +1899,17 @@ typedef struct
} ma_lcg; } ma_lcg;
/*
Retrieves the version of miniaudio as separated integers. Each component can be NULL if it's not required.
*/
MA_API void ma_version(ma_uint32* pMajor, ma_uint32* pMinor, ma_uint32* pRevision);
/*
Retrieves the version of miniaudio as a string which can be useful for logging purposes.
*/
MA_API const char* ma_version_string();
/************************************************************************************************************************************************************** /**************************************************************************************************************************************************************
Biquad Filtering Biquad Filtering
...@@ -6017,6 +6036,27 @@ static ma_format g_maFormatPriorities[] = { ...@@ -6017,6 +6036,27 @@ static ma_format g_maFormatPriorities[] = {
#endif #endif
MA_API void ma_version(ma_uint32* pMajor, ma_uint32* pMinor, ma_uint32* pRevision)
{
if (pMajor) {
*pMajor = MA_VERSION_MAJOR;
}
if (pMinor) {
*pMinor = MA_VERSION_MINOR;
}
if (pRevision) {
*pRevision = MA_VERSION_REVISION;
}
}
MA_API const char* ma_version_string()
{
return MA_VERSION_STRING;
}
/****************************************************************************** /******************************************************************************
Standard Library Stuff Standard Library Stuff
...@@ -42492,6 +42532,13 @@ REVISION HISTORY ...@@ -42492,6 +42532,13 @@ REVISION HISTORY
================ ================
v0.10.6 - TBD v0.10.6 - TBD
- Change ma_clip_samples_f32() and ma_clip_pcm_frames_f32() to take a 64-bit sample/frame count. - Change ma_clip_samples_f32() and ma_clip_pcm_frames_f32() to take a 64-bit sample/frame count.
- Add compile-time and run-time version querying.
- MA_VERSION_MINOR
- MA_VERSION_MAJOR
- MA_VERSION_REVISION
- MA_VERSION_STRING
- ma_version()
- ma_version_string()
v0.10.5 - 2020-05-05 v0.10.5 - 2020-05-05
- Change ma_zero_pcm_frames() to take a 64-bit frame count. - Change ma_zero_pcm_frames() to take a 64-bit frame count.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment