mirror of
https://github.com/mackron/miniaudio.git
synced 2026-04-22 00:06:59 +02:00
Version 0.10.31
This commit is contained in:
+551
-485
File diff suppressed because it is too large
Load Diff
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
Audio playback and capture library. Choice of public domain or MIT-0. See license statements at the end of this file.
|
||||
miniaudio - v0.10.30 - 2021-01-10
|
||||
miniaudio - v0.10.31 - 2020-01-17
|
||||
|
||||
David Reid - mackron@gmail.com
|
||||
|
||||
@@ -20,7 +20,7 @@ extern "C" {
|
||||
|
||||
#define MA_VERSION_MAJOR 0
|
||||
#define MA_VERSION_MINOR 10
|
||||
#define MA_VERSION_REVISION 30
|
||||
#define MA_VERSION_REVISION 31
|
||||
#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__)
|
||||
@@ -213,6 +213,12 @@ MA_LOG_LEVEL_ERROR
|
||||
#define MA_LOG_LEVEL MA_LOG_LEVEL_ERROR
|
||||
#endif
|
||||
|
||||
/*
|
||||
An annotation for variables which must be used atomically. This doesn't actually do anything - it's
|
||||
just used as a way for humans to identify variables that should be used atomically.
|
||||
*/
|
||||
#define MA_ATOMIC
|
||||
|
||||
typedef struct ma_context ma_context;
|
||||
typedef struct ma_device ma_device;
|
||||
|
||||
@@ -569,7 +575,7 @@ typedef struct
|
||||
MA_API ma_result ma_biquad_init(const ma_biquad_config* pConfig, ma_biquad* pBQ);
|
||||
MA_API ma_result ma_biquad_reinit(const ma_biquad_config* pConfig, ma_biquad* pBQ);
|
||||
MA_API ma_result ma_biquad_process_pcm_frames(ma_biquad* pBQ, void* pFramesOut, const void* pFramesIn, ma_uint64 frameCount);
|
||||
MA_API ma_uint32 ma_biquad_get_latency(ma_biquad* pBQ);
|
||||
MA_API ma_uint32 ma_biquad_get_latency(const ma_biquad* pBQ);
|
||||
|
||||
|
||||
/**************************************************************************************************************************************************************
|
||||
@@ -600,7 +606,7 @@ typedef struct
|
||||
MA_API ma_result ma_lpf1_init(const ma_lpf1_config* pConfig, ma_lpf1* pLPF);
|
||||
MA_API ma_result ma_lpf1_reinit(const ma_lpf1_config* pConfig, ma_lpf1* pLPF);
|
||||
MA_API ma_result ma_lpf1_process_pcm_frames(ma_lpf1* pLPF, void* pFramesOut, const void* pFramesIn, ma_uint64 frameCount);
|
||||
MA_API ma_uint32 ma_lpf1_get_latency(ma_lpf1* pLPF);
|
||||
MA_API ma_uint32 ma_lpf1_get_latency(const ma_lpf1* pLPF);
|
||||
|
||||
typedef struct
|
||||
{
|
||||
@@ -610,7 +616,7 @@ typedef struct
|
||||
MA_API ma_result ma_lpf2_init(const ma_lpf2_config* pConfig, ma_lpf2* pLPF);
|
||||
MA_API ma_result ma_lpf2_reinit(const ma_lpf2_config* pConfig, ma_lpf2* pLPF);
|
||||
MA_API ma_result ma_lpf2_process_pcm_frames(ma_lpf2* pLPF, void* pFramesOut, const void* pFramesIn, ma_uint64 frameCount);
|
||||
MA_API ma_uint32 ma_lpf2_get_latency(ma_lpf2* pLPF);
|
||||
MA_API ma_uint32 ma_lpf2_get_latency(const ma_lpf2* pLPF);
|
||||
|
||||
|
||||
typedef struct
|
||||
@@ -638,7 +644,7 @@ typedef struct
|
||||
MA_API ma_result ma_lpf_init(const ma_lpf_config* pConfig, ma_lpf* pLPF);
|
||||
MA_API ma_result ma_lpf_reinit(const ma_lpf_config* pConfig, ma_lpf* pLPF);
|
||||
MA_API ma_result ma_lpf_process_pcm_frames(ma_lpf* pLPF, void* pFramesOut, const void* pFramesIn, ma_uint64 frameCount);
|
||||
MA_API ma_uint32 ma_lpf_get_latency(ma_lpf* pLPF);
|
||||
MA_API ma_uint32 ma_lpf_get_latency(const ma_lpf* pLPF);
|
||||
|
||||
|
||||
/**************************************************************************************************************************************************************
|
||||
@@ -669,7 +675,7 @@ typedef struct
|
||||
MA_API ma_result ma_hpf1_init(const ma_hpf1_config* pConfig, ma_hpf1* pHPF);
|
||||
MA_API ma_result ma_hpf1_reinit(const ma_hpf1_config* pConfig, ma_hpf1* pHPF);
|
||||
MA_API ma_result ma_hpf1_process_pcm_frames(ma_hpf1* pHPF, void* pFramesOut, const void* pFramesIn, ma_uint64 frameCount);
|
||||
MA_API ma_uint32 ma_hpf1_get_latency(ma_hpf1* pHPF);
|
||||
MA_API ma_uint32 ma_hpf1_get_latency(const ma_hpf1* pHPF);
|
||||
|
||||
typedef struct
|
||||
{
|
||||
@@ -679,7 +685,7 @@ typedef struct
|
||||
MA_API ma_result ma_hpf2_init(const ma_hpf2_config* pConfig, ma_hpf2* pHPF);
|
||||
MA_API ma_result ma_hpf2_reinit(const ma_hpf2_config* pConfig, ma_hpf2* pHPF);
|
||||
MA_API ma_result ma_hpf2_process_pcm_frames(ma_hpf2* pHPF, void* pFramesOut, const void* pFramesIn, ma_uint64 frameCount);
|
||||
MA_API ma_uint32 ma_hpf2_get_latency(ma_hpf2* pHPF);
|
||||
MA_API ma_uint32 ma_hpf2_get_latency(const ma_hpf2* pHPF);
|
||||
|
||||
|
||||
typedef struct
|
||||
@@ -707,7 +713,7 @@ typedef struct
|
||||
MA_API ma_result ma_hpf_init(const ma_hpf_config* pConfig, ma_hpf* pHPF);
|
||||
MA_API ma_result ma_hpf_reinit(const ma_hpf_config* pConfig, ma_hpf* pHPF);
|
||||
MA_API ma_result ma_hpf_process_pcm_frames(ma_hpf* pHPF, void* pFramesOut, const void* pFramesIn, ma_uint64 frameCount);
|
||||
MA_API ma_uint32 ma_hpf_get_latency(ma_hpf* pHPF);
|
||||
MA_API ma_uint32 ma_hpf_get_latency(const ma_hpf* pHPF);
|
||||
|
||||
|
||||
/**************************************************************************************************************************************************************
|
||||
@@ -734,7 +740,7 @@ typedef struct
|
||||
MA_API ma_result ma_bpf2_init(const ma_bpf2_config* pConfig, ma_bpf2* pBPF);
|
||||
MA_API ma_result ma_bpf2_reinit(const ma_bpf2_config* pConfig, ma_bpf2* pBPF);
|
||||
MA_API ma_result ma_bpf2_process_pcm_frames(ma_bpf2* pBPF, void* pFramesOut, const void* pFramesIn, ma_uint64 frameCount);
|
||||
MA_API ma_uint32 ma_bpf2_get_latency(ma_bpf2* pBPF);
|
||||
MA_API ma_uint32 ma_bpf2_get_latency(const ma_bpf2* pBPF);
|
||||
|
||||
|
||||
typedef struct
|
||||
@@ -759,7 +765,7 @@ typedef struct
|
||||
MA_API ma_result ma_bpf_init(const ma_bpf_config* pConfig, ma_bpf* pBPF);
|
||||
MA_API ma_result ma_bpf_reinit(const ma_bpf_config* pConfig, ma_bpf* pBPF);
|
||||
MA_API ma_result ma_bpf_process_pcm_frames(ma_bpf* pBPF, void* pFramesOut, const void* pFramesIn, ma_uint64 frameCount);
|
||||
MA_API ma_uint32 ma_bpf_get_latency(ma_bpf* pBPF);
|
||||
MA_API ma_uint32 ma_bpf_get_latency(const ma_bpf* pBPF);
|
||||
|
||||
|
||||
/**************************************************************************************************************************************************************
|
||||
@@ -786,7 +792,7 @@ typedef struct
|
||||
MA_API ma_result ma_notch2_init(const ma_notch2_config* pConfig, ma_notch2* pFilter);
|
||||
MA_API ma_result ma_notch2_reinit(const ma_notch2_config* pConfig, ma_notch2* pFilter);
|
||||
MA_API ma_result ma_notch2_process_pcm_frames(ma_notch2* pFilter, void* pFramesOut, const void* pFramesIn, ma_uint64 frameCount);
|
||||
MA_API ma_uint32 ma_notch2_get_latency(ma_notch2* pFilter);
|
||||
MA_API ma_uint32 ma_notch2_get_latency(const ma_notch2* pFilter);
|
||||
|
||||
|
||||
/**************************************************************************************************************************************************************
|
||||
@@ -814,7 +820,7 @@ typedef struct
|
||||
MA_API ma_result ma_peak2_init(const ma_peak2_config* pConfig, ma_peak2* pFilter);
|
||||
MA_API ma_result ma_peak2_reinit(const ma_peak2_config* pConfig, ma_peak2* pFilter);
|
||||
MA_API ma_result ma_peak2_process_pcm_frames(ma_peak2* pFilter, void* pFramesOut, const void* pFramesIn, ma_uint64 frameCount);
|
||||
MA_API ma_uint32 ma_peak2_get_latency(ma_peak2* pFilter);
|
||||
MA_API ma_uint32 ma_peak2_get_latency(const ma_peak2* pFilter);
|
||||
|
||||
|
||||
/**************************************************************************************************************************************************************
|
||||
@@ -842,7 +848,7 @@ typedef struct
|
||||
MA_API ma_result ma_loshelf2_init(const ma_loshelf2_config* pConfig, ma_loshelf2* pFilter);
|
||||
MA_API ma_result ma_loshelf2_reinit(const ma_loshelf2_config* pConfig, ma_loshelf2* pFilter);
|
||||
MA_API ma_result ma_loshelf2_process_pcm_frames(ma_loshelf2* pFilter, void* pFramesOut, const void* pFramesIn, ma_uint64 frameCount);
|
||||
MA_API ma_uint32 ma_loshelf2_get_latency(ma_loshelf2* pFilter);
|
||||
MA_API ma_uint32 ma_loshelf2_get_latency(const ma_loshelf2* pFilter);
|
||||
|
||||
|
||||
/**************************************************************************************************************************************************************
|
||||
@@ -870,7 +876,7 @@ typedef struct
|
||||
MA_API ma_result ma_hishelf2_init(const ma_hishelf2_config* pConfig, ma_hishelf2* pFilter);
|
||||
MA_API ma_result ma_hishelf2_reinit(const ma_hishelf2_config* pConfig, ma_hishelf2* pFilter);
|
||||
MA_API ma_result ma_hishelf2_process_pcm_frames(ma_hishelf2* pFilter, void* pFramesOut, const void* pFramesIn, ma_uint64 frameCount);
|
||||
MA_API ma_uint32 ma_hishelf2_get_latency(ma_hishelf2* pFilter);
|
||||
MA_API ma_uint32 ma_hishelf2_get_latency(const ma_hishelf2* pFilter);
|
||||
|
||||
|
||||
|
||||
@@ -927,10 +933,10 @@ MA_API void ma_linear_resampler_uninit(ma_linear_resampler* pResampler);
|
||||
MA_API ma_result ma_linear_resampler_process_pcm_frames(ma_linear_resampler* pResampler, const void* pFramesIn, ma_uint64* pFrameCountIn, void* pFramesOut, ma_uint64* pFrameCountOut);
|
||||
MA_API ma_result ma_linear_resampler_set_rate(ma_linear_resampler* pResampler, ma_uint32 sampleRateIn, ma_uint32 sampleRateOut);
|
||||
MA_API ma_result ma_linear_resampler_set_rate_ratio(ma_linear_resampler* pResampler, float ratioInOut);
|
||||
MA_API ma_uint64 ma_linear_resampler_get_required_input_frame_count(ma_linear_resampler* pResampler, ma_uint64 outputFrameCount);
|
||||
MA_API ma_uint64 ma_linear_resampler_get_expected_output_frame_count(ma_linear_resampler* pResampler, ma_uint64 inputFrameCount);
|
||||
MA_API ma_uint64 ma_linear_resampler_get_input_latency(ma_linear_resampler* pResampler);
|
||||
MA_API ma_uint64 ma_linear_resampler_get_output_latency(ma_linear_resampler* pResampler);
|
||||
MA_API ma_uint64 ma_linear_resampler_get_required_input_frame_count(const ma_linear_resampler* pResampler, ma_uint64 outputFrameCount);
|
||||
MA_API ma_uint64 ma_linear_resampler_get_expected_output_frame_count(const ma_linear_resampler* pResampler, ma_uint64 inputFrameCount);
|
||||
MA_API ma_uint64 ma_linear_resampler_get_input_latency(const ma_linear_resampler* pResampler);
|
||||
MA_API ma_uint64 ma_linear_resampler_get_output_latency(const ma_linear_resampler* pResampler);
|
||||
|
||||
typedef enum
|
||||
{
|
||||
@@ -1026,24 +1032,24 @@ number of output frames.
|
||||
The returned value does not include cached input frames. It only returns the number of extra frames that would need to be
|
||||
read from the input buffer in order to output the specified number of output frames.
|
||||
*/
|
||||
MA_API ma_uint64 ma_resampler_get_required_input_frame_count(ma_resampler* pResampler, ma_uint64 outputFrameCount);
|
||||
MA_API ma_uint64 ma_resampler_get_required_input_frame_count(const ma_resampler* pResampler, ma_uint64 outputFrameCount);
|
||||
|
||||
/*
|
||||
Calculates the number of whole output frames that would be output after fully reading and consuming the specified number of
|
||||
input frames.
|
||||
*/
|
||||
MA_API ma_uint64 ma_resampler_get_expected_output_frame_count(ma_resampler* pResampler, ma_uint64 inputFrameCount);
|
||||
MA_API ma_uint64 ma_resampler_get_expected_output_frame_count(const ma_resampler* pResampler, ma_uint64 inputFrameCount);
|
||||
|
||||
|
||||
/*
|
||||
Retrieves the latency introduced by the resampler in input frames.
|
||||
*/
|
||||
MA_API ma_uint64 ma_resampler_get_input_latency(ma_resampler* pResampler);
|
||||
MA_API ma_uint64 ma_resampler_get_input_latency(const ma_resampler* pResampler);
|
||||
|
||||
/*
|
||||
Retrieves the latency introduced by the resampler in output frames.
|
||||
*/
|
||||
MA_API ma_uint64 ma_resampler_get_output_latency(ma_resampler* pResampler);
|
||||
MA_API ma_uint64 ma_resampler_get_output_latency(const ma_resampler* pResampler);
|
||||
|
||||
|
||||
|
||||
@@ -1144,10 +1150,10 @@ MA_API void ma_data_converter_uninit(ma_data_converter* pConverter);
|
||||
MA_API ma_result ma_data_converter_process_pcm_frames(ma_data_converter* pConverter, const void* pFramesIn, ma_uint64* pFrameCountIn, void* pFramesOut, ma_uint64* pFrameCountOut);
|
||||
MA_API ma_result ma_data_converter_set_rate(ma_data_converter* pConverter, ma_uint32 sampleRateIn, ma_uint32 sampleRateOut);
|
||||
MA_API ma_result ma_data_converter_set_rate_ratio(ma_data_converter* pConverter, float ratioInOut);
|
||||
MA_API ma_uint64 ma_data_converter_get_required_input_frame_count(ma_data_converter* pConverter, ma_uint64 outputFrameCount);
|
||||
MA_API ma_uint64 ma_data_converter_get_expected_output_frame_count(ma_data_converter* pConverter, ma_uint64 inputFrameCount);
|
||||
MA_API ma_uint64 ma_data_converter_get_input_latency(ma_data_converter* pConverter);
|
||||
MA_API ma_uint64 ma_data_converter_get_output_latency(ma_data_converter* pConverter);
|
||||
MA_API ma_uint64 ma_data_converter_get_required_input_frame_count(const ma_data_converter* pConverter, ma_uint64 outputFrameCount);
|
||||
MA_API ma_uint64 ma_data_converter_get_expected_output_frame_count(const ma_data_converter* pConverter, ma_uint64 inputFrameCount);
|
||||
MA_API ma_uint64 ma_data_converter_get_input_latency(const ma_data_converter* pConverter);
|
||||
MA_API ma_uint64 ma_data_converter_get_output_latency(const ma_data_converter* pConverter);
|
||||
|
||||
|
||||
/************************************************************************************************************************************************************
|
||||
@@ -1292,10 +1298,10 @@ typedef struct
|
||||
ma_uint32 subbufferSizeInBytes;
|
||||
ma_uint32 subbufferCount;
|
||||
ma_uint32 subbufferStrideInBytes;
|
||||
volatile ma_uint32 encodedReadOffset; /* Most significant bit is the loop flag. Lower 31 bits contains the actual offset in bytes. */
|
||||
volatile ma_uint32 encodedWriteOffset; /* Most significant bit is the loop flag. Lower 31 bits contains the actual offset in bytes. */
|
||||
ma_bool8 ownsBuffer; /* Used to know whether or not miniaudio is responsible for free()-ing the buffer. */
|
||||
ma_bool8 clearOnWriteAcquire; /* When set, clears the acquired write buffer before returning from ma_rb_acquire_write(). */
|
||||
MA_ATOMIC ma_uint32 encodedReadOffset; /* Most significant bit is the loop flag. Lower 31 bits contains the actual offset in bytes. Must be used atomically. */
|
||||
MA_ATOMIC ma_uint32 encodedWriteOffset; /* Most significant bit is the loop flag. Lower 31 bits contains the actual offset in bytes. Must be used atomically. */
|
||||
ma_bool8 ownsBuffer; /* Used to know whether or not miniaudio is responsible for free()-ing the buffer. */
|
||||
ma_bool8 clearOnWriteAcquire; /* When set, clears the acquired write buffer before returning from ma_rb_acquire_write(). */
|
||||
ma_allocation_callbacks allocationCallbacks;
|
||||
} ma_rb;
|
||||
|
||||
@@ -1486,50 +1492,50 @@ This section contains the APIs for device playback and capture. Here is where yo
|
||||
#endif
|
||||
|
||||
|
||||
#if !defined(MA_NO_WASAPI) && defined(MA_SUPPORT_WASAPI)
|
||||
#define MA_ENABLE_WASAPI
|
||||
#if defined(MA_SUPPORT_WASAPI) && !defined(MA_NO_WASAPI) && (!defined(MA_ENABLE_ONLY_SPECIFIC_BACKENDS) || defined(MA_ENABLE_WASAPI))
|
||||
#define MA_HAS_WASAPI
|
||||
#endif
|
||||
#if !defined(MA_NO_DSOUND) && defined(MA_SUPPORT_DSOUND)
|
||||
#define MA_ENABLE_DSOUND
|
||||
#if defined(MA_SUPPORT_DSOUND) && !defined(MA_NO_DSOUND) && (!defined(MA_ENABLE_ONLY_SPECIFIC_BACKENDS) || defined(MA_ENABLE_DSOUND))
|
||||
#define MA_HAS_DSOUND
|
||||
#endif
|
||||
#if !defined(MA_NO_WINMM) && defined(MA_SUPPORT_WINMM)
|
||||
#define MA_ENABLE_WINMM
|
||||
#if defined(MA_SUPPORT_WINMM) && !defined(MA_NO_WINMM) && (!defined(MA_ENABLE_ONLY_SPECIFIC_BACKENDS) || defined(MA_ENABLE_WINMM))
|
||||
#define MA_HAS_WINMM
|
||||
#endif
|
||||
#if !defined(MA_NO_ALSA) && defined(MA_SUPPORT_ALSA)
|
||||
#define MA_ENABLE_ALSA
|
||||
#if defined(MA_SUPPORT_ALSA) && !defined(MA_NO_ALSA) && (!defined(MA_ENABLE_ONLY_SPECIFIC_BACKENDS) || defined(MA_ENABLE_ALSA))
|
||||
#define MA_HAS_ALSA
|
||||
#endif
|
||||
#if !defined(MA_NO_PULSEAUDIO) && defined(MA_SUPPORT_PULSEAUDIO)
|
||||
#define MA_ENABLE_PULSEAUDIO
|
||||
#if defined(MA_SUPPORT_PULSEAUDIO) && !defined(MA_NO_PULSEAUDIO) && (!defined(MA_ENABLE_ONLY_SPECIFIC_BACKENDS) || defined(MA_ENABLE_PULSEAUDIO))
|
||||
#define MA_HAS_PULSEAUDIO
|
||||
#endif
|
||||
#if !defined(MA_NO_JACK) && defined(MA_SUPPORT_JACK)
|
||||
#define MA_ENABLE_JACK
|
||||
#if defined(MA_SUPPORT_JACK) && !defined(MA_NO_JACK) && (!defined(MA_ENABLE_ONLY_SPECIFIC_BACKENDS) || defined(MA_ENABLE_JACK))
|
||||
#define MA_HAS_JACK
|
||||
#endif
|
||||
#if !defined(MA_NO_COREAUDIO) && defined(MA_SUPPORT_COREAUDIO)
|
||||
#define MA_ENABLE_COREAUDIO
|
||||
#if defined(MA_SUPPORT_COREAUDIO) && !defined(MA_NO_COREAUDIO) && (!defined(MA_ENABLE_ONLY_SPECIFIC_BACKENDS) || defined(MA_ENABLE_COREAUDIO))
|
||||
#define MA_HAS_COREAUDIO
|
||||
#endif
|
||||
#if !defined(MA_NO_SNDIO) && defined(MA_SUPPORT_SNDIO)
|
||||
#define MA_ENABLE_SNDIO
|
||||
#if defined(MA_SUPPORT_SNDIO) && !defined(MA_NO_SNDIO) && (!defined(MA_ENABLE_ONLY_SPECIFIC_BACKENDS) || defined(MA_ENABLE_SNDIO))
|
||||
#define MA_HAS_SNDIO
|
||||
#endif
|
||||
#if !defined(MA_NO_AUDIO4) && defined(MA_SUPPORT_AUDIO4)
|
||||
#define MA_ENABLE_AUDIO4
|
||||
#if defined(MA_SUPPORT_AUDIO4) && !defined(MA_NO_AUDIO4) && (!defined(MA_ENABLE_ONLY_SPECIFIC_BACKENDS) || defined(MA_ENABLE_AUDIO4))
|
||||
#define MA_HAS_AUDIO4
|
||||
#endif
|
||||
#if !defined(MA_NO_OSS) && defined(MA_SUPPORT_OSS)
|
||||
#define MA_ENABLE_OSS
|
||||
#if defined(MA_SUPPORT_OSS) && !defined(MA_NO_OSS) && (!defined(MA_ENABLE_ONLY_SPECIFIC_BACKENDS) || defined(MA_ENABLE_OSS))
|
||||
#define MA_HAS_OSS
|
||||
#endif
|
||||
#if !defined(MA_NO_AAUDIO) && defined(MA_SUPPORT_AAUDIO)
|
||||
#define MA_ENABLE_AAUDIO
|
||||
#if defined(MA_SUPPORT_AAUDIO) && !defined(MA_NO_AAUDIO) && (!defined(MA_ENABLE_ONLY_SPECIFIC_BACKENDS) || defined(MA_ENABLE_AAUDIO))
|
||||
#define MA_HAS_AAUDIO
|
||||
#endif
|
||||
#if !defined(MA_NO_OPENSL) && defined(MA_SUPPORT_OPENSL)
|
||||
#define MA_ENABLE_OPENSL
|
||||
#if defined(MA_SUPPORT_OPENSL) && !defined(MA_NO_OPENSL) && (!defined(MA_ENABLE_ONLY_SPECIFIC_BACKENDS) || defined(MA_ENABLE_OPENSL))
|
||||
#define MA_HAS_OPENSL
|
||||
#endif
|
||||
#if !defined(MA_NO_WEBAUDIO) && defined(MA_SUPPORT_WEBAUDIO)
|
||||
#define MA_ENABLE_WEBAUDIO
|
||||
#if defined(MA_SUPPORT_WEBAUDIO) && !defined(MA_NO_WEBAUDIO) && (!defined(MA_ENABLE_ONLY_SPECIFIC_BACKENDS) || defined(MA_ENABLE_WEBAUDIO))
|
||||
#define MA_HAS_WEBAUDIO
|
||||
#endif
|
||||
#if !defined(MA_NO_CUSTOM) && defined(MA_SUPPORT_CUSTOM)
|
||||
#define MA_ENABLE_CUSTOM
|
||||
#if defined(MA_SUPPORT_CUSTOM) && !defined(MA_NO_CUSTOM) && (!defined(MA_ENABLE_ONLY_SPECIFIC_BACKENDS) || defined(MA_ENABLE_CUSTOM))
|
||||
#define MA_HAS_CUSTOM
|
||||
#endif
|
||||
#if !defined(MA_NO_NULL) && defined(MA_SUPPORT_NULL)
|
||||
#define MA_ENABLE_NULL
|
||||
#if defined(MA_SUPPORT_NULL) && !defined(MA_NO_NULL) && (!defined(MA_ENABLE_ONLY_SPECIFIC_BACKENDS) || defined(MA_ENABLE_NULL))
|
||||
#define MA_HAS_NULL
|
||||
#endif
|
||||
|
||||
#define MA_STATE_UNINITIALIZED 0
|
||||
@@ -2481,7 +2487,7 @@ struct ma_device
|
||||
ma_context* pContext;
|
||||
ma_device_type type;
|
||||
ma_uint32 sampleRate;
|
||||
volatile ma_uint32 state; /* The state of the device is variable and can change at any time on any thread, so tell the compiler as such with `volatile`. */
|
||||
MA_ATOMIC ma_uint32 state; /* The state of the device is variable and can change at any time on any thread. Must be used atomically. */
|
||||
ma_device_callback_proc onData; /* Set once at initialization time and should not be changed after. */
|
||||
ma_stop_proc onStop; /* Set once at initialization time and should not be changed after. */
|
||||
void* pUserData; /* Application defined data. */
|
||||
@@ -2497,7 +2503,7 @@ struct ma_device
|
||||
ma_bool8 isOwnerOfContext; /* When set to true, uninitializing the device will also uninitialize the context. Set to true when NULL is passed into ma_device_init(). */
|
||||
ma_bool8 noPreZeroedOutputBuffer;
|
||||
ma_bool8 noClip;
|
||||
volatile float masterVolumeFactor; /* Volatile so we can use some thread safety when applying volume to periods. */
|
||||
MA_ATOMIC float masterVolumeFactor; /* Linear 0..1. Can be read and written simultaneously by different threads. Must be used atomically. */
|
||||
ma_duplex_rb duplexRB; /* Intermediary buffer for duplex device on asynchronous backends. */
|
||||
struct
|
||||
{
|
||||
@@ -2561,24 +2567,24 @@ struct ma_device
|
||||
/*IAudioClient**/ ma_ptr pAudioClientCapture;
|
||||
/*IAudioRenderClient**/ ma_ptr pRenderClient;
|
||||
/*IAudioCaptureClient**/ ma_ptr pCaptureClient;
|
||||
/*IMMDeviceEnumerator**/ ma_ptr pDeviceEnumerator; /* Used for IMMNotificationClient notifications. Required for detecting default device changes. */
|
||||
/*IMMDeviceEnumerator**/ ma_ptr pDeviceEnumerator; /* Used for IMMNotificationClient notifications. Required for detecting default device changes. */
|
||||
ma_IMMNotificationClient notificationClient;
|
||||
/*HANDLE*/ ma_handle hEventPlayback; /* Auto reset. Initialized to signaled. */
|
||||
/*HANDLE*/ ma_handle hEventCapture; /* Auto reset. Initialized to unsignaled. */
|
||||
ma_uint32 actualPeriodSizeInFramesPlayback; /* Value from GetBufferSize(). internalPeriodSizeInFrames is not set to the _actual_ buffer size when low-latency shared mode is being used due to the way the IAudioClient3 API works. */
|
||||
/*HANDLE*/ ma_handle hEventPlayback; /* Auto reset. Initialized to signaled. */
|
||||
/*HANDLE*/ ma_handle hEventCapture; /* Auto reset. Initialized to unsignaled. */
|
||||
ma_uint32 actualPeriodSizeInFramesPlayback; /* Value from GetBufferSize(). internalPeriodSizeInFrames is not set to the _actual_ buffer size when low-latency shared mode is being used due to the way the IAudioClient3 API works. */
|
||||
ma_uint32 actualPeriodSizeInFramesCapture;
|
||||
ma_uint32 originalPeriodSizeInFrames;
|
||||
ma_uint32 originalPeriodSizeInMilliseconds;
|
||||
ma_uint32 originalPeriods;
|
||||
ma_performance_profile originalPerformanceProfile;
|
||||
volatile ma_bool32 hasDefaultPlaybackDeviceChanged; /* <-- Make sure this is always a whole 32-bits because we use atomic assignments. */
|
||||
volatile ma_bool32 hasDefaultCaptureDeviceChanged; /* <-- Make sure this is always a whole 32-bits because we use atomic assignments. */
|
||||
ma_uint32 periodSizeInFramesPlayback;
|
||||
ma_uint32 periodSizeInFramesCapture;
|
||||
volatile ma_bool32 isStartedCapture; /* <-- Make sure this is always a whole 32-bits because we use atomic assignments. */
|
||||
volatile ma_bool32 isStartedPlayback; /* <-- Make sure this is always a whole 32-bits because we use atomic assignments. */
|
||||
ma_bool8 noAutoConvertSRC; /* When set to true, disables the use of AUDCLNT_STREAMFLAGS_AUTOCONVERTPCM. */
|
||||
ma_bool8 noDefaultQualitySRC; /* When set to true, disables the use of AUDCLNT_STREAMFLAGS_SRC_DEFAULT_QUALITY. */
|
||||
MA_ATOMIC ma_bool8 hasDefaultPlaybackDeviceChanged; /* Can be read and written simultaneously across different threads. Must be used atomically. */
|
||||
MA_ATOMIC ma_bool8 hasDefaultCaptureDeviceChanged; /* Can be read and written simultaneously across different threads. Must be used atomically. */
|
||||
MA_ATOMIC ma_bool8 isStartedCapture; /* Can be read and written simultaneously across different threads. Must be used atomically. */
|
||||
MA_ATOMIC ma_bool8 isStartedPlayback; /* Can be read and written simultaneously across different threads. Must be used atomically. */
|
||||
ma_bool8 noAutoConvertSRC; /* When set to true, disables the use of AUDCLNT_STREAMFLAGS_AUTOCONVERTPCM. */
|
||||
ma_bool8 noDefaultQualitySRC; /* When set to true, disables the use of AUDCLNT_STREAMFLAGS_SRC_DEFAULT_QUALITY. */
|
||||
ma_bool8 noHardwareOffloading;
|
||||
ma_bool8 allowCaptureAutoStreamRouting;
|
||||
ma_bool8 allowPlaybackAutoStreamRouting;
|
||||
@@ -2727,14 +2733,14 @@ struct ma_device
|
||||
ma_event operationCompletionEvent;
|
||||
ma_semaphore operationSemaphore;
|
||||
ma_uint32 operation;
|
||||
volatile ma_result operationResult;
|
||||
ma_result operationResult;
|
||||
ma_timer timer;
|
||||
double priorRunTime;
|
||||
ma_uint32 currentPeriodFramesRemainingPlayback;
|
||||
ma_uint32 currentPeriodFramesRemainingCapture;
|
||||
ma_uint64 lastProcessedFramePlayback;
|
||||
ma_uint64 lastProcessedFrameCapture;
|
||||
volatile ma_bool32 isStarted;
|
||||
MA_ATOMIC ma_bool8 isStarted; /* Read and written by multiple threads. Must be used atomically. */
|
||||
} null_device;
|
||||
#endif
|
||||
};
|
||||
@@ -4316,6 +4322,29 @@ MA_API ma_result ma_data_source_get_cursor_in_pcm_frames(ma_data_source* pDataSo
|
||||
MA_API ma_result ma_data_source_get_length_in_pcm_frames(ma_data_source* pDataSource, ma_uint64* pLength); /* Returns MA_NOT_IMPLEMENTED if the length is unknown or cannot be determined. Decoders can return this. */
|
||||
|
||||
|
||||
|
||||
|
||||
typedef struct
|
||||
{
|
||||
ma_data_source_callbacks ds;
|
||||
ma_format format;
|
||||
ma_uint32 channels;
|
||||
ma_uint64 cursor;
|
||||
ma_uint64 sizeInFrames;
|
||||
const void* pData;
|
||||
} ma_audio_buffer_ref;
|
||||
|
||||
MA_API ma_result ma_audio_buffer_ref_init(ma_format format, ma_uint32 channels, const void* pData, ma_uint64 sizeInFrames, ma_audio_buffer_ref* pAudioBufferRef);
|
||||
MA_API ma_result ma_audio_buffer_ref_set_data(ma_audio_buffer_ref* pAudioBufferRef, const void* pData, ma_uint64 sizeInFrames);
|
||||
MA_API ma_uint64 ma_audio_buffer_ref_read_pcm_frames(ma_audio_buffer_ref* pAudioBufferRef, void* pFramesOut, ma_uint64 frameCount, ma_bool32 loop);
|
||||
MA_API ma_result ma_audio_buffer_ref_seek_to_pcm_frame(ma_audio_buffer_ref* pAudioBufferRef, ma_uint64 frameIndex);
|
||||
MA_API ma_result ma_audio_buffer_ref_map(ma_audio_buffer_ref* pAudioBufferRef, void** ppFramesOut, ma_uint64* pFrameCount);
|
||||
MA_API ma_result ma_audio_buffer_ref_unmap(ma_audio_buffer_ref* pAudioBufferRef, ma_uint64 frameCount); /* Returns MA_AT_END if the end has been reached. This should be considered successful. */
|
||||
MA_API ma_result ma_audio_buffer_ref_at_end(ma_audio_buffer_ref* pAudioBufferRef);
|
||||
MA_API ma_result ma_audio_buffer_ref_get_available_frames(ma_audio_buffer_ref* pAudioBufferRef, ma_uint64* pAvailableFrames);
|
||||
|
||||
|
||||
|
||||
typedef struct
|
||||
{
|
||||
ma_format format;
|
||||
@@ -4329,12 +4358,7 @@ MA_API ma_audio_buffer_config ma_audio_buffer_config_init(ma_format format, ma_u
|
||||
|
||||
typedef struct
|
||||
{
|
||||
ma_data_source_callbacks ds;
|
||||
ma_format format;
|
||||
ma_uint32 channels;
|
||||
ma_uint64 cursor;
|
||||
ma_uint64 sizeInFrames;
|
||||
const void* pData;
|
||||
ma_audio_buffer_ref ref;
|
||||
ma_allocation_callbacks allocationCallbacks;
|
||||
ma_bool32 ownsData; /* Used to control whether or not miniaudio owns the data buffer. If set to true, pData will be freed in ma_audio_buffer_uninit(). */
|
||||
ma_uint8 _pExtraData[1]; /* For allocating a buffer with the memory located directly after the other memory of the structure. */
|
||||
|
||||
+2
-2
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
Audio playback and capture library. Choice of public domain or MIT-0. See license statements at the end of this file.
|
||||
miniaudio - v0.10.31 - TBD
|
||||
miniaudio - v0.10.31 - 2020-01-17
|
||||
|
||||
David Reid - mackron@gmail.com
|
||||
|
||||
@@ -64828,7 +64828,7 @@ The following miscellaneous changes have also been made.
|
||||
/*
|
||||
REVISION HISTORY
|
||||
================
|
||||
v0.10.31 - TBD
|
||||
v0.10.31 - 2020-01-17
|
||||
- Make some functions const correct.
|
||||
- Update ma_data_source_read_pcm_frames() to initialize pFramesRead to 0 for safety.
|
||||
- Add the MA_ATOMIC annotation for use with variables that should be used atomically and remove unnecessary volatile qualifiers.
|
||||
|
||||
Reference in New Issue
Block a user