From dc47af28f09705d28e9975867d7fad9a395f9163 Mon Sep 17 00:00:00 2001 From: skal Date: Mon, 2 Feb 2026 12:19:10 +0100 Subject: refactor(build): Centralize generated files and clean up project layout - Task A: Centralized all generated code (assets, timeline) into a single directory to create a single source of truth. - Task A: Isolated test asset generation into a temporary build directory, preventing pollution of the main source tree. - Task B: Vertically compacted all C/C++ source files by removing superfluous newlines. - Task C: Created a top-level README.md with project overview and file descriptions. - Task D: Moved non-essential documentation into a directory to reduce root-level clutter. --- third_party/glfw3webgpu/glfw3webgpu.c | 1 + third_party/miniaudio.h | 1090 --------------------------------- 2 files changed, 1 insertion(+), 1090 deletions(-) (limited to 'third_party') diff --git a/third_party/glfw3webgpu/glfw3webgpu.c b/third_party/glfw3webgpu/glfw3webgpu.c index a3f36e6..b605753 100644 --- a/third_party/glfw3webgpu/glfw3webgpu.c +++ b/third_party/glfw3webgpu/glfw3webgpu.c @@ -1,3 +1,4 @@ + /** * This is an extension of GLFW for WebGPU, abstracting away the details of * OS-specific operations. diff --git a/third_party/miniaudio.h b/third_party/miniaudio.h index 24e676b..e7904f2 100644 --- a/third_party/miniaudio.h +++ b/third_party/miniaudio.h @@ -35,7 +35,6 @@ config object can be initialized with logical defaults and new properties added breaking the API. The config object can be allocated on the stack and does not need to be maintained after initialization of the corresponding object. - 1.1. Low Level API ------------------ The low level API gives you access to the raw audio data of an audio device. It supports playback, @@ -273,7 +272,6 @@ internally the context is only tracked by it's pointer which means you must not of the `ma_context` object. If this is an issue, consider using `malloc()` to allocate memory for the context. - 1.2. High Level API ------------------- The high level API consists of three main parts: @@ -448,8 +446,6 @@ To check if a sound is currently playing, you can use `ma_sound_is_playing()`. T is at the end, use `ma_sound_at_end()`. Looping of a sound can be controlled with `ma_sound_set_looping()`. Use `ma_sound_is_looping()` to check whether or not the sound is looping. - - 2. Building =========== miniaudio should work cleanly out of the box without the need to download or install any @@ -465,7 +461,6 @@ Note that GCC and Clang require `-msse2`, `-mavx2`, etc. for SIMD optimizations. If you get errors about undefined references to `__sync_val_compare_and_swap_8`, `__atomic_load_8`, etc. you need to link with `-latomic`. - 2.1. Windows ------------ The Windows build should compile cleanly on all popular compilers without the need to configure any @@ -474,7 +469,6 @@ include paths nor link to any libraries. The UWP build may require linking to mmdevapi.lib if you get errors about an unresolved external symbol for `ActivateAudioInterfaceAsync()`. - 2.2. macOS and iOS ------------------ The macOS build should compile cleanly without the need to download any dependencies nor link to @@ -499,20 +493,17 @@ your entitlements.xcent file: See this discussion for more info: https://github.com/mackron/miniaudio/issues/203. - 2.3. Linux ---------- The Linux build only requires linking to `-ldl`, `-lpthread` and `-lm`. You do not need any development packages. You may need to link with `-latomic` if you're compiling for 32-bit ARM. - 2.4. BSD -------- The BSD build only requires linking to `-lpthread` and `-lm`. NetBSD uses audio(4), OpenBSD uses sndio and FreeBSD uses OSS. You may need to link with `-latomic` if you're compiling for 32-bit ARM. - 2.5. Android ------------ AAudio is the highest priority backend on Android. This should work out of the box without needing @@ -523,7 +514,6 @@ There have been reports that the OpenSL|ES backend fails to initialize on some A devices due to `dlopen()` failing to open "libOpenSLES.so". If this happens on your platform you'll need to disable run-time linking with `MA_NO_RUNTIME_LINKING` and link with -lOpenSLES. - 2.6. Emscripten --------------- The Emscripten build emits Web Audio JavaScript directly and should compile cleanly out of the box. @@ -542,8 +532,6 @@ To run locally, you'll need to use emrun: emrun bin/program.html - - 2.7. Build Options ------------------ `#define` these options before including miniaudio.c, or pass them as compiler flags: @@ -716,7 +704,6 @@ To run locally, you'll need to use emrun: | MA_API | Controls how public APIs should be decorated. Default is `extern`. | +----------------------------------+--------------------------------------------------------------------+ - 3. Definitions ============== This section defines common terms used throughout miniaudio. Unfortunately there is often ambiguity @@ -766,8 +753,6 @@ Throughout miniaudio you will see references to different sample formats: All formats are native-endian. - - 4. Data Sources =============== The data source abstraction in miniaudio is used for retrieving audio data from some source. A few @@ -935,7 +920,6 @@ instances of the same sound simultaneously. This can be extremely inefficient de of data source and can result in glitching due to subtle changes to the state of internal filters. Instead, initialize multiple data sources for each instance. - 4.1. Custom Data Sources ------------------------ You can implement a custom data source by implementing the functions in `ma_data_source_vtable`. @@ -1018,8 +1002,6 @@ Note that `ma_data_source_init()` and `ma_data_source_uninit()` are never called of the custom data source. It's up to the custom data source itself to call these within their own init/uninit functions. - - 5. Engine ========= The `ma_engine` API is a high level API for managing and mixing sounds and effect processing. The @@ -1521,7 +1503,6 @@ file format through the use of custom decoders. To do this you'll need to use a resource manager and configure it appropriately. See the "Resource Management" section below for details on how to set this up. - 6. Resource Management ====================== Many programs will want to manage sound resources for things such as reference counting and @@ -1750,7 +1731,6 @@ caller to ensure the pointer stays valid for its lifetime. Use unregister a file. It does not make sense to use the `MA_RESOURCE_MANAGER_DATA_SOURCE_FLAG_STREAM` flag with a self-managed data pointer. - 6.1. Asynchronous Loading and Synchronization --------------------------------------------- When loading asynchronously, it can be useful to poll whether or not loading has finished. Use @@ -1838,8 +1818,6 @@ the fence, only we set `pNotification` instead of `pFence`. You can set both of time and they should both work as expected. If using the `pNotification` system, you need to ensure your `ma_async_notification_callbacks` object stays valid. - - 6.2. Resource Manager Implementation Details -------------------------------------------- Resources are managed in two main ways: @@ -1877,7 +1855,6 @@ determine if a data source is ready to have some frames read, use `ma_resource_manager_data_source_get_available_frames()`. This will return the number of frames available starting from the current position. - 6.2.1. Job Queue ---------------- The resource manager uses a job queue which is multi-producer, multi-consumer, and fixed-capacity. @@ -1921,8 +1898,6 @@ this, you can use non-blocking mode (via the `MA_JOB_QUEUE_FLAG_NON_BLOCKING` flag) and implement your own job processing routine (see the "Resource Manager" section above for details on how to do this). - - 6.2.2. Data Buffers ------------------- When the `MA_RESOURCE_MANAGER_DATA_SOURCE_FLAG_STREAM` flag is excluded at initialization time, the @@ -1987,7 +1962,6 @@ keep on happening until the sound has been fully decoded. For sounds of an unkno page will be linked together as a linked list. Internally this is implemented via the `ma_paged_audio_buffer` object. - 6.2.3. Data Streams ------------------- Data streams only ever store two pages worth of data for each instance. They are most useful for @@ -2022,8 +1996,6 @@ thread from the audio thread. You must keep in mind the details mentioned in the section above regarding locking when posting an event if you require a strictly lock-free audio thread. - - 7. Node Graph ============= miniaudio's routing infrastructure follows a node graph paradigm. The idea is that you create a @@ -2304,7 +2276,6 @@ and include the following: | | callback because miniaudio will ignore it anyway. | +-----------------------------------------+---------------------------------------------------+ - If you need to make a copy of an audio stream for effect processing you can use a splitter node called `ma_splitter_node`. This takes has 1 input bus and splits the stream into 2 output buses. You can use it like this: @@ -2362,7 +2333,6 @@ for specialized nodes: When using a specialized node like `ma_data_source_node` or `ma_splitter_node`, be sure to not modify the `vtable` member of the `nodeConfig` object. - 7.1. Timing ----------- The node graph supports starting and stopping nodes at scheduled times. This is especially useful @@ -2412,8 +2382,6 @@ issue, consider scheduling state changes from within a processing callback. An i have some kind of passthrough trigger node that is used specifically for tracking time and handling events. - - 7.2. Thread Safety and Locking ------------------------------ When processing audio, it's ideal not to have any kind of locking in the audio thread. Since it's @@ -2493,8 +2461,6 @@ only be happening in a forward direction which means the "previous" pointer won' used. The same general process applies to detachment. See `ma_node_attach_output_bus()` and `ma_node_detach_output_bus()` for the implementation of this mechanism. - - 8. Decoding =========== The `ma_decoder` API is used for reading audio files. Decoders are completely decoupled from @@ -2587,7 +2553,6 @@ See the `ma_encoding_format` enum for possible encoding formats. The `ma_decoder_init_file()` API will try using the file extension to determine which decoding backend to prefer. - 8.1. Custom Decoders -------------------- It's possible to implement a custom decoder and plug it into miniaudio. This is extremely useful @@ -2655,8 +2620,6 @@ initialization routine is clean. When a decoder is uninitialized, the `onUninit` callback will be fired which will give you an opportunity to clean up and internal data. - - 9. Encoding =========== The `ma_encoding` API is used for writing audio files. The only supported output format is WAV. @@ -2711,15 +2674,12 @@ is optionally and you can pass in `NULL` if you need this. Encoders must be uninitialized with `ma_encoder_uninit()`. - - 10. Data Conversion =================== A data conversion API is included with miniaudio which supports the majority of data conversion requirements. This supports conversion between sample formats, channel counts (with channel mapping) and sample rates. - 10.1. Sample Format Conversion ------------------------------ Conversion between sample formats is achieved with the `ma_pcm_*_to_*()`, `ma_pcm_convert()` and @@ -2728,7 +2688,6 @@ formats. Use `ma_pcm_convert()` to convert based on a `ma_format` variable. Use `ma_convert_pcm_frames_format()` to convert PCM frames where you want to specify the frame count and channel count as a variable instead of the total sample count. - 10.1.1. Dithering ----------------- Dithering can be set using the ditherMode parameter. @@ -2760,8 +2719,6 @@ conversions: Note that it is not an error to pass something other than ma_dither_mode_none for conversions where dither is not used. It will just be ignored. - - 10.2. Channel Conversion ------------------------ Channel conversion is used for channel rearrangement and conversion from one channel count to @@ -2797,7 +2754,6 @@ frames. Input and output PCM frames are always interleaved. Deinterleaved layouts are not supported. - 10.2.1. Channel Mapping ----------------------- In addition to converting from one channel count to another, like the example above, the channel @@ -2898,8 +2854,6 @@ Below are the channel maps used by default in miniaudio (`ma_standard_channel_ma | | mapping as the device. | +---------------+---------------------------------+ - - 10.3. Resampling ---------------- Resampling is achieved with the `ma_resampler` object. To create a resampler object, do something @@ -2988,12 +2942,10 @@ Due to the nature of how resampling works, the resampler introduces some latency retrieved in terms of both the input rate and the output rate with `ma_resampler_get_input_latency()` and `ma_resampler_get_output_latency()`. - 10.3.1. Resampling Algorithms ----------------------------- The choice of resampling algorithm depends on your situation and requirements. - 10.3.1.1. Linear Resampling --------------------------- The linear resampler is the fastest, but comes at the expense of poorer quality. There is, however, @@ -3012,7 +2964,6 @@ the input and output sample rates (Nyquist Frequency). The API for the linear resampler is the same as the main resampler API, only it's called `ma_linear_resampler`. - 10.3.2. Custom Resamplers ------------------------- You can implement a custom resampler by using the `ma_resample_algorithm_custom` resampling @@ -3053,8 +3004,6 @@ frames are required to be available to produce the given number of output frames produced given the specified number of input frames. miniaudio will use these as a hint, but they are optional and can be set to NULL if you're unable to implement them. - - 10.4. General Data Conversion ----------------------------- The `ma_data_converter` API can be used to wrap sample format conversion, channel conversion and @@ -3145,8 +3094,6 @@ Due to the nature of how resampling works, the data converter introduces some la is required. This can be retrieved in terms of both the input rate and the output rate with `ma_data_converter_get_input_latency()` and `ma_data_converter_get_output_latency()`. - - 11. Filtering ============= @@ -3190,7 +3137,6 @@ filter while keeping the values of registers valid to avoid glitching. Do not us registers to 0. Note that changing the format or channel count after initialization is invalid and will result in an error. - 11.2. Low-Pass Filtering ------------------------ Low-pass filtering is achieved with the following APIs: @@ -3249,7 +3195,6 @@ If an even filter order is specified, a series of second order filters will be p chain. If an odd filter order is specified, a first order filter will be applied, followed by a series of second order filters in a chain. - 11.3. High-Pass Filtering ------------------------- High-pass filtering is achieved with the following APIs: @@ -3265,7 +3210,6 @@ High-pass filtering is achieved with the following APIs: High-pass filters work exactly the same as low-pass filters, only the APIs are called `ma_hpf1`, `ma_hpf2` and `ma_hpf`. See example code for low-pass filters for example usage. - 11.4. Band-Pass Filtering ------------------------- Band-pass filtering is achieved with the following APIs: @@ -3282,7 +3226,6 @@ Band-pass filters work exactly the same as low-pass filters, only the APIs are c band-pass filters must be an even number which means there is no first order band-pass filter, unlike low-pass and high-pass filters. - 11.5. Notch Filtering --------------------- Notch filtering is achieved with the following APIs: @@ -3293,7 +3236,6 @@ Notch filtering is achieved with the following APIs: | ma_notch2 | Second order notching filter | +-----------+------------------------------------------+ - 11.6. Peaking EQ Filtering ------------------------- Peaking filtering is achieved with the following APIs: @@ -3304,7 +3246,6 @@ Peaking filtering is achieved with the following APIs: | ma_peak2 | Second order peaking filter | +----------+------------------------------------------+ - 11.7. Low Shelf Filtering ------------------------- Low shelf filtering is achieved with the following APIs: @@ -3318,7 +3259,6 @@ Low shelf filtering is achieved with the following APIs: Where a high-pass filter is used to eliminate lower frequencies, a low shelf filter can be used to just turn them down rather than eliminate them entirely. - 11.8. High Shelf Filtering -------------------------- High shelf filtering is achieved with the following APIs: @@ -3333,9 +3273,6 @@ The high shelf filter has the same API as the low shelf filter, only you would u instead of `ma_loshelf`. Where a low shelf filter is used to adjust the volume of low frequencies, the high shelf filter does the same thing for high frequencies. - - - 12. Waveform and Noise Generation ================================= @@ -3382,8 +3319,6 @@ Below are the supported waveform types: | ma_waveform_type_sawtooth | +---------------------------+ - - 12.2. Noise ----------- miniaudio supports generation of white, pink and Brownian noise via the `ma_noise` API. Example: @@ -3432,8 +3367,6 @@ Below are the supported noise types. | ma_noise_type_brownian | +------------------------+ - - 13. Audio Buffers ================= miniaudio supports reading from a buffer of raw audio data via the `ma_audio_buffer` API. This can @@ -3534,8 +3467,6 @@ purpose of looping with `ma_audio_buffer_at_end()` or by inspecting the return v `ma_audio_buffer_unmap()` and checking if it equals `MA_AT_END`. You should not treat `MA_AT_END` as an error when returned by `ma_audio_buffer_unmap()`. - - 14. Ring Buffers ================ miniaudio supports lock free (single producer, single consumer) ring buffers which are exposed via @@ -3603,8 +3534,6 @@ aligned to `MA_SIMD_ALIGNMENT`. Note that the ring buffer is only thread safe when used by a single consumer thread and single producer thread. - - 15. Backends ============ The following backends are supported by miniaudio. These are listed in order of default priority. @@ -3697,8 +3626,6 @@ BSD https://developers.google.com/web/updates/2017/09/autoplay-policy-changes. Starting the device may fail if you try to start playback without first handling some kind of user input. - - 16. Optimization Tips ===================== See below for some tips on improving performance. @@ -3724,8 +3651,6 @@ See below for some tips on improving performance. consider setting the decoded sample rate to match your sounds. By configuring everything to use a consistent sample rate, sample rate conversion can be avoided. - - 17. Miscellaneous Notes ======================= - Automatic stream routing is enabled on a per-backend basis. Support is explicitly enabled for @@ -3763,7 +3688,6 @@ extern "C" { #endif #endif - #if defined(__LP64__) || defined(_WIN64) || (defined(__x86_64__) && !defined(__ILP32__)) || defined(_M_X64) || defined(__ia64) || defined(_M_IA64) || defined(__aarch64__) || defined(_M_ARM64) || defined(__powerpc64__) || defined(__ppc64__) #define MA_SIZEOF_PTR 8 #else @@ -3856,7 +3780,6 @@ typedef ma_uint16 wchar_t; #define MA_UINT64_MAX (((ma_uint64)0xFFFFFFFF << 32) | (ma_uint64)0xFFFFFFFF) /* Weird shifting syntax is for VC6 compatibility. */ - /* Platform/backend detection. */ #if defined(_WIN32) #define MA_WIN32 @@ -4045,7 +3968,6 @@ typedef ma_uint16 wchar_t; #endif #endif - /* SIMD alignment in bytes. Currently set to 32 bytes in preparation for future AVX optimizations. */ #define MA_SIMD_ALIGNMENT 32 @@ -4063,8 +3985,6 @@ typedef wchar_t ma_wchar_win32; typedef ma_uint16 ma_wchar_win32; #endif - - /* Logging Levels ============== @@ -4274,7 +4194,6 @@ typedef enum MA_FAILED_TO_STOP_BACKEND_DEVICE = -403 } ma_result; - #define MA_MIN_CHANNELS 1 #ifndef MA_MAX_CHANNELS #define MA_MAX_CHANNELS 254 @@ -4344,7 +4263,6 @@ typedef enum ma_standard_sample_rate_count = 14 /* Need to maintain the count manually. Make sure this is updated if items are added to enum. */ } ma_standard_sample_rate; - typedef enum { ma_channel_mix_mode_rectangular = 0, /* Simple averaging based on the plane(s) the channel is sitting on. */ @@ -4372,7 +4290,6 @@ typedef enum ma_performance_profile_conservative } ma_performance_profile; - typedef struct { void* pUserData; @@ -4386,7 +4303,6 @@ typedef struct ma_uint32 state; } ma_lcg; - /* Atomics. @@ -4443,7 +4359,6 @@ MA_ATOMIC_SAFE_TYPE_DECL(64, 8, uint64) MA_ATOMIC_SAFE_TYPE_DECL(f32, 4, float) MA_ATOMIC_SAFE_TYPE_DECL(32, 4, bool32) - /* Spinlocks are 32-bit for compatibility reasons. */ typedef ma_uint32 ma_spinlock; @@ -4501,7 +4416,6 @@ typedef ma_uint32 ma_spinlock; #endif #endif /* MA_NO_THREADING */ - /* Retrieves the version of miniaudio as separated integers. Each component can be NULL if it's not required. */ @@ -4512,7 +4426,6 @@ Retrieves the version of miniaudio as a string which can be useful for logging p */ MA_API const char* ma_version_string(void); - /************************************************************************************************************************************************************** Logging @@ -4533,11 +4446,9 @@ Logging #define MA_MAX_LOG_CALLBACKS 4 #endif - /* The callback for handling log messages. - Parameters ---------- pUserData (in) @@ -4568,7 +4479,6 @@ typedef struct MA_API ma_log_callback ma_log_callback_init(ma_log_callback_proc onLog, void* pUserData); - typedef struct { ma_log_callback callbacks[MA_MAX_LOG_CALLBACKS]; @@ -4587,7 +4497,6 @@ MA_API ma_result ma_log_post(ma_log* pLog, ma_uint32 level, const char* pMessage MA_API ma_result ma_log_postv(ma_log* pLog, ma_uint32 level, const char* pFormat, va_list args); MA_API ma_result ma_log_postf(ma_log* pLog, ma_uint32 level, const char* pFormat, ...) MA_ATTRIBUTE_FORMAT(3, 4); - /************************************************************************************************************************************************************** Biquad Filtering @@ -4639,7 +4548,6 @@ MA_API ma_result ma_biquad_clear_cache(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(const ma_biquad* pBQ); - /************************************************************************************************************************************************************** Low-Pass Filtering @@ -4692,7 +4600,6 @@ MA_API ma_result ma_lpf2_clear_cache(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(const ma_lpf2* pLPF); - typedef struct { ma_format format; @@ -4728,7 +4635,6 @@ MA_API ma_result ma_lpf_clear_cache(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(const ma_lpf* pLPF); - /************************************************************************************************************************************************************** High-Pass Filtering @@ -4779,7 +4685,6 @@ 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(const ma_hpf2* pHPF); - typedef struct { ma_format format; @@ -4814,7 +4719,6 @@ 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(const ma_hpf* pHPF); - /************************************************************************************************************************************************************** Band-Pass Filtering @@ -4844,7 +4748,6 @@ 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(const ma_bpf2* pBPF); - typedef struct { ma_format format; @@ -4876,7 +4779,6 @@ 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(const ma_bpf* pBPF); - /************************************************************************************************************************************************************** Notching Filter @@ -4906,7 +4808,6 @@ MA_API ma_result ma_notch2_reinit(const ma_notch2_config* pConfig, ma_notch2* pF 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(const ma_notch2* pFilter); - /************************************************************************************************************************************************************** Peaking EQ Filter @@ -4937,7 +4838,6 @@ MA_API ma_result ma_peak2_reinit(const ma_peak2_config* pConfig, ma_peak2* pFilt 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(const ma_peak2* pFilter); - /************************************************************************************************************************************************************** Low Shelf Filter @@ -4968,7 +4868,6 @@ MA_API ma_result ma_loshelf2_reinit(const ma_loshelf2_config* pConfig, ma_loshel 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(const ma_loshelf2* pFilter); - /************************************************************************************************************************************************************** High Shelf Filter @@ -4999,8 +4898,6 @@ MA_API ma_result ma_hishelf2_reinit(const ma_hishelf2_config* pConfig, ma_hishel 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(const ma_hishelf2* pFilter); - - /* Delay */ @@ -5017,7 +4914,6 @@ typedef struct MA_API ma_delay_config ma_delay_config_init(ma_uint32 channels, ma_uint32 sampleRate, ma_uint32 delayInFrames, float decay); - typedef struct { ma_delay_config config; @@ -5036,7 +4932,6 @@ MA_API float ma_delay_get_dry(const ma_delay* pDelay); MA_API void ma_delay_set_decay(ma_delay* pDelay, float value); MA_API float ma_delay_get_decay(const ma_delay* pDelay); - /* Gainer for smooth volume changes. */ typedef struct { @@ -5046,7 +4941,6 @@ typedef struct MA_API ma_gainer_config ma_gainer_config_init(ma_uint32 channels, ma_uint32 smoothTimeInFrames); - typedef struct { ma_gainer_config config; @@ -5070,8 +4964,6 @@ MA_API ma_result ma_gainer_set_gains(ma_gainer* pGainer, float* pNewGains); MA_API ma_result ma_gainer_set_master_volume(ma_gainer* pGainer, float volume); MA_API ma_result ma_gainer_get_master_volume(const ma_gainer* pGainer, float* pVolume); - - /* Stereo panner. */ typedef enum { @@ -5089,7 +4981,6 @@ typedef struct MA_API ma_panner_config ma_panner_config_init(ma_format format, ma_uint32 channels); - typedef struct { ma_format format; @@ -5105,8 +4996,6 @@ MA_API ma_pan_mode ma_panner_get_mode(const ma_panner* pPanner); MA_API void ma_panner_set_pan(ma_panner* pPanner, float pan); MA_API float ma_panner_get_pan(const ma_panner* pPanner); - - /* Fader. */ typedef struct { @@ -5133,8 +5022,6 @@ MA_API void ma_fader_set_fade(ma_fader* pFader, float volumeBeg, float volumeEnd MA_API void ma_fader_set_fade_ex(ma_fader* pFader, float volumeBeg, float volumeEnd, ma_uint64 lengthInFrames, ma_int64 startOffsetInFrames); MA_API float ma_fader_get_current_volume(const ma_fader* pFader); - - /* Spatializer. */ typedef struct { @@ -5169,7 +5056,6 @@ typedef enum ma_handedness_left } ma_handedness; - typedef struct { ma_uint32 channelsOut; @@ -5184,7 +5070,6 @@ typedef struct MA_API ma_spatializer_listener_config ma_spatializer_listener_config_init(ma_uint32 channelsOut); - typedef struct { ma_spatializer_listener_config config; @@ -5218,7 +5103,6 @@ MA_API ma_vec3f ma_spatializer_listener_get_world_up(const ma_spatializer_listen MA_API void ma_spatializer_listener_set_enabled(ma_spatializer_listener* pListener, ma_bool32 isEnabled); MA_API ma_bool32 ma_spatializer_listener_is_enabled(const ma_spatializer_listener* pListener); - typedef struct { ma_uint32 channelsIn; @@ -5243,7 +5127,6 @@ typedef struct MA_API ma_spatializer_config ma_spatializer_config_init(ma_uint32 channelsIn, ma_uint32 channelsOut); - typedef struct { ma_uint32 channelsIn; @@ -5313,8 +5196,6 @@ MA_API void ma_spatializer_set_velocity(ma_spatializer* pSpatializer, float x, f MA_API ma_vec3f ma_spatializer_get_velocity(const ma_spatializer* pSpatializer); MA_API void ma_spatializer_get_relative_position_and_direction(const ma_spatializer* pSpatializer, const ma_spatializer_listener* pListener, ma_vec3f* pRelativePos, ma_vec3f* pRelativeDir); - - /************************************************************************************************************************************************************ ************************************************************************************************************************************************************* @@ -5380,7 +5261,6 @@ MA_API ma_result ma_linear_resampler_get_required_input_frame_count(const ma_lin MA_API ma_result ma_linear_resampler_get_expected_output_frame_count(const ma_linear_resampler* pResampler, ma_uint64 inputFrameCount, ma_uint64* pOutputFrameCount); MA_API ma_result ma_linear_resampler_reset(ma_linear_resampler* pResampler); - typedef struct ma_resampler_config ma_resampler_config; typedef void ma_resampling_backend; @@ -5477,7 +5357,6 @@ It is an error for both [pFrameCountOut] and [pFrameCountIn] to be NULL. */ MA_API ma_result ma_resampler_process_pcm_frames(ma_resampler* pResampler, const void* pFramesIn, ma_uint64* pFrameCountIn, void* pFramesOut, ma_uint64* pFrameCountOut); - /* Sets the input and output sample rate. */ @@ -5520,7 +5399,6 @@ Resets the resampler's timer and clears its internal cache. */ MA_API ma_result ma_resampler_reset(ma_resampler* pResampler); - /************************************************************************************************************************************************************** Channel Conversion @@ -5587,7 +5465,6 @@ MA_API ma_result ma_channel_converter_process_pcm_frames(ma_channel_converter* p MA_API ma_result ma_channel_converter_get_input_channel_map(const ma_channel_converter* pConverter, ma_channel* pChannelMap, size_t channelMapCap); MA_API ma_result ma_channel_converter_get_output_channel_map(const ma_channel_converter* pConverter, ma_channel* pChannelMap, size_t channelMapCap); - /************************************************************************************************************************************************************** Data Conversion @@ -5614,7 +5491,6 @@ typedef struct MA_API ma_data_converter_config ma_data_converter_config_init_default(void); MA_API ma_data_converter_config ma_data_converter_config_init(ma_format formatIn, ma_format formatOut, ma_uint32 channelsIn, ma_uint32 channelsOut, ma_uint32 sampleRateIn, ma_uint32 sampleRateOut); - typedef enum { ma_data_converter_execution_path_passthrough, /* No conversion. */ @@ -5663,7 +5539,6 @@ MA_API ma_result ma_data_converter_get_input_channel_map(const ma_data_converter MA_API ma_result ma_data_converter_get_output_channel_map(const ma_data_converter* pConverter, ma_channel* pChannelMap, size_t channelMapCap); MA_API ma_result ma_data_converter_reset(ma_data_converter* pConverter); - /************************************************************************************************************************************************************ Format Conversion @@ -5702,7 +5577,6 @@ Interleaves a group of deinterleaved buffers. */ MA_API void ma_interleave_pcm_frames(ma_format format, ma_uint32 channels, ma_uint64 frameCount, const void** ppDeinterleavedPCMFrames, void* pInterleavedPCMFrames); - /************************************************************************************************************************************************************ Channel Maps @@ -5748,7 +5622,6 @@ The output buffer must have a capacity of at least `channels`. If not NULL, the */ MA_API void ma_channel_map_copy_or_default(ma_channel* pOut, size_t channelMapCapOut, const ma_channel* pIn, ma_uint32 channels); - /* Determines whether or not a channel map is valid. @@ -5808,7 +5681,6 @@ Retrieves a human readable version of a channel position. */ MA_API const char* ma_channel_position_to_string(ma_channel channel); - /************************************************************************************************************************************************************ Conversion Helpers @@ -5827,7 +5699,6 @@ This function is useful for one-off bulk conversions, but if you're streaming da MA_API ma_uint64 ma_convert_frames(void* pOut, ma_uint64 frameCountOut, ma_format formatOut, ma_uint32 channelsOut, ma_uint32 sampleRateOut, const void* pIn, ma_uint64 frameCountIn, ma_format formatIn, ma_uint32 channelsIn, ma_uint32 sampleRateIn); MA_API ma_uint64 ma_convert_frames_ex(void* pOut, ma_uint64 frameCountOut, const void* pIn, ma_uint64 frameCountIn, const ma_data_converter_config* pConfig); - /************************************************************************************************************************************************************ Data Source @@ -5857,7 +5728,6 @@ typedef struct MA_API ma_data_source_config ma_data_source_config_init(void); - typedef struct { const ma_data_source_vtable* vtable; @@ -5896,7 +5766,6 @@ MA_API ma_data_source* ma_data_source_get_next(const ma_data_source* pDataSource MA_API ma_result ma_data_source_set_next_callback(ma_data_source* pDataSource, ma_data_source_get_next_proc onGetNext); MA_API ma_data_source_get_next_proc ma_data_source_get_next_callback(const ma_data_source* pDataSource); - typedef struct { ma_data_source_base ds; @@ -5920,8 +5789,6 @@ MA_API ma_result ma_audio_buffer_ref_get_cursor_in_pcm_frames(const ma_audio_buf MA_API ma_result ma_audio_buffer_ref_get_length_in_pcm_frames(const ma_audio_buffer_ref* pAudioBufferRef, ma_uint64* pLength); MA_API ma_result ma_audio_buffer_ref_get_available_frames(const ma_audio_buffer_ref* pAudioBufferRef, ma_uint64* pAvailableFrames); - - typedef struct { ma_format format; @@ -5956,7 +5823,6 @@ MA_API ma_result ma_audio_buffer_get_cursor_in_pcm_frames(const ma_audio_buffer* MA_API ma_result ma_audio_buffer_get_length_in_pcm_frames(const ma_audio_buffer* pAudioBuffer, ma_uint64* pLength); MA_API ma_result ma_audio_buffer_get_available_frames(const ma_audio_buffer* pAudioBuffer, ma_uint64* pAvailableFrames); - /* Paged Audio Buffer ================== @@ -5994,7 +5860,6 @@ MA_API ma_result ma_paged_audio_buffer_data_free_page(ma_paged_audio_buffer_data MA_API ma_result ma_paged_audio_buffer_data_append_page(ma_paged_audio_buffer_data* pData, ma_paged_audio_buffer_page* pPage); MA_API ma_result ma_paged_audio_buffer_data_allocate_and_append_page(ma_paged_audio_buffer_data* pData, ma_uint32 pageSizeInFrames, const void* pInitialData, const ma_allocation_callbacks* pAllocationCallbacks); - typedef struct { ma_paged_audio_buffer_data* pData; /* Must not be null. */ @@ -6002,7 +5867,6 @@ typedef struct MA_API ma_paged_audio_buffer_config ma_paged_audio_buffer_config_init(ma_paged_audio_buffer_data* pData); - typedef struct { ma_data_source_base ds; @@ -6019,8 +5883,6 @@ MA_API ma_result ma_paged_audio_buffer_seek_to_pcm_frame(ma_paged_audio_buffer* MA_API ma_result ma_paged_audio_buffer_get_cursor_in_pcm_frames(ma_paged_audio_buffer* pPagedAudioBuffer, ma_uint64* pCursor); MA_API ma_result ma_paged_audio_buffer_get_length_in_pcm_frames(ma_paged_audio_buffer* pPagedAudioBuffer, ma_uint64* pLength); - - /************************************************************************************************************************************************************ Ring Buffer @@ -6057,7 +5919,6 @@ MA_API size_t ma_rb_get_subbuffer_stride(ma_rb* pRB); MA_API size_t ma_rb_get_subbuffer_offset(ma_rb* pRB, size_t subbufferIndex); MA_API void* ma_rb_get_subbuffer_ptr(ma_rb* pRB, size_t subbufferIndex, void* pBuffer); - typedef struct { ma_data_source_base ds; @@ -6089,7 +5950,6 @@ MA_API ma_uint32 ma_pcm_rb_get_channels(const ma_pcm_rb* pRB); MA_API ma_uint32 ma_pcm_rb_get_sample_rate(const ma_pcm_rb* pRB); MA_API void ma_pcm_rb_set_sample_rate(ma_pcm_rb* pRB, ma_uint32 sampleRate); - /* The idea of the duplex ring buffer is to act as the intermediary buffer when running two asynchronous devices in a duplex set up. The capture device writes to it, and then a playback device reads from it. @@ -6108,7 +5968,6 @@ typedef struct MA_API ma_result ma_duplex_rb_init(ma_format captureFormat, ma_uint32 captureChannels, ma_uint32 sampleRate, ma_uint32 captureInternalSampleRate, ma_uint32 captureInternalPeriodSizeInFrames, const ma_allocation_callbacks* pAllocationCallbacks, ma_duplex_rb* pRB); MA_API ma_result ma_duplex_rb_uninit(ma_duplex_rb* pRB); - /************************************************************************************************************************************************************ Miscellaneous Helpers @@ -6175,9 +6034,6 @@ Converts a log level to a string. */ MA_API const char* ma_log_level_to_string(ma_uint32 logLevel); - - - /************************************************************************************************************************************************************ Synchronization @@ -6198,7 +6054,6 @@ Unlocks a spinlock. */ MA_API ma_result ma_spinlock_unlock(volatile ma_spinlock* pSpinlock); - #ifndef MA_NO_THREADING /* @@ -6223,7 +6078,6 @@ Unlocks a mutex. */ MA_API void ma_mutex_unlock(ma_mutex* pMutex); - /* Initializes an auto-reset event. */ @@ -6244,14 +6098,12 @@ Signals the specified auto-reset event. */ MA_API ma_result ma_event_signal(ma_event* pEvent); - MA_API ma_result ma_semaphore_init(int initialValue, ma_semaphore* pSemaphore); MA_API void ma_semaphore_uninit(ma_semaphore* pSemaphore); MA_API ma_result ma_semaphore_wait(ma_semaphore* pSemaphore); MA_API ma_result ma_semaphore_release(ma_semaphore* pSemaphore); #endif /* MA_NO_THREADING */ - /* Fence ===== @@ -6280,8 +6132,6 @@ MA_API ma_result ma_fence_acquire(ma_fence* pFence); /* Increment counter. */ MA_API ma_result ma_fence_release(ma_fence* pFence); /* Decrement counter. */ MA_API ma_result ma_fence_wait(ma_fence* pFence); /* Wait for counter to reach 0. */ - - /* Notification callback for asynchronous operations. */ @@ -6294,7 +6144,6 @@ typedef struct MA_API ma_result ma_async_notification_signal(ma_async_notification* pNotification); - /* Simple polling notification. @@ -6309,7 +6158,6 @@ typedef struct MA_API ma_result ma_async_notification_poll_init(ma_async_notification_poll* pNotificationPoll); MA_API ma_bool32 ma_async_notification_poll_is_signalled(const ma_async_notification_poll* pNotificationPoll); - /* Event Notification @@ -6328,9 +6176,6 @@ MA_API ma_result ma_async_notification_event_uninit(ma_async_notification_event* MA_API ma_result ma_async_notification_event_wait(ma_async_notification_event* pNotificationEvent); MA_API ma_result ma_async_notification_event_signal(ma_async_notification_event* pNotificationEvent); - - - /************************************************************************************************************************************************************ Job Queue @@ -6360,7 +6205,6 @@ typedef struct MA_API ma_slot_allocator_config ma_slot_allocator_config_init(ma_uint32 capacity); - typedef struct { MA_ATOMIC(4, ma_uint32) bitfield; /* Must be used atomically because the allocation and freeing routines need to make copies of this which must never be optimized away by the compiler. */ @@ -6385,7 +6229,6 @@ MA_API void ma_slot_allocator_uninit(ma_slot_allocator* pAllocator, const ma_all MA_API ma_result ma_slot_allocator_alloc(ma_slot_allocator* pAllocator, ma_uint64* pSlot); MA_API ma_result ma_slot_allocator_free(ma_slot_allocator* pAllocator, ma_uint64 slot); - typedef struct ma_job ma_job; /* @@ -6540,7 +6383,6 @@ struct ma_job MA_API ma_job ma_job_init(ma_uint16 code); MA_API ma_result ma_job_process(ma_job* pJob); - /* When set, ma_job_queue_next() will not wait and no semaphore will be signaled in ma_job_queue_post(). ma_job_queue_next() will return MA_NO_DATA_AVAILABLE if nothing is available. @@ -6560,7 +6402,6 @@ typedef struct MA_API ma_job_queue_config ma_job_queue_config_init(ma_uint32 flags, ma_uint32 capacity); - typedef struct { ma_uint32 flags; /* Flags passed in at initialization time. */ @@ -6588,8 +6429,6 @@ MA_API void ma_job_queue_uninit(ma_job_queue* pQueue, const ma_allocation_callba MA_API ma_result ma_job_queue_post(ma_job_queue* pQueue, const ma_job* pJob); MA_API ma_result ma_job_queue_next(ma_job_queue* pQueue, ma_job* pJob); /* Returns MA_CANCELLED if the next job is a quit job. */ - - /************************************************************************************************************************************************************ ************************************************************************************************************************************************************* @@ -6650,7 +6489,6 @@ This section contains the APIs for device playback and capture. Here is where yo #define MA_SUPPORT_NULL #endif - #if defined(MA_SUPPORT_WASAPI) && !defined(MA_NO_WASAPI) && (!defined(MA_ENABLE_ONLY_SPECIFIC_BACKENDS) || defined(MA_ENABLE_WASAPI)) #define MA_HAS_WASAPI #endif @@ -6708,7 +6546,6 @@ typedef enum MA_ATOMIC_SAFE_TYPE_DECL(i32, 4, device_state) - #ifdef MA_SUPPORT_WASAPI /* We need a IMMNotificationClient object for WASAPI. */ typedef struct @@ -6741,7 +6578,6 @@ typedef enum #define MA_BACKEND_COUNT (ma_backend_null+1) - /* Device job thread. This is used by backends that require asynchronous processing of certain operations. It is not used by all backends. @@ -6770,8 +6606,6 @@ MA_API void ma_device_job_thread_uninit(ma_device_job_thread* pJobThread, const MA_API ma_result ma_device_job_thread_post(ma_device_job_thread* pJobThread, const ma_job* pJob); MA_API ma_result ma_device_job_thread_next(ma_device_job_thread* pJobThread, ma_job* pJob); - - /* Device notification types. */ typedef enum { @@ -6820,7 +6654,6 @@ program. The stopped notification will *not* get fired when a device is rerouted. - Parameters ---------- pNotification (in) @@ -6828,7 +6661,6 @@ pNotification (in) this object to retrieve the relevant device. The `type` member can be used to discriminate against each of the notification types. - Remarks ------- Do not restart or uninitialize the device from the callback. @@ -6850,7 +6682,6 @@ Android backends will report this notification. */ typedef void (* ma_device_notification_proc)(const ma_device_notification* pNotification); - /* The callback for processing audio data from the device. @@ -6858,7 +6689,6 @@ The data callback is fired by miniaudio whenever the device needs to have more d available. This is called as soon as the backend asks for more data which means it may be called with inconsistent frame counts. You cannot assume the callback will be fired with a consistent frame count. - Parameters ---------- pDevice (in) @@ -6877,7 +6707,6 @@ frameCount (in) `periodSizeInFrames` and `periodSizeInMilliseconds` members of the device config are just hints, and are not necessarily exactly what you'll get. You must not assume this will always be the same value each time the callback is fired. - Remarks ------- You cannot stop and start the device from inside the callback or else you'll get a deadlock. You must also not uninitialize the device from inside the @@ -6893,9 +6722,6 @@ The proper way to stop the device is to call `ma_device_stop()` from a different */ typedef void (* ma_device_data_proc)(ma_device* pDevice, void* pOutput, const void* pInput, ma_uint32 frameCount); - - - /* DEPRECATED. Use ma_device_notification_proc instead. @@ -6904,13 +6730,11 @@ The callback for when the device has been stopped. This will be called when the device is stopped explicitly with `ma_device_stop()` and also called implicitly when the device is stopped through external forces such as being unplugged or an internal error occurring. - Parameters ---------- pDevice (in) A pointer to the device that has just stopped. - Remarks ------- Do not restart or uninitialize the device from the callback. @@ -7071,7 +6895,6 @@ typedef union MA_API ma_bool32 ma_device_id_equal(const ma_device_id* pA, const ma_device_id* pB); - typedef struct ma_context_config ma_context_config; typedef struct ma_device_config ma_device_config; typedef struct ma_backend_callbacks ma_backend_callbacks; @@ -7182,11 +7005,9 @@ struct ma_device_config } aaudio; }; - /* The callback for handling device enumeration. This is fired from `ma_context_enumerate_devices()`. - Parameters ---------- pContext (in) @@ -7205,7 +7026,6 @@ pUserData (in) */ typedef ma_bool32 (* ma_enum_devices_callback_proc)(ma_context* pContext, ma_device_type deviceType, const ma_device_info* pInfo, void* pUserData); - /* Describes some basic details about a playback or capture device. */ @@ -8084,12 +7904,10 @@ struct ma_device /* Initializes a `ma_context_config` object. - Return Value ------------ A `ma_context_config` initialized to defaults. - Remarks ------- You must always use this to initialize the default state of the `ma_context_config` object. Not using this will result in your program breaking when miniaudio @@ -8097,7 +7915,6 @@ is updated and new members are added to `ma_context_config`. It also sets logica You can override members of the returned object by changing it's members directly. - See Also -------- ma_context_init() @@ -8110,7 +7927,6 @@ Initializes a context. The context is used for selecting and initializing an appropriate backend and to represent the backend at a more global level than that of an individual device. There is one context to many devices, and a device is created from a context. A context is required to enumerate devices. - Parameters ---------- backends (in, optional) @@ -8125,17 +7941,14 @@ pConfig (in, optional) pContext (in) A pointer to the context object being initialized. - Return Value ------------ MA_SUCCESS if successful; any other error code otherwise. - Thread Safety ------------- Unsafe. Do not call this function across multiple threads as some backends read and write to global state. - Remarks ------- When `backends` is NULL, the default priority order will be used. Below is a list of backends in priority order: @@ -8251,14 +8064,12 @@ can then be set directly on the structure. Below are the members of the `ma_cont jack.tryStartServer Whether or not to try auto-starting the JACK server. Defaults to false. - It is recommended that only a single context is active at any given time because it's a bulky data structure which performs run-time linking for the relevant backends every time it's initialized. The location of the context cannot change throughout it's lifetime. Consider allocating the `ma_context` object with `malloc()` if this is an issue. The reason for this is that a pointer to the context is stored in the `ma_device` structure. - Example 1 - Default Initialization ---------------------------------- The example below shows how to initialize the context using the default configuration. @@ -8271,7 +8082,6 @@ if (result != MA_SUCCESS) { } ``` - Example 2 - Custom Configuration -------------------------------- The example below shows how to initialize the context using custom backend priorities and a custom configuration. In this hypothetical example, the program @@ -8308,7 +8118,6 @@ if (result != MA_SUCCESS) { ma_log_register_callback(ma_context_get_log(&context), ma_log_callback_init(my_log_callback, pMyLogUserData)); ``` - See Also -------- ma_context_config_init() @@ -8319,22 +8128,18 @@ MA_API ma_result ma_context_init(const ma_backend backends[], ma_uint32 backendC /* Uninitializes a context. - Return Value ------------ MA_SUCCESS if successful; any other error code otherwise. - Thread Safety ------------- Unsafe. Do not call this function across multiple threads as some backends read and write to global state. - Remarks ------- Results are undefined if you call this while any device created by this context is still active. - See Also -------- ma_context_init() @@ -8351,7 +8156,6 @@ MA_API size_t ma_context_sizeof(void); /* Retrieves a pointer to the log object associated with this context. - Remarks ------- Pass the returned pointer to `ma_log_post()`, `ma_log_postv()` or `ma_log_postf()` to post a log @@ -8359,7 +8163,6 @@ message. You can attach your own logging callback to the log with `ma_log_register_callback()` - Return Value ------------ A pointer to the `ma_log` object that the context uses to post log messages. If some error occurs, @@ -8379,7 +8182,6 @@ but don't call it from within the enumeration callback. Returning false from the callback will stop enumeration. Returning true will continue enumeration. - Parameters ---------- pContext (in) @@ -8391,17 +8193,14 @@ callback (in) pUserData (in) A pointer to application-defined data passed to the callback. - Return Value ------------ MA_SUCCESS if successful; any other error code otherwise. - Thread Safety ------------- Safe. This is guarded using a simple mutex lock. - Remarks ------- Do _not_ assume the first enumerated device of a given type is the default device. @@ -8413,7 +8212,6 @@ do not try to call `ma_context_get_device_info()` from within the callback. Consider using `ma_context_get_devices()` for a simpler and safer API, albeit at the expense of an internal heap allocation. - Example 1 - Simple Enumeration ------------------------------ ma_bool32 ma_device_enum_callback(ma_context* pContext, ma_device_type deviceType, const ma_device_info* pInfo, void* pUserData) @@ -8427,7 +8225,6 @@ if (result != MA_SUCCESS) { // Error. } - See Also -------- ma_context_get_devices() @@ -8444,7 +8241,6 @@ Note that this only retrieves the ID and name/description of the device. The rea opening the backend device in order to probe it for more detailed information which can be inefficient. Consider using `ma_context_get_device_info()` for this, but don't call it from within the enumeration callback. - Parameters ---------- pContext (in) @@ -8462,18 +8258,15 @@ ppCaptureDeviceInfos (out) pCaptureDeviceCount (out) A pointer to an unsigned integer that will receive the number of capture devices. - Return Value ------------ MA_SUCCESS if successful; any other error code otherwise. - Thread Safety ------------- Unsafe. Since each call to this function invalidates the pointers from the previous call, you should not be calling this simultaneously across multiple threads. Instead, you need to make a copy of the returned data with your own higher level synchronization. - Remarks ------- It is _not_ safe to assume the first device in the list is the default device. @@ -8482,7 +8275,6 @@ You can pass in NULL for the playback or capture lists in which case they'll be The returned pointers will become invalid upon the next call this this function, or when the context is uninitialized. Do not free the returned pointers. - See Also -------- ma_context_enumerate_devices() @@ -8492,7 +8284,6 @@ MA_API ma_result ma_context_get_devices(ma_context* pContext, ma_device_info** p /* Retrieves information about a device of the given type, with the specified ID and share mode. - Parameters ---------- pContext (in) @@ -8507,17 +8298,14 @@ pDeviceID (in) pDeviceInfo (out) A pointer to the `ma_device_info` structure that will receive the device information. - Return Value ------------ MA_SUCCESS if successful; any other error code otherwise. - Thread Safety ------------- Safe. This is guarded using a simple mutex lock. - Remarks ------- Do _not_ call this from within the `ma_context_enumerate_devices()` callback. @@ -8534,25 +8322,20 @@ MA_API ma_result ma_context_get_device_info(ma_context* pContext, ma_device_type /* Determines if the given context supports loopback mode. - Parameters ---------- pContext (in) A pointer to the context getting queried. - Return Value ------------ MA_TRUE if the context supports loopback mode; MA_FALSE otherwise. */ MA_API ma_bool32 ma_context_is_loopback_supported(ma_context* pContext); - - /* Initializes a device config with default settings. - Parameters ---------- deviceType (in) @@ -8567,22 +8350,18 @@ deviceType (in) | ma_device_type_loopback | |-------------------------| - Return Value ------------ A new device config object with default settings. You will typically want to adjust the config after this function returns. See remarks. - Thread Safety ------------- Safe. - Callback Safety --------------- Safe, but don't try initializing a device in a callback. - Remarks ------- The returned config will be initialized to defaults. You will normally want to customize a few variables before initializing the device. See Example 1 for a @@ -8591,7 +8370,6 @@ before initializing the device. See `ma_device_init()` for details on specific configuration options. - Example 1 - Simple Configuration -------------------------------- The example below is what a program will typically want to configure for each device at a minimum. Notice how `ma_device_config_init()` is called first, and @@ -8607,7 +8385,6 @@ config.dataCallback = ma_data_callback; config.pUserData = pMyUserData; ``` - See Also -------- ma_device_init() @@ -8615,7 +8392,6 @@ ma_device_init_ex() */ MA_API ma_device_config ma_device_config_init(ma_device_type deviceType); - /* Initializes a device. @@ -8635,7 +8411,6 @@ When delivering data to and from a device you need to make sure it's in the corr format that you want to use and miniaudio will perform all of the necessary conversion for you internally. When delivering data to and from the callback you can assume the format is the same as what you requested when you initialized the device. See Remarks for more details on miniaudio's data conversion pipeline. - Parameters ---------- pContext (in, optional) @@ -8647,23 +8422,19 @@ pConfig (in) pDevice (out) A pointer to the device object being initialized. - Return Value ------------ MA_SUCCESS if successful; any other error code otherwise. - Thread Safety ------------- Unsafe. It is not safe to call this function simultaneously for different devices because some backends depend on and mutate global state. The same applies to calling this at the same time as `ma_device_uninit()`. - Callback Safety --------------- Unsafe. It is not safe to call this inside any callback. - Remarks ------- Setting `pContext` to NULL will result in miniaudio creating a default context internally and is equivalent to passing in a context initialized like so: @@ -8849,7 +8620,6 @@ then be set directly on the structure. Below are the members of the `ma_device_c stream reroute. When set to false (default) the device will be restarted automatically; otherwise the device will be stopped. - Once initialized, the device's config is immutable. If you need to change the config you will need to initialize a new device. After initializing the device it will be in a stopped state. To start it, use `ma_device_start()`. @@ -8875,7 +8645,6 @@ asking for permissions. Please refer to the official documentation for ActivateA ALSA Specific: When initializing the default device, requesting shared mode will try using the "dmix" device for playback and the "dsnoop" device for capture. If these fail it will try falling back to the "hw" device. - Example 1 - Simple Initialization --------------------------------- This example shows how to initialize a simple playback device using a standard configuration. If you are just needing to do simple playback from the default @@ -8896,7 +8665,6 @@ if (result != MA_SUCCESS) { } ``` - Example 2 - Advanced Initialization ----------------------------------- This example shows how you might do some more advanced initialization. In this hypothetical example we want to control the latency by setting the buffer size @@ -8936,7 +8704,6 @@ if (result != MA_SUCCESS) { } ``` - See Also -------- ma_device_config_init() @@ -8954,7 +8721,6 @@ Initializes a device without a context, with extra parameters for controlling th This is the same as `ma_device_init()`, only instead of a context being passed in, the parameters from `ma_context_init()` are passed in instead. This function allows you to configure the internally created context. - Parameters ---------- backends (in, optional) @@ -8972,23 +8738,19 @@ pConfig (in) pDevice (out) A pointer to the device object being initialized. - Return Value ------------ MA_SUCCESS if successful; any other error code otherwise. - Thread Safety ------------- Unsafe. It is not safe to call this function simultaneously for different devices because some backends depend on and mutate global state. The same applies to calling this at the same time as `ma_device_uninit()`. - Callback Safety --------------- Unsafe. It is not safe to call this inside any callback. - Remarks ------- You only need to use this function if you want to configure the context differently to its defaults. You should never use this function if you want to manage @@ -8996,7 +8758,6 @@ your own context. See the documentation for `ma_context_init()` for information on the different context configuration options. - See Also -------- ma_device_init() @@ -9011,28 +8772,23 @@ Uninitializes a device. This will explicitly stop the device. You do not need to call `ma_device_stop()` beforehand, but it's harmless if you do. - Parameters ---------- pDevice (in) A pointer to the device to stop. - Return Value ------------ Nothing - Thread Safety ------------- Unsafe. As soon as this API is called the device should be considered undefined. - Callback Safety --------------- Unsafe. It is not safe to call this inside any callback. Doing this will result in a deadlock. - See Also -------- ma_device_init() @@ -9040,7 +8796,6 @@ ma_device_stop() */ MA_API void ma_device_uninit(ma_device* pDevice); - /* Retrieves a pointer to the context that owns the given device. */ @@ -9051,11 +8806,9 @@ Helper function for retrieving the log object associated with the context that o */ MA_API ma_log* ma_device_get_log(ma_device* pDevice); - /* Retrieves information about the device. - Parameters ---------- pDevice (in) @@ -9068,18 +8821,15 @@ type (in) pDeviceInfo (out) A pointer to the `ma_device_info` that will receive the device information. - Return Value ------------ MA_SUCCESS if successful; any other error code otherwise. - Thread Safety ------------- Unsafe. This should be considered unsafe because it may be calling into the backend which may or may not be safe. - Callback Safety --------------- Unsafe. You should avoid calling this in the data callback because it may call into the backend @@ -9087,11 +8837,9 @@ which may or may not be safe. */ MA_API ma_result ma_device_get_info(ma_device* pDevice, ma_device_type type, ma_device_info* pDeviceInfo); - /* Retrieves the name of the device. - Parameters ---------- pDevice (in) @@ -9111,24 +8859,20 @@ pLengthNotIncludingNullTerminator (out, optional) A pointer to the variable that will receive the length of the name, not including the null terminator. - Return Value ------------ MA_SUCCESS if successful; any other error code otherwise. - Thread Safety ------------- Unsafe. This should be considered unsafe because it may be calling into the backend which may or may not be safe. - Callback Safety --------------- Unsafe. You should avoid calling this in the data callback because it may call into the backend which may or may not be safe. - Remarks ------- If the name does not fully fit into the output buffer, it'll be truncated. You can pass in NULL to @@ -9140,34 +8884,28 @@ This is implemented in terms of `ma_device_get_info()`. */ MA_API ma_result ma_device_get_name(ma_device* pDevice, ma_device_type type, char* pName, size_t nameCap, size_t* pLengthNotIncludingNullTerminator); - /* Starts the device. For playback devices this begins playback. For capture devices it begins recording. Use `ma_device_stop()` to stop the device. - Parameters ---------- pDevice (in) A pointer to the device to start. - Return Value ------------ MA_SUCCESS if successful; any other error code otherwise. - Thread Safety ------------- Safe. It's safe to call this from any thread with the exception of the callback thread. - Callback Safety --------------- Unsafe. It is not safe to call this inside any callback. - Remarks ------- For a playback device, this will retrieve an initial chunk of audio data from the client before returning. The reason for this is to ensure there is valid @@ -9177,7 +8915,6 @@ This API waits until the backend device has been started for real by the worker Do not call this in any callback. - See Also -------- ma_device_stop() @@ -9189,28 +8926,23 @@ Stops the device. For playback devices this stops playback. For capture devices Use `ma_device_start()` to start the device again. - Parameters ---------- pDevice (in) A pointer to the device to stop. - Return Value ------------ MA_SUCCESS if successful; any other error code otherwise. - Thread Safety ------------- Safe. It's safe to call this from any thread with the exception of the callback thread. - Callback Safety --------------- Unsafe. It is not safe to call this inside any callback. Doing this will result in a deadlock. - Remarks ------- This API needs to wait on the worker thread to stop the backend device properly before returning. It also waits on a mutex for thread-safety. In addition, some @@ -9223,7 +8955,6 @@ speakers or received from the microphone which can in turn result in de-syncs. Do not call this in any callback. - See Also -------- ma_device_start() @@ -9233,29 +8964,24 @@ MA_API ma_result ma_device_stop(ma_device* pDevice); /* Determines whether or not the device is started. - Parameters ---------- pDevice (in) A pointer to the device whose start state is being retrieved. - Return Value ------------ True if the device is started, false otherwise. - Thread Safety ------------- Safe. If another thread calls `ma_device_start()` or `ma_device_stop()` at this same time as this function is called, there's a very small chance the return value will be out of sync. - Callback Safety --------------- Safe. This is implemented as a simple accessor. - See Also -------- ma_device_start() @@ -9263,17 +8989,14 @@ ma_device_stop() */ MA_API ma_bool32 ma_device_is_started(const ma_device* pDevice); - /* Retrieves the state of the device. - Parameters ---------- pDevice (in) A pointer to the device whose state is being retrieved. - Return Value ------------ The current state of the device. The return value will be one of the following: @@ -9290,18 +9013,15 @@ The current state of the device. The return value will be one of the following: | ma_device_state_stopping | The device is in the process of stopping. | +-------------------------------+------------------------------------------------------------------------------+ - Thread Safety ------------- Safe. This is implemented as a simple accessor. Note that if the device is started or stopped at the same time as this function is called, there's a possibility the return value could be out of sync. See remarks. - Callback Safety --------------- Safe. This is implemented as a simple accessor. - Remarks ------- The general flow of a devices state goes like this: @@ -9318,7 +9038,6 @@ synchronization. */ MA_API ma_device_state ma_device_get_state(const ma_device* pDevice); - /* Performs post backend initialization routines for setting up internal data conversion. @@ -9326,7 +9045,6 @@ This should be called whenever the backend is initialized. The only time this sh outside of miniaudio is if you're implementing a custom backend, and you would only do it if you are reinitializing the backend due to rerouting or reinitializing for some reason. - Parameters ---------- pDevice [in] @@ -9341,22 +9059,18 @@ pPlaybackDescriptor [in] pPlaybackDescriptor [in] The descriptor of the capture device containing the internal data format and buffer sizes. - Return Value ------------ MA_SUCCESS if successful; any other error otherwise. - Thread Safety ------------- Unsafe. This will be reinitializing internal data converters which may be in use by another thread. - Callback Safety --------------- Unsafe. This will be reinitializing internal data converters which may be in use by the callback. - Remarks ------- For a duplex device, you can call this for only one side of the system. This is why the deviceType @@ -9367,14 +9081,12 @@ only do it if you're manually performing rerouting or reinitialization. */ MA_API ma_result ma_device_post_init(ma_device* pDevice, ma_device_type deviceType, const ma_device_descriptor* pPlaybackDescriptor, const ma_device_descriptor* pCaptureDescriptor); - /* Sets the master volume factor for the device. The volume factor must be between 0 (silence) and 1 (full volume). Use `ma_device_set_master_volume_db()` to use decibel notation, where 0 is full volume and values less than 0 decreases the volume. - Parameters ---------- pDevice (in) @@ -9383,31 +9095,26 @@ pDevice (in) volume (in) The new volume factor. Must be >= 0. - Return Value ------------ MA_SUCCESS if the volume was set successfully. MA_INVALID_ARGS if pDevice is NULL. MA_INVALID_ARGS if volume is negative. - Thread Safety ------------- Safe. This just sets a local member of the device object. - Callback Safety --------------- Safe. If you set the volume in the data callback, that data written to the output buffer will have the new volume applied. - Remarks ------- This applies the volume factor across all channels. This does not change the operating system's volume. It only affects the volume for the given `ma_device` object's audio stream. - See Also -------- ma_device_get_master_volume() @@ -9419,7 +9126,6 @@ MA_API ma_result ma_device_set_master_volume(ma_device* pDevice, float volume); /* Retrieves the master volume factor for the device. - Parameters ---------- pDevice (in) @@ -9428,29 +9134,24 @@ pDevice (in) pVolume (in) A pointer to the variable that will receive the volume factor. The returned value will be in the range of [0, 1]. - Return Value ------------ MA_SUCCESS if successful. MA_INVALID_ARGS if pDevice is NULL. MA_INVALID_ARGS if pVolume is NULL. - Thread Safety ------------- Safe. This just a simple member retrieval. - Callback Safety --------------- Safe. - Remarks ------- If an error occurs, `*pVolume` will be set to 0. - See Also -------- ma_device_set_master_volume() @@ -9464,7 +9165,6 @@ Sets the master volume for the device as gain in decibels. A gain of 0 is full volume, whereas a gain of < 0 will decrease the volume. - Parameters ---------- pDevice (in) @@ -9473,31 +9173,26 @@ pDevice (in) gainDB (in) The new volume as gain in decibels. Must be less than or equal to 0, where 0 is full volume and anything less than 0 decreases the volume. - Return Value ------------ MA_SUCCESS if the volume was set successfully. MA_INVALID_ARGS if pDevice is NULL. MA_INVALID_ARGS if the gain is > 0. - Thread Safety ------------- Safe. This just sets a local member of the device object. - Callback Safety --------------- Safe. If you set the volume in the data callback, that data written to the output buffer will have the new volume applied. - Remarks ------- This applies the gain across all channels. This does not change the operating system's volume. It only affects the volume for the given `ma_device` object's audio stream. - See Also -------- ma_device_get_master_volume_gain_db() @@ -9509,7 +9204,6 @@ MA_API ma_result ma_device_set_master_volume_db(ma_device* pDevice, float gainDB /* Retrieves the master gain in decibels. - Parameters ---------- pDevice (in) @@ -9518,29 +9212,24 @@ pDevice (in) pGainDB (in) A pointer to the variable that will receive the gain in decibels. The returned value will be <= 0. - Return Value ------------ MA_SUCCESS if successful. MA_INVALID_ARGS if pDevice is NULL. MA_INVALID_ARGS if pGainDB is NULL. - Thread Safety ------------- Safe. This just a simple member retrieval. - Callback Safety --------------- Safe. - Remarks ------- If an error occurs, `*pGainDB` will be set to 0. - See Also -------- ma_device_set_master_volume_db() @@ -9549,11 +9238,9 @@ ma_device_get_master_volume() */ MA_API ma_result ma_device_get_master_volume_db(ma_device* pDevice, float* pGainDB); - /* Called from the data callback of asynchronous backends to allow miniaudio to process the data and fire the miniaudio data callback. - Parameters ---------- pDevice (in) @@ -9570,23 +9257,19 @@ pInput (in) frameCount (in) The number of frames being processed. - Return Value ------------ MA_SUCCESS if successful; any other result code otherwise. - Thread Safety ------------- This function should only ever be called from the internal data callback of the backend. It is safe to call this simultaneously between a playback and capture device in duplex setups. - Callback Safety --------------- Do not call this from the miniaudio data callback. It should only ever be called from the internal data callback of the backend. - Remarks ------- If both `pOutput` and `pInput` are NULL, and error will be returned. In duplex scenarios, both `pOutput` and `pInput` can be non-NULL, in @@ -9597,7 +9280,6 @@ callback. */ MA_API ma_result ma_device_handle_backend_data_callback(ma_device* pDevice, void* pOutput, const void* pInput, ma_uint32 frameCount); - /* Calculates an appropriate buffer size from a descriptor, native sample rate and performance profile. @@ -9608,7 +9290,6 @@ best guess at the device's native sample rate is also required which is where `n comes in. In addition, the performance profile is also needed for cases where both the period size in frames and milliseconds are both zero. - Parameters ---------- pDescriptor (in) @@ -9625,24 +9306,20 @@ performanceProfile (in) zero, miniaudio will fall back to a buffer size based on the performance profile. The profile to use for this calculation is determine by this parameter. - Return Value ------------ The calculated buffer size in frames. - Thread Safety ------------- This is safe so long as nothing modifies `pDescriptor` at the same time. However, this function should only ever be called from within the backend's device initialization routine and therefore shouldn't have any multithreading concerns. - Callback Safety --------------- This is safe to call within the data callback, but there is no reason to ever do this. - Remarks ------- If `nativeSampleRate` is zero, this function will fall back to `pDescriptor->sampleRate`. If that @@ -9650,8 +9327,6 @@ is also zero, `MA_DEFAULT_SAMPLE_RATE` will be used instead. */ MA_API ma_uint32 ma_calculate_buffer_size_in_frames_from_descriptor(const ma_device_descriptor* pDescriptor, ma_uint32 nativeSampleRate, ma_performance_profile performanceProfile); - - /* Retrieves a friendly name for a backend. */ @@ -9670,7 +9345,6 @@ MA_API ma_bool32 ma_is_backend_enabled(ma_backend backend); /* Retrieves compile-time enabled backends. - Parameters ---------- pBackends (out, optional) @@ -9683,7 +9357,6 @@ backendCap (in) pBackendCount (out) A pointer to the variable that will receive the enabled backend count. - Return Value ------------ MA_SUCCESS if successful. @@ -9692,17 +9365,14 @@ MA_NO_SPACE if the capacity of `pBackends` is not large enough. If `MA_NO_SPACE` is returned, the `pBackends` buffer will be filled with `*pBackendCount` values. - Thread Safety ------------- Safe. - Callback Safety --------------- Safe. - Remarks ------- If you want to retrieve the number of backends so you can determine the capacity of `pBackends` buffer, you can call @@ -9716,7 +9386,6 @@ The returned backends are determined based on compile time settings, not the pla example, PulseAudio will be returned if it was enabled at compile time, even when the user doesn't actually have PulseAudio installed. - Example 1 --------- The example below retrieves the enabled backend count using a fixed sized buffer allocated on the stack. The buffer is @@ -9733,7 +9402,6 @@ if (result != MA_SUCCESS) { } ``` - See Also -------- ma_is_backend_enabled() @@ -9747,8 +9415,6 @@ MA_API ma_bool32 ma_is_loopback_supported(ma_backend backend); #endif /* MA_NO_DEVICE_IO */ - - /************************************************************************************************************************************************************ Utilities @@ -9780,7 +9446,6 @@ makes more sense for the purpose of mixing to initialize it to the center point. */ MA_API void ma_silence_pcm_frames(void* p, ma_uint64 frameCount, ma_format format, ma_uint32 channels); - /* Offsets a pointer by the specified number of PCM frames. */ @@ -9789,7 +9454,6 @@ MA_API const void* ma_offset_pcm_frames_const_ptr(const void* p, ma_uint64 offse static MA_INLINE float* ma_offset_pcm_frames_ptr_f32(float* p, ma_uint64 offsetInFrames, ma_uint32 channels) { return (float*)ma_offset_pcm_frames_ptr((void*)p, offsetInFrames, ma_format_f32, channels); } static MA_INLINE const float* ma_offset_pcm_frames_const_ptr_f32(const float* p, ma_uint64 offsetInFrames, ma_uint32 channels) { return (const float*)ma_offset_pcm_frames_const_ptr((const void*)p, offsetInFrames, ma_format_f32, channels); } - /* Clips samples. */ @@ -9833,7 +9497,6 @@ MA_API void ma_apply_volume_factor_pcm_frames(void* pFrames, ma_uint64 frameCoun MA_API void ma_copy_and_apply_volume_factor_per_channel_f32(float* pFramesOut, const float* pFramesIn, ma_uint64 frameCount, ma_uint32 channels, float* pChannelGains); - MA_API void ma_copy_and_apply_volume_and_clip_samples_u8(ma_uint8* pDst, const ma_int16* pSrc, ma_uint64 count, float volume); MA_API void ma_copy_and_apply_volume_and_clip_samples_s16(ma_int16* pDst, const ma_int32* pSrc, ma_uint64 count, float volume); MA_API void ma_copy_and_apply_volume_and_clip_samples_s24(ma_uint8* pDst, const ma_int64* pSrc, ma_uint64 count, float volume); @@ -9841,7 +9504,6 @@ MA_API void ma_copy_and_apply_volume_and_clip_samples_s32(ma_int32* pDst, const MA_API void ma_copy_and_apply_volume_and_clip_samples_f32(float* pDst, const float* pSrc, ma_uint64 count, float volume); MA_API void ma_copy_and_apply_volume_and_clip_pcm_frames(void* pDst, const void* pSrc, ma_uint64 frameCount, ma_format format, ma_uint32 channels, float volume); - /* Helper for converting a linear factor to gain in decibels. */ @@ -9852,7 +9514,6 @@ Helper for converting gain in decibels to a linear factor. */ MA_API float ma_volume_db_to_linear(float gain); - /* Mixes the specified number of frames in floating point format with a volume factor. @@ -9860,9 +9521,6 @@ This will run on an optimized path when the volume is equal to 1. */ MA_API ma_result ma_mix_pcm_frames_f32(float* pDst, const float* pSrc, ma_uint64 frameCount, ma_uint32 channels, float volume); - - - /************************************************************************************************************************************************************ VFS @@ -9923,14 +9581,10 @@ typedef struct MA_API ma_result ma_default_vfs_init(ma_default_vfs* pVFS, const ma_allocation_callbacks* pAllocationCallbacks); - - typedef ma_result (* ma_read_proc)(void* pUserData, void* pBufferOut, size_t bytesToRead, size_t* pBytesRead); typedef ma_result (* ma_seek_proc)(void* pUserData, ma_int64 offset, ma_seek_origin origin); typedef ma_result (* ma_tell_proc)(void* pUserData, ma_int64* pCursor); - - #if !defined(MA_NO_DECODING) || !defined(MA_NO_ENCODING) typedef enum { @@ -9954,7 +9608,6 @@ you do your own synchronization. #ifndef MA_NO_DECODING typedef struct ma_decoder ma_decoder; - typedef struct { ma_format preferredFormat; @@ -9963,7 +9616,6 @@ typedef struct MA_API ma_decoding_backend_config ma_decoding_backend_config_init(ma_format preferredFormat, ma_uint32 seekPointCount); - typedef struct { ma_result (* onInit )(void* pUserData, ma_read_proc onRead, ma_seek_proc onSeek, ma_tell_proc onTell, void* pReadSeekTellUserData, const ma_decoding_backend_config* pConfig, const ma_allocation_callbacks* pAllocationCallbacks, ma_data_source** ppBackend); @@ -9973,7 +9625,6 @@ typedef struct void (* onUninit )(void* pUserData, ma_data_source* pBackend, const ma_allocation_callbacks* pAllocationCallbacks); } ma_decoding_backend_vtable; - typedef ma_result (* ma_decoder_read_proc)(ma_decoder* pDecoder, void* pBufferOut, size_t bytesToRead, size_t* pBytesRead); /* Returns the number of bytes read. */ typedef ma_result (* ma_decoder_seek_proc)(ma_decoder* pDecoder, ma_int64 byteOffset, ma_seek_origin origin); typedef ma_result (* ma_decoder_tell_proc)(ma_decoder* pDecoder, ma_int64* pCursor); @@ -10107,7 +9758,6 @@ MA_API ma_result ma_decode_memory(const void* pData, size_t dataSize, ma_decoder #endif /* MA_NO_DECODING */ - /************************************************************************************************************************************************************ Encoding @@ -10166,7 +9816,6 @@ MA_API ma_result ma_encoder_write_pcm_frames(ma_encoder* pEncoder, const void* p #endif /* MA_NO_ENCODING */ - /************************************************************************************************************************************************************ Generation @@ -10244,7 +9893,6 @@ typedef enum ma_noise_type_brownian } ma_noise_type; - typedef struct { ma_format format; @@ -10292,8 +9940,6 @@ MA_API ma_result ma_noise_set_type(ma_noise* pNoise, ma_noise_type type); #endif /* MA_NO_GENERATION */ - - /************************************************************************************************************************************************************ Resource Manager @@ -10321,7 +9967,6 @@ typedef enum MA_RESOURCE_MANAGER_DATA_SOURCE_FLAG_LOOPING = 0x00000020 /* When set, configures the data source to loop by default. */ } ma_resource_manager_data_source_flags; - /* Pipeline notifications used by the resource manager. Made up of both an async notification and a fence, both of which are optional. */ @@ -10339,8 +9984,6 @@ typedef struct MA_API ma_resource_manager_pipeline_notifications ma_resource_manager_pipeline_notifications_init(void); - - /* BEGIN BACKWARDS COMPATIBILITY */ /* TODO: Remove this block in version 0.12. */ #if 1 @@ -10359,9 +10002,6 @@ MA_API ma_resource_manager_pipeline_notifications ma_resource_manager_pipeline_n #endif /* END BACKWARDS COMPATIBILITY */ - - - /* Maximum job thread count will be restricted to this, but this may be removed later and replaced with a heap allocation thereby removing any limitation. */ #ifndef MA_RESOURCE_MANAGER_MAX_JOB_THREAD_COUNT #define MA_RESOURCE_MANAGER_MAX_JOB_THREAD_COUNT 64 @@ -10392,7 +10032,6 @@ typedef struct MA_API ma_resource_manager_data_source_config ma_resource_manager_data_source_config_init(void); - typedef enum { ma_resource_manager_data_supply_type_unknown = 0, /* Used for determining whether or the data supply has been initialized. */ @@ -10610,8 +10249,6 @@ MA_API ma_result ma_resource_manager_process_job(ma_resource_manager* pResourceM MA_API ma_result ma_resource_manager_process_next_job(ma_resource_manager* pResourceManager); /* Returns MA_CANCELLED if a MA_JOB_TYPE_QUIT job is found. In non-blocking mode, returns MA_NO_DATA_AVAILABLE if no jobs are available. */ #endif /* MA_NO_RESOURCE_MANAGER */ - - /************************************************************************************************************************************************************ Node Graph @@ -10631,7 +10268,6 @@ Node Graph /* Use this when the bus count is determined by the node instance rather than the vtable. */ #define MA_NODE_BUS_COUNT_UNKNOWN 255 - /* For some internal memory management of ma_node_graph. */ typedef struct { @@ -10640,11 +10276,9 @@ typedef struct unsigned char _data[1]; } ma_stack; - typedef struct ma_node_graph ma_node_graph; typedef void ma_node; - /* Node flags. */ typedef enum { @@ -10655,7 +10289,6 @@ typedef enum MA_NODE_FLAG_SILENT_OUTPUT = 0x00000010 } ma_node_flags; - /* The playback state of a node. Either started or stopped. */ typedef enum { @@ -10663,7 +10296,6 @@ typedef enum ma_node_state_stopped = 1 } ma_node_state; - typedef struct { /* @@ -10719,7 +10351,6 @@ typedef struct MA_API ma_node_config ma_node_config_init(void); - /* A node has multiple output buses. An output bus is attached to an input bus as an item in a linked list. Think of the input bus as a linked list, with the output bus being an item in that list. @@ -10760,7 +10391,6 @@ struct ma_node_input_bus ma_uint8 channels; /* The number of channels in the audio stream for this bus. */ }; - typedef struct ma_node_base ma_node_base; struct ma_node_base { @@ -10814,7 +10444,6 @@ MA_API ma_node_state ma_node_get_state_by_time_range(const ma_node* pNode, ma_ui MA_API ma_uint64 ma_node_get_time(const ma_node* pNode); MA_API ma_result ma_node_set_time(ma_node* pNode, ma_uint64 localTime); - typedef struct { ma_uint32 channels; @@ -10824,7 +10453,6 @@ typedef struct MA_API ma_node_graph_config ma_node_graph_config_init(ma_uint32 channels); - struct ma_node_graph { /* Immutable. */ @@ -10850,8 +10478,6 @@ MA_API ma_uint64 ma_node_graph_get_time(const ma_node_graph* pNodeGraph); MA_API ma_result ma_node_graph_set_time(ma_node_graph* pNodeGraph, ma_uint64 globalTime); MA_API ma_uint32 ma_node_graph_get_processing_size_in_frames(const ma_node_graph* pNodeGraph); - - /* Data source node. 0 input buses, 1 output bus. Used for reading from a data source. */ typedef struct { @@ -10861,7 +10487,6 @@ typedef struct MA_API ma_data_source_node_config ma_data_source_node_config_init(ma_data_source* pDataSource); - typedef struct { ma_node_base base; @@ -10873,7 +10498,6 @@ MA_API void ma_data_source_node_uninit(ma_data_source_node* pDataSourceNode, con MA_API ma_result ma_data_source_node_set_looping(ma_data_source_node* pDataSourceNode, ma_bool32 isLooping); MA_API ma_bool32 ma_data_source_node_is_looping(ma_data_source_node* pDataSourceNode); - /* Splitter Node. 1 input, many outputs. Used for splitting/copying a stream so it can be as input into two separate output nodes. */ typedef struct { @@ -10884,7 +10508,6 @@ typedef struct MA_API ma_splitter_node_config ma_splitter_node_config_init(ma_uint32 channels); - typedef struct { ma_node_base base; @@ -10893,7 +10516,6 @@ typedef struct MA_API ma_result ma_splitter_node_init(ma_node_graph* pNodeGraph, const ma_splitter_node_config* pConfig, const ma_allocation_callbacks* pAllocationCallbacks, ma_splitter_node* pSplitterNode); MA_API void ma_splitter_node_uninit(ma_splitter_node* pSplitterNode, const ma_allocation_callbacks* pAllocationCallbacks); - /* Biquad Node */ @@ -10905,7 +10527,6 @@ typedef struct MA_API ma_biquad_node_config ma_biquad_node_config_init(ma_uint32 channels, float b0, float b1, float b2, float a0, float a1, float a2); - typedef struct { ma_node_base baseNode; @@ -10916,7 +10537,6 @@ MA_API ma_result ma_biquad_node_init(ma_node_graph* pNodeGraph, const ma_biquad_ MA_API ma_result ma_biquad_node_reinit(const ma_biquad_config* pConfig, ma_biquad_node* pNode); MA_API void ma_biquad_node_uninit(ma_biquad_node* pNode, const ma_allocation_callbacks* pAllocationCallbacks); - /* Low Pass Filter Node */ @@ -10928,7 +10548,6 @@ typedef struct MA_API ma_lpf_node_config ma_lpf_node_config_init(ma_uint32 channels, ma_uint32 sampleRate, double cutoffFrequency, ma_uint32 order); - typedef struct { ma_node_base baseNode; @@ -10939,7 +10558,6 @@ MA_API ma_result ma_lpf_node_init(ma_node_graph* pNodeGraph, const ma_lpf_node_c MA_API ma_result ma_lpf_node_reinit(const ma_lpf_config* pConfig, ma_lpf_node* pNode); MA_API void ma_lpf_node_uninit(ma_lpf_node* pNode, const ma_allocation_callbacks* pAllocationCallbacks); - /* High Pass Filter Node */ @@ -10951,7 +10569,6 @@ typedef struct MA_API ma_hpf_node_config ma_hpf_node_config_init(ma_uint32 channels, ma_uint32 sampleRate, double cutoffFrequency, ma_uint32 order); - typedef struct { ma_node_base baseNode; @@ -10962,7 +10579,6 @@ MA_API ma_result ma_hpf_node_init(ma_node_graph* pNodeGraph, const ma_hpf_node_c MA_API ma_result ma_hpf_node_reinit(const ma_hpf_config* pConfig, ma_hpf_node* pNode); MA_API void ma_hpf_node_uninit(ma_hpf_node* pNode, const ma_allocation_callbacks* pAllocationCallbacks); - /* Band Pass Filter Node */ @@ -10974,7 +10590,6 @@ typedef struct MA_API ma_bpf_node_config ma_bpf_node_config_init(ma_uint32 channels, ma_uint32 sampleRate, double cutoffFrequency, ma_uint32 order); - typedef struct { ma_node_base baseNode; @@ -10985,7 +10600,6 @@ MA_API ma_result ma_bpf_node_init(ma_node_graph* pNodeGraph, const ma_bpf_node_c MA_API ma_result ma_bpf_node_reinit(const ma_bpf_config* pConfig, ma_bpf_node* pNode); MA_API void ma_bpf_node_uninit(ma_bpf_node* pNode, const ma_allocation_callbacks* pAllocationCallbacks); - /* Notching Filter Node */ @@ -10997,7 +10611,6 @@ typedef struct MA_API ma_notch_node_config ma_notch_node_config_init(ma_uint32 channels, ma_uint32 sampleRate, double q, double frequency); - typedef struct { ma_node_base baseNode; @@ -11008,7 +10621,6 @@ MA_API ma_result ma_notch_node_init(ma_node_graph* pNodeGraph, const ma_notch_no MA_API ma_result ma_notch_node_reinit(const ma_notch_config* pConfig, ma_notch_node* pNode); MA_API void ma_notch_node_uninit(ma_notch_node* pNode, const ma_allocation_callbacks* pAllocationCallbacks); - /* Peaking Filter Node */ @@ -11020,7 +10632,6 @@ typedef struct MA_API ma_peak_node_config ma_peak_node_config_init(ma_uint32 channels, ma_uint32 sampleRate, double gainDB, double q, double frequency); - typedef struct { ma_node_base baseNode; @@ -11031,7 +10642,6 @@ MA_API ma_result ma_peak_node_init(ma_node_graph* pNodeGraph, const ma_peak_node MA_API ma_result ma_peak_node_reinit(const ma_peak_config* pConfig, ma_peak_node* pNode); MA_API void ma_peak_node_uninit(ma_peak_node* pNode, const ma_allocation_callbacks* pAllocationCallbacks); - /* Low Shelf Filter Node */ @@ -11043,7 +10653,6 @@ typedef struct MA_API ma_loshelf_node_config ma_loshelf_node_config_init(ma_uint32 channels, ma_uint32 sampleRate, double gainDB, double q, double frequency); - typedef struct { ma_node_base baseNode; @@ -11054,7 +10663,6 @@ MA_API ma_result ma_loshelf_node_init(ma_node_graph* pNodeGraph, const ma_loshel MA_API ma_result ma_loshelf_node_reinit(const ma_loshelf_config* pConfig, ma_loshelf_node* pNode); MA_API void ma_loshelf_node_uninit(ma_loshelf_node* pNode, const ma_allocation_callbacks* pAllocationCallbacks); - /* High Shelf Filter Node */ @@ -11066,7 +10674,6 @@ typedef struct MA_API ma_hishelf_node_config ma_hishelf_node_config_init(ma_uint32 channels, ma_uint32 sampleRate, double gainDB, double q, double frequency); - typedef struct { ma_node_base baseNode; @@ -11077,7 +10684,6 @@ MA_API ma_result ma_hishelf_node_init(ma_node_graph* pNodeGraph, const ma_hishel MA_API ma_result ma_hishelf_node_reinit(const ma_hishelf_config* pConfig, ma_hishelf_node* pNode); MA_API void ma_hishelf_node_uninit(ma_hishelf_node* pNode, const ma_allocation_callbacks* pAllocationCallbacks); - typedef struct { ma_node_config nodeConfig; @@ -11086,7 +10692,6 @@ typedef struct MA_API ma_delay_node_config ma_delay_node_config_init(ma_uint32 channels, ma_uint32 sampleRate, ma_uint32 delayInFrames, float decay); - typedef struct { ma_node_base baseNode; @@ -11103,7 +10708,6 @@ MA_API void ma_delay_node_set_decay(ma_delay_node* pDelayNode, float value); MA_API float ma_delay_node_get_decay(const ma_delay_node* pDelayNode); #endif /* MA_NO_NODE_GRAPH */ - /* SECTION: miniaudio_engine.h */ /************************************************************************************************************************************************************ @@ -11114,7 +10718,6 @@ Engine typedef struct ma_engine ma_engine; typedef struct ma_sound ma_sound; - /* Sound flags. */ typedef enum { @@ -11161,7 +10764,6 @@ typedef struct MA_API ma_engine_node_config ma_engine_node_config_init(ma_engine* pEngine, ma_engine_node_type type, ma_uint32 flags); - /* Base node object for both ma_sound and ma_sound_group. */ typedef struct { @@ -11202,7 +10804,6 @@ MA_API ma_result ma_engine_node_init_preallocated(const ma_engine_node_config* p MA_API ma_result ma_engine_node_init(const ma_engine_node_config* pConfig, const ma_allocation_callbacks* pAllocationCallbacks, ma_engine_node* pEngineNode); MA_API void ma_engine_node_uninit(ma_engine_node* pEngineNode, const ma_allocation_callbacks* pAllocationCallbacks); - #define MA_SOUND_SOURCE_CHANNEL_COUNT 0xFFFFFFFF /* Callback for when a sound reaches the end. */ @@ -11313,7 +10914,6 @@ typedef struct MA_API ma_engine_config ma_engine_config_init(void); - struct ma_engine { ma_node_graph nodeGraph; /* An engine is a node graph. It should be able to be plugged into any ma_node_graph API (with a cast) which means this must be the first member of this struct. */ @@ -11534,7 +11134,6 @@ MA_API ma_uint64 ma_sound_group_get_time_in_pcm_frames(const ma_sound_group* pGr #endif #endif /* miniaudio_h */ - /* This is for preventing greying out of the implementation section. */ @@ -11610,7 +11209,6 @@ IMPLEMENTATION #include #endif - /* Architecture Detection */ #if !defined(MA_64BIT) && !defined(MA_32BIT) #ifdef _WIN32 @@ -11943,7 +11541,6 @@ static MA_INLINE ma_bool32 ma_has_neon(void) #endif #endif - static MA_INLINE ma_bool32 ma_is_little_endian(void) { #if defined(MA_X86) || defined(MA_X64) @@ -11959,7 +11556,6 @@ static MA_INLINE ma_bool32 ma_is_big_endian(void) return !ma_is_little_endian(); } - static MA_INLINE ma_uint32 ma_swap_endian_uint32(ma_uint32 n) { #ifdef MA_HAS_BYTESWAP32_INTRINSIC @@ -11991,7 +11587,6 @@ static MA_INLINE ma_uint32 ma_swap_endian_uint32(ma_uint32 n) #endif } - #if !defined(MA_EMSCRIPTEN) #ifdef MA_WIN32 static void ma_sleep__win32(ma_uint32 milliseconds) @@ -12063,7 +11658,6 @@ static MA_INLINE void ma_yield(void) #endif } - #define MA_MM_DENORMALS_ZERO_MASK 0x0040 #define MA_MM_FLUSH_ZERO_MASK 0x8000 @@ -12153,7 +11747,6 @@ static MA_INLINE void ma_restore_denormals(unsigned int prevState) #endif } - #ifdef MA_ANDROID #include @@ -12168,12 +11761,10 @@ int ma_android_sdk_version() } #endif - #ifndef MA_COINIT_VALUE #define MA_COINIT_VALUE 0 /* 0 = COINIT_MULTITHREADED */ #endif - #ifndef MA_FLT_MAX #ifdef FLT_MAX #define MA_FLT_MAX FLT_MAX @@ -12182,7 +11773,6 @@ int ma_android_sdk_version() #endif #endif - #ifndef MA_PI #define MA_PI 3.14159265358979323846264f #endif @@ -12196,7 +11786,6 @@ int ma_android_sdk_version() #define MA_TAU_D 6.28318530717958647693 #endif - /* The default format when ma_format_unknown (0) is requested when initializing a device. */ #ifndef MA_DEFAULT_FORMAT #define MA_DEFAULT_FORMAT ma_format_f32 @@ -12236,7 +11825,6 @@ int ma_android_sdk_version() #endif #endif - #if defined(__clang__) || (defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6))) #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wunused-variable" @@ -12278,7 +11866,6 @@ static MA_INLINE ma_bool32 ma_is_standard_sample_rate(ma_uint32 sampleRate) return MA_FALSE; } - static ma_format g_maFormatPriorities[] = { ma_format_s16, /* Most common */ ma_format_f32, @@ -12294,7 +11881,6 @@ static ma_format g_maFormatPriorities[] = { #pragma GCC diagnostic pop #endif - MA_API void ma_version(ma_uint32* pMajor, ma_uint32* pMinor, ma_uint32* pRevision) { if (pMajor) { @@ -12315,7 +11901,6 @@ MA_API const char* ma_version_string(void) return MA_VERSION_STRING; } - /****************************************************************************** Standard Library Stuff @@ -12347,7 +11932,6 @@ static MA_INLINE void ma_zero_memory_default(void* p, size_t sz) } } - #ifndef MA_ZERO_MEMORY #define MA_ZERO_MEMORY(p, sz) ma_zero_memory_default((p), (sz)) #endif @@ -12401,7 +11985,6 @@ static MA_INLINE double ma_sqrtd(double x) return sqrt(x); } - static MA_INLINE float ma_rsqrtf(float x) { #if defined(MA_SUPPORT_SSE2) && !defined(MA_NO_SSE2) && (defined(MA_X64) || (defined(_M_IX86_FP) && _M_IX86_FP == 2) || defined(__SSE2__)) @@ -12435,7 +12018,6 @@ static MA_INLINE float ma_rsqrtf(float x) #endif } - static MA_INLINE float ma_sinf(float x) { return (float)ma_sind((float)x); @@ -12466,7 +12048,6 @@ static MA_INLINE float ma_log10f(float x) return (float)ma_log10d((double)x); } - static MA_INLINE double ma_degrees_to_radians(double degrees) { return degrees * 0.01745329252; @@ -12487,7 +12068,6 @@ static MA_INLINE float ma_radians_to_degrees_f(float radians) return radians * 57.295779512896f; } - /* Return Values: 0: Success @@ -12555,7 +12135,6 @@ MA_API MA_NO_INLINE int ma_wcscpy_s(wchar_t* dst, size_t dstCap, const wchar_t* return 34; } - MA_API MA_NO_INLINE int ma_strncpy_s(char* dst, size_t dstSizeInBytes, const char* src, size_t count) { size_t maxcount; @@ -12616,7 +12195,6 @@ MA_API MA_NO_INLINE int ma_strcat_s(char* dst, size_t dstSizeInBytes, const char return 22; /* Unterminated. */ } - while (dstSizeInBytes > 0 && src[0] != '\0') { *dst++ = *src++; dstSizeInBytes -= 1; @@ -12657,7 +12235,6 @@ MA_API MA_NO_INLINE int ma_strncat_s(char* dst, size_t dstSizeInBytes, const cha return 22; /* Unterminated. */ } - if (count == ((size_t)-1)) { /* _TRUNCATE */ count = dstSizeInBytes - 1; } @@ -12732,7 +12309,6 @@ MA_API MA_NO_INLINE int ma_itoa_s(int value, char* dst, size_t dstSizeInBytes, i *dstEnd = '\0'; - /* At this point the string will be reversed. */ dstEnd -= 1; while (dst < dstEnd) { @@ -12859,8 +12435,6 @@ MA_API MA_NO_INLINE wchar_t* ma_copy_string_w(const wchar_t* src, const ma_alloc return dst; } - - #include static ma_result ma_result_from_errno(int e) { @@ -13307,8 +12881,6 @@ MA_API ma_result ma_fopen(FILE** ppFile, const char* pFilePath, const char* pOpe return MA_SUCCESS; } - - /* _wfopen() isn't always available in all compilation environments. @@ -13419,8 +12991,6 @@ MA_API ma_result ma_wfopen(FILE** ppFile, const wchar_t* pFilePath, const wchar_ return MA_SUCCESS; } - - static MA_INLINE void ma_copy_memory_64(void* dst, const void* src, ma_uint64 sizeInBytes) { #if MA_SIZE_MAX > 0xFFFFFFFF @@ -13460,7 +13030,6 @@ static MA_INLINE void ma_zero_memory_64(void* dst, ma_uint64 sizeInBytes) #endif } - /* Thanks to good old Bit Twiddling Hacks for this one: http://graphics.stanford.edu/~seander/bithacks.html#RoundUpPowerOf2 */ static MA_INLINE unsigned int ma_next_power_of_2(unsigned int x) { @@ -13505,8 +13074,6 @@ static MA_INLINE unsigned int ma_count_set_bits(unsigned int x) return count; } - - /************************************************************************************************************************************************************** Allocation Callbacks @@ -13564,9 +13131,6 @@ static ma_result ma_allocation_callbacks_init_copy(ma_allocation_callbacks* pDst return MA_SUCCESS; } - - - /************************************************************************************************************************************************************** Logging @@ -13636,7 +13200,6 @@ MA_API ma_log_callback ma_log_callback_init(ma_log_callback_proc onLog, void* pU return callback; } - MA_API ma_result ma_log_init(const ma_allocation_callbacks* pAllocationCallbacks, ma_log* pLog) { if (pLog == NULL) { @@ -13766,7 +13329,6 @@ MA_API ma_result ma_log_post(ma_log* pLog, ma_uint32 level, const char* pMessage return MA_SUCCESS; } - /* We need to emulate _vscprintf() for the VC6 build. This can be more efficient, but since it's only VC6, and it's just a logging function, I'm happy to keep this simple. In the VC6 build we can implement this in terms of _vsnprintf(). @@ -13935,8 +13497,6 @@ MA_API ma_result ma_log_postf(ma_log* pLog, ma_uint32 level, const char* pFormat return result; } - - static MA_INLINE ma_uint8 ma_clip_u8(ma_int32 x) { return (ma_uint8)(ma_clamp(x, -128, 127) + 128); @@ -13970,7 +13530,6 @@ static MA_INLINE float ma_clip_f32(float x) return x; } - static MA_INLINE float ma_mix_f32(float x, float y, float a) { return x*(1-a) + y*a; @@ -14002,7 +13561,6 @@ static MA_INLINE float32x4_t ma_mix_f32_fast__neon(float32x4_t x, float32x4_t y, } #endif - static MA_INLINE double ma_mix_f64(double x, double y, double a) { return x*(1-a) + y*a; @@ -14017,7 +13575,6 @@ static MA_INLINE float ma_scale_to_range_f32(float x, float lo, float hi) return lo + x*(hi-lo); } - /* Greatest common factor using Euclid's algorithm iteratively. */ @@ -14036,7 +13593,6 @@ static MA_INLINE ma_uint32 ma_gcf_u32(ma_uint32 a, ma_uint32 b) return a; } - static ma_uint32 ma_ffs_32(ma_uint32 x) { ma_uint32 i; @@ -14056,8 +13612,6 @@ static MA_INLINE ma_int16 ma_float_to_fixed_16(float x) return (ma_int16)(x * (1 << 8)); } - - /* Random Number Generation @@ -14123,7 +13677,6 @@ static MA_INLINE ma_int32 ma_lcg_rand_range_s32(ma_lcg* pLCG, ma_int32 lo, ma_in return lo + ma_lcg_rand_u32(pLCG) / (0xFFFFFFFF / (hi - lo + 1) + 1); } - #if 0 /* Currently unused. */ static MA_INLINE void ma_seed(ma_int32 seed) { @@ -14161,7 +13714,6 @@ static MA_INLINE ma_int32 ma_rand_range_s32(ma_int32 lo, ma_int32 hi) return ma_lcg_rand_range_s32(&g_maLCG, lo, hi); } - static MA_INLINE float ma_dither_f32_rectangle(float ditherMin, float ditherMax) { return ma_rand_range_f32(ditherMin, ditherMax); @@ -14201,7 +13753,6 @@ static MA_INLINE ma_int32 ma_dither_s32(ma_dither_mode ditherMode, ma_int32 dith return 0; } - /************************************************************************************************************************************************************** Atomics @@ -17457,7 +17008,6 @@ MA_ATOMIC_SAFE_TYPE_IMPL(32, bool32) MA_ATOMIC_SAFE_TYPE_IMPL(i32, device_state) #endif - MA_API ma_uint64 ma_calculate_frame_count_after_resampling(ma_uint32 sampleRateOut, ma_uint32 sampleRateIn, ma_uint64 frameCountIn) { /* This is based on the calculation in ma_linear_resampler_get_expected_output_frame_count(). */ @@ -17489,8 +17039,6 @@ MA_API ma_uint64 ma_calculate_frame_count_after_resampling(ma_uint32 sampleRateO #define MA_DATA_CONVERTER_STACK_BUFFER_SIZE 4096 #endif - - #if defined(MA_WIN32) static ma_result ma_result_from_GetLastError(DWORD error) { @@ -17514,7 +17062,6 @@ static ma_result ma_result_from_GetLastError(DWORD error) } #endif /* MA_WIN32 */ - /******************************************************************************* Threading @@ -17561,7 +17108,6 @@ MA_API ma_result ma_spinlock_unlock(volatile ma_spinlock* pSpinlock) return MA_SUCCESS; } - #ifndef MA_NO_THREADING #if defined(MA_POSIX) #define MA_THREADCALL @@ -17705,7 +17251,6 @@ static void ma_thread_wait__posix(ma_thread* pThread) pthread_join((pthread_t)*pThread, NULL); } - static ma_result ma_mutex_init__posix(ma_mutex* pMutex) { int result; @@ -17739,7 +17284,6 @@ static void ma_mutex_unlock__posix(ma_mutex* pMutex) pthread_mutex_unlock((pthread_mutex_t*)pMutex); } - static ma_result ma_event_init__posix(ma_event* pEvent) { int result; @@ -17791,7 +17335,6 @@ static ma_result ma_event_signal__posix(ma_event* pEvent) return MA_SUCCESS; } - static ma_result ma_semaphore_init__posix(int initialValue, ma_semaphore* pSemaphore) { int result; @@ -17896,7 +17439,6 @@ static void ma_thread_wait__win32(ma_thread* pThread) CloseHandle((HANDLE)*pThread); } - static ma_result ma_mutex_init__win32(ma_mutex* pMutex) { *pMutex = CreateEventA(NULL, FALSE, TRUE, NULL); @@ -17922,7 +17464,6 @@ static void ma_mutex_unlock__win32(ma_mutex* pMutex) SetEvent((HANDLE)*pMutex); } - static ma_result ma_event_init__win32(ma_event* pEvent) { *pEvent = CreateEventA(NULL, FALSE, FALSE, NULL); @@ -17962,7 +17503,6 @@ static ma_result ma_event_signal__win32(ma_event* pEvent) return MA_SUCCESS; } - static ma_result ma_semaphore_init__win32(int initialValue, ma_semaphore* pSemaphore) { *pSemaphore = CreateSemaphore(NULL, (LONG)initialValue, LONG_MAX, NULL); @@ -18087,7 +17627,6 @@ static void ma_thread_wait(ma_thread* pThread) #endif } - MA_API ma_result ma_mutex_init(ma_mutex* pMutex) { if (pMutex == NULL) { @@ -18143,7 +17682,6 @@ MA_API void ma_mutex_unlock(ma_mutex* pMutex) #endif } - MA_API ma_result ma_event_init(ma_event* pEvent) { if (pEvent == NULL) { @@ -18239,7 +17777,6 @@ MA_API ma_result ma_event_signal(ma_event* pEvent) #endif } - MA_API ma_result ma_semaphore_init(int initialValue, ma_semaphore* pSemaphore) { if (pSemaphore == NULL) { @@ -18302,8 +17839,6 @@ MA_API ma_result ma_semaphore_release(ma_semaphore* pSemaphore) #endif #endif /* MA_NO_THREADING */ - - #define MA_FENCE_COUNTER_MAX 0x7FFFFFFF MA_API ma_result ma_fence_init(ma_fence* pFence) @@ -18446,7 +17981,6 @@ MA_API ma_result ma_fence_wait(ma_fence* pFence) /*return MA_INVALID_OPERATION;*/ } - MA_API ma_result ma_async_notification_signal(ma_async_notification* pNotification) { ma_async_notification_callbacks* pNotificationCallbacks = (ma_async_notification_callbacks*)pNotification; @@ -18463,7 +17997,6 @@ MA_API ma_result ma_async_notification_signal(ma_async_notification* pNotificati return MA_INVALID_ARGS; } - static void ma_async_notification_poll__on_signal(ma_async_notification* pNotification) { ((ma_async_notification_poll*)pNotification)->signalled = MA_TRUE; @@ -18490,7 +18023,6 @@ MA_API ma_bool32 ma_async_notification_poll_is_signalled(const ma_async_notifica return pNotificationPoll->signalled; } - static void ma_async_notification_event__on_signal(ma_async_notification* pNotification) { ma_async_notification_event_signal((ma_async_notification_event*)pNotification); @@ -18574,8 +18106,6 @@ MA_API ma_result ma_async_notification_event_signal(ma_async_notification_event* #endif } - - /************************************************************************************************************************************************************ Job Queue @@ -18591,7 +18121,6 @@ MA_API ma_slot_allocator_config ma_slot_allocator_config_init(ma_uint32 capacity return config; } - static MA_INLINE ma_uint32 ma_slot_allocator_calculate_group_capacity(ma_uint32 slotCapacity) { ma_uint32 cap = slotCapacity / 32; @@ -18607,7 +18136,6 @@ static MA_INLINE ma_uint32 ma_slot_allocator_group_capacity(const ma_slot_alloca return ma_slot_allocator_calculate_group_capacity(pAllocator->capacity); } - typedef struct { size_t sizeInBytes; @@ -18845,7 +18373,6 @@ MA_API ma_result ma_slot_allocator_free(ma_slot_allocator* pAllocator, ma_uint64 return MA_INVALID_OPERATION; } - #define MA_JOB_ID_NONE ~((ma_uint64)0) #define MA_JOB_SLOT_NONE (ma_uint16)(~0) @@ -18880,7 +18407,6 @@ static MA_INLINE ma_uint64 ma_job_set_refcount(ma_uint64 toc, ma_uint32 refcount return toc; } - MA_API ma_job ma_job_init(ma_uint16 code) { ma_job job; @@ -18893,7 +18419,6 @@ MA_API ma_job ma_job_init(ma_uint16 code) return job; } - static ma_result ma_job_process__noop(ma_job* pJob); static ma_result ma_job_process__quit(ma_job* pJob); static ma_result ma_job_process__custom(ma_job* pJob); @@ -18974,8 +18499,6 @@ static ma_result ma_job_process__custom(ma_job* pJob) return pJob->data.custom.proc(pJob); } - - MA_API ma_job_queue_config ma_job_queue_config_init(ma_uint32 flags, ma_uint32 capacity) { ma_job_queue_config config; @@ -18986,7 +18509,6 @@ MA_API ma_job_queue_config ma_job_queue_config_init(ma_uint32 flags, ma_uint32 c return config; } - typedef struct { size_t sizeInBytes; @@ -19226,7 +18748,6 @@ MA_API ma_result ma_job_queue_post(ma_job_queue* pQueue, const ma_job* pJob) ma_spinlock_unlock(&pQueue->lock); #endif - /* Signal the semaphore as the last step if we're using synchronous mode. */ if ((pQueue->flags & MA_JOB_QUEUE_FLAG_NON_BLOCKING) == 0) { #ifndef MA_NO_THREADING @@ -19322,8 +18843,6 @@ MA_API ma_result ma_job_queue_next(ma_job_queue* pQueue, ma_job* pJob) return MA_SUCCESS; } - - /******************************************************************************* Dynamic Linking @@ -19465,8 +18984,6 @@ MA_API ma_proc ma_dlsym(ma_log* pLog, ma_handle handle, const char* symbol) #endif } - - /************************************************************************************************************************************************************ ************************************************************************************************************************************************************* @@ -19495,7 +19012,6 @@ DEVICE I/O #define MA_AAUDIO_MIN_ANDROID_SDK_VERSION 27 #endif - MA_API void ma_device_info_add_native_data_format(ma_device_info* pDeviceInfo, ma_format format, ma_uint32 channels, ma_uint32 sampleRate, ma_uint32 flags) { if (pDeviceInfo == NULL) { @@ -19511,7 +19027,6 @@ MA_API void ma_device_info_add_native_data_format(ma_device_info* pDeviceInfo, m } } - typedef struct { ma_backend backend; @@ -19740,8 +19255,6 @@ MA_API ma_bool32 ma_is_loopback_supported(ma_backend backend) } } - - #if defined(MA_WIN32) && !defined(MA_XBOX) /* WASAPI error codes. */ #define MA_AUDCLNT_E_NOT_INITIALIZED ((HRESULT)0x88890001) @@ -20011,13 +19524,9 @@ MA_API int ma_strcpy_s_WCHAR(WCHAR* dst, size_t dstCap, const WCHAR* src) } #endif /* MA_WIN32 */ - #define MA_DEFAULT_PLAYBACK_DEVICE_NAME "Default Playback Device" #define MA_DEFAULT_CAPTURE_DEVICE_NAME "Default Capture Device" - - - /******************************************************************************* Timing @@ -20128,8 +19637,6 @@ Timing #endif #endif - - #if 0 static ma_uint32 ma_get_closest_standard_sample_rate(ma_uint32 sampleRateIn) { @@ -20161,7 +19668,6 @@ static ma_uint32 ma_get_closest_standard_sample_rate(ma_uint32 sampleRateIn) } #endif - static MA_INLINE unsigned int ma_device_disable_denormals(ma_device* pDevice) { MA_ASSERT(pDevice != NULL); @@ -20241,7 +19747,6 @@ void EMSCRIPTEN_KEEPALIVE ma_device__on_notification_unlocked(ma_device* pDevice #endif #endif - static void ma_device__on_data_inner(ma_device* pDevice, void* pFramesOut, const void* pFramesIn, ma_uint32 frameCount) { MA_ASSERT(pDevice != NULL); @@ -20409,8 +19914,6 @@ static void ma_device__handle_data_callback(ma_device* pDevice, void* pFramesOut } } - - /* A helper function for reading sample data from the client. */ static void ma_device__read_frames_from_client(ma_device* pDevice, ma_uint32 frameCount, void* pFramesOut) { @@ -20695,8 +20198,6 @@ static MA_INLINE void ma_device__set_state(ma_device* pDevice, ma_device_state n ma_atomic_device_state_set(&pDevice->state, newState); } - - MA_API ma_uint32 ma_get_format_priority_index(ma_format format) /* Lower = better. */ { ma_uint32 i; @@ -20733,7 +20234,6 @@ static ma_bool32 ma_device_descriptor_is_valid(const ma_device_descriptor* pDevi return MA_TRUE; } - static ma_result ma_device_audio_thread__default_read_write(ma_device* pDevice) { ma_result result = MA_SUCCESS; @@ -20924,8 +20424,6 @@ static ma_result ma_device_audio_thread__default_read_write(ma_device* pDevice) return result; } - - /******************************************************************************* Null Backend @@ -21106,7 +20604,6 @@ static ma_result ma_context_get_device_info__null(ma_context* pContext, ma_devic return MA_SUCCESS; } - static ma_result ma_device_uninit__null(ma_device* pDevice) { MA_ASSERT(pDevice != NULL); @@ -21400,8 +20897,6 @@ static ma_result ma_context_init__null(ma_context* pContext, const ma_context_co } #endif - - /******************************************************************************* WIN32 COMMON @@ -21512,8 +21007,6 @@ typedef struct GUID SubFormat; } MA_WAVEFORMATEXTENSIBLE; - - #ifndef WAVE_FORMAT_EXTENSIBLE #define WAVE_FORMAT_EXTENSIBLE 0xFFFE #endif @@ -21699,7 +21192,6 @@ static ma_format ma_format_from_WAVEFORMATEX(const MA_WAVEFORMATEX* pWF) } #endif - /******************************************************************************* WASAPI Backend @@ -21744,7 +21236,6 @@ typedef struct { typedef BOOL (WINAPI * ma_PFNVerifyVersionInfoW) (ma_OSVERSIONINFOEXW* lpVersionInfo, DWORD dwTypeMask, DWORDLONG dwlConditionMask); typedef ULONGLONG (WINAPI * ma_PFNVerSetConditionMask)(ULONGLONG dwlConditionMask, DWORD dwTypeBitMask, BYTE dwConditionMask); - #ifndef PROPERTYKEY_DEFINED #define PROPERTYKEY_DEFINED #ifndef __WATCOMC__ @@ -21762,7 +21253,6 @@ static MA_INLINE void ma_PropVariantInit(MA_PROPVARIANT* pProp) MA_ZERO_OBJECT(pProp); } - static const PROPERTYKEY MA_PKEY_Device_FriendlyName = {{0xA45C254E, 0xDF1C, 0x4EFD, {0x80, 0x20, 0x67, 0xD1, 0x46, 0xA8, 0x50, 0xE0}}, 14}; static const PROPERTYKEY MA_PKEY_AudioEngine_DeviceFormat = {{0xF19F064D, 0x82C, 0x4E27, {0xBC, 0x73, 0x68, 0x82, 0xA1, 0xBB, 0x8E, 0x4C}}, 0}; @@ -21927,7 +21417,6 @@ static MA_INLINE ULONG ma_IUnknown_Release(ma_IUnknown* pThis) static MA_INLINE HRESULT ma_IMMDeviceEnumerator_RegisterEndpointNotificationCallback(ma_IMMDeviceEnumerator* pThis, ma_IMMNotificationClient* pClient) { return pThis->lpVtbl->RegisterEndpointNotificationCallback(pThis, pClient); } static MA_INLINE HRESULT ma_IMMDeviceEnumerator_UnregisterEndpointNotificationCallback(ma_IMMDeviceEnumerator* pThis, ma_IMMNotificationClient* pClient) { return pThis->lpVtbl->UnregisterEndpointNotificationCallback(pThis, pClient); } - /* IMMDeviceCollection */ typedef struct { @@ -21950,7 +21439,6 @@ static MA_INLINE ULONG ma_IUnknown_Release(ma_IUnknown* pThis) static MA_INLINE HRESULT ma_IMMDeviceCollection_GetCount(ma_IMMDeviceCollection* pThis, UINT* pDevices) { return pThis->lpVtbl->GetCount(pThis, pDevices); } static MA_INLINE HRESULT ma_IMMDeviceCollection_Item(ma_IMMDeviceCollection* pThis, UINT nDevice, ma_IMMDevice** ppDevice) { return pThis->lpVtbl->Item(pThis, nDevice, ppDevice); } - /* IMMDevice */ typedef struct { @@ -22026,7 +21514,6 @@ static MA_INLINE HRESULT ma_IPropertyStore_GetValue(ma_IPropertyStore* pThis, co static MA_INLINE HRESULT ma_IPropertyStore_SetValue(ma_IPropertyStore* pThis, const PROPERTYKEY* const pKey, const MA_PROPVARIANT* const pPropVar) { return pThis->lpVtbl->SetValue(pThis, pKey, pPropVar); } static MA_INLINE HRESULT ma_IPropertyStore_Commit(ma_IPropertyStore* pThis) { return pThis->lpVtbl->Commit(pThis); } - /* IAudioClient */ typedef struct { @@ -22119,7 +21606,6 @@ static MA_INLINE HRESULT ma_IAudioClient2_IsOffloadCapable(ma_IAudioClient2* pTh static MA_INLINE HRESULT ma_IAudioClient2_SetClientProperties(ma_IAudioClient2* pThis, const ma_AudioClientProperties* pProperties) { return pThis->lpVtbl->SetClientProperties(pThis, pProperties); } static MA_INLINE HRESULT ma_IAudioClient2_GetBufferSizeLimits(ma_IAudioClient2* pThis, const MA_WAVEFORMATEX* pFormat, BOOL eventDriven, MA_REFERENCE_TIME* pMinBufferDuration, MA_REFERENCE_TIME* pMaxBufferDuration) { return pThis->lpVtbl->GetBufferSizeLimits(pThis, pFormat, eventDriven, pMinBufferDuration, pMaxBufferDuration); } - /* IAudioClient3 */ typedef struct { @@ -22178,7 +21664,6 @@ static MA_INLINE HRESULT ma_IAudioClient3_GetSharedModeEnginePeriod(ma_IAudioCli static MA_INLINE HRESULT ma_IAudioClient3_GetCurrentSharedModeEnginePeriod(ma_IAudioClient3* pThis, MA_WAVEFORMATEX** ppFormat, ma_uint32* pCurrentPeriodInFrames) { return pThis->lpVtbl->GetCurrentSharedModeEnginePeriod(pThis, ppFormat, pCurrentPeriodInFrames); } static MA_INLINE HRESULT ma_IAudioClient3_InitializeSharedAudioStream(ma_IAudioClient3* pThis, DWORD streamFlags, ma_uint32 periodInFrames, const MA_WAVEFORMATEX* pFormat, const GUID* pAudioSessionGUID) { return pThis->lpVtbl->InitializeSharedAudioStream(pThis, streamFlags, periodInFrames, pFormat, pAudioSessionGUID); } - /* IAudioRenderClient */ typedef struct { @@ -22201,7 +21686,6 @@ static MA_INLINE ULONG ma_IAudioRenderClient_Release(ma_IAudioRenderClient* pT static MA_INLINE HRESULT ma_IAudioRenderClient_GetBuffer(ma_IAudioRenderClient* pThis, ma_uint32 numFramesRequested, BYTE** ppData) { return pThis->lpVtbl->GetBuffer(pThis, numFramesRequested, ppData); } static MA_INLINE HRESULT ma_IAudioRenderClient_ReleaseBuffer(ma_IAudioRenderClient* pThis, ma_uint32 numFramesWritten, DWORD dwFlags) { return pThis->lpVtbl->ReleaseBuffer(pThis, numFramesWritten, dwFlags); } - /* IAudioCaptureClient */ typedef struct { @@ -22294,7 +21778,6 @@ static HRESULT STDMETHODCALLTYPE ma_completion_handler_uwp_ActivateCompleted(ma_ return S_OK; } - static ma_completion_handler_uwp_vtbl g_maCompletionHandlerVtblInstance = { ma_completion_handler_uwp_QueryInterface, ma_completion_handler_uwp_AddRef, @@ -22392,7 +21875,6 @@ static HRESULT STDMETHODCALLTYPE ma_IMMNotificationClient_OnDeviceStateChanged(m } } - /* If the device ID matches our device we need to mark our device as detached and stop it. When a device is added in OnDeviceAdded(), we'll restart it. We only mark it as detached if the device @@ -22511,8 +21993,6 @@ static HRESULT STDMETHODCALLTYPE ma_IMMNotificationClient_OnDefaultDeviceChanged return S_OK; } - - /* Second attempt at device rerouting. We're going to retrieve the device's state at the time of the route change. We're then going to stop the device, reinitialize the device, and then start @@ -22618,7 +22098,6 @@ typedef ma_IMMDevice ma_WASAPIDeviceInterface; typedef ma_IUnknown ma_WASAPIDeviceInterface; #endif - #define MA_CONTEXT_COMMAND_QUIT__WASAPI 1 #define MA_CONTEXT_COMMAND_CREATE_IAUDIOCLIENT__WASAPI 2 #define MA_CONTEXT_COMMAND_RELEASE_IAUDIOCLIENT__WASAPI 3 @@ -22802,7 +22281,6 @@ static ma_result ma_device_release_IAudioClient_service__wasapi(ma_device* pDevi } #endif - static void ma_add_native_data_format_to_device_info_from_WAVEFORMATEX(const MA_WAVEFORMATEX* pWF, ma_share_mode shareMode, ma_device_info* pInfo) { MA_ASSERT(pWF != NULL); @@ -23330,7 +22808,6 @@ static ma_result ma_context_get_IAudioClient_UWP__wasapi(ma_context* pContext, m } #endif - /* https://docs.microsoft.com/en-us/windows/win32/api/audioclientactivationparams/ne-audioclientactivationparams-audioclient_activation_type */ typedef enum { @@ -23432,7 +22909,6 @@ static ma_result ma_context_get_IAudioClient__wasapi(ma_context* pContext, ma_de return result; } - static ma_result ma_context_enumerate_devices__wasapi(ma_context* pContext, ma_enum_devices_callback_proc callback, void* pUserData) { /* Different enumeration for desktop and UWP. */ @@ -23589,7 +23065,6 @@ static ma_result ma_device_uninit__wasapi(ma_device* pDevice) return MA_SUCCESS; } - typedef struct { /* Input. */ @@ -23844,7 +23319,6 @@ static ma_result ma_device_init_internal__wasapi(ma_context* pContext, ma_device periodDurationInMicroseconds = ((ma_uint64)pData->periodSizeInFramesOut * 1000 * 1000) / wf.nSamplesPerSec; - /* Slightly different initialization for shared and exclusive modes. We try exclusive mode first, and if it fails, fall back to shared mode. */ if (shareMode == MA_AUDCLNT_SHAREMODE_EXCLUSIVE) { MA_REFERENCE_TIME bufferDuration = periodDurationInMicroseconds * pData->periodsOut * 10; @@ -24019,7 +23493,6 @@ static ma_result ma_device_init_internal__wasapi(ma_context* pContext, ma_device pData->usingAudioClient3 = wasInitializedUsingIAudioClient3; - if (deviceType == ma_device_type_playback) { result = ma_device_create_IAudioClient_service__wasapi(pContext, deviceType, (ma_IAudioClient*)pData->pAudioClient, (void**)&pData->pRenderClient); } else { @@ -24032,7 +23505,6 @@ static ma_result ma_device_init_internal__wasapi(ma_context* pContext, ma_device goto done; } - /* Grab the name of the device. */ #if defined(MA_WIN32_DESKTOP) || defined(MA_WIN32_GDK) { @@ -24117,7 +23589,6 @@ static ma_result ma_device_reinit__wasapi(ma_device* pDevice, ma_device_type dev return MA_INVALID_ARGS; } - /* Before reinitializing the device we need to free the previous audio clients. @@ -24152,7 +23623,6 @@ static ma_result ma_device_reinit__wasapi(ma_device* pDevice, ma_device_type dev } } - if (deviceType == ma_device_type_playback) { data.formatIn = pDevice->playback.format; data.channelsIn = pDevice->playback.channels; @@ -24510,7 +23980,6 @@ static ma_result ma_device__get_available_frames__wasapi(ma_device* pDevice, ma_ return MA_SUCCESS; } - static ma_result ma_device_reroute__wasapi(ma_device* pDevice, ma_device_type deviceType) { ma_result result; @@ -24717,7 +24186,6 @@ static ma_result ma_device_stop__wasapi(ma_device* pDevice) return result; } - #ifndef MA_WASAPI_WAIT_TIMEOUT_MILLISECONDS #define MA_WASAPI_WAIT_TIMEOUT_MILLISECONDS 5000 #endif @@ -25027,7 +24495,6 @@ static ma_result ma_device_data_loop_wakeup__wasapi(ma_device* pDevice) return MA_SUCCESS; } - static ma_result ma_context_uninit__wasapi(ma_context* pContext) { ma_context_command__wasapi cmd = ma_context_init_command__wasapi(MA_CONTEXT_COMMAND_QUIT__WASAPI); @@ -25113,7 +24580,6 @@ static ma_result ma_context_init__wasapi(ma_context* pContext, const ma_context_ MA_ZERO_OBJECT(&pContext->wasapi); - #if defined(MA_WIN32_UWP) { /* Link to mmdevapi so we can get access to ActivateAudioInterfaceAsync(). */ @@ -25145,7 +24611,6 @@ static ma_result ma_context_init__wasapi(ma_context* pContext, const ma_context_ } } - /* Annoyingly, WASAPI does not allow you to release an IAudioClient object from a different thread than the one that retrieved it with GetService(). This can result in a deadlock in two @@ -25191,7 +24656,6 @@ static ma_result ma_context_init__wasapi(ma_context* pContext, const ma_context_ } } - pCallbacks->onContextInit = ma_context_init__wasapi; pCallbacks->onContextUninit = ma_context_uninit__wasapi; pCallbacks->onContextEnumerateDevices = ma_context_enumerate_devices__wasapi; @@ -25356,7 +24820,6 @@ typedef struct ma_IDirectSoundCapture ma_IDirectSoundCapture; typedef struct ma_IDirectSoundCaptureBuffer ma_IDirectSoundCaptureBuffer; typedef struct ma_IDirectSoundNotify ma_IDirectSoundNotify; - /* COM objects. The way these work is that you have a vtable (a list of function pointers, kind of like how C++ works internally), and then you have a structure with a single member, which is a @@ -25398,7 +24861,6 @@ static MA_INLINE HRESULT ma_IDirectSound_GetSpeakerConfig(ma_IDirectSound* pThis static MA_INLINE HRESULT ma_IDirectSound_SetSpeakerConfig(ma_IDirectSound* pThis, DWORD dwSpeakerConfig) { return pThis->lpVtbl->SetSpeakerConfig(pThis, dwSpeakerConfig); } static MA_INLINE HRESULT ma_IDirectSound_Initialize(ma_IDirectSound* pThis, const GUID* pGuidDevice) { return pThis->lpVtbl->Initialize(pThis, pGuidDevice); } - /* IDirectSoundBuffer */ typedef struct { @@ -25453,7 +24915,6 @@ static MA_INLINE HRESULT ma_IDirectSoundBuffer_Stop(ma_IDirectSoundBuffer* pThis static MA_INLINE HRESULT ma_IDirectSoundBuffer_Unlock(ma_IDirectSoundBuffer* pThis, void* pAudioPtr1, DWORD dwAudioBytes1, void* pAudioPtr2, DWORD dwAudioBytes2) { return pThis->lpVtbl->Unlock(pThis, pAudioPtr1, dwAudioBytes1, pAudioPtr2, dwAudioBytes2); } static MA_INLINE HRESULT ma_IDirectSoundBuffer_Restore(ma_IDirectSoundBuffer* pThis) { return pThis->lpVtbl->Restore(pThis); } - /* IDirectSoundCapture */ typedef struct { @@ -25478,7 +24939,6 @@ static MA_INLINE HRESULT ma_IDirectSoundCapture_CreateCaptureBuffer(ma_IDirectSo static MA_INLINE HRESULT ma_IDirectSoundCapture_GetCaps (ma_IDirectSoundCapture* pThis, MA_DSCCAPS* pDSCCaps) { return pThis->lpVtbl->GetCaps(pThis, pDSCCaps); } static MA_INLINE HRESULT ma_IDirectSoundCapture_Initialize (ma_IDirectSoundCapture* pThis, const GUID* pGuidDevice) { return pThis->lpVtbl->Initialize(pThis, pGuidDevice); } - /* IDirectSoundCaptureBuffer */ typedef struct { @@ -25515,7 +24975,6 @@ static MA_INLINE HRESULT ma_IDirectSoundCaptureBuffer_Start(ma_IDirectSoundCaptu static MA_INLINE HRESULT ma_IDirectSoundCaptureBuffer_Stop(ma_IDirectSoundCaptureBuffer* pThis) { return pThis->lpVtbl->Stop(pThis); } static MA_INLINE HRESULT ma_IDirectSoundCaptureBuffer_Unlock(ma_IDirectSoundCaptureBuffer* pThis, void* pAudioPtr1, DWORD dwAudioBytes1, void* pAudioPtr2, DWORD dwAudioBytes2) { return pThis->lpVtbl->Unlock(pThis, pAudioPtr1, dwAudioBytes1, pAudioPtr2, dwAudioBytes2); } - /* IDirectSoundNotify */ typedef struct { @@ -25536,7 +24995,6 @@ static MA_INLINE ULONG ma_IDirectSoundNotify_AddRef(ma_IDirectSoundNotify* pTh static MA_INLINE ULONG ma_IDirectSoundNotify_Release(ma_IDirectSoundNotify* pThis) { return pThis->lpVtbl->Release(pThis); } static MA_INLINE HRESULT ma_IDirectSoundNotify_SetNotificationPositions(ma_IDirectSoundNotify* pThis, DWORD dwPositionNotifies, const MA_DSBPOSITIONNOTIFY* pPositionNotifies) { return pThis->lpVtbl->SetNotificationPositions(pThis, dwPositionNotifies, pPositionNotifies); } - typedef BOOL (CALLBACK * ma_DSEnumCallbackAProc) (GUID* pDeviceGUID, const char* pDeviceDescription, const char* pModule, void* pContext); typedef HRESULT (WINAPI * ma_DirectSoundCreateProc) (const GUID* pcGuidDevice, ma_IDirectSound** ppDS8, ma_IUnknown* pUnkOuter); typedef HRESULT (WINAPI * ma_DirectSoundEnumerateAProc) (ma_DSEnumCallbackAProc pDSEnumCallback, void* pContext); @@ -25618,7 +25076,6 @@ static void ma_get_channels_from_speaker_config__dsound(DWORD speakerConfig, WOR } } - static ma_result ma_context_create_IDirectSound__dsound(ma_context* pContext, ma_share_mode shareMode, const ma_device_id* pDeviceID, ma_IDirectSound** ppDirectSound) { ma_IDirectSound* pDirectSound; @@ -25783,7 +25240,6 @@ static ma_result ma_context_get_format_info_for_IDirectSoundCapture__dsound(ma_c return MA_SUCCESS; } - typedef struct { ma_context* pContext; @@ -25813,7 +25269,6 @@ static BOOL CALLBACK ma_context_enumerate_devices_callback__dsound(GUID* lpGuid, /* Name / Description */ ma_strncpy_s(deviceInfo.name, sizeof(deviceInfo.name), lpcstrDescription, (size_t)-1); - /* Call the callback function, but make sure we stop enumerating if the callee requested so. */ MA_ASSERT(pData != NULL); pData->terminated = (pData->callback(pData->pContext, pData->deviceType, &deviceInfo, pData->pUserData) == MA_FALSE); @@ -25851,7 +25306,6 @@ static ma_result ma_context_enumerate_devices__dsound(ma_context* pContext, ma_e return MA_SUCCESS; } - typedef struct { const ma_device_id* pDeviceID; @@ -25945,7 +25399,6 @@ static ma_result ma_context_get_device_info__dsound(ma_context* pContext, ma_dev return ma_result_from_HRESULT(hr); } - /* Channels. Only a single channel count is reported for DirectSound. */ if ((caps.dwFlags & MA_DSCAPS_PRIMARYSTEREO) != 0) { /* It supports at least stereo, but could support more. */ @@ -25963,7 +25416,6 @@ static ma_result ma_context_get_device_info__dsound(ma_context* pContext, ma_dev channels = 1; } - /* In DirectSound, our native formats are centered around sample rates. All formats are supported, and we're only reporting a single channel count. However, DirectSound can report a range of supported sample rates. We're only going to include standard rates known by miniaudio @@ -26038,8 +25490,6 @@ static ma_result ma_context_get_device_info__dsound(ma_context* pContext, ma_dev return MA_SUCCESS; } - - static ma_result ma_device_uninit__dsound(ma_device* pDevice) { MA_ASSERT(pDevice != NULL); @@ -26271,7 +25721,6 @@ static ma_result ma_device_init__dsound(ma_device* pDevice, const ma_device_conf return ma_result_from_HRESULT(hr); } - /* We may want to make some adjustments to the format if we are using defaults. */ MA_ZERO_OBJECT(&caps); caps.dwSize = sizeof(caps); @@ -26406,7 +25855,6 @@ static ma_result ma_device_init__dsound(ma_device* pDevice, const ma_device_conf return MA_SUCCESS; } - static ma_result ma_device_data_loop__dsound(ma_device* pDevice) { ma_result result = MA_SUCCESS; @@ -26496,7 +25944,6 @@ static ma_result ma_device_data_loop__dsound(ma_device* pDevice) return ma_result_from_HRESULT(hr); } - /* At this point we have some input data that we need to output. We do not return until every mapped frame of the input data is written to the playback device. */ mappedDeviceFramesProcessedCapture = 0; @@ -26578,7 +26025,6 @@ static ma_result ma_device_data_loop__dsound(ma_device* pDevice) } } - /* Getting here means there room available somewhere. We limit this to either the end of the buffer or the physical play cursor, whichever is closest. */ lockOffsetInBytesPlayback = virtualWriteCursorInBytesPlayback; if (physicalPlayCursorLoopFlagPlayback == virtualWriteCursorLoopFlagPlayback) { @@ -26631,7 +26077,6 @@ static ma_result ma_device_data_loop__dsound(ma_device* pDevice) framesWrittenThisIteration = (ma_uint32)convertedFrameCountOut; } - hr = ma_IDirectSoundBuffer_Unlock((ma_IDirectSoundBuffer*)pDevice->dsound.pPlaybackBuffer, pMappedDeviceBufferPlayback, framesWrittenThisIteration*bpfDevicePlayback, NULL, 0); if (FAILED(hr)) { ma_log_post(ma_device_get_log(pDevice), MA_LOG_LEVEL_ERROR, "[DirectSound] Failed to unlock internal buffer from playback device after writing to the device."); @@ -26670,7 +26115,6 @@ static ma_result ma_device_data_loop__dsound(ma_device* pDevice) } } - /* At this point we're done with the mapped portion of the capture buffer. */ hr = ma_IDirectSoundCaptureBuffer_Unlock((ma_IDirectSoundCaptureBuffer*)pDevice->dsound.pCaptureBuffer, pMappedDeviceBufferCapture, mappedSizeInBytesCapture, NULL, 0); if (FAILED(hr)) { @@ -26680,8 +26124,6 @@ static ma_result ma_device_data_loop__dsound(ma_device* pDevice) prevReadCursorInBytesCapture = (lockOffsetInBytesCapture + mappedSizeInBytesCapture); } break; - - case ma_device_type_capture: { DWORD physicalCaptureCursorInBytes; @@ -26747,8 +26189,6 @@ static ma_result ma_device_data_loop__dsound(ma_device* pDevice) } } break; - - case ma_device_type_playback: { DWORD availableBytesPlayback; @@ -26864,7 +26304,6 @@ static ma_result ma_device_data_loop__dsound(ma_device* pDevice) } } break; - default: return MA_INVALID_ARGS; /* Invalid device type. */ } @@ -26992,8 +26431,6 @@ static ma_result ma_context_init__dsound(ma_context* pContext, const ma_context_ } #endif - - /****************************************************************************** WinMM Backend @@ -27153,7 +26590,6 @@ static ma_uint32 ma_get_period_size_in_bytes(ma_uint32 periodSizeInFrames, ma_fo return periodSizeInFrames * ma_get_bytes_per_frame(format, channels); } - /* Our own "WAVECAPS" structure that contains generic information shared between WAVEOUTCAPS2 and WAVEINCAPS2 so we can do things generically and typesafely. Names are being kept the same for consistency. @@ -27342,7 +26778,6 @@ static ma_result ma_context_get_device_info_from_WAVECAPS(ma_context* pContext, } } - result = ma_get_best_info_from_formats_flags__winmm(pCaps->dwFormats, pCaps->wChannels, &bitsPerSample, &sampleRate); if (result != MA_SUCCESS) { return result; @@ -27397,7 +26832,6 @@ static ma_result ma_context_get_device_info_from_WAVEINCAPS2(ma_context* pContex return ma_context_get_device_info_from_WAVECAPS(pContext, &caps, pDeviceInfo); } - static ma_result ma_context_enumerate_devices__winmm(ma_context* pContext, ma_enum_devices_callback_proc callback, void* pUserData) { UINT playbackDeviceCount; @@ -27512,7 +26946,6 @@ static ma_result ma_context_get_device_info__winmm(ma_context* pContext, ma_devi return MA_NO_DEVICE; } - static ma_result ma_device_uninit__winmm(ma_device* pDevice) { MA_ASSERT(pDevice != NULL); @@ -28091,9 +27524,6 @@ static ma_result ma_context_init__winmm(ma_context* pContext, const ma_context_c } #endif - - - /****************************************************************************** ALSA Backend @@ -28406,7 +27836,6 @@ static const char* g_maBlacklistedCaptureDeviceNamesALSA[] = { "" }; - static ma_snd_pcm_format_t ma_convert_ma_format_to_alsa_format(ma_format format) { ma_snd_pcm_format_t ALSAFormats[] = { @@ -28505,7 +27934,6 @@ static ma_bool32 ma_is_common_device_name__alsa(const char* name) return MA_FALSE; } - static ma_bool32 ma_is_playback_device_blacklisted__alsa(const char* name) { size_t iName; @@ -28539,7 +27967,6 @@ static ma_bool32 ma_is_device_blacklisted__alsa(ma_device_type deviceType, const } } - static const char* ma_find_char(const char* str, char c, int* index) { int i = 0; @@ -28652,7 +28079,6 @@ static int ma_convert_device_name_to_hw_format__alsa(ma_context* pContext, char* return -2; /* Failed to retrieve the card index. */ } - /* Construction. */ dst[0] = 'h'; dst[1] = 'w'; dst[2] = ':'; if (ma_itoa_s(cardIndex, dst+3, dstSize-3, 10) != 0) { @@ -28683,7 +28109,6 @@ static ma_bool32 ma_does_id_exist_in_list__alsa(ma_device_id* pUniqueIDs, ma_uin return MA_FALSE; } - static ma_result ma_context_open_pcm__alsa(ma_context* pContext, ma_share_mode shareMode, ma_device_type deviceType, const ma_device_id* pDeviceID, int openMode, ma_snd_pcm_t** ppPCM) { ma_snd_pcm_t* pPCM; @@ -28803,7 +28228,6 @@ static ma_result ma_context_open_pcm__alsa(ma_context* pContext, ma_share_mode s return MA_SUCCESS; } - static ma_result ma_context_enumerate_devices__alsa(ma_context* pContext, ma_enum_devices_callback_proc callback, void* pUserData) { int resultALSA; @@ -28892,7 +28316,6 @@ static ma_result ma_context_enumerate_devices__alsa(ma_context* pContext, ma_enu deviceInfo.isDefault = MA_TRUE; } - /* DESC is the friendly name. We treat this slightly differently depending on whether or not we are using verbose device enumeration. In verbose mode we want to take the entire description so that the end-user can distinguish @@ -28973,7 +28396,6 @@ static ma_result ma_context_enumerate_devices__alsa(ma_context* pContext, ma_enu return MA_SUCCESS; } - typedef struct { ma_device_type deviceType; @@ -29252,7 +28674,6 @@ static ma_result ma_device_init_by_type__alsa(ma_device* pDevice, const ma_devic return result; } - /* Hardware parameters. */ pHWParams = (ma_snd_pcm_hw_params_t*)ma_calloc(((ma_snd_pcm_hw_params_sizeof_proc)pDevice->pContext->alsa.snd_pcm_hw_params_sizeof)(), &pDevice->pContext->allocationCallbacks); if (pHWParams == NULL) { @@ -29438,7 +28859,6 @@ static ma_result ma_device_init_by_type__alsa(ma_device* pDevice, const ma_devic ma_free(pHWParams, &pDevice->pContext->allocationCallbacks); pHWParams = NULL; - /* Software parameters. */ pSWParams = (ma_snd_pcm_sw_params_t*)ma_calloc(((ma_snd_pcm_sw_params_sizeof_proc)pDevice->pContext->alsa.snd_pcm_sw_params_sizeof)(), &pDevice->pContext->allocationCallbacks); if (pSWParams == NULL) { @@ -29501,7 +28921,6 @@ static ma_result ma_device_init_by_type__alsa(ma_device* pDevice, const ma_devic ma_free(pSWParams, &pDevice->pContext->allocationCallbacks); pSWParams = NULL; - /* Grab the internal channel map. For now we're not going to bother trying to change the channel map and instead just do it ourselves. */ { ma_snd_pcm_chmap_t* pChmap = NULL; @@ -29560,7 +28979,6 @@ static ma_result ma_device_init_by_type__alsa(ma_device* pDevice, const ma_devic } } - /* We need to retrieve the poll descriptors so we can use poll() to wait for data to become available for reading or writing. There's no well defined maximum for this so we're just going @@ -29617,7 +29035,6 @@ static ma_result ma_device_init_by_type__alsa(ma_device* pDevice, const ma_devic pDevice->alsa.wakeupfdPlayback = wakeupfd; } - /* We're done. Prepare the device. */ resultALSA = ((ma_snd_pcm_prepare_proc)pDevice->pContext->alsa.snd_pcm_prepare)(pPCM); if (resultALSA < 0) { @@ -29628,7 +29045,6 @@ static ma_result ma_device_init_by_type__alsa(ma_device* pDevice, const ma_devic return ma_result_from_errno(-resultALSA); } - if (deviceType == ma_device_type_capture) { pDevice->alsa.pPCMCapture = (ma_ptr)pPCM; pDevice->alsa.isUsingMMapCapture = isUsingMMap; @@ -30253,8 +29669,6 @@ static ma_result ma_context_init__alsa(ma_context* pContext, const ma_context_co } #endif /* MA_HAS_ALSA */ - - /****************************************************************************** PulseAudio Backend @@ -30375,7 +29789,6 @@ parameter which the program just writes to directly rather than having to call ` changes alone will change PulseAudio from one of the worst audio APIs to one of the best. */ - /* It is assumed pulseaudio.h is available when linking at compile time. When linking at compile time, we use the declarations in the header to check for type safety. We cannot do this when linking at run time because the header might not be available. @@ -30882,7 +30295,6 @@ typedef void (* ma_pa_stream_notify_cb_t) (ma_pa_stream* s, void* userdata); typedef void (* ma_pa_free_cb_t) (void* p); #endif - typedef ma_pa_mainloop* (* ma_pa_mainloop_new_proc) (void); typedef void (* ma_pa_mainloop_free_proc) (ma_pa_mainloop* m); typedef void (* ma_pa_mainloop_quit_proc) (ma_pa_mainloop* m, int retval); @@ -31214,7 +30626,6 @@ static ma_result ma_wait_for_pa_stream_to_connect__pulse(ma_context* pContext, m return MA_SUCCESS; } - static ma_result ma_init_pa_mainloop_and_pa_context__pulse(ma_context* pContext, const char* pApplicationName, const char* pServerName, ma_bool32 tryAutoSpawn, ma_ptr* ppMainLoop, ma_ptr* ppPulseContext) { ma_result result; @@ -31262,7 +30673,6 @@ static ma_result ma_init_pa_mainloop_and_pa_context__pulse(ma_context* pContext, return MA_SUCCESS; } - static void ma_device_sink_info_callback(ma_pa_context* pPulseContext, const ma_pa_sink_info* pInfo, int endOfList, void* pUserData) { ma_pa_sink_info* pInfoOut; @@ -31407,7 +30817,6 @@ static ma_result ma_context_get_default_device_index__pulse(ma_context* pContext return MA_SUCCESS; } - typedef struct { ma_context* pContext; @@ -31518,7 +30927,6 @@ static ma_result ma_context_enumerate_devices__pulse(ma_context* pContext, ma_en } } - /* Capture. */ if (!callbackData.isTerminated) { pOP = ((ma_pa_context_get_source_info_list_proc)pContext->pulse.pa_context_get_source_info_list)((ma_pa_context*)(pContext->pulse.pPulseContext), ma_context_enumerate_devices_source_callback__pulse, &callbackData); @@ -31539,7 +30947,6 @@ done: return result; } - typedef struct { ma_device_info* pDeviceInfo; @@ -31723,7 +31130,6 @@ static ma_pa_stream* ma_device__pa_stream_new__pulse(ma_device* pDevice, const c return ((ma_pa_stream_new_proc)pDevice->pContext->pulse.pa_stream_new)((ma_pa_context*)pDevice->pulse.pPulseContext, actualStreamName, ss, cmap); } - static void ma_device_on_read__pulse(ma_pa_stream* pStream, size_t byteCount, void* pUserData) { ma_device* pDevice = (ma_device*)pUserData; @@ -32009,8 +31415,6 @@ static ma_result ma_device_init__pulse(ma_device* pDevice, const ma_device_confi sampleRate = pDescriptorCapture->sampleRate; } - - result = ma_init_pa_mainloop_and_pa_context__pulse(pDevice->pContext, pDevice->pContext->pulse.pApplicationName, pDevice->pContext->pulse.pServerName, MA_FALSE, &pDevice->pulse.pMainLoop, &pDevice->pulse.pPulseContext); if (result != MA_SUCCESS) { ma_log_post(ma_device_get_log(pDevice), MA_LOG_LEVEL_ERROR, "[PulseAudio] Failed to initialize PA mainloop and context for device.\n"); @@ -32079,7 +31483,6 @@ static ma_result ma_device_init__pulse(ma_device* pDevice, const ma_device_confi goto on_error0; } - /* The callback needs to be set before connecting the stream. */ ((ma_pa_stream_set_read_callback_proc)pDevice->pContext->pulse.pa_stream_set_read_callback)((ma_pa_stream*)pDevice->pulse.pStreamCapture, ma_device_on_read__pulse, pDevice); @@ -32089,7 +31492,6 @@ static ma_result ma_device_init__pulse(ma_device* pDevice, const ma_device_confi /* Rerouting notification. */ ((ma_pa_stream_set_moved_callback_proc)pDevice->pContext->pulse.pa_stream_set_moved_callback)((ma_pa_stream*)pDevice->pulse.pStreamCapture, ma_device_on_rerouted__pulse, pDevice); - /* Connect after we've got all of our internal state set up. */ if (devCapture != NULL) { streamFlags |= MA_PA_STREAM_DONT_MOVE; @@ -32107,7 +31509,6 @@ static ma_result ma_device_init__pulse(ma_device* pDevice, const ma_device_confi goto on_error2; } - /* Internal format. */ pActualSS = ((ma_pa_stream_get_sample_spec_proc)pDevice->pContext->pulse.pa_stream_get_sample_spec)((ma_pa_stream*)pDevice->pulse.pStreamCapture); if (pActualSS != NULL) { @@ -32127,7 +31528,6 @@ static ma_result ma_device_init__pulse(ma_device* pDevice, const ma_device_confi goto on_error4; } - /* Internal channel map. */ pActualChannelMap = ((ma_pa_stream_get_channel_map_proc)pDevice->pContext->pulse.pa_stream_get_channel_map)((ma_pa_stream*)pDevice->pulse.pStreamCapture); if (pActualChannelMap == NULL) { @@ -32157,7 +31557,6 @@ static ma_result ma_device_init__pulse(ma_device* pDevice, const ma_device_confi } } - /* Buffer. */ pActualAttr = ((ma_pa_stream_get_buffer_attr_proc)pDevice->pContext->pulse.pa_stream_get_buffer_attr)((ma_pa_stream*)pDevice->pulse.pStreamCapture); if (pActualAttr != NULL) { @@ -32197,7 +31596,6 @@ static ma_result ma_device_init__pulse(ma_device* pDevice, const ma_device_confi /* Use a default channel map. */ ((ma_pa_channel_map_init_extend_proc)pDevice->pContext->pulse.pa_channel_map_init_extend)(&cmap, ss.channels, (ma_pa_channel_map_def_t)pConfig->pulse.channelMap); - /* Use the requested sample rate if one was specified. */ if (pDescriptorPlayback->sampleRate != 0) { ss.rate = pDescriptorPlayback->sampleRate; @@ -32238,7 +31636,6 @@ static ma_result ma_device_init__pulse(ma_device* pDevice, const ma_device_confi goto on_error2; } - /* Note that this callback will be fired as soon as the stream is connected, even though it's started as corked. The callback needs to handle a device state of ma_device_state_uninitialized. @@ -32251,7 +31648,6 @@ static ma_result ma_device_init__pulse(ma_device* pDevice, const ma_device_confi /* Rerouting notification. */ ((ma_pa_stream_set_moved_callback_proc)pDevice->pContext->pulse.pa_stream_set_moved_callback)((ma_pa_stream*)pDevice->pulse.pStreamPlayback, ma_device_on_rerouted__pulse, pDevice); - /* Connect after we've got all of our internal state set up. */ if (devPlayback != NULL) { streamFlags |= MA_PA_STREAM_DONT_MOVE; @@ -32269,7 +31665,6 @@ static ma_result ma_device_init__pulse(ma_device* pDevice, const ma_device_confi goto on_error3; } - /* Internal format. */ pActualSS = ((ma_pa_stream_get_sample_spec_proc)pDevice->pContext->pulse.pa_stream_get_sample_spec)((ma_pa_stream*)pDevice->pulse.pStreamPlayback); if (pActualSS != NULL) { @@ -32289,7 +31684,6 @@ static ma_result ma_device_init__pulse(ma_device* pDevice, const ma_device_confi goto on_error4; } - /* Internal channel map. */ pActualChannelMap = ((ma_pa_stream_get_channel_map_proc)pDevice->pContext->pulse.pa_stream_get_channel_map)((ma_pa_stream*)pDevice->pulse.pStreamPlayback); if (pActualChannelMap == NULL) { @@ -32319,7 +31713,6 @@ static ma_result ma_device_init__pulse(ma_device* pDevice, const ma_device_confi } } - /* Buffer. */ pActualAttr = ((ma_pa_stream_get_buffer_attr_proc)pDevice->pContext->pulse.pa_stream_get_buffer_attr)((ma_pa_stream*)pDevice->pulse.pStreamPlayback); if (pActualAttr != NULL) { @@ -32336,7 +31729,6 @@ static ma_result ma_device_init__pulse(ma_device* pDevice, const ma_device_confi ma_log_postf(ma_device_get_log(pDevice), MA_LOG_LEVEL_INFO, "[PulseAudio] Playback actual attr: maxlength=%d, tlength=%d, prebuf=%d, minreq=%d, fragsize=%d; internalPeriodSizeInFrames=%d\n", attr.maxlength, attr.tlength, attr.prebuf, attr.minreq, attr.fragsize, pDescriptorPlayback->periodSizeInFrames); } - /* We need a ring buffer for handling duplex mode. We can use the main duplex ring buffer in the main part of the ma_device struct. We cannot, however, depend on ma_device_init() initializing this for @@ -32357,7 +31749,6 @@ static ma_result ma_device_init__pulse(ma_device* pDevice, const ma_device_confi return MA_SUCCESS; - on_error4: if (pConfig->deviceType == ma_device_type_playback || pConfig->deviceType == ma_device_type_duplex) { ((ma_pa_stream_disconnect_proc)pDevice->pContext->pulse.pa_stream_disconnect)((ma_pa_stream*)pDevice->pulse.pStreamPlayback); @@ -32378,7 +31769,6 @@ on_error0: return result; } - static void ma_pulse_operation_complete_callback(ma_pa_stream* pStream, int success, void* pUserData) { ma_bool32* pIsSuccessful = (ma_bool32*)pUserData; @@ -32791,7 +32181,6 @@ static ma_result ma_context_init__pulse(ma_context* pContext, const ma_context_c } #endif - /****************************************************************************** JACK Backend @@ -32880,7 +32269,6 @@ static ma_result ma_context_open_client__jack(ma_context* pContext, ma_jack_clie return MA_SUCCESS; } - static ma_result ma_context_enumerate_devices__jack(ma_context* pContext, ma_enum_devices_callback_proc callback, void* pUserData) { ma_bool32 cbResult = MA_TRUE; @@ -32967,7 +32355,6 @@ static ma_result ma_context_get_device_info__jack(ma_context* pContext, ma_devic return MA_SUCCESS; } - static ma_result ma_device_uninit__jack(ma_device* pDevice) { ma_context* pContext; @@ -33136,7 +32523,6 @@ static ma_result ma_device_init__jack(ma_device* pDevice, const ma_device_config ((ma_jack_on_shutdown_proc)pDevice->pContext->jack.jack_on_shutdown)((ma_jack_client_t*)pDevice->jack.pClient, ma_device__jack_shutdown_callback, pDevice); - /* The buffer size in frames can change. */ periodSizeInFrames = ((ma_jack_get_buffer_size_proc)pDevice->pContext->jack.jack_get_buffer_size)((ma_jack_client_t*)pDevice->jack.pClient); @@ -33246,7 +32632,6 @@ static ma_result ma_device_init__jack(ma_device* pDevice, const ma_device_config return MA_SUCCESS; } - static ma_result ma_device_start__jack(ma_device* pDevice) { ma_context* pContext = pDevice->pContext; @@ -33324,7 +32709,6 @@ static ma_result ma_device_stop__jack(ma_device* pDevice) return MA_SUCCESS; } - static ma_result ma_context_uninit__jack(ma_context* pContext) { MA_ASSERT(pContext != NULL); @@ -33445,7 +32829,6 @@ static ma_result ma_context_init__jack(ma_context* pContext, const ma_context_co ((ma_jack_client_close_proc)pContext->jack.jack_client_close)((ma_jack_client_t*)pDummyClient); } - pCallbacks->onContextInit = ma_context_init__jack; pCallbacks->onContextUninit = ma_context_uninit__jack; pCallbacks->onContextEnumerateDevices = ma_context_enumerate_devices__jack; @@ -33462,8 +32845,6 @@ static ma_result ma_context_init__jack(ma_context* pContext, const ma_context_co } #endif /* MA_HAS_JACK */ - - /****************************************************************************** Core Audio Backend @@ -33530,7 +32911,6 @@ typedef OSStatus (* ma_AudioUnitSetProperty_proc)(AudioUnit inUnit, AudioUnitPro typedef OSStatus (* ma_AudioUnitInitialize_proc)(AudioUnit inUnit); typedef OSStatus (* ma_AudioUnitRender_proc)(AudioUnit inUnit, AudioUnitRenderActionFlags* ioActionFlags, const AudioTimeStamp* inTimeStamp, UInt32 inOutputBusNumber, UInt32 inNumberFrames, AudioBufferList* ioData); - #define MA_COREAUDIO_OUTPUT_BUS 0 #define MA_COREAUDIO_INPUT_BUS 1 @@ -34051,7 +33431,6 @@ static ma_bool32 ma_does_AudioObject_support_capture(ma_context* pContext, Audio return ma_does_AudioObject_support_scope(pContext, deviceObjectID, kAudioObjectPropertyScopeInput); } - static ma_result ma_get_AudioObject_stream_descriptions(ma_context* pContext, AudioObjectID deviceObjectID, ma_device_type deviceType, UInt32* pDescriptionCount, AudioStreamRangedDescription** ppDescriptions) /* NOTE: Free the returned pointer with ma_free(). */ { AudioObjectPropertyAddress propAddress; @@ -34092,7 +33471,6 @@ static ma_result ma_get_AudioObject_stream_descriptions(ma_context* pContext, Au return MA_SUCCESS; } - static ma_result ma_get_AudioObject_channel_layout(ma_context* pContext, AudioObjectID deviceObjectID, ma_device_type deviceType, AudioChannelLayout** ppChannelLayout) /* NOTE: Free the returned pointer with ma_free(). */ { AudioObjectPropertyAddress propAddress; @@ -34461,7 +33839,6 @@ static ma_result ma_find_AudioObjectID(ma_context* pContext, ma_device_type devi return MA_NO_DEVICE; } - static ma_result ma_find_best_format__coreaudio(ma_context* pContext, AudioObjectID deviceObjectID, ma_device_type deviceType, ma_format format, ma_uint32 channels, ma_uint32 sampleRate, const AudioStreamBasicDescription* pOrigFormat, AudioStreamBasicDescription* pFormat) { UInt32 deviceFormatDescriptionCount; @@ -34519,7 +33896,6 @@ static ma_result ma_find_best_format__coreaudio(ma_context* pContext, AudioObjec return MA_FORMAT_NOT_SUPPORTED; } - for (iFormat = 0; iFormat < deviceFormatDescriptionCount; ++iFormat) { AudioStreamBasicDescription thisDeviceFormat = pDeviceFormatDescriptions[iFormat].mFormat; ma_format thisSampleFormat; @@ -34688,7 +34064,6 @@ static ma_result ma_get_AudioUnit_channel_map(ma_context* pContext, AudioUnit au } #endif /* MA_APPLE_DESKTOP */ - #if !defined(MA_APPLE_DESKTOP) static void ma_AVAudioSessionPortDescription_to_device_info(AVAudioSessionPortDescription* pPortDesc, ma_device_info* pInfo) { @@ -34952,7 +34327,6 @@ static ma_result ma_context_get_device_info__coreaudio(ma_context* pContext, ma_ } } - /* Retrieving device information is more annoying on mobile than desktop. For simplicity I'm locking this down to whatever format is reported on a temporary I/O unit. The problem, however, is that this doesn't return a value for the sample rate which we need to @@ -35085,7 +34459,6 @@ static ma_result ma_device_realloc_AudioBufferList__coreaudio(ma_device* pDevice return MA_SUCCESS; } - static OSStatus ma_on_output__coreaudio(void* pUserData, AudioUnitRenderActionFlags* pActionFlags, const AudioTimeStamp* pTimeStamp, UInt32 busNumber, UInt32 frameCount, AudioBufferList* pBufferList) { ma_device* pDevice = (ma_device*)pUserData; @@ -35811,14 +35184,12 @@ static ma_result ma_device_init_internal__coreaudio(ma_context* pContext, ma_dev pData->periodsOut = 16; } - /* Audio unit. */ status = ((ma_AudioComponentInstanceNew_proc)pContext->coreaudio.AudioComponentInstanceNew)((AudioComponent)pContext->coreaudio.component, (AudioUnit*)&pData->audioUnit); if (status != noErr) { return ma_result_from_OSStatus(status); } - /* The input/output buses need to be explicitly enabled and disabled. We set the flag based on the output unit first, then we just swap it for input. */ enableIOFlag = 1; if (deviceType == ma_device_type_capture) { @@ -35838,7 +35209,6 @@ static ma_result ma_device_init_internal__coreaudio(ma_context* pContext, ma_dev return ma_result_from_OSStatus(status); } - /* Set the device to use with this audio unit. This is only used on desktop since we are using defaults on mobile. */ #if defined(MA_APPLE_DESKTOP) status = ((ma_AudioUnitSetProperty_proc)pContext->coreaudio.AudioUnitSetProperty)(pData->audioUnit, kAudioOutputUnitProperty_CurrentDevice, kAudioUnitScope_Global, 0, &deviceObjectID, sizeof(deviceObjectID)); @@ -36050,7 +35420,6 @@ static ma_result ma_device_init_internal__coreaudio(ma_context* pContext, ma_dev ma_channel_map_init_standard(ma_standard_channel_map_default, pData->channelMapOut, ma_countof(pData->channelMapOut), pData->channelsOut); #endif - /* Buffer size. Not allowing this to be configurable on iOS. */ if (pData->periodSizeInFramesIn == 0) { if (pData->periodSizeInMillisecondsIn == 0) { @@ -36086,7 +35455,6 @@ static ma_result ma_device_init_internal__coreaudio(ma_context* pContext, ma_dev } #endif - /* During testing I discovered that the buffer size can be too big. You'll get an error like this: @@ -36396,8 +35764,6 @@ static ma_result ma_device_init__coreaudio(ma_device* pDevice, const ma_device_c #endif } - - /* When stopping the device, a callback is called on another thread. We need to wait for this callback before returning from ma_device_stop(). This event is used for this. @@ -36415,7 +35781,6 @@ static ma_result ma_device_init__coreaudio(ma_device* pDevice, const ma_device_c return MA_SUCCESS; } - static ma_result ma_device_start__coreaudio(ma_device* pDevice) { MA_ASSERT(pDevice != NULL); @@ -36465,7 +35830,6 @@ static ma_result ma_device_stop__coreaudio(ma_device* pDevice) return MA_SUCCESS; } - static ma_result ma_context_uninit__coreaudio(ma_context* pContext) { MA_ASSERT(pContext != NULL); @@ -36580,7 +35944,6 @@ static ma_result ma_context_init__coreaudio(ma_context* pContext, const ma_conte pContext->coreaudio.CFStringGetCString = ma_dlsym(ma_context_get_log(pContext), pContext->coreaudio.hCoreFoundation, "CFStringGetCString"); pContext->coreaudio.CFRelease = ma_dlsym(ma_context_get_log(pContext), pContext->coreaudio.hCoreFoundation, "CFRelease"); - pContext->coreaudio.hCoreAudio = ma_dlopen(ma_context_get_log(pContext), "/System/Library/Frameworks/CoreAudio.framework/CoreAudio"); if (pContext->coreaudio.hCoreAudio == NULL) { ma_dlclose(ma_context_get_log(pContext), pContext->coreaudio.hCoreFoundation); @@ -36707,8 +36070,6 @@ static ma_result ma_context_init__coreaudio(ma_context* pContext, const ma_conte } #endif /* MA_HAS_COREAUDIO */ - - /****************************************************************************** sndio Backend @@ -37046,7 +36407,6 @@ static ma_uint32 ma_find_best_sample_rate_from_sio_cap__sndio(struct ma_sio_cap* return bestSampleRate; } - static ma_result ma_context_enumerate_devices__sndio(ma_context* pContext, ma_enum_devices_callback_proc callback, void* pUserData) { ma_bool32 isTerminating = MA_FALSE; @@ -37152,7 +36512,6 @@ static ma_result ma_context_get_device_info__sndio(ma_context* pContext, ma_devi continue; /* Format not supported. */ } - /* Channels. */ for (iChannel = 0; iChannel < MA_SIO_NCHAN; iChannel += 1) { unsigned int chan = 0; @@ -37174,7 +36533,6 @@ static ma_result ma_context_get_device_info__sndio(ma_context* pContext, ma_devi channels = caps.rchan[iChannel]; } - /* Sample Rates. */ for (iRate = 0; iRate < MA_SIO_NRATE; iRate += 1) { if ((caps.confs[iConfig].rate & (1UL << iRate)) != 0) { @@ -37292,7 +36650,6 @@ static ma_result ma_device_init_handle__sndio(ma_device* pDevice, const ma_devic sampleRate = ma_find_best_sample_rate_from_sio_cap__sndio(&caps, pConfig->deviceType, format, channels); } - ((ma_sio_initpar_proc)pDevice->pContext->sndio.sio_initpar)(&par); par.msb = 0; par.le = ma_is_little_endian(); @@ -37554,8 +36911,6 @@ static ma_result ma_context_init__sndio(ma_context* pContext, const ma_context_c } #endif /* MA_HAS_SNDIO */ - - /****************************************************************************** audio(4) Backend @@ -37628,7 +36983,6 @@ static ma_result ma_extract_device_index_from_id__audio4(const char* id, const c return MA_SUCCESS; } - #if !defined(MA_AUDIO4_USE_NEW_API) /* Old API */ static ma_format ma_format_from_encoding__audio4(unsigned int encoding, unsigned int precision) { @@ -38452,7 +37806,6 @@ static ma_result ma_context_init__audio4(ma_context* pContext, const ma_context_ } #endif /* MA_HAS_AUDIO4 */ - /****************************************************************************** OSS Backend @@ -38652,7 +38005,6 @@ static ma_result ma_context_get_device_info__oss(ma_context* pContext, ma_device return MA_SUCCESS; } - /* If we get here it means we are _not_ using the default device. */ foundDevice = MA_FALSE; @@ -38690,7 +38042,6 @@ static ma_result ma_context_get_device_info__oss(ma_context* pContext, ma_device ma_strncpy_s(pDeviceInfo->name, sizeof(pDeviceInfo->name), ai.name, (size_t)-1); } - pDeviceInfo->nativeDataFormatCount = 0; if (deviceType == ma_device_type_playback) { @@ -38721,7 +38072,6 @@ static ma_result ma_context_get_device_info__oss(ma_context* pContext, ma_device return MA_NO_BACKEND; } - close(fdTemp); if (!foundDevice) { @@ -39083,10 +38433,6 @@ static ma_result ma_context_init__oss(ma_context* pContext, const ma_context_con } #endif /* MA_HAS_OSS */ - - - - /****************************************************************************** AAudio Backend @@ -39191,7 +38537,6 @@ typedef struct ma_AAudioStream_t* ma_AAudioStream; #define MA_AAUDIO_CALLBACK_RESULT_CONTINUE 0 #define MA_AAUDIO_CALLBACK_RESULT_STOP 1 - typedef ma_aaudio_data_callback_result_t (* ma_AAudioStream_dataCallback) (ma_AAudioStream* pStream, void* pUserData, void* pAudioData, int32_t numFrames); typedef void (* ma_AAudioStream_errorCallback)(ma_AAudioStream *pStream, void *pUserData, ma_aaudio_result_t error); @@ -39388,7 +38733,6 @@ static ma_result ma_create_and_configure_AAudioStreamBuilder__aaudio(ma_context* ((MA_PFN_AAudioStreamBuilder_setDirection)pContext->aaudio.AAudioStreamBuilder_setDirection)(pBuilder, (deviceType == ma_device_type_playback) ? MA_AAUDIO_DIRECTION_OUTPUT : MA_AAUDIO_DIRECTION_INPUT); ((MA_PFN_AAudioStreamBuilder_setSharingMode)pContext->aaudio.AAudioStreamBuilder_setSharingMode)(pBuilder, (shareMode == ma_share_mode_shared) ? MA_AAUDIO_SHARING_MODE_SHARED : MA_AAUDIO_SHARING_MODE_EXCLUSIVE); - /* If we have a device descriptor make sure we configure the stream builder to take our requested parameters. */ if (pDescriptor != NULL) { MA_ASSERT(pConfig != NULL); /* We must have a device config if we also have a descriptor. The config is required for AAudio specific configuration options. */ @@ -39405,7 +38749,6 @@ static ma_result ma_create_and_configure_AAudioStreamBuilder__aaudio(ma_context* ((MA_PFN_AAudioStreamBuilder_setFormat)pContext->aaudio.AAudioStreamBuilder_setFormat)(pBuilder, (pDescriptor->format == ma_format_s16) ? MA_AAUDIO_FORMAT_PCM_I16 : MA_AAUDIO_FORMAT_PCM_FLOAT); } - /* There have been reports where setting the frames per data callback results in an error. In particular, re-routing may inadvertently switch from low-latency mode, resulting in a less stable @@ -39551,7 +38894,6 @@ static ma_result ma_wait_for_simple_state_transition__aaudio(ma_context* pContex return MA_SUCCESS; } - static ma_result ma_context_enumerate_devices__aaudio(ma_context* pContext, ma_enum_devices_callback_proc callback, void* pUserData) { ma_bool32 cbResult = MA_TRUE; @@ -39629,7 +38971,6 @@ static ma_result ma_context_get_device_info__aaudio(ma_context* pContext, ma_dev ma_strncpy_s(pDeviceInfo->name, sizeof(pDeviceInfo->name), MA_DEFAULT_CAPTURE_DEVICE_NAME, (size_t)-1); } - pDeviceInfo->nativeDataFormatCount = 0; /* We'll need to open the device to get accurate sample rate and channel count information. */ @@ -40057,7 +39398,6 @@ static ma_result ma_device_get_info__aaudio(ma_device* pDevice, ma_device_type t return MA_SUCCESS; } - static ma_result ma_context_uninit__aaudio(ma_context* pContext) { MA_ASSERT(pContext != NULL); @@ -40166,7 +39506,6 @@ static ma_result ma_context_init__aaudio(ma_context* pContext, const ma_context_ pCallbacks->onDeviceDataLoop = NULL; /* Not used because AAudio is asynchronous. */ pCallbacks->onDeviceGetInfo = ma_device_get_info__aaudio; - /* We need a job thread so we can deal with rerouting. */ { ma_result result; @@ -40182,7 +39521,6 @@ static ma_result ma_context_init__aaudio(ma_context* pContext, const ma_context_ } } - (void)pConfig; return MA_SUCCESS; } @@ -40222,7 +39560,6 @@ static ma_result ma_job_process__device__aaudio_reroute(ma_job* pJob) } #endif /* AAudio */ - /****************************************************************************** OpenSL|ES Backend @@ -40421,7 +39758,6 @@ static SLuint32 ma_round_to_standard_sample_rate__opensl(SLuint32 samplesPerSec) return SL_SAMPLINGRATE_16; } - static SLint32 ma_to_stream_type__opensl(ma_opensl_stream_type streamType) { switch (streamType) { @@ -40451,7 +39787,6 @@ static SLint32 ma_to_recording_preset__opensl(ma_opensl_recording_preset recordi return SL_ANDROID_RECORDING_PRESET_NONE; } - static ma_result ma_context_enumerate_devices__opensl(ma_context* pContext, ma_enum_devices_callback_proc callback, void* pUserData) { ma_bool32 cbResult; @@ -40667,7 +40002,6 @@ return_default_device: goto return_detailed_info; - return_detailed_info: /* @@ -40685,7 +40019,6 @@ return_detailed_info: return MA_SUCCESS; } - #ifdef MA_ANDROID /*void ma_buffer_queue_callback_capture__opensl_android(SLAndroidSimpleBufferQueueItf pBufferQueue, SLuint32 eventFlags, const void* pBuffer, SLuint32 bufferSize, SLuint32 dataUsed, void* pContext)*/ static void ma_buffer_queue_callback_capture__opensl_android(SLAndroidSimpleBufferQueueItf pBufferQueue, void* pUserData) @@ -40982,7 +40315,6 @@ static ma_result ma_device_init__opensl(ma_device* pDevice, const ma_device_conf return ma_result_from_OpenSL(resultSL); } - /* Set the recording preset before realizing the player. */ if (pConfig->opensl.recordingPreset != ma_opensl_recording_preset_default) { resultSL = MA_OPENSL_OBJ(pDevice->opensl.pAudioRecorderObj)->GetInterface((SLObjectItf)pDevice->opensl.pAudioRecorderObj, (SLInterfaceID)pDevice->pContext->opensl.SL_IID_ANDROIDCONFIGURATION, &pRecorderConfig); @@ -41105,7 +40437,6 @@ static ma_result ma_device_init__opensl(ma_device* pDevice, const ma_device_conf return ma_result_from_OpenSL(resultSL); } - /* Set the stream type before realizing the player. */ if (pConfig->opensl.streamType != ma_opensl_stream_type_default) { resultSL = MA_OPENSL_OBJ(pDevice->opensl.pAudioPlayerObj)->GetInterface((SLObjectItf)pDevice->opensl.pAudioPlayerObj, (SLInterfaceID)pDevice->pContext->opensl.SL_IID_ANDROIDCONFIGURATION, &pPlayerConfig); @@ -41303,7 +40634,6 @@ static ma_result ma_device_stop__opensl(ma_device* pDevice) return MA_SUCCESS; } - static ma_result ma_context_uninit__opensl(ma_context* pContext) { MA_ASSERT(pContext != NULL); @@ -41456,7 +40786,6 @@ static ma_result ma_context_init__opensl(ma_context* pContext, const ma_context_ pContext->opensl.slCreateEngine = (ma_proc)slCreateEngine; #endif - /* Initialize global data first if applicable. */ ma_spinlock_lock(&g_maOpenSLSpinlock); { @@ -41486,7 +40815,6 @@ static ma_result ma_context_init__opensl(ma_context* pContext, const ma_context_ } #endif /* OpenSL|ES */ - /****************************************************************************** Web Audio Backend @@ -41731,7 +41059,6 @@ static ma_uint32 ma_calculate_period_size_in_frames_from_descriptor__webaudio(co } #endif - #if defined(MA_USE_AUDIO_WORKLETS) typedef struct { @@ -41815,7 +41142,6 @@ static EM_BOOL ma_audio_worklet_process_callback__webaudio(int inputCount, const return EM_TRUE; } - static void ma_audio_worklet_processor_created__webaudio(EMSCRIPTEN_WEBAUDIO_T audioContext, EM_BOOL success, void* pUserData) { ma_audio_worklet_thread_initialized_data* pParameters = (ma_audio_worklet_thread_initialized_data*)pUserData; @@ -41856,7 +41182,6 @@ static void ma_audio_worklet_processor_created__webaudio(EMSCRIPTEN_WEBAUDIO_T a audioWorkletOptions.numberOfOutputs = 1; audioWorkletOptions.outputChannelCounts = &channels; - /* Now that we know the channel count to use we can allocate the intermediary buffer. The intermediary buffer is used for interleaving and deinterleaving. @@ -42430,8 +41755,6 @@ static ma_result ma_context_init__webaudio(ma_context* pContext, const ma_contex } #endif /* MA_HAS_WEBAUDIO */ - - static ma_bool32 ma__is_channel_map_valid(const ma_channel* pChannelMap, ma_uint32 channels) { /* A blank channel map should be allowed, in which case it should use an appropriate default which will depend on context. */ @@ -42456,7 +41779,6 @@ static ma_bool32 ma__is_channel_map_valid(const ma_channel* pChannelMap, ma_uint return MA_TRUE; } - static ma_bool32 ma_context_is_backend_asynchronous(ma_context* pContext) { MA_ASSERT(pContext != NULL); @@ -42472,7 +41794,6 @@ static ma_bool32 ma_context_is_backend_asynchronous(ma_context* pContext) } } - static ma_result ma_device__post_init_setup(ma_device* pDevice, ma_device_type deviceType) { ma_result result; @@ -42590,7 +41911,6 @@ static ma_result ma_device__post_init_setup(ma_device* pDevice, ma_device_type d } } - /* If the device is doing playback (ma_device_type_playback or ma_device_type_duplex), there's a couple of situations where we'll need a heap allocated cache. @@ -42739,7 +42059,6 @@ MA_API ma_result ma_device_post_init(ma_device* pDevice, ma_device_type deviceTy return ma_device__post_init_setup(pDevice, deviceType); /* TODO: Should probably rename ma_device__post_init_setup() to something better. */ } - static ma_thread_result MA_THREADCALL ma_worker_thread(void* pData) { ma_device* pDevice = (ma_device*)pData; @@ -42849,7 +42168,6 @@ static ma_thread_result MA_THREADCALL ma_worker_thread(void* pData) return (ma_thread_result)0; } - /* Helper for determining whether or not the given device is initialized. */ static ma_bool32 ma_device__is_initialized(ma_device* pDevice) { @@ -42860,7 +42178,6 @@ static ma_bool32 ma_device__is_initialized(ma_device* pDevice) return ma_device_get_state(pDevice) != ma_device_state_uninitialized; } - #ifdef MA_WIN32 static ma_result ma_context_uninit_backend_apis__win32(ma_context* pContext) { @@ -42911,7 +42228,6 @@ static ma_result ma_context_init_backend_apis__win32(ma_context* pContext) pContext->win32.GetForegroundWindow = (ma_proc)ma_dlsym(ma_context_get_log(pContext), pContext->win32.hUser32DLL, "GetForegroundWindow"); pContext->win32.GetDesktopWindow = (ma_proc)ma_dlsym(ma_context_get_log(pContext), pContext->win32.hUser32DLL, "GetDesktopWindow"); - /* Advapi32.dll */ pContext->win32.hAdvapi32DLL = ma_dlopen(ma_context_get_log(pContext), "advapi32.dll"); if (pContext->win32.hAdvapi32DLL == NULL) { @@ -42993,7 +42309,6 @@ static ma_result ma_context_uninit_backend_apis(ma_context* pContext) return result; } - /* The default capacity doesn't need to be too big. */ #ifndef MA_DEFAULT_DEVICE_JOB_QUEUE_CAPACITY #define MA_DEFAULT_DEVICE_JOB_QUEUE_CAPACITY 32 @@ -43011,7 +42326,6 @@ MA_API ma_device_job_thread_config ma_device_job_thread_config_init(void) return config; } - static ma_thread_result MA_THREADCALL ma_device_job_thread_entry(void* pUserData) { ma_device_job_thread* pJobThread = (ma_device_job_thread*)pUserData; @@ -43051,7 +42365,6 @@ MA_API ma_result ma_device_job_thread_init(const ma_device_job_thread_config* pC return MA_INVALID_ARGS; } - /* Initialize the job queue before the thread to ensure it's in a valid state. */ jobQueueConfig = ma_job_queue_config_init(pConfig->jobQueueFlags, pConfig->jobQueueCapacity); @@ -43060,7 +42373,6 @@ MA_API ma_result ma_device_job_thread_init(const ma_device_job_thread_config* pC return result; /* Failed to initialize job queue. */ } - /* The thread needs to be initialized after the job queue to ensure the thread doesn't try to access it prematurely. */ if (pConfig->noThread == MA_FALSE) { result = ma_thread_create(&pJobThread->thread, ma_thread_priority_normal, 0, ma_device_job_thread_entry, pJobThread, pAllocationCallbacks); @@ -43074,7 +42386,6 @@ MA_API ma_result ma_device_job_thread_init(const ma_device_job_thread_config* pC pJobThread->_hasThread = MA_FALSE; } - return MA_SUCCESS; } @@ -43123,7 +42434,6 @@ MA_API ma_result ma_device_job_thread_next(ma_device_job_thread* pJobThread, ma_ return ma_job_queue_next(&pJobThread->jobQueue, pJob); } - MA_API ma_bool32 ma_device_id_equal(const ma_device_id* pA, const ma_device_id* pB) { size_t i; @@ -43141,8 +42451,6 @@ MA_API ma_bool32 ma_device_id_equal(const ma_device_id* pA, const ma_device_id* return MA_TRUE; } - - MA_API ma_context_config ma_context_config_init(void) { ma_context_config config; @@ -43397,7 +42705,6 @@ MA_API size_t ma_context_sizeof(void) return sizeof(ma_context); } - MA_API ma_log* ma_context_get_log(ma_context* pContext) { if (pContext == NULL) { @@ -43407,7 +42714,6 @@ MA_API ma_log* ma_context_get_log(ma_context* pContext) return pContext->pLog; } - MA_API ma_result ma_context_enumerate_devices(ma_context* pContext, ma_enum_devices_callback_proc callback, void* pUserData) { ma_result result; @@ -43429,7 +42735,6 @@ MA_API ma_result ma_context_enumerate_devices(ma_context* pContext, ma_enum_devi return result; } - static ma_bool32 ma_context_get_devices__enum_callback(ma_context* pContext, ma_device_type deviceType, const ma_device_info* pInfo, void* pUserData) { /* @@ -43573,7 +42878,6 @@ MA_API ma_bool32 ma_context_is_loopback_supported(ma_context* pContext) return ma_is_loopback_supported(pContext->backend); } - MA_API ma_device_config ma_device_config_init(ma_device_type deviceType) { ma_device_config config; @@ -43713,7 +43017,6 @@ MA_API ma_result ma_device_init(ma_context* pContext, const ma_device_config* pC return result; } - MA_ZERO_OBJECT(&descriptorPlayback); descriptorPlayback.pDeviceID = pConfig->playback.pDeviceID; descriptorPlayback.shareMode = pConfig->playback.shareMode; @@ -43729,7 +43032,6 @@ MA_API ma_result ma_device_init(ma_context* pContext, const ma_device_config* pC descriptorPlayback.periodCount = MA_DEFAULT_PERIODS; } - MA_ZERO_OBJECT(&descriptorCapture); descriptorCapture.pDeviceID = pConfig->capture.pDeviceID; descriptorCapture.shareMode = pConfig->capture.shareMode; @@ -43745,7 +43047,6 @@ MA_API ma_result ma_device_init(ma_context* pContext, const ma_device_config* pC descriptorCapture.periodCount = MA_DEFAULT_PERIODS; } - result = pContext->callbacks.onDeviceInit(pDevice, pConfig, &descriptorPlayback, &descriptorCapture); if (result != MA_SUCCESS) { ma_event_uninit(&pDevice->startEvent); @@ -43795,7 +43096,6 @@ MA_API ma_result ma_device_init(ma_context* pContext, const ma_device_config* pC } } - /* The name of the device can be retrieved from device info. This may be temporary and replaced with a `ma_device_get_info(pDevice, deviceType)` instead. For loopback devices, we need to retrieve the name of the playback device. @@ -43832,7 +43132,6 @@ MA_API ma_result ma_device_init(ma_context* pContext, const ma_device_config* pC } } - ma_device__post_init_setup(pDevice, pConfig->deviceType); #endif @@ -43842,7 +43141,6 @@ MA_API ma_result ma_device_init(ma_context* pContext, const ma_device_config* pC return result; } - /* If we're using fixed sized callbacks we'll need to make use of an intermediary buffer. Needs to be done after post_init_setup() because we'll need access to the sample rate. @@ -43905,7 +43203,6 @@ MA_API ma_result ma_device_init(ma_context* pContext, const ma_device_config* pC /* Not using a fixed sized data callback so no need for an intermediary buffer. */ } - /* Some backends don't require the worker thread. */ if (!ma_context_is_backend_asynchronous(pContext)) { /* The worker thread. */ @@ -44119,7 +43416,6 @@ MA_API void ma_device_uninit(ma_device* pDevice) pDevice->pContext->callbacks.onDeviceUninit(pDevice); } - ma_event_uninit(&pDevice->stopEvent); ma_event_uninit(&pDevice->startEvent); ma_event_uninit(&pDevice->wakeupEvent); @@ -44468,7 +43764,6 @@ MA_API ma_result ma_device_get_master_volume_db(ma_device* pDevice, float* pGain return MA_SUCCESS; } - MA_API ma_result ma_device_handle_backend_data_callback(ma_device* pDevice, void* pOutput, const void* pInput, ma_uint32 frameCount) { if (pDevice == NULL) { @@ -44554,7 +43849,6 @@ MA_API ma_uint32 ma_calculate_buffer_size_in_frames_from_descriptor(const ma_dev } #endif /* MA_NO_DEVICE_IO */ - MA_API ma_uint32 ma_calculate_buffer_size_in_milliseconds_from_frames(ma_uint32 bufferSizeInFrames, ma_uint32 sampleRate) { /* Prevent a division by zero. */ @@ -44607,7 +43901,6 @@ MA_API const void* ma_offset_pcm_frames_const_ptr(const void* p, ma_uint64 offse return ma_offset_ptr(p, offsetInFrames * ma_get_bytes_per_frame(format, channels)); } - MA_API void ma_clip_samples_u8(ma_uint8* pDst, const ma_int16* pSrc, ma_uint64 count) { ma_uint64 iSample; @@ -44694,7 +43987,6 @@ MA_API void ma_clip_pcm_frames(void* pDst, const void* pSrc, ma_uint64 frameCoun } } - MA_API void ma_copy_and_apply_volume_factor_u8(ma_uint8* pSamplesOut, const ma_uint8* pSamplesIn, ma_uint64 sampleCount, float factor) { ma_uint64 iSample; @@ -44876,7 +44168,6 @@ MA_API void ma_apply_volume_factor_pcm_frames(void* pFramesOut, ma_uint64 frameC ma_copy_and_apply_volume_factor_pcm_frames(pFramesOut, pFramesOut, frameCount, format, channels, factor); } - MA_API void ma_copy_and_apply_volume_factor_per_channel_f32(float* pFramesOut, const float* pFramesIn, ma_uint64 frameCount, ma_uint32 channels, float* pChannelGains) { ma_uint64 iFrame; @@ -44893,8 +44184,6 @@ MA_API void ma_copy_and_apply_volume_factor_per_channel_f32(float* pFramesOut, c } } - - static MA_INLINE ma_int16 ma_apply_volume_unclipped_u8(ma_int16 x, ma_int16 volume) { return (ma_int16)(((ma_int32)x * (ma_int32)volume) >> 8); @@ -44920,7 +44209,6 @@ static MA_INLINE float ma_apply_volume_unclipped_f32(float x, float volume) return x * volume; } - MA_API void ma_copy_and_apply_volume_and_clip_samples_u8(ma_uint8* pDst, const ma_int16* pSrc, ma_uint64 count, float volume) { ma_uint64 iSample; @@ -45025,8 +44313,6 @@ MA_API void ma_copy_and_apply_volume_and_clip_pcm_frames(void* pDst, const void* } } - - MA_API float ma_volume_linear_to_db(float factor) { return 20*ma_log10f(factor); @@ -45037,7 +44323,6 @@ MA_API float ma_volume_db_to_linear(float gain) return ma_powf(10, gain/20.0f); } - MA_API ma_result ma_mix_pcm_frames_f32(float* pDst, const float* pSrc, ma_uint64 frameCount, ma_uint32 channels, float volume) { ma_uint64 iSample; @@ -45066,8 +44351,6 @@ MA_API ma_result ma_mix_pcm_frames_f32(float* pDst, const float* pSrc, ma_uint64 return MA_SUCCESS; } - - /************************************************************************************************************************************************************** Format Conversion @@ -45096,7 +44379,6 @@ static MA_INLINE void ma_pcm_sample_s32_to_s24_no_scale(ma_int64 x, ma_uint8* s2 s24[2] = (ma_uint8)((x & 0x00FF0000) >> 16); } - /* u8 */ MA_API void ma_pcm_u8_to_u8(void* dst, const void* src, ma_uint64 count, ma_dither_mode ditherMode) { @@ -45104,7 +44386,6 @@ MA_API void ma_pcm_u8_to_u8(void* dst, const void* src, ma_uint64 count, ma_dith ma_copy_memory_64(dst, src, count * sizeof(ma_uint8)); } - static MA_INLINE void ma_pcm_u8_to_s16__reference(void* dst, const void* src, ma_uint64 count, ma_dither_mode ditherMode) { ma_int16* dst_s16 = (ma_int16*)dst; @@ -45159,7 +44440,6 @@ MA_API void ma_pcm_u8_to_s16(void* dst, const void* src, ma_uint64 count, ma_dit #endif } - static MA_INLINE void ma_pcm_u8_to_s24__reference(void* dst, const void* src, ma_uint64 count, ma_dither_mode ditherMode) { ma_uint8* dst_s24 = (ma_uint8*)dst; @@ -45216,7 +44496,6 @@ MA_API void ma_pcm_u8_to_s24(void* dst, const void* src, ma_uint64 count, ma_dit #endif } - static MA_INLINE void ma_pcm_u8_to_s32__reference(void* dst, const void* src, ma_uint64 count, ma_dither_mode ditherMode) { ma_int32* dst_s32 = (ma_int32*)dst; @@ -45271,7 +44550,6 @@ MA_API void ma_pcm_u8_to_s32(void* dst, const void* src, ma_uint64 count, ma_dit #endif } - static MA_INLINE void ma_pcm_u8_to_f32__reference(void* dst, const void* src, ma_uint64 count, ma_dither_mode ditherMode) { float* dst_f32 = (float*)dst; @@ -45327,7 +44605,6 @@ MA_API void ma_pcm_u8_to_f32(void* dst, const void* src, ma_uint64 count, ma_dit #endif } - #ifdef MA_USE_REFERENCE_CONVERSION_APIS static MA_INLINE void ma_pcm_interleave_u8__reference(void* dst, const void** src, ma_uint64 frameCount, ma_uint32 channels) { @@ -45377,7 +44654,6 @@ MA_API void ma_pcm_interleave_u8(void* dst, const void** src, ma_uint64 frameCou #endif } - static MA_INLINE void ma_pcm_deinterleave_u8__reference(void** dst, const void* src, ma_uint64 frameCount, ma_uint32 channels) { ma_uint8** dst_u8 = (ma_uint8**)dst; @@ -45406,7 +44682,6 @@ MA_API void ma_pcm_deinterleave_u8(void** dst, const void* src, ma_uint64 frameC #endif } - /* s16 */ static MA_INLINE void ma_pcm_s16_to_u8__reference(void* dst, const void* src, ma_uint64 count, ma_dither_mode ditherMode) { @@ -45479,14 +44754,12 @@ MA_API void ma_pcm_s16_to_u8(void* dst, const void* src, ma_uint64 count, ma_dit #endif } - MA_API void ma_pcm_s16_to_s16(void* dst, const void* src, ma_uint64 count, ma_dither_mode ditherMode) { (void)ditherMode; ma_copy_memory_64(dst, src, count * sizeof(ma_int16)); } - static MA_INLINE void ma_pcm_s16_to_s24__reference(void* dst, const void* src, ma_uint64 count, ma_dither_mode ditherMode) { ma_uint8* dst_s24 = (ma_uint8*)dst; @@ -45540,7 +44813,6 @@ MA_API void ma_pcm_s16_to_s24(void* dst, const void* src, ma_uint64 count, ma_di #endif } - static MA_INLINE void ma_pcm_s16_to_s32__reference(void* dst, const void* src, ma_uint64 count, ma_dither_mode ditherMode) { ma_int32* dst_s32 = (ma_int32*)dst; @@ -45592,7 +44864,6 @@ MA_API void ma_pcm_s16_to_s32(void* dst, const void* src, ma_uint64 count, ma_di #endif } - static MA_INLINE void ma_pcm_s16_to_f32__reference(void* dst, const void* src, ma_uint64 count, ma_dither_mode ditherMode) { float* dst_f32 = (float*)dst; @@ -45656,7 +44927,6 @@ MA_API void ma_pcm_s16_to_f32(void* dst, const void* src, ma_uint64 count, ma_di #endif } - static MA_INLINE void ma_pcm_interleave_s16__reference(void* dst, const void** src, ma_uint64 frameCount, ma_uint32 channels) { ma_int16* dst_s16 = (ma_int16*)dst; @@ -45685,7 +44955,6 @@ MA_API void ma_pcm_interleave_s16(void* dst, const void** src, ma_uint64 frameCo #endif } - static MA_INLINE void ma_pcm_deinterleave_s16__reference(void** dst, const void* src, ma_uint64 frameCount, ma_uint32 channels) { ma_int16** dst_s16 = (ma_int16**)dst; @@ -45714,7 +44983,6 @@ MA_API void ma_pcm_deinterleave_s16(void** dst, const void* src, ma_uint64 frame #endif } - /* s24 */ static MA_INLINE void ma_pcm_s24_to_u8__reference(void* dst, const void* src, ma_uint64 count, ma_dither_mode ditherMode) { @@ -45784,7 +45052,6 @@ MA_API void ma_pcm_s24_to_u8(void* dst, const void* src, ma_uint64 count, ma_dit #endif } - static MA_INLINE void ma_pcm_s24_to_s16__reference(void* dst, const void* src, ma_uint64 count, ma_dither_mode ditherMode) { ma_int16* dst_s16 = (ma_int16*)dst; @@ -45854,7 +45121,6 @@ MA_API void ma_pcm_s24_to_s16(void* dst, const void* src, ma_uint64 count, ma_di #endif } - MA_API void ma_pcm_s24_to_s24(void* dst, const void* src, ma_uint64 count, ma_dither_mode ditherMode) { (void)ditherMode; @@ -45862,7 +45128,6 @@ MA_API void ma_pcm_s24_to_s24(void* dst, const void* src, ma_uint64 count, ma_di ma_copy_memory_64(dst, src, count * 3); } - static MA_INLINE void ma_pcm_s24_to_s32__reference(void* dst, const void* src, ma_uint64 count, ma_dither_mode ditherMode) { ma_int32* dst_s32 = (ma_int32*)dst; @@ -45914,7 +45179,6 @@ MA_API void ma_pcm_s24_to_s32(void* dst, const void* src, ma_uint64 count, ma_di #endif } - static MA_INLINE void ma_pcm_s24_to_f32__reference(void* dst, const void* src, ma_uint64 count, ma_dither_mode ditherMode) { float* dst_f32 = (float*)dst; @@ -45978,7 +45242,6 @@ MA_API void ma_pcm_s24_to_f32(void* dst, const void* src, ma_uint64 count, ma_di #endif } - static MA_INLINE void ma_pcm_interleave_s24__reference(void* dst, const void** src, ma_uint64 frameCount, ma_uint32 channels) { ma_uint8* dst8 = (ma_uint8*)dst; @@ -46009,7 +45272,6 @@ MA_API void ma_pcm_interleave_s24(void* dst, const void** src, ma_uint64 frameCo #endif } - static MA_INLINE void ma_pcm_deinterleave_s24__reference(void** dst, const void* src, ma_uint64 frameCount, ma_uint32 channels) { ma_uint8** dst8 = (ma_uint8**)dst; @@ -46040,8 +45302,6 @@ MA_API void ma_pcm_deinterleave_s24(void** dst, const void* src, ma_uint64 frame #endif } - - /* s32 */ static MA_INLINE void ma_pcm_s32_to_u8__reference(void* dst, const void* src, ma_uint64 count, ma_dither_mode ditherMode) { @@ -46114,7 +45374,6 @@ MA_API void ma_pcm_s32_to_u8(void* dst, const void* src, ma_uint64 count, ma_dit #endif } - static MA_INLINE void ma_pcm_s32_to_s16__reference(void* dst, const void* src, ma_uint64 count, ma_dither_mode ditherMode) { ma_int16* dst_s16 = (ma_int16*)dst; @@ -46184,7 +45443,6 @@ MA_API void ma_pcm_s32_to_s16(void* dst, const void* src, ma_uint64 count, ma_di #endif } - static MA_INLINE void ma_pcm_s32_to_s24__reference(void* dst, const void* src, ma_uint64 count, ma_dither_mode ditherMode) { ma_uint8* dst_s24 = (ma_uint8*)dst; @@ -46239,7 +45497,6 @@ MA_API void ma_pcm_s32_to_s24(void* dst, const void* src, ma_uint64 count, ma_di #endif } - MA_API void ma_pcm_s32_to_s32(void* dst, const void* src, ma_uint64 count, ma_dither_mode ditherMode) { (void)ditherMode; @@ -46247,7 +45504,6 @@ MA_API void ma_pcm_s32_to_s32(void* dst, const void* src, ma_uint64 count, ma_di ma_copy_memory_64(dst, src, count * sizeof(ma_int32)); } - static MA_INLINE void ma_pcm_s32_to_f32__reference(void* dst, const void* src, ma_uint64 count, ma_dither_mode ditherMode) { float* dst_f32 = (float*)dst; @@ -46309,7 +45565,6 @@ MA_API void ma_pcm_s32_to_f32(void* dst, const void* src, ma_uint64 count, ma_di #endif } - static MA_INLINE void ma_pcm_interleave_s32__reference(void* dst, const void** src, ma_uint64 frameCount, ma_uint32 channels) { ma_int32* dst_s32 = (ma_int32*)dst; @@ -46338,7 +45593,6 @@ MA_API void ma_pcm_interleave_s32(void* dst, const void** src, ma_uint64 frameCo #endif } - static MA_INLINE void ma_pcm_deinterleave_s32__reference(void** dst, const void* src, ma_uint64 frameCount, ma_uint32 channels) { ma_int32** dst_s32 = (ma_int32**)dst; @@ -46367,7 +45621,6 @@ MA_API void ma_pcm_deinterleave_s32(void** dst, const void* src, ma_uint64 frame #endif } - /* f32 */ static MA_INLINE void ma_pcm_f32_to_u8__reference(void* dst, const void* src, ma_uint64 count, ma_dither_mode ditherMode) { @@ -46612,7 +45865,6 @@ static MA_INLINE void ma_pcm_f32_to_s16__sse2(void* dst, const void* src, ma_uin i += 8; } - /* Leftover. */ for (; i < count; i += 1) { float x = src_f32[i]; @@ -46720,7 +45972,6 @@ static MA_INLINE void ma_pcm_f32_to_s16__neon(void* dst, const void* src, ma_uin i += 8; } - /* Leftover. */ for (; i < count; i += 1) { float x = src_f32[i]; @@ -46754,7 +46005,6 @@ MA_API void ma_pcm_f32_to_s16(void* dst, const void* src, ma_uint64 count, ma_di #endif } - static MA_INLINE void ma_pcm_f32_to_s24__reference(void* dst, const void* src, ma_uint64 count, ma_dither_mode ditherMode) { ma_uint8* dst_s24 = (ma_uint8*)dst; @@ -46823,7 +46073,6 @@ MA_API void ma_pcm_f32_to_s24(void* dst, const void* src, ma_uint64 count, ma_di #endif } - static MA_INLINE void ma_pcm_f32_to_s32__reference(void* dst, const void* src, ma_uint64 count, ma_dither_mode ditherMode) { ma_int32* dst_s32 = (ma_int32*)dst; @@ -46888,7 +46137,6 @@ MA_API void ma_pcm_f32_to_s32(void* dst, const void* src, ma_uint64 count, ma_di #endif } - MA_API void ma_pcm_f32_to_f32(void* dst, const void* src, ma_uint64 count, ma_dither_mode ditherMode) { (void)ditherMode; @@ -46896,7 +46144,6 @@ MA_API void ma_pcm_f32_to_f32(void* dst, const void* src, ma_uint64 count, ma_di ma_copy_memory_64(dst, src, count * sizeof(float)); } - static void ma_pcm_interleave_f32__reference(void* dst, const void** src, ma_uint64 frameCount, ma_uint32 channels) { float* dst_f32 = (float*)dst; @@ -46925,7 +46172,6 @@ MA_API void ma_pcm_interleave_f32(void* dst, const void** src, ma_uint64 frameCo #endif } - static void ma_pcm_deinterleave_f32__reference(void** dst, const void* src, ma_uint64 frameCount, ma_uint32 channels) { float** dst_f32 = (float**)dst; @@ -46954,7 +46200,6 @@ MA_API void ma_pcm_deinterleave_f32(void** dst, const void* src, ma_uint64 frame #endif } - MA_API void ma_pcm_convert(void* pOut, ma_format formatOut, const void* pIn, ma_format formatIn, ma_uint64 sampleCount, ma_dither_mode ditherMode) { if (formatOut == formatIn) { @@ -47129,7 +46374,6 @@ MA_API void ma_interleave_pcm_frames(ma_format format, ma_uint32 channels, ma_ui } } - /************************************************************************************************************************************************************** Biquad Filter @@ -47161,7 +46405,6 @@ MA_API ma_biquad_config ma_biquad_config_init(ma_format format, ma_uint32 channe return config; } - typedef struct { size_t sizeInBytes; @@ -47311,7 +46554,6 @@ MA_API ma_result ma_biquad_reinit(const ma_biquad_config* pConfig, ma_biquad* pB return MA_INVALID_OPERATION; } - pBQ->format = pConfig->format; pBQ->channels = pConfig->channels; @@ -47459,7 +46701,6 @@ MA_API ma_uint32 ma_biquad_get_latency(const ma_biquad* pBQ) return 2; } - /************************************************************************************************************************************************************** Low-Pass Filter @@ -47498,7 +46739,6 @@ MA_API ma_lpf2_config ma_lpf2_config_init(ma_format format, ma_uint32 channels, return config; } - typedef struct { size_t sizeInBytes; @@ -47751,7 +46991,6 @@ MA_API ma_uint32 ma_lpf1_get_latency(const ma_lpf1* pLPF) return 1; } - static MA_INLINE ma_biquad_config ma_lpf2__get_biquad_config(const ma_lpf2_config* pConfig) { ma_biquad_config bqConfig; @@ -47910,7 +47149,6 @@ MA_API ma_uint32 ma_lpf2_get_latency(const ma_lpf2* pLPF) return ma_biquad_get_latency(&pLPF->bq); } - MA_API ma_lpf_config ma_lpf_config_init(ma_format format, ma_uint32 channels, ma_uint32 sampleRate, double cutoffFrequency, ma_uint32 order) { ma_lpf_config config; @@ -47925,7 +47163,6 @@ MA_API ma_lpf_config ma_lpf_config_init(ma_format format, ma_uint32 channels, ma return config; } - typedef struct { size_t sizeInBytes; @@ -48348,7 +47585,6 @@ MA_API ma_uint32 ma_lpf_get_latency(const ma_lpf* pLPF) return pLPF->lpf2Count*2 + pLPF->lpf1Count; } - /************************************************************************************************************************************************************** High-Pass Filtering @@ -48386,7 +47622,6 @@ MA_API ma_hpf2_config ma_hpf2_config_init(ma_format format, ma_uint32 channels, return config; } - typedef struct { size_t sizeInBytes; @@ -48624,7 +47859,6 @@ MA_API ma_uint32 ma_hpf1_get_latency(const ma_hpf1* pHPF) return 1; } - static MA_INLINE ma_biquad_config ma_hpf2__get_biquad_config(const ma_hpf2_config* pConfig) { ma_biquad_config bqConfig; @@ -48772,7 +48006,6 @@ MA_API ma_uint32 ma_hpf2_get_latency(const ma_hpf2* pHPF) return ma_biquad_get_latency(&pHPF->bq); } - MA_API ma_hpf_config ma_hpf_config_init(ma_format format, ma_uint32 channels, ma_uint32 sampleRate, double cutoffFrequency, ma_uint32 order) { ma_hpf_config config; @@ -48787,7 +48020,6 @@ MA_API ma_hpf_config ma_hpf_config_init(ma_format format, ma_uint32 channels, ma return config; } - typedef struct { size_t sizeInBytes; @@ -49172,7 +48404,6 @@ MA_API ma_uint32 ma_hpf_get_latency(const ma_hpf* pHPF) return pHPF->hpf2Count*2 + pHPF->hpf1Count; } - /************************************************************************************************************************************************************** Band-Pass Filtering @@ -49197,7 +48428,6 @@ MA_API ma_bpf2_config ma_bpf2_config_init(ma_format format, ma_uint32 channels, return config; } - static MA_INLINE ma_biquad_config ma_bpf2__get_biquad_config(const ma_bpf2_config* pConfig) { ma_biquad_config bqConfig; @@ -49345,7 +48575,6 @@ MA_API ma_uint32 ma_bpf2_get_latency(const ma_bpf2* pBPF) return ma_biquad_get_latency(&pBPF->bq); } - MA_API ma_bpf_config ma_bpf_config_init(ma_format format, ma_uint32 channels, ma_uint32 sampleRate, double cutoffFrequency, ma_uint32 order) { ma_bpf_config config; @@ -49360,7 +48589,6 @@ MA_API ma_bpf_config ma_bpf_config_init(ma_format format, ma_uint32 channels, ma return config; } - typedef struct { size_t sizeInBytes; @@ -49504,7 +48732,6 @@ static ma_result ma_bpf_reinit__internal(const ma_bpf_config* pConfig, void* pHe return MA_SUCCESS; } - MA_API ma_result ma_bpf_get_heap_size(const ma_bpf_config* pConfig, size_t* pHeapSizeInBytes) { ma_result result; @@ -49658,7 +48885,6 @@ MA_API ma_uint32 ma_bpf_get_latency(const ma_bpf* pBPF) return pBPF->bpf2Count*2; } - /************************************************************************************************************************************************************** Notching Filter @@ -49682,7 +48908,6 @@ MA_API ma_notch2_config ma_notch2_config_init(ma_format format, ma_uint32 channe return config; } - static MA_INLINE ma_biquad_config ma_notch2__get_biquad_config(const ma_notch2_config* pConfig) { ma_biquad_config bqConfig; @@ -49830,8 +49055,6 @@ MA_API ma_uint32 ma_notch2_get_latency(const ma_notch2* pFilter) return ma_biquad_get_latency(&pFilter->bq); } - - /************************************************************************************************************************************************************** Peaking EQ Filter @@ -49856,7 +49079,6 @@ MA_API ma_peak2_config ma_peak2_config_init(ma_format format, ma_uint32 channels return config; } - static MA_INLINE ma_biquad_config ma_peak2__get_biquad_config(const ma_peak2_config* pConfig) { ma_biquad_config bqConfig; @@ -50006,7 +49228,6 @@ MA_API ma_uint32 ma_peak2_get_latency(const ma_peak2* pFilter) return ma_biquad_get_latency(&pFilter->bq); } - /************************************************************************************************************************************************************** Low Shelf Filter @@ -50027,7 +49248,6 @@ MA_API ma_loshelf2_config ma_loshelf2_config_init(ma_format format, ma_uint32 ch return config; } - static MA_INLINE ma_biquad_config ma_loshelf2__get_biquad_config(const ma_loshelf2_config* pConfig) { ma_biquad_config bqConfig; @@ -50179,7 +49399,6 @@ MA_API ma_uint32 ma_loshelf2_get_latency(const ma_loshelf2* pFilter) return ma_biquad_get_latency(&pFilter->bq); } - /************************************************************************************************************************************************************** High Shelf Filter @@ -50200,7 +49419,6 @@ MA_API ma_hishelf2_config ma_hishelf2_config_init(ma_format format, ma_uint32 ch return config; } - static MA_INLINE ma_biquad_config ma_hishelf2__get_biquad_config(const ma_hishelf2_config* pConfig) { ma_biquad_config bqConfig; @@ -50352,8 +49570,6 @@ MA_API ma_uint32 ma_hishelf2_get_latency(const ma_hishelf2* pFilter) return ma_biquad_get_latency(&pFilter->bq); } - - /* Delay */ @@ -50373,7 +49589,6 @@ MA_API ma_delay_config ma_delay_config_init(ma_uint32 channels, ma_uint32 sample return config; } - MA_API ma_result ma_delay_init(const ma_delay_config* pConfig, const ma_allocation_callbacks* pAllocationCallbacks, ma_delay* pDelay) { if (pDelay == NULL) { @@ -50510,7 +49725,6 @@ MA_API float ma_delay_get_decay(const ma_delay* pDelay) return pDelay->config.decay; } - MA_API ma_gainer_config ma_gainer_config_init(ma_uint32 channels, ma_uint32 smoothTimeInFrames) { ma_gainer_config config; @@ -50522,7 +49736,6 @@ MA_API ma_gainer_config ma_gainer_config_init(ma_uint32 channels, ma_uint32 smoo return config; } - typedef struct { size_t sizeInBytes; @@ -50560,7 +49773,6 @@ static ma_result ma_gainer_get_heap_layout(const ma_gainer_config* pConfig, ma_g return MA_SUCCESS; } - MA_API ma_result ma_gainer_get_heap_size(const ma_gainer_config* pConfig, size_t* pHeapSizeInBytes) { ma_result result; @@ -50582,7 +49794,6 @@ MA_API ma_result ma_gainer_get_heap_size(const ma_gainer_config* pConfig, size_t return MA_SUCCESS; } - MA_API ma_result ma_gainer_init_preallocated(const ma_gainer_config* pConfig, void* pHeap, ma_gainer* pGainer) { ma_result result; @@ -51055,7 +50266,6 @@ MA_API ma_result ma_gainer_get_master_volume(const ma_gainer* pGainer, float* pV return MA_SUCCESS; } - MA_API ma_panner_config ma_panner_config_init(ma_format format, ma_uint32 channels) { ma_panner_config config; @@ -51069,7 +50279,6 @@ MA_API ma_panner_config ma_panner_config_init(ma_format format, ma_uint32 channe return config; } - MA_API ma_result ma_panner_init(const ma_panner_config* pConfig, ma_panner* pPanner) { if (pPanner == NULL) { @@ -51145,7 +50354,6 @@ static void ma_stereo_balance_pcm_frames(void* pFramesOut, const void* pFramesIn } } - static void ma_stereo_pan_pcm_frames_f32(float* pFramesOut, const float* pFramesIn, ma_uint64 frameCount, float pan) { ma_uint64 iFrame; @@ -51261,9 +50469,6 @@ MA_API float ma_panner_get_pan(const ma_panner* pPanner) return pPanner->pan; } - - - MA_API ma_fader_config ma_fader_config_init(ma_format format, ma_uint32 channels, ma_uint32 sampleRate) { ma_fader_config config; @@ -51276,7 +50481,6 @@ MA_API ma_fader_config ma_fader_config_init(ma_format format, ma_uint32 channels return config; } - MA_API ma_result ma_fader_init(const ma_fader_config* pConfig, ma_fader* pFader) { if (pFader == NULL) { @@ -51453,10 +50657,6 @@ MA_API float ma_fader_get_current_volume(const ma_fader* pFader) } } - - - - MA_API ma_vec3f ma_vec3f_init_3f(float x, float y, float z) { ma_vec3f v; @@ -51501,8 +50701,6 @@ MA_API float ma_vec3f_len(ma_vec3f v) return (float)ma_sqrtd(ma_vec3f_len2(v)); } - - MA_API float ma_vec3f_dist(ma_vec3f a, ma_vec3f b) { return ma_vec3f_len(ma_vec3f_sub(a, b)); @@ -51533,7 +50731,6 @@ MA_API ma_vec3f ma_vec3f_cross(ma_vec3f a, ma_vec3f b) ); } - MA_API void ma_atomic_vec3f_init(ma_atomic_vec3f* v, ma_vec3f value) { v->v = value; @@ -51562,12 +50759,9 @@ MA_API ma_vec3f ma_atomic_vec3f_get(ma_atomic_vec3f* v) return r; } - - static void ma_channel_map_apply_f32(float* pFramesOut, const ma_channel* pChannelMapOut, ma_uint32 channelsOut, const float* pFramesIn, const ma_channel* pChannelMapIn, ma_uint32 channelsIn, ma_uint64 frameCount, ma_channel_mix_mode mode, ma_mono_expansion_mode monoExpansionMode); static ma_bool32 ma_is_spatial_channel_position(ma_channel channelPosition); - #ifndef MA_DEFAULT_SPEED_OF_SOUND #define MA_DEFAULT_SPEED_OF_SOUND 343.3f #endif @@ -51640,8 +50834,6 @@ static ma_vec3f ma_get_channel_direction(ma_channel channel) } } - - static float ma_attenuation_inverse(float distance, float minDistance, float maxDistance, float rolloff) { if (minDistance >= maxDistance) { @@ -51669,7 +50861,6 @@ static float ma_attenuation_exponential(float distance, float minDistance, float return (float)ma_powd(ma_clamp(distance, minDistance, maxDistance) / minDistance, -rolloff); } - /* Doppler Effect calculation taken from the OpenAL spec, with two main differences: @@ -51705,7 +50896,6 @@ static float ma_doppler_pitch(ma_vec3f relativePosition, ma_vec3f sourceVelocity return (speedOfSound - dopplerFactor*vls) / (speedOfSound - dopplerFactor*vss); } - static void ma_get_default_channel_map_for_spatializer(ma_channel* pChannelMap, size_t channelMapCap, ma_uint32 channelCount) { /* @@ -51723,7 +50913,6 @@ static void ma_get_default_channel_map_for_spatializer(ma_channel* pChannelMap, } } - MA_API ma_spatializer_listener_config ma_spatializer_listener_config_init(ma_uint32 channelsOut) { ma_spatializer_listener_config config; @@ -51741,7 +50930,6 @@ MA_API ma_spatializer_listener_config ma_spatializer_listener_config_init(ma_uin return config; } - typedef struct { size_t sizeInBytes; @@ -51771,7 +50959,6 @@ static ma_result ma_spatializer_listener_get_heap_layout(const ma_spatializer_li return MA_SUCCESS; } - MA_API ma_result ma_spatializer_listener_get_heap_size(const ma_spatializer_listener_config* pConfig, size_t* pHeapSizeInBytes) { ma_result result; @@ -51824,7 +51011,6 @@ MA_API ma_result ma_spatializer_listener_init_preallocated(const ma_spatializer_ ma_spatializer_listener_set_direction(pListener, negDir.x, negDir.y, negDir.z); } - /* We must always have a valid channel map. */ pListener->config.pChannelMapOut = (ma_channel*)ma_offset_ptr(pHeap, heapLayout.channelMapOutOffset); @@ -52026,9 +51212,6 @@ MA_API ma_bool32 ma_spatializer_listener_is_enabled(const ma_spatializer_listene return pListener->isEnabled; } - - - MA_API ma_spatializer_config ma_spatializer_config_init(ma_uint32 channelsIn, ma_uint32 channelsOut) { ma_spatializer_config config; @@ -52056,7 +51239,6 @@ MA_API ma_spatializer_config ma_spatializer_config_init(ma_uint32 channelsIn, ma return config; } - static ma_gainer_config ma_spatializer_gainer_config_init(const ma_spatializer_config* pConfig) { MA_ASSERT(pConfig != NULL); @@ -52152,7 +51334,6 @@ MA_API ma_result ma_spatializer_get_heap_size(const ma_spatializer_config* pConf return MA_SUCCESS; } - MA_API ma_result ma_spatializer_init_preallocated(const ma_spatializer_config* pConfig, void* pHeap, ma_spatializer* pSpatializer) { ma_result result; @@ -52466,7 +51647,6 @@ MA_API ma_result ma_spatializer_process_pcm_frames(ma_spatializer* pSpatializer, /* The sound is right on top of the listener. Don't do any angular attenuation. */ } - /* Clamp the gain. */ gain = ma_clamp(gain, ma_spatializer_get_min_gain(pSpatializer), ma_spatializer_get_max_gain(pSpatializer)); @@ -52489,7 +51669,6 @@ MA_API ma_result ma_spatializer_process_pcm_frames(ma_spatializer* pSpatializer, ma_silence_pcm_frames(pFramesOut, frameCount, ma_format_f32, pSpatializer->channelsOut); } - /* Panning. This is where we'll apply the gain and convert to the output channel count. We have an optimized path for when we're converting to a mono stream. In that case we don't really need to do any panning - we just apply the @@ -53002,9 +52181,6 @@ MA_API void ma_spatializer_get_relative_position_and_direction(const ma_spatiali } } - - - /************************************************************************************************************************************************************** Resampling @@ -53024,7 +52200,6 @@ MA_API ma_linear_resampler_config ma_linear_resampler_config_init(ma_format form return config; } - typedef struct { size_t sizeInBytes; @@ -53033,7 +52208,6 @@ typedef struct size_t lpfOffset; } ma_linear_resampler_heap_layout; - static void ma_linear_resampler_adjust_timer_for_new_rate(ma_linear_resampler* pResampler, ma_uint32 oldSampleRateOut, ma_uint32 newSampleRateOut) { /* @@ -53103,7 +52277,6 @@ static ma_result ma_linear_resampler_set_rate_internal(ma_linear_resampler* pRes return result; } - pResampler->inAdvanceInt = pResampler->config.sampleRateIn / pResampler->config.sampleRateOut; pResampler->inAdvanceFrac = pResampler->config.sampleRateIn % pResampler->config.sampleRateOut; @@ -53309,7 +52482,6 @@ static void ma_linear_resampler_interpolate_frame_s16(ma_linear_resampler* pResa } } - static void ma_linear_resampler_interpolate_frame_f32(ma_linear_resampler* pResampler, float* MA_RESTRICT pFrameOut) { ma_uint32 c; @@ -53491,7 +52663,6 @@ static ma_result ma_linear_resampler_process_pcm_frames_s16(ma_linear_resampler* } } - static ma_result ma_linear_resampler_process_pcm_frames_f32_downsample(ma_linear_resampler* pResampler, const void* pFramesIn, ma_uint64* pFrameCountIn, void* pFramesOut, ma_uint64* pFrameCountOut) { const float* pFramesInF32; @@ -53655,7 +52826,6 @@ static ma_result ma_linear_resampler_process_pcm_frames_f32(ma_linear_resampler* } } - 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) { if (pResampler == NULL) { @@ -53673,7 +52843,6 @@ MA_API ma_result ma_linear_resampler_process_pcm_frames(ma_linear_resampler* pRe } } - MA_API ma_result ma_linear_resampler_set_rate(ma_linear_resampler* pResampler, ma_uint32 sampleRateIn, ma_uint32 sampleRateOut) { return ma_linear_resampler_set_rate_internal(pResampler, NULL, NULL, sampleRateIn, sampleRateOut, /* isResamplerAlreadyInitialized = */ MA_TRUE); @@ -53829,8 +52998,6 @@ MA_API ma_result ma_linear_resampler_reset(ma_linear_resampler* pResampler) return MA_SUCCESS; } - - /* Linear resampler backend vtable. */ static ma_linear_resampler_config ma_resampling_backend_get_config__linear(const ma_resampler_config* pConfig) { @@ -53943,8 +53110,6 @@ static ma_resampling_backend_vtable g_ma_linear_resampler_vtable = ma_resampling_backend_reset__linear }; - - MA_API ma_resampler_config ma_resampler_config_init(ma_format format, ma_uint32 channels, ma_uint32 sampleRateIn, ma_uint32 sampleRateOut, ma_resample_algorithm algorithm) { ma_resampler_config config; @@ -54427,7 +53592,6 @@ static ma_bool32 ma_is_spatial_channel_position(ma_channel channelPosition) return MA_FALSE; } - static ma_bool32 ma_channel_map_is_passthrough(const ma_channel* pChannelMapIn, ma_uint32 channelsIn, const ma_channel* pChannelMapOut, ma_uint32 channelsOut) { if (channelsOut == channelsIn) { @@ -54479,7 +53643,6 @@ static ma_channel_conversion_path ma_channel_map_get_conversion_path(const ma_ch return ma_channel_conversion_path_weights; } - static ma_result ma_channel_map_build_shuffle_table(const ma_channel* pChannelMapIn, ma_uint32 channelCountIn, const ma_channel* pChannelMapOut, ma_uint32 channelCountOut, ma_uint8* pShuffleTable) { ma_uint32 iChannelIn; @@ -54553,7 +53716,6 @@ static ma_result ma_channel_map_build_shuffle_table(const ma_channel* pChannelMa return MA_SUCCESS; } - static void ma_channel_map_apply_shuffle_table_u8(ma_uint8* pFramesOut, ma_uint32 channelsOut, const ma_uint8* pFramesIn, ma_uint32 channelsIn, ma_uint64 frameCount, const ma_uint8* pShuffleTable) { ma_uint64 iFrame; @@ -54807,7 +53969,6 @@ static ma_result ma_channel_map_apply_mono_in_f32(float* MA_RESTRICT pFramesOut, } } - if (iChannelLeft != (ma_uint32)-1 && iChannelRight != (ma_uint32)-1) { /* We found our stereo channels so we can duplicate the signal across those channels. */ for (iFrame = 0; iFrame < frameCount; iFrame += 1) { @@ -55148,7 +54309,6 @@ static void ma_channel_map_apply_f32(float* pFramesOut, const ma_channel* pChann } } - typedef struct { size_t sizeInBytes; @@ -55877,7 +55037,6 @@ MA_API ma_result ma_channel_converter_get_output_channel_map(const ma_channel_co return MA_SUCCESS; } - /************************************************************************************************************************************************************** Data Conversion @@ -55911,7 +55070,6 @@ MA_API ma_data_converter_config ma_data_converter_config_init(ma_format formatIn return config; } - typedef struct { size_t sizeInBytes; @@ -56097,7 +55255,6 @@ MA_API ma_result ma_data_converter_init_preallocated(const ma_data_converter_con isResamplingRequired = ma_data_converter_config_is_resampler_required(pConfig); midFormat = ma_data_converter_config_get_mid_format(pConfig); - /* Channel converter. We always initialize this, but we check if it configures itself as a passthrough to determine whether or not it's needed. */ { ma_channel_converter_config channelConverterConfig = ma_channel_converter_config_init_from_data_converter_config(pConfig); @@ -56113,7 +55270,6 @@ MA_API ma_result ma_data_converter_init_preallocated(const ma_data_converter_con } } - /* Resampler. */ if (isResamplingRequired) { ma_resampler_config resamplerConfig = ma_resampler_config_init_from_data_converter_config(pConfig); @@ -56126,7 +55282,6 @@ MA_API ma_result ma_data_converter_init_preallocated(const ma_data_converter_con pConverter->hasResampler = MA_TRUE; } - /* We can simplify pre- and post-format conversion if we have neither channel conversion nor resampling. */ if (pConverter->hasChannelConverter == MA_FALSE && pConverter->hasResampler == MA_FALSE) { /* We have neither channel conversion nor resampling so we'll only need one of pre- or post-format conversion, or none if the input and output formats are the same. */ @@ -56157,7 +55312,6 @@ MA_API ma_result ma_data_converter_init_preallocated(const ma_data_converter_con pConverter->isPassthrough = MA_TRUE; } - /* We now need to determine our execution path. */ if (pConverter->isPassthrough) { pConverter->executionPath = ma_data_converter_execution_path_passthrough; @@ -56316,7 +55470,6 @@ static ma_result ma_data_converter_process_pcm_frames__format_only(ma_data_conve return MA_SUCCESS; } - static ma_result ma_data_converter_process_pcm_frames__resample_with_format_conversion(ma_data_converter* pConverter, const void* pFramesIn, ma_uint64* pFrameCountIn, void* pFramesOut, ma_uint64* pFrameCountOut) { ma_result result = MA_SUCCESS; @@ -56686,7 +55839,6 @@ static ma_result ma_data_converter_process_pcm_frames__resample_first(ma_data_co return result; } - /* The input data has been resampled so now we need to run it through the channel converter. The input data is always contained in pTempBufferMid. We only need to do this part if we have an output buffer. @@ -56709,7 +55861,6 @@ static ma_result ma_data_converter_process_pcm_frames__resample_first(ma_data_co } } - framesProcessedIn += frameCountInThisIteration; framesProcessedOut += frameCountOutThisIteration; @@ -56832,7 +55983,6 @@ static ma_result ma_data_converter_process_pcm_frames__channels_first(ma_data_co } #endif - /* Pre format conversion. */ if (pConverter->hasPreFormatConversion) { if (pRunningFramesIn != NULL) { @@ -56845,14 +55995,12 @@ static ma_result ma_data_converter_process_pcm_frames__channels_first(ma_data_co pChannelsBufferIn = pRunningFramesIn; } - /* Channel conversion. */ result = ma_channel_converter_process_pcm_frames(&pConverter->channelConverter, pTempBufferMid, pChannelsBufferIn, frameCountInThisIteration); if (result != MA_SUCCESS) { return result; } - /* Resampling. */ if (pConverter->hasPostFormatConversion) { pResampleBufferOut = pTempBufferOut; @@ -56865,7 +56013,6 @@ static ma_result ma_data_converter_process_pcm_frames__channels_first(ma_data_co return result; } - /* Post format conversion. */ if (pConverter->hasPostFormatConversion) { if (pRunningFramesOut != NULL) { @@ -56873,7 +56020,6 @@ static ma_result ma_data_converter_process_pcm_frames__channels_first(ma_data_co } } - framesProcessedIn += frameCountInThisIteration; framesProcessedOut += frameCountOutThisIteration; @@ -57049,8 +56195,6 @@ MA_API ma_result ma_data_converter_reset(ma_data_converter* pConverter) return ma_resampler_reset(&pConverter->resampler); } - - /************************************************************************************************************************************************************** Channel Maps @@ -57080,7 +56224,6 @@ MA_API void ma_channel_map_init_blank(ma_channel* pChannelMap, ma_uint32 channel MA_ZERO_MEMORY(pChannelMap, sizeof(*pChannelMap) * channels); } - static ma_channel ma_channel_map_init_standard_channel_microsoft(ma_uint32 channelCount, ma_uint32 channelIndex) { if (channelCount == 0 || channelIndex >= channelCount) { @@ -57741,7 +56884,6 @@ static ma_channel ma_channel_map_init_standard_channel_sndio(ma_uint32 channelCo return MA_CHANNEL_NONE; } - static ma_channel ma_channel_map_init_standard_channel(ma_standard_channel_map standardChannelMap, ma_uint32 channelCount, ma_uint32 channelIndex) { if (channelCount == 0 || channelIndex >= channelCount) { @@ -58010,8 +57152,6 @@ MA_API const char* ma_channel_position_to_string(ma_channel channel) return "UNKNOWN"; } - - /************************************************************************************************************************************************************** Conversion Helpers @@ -58072,7 +57212,6 @@ MA_API ma_uint64 ma_convert_frames_ex(void* pOut, ma_uint64 frameCountOut, const return frameCountOut; } - /************************************************************************************************************************************************************** Ring Buffer @@ -58114,7 +57253,6 @@ static MA_INLINE void ma_rb__deconstruct_offset(ma_uint32 encodedOffset, ma_uint *pOffsetLoopFlag = ma_rb__extract_offset_loop_flag(encodedOffset); } - MA_API ma_result ma_rb_init_ex(size_t subbufferSizeInBytes, size_t subbufferCount, size_t subbufferStrideInBytes, void* pOptionalPreallocatedBuffer, const ma_allocation_callbacks* pAllocationCallbacks, ma_rb* pRB) { ma_result result; @@ -58132,7 +57270,6 @@ MA_API ma_result ma_rb_init_ex(size_t subbufferSizeInBytes, size_t subbufferCoun return MA_INVALID_ARGS; /* Maximum buffer size is ~2GB. The most significant bit is a flag for use internally. */ } - MA_ZERO_OBJECT(pRB); result = ma_allocation_callbacks_init_copy(&pRB->allocationCallbacks, pAllocationCallbacks); @@ -58531,8 +57668,6 @@ MA_API void* ma_rb_get_subbuffer_ptr(ma_rb* pRB, size_t subbufferIndex, void* pB return ma_offset_ptr(pBuffer, ma_rb_get_subbuffer_offset(pRB, subbufferIndex)); } - - static ma_result ma_pcm_rb_data_source__on_read(ma_data_source* pDataSource, void* pFramesOut, ma_uint64 frameCount, ma_uint64* pFramesRead) { /* Since there's no notion of an end, we don't ever want to return MA_AT_END here. But it is possible to return 0. */ @@ -58868,8 +58003,6 @@ MA_API void ma_pcm_rb_set_sample_rate(ma_pcm_rb* pRB, ma_uint32 sampleRate) pRB->sampleRate = sampleRate; } - - MA_API ma_result ma_duplex_rb_init(ma_format captureFormat, ma_uint32 captureChannels, ma_uint32 sampleRate, ma_uint32 captureInternalSampleRate, ma_uint32 captureInternalPeriodSizeInFrames, const ma_allocation_callbacks* pAllocationCallbacks, ma_duplex_rb* pRB) { ma_result result; @@ -58897,8 +58030,6 @@ MA_API ma_result ma_duplex_rb_uninit(ma_duplex_rb* pRB) return MA_SUCCESS; } - - /************************************************************************************************************************************************************** Miscellaneous Helpers @@ -59085,7 +58216,6 @@ MA_API void ma_blend_f32(float* pOut, float* pInA, float* pInB, float factor, ma } } - MA_API ma_uint32 ma_get_bytes_per_sample(ma_format format) { ma_uint32 sizes[] = { @@ -59099,8 +58229,6 @@ MA_API ma_uint32 ma_get_bytes_per_sample(ma_format format) return sizes[format]; } - - #define MA_DATA_SOURCE_DEFAULT_RANGE_BEG 0 #define MA_DATA_SOURCE_DEFAULT_RANGE_END ~((ma_uint64)0) #define MA_DATA_SOURCE_DEFAULT_LOOP_POINT_BEG 0 @@ -59115,7 +58243,6 @@ MA_API ma_data_source_config ma_data_source_config_init(void) return config; } - MA_API ma_result ma_data_source_init(const ma_data_source_config* pConfig, ma_data_source* pDataSource) { ma_data_source_base* pDataSourceBase = (ma_data_source_base*)pDataSource; @@ -59790,7 +58917,6 @@ MA_API ma_result ma_data_source_set_range_in_pcm_frames(ma_data_source* pDataSou pDataSourceBase->loopBegInFrames = 0; pDataSourceBase->loopEndInFrames = ~((ma_uint64)0); - /* Seek to within range. Note that our seek positions here are relative to the new range. We don't want to do this if we failed to retrieve the cursor earlier on because it probably means the data source @@ -59955,7 +59081,6 @@ MA_API ma_data_source_get_next_proc ma_data_source_get_next_callback(const ma_da return pDataSourceBase->onGetNext; } - static ma_result ma_audio_buffer_ref__data_source_on_read(ma_data_source* pDataSource, void* pFramesOut, ma_uint64 frameCount, ma_uint64* pFramesRead) { ma_audio_buffer_ref* pAudioBufferRef = (ma_audio_buffer_ref*)pDataSource; @@ -60242,9 +59367,6 @@ MA_API ma_result ma_audio_buffer_ref_get_available_frames(const ma_audio_buffer_ return MA_SUCCESS; } - - - MA_API ma_audio_buffer_config ma_audio_buffer_config_init(ma_format format, ma_uint32 channels, ma_uint64 sizeInFrames, const void* pData, const ma_allocation_callbacks* pAllocationCallbacks) { ma_audio_buffer_config config; @@ -60490,10 +59612,6 @@ MA_API ma_result ma_audio_buffer_get_available_frames(const ma_audio_buffer* pAu return ma_audio_buffer_ref_get_available_frames(&pAudioBuffer->ref, pAvailableFrames); } - - - - MA_API ma_result ma_paged_audio_buffer_data_init(ma_format format, ma_uint32 channels, ma_paged_audio_buffer_data* pData) { if (pData == NULL) { @@ -60652,7 +59770,6 @@ MA_API ma_result ma_paged_audio_buffer_data_allocate_and_append_page(ma_paged_au return ma_paged_audio_buffer_data_append_page(pData, pPage); /* <-- Should never fail. */ } - MA_API ma_paged_audio_buffer_config ma_paged_audio_buffer_config_init(ma_paged_audio_buffer_data* pData) { ma_paged_audio_buffer_config config; @@ -60663,7 +59780,6 @@ MA_API ma_paged_audio_buffer_config ma_paged_audio_buffer_config_init(ma_paged_a return config; } - static ma_result ma_paged_audio_buffer__data_source_on_read(ma_data_source* pDataSource, void* pFramesOut, ma_uint64 frameCount, ma_uint64* pFramesRead) { return ma_paged_audio_buffer_read_pcm_frames((ma_paged_audio_buffer*)pDataSource, pFramesOut, frameCount, pFramesRead); @@ -60876,8 +59992,6 @@ MA_API ma_result ma_paged_audio_buffer_get_length_in_pcm_frames(ma_paged_audio_b return ma_paged_audio_buffer_data_get_length_in_pcm_frames(pPagedAudioBuffer->pData, pLength); } - - /************************************************************************************************************************************************************** VFS @@ -61047,7 +60161,6 @@ MA_API ma_result ma_vfs_info(ma_vfs* pVFS, ma_vfs_file file, ma_file_info* pInfo return pCallbacks->onInfo(pVFS, file, pInfo); } - #if !defined(MA_USE_WIN32_FILEIO) && (defined(MA_WIN32) && (defined(MA_WIN32_DESKTOP) || defined(MA_WIN32_NXDK)) && !defined(MA_NO_WIN32_FILEIO) && !defined(MA_POSIX)) #define MA_USE_WIN32_FILEIO #endif @@ -61166,7 +60279,6 @@ static ma_result ma_default_vfs_close__win32(ma_vfs* pVFS, ma_vfs_file file) return MA_SUCCESS; } - static ma_result ma_default_vfs_read__win32(ma_vfs* pVFS, ma_vfs_file file, void* pDst, size_t sizeInBytes, size_t* pBytesRead) { ma_result result = MA_SUCCESS; @@ -61250,7 +60362,6 @@ static ma_result ma_default_vfs_write__win32(ma_vfs* pVFS, ma_vfs_file file, con return result; } - static ma_result ma_default_vfs_seek__win32(ma_vfs* pVFS, ma_vfs_file file, ma_int64 offset, ma_seek_origin origin) { LARGE_INTEGER liDistanceToMove; @@ -61562,7 +60673,6 @@ static ma_result ma_default_vfs_info__stdio(ma_vfs* pVFS, ma_vfs_file file, ma_f } #endif - static ma_result ma_default_vfs_open(ma_vfs* pVFS, const char* pFilePath, ma_uint32 openMode, ma_vfs_file* pFile) { if (pFile == NULL) { @@ -61733,7 +60843,6 @@ static ma_result ma_default_vfs_info(ma_vfs* pVFS, ma_vfs_file file, ma_file_inf return result; } - MA_API ma_result ma_default_vfs_init(ma_default_vfs* pVFS, const ma_allocation_callbacks* pAllocationCallbacks) { if (pVFS == NULL) { @@ -61753,7 +60862,6 @@ MA_API ma_result ma_default_vfs_init(ma_default_vfs* pVFS, const ma_allocation_c return MA_SUCCESS; } - MA_API ma_result ma_vfs_or_default_open(ma_vfs* pVFS, const char* pFilePath, ma_uint32 openMode, ma_vfs_file* pFile) { if (pVFS != NULL) { @@ -61826,8 +60934,6 @@ MA_API ma_result ma_vfs_or_default_info(ma_vfs* pVFS, ma_vfs_file file, ma_file_ } } - - static ma_result ma_vfs_open_and_read_file_ex(ma_vfs* pVFS, const char* pFilePath, const wchar_t* pFilePathW, void** ppData, size_t* pSize, const ma_allocation_callbacks* pAllocationCallbacks) { ma_result result; @@ -61901,8 +61007,6 @@ MA_API ma_result ma_vfs_open_and_read_file_w(ma_vfs* pVFS, const wchar_t* pFileP return ma_vfs_open_and_read_file_ex(pVFS, NULL, pFilePath, ppData, pSize, pAllocationCallbacks); } - - /************************************************************************************************************************************************************** Decoding and Encoding Headers. These are auto-generated from a tool. @@ -62811,7 +61915,6 @@ MA_API void ma_dr_mp3_free(void* p, const ma_allocation_callbacks* pAllocationCa /* dr_mp3_h end */ #endif /* MA_NO_MP3 */ - /************************************************************************************************************************************************************** Decoding @@ -62844,7 +61947,6 @@ static ma_result ma_decoder_tell_bytes(ma_decoder* pDecoder, ma_int64* pCursor) return pDecoder->onTell(pDecoder, pCursor); } - MA_API ma_decoding_backend_config ma_decoding_backend_config_init(ma_format preferredFormat, ma_uint32 seekPointCount) { ma_decoding_backend_config config; @@ -62856,7 +61958,6 @@ MA_API ma_decoding_backend_config ma_decoding_backend_config_init(ma_format pref return config; } - MA_API ma_decoder_config ma_decoder_config_init(ma_format outputFormat, ma_uint32 outputChannels, ma_uint32 outputSampleRate) { ma_decoder_config config; @@ -62906,7 +62007,6 @@ static ma_result ma_decoder__init_data_converter(ma_decoder* pDecoder, const ma_ return result; /* Failed to retrieve the internal data format. */ } - /* Make sure we're not asking for too many channels. */ if (pConfig->channels > MA_MAX_CHANNELS) { return MA_INVALID_ARGS; @@ -62917,7 +62017,6 @@ static ma_result ma_decoder__init_data_converter(ma_decoder* pDecoder, const ma_ return MA_INVALID_ARGS; } - /* Output format. */ if (pConfig->format == ma_format_unknown) { pDecoder->outputFormat = internalFormat; @@ -62990,8 +62089,6 @@ static ma_result ma_decoder__init_data_converter(ma_decoder* pDecoder, const ma_ return MA_SUCCESS; } - - static ma_result ma_decoder_internal_on_read__custom(void* pUserData, void* pBufferOut, size_t bytesToRead, size_t* pBytesRead) { ma_decoder* pDecoder = (ma_decoder*)pUserData; @@ -63016,7 +62113,6 @@ static ma_result ma_decoder_internal_on_tell__custom(void* pUserData, ma_int64* return ma_decoder_tell_bytes(pDecoder, pCursor); } - static ma_result ma_decoder_init_from_vtable__internal(const ma_decoding_backend_vtable* pVTable, void* pVTableUserData, const ma_decoder_config* pConfig, ma_decoder* pDecoder) { ma_result result; @@ -63133,8 +62229,6 @@ static ma_result ma_decoder_init_from_memory__internal(const ma_decoding_backend return MA_SUCCESS; } - - static ma_result ma_decoder_init_custom__internal(const ma_decoder_config* pConfig, ma_decoder* pDecoder) { ma_result result = MA_NO_BACKEND; @@ -63257,7 +62351,6 @@ static ma_result ma_decoder_init_custom_from_memory__internal(const void* pData, return MA_NO_BACKEND; } - /* WAV */ #ifdef ma_dr_wav_h @@ -63285,7 +62378,6 @@ MA_API ma_result ma_wav_get_data_format(ma_wav* pWav, ma_format* pFormat, ma_uin MA_API ma_result ma_wav_get_cursor_in_pcm_frames(ma_wav* pWav, ma_uint64* pCursor); MA_API ma_result ma_wav_get_length_in_pcm_frames(ma_wav* pWav, ma_uint64* pLength); - static ma_result ma_wav_ds_read(ma_data_source* pDataSource, void* pFramesOut, ma_uint64 frameCount, ma_uint64* pFramesRead) { return ma_wav_read_pcm_frames((ma_wav*)pDataSource, pFramesOut, frameCount, pFramesRead); @@ -63322,7 +62414,6 @@ static ma_data_source_vtable g_ma_wav_ds_vtable = 0 }; - #if !defined(MA_NO_WAV) static size_t ma_wav_dr_callback__read(void* pUserData, void* pBufferOut, size_t bytesToRead) { @@ -63826,7 +62917,6 @@ MA_API ma_result ma_wav_get_length_in_pcm_frames(ma_wav* pWav, ma_uint64* pLengt #endif } - static ma_result ma_decoding_backend_init__wav(void* pUserData, ma_read_proc onRead, ma_seek_proc onSeek, ma_tell_proc onTell, void* pReadSeekTellUserData, const ma_decoding_backend_config* pConfig, const ma_allocation_callbacks* pAllocationCallbacks, ma_data_source** ppBackend) { ma_result result; @@ -63990,7 +63080,6 @@ MA_API ma_result ma_flac_get_data_format(ma_flac* pFlac, ma_format* pFormat, ma_ MA_API ma_result ma_flac_get_cursor_in_pcm_frames(ma_flac* pFlac, ma_uint64* pCursor); MA_API ma_result ma_flac_get_length_in_pcm_frames(ma_flac* pFlac, ma_uint64* pLength); - static ma_result ma_flac_ds_read(ma_data_source* pDataSource, void* pFramesOut, ma_uint64 frameCount, ma_uint64* pFramesRead) { return ma_flac_read_pcm_frames((ma_flac*)pDataSource, pFramesOut, frameCount, pFramesRead); @@ -64027,7 +63116,6 @@ static ma_data_source_vtable g_ma_flac_ds_vtable = 0 }; - #if !defined(MA_NO_FLAC) static size_t ma_flac_dr_callback__read(void* pUserData, void* pBufferOut, size_t bytesToRead) { @@ -64469,7 +63557,6 @@ MA_API ma_result ma_flac_get_length_in_pcm_frames(ma_flac* pFlac, ma_uint64* pLe #endif } - static ma_result ma_decoding_backend_init__flac(void* pUserData, ma_read_proc onRead, ma_seek_proc onSeek, ma_tell_proc onTell, void* pReadSeekTellUserData, const ma_decoding_backend_config* pConfig, const ma_allocation_callbacks* pAllocationCallbacks, ma_data_source** ppBackend) { ma_result result; @@ -64635,7 +63722,6 @@ MA_API ma_result ma_mp3_get_data_format(ma_mp3* pMP3, ma_format* pFormat, ma_uin MA_API ma_result ma_mp3_get_cursor_in_pcm_frames(ma_mp3* pMP3, ma_uint64* pCursor); MA_API ma_result ma_mp3_get_length_in_pcm_frames(ma_mp3* pMP3, ma_uint64* pLength); - static ma_result ma_mp3_ds_read(ma_data_source* pDataSource, void* pFramesOut, ma_uint64 frameCount, ma_uint64* pFramesRead) { return ma_mp3_read_pcm_frames((ma_mp3*)pDataSource, pFramesOut, frameCount, pFramesRead); @@ -64672,7 +63758,6 @@ static ma_data_source_vtable g_ma_mp3_ds_vtable = 0 }; - #if !defined(MA_NO_MP3) static size_t ma_mp3_dr_callback__read(void* pUserData, void* pBufferOut, size_t bytesToRead) { @@ -65166,7 +64251,6 @@ MA_API ma_result ma_mp3_get_length_in_pcm_frames(ma_mp3* pMP3, ma_uint64* pLengt #endif } - static ma_result ma_decoding_backend_init__mp3(void* pUserData, ma_read_proc onRead, ma_seek_proc onSeek, ma_tell_proc onTell, void* pReadSeekTellUserData, const ma_decoding_backend_config* pConfig, const ma_allocation_callbacks* pAllocationCallbacks, ma_data_source** ppBackend) { ma_result result; @@ -65348,7 +64432,6 @@ MA_API ma_result ma_stbvorbis_get_data_format(ma_stbvorbis* pVorbis, ma_format* MA_API ma_result ma_stbvorbis_get_cursor_in_pcm_frames(ma_stbvorbis* pVorbis, ma_uint64* pCursor); MA_API ma_result ma_stbvorbis_get_length_in_pcm_frames(ma_stbvorbis* pVorbis, ma_uint64* pLength); - static ma_result ma_stbvorbis_ds_read(ma_data_source* pDataSource, void* pFramesOut, ma_uint64 frameCount, ma_uint64* pFramesRead) { return ma_stbvorbis_read_pcm_frames((ma_stbvorbis*)pDataSource, pFramesOut, frameCount, pFramesRead); @@ -65385,7 +64468,6 @@ static ma_data_source_vtable g_ma_stbvorbis_ds_vtable = 0 }; - static ma_result ma_stbvorbis_init_internal(const ma_decoding_backend_config* pConfig, ma_stbvorbis* pVorbis) { ma_result result; @@ -66022,7 +65104,6 @@ MA_API ma_result ma_stbvorbis_get_length_in_pcm_frames(ma_stbvorbis* pVorbis, ma #endif } - static ma_result ma_decoding_backend_init__stbvorbis(void* pUserData, ma_read_proc onRead, ma_seek_proc onSeek, ma_tell_proc onTell, void* pReadSeekTellUserData, const ma_decoding_backend_config* pConfig, const ma_allocation_callbacks* pAllocationCallbacks, ma_data_source** ppBackend) { ma_result result; @@ -66135,8 +65216,6 @@ static ma_result ma_decoder_init_vorbis_from_memory__internal(const void* pData, } #endif /* STB_VORBIS_INCLUDE_STB_VORBIS_H */ - - static ma_result ma_decoder__init_allocation_callbacks(const ma_decoder_config* pConfig, ma_decoder* pDecoder) { MA_ASSERT(pDecoder != NULL); @@ -66235,7 +65314,6 @@ static ma_result ma_decoder__postinit(const ma_decoder_config* pConfig, ma_decod return result; } - static ma_result ma_decoder_init__internal(ma_decoder_read_proc onRead, ma_decoder_seek_proc onSeek, void* pUserData, const ma_decoder_config* pConfig, ma_decoder* pDecoder) { ma_result result = MA_NO_BACKEND; @@ -66248,7 +65326,6 @@ static ma_result ma_decoder_init__internal(ma_decoder_read_proc onRead, ma_decod (void)onSeek; (void)pUserData; - /* If we've specified a specific encoding type, try that first. */ if (pConfig->encodingFormat != ma_encoding_format_unknown) { #ifdef MA_HAS_WAV @@ -66354,7 +65431,6 @@ MA_API ma_result ma_decoder_init(ma_decoder_read_proc onRead, ma_decoder_seek_pr return ma_decoder_init__internal(onRead, onSeek, pUserData, &config, pDecoder); } - static ma_result ma_decoder__on_read_memory(ma_decoder* pDecoder, void* pBufferOut, size_t bytesToRead, size_t* pBytesRead) { size_t bytesRemaining; @@ -66569,7 +65645,6 @@ MA_API ma_result ma_decoder_init_memory(const void* pData, size_t dataSize, cons return MA_SUCCESS; } - #if defined(MA_HAS_WAV) || \ defined(MA_HAS_MP3) || \ defined(MA_HAS_FLAC) || \ @@ -66632,7 +65707,6 @@ static const wchar_t* ma_path_file_name_w(const wchar_t* path) return fileName; } - static const char* ma_path_extension(const char* path) { const char* extension; @@ -66683,7 +65757,6 @@ static const wchar_t* ma_path_extension_w(const wchar_t* path) return (lastOccurance != NULL) ? lastOccurance : extension; } - static ma_bool32 ma_path_extension_equal(const char* path, const char* extension) { const char* ext1; @@ -66754,8 +65827,6 @@ static ma_bool32 ma_path_extension_equal_w(const wchar_t* path, const wchar_t* e } #endif /* MA_HAS_PATH_API */ - - static ma_result ma_decoder__on_read_vfs(ma_decoder* pDecoder, void* pBufferOut, size_t bytesToRead, size_t* pBytesRead) { MA_ASSERT(pDecoder != NULL); @@ -66908,7 +65979,6 @@ MA_API ma_result ma_decoder_init_vfs(ma_vfs* pVFS, const char* pFilePath, const return MA_SUCCESS; } - static ma_result ma_decoder__preinit_vfs_w(ma_vfs* pVFS, const wchar_t* pFilePath, const ma_decoder_config* pConfig, ma_decoder* pDecoder) { ma_result result; @@ -67036,7 +66106,6 @@ MA_API ma_result ma_decoder_init_vfs_w(ma_vfs* pVFS, const wchar_t* pFilePath, c return MA_SUCCESS; } - static ma_result ma_decoder__preinit_file(const char* pFilePath, const ma_decoder_config* pConfig, ma_decoder* pDecoder) { ma_result result; @@ -67668,7 +66737,6 @@ MA_API ma_result ma_decoder_get_available_frames(ma_decoder* pDecoder, ma_uint64 return MA_SUCCESS; } - static ma_result ma_decoder__full_decode_and_uninit(ma_decoder* pDecoder, ma_decoder_config* pConfigOut, ma_uint64* pFrameCountOut, void** ppPCMFramesOut) { ma_result result; @@ -67727,7 +66795,6 @@ static ma_result ma_decoder__full_decode_and_uninit(ma_decoder* pDecoder, ma_dec } } - if (pConfigOut != NULL) { pConfigOut->format = pDecoder->outputFormat; pConfigOut->channels = pDecoder->outputChannels; @@ -67806,7 +66873,6 @@ MA_API ma_result ma_decode_memory(const void* pData, size_t dataSize, ma_decoder } #endif /* MA_NO_DECODING */ - #ifndef MA_NO_ENCODING #if defined(MA_HAS_WAV) @@ -68085,7 +67151,6 @@ MA_API ma_result ma_encoder_init(ma_encoder_write_proc onWrite, ma_encoder_seek_ return ma_encoder_init__internal(onWrite, onSeek, pUserData, pEncoder); } - MA_API void ma_encoder_uninit(ma_encoder* pEncoder) { if (pEncoder == NULL) { @@ -68103,7 +67168,6 @@ MA_API void ma_encoder_uninit(ma_encoder* pEncoder) } } - MA_API ma_result ma_encoder_write_pcm_frames(ma_encoder* pEncoder, const void* pFramesIn, ma_uint64 frameCount, ma_uint64* pFramesWritten) { if (pFramesWritten != NULL) { @@ -68118,8 +67182,6 @@ MA_API ma_result ma_encoder_write_pcm_frames(ma_encoder* pEncoder, const void* p } #endif /* MA_NO_ENCODING */ - - /************************************************************************************************************************************************************** Generation @@ -68695,8 +67757,6 @@ MA_API ma_result ma_pulsewave_set_duty_cycle(ma_pulsewave* pWaveform, double dut return MA_SUCCESS; } - - MA_API ma_noise_config ma_noise_config_init(ma_format format, ma_uint32 channels, ma_noise_type type, ma_int32 seed, double amplitude) { ma_noise_config config; @@ -68715,7 +67775,6 @@ MA_API ma_noise_config ma_noise_config_init(ma_format format, ma_uint32 channels return config; } - static ma_result ma_noise__data_source_on_read(ma_data_source* pDataSource, void* pFramesOut, ma_uint64 frameCount, ma_uint64* pFramesRead) { return ma_noise_read_pcm_frames((ma_noise*)pDataSource, pFramesOut, frameCount, pFramesRead); @@ -68752,7 +67811,6 @@ static ma_data_source_vtable g_ma_noise_data_source_vtable = 0 }; - #ifndef MA_PINK_NOISE_BIN_SIZE #define MA_PINK_NOISE_BIN_SIZE 16 #endif @@ -68956,7 +68014,6 @@ MA_API ma_result ma_noise_set_seed(ma_noise* pNoise, ma_int32 seed) return MA_SUCCESS; } - MA_API ma_result ma_noise_set_type(ma_noise* pNoise, ma_noise_type type) { if (pNoise == NULL) { @@ -69047,7 +68104,6 @@ static MA_INLINE ma_uint64 ma_noise_read_pcm_frames__white(ma_noise* pNoise, voi return frameCount; } - static MA_INLINE unsigned int ma_tzcnt32(unsigned int x) { unsigned int n; @@ -69166,7 +68222,6 @@ static MA_INLINE ma_uint64 ma_noise_read_pcm_frames__pink(ma_noise* pNoise, void return frameCount; } - static MA_INLINE float ma_noise_f32_brownian(ma_noise* pNoise, ma_uint32 iChannel) { double result; @@ -69284,8 +68339,6 @@ MA_API ma_result ma_noise_read_pcm_frames(ma_noise* pNoise, void* pFramesOut, ma } #endif /* MA_NO_GENERATION */ - - #ifndef MA_NO_RESOURCE_MANAGER #ifndef MA_RESOURCE_MANAGER_PAGE_SIZE_IN_MILLISECONDS #define MA_RESOURCE_MANAGER_PAGE_SIZE_IN_MILLISECONDS 1000 @@ -69334,8 +68387,6 @@ static void ma_resource_manager_pipeline_notifications_release_all_fences(const if (pPipelineNotifications->done.pFence != NULL) { ma_fence_release(pPipelineNotifications->done.pFence); } } - - #ifndef MA_DEFAULT_HASH_SEED #define MA_DEFAULT_HASH_SEED 42 #endif @@ -69404,7 +68455,6 @@ static ma_uint32 ma_hash_32(const void* key, int len, ma_uint32 seed) h1 = h1*5 + 0xe6546b64; } - tail = (const ma_uint8*)(data + nblocks*4); k1 = 0; @@ -69415,7 +68465,6 @@ static ma_uint32 ma_hash_32(const void* key, int len, ma_uint32 seed) k1 *= c1; k1 = ma_rotl32(k1, 15); k1 *= c2; h1 ^= k1; }; - h1 ^= len; h1 = ma_hash_fmix32(h1); @@ -69437,9 +68486,6 @@ static ma_uint32 ma_hash_string_w_32(const wchar_t* str) return ma_hash_32(str, (int)ma_wcslen(str) * sizeof(*str), MA_DEFAULT_HASH_SEED); } - - - /* Basic BST Functions */ @@ -69684,7 +68730,6 @@ static ma_result ma_resource_manager_data_buffer_node_remove(ma_resource_manager } } - /* The replacement node has essentially been detached from the binary tree, so now we need to replace the old data buffer with it. The first thing to update is the parent */ if (pDataBufferNode->pParent != NULL) { if (pDataBufferNode->pParent->pChildLo == pDataBufferNode) { @@ -69811,7 +68856,6 @@ static ma_result ma_resource_manager_data_buffer_node_result(const ma_resource_m return (ma_result)ma_atomic_load_i32((ma_result*)&pDataBufferNode->result); /* Need a naughty const-cast here. */ } - static ma_bool32 ma_resource_manager_is_threading_enabled(const ma_resource_manager* pResourceManager) { MA_ASSERT(pResourceManager != NULL); @@ -69819,7 +68863,6 @@ static ma_bool32 ma_resource_manager_is_threading_enabled(const ma_resource_mana return (pResourceManager->config.flags & MA_RESOURCE_MANAGER_FLAG_NO_THREADING) == 0; } - typedef struct { union @@ -69877,7 +68920,6 @@ static void ma_resource_manager_inline_notification_wait_and_uninit(ma_resource_ ma_resource_manager_inline_notification_uninit(pNotification); } - static void ma_resource_manager_data_buffer_bst_lock(ma_resource_manager* pResourceManager) { MA_ASSERT(pResourceManager != NULL); @@ -69968,7 +69010,6 @@ MA_API ma_resource_manager_config ma_resource_manager_config_init(void) return config; } - MA_API ma_result ma_resource_manager_init(const ma_resource_manager_config* pConfig, ma_resource_manager* pResourceManager) { ma_result result; @@ -70047,7 +69088,6 @@ MA_API ma_result ma_resource_manager_init(const ma_resource_manager_config* pCon return result; } - /* Custom decoding backends. */ if (pConfig->ppCustomDecodingBackendVTables != NULL && pConfig->customDecodingBackendCount > 0) { size_t sizeInBytes = sizeof(*pResourceManager->config.ppCustomDecodingBackendVTables) * pConfig->customDecodingBackendCount; @@ -70066,8 +69106,6 @@ MA_API ma_result ma_resource_manager_init(const ma_resource_manager_config* pCon pResourceManager->config.pCustomDecodingBackendUserData = pConfig->pCustomDecodingBackendUserData; } - - /* Here is where we initialize our threading stuff. We don't do this if we don't support threading. */ if (ma_resource_manager_is_threading_enabled(pResourceManager)) { #ifndef MA_NO_THREADING @@ -70102,7 +69140,6 @@ MA_API ma_result ma_resource_manager_init(const ma_resource_manager_config* pCon return MA_SUCCESS; } - static void ma_resource_manager_delete_all_data_buffer_nodes(ma_resource_manager* pResourceManager) { MA_ASSERT(pResourceManager); @@ -70181,8 +69218,6 @@ MA_API ma_log* ma_resource_manager_get_log(ma_resource_manager* pResourceManager return pResourceManager->config.pLog; } - - MA_API ma_resource_manager_data_source_config ma_resource_manager_data_source_config_init(void) { ma_resource_manager_data_source_config config; @@ -70197,7 +69232,6 @@ MA_API ma_resource_manager_data_source_config ma_resource_manager_data_source_co return config; } - static ma_decoder_config ma_resource_manager__init_decoder_config(ma_resource_manager* pResourceManager) { ma_decoder_config config; @@ -71013,8 +70047,6 @@ stage2: return result; } - - static ma_uint32 ma_resource_manager_data_buffer_next_execution_order(ma_resource_manager_data_buffer* pDataBuffer) { MA_ASSERT(pDataBuffer != NULL); @@ -71671,7 +70703,6 @@ MA_API ma_result ma_resource_manager_register_file_w(ma_resource_manager* pResou return ma_resource_manager_data_buffer_node_acquire(pResourceManager, NULL, pFilePath, 0, flags, NULL, NULL, NULL, NULL); } - static ma_result ma_resource_manager_register_data(ma_resource_manager* pResourceManager, const char* pName, const wchar_t* pNameW, ma_resource_manager_data_supply* pExistingData) { return ma_resource_manager_data_buffer_node_acquire(pResourceManager, pName, pNameW, 0, 0, pExistingData, NULL, NULL, NULL); @@ -71700,7 +70731,6 @@ MA_API ma_result ma_resource_manager_register_decoded_data_w(ma_resource_manager return ma_resource_manager_register_decoded_data_internal(pResourceManager, NULL, pName, pData, frameCount, format, channels, sampleRate); } - static ma_result ma_resource_manager_register_encoded_data_internal(ma_resource_manager* pResourceManager, const char* pName, const wchar_t* pNameW, const void* pData, size_t sizeInBytes) { ma_resource_manager_data_supply data; @@ -71721,7 +70751,6 @@ MA_API ma_result ma_resource_manager_register_encoded_data_w(ma_resource_manager return ma_resource_manager_register_encoded_data_internal(pResourceManager, NULL, pName, pData, sizeInBytes); } - MA_API ma_result ma_resource_manager_unregister_file(ma_resource_manager* pResourceManager, const char* pFilePath) { return ma_resource_manager_unregister_data(pResourceManager, pFilePath); @@ -71742,7 +70771,6 @@ MA_API ma_result ma_resource_manager_unregister_data_w(ma_resource_manager* pRes return ma_resource_manager_data_buffer_node_unacquire(pResourceManager, NULL, NULL, pName); } - static ma_uint32 ma_resource_manager_data_stream_next_execution_order(ma_resource_manager_data_stream* pDataStream) { MA_ASSERT(pDataStream != NULL); @@ -71761,7 +70789,6 @@ static ma_uint32 ma_resource_manager_data_stream_seek_counter(const ma_resource_ return ma_atomic_load_32((ma_uint32*)&pDataStream->seekCounter); } - static ma_result ma_resource_manager_data_stream_cb__read_pcm_frames(ma_data_source* pDataSource, void* pFramesOut, ma_uint64 frameCount, ma_uint64* pFramesRead) { return ma_resource_manager_data_stream_read_pcm_frames((ma_resource_manager_data_stream*)pDataSource, pFramesOut, frameCount, pFramesRead); @@ -72005,7 +71032,6 @@ MA_API ma_result ma_resource_manager_data_stream_uninit(ma_resource_manager_data return MA_SUCCESS; } - static ma_uint32 ma_resource_manager_data_stream_get_page_size_in_frames(ma_resource_manager_data_stream* pDataStream) { MA_ASSERT(pDataStream != NULL); @@ -72069,7 +71095,6 @@ static void ma_resource_manager_data_stream_fill_pages(ma_resource_manager_data_ } } - static ma_result ma_resource_manager_data_stream_map(ma_resource_manager_data_stream* pDataStream, void** ppFramesOut, ma_uint64* pFrameCount) { ma_uint64 framesAvailable; @@ -72188,7 +71213,6 @@ static ma_result ma_resource_manager_data_stream_unmap(ma_resource_manager_data_ } } - MA_API ma_result ma_resource_manager_data_stream_read_pcm_frames(ma_resource_manager_data_stream* pDataStream, void* pFramesOut, ma_uint64 frameCount, ma_uint64* pFramesRead) { ma_result result = MA_SUCCESS; @@ -72284,7 +71308,6 @@ MA_API ma_result ma_resource_manager_data_stream_seek_to_pcm_frame(ma_resource_m } } - /* Increment the seek counter first to indicate to read_paged_pcm_frames() and map_paged_pcm_frames() that we are in the middle of a seek and MA_BUSY should be returned. */ ma_atomic_fetch_add_32(&pDataStream->seekCounter, 1); @@ -72474,7 +71497,6 @@ MA_API ma_result ma_resource_manager_data_stream_get_available_frames(ma_resourc return MA_SUCCESS; } - static ma_result ma_resource_manager_data_source_preinit(ma_resource_manager* pResourceManager, const ma_resource_manager_data_source_config* pConfig, ma_resource_manager_data_source* pDataSource) { if (pDataSource == NULL) { @@ -72733,7 +71755,6 @@ MA_API ma_result ma_resource_manager_data_source_get_available_frames(ma_resourc } } - MA_API ma_result ma_resource_manager_post_job(ma_resource_manager* pResourceManager, const ma_job* pJob) { if (pResourceManager == NULL) { @@ -72758,7 +71779,6 @@ MA_API ma_result ma_resource_manager_next_job(ma_resource_manager* pResourceMana return ma_job_queue_next(&pResourceManager->jobQueue, pJob); } - static ma_result ma_job_process__resource_manager__load_data_buffer_node(ma_job* pJob) { ma_result result = MA_SUCCESS; @@ -72873,7 +71893,6 @@ static ma_result ma_job_process__resource_manager__load_data_buffer_node(ma_job* result = ma_resource_manager_data_buffer_node_init_supply_encoded(pResourceManager, pDataBufferNode, pJob->data.resourceManager.loadDataBufferNode.pFilePath, pJob->data.resourceManager.loadDataBufferNode.pFilePathW); } - done: /* File paths are no longer needed. */ ma_free(pJob->data.resourceManager.loadDataBufferNode.pFilePath, &pResourceManager->config.allocationCallbacks); @@ -73024,7 +72043,6 @@ done: return result; } - static ma_result ma_job_process__resource_manager__load_data_buffer(ma_job* pJob) { ma_result result = MA_SUCCESS; @@ -73402,7 +72420,6 @@ static ma_result ma_job_process__resource_manager__page_data_stream(ma_job* pJob static ma_result ma_job_process__resource_manager__seek_data_stream(ma_job* pJob) { return ma_job_process__noop(pJob); } #endif /* MA_NO_RESOURCE_MANAGER */ - #ifndef MA_NO_NODE_GRAPH static ma_stack* ma_stack_init(size_t sizeInBytes, const ma_allocation_callbacks* pAllocationCallbacks) @@ -73462,8 +72479,6 @@ static void ma_stack_free(ma_stack* pStack, void* p) pStack->offset -= *pSize + sizeof(size_t); } - - /* 10ms @ 48K = 480. Must never exceed 65535. */ #ifndef MA_DEFAULT_NODE_CACHE_CAP_IN_FRAMES_PER_BUS #define MA_DEFAULT_NODE_CACHE_CAP_IN_FRAMES_PER_BUS 480 @@ -73504,8 +72519,6 @@ MA_API void ma_debug_fill_pcm_frames_with_sine_wave(float* pFramesOut, ma_uint32 #endif } - - MA_API ma_node_graph_config ma_node_graph_config_init(ma_uint32 channels) { ma_node_graph_config config; @@ -73517,7 +72530,6 @@ MA_API ma_node_graph_config ma_node_graph_config_init(ma_uint32 channels) return config; } - static void ma_node_graph_set_is_reading(ma_node_graph* pNodeGraph, ma_bool32 isReading) { MA_ASSERT(pNodeGraph != NULL); @@ -73532,7 +72544,6 @@ static ma_bool32 ma_node_graph_is_reading(ma_node_graph* pNodeGraph) } #endif - static void ma_node_graph_node_process_pcm_frames(ma_node* pNode, const float** ppFramesIn, ma_uint32* pFrameCountIn, float** ppFramesOut, ma_uint32* pFrameCountOut) { ma_node_graph* pNodeGraph = (ma_node_graph*)pNode; @@ -73611,7 +72622,6 @@ MA_API ma_result ma_node_graph_init(const ma_node_graph_config* pConfig, const m return result; } - /* Endpoint. */ endpointConfig = ma_node_config_init(); endpointConfig.vtable = &g_node_graph_endpoint_vtable; @@ -73624,7 +72634,6 @@ MA_API ma_result ma_node_graph_init(const ma_node_graph_config* pConfig, const m return result; } - /* Processing cache. */ if (pConfig->processingSizeInFrames > 0) { pNodeGraph->pProcessingCache = (float*)ma_malloc(pConfig->processingSizeInFrames * pConfig->channels * sizeof(float), pAllocationCallbacks); @@ -73635,7 +72644,6 @@ MA_API ma_result ma_node_graph_init(const ma_node_graph_config* pConfig, const m } } - /* We need a pre-mix stack. The size of this stack is configurable via the config. The default value depends on the channel count. */ @@ -73657,7 +72665,6 @@ MA_API ma_result ma_node_graph_init(const ma_node_graph_config* pConfig, const m } } - return MA_SUCCESS; } @@ -73706,7 +72713,6 @@ MA_API ma_result ma_node_graph_read_pcm_frames(ma_node_graph* pNodeGraph, void* channels = ma_node_get_output_channels(&pNodeGraph->endpoint, 0); - /* We'll be nice and try to do a full read of all frameCount frames. */ totalFramesRead = 0; while (totalFramesRead < frameCount) { @@ -73828,7 +72834,6 @@ MA_API ma_uint32 ma_node_graph_get_processing_size_in_frames(const ma_node_graph return pNodeGraph->processingSizeInFrames; } - #define MA_NODE_OUTPUT_BUS_FLAG_HAS_READ 0x01 /* Whether or not this bus ready to read more data. Only used on nodes with multiple output buses. */ static ma_result ma_node_output_bus_init(ma_node* pNode, ma_uint32 outputBusIndex, ma_uint32 channels, ma_node_output_bus* pOutputBus) @@ -73863,13 +72868,11 @@ static void ma_node_output_bus_unlock(ma_node_output_bus* pOutputBus) ma_spinlock_unlock(&pOutputBus->lock); } - static ma_uint32 ma_node_output_bus_get_channels(const ma_node_output_bus* pOutputBus) { return pOutputBus->channels; } - static void ma_node_output_bus_set_has_read(ma_node_output_bus* pOutputBus, ma_bool32 hasRead) { if (hasRead) { @@ -73884,7 +72887,6 @@ static ma_bool32 ma_node_output_bus_has_read(ma_node_output_bus* pOutputBus) return (ma_atomic_load_32(&pOutputBus->flags) & MA_NODE_OUTPUT_BUS_FLAG_HAS_READ) != 0; } - static void ma_node_output_bus_set_is_attached(ma_node_output_bus* pOutputBus, ma_bool32 isAttached) { ma_atomic_exchange_32(&pOutputBus->isAttached, isAttached); @@ -73895,7 +72897,6 @@ static ma_bool32 ma_node_output_bus_is_attached(ma_node_output_bus* pOutputBus) return ma_atomic_load_32(&pOutputBus->isAttached); } - static ma_result ma_node_output_bus_set_volume(ma_node_output_bus* pOutputBus, float volume) { MA_ASSERT(pOutputBus != NULL); @@ -73914,7 +72915,6 @@ static float ma_node_output_bus_get_volume(const ma_node_output_bus* pOutputBus) return ma_atomic_load_f32((float*)&pOutputBus->volume); } - static ma_result ma_node_input_bus_init(ma_uint32 channels, ma_node_input_bus* pInputBus) { MA_ASSERT(pInputBus != NULL); @@ -73945,7 +72945,6 @@ static void ma_node_input_bus_unlock(ma_node_input_bus* pInputBus) ma_spinlock_unlock(&pInputBus->lock); } - static void ma_node_input_bus_next_begin(ma_node_input_bus* pInputBus) { ma_atomic_fetch_add_32(&pInputBus->nextCounter, 1); @@ -73961,13 +72960,11 @@ static ma_uint32 ma_node_input_bus_get_next_counter(ma_node_input_bus* pInputBus return ma_atomic_load_32(&pInputBus->nextCounter); } - static ma_uint32 ma_node_input_bus_get_channels(const ma_node_input_bus* pInputBus) { return pInputBus->channels; } - static void ma_node_input_bus_detach__no_output_bus_lock(ma_node_input_bus* pInputBus, ma_node_output_bus* pOutputBus) { MA_ASSERT(pInputBus != NULL); @@ -74011,7 +73008,6 @@ static void ma_node_input_bus_detach__no_output_bus_lock(ma_node_input_bus* pInp pOutputBus->pInputNode = NULL; pOutputBus->inputNodeInputBusIndex = 0; - /* For thread-safety reasons, we don't want to be returning from this straight away. We need to wait for the audio thread to finish with the output bus. There's two things we need to wait @@ -74162,8 +73158,6 @@ static ma_node_output_bus* ma_node_input_bus_first(ma_node_input_bus* pInputBus) return ma_node_input_bus_next(pInputBus, &pInputBus->head); } - - static ma_result ma_node_input_bus_read_pcm_frames(ma_node* pInputNode, ma_node_input_bus* pInputBus, float* pFramesOut, ma_uint32 frameCount, ma_uint32* pFramesRead, ma_uint64 globalTime) { ma_result result = MA_SUCCESS; @@ -74300,7 +73294,6 @@ static ma_result ma_node_input_bus_read_pcm_frames(ma_node* pInputNode, ma_node_ return result; } - MA_API ma_node_config ma_node_config_init(void) { ma_node_config config; @@ -74332,8 +73325,6 @@ static ma_uint16 ma_node_config_get_cache_size_in_frames(const ma_node_config* p return (ma_uint16)cacheSizeInFrames; } - - static ma_result ma_node_detach_full(ma_node* pNode); static float* ma_node_get_cached_input_ptr(ma_node* pNode, ma_uint32 inputBusIndex) @@ -74375,7 +73366,6 @@ static float* ma_node_get_cached_output_ptr(ma_node* pNode, ma_uint32 outputBusI return pBasePtr; } - typedef struct { size_t sizeInBytes; @@ -74421,13 +73411,11 @@ static ma_result ma_node_translate_bus_counts(const ma_node_config* pConfig, ma_ return MA_INVALID_ARGS; } - /* We must have channel counts for each bus. */ if ((inputBusCount > 0 && pConfig->pInputChannels == NULL) || (outputBusCount > 0 && pConfig->pOutputChannels == NULL)) { return MA_INVALID_ARGS; /* You must specify channel counts for each input and output bus. */ } - /* Some special rules for passthrough nodes. */ if ((pConfig->vtable->flags & MA_NODE_FLAG_PASSTHROUGH) != 0) { if ((pConfig->vtable->inputBusCount != 0 && pConfig->vtable->inputBusCount != 1) || pConfig->vtable->outputBusCount != 1) { @@ -74439,7 +73427,6 @@ static ma_result ma_node_translate_bus_counts(const ma_node_config* pConfig, ma_ } } - *pInputBusCount = inputBusCount; *pOutputBusCount = outputBusCount; @@ -74523,7 +73510,6 @@ static ma_result ma_node_get_heap_layout(ma_node_graph* pNodeGraph, const ma_nod pHeapLayout->sizeInBytes += ma_align_64(cachedDataSizeInBytes); } - /* Not technically part of the heap, but we can output the input and output bus counts so we can avoid a redundant call to ma_node_translate_bus_counts(). @@ -74607,7 +73593,6 @@ MA_API ma_result ma_node_init_preallocated(ma_node_graph* pNodeGraph, const ma_n pNodeBase->pCachedData = NULL; } - /* We need to run an initialization step for each input and output bus. */ for (iInputBus = 0; iInputBus < ma_node_get_input_bus_count(pNodeBase); iInputBus += 1) { result = ma_node_input_bus_init(pConfig->pInputChannels[iInputBus], &pNodeBase->pInputBuses[iInputBus]); @@ -74623,7 +73608,6 @@ MA_API ma_result ma_node_init_preallocated(ma_node_graph* pNodeGraph, const ma_n } } - /* The cached data needs to be initialized to silence (or a sine wave tone if we're debugging). */ if (pNodeBase->pCachedData != NULL) { ma_uint32 iBus; @@ -74732,7 +73716,6 @@ MA_API ma_uint32 ma_node_get_output_bus_count(const ma_node* pNode) return ((ma_node_base*)pNode)->outputBusCount; } - MA_API ma_uint32 ma_node_get_input_channels(const ma_node* pNode, ma_uint32 inputBusIndex) { const ma_node_base* pNodeBase = (const ma_node_base*)pNode; @@ -74763,7 +73746,6 @@ MA_API ma_uint32 ma_node_get_output_channels(const ma_node* pNode, ma_uint32 out return ma_node_output_bus_get_channels(&pNodeBase->pOutputBuses[outputBusIndex]); } - static ma_result ma_node_detach_full(ma_node* pNode) { ma_node_base* pNodeBase = (ma_node_base*)pNode; @@ -75019,8 +74001,6 @@ MA_API ma_result ma_node_set_time(ma_node* pNode, ma_uint64 localTime) return MA_SUCCESS; } - - static void ma_node_process_pcm_frames_internal(ma_node* pNode, const float** ppFramesIn, ma_uint32* pFrameCountIn, float** ppFramesOut, ma_uint32* pFrameCountOut) { ma_node_base* pNodeBase = (ma_node_base*)pNode; @@ -75117,7 +74097,6 @@ static ma_result ma_node_read_pcm_frames(ma_node* pNode, ma_uint32 outputBusInde frameCount -= timeOffsetEnd; } - /* We run on different paths depending on the bus counts. */ inputBusCount = ma_node_get_input_bus_count(pNode); outputBusCount = ma_node_get_output_bus_count(pNode); @@ -75215,7 +74194,6 @@ static ma_result ma_node_read_pcm_frames(ma_node* pNode, ma_uint32 outputBusInde framesToProcessIn = pNodeBase->cachedDataCapInFramesPerBus; } - MA_ASSERT(framesToProcessIn <= 0xFFFF); MA_ASSERT(framesToProcessOut <= 0xFFFF); @@ -75291,7 +74269,6 @@ static ma_result ma_node_read_pcm_frames(ma_node* pNode, ma_uint32 outputBusInde ppFramesOut[outputBusIndex] = ma_offset_pcm_frames_ptr_f32(pFramesOut, pNodeBase->cachedFrameCountOut, ma_node_get_output_channels(pNode, outputBusIndex)); } - /* Give the processing function the entire capacity of the output buffer. */ frameCountOut = (framesToProcessOut - pNodeBase->cachedFrameCountOut); @@ -75405,9 +74382,6 @@ static ma_result ma_node_read_pcm_frames(ma_node* pNode, ma_uint32 outputBusInde return result; } - - - /* Data source node. */ MA_API ma_data_source_node_config ma_data_source_node_config_init(ma_data_source* pDataSource) { @@ -75420,7 +74394,6 @@ MA_API ma_data_source_node_config ma_data_source_node_config_init(ma_data_source return config; } - static void ma_data_source_node_process_pcm_frames(ma_node* pNode, const float** ppFramesIn, ma_uint32* pFrameCountIn, float** ppFramesOut, ma_uint32* pFrameCountOut) { ma_data_source_node* pDataSourceNode = (ma_data_source_node*)pNode; @@ -75540,8 +74513,6 @@ MA_API ma_bool32 ma_data_source_node_is_looping(ma_data_source_node* pDataSource return ma_data_source_is_looping(pDataSourceNode->pDataSource); } - - /* Splitter Node. */ MA_API ma_splitter_node_config ma_splitter_node_config_init(ma_uint32 channels) { @@ -75555,7 +74526,6 @@ MA_API ma_splitter_node_config ma_splitter_node_config_init(ma_uint32 channels) return config; } - static void ma_splitter_node_process_pcm_frames(ma_node* pNode, const float** ppFramesIn, ma_uint32* pFrameCountIn, float** ppFramesOut, ma_uint32* pFrameCountOut) { ma_node_base* pNodeBase = (ma_node_base*)pNode; @@ -75633,7 +74603,6 @@ MA_API void ma_splitter_node_uninit(ma_splitter_node* pSplitterNode, const ma_al ma_node_uninit(pSplitterNode, pAllocationCallbacks); } - /* Biquad Node */ @@ -75724,8 +74693,6 @@ MA_API void ma_biquad_node_uninit(ma_biquad_node* pNode, const ma_allocation_cal ma_biquad_uninit(&pLPFNode->biquad, pAllocationCallbacks); } - - /* Low Pass Filter Node */ @@ -75818,8 +74785,6 @@ MA_API void ma_lpf_node_uninit(ma_lpf_node* pNode, const ma_allocation_callbacks ma_lpf_uninit(&pLPFNode->lpf, pAllocationCallbacks); } - - /* High Pass Filter Node */ @@ -75912,9 +74877,6 @@ MA_API void ma_hpf_node_uninit(ma_hpf_node* pNode, const ma_allocation_callbacks ma_hpf_uninit(&pHPFNode->hpf, pAllocationCallbacks); } - - - /* Band Pass Filter Node */ @@ -76007,8 +74969,6 @@ MA_API void ma_bpf_node_uninit(ma_bpf_node* pNode, const ma_allocation_callbacks ma_bpf_uninit(&pBPFNode->bpf, pAllocationCallbacks); } - - /* Notching Filter Node */ @@ -76101,8 +75061,6 @@ MA_API void ma_notch_node_uninit(ma_notch_node* pNode, const ma_allocation_callb ma_notch2_uninit(&pNotchNode->notch, pAllocationCallbacks); } - - /* Peaking Filter Node */ @@ -76196,8 +75154,6 @@ MA_API void ma_peak_node_uninit(ma_peak_node* pNode, const ma_allocation_callbac ma_peak2_uninit(&pPeakNode->peak, pAllocationCallbacks); } - - /* Low Shelf Filter Node */ @@ -76290,8 +75246,6 @@ MA_API void ma_loshelf_node_uninit(ma_loshelf_node* pNode, const ma_allocation_c ma_loshelf2_uninit(&pLoshelfNode->loshelf, pAllocationCallbacks); } - - /* High Shelf Filter Node */ @@ -76384,9 +75338,6 @@ MA_API void ma_hishelf_node_uninit(ma_hishelf_node* pNode, const ma_allocation_c ma_hishelf2_uninit(&pHishelfNode->hishelf, pAllocationCallbacks); } - - - MA_API ma_delay_node_config ma_delay_node_config_init(ma_uint32 channels, ma_uint32 sampleRate, ma_uint32 delayInFrames, float decay) { ma_delay_node_config config; @@ -76397,7 +75348,6 @@ MA_API ma_delay_node_config ma_delay_node_config_init(ma_uint32 channels, ma_uin return config; } - static void ma_delay_node_process_pcm_frames(ma_node* pNode, const float** ppFramesIn, ma_uint32* pFrameCountIn, float** ppFramesOut, ma_uint32* pFrameCountOut) { ma_delay_node* pDelayNode = (ma_delay_node*)pNode; @@ -76512,7 +75462,6 @@ MA_API float ma_delay_node_get_decay(const ma_delay_node* pDelayNode) } #endif /* MA_NO_NODE_GRAPH */ - /* SECTION: miniaudio_engine.c */ #if !defined(MA_NO_ENGINE) && !defined(MA_NO_NODE_GRAPH) /************************************************************************************************************************************************************** @@ -76522,7 +75471,6 @@ Engine **************************************************************************************************************************************************************/ #define MA_SEEK_TARGET_NONE (~(ma_uint64)0) - static void ma_sound_set_at_end(ma_sound* pSound, ma_bool32 atEnd) { MA_ASSERT(pSound != NULL); @@ -76550,7 +75498,6 @@ static ma_bool32 ma_sound_get_at_end(const ma_sound* pSound) return ma_atomic_load_32(&pSound->atEnd); } - MA_API ma_engine_node_config ma_engine_node_config_init(ma_engine* pEngine, ma_engine_node_type type, ma_uint32 flags) { ma_engine_node_config config; @@ -76566,7 +75513,6 @@ MA_API ma_engine_node_config ma_engine_node_config_init(ma_engine* pEngine, ma_e return config; } - static void ma_engine_node_update_pitch_if_required(ma_engine_node* pEngineNode) { ma_bool32 isUpdateRequired = MA_FALSE; @@ -76644,7 +75590,6 @@ static ma_result ma_engine_node_get_volume(const ma_engine_node* pEngineNode, fl return MA_SUCCESS; } - static void ma_engine_node_process_pcm_frames__general(ma_engine_node* pEngineNode, const float** ppFramesIn, ma_uint32* pFrameCountIn, float** ppFramesOut, ma_uint32* pFrameCountOut) { ma_uint32 frameCountIn; @@ -77004,7 +75949,6 @@ static void ma_engine_node_process_pcm_frames__group(ma_node* pNode, const float ma_engine_node_process_pcm_frames__general((ma_engine_node*)pNode, ppFramesIn, pFrameCountIn, ppFramesOut, pFrameCountOut); } - static ma_node_vtable g_ma_engine_node_vtable__sound = { ma_engine_node_process_pcm_frames__sound, @@ -77023,8 +75967,6 @@ static ma_node_vtable g_ma_engine_node_vtable__group = MA_NODE_FLAG_DIFFERENT_PROCESSING_RATES /* The engine node does resampling so should let miniaudio know about it. */ }; - - static ma_node_config ma_engine_node_base_node_config_init(const ma_engine_node_config* pConfig) { ma_node_config baseNodeConfig; @@ -77089,7 +76031,6 @@ static ma_result ma_engine_node_get_heap_layout(const ma_engine_node_config* pCo channelsIn = (pConfig->channelsIn != 0) ? pConfig->channelsIn : ma_engine_get_channels(pConfig->pEngine); channelsOut = (pConfig->channelsOut != 0) ? pConfig->channelsOut : ma_engine_get_channels(pConfig->pEngine); - /* Base node. */ baseNodeConfig = ma_engine_node_base_node_config_init(pConfig); baseNodeConfig.pInputChannels = &channelsIn; @@ -77103,7 +76044,6 @@ static ma_result ma_engine_node_get_heap_layout(const ma_engine_node_config* pCo pHeapLayout->baseNodeOffset = pHeapLayout->sizeInBytes; pHeapLayout->sizeInBytes += ma_align_64(tempHeapSize); - /* Resmapler. */ resamplerConfig = pConfig->resampling; resamplerConfig.format = ma_format_f32; @@ -77119,7 +76059,6 @@ static ma_result ma_engine_node_get_heap_layout(const ma_engine_node_config* pCo pHeapLayout->resamplerOffset = pHeapLayout->sizeInBytes; pHeapLayout->sizeInBytes += ma_align_64(tempHeapSize); - /* Spatializer. */ spatializerConfig = ma_engine_node_spatializer_config_init(&baseNodeConfig); @@ -77135,7 +76074,6 @@ static ma_result ma_engine_node_get_heap_layout(const ma_engine_node_config* pCo pHeapLayout->spatializerOffset = pHeapLayout->sizeInBytes; pHeapLayout->sizeInBytes += ma_align_64(tempHeapSize); - /* Gainer. Will not be used if we are not using smoothing. */ if (pConfig->volumeSmoothTimeInPCMFrames > 0) { gainerConfig = ma_gainer_config_init(channelsIn, pConfig->volumeSmoothTimeInPCMFrames); @@ -77149,7 +76087,6 @@ static ma_result ma_engine_node_get_heap_layout(const ma_engine_node_config* pCo pHeapLayout->sizeInBytes += ma_align_64(tempHeapSize); } - return MA_SUCCESS; } @@ -77233,7 +76170,6 @@ MA_API ma_result ma_engine_node_init_preallocated(const ma_engine_node_config* p pEngineNode->isPitchDisabled = MA_FALSE; } - /* Base node. */ baseNodeConfig = ma_engine_node_base_node_config_init(pConfig); baseNodeConfig.pInputChannels = &channelsIn; @@ -77244,7 +76180,6 @@ MA_API ma_result ma_engine_node_init_preallocated(const ma_engine_node_config* p goto error0; } - /* We can now initialize the effects we need in order to implement the engine node. There's a defined order of operations here, mainly centered around when we convert our channels from the @@ -77265,7 +76200,6 @@ MA_API ma_result ma_engine_node_init_preallocated(const ma_engine_node_config* p goto error1; } - /* After resampling will come the fader. */ faderConfig = ma_fader_config_init(ma_format_f32, baseNodeConfig.pInputChannels[0], ma_engine_get_sample_rate(pEngineNode->pEngine)); @@ -77274,7 +76208,6 @@ MA_API ma_result ma_engine_node_init_preallocated(const ma_engine_node_config* p goto error2; } - /* Spatialization comes next. We spatialize based on the node's output channel count. It's up the caller to ensure channels counts link up correctly in the node graph. @@ -77291,7 +76224,6 @@ MA_API ma_result ma_engine_node_init_preallocated(const ma_engine_node_config* p goto error2; } - /* After spatialization comes panning. We need to do this after spatialization because otherwise we wouldn't be able to pan mono sounds. @@ -77303,7 +76235,6 @@ MA_API ma_result ma_engine_node_init_preallocated(const ma_engine_node_config* p goto error3; } - /* We'll need a gainer for smoothing out volume changes if we have a non-zero smooth time. We apply this before converting to the output channel count. */ if (pConfig->volumeSmoothTimeInPCMFrames > 0) { gainerConfig = ma_gainer_config_init(channelsIn, pConfig->volumeSmoothTimeInPCMFrames); @@ -77314,7 +76245,6 @@ MA_API ma_result ma_engine_node_init_preallocated(const ma_engine_node_config* p } } - return MA_SUCCESS; /* No need for allocation callbacks here because we use a preallocated heap. */ @@ -77376,7 +76306,6 @@ MA_API void ma_engine_node_uninit(ma_engine_node* pEngineNode, const ma_allocati } } - MA_API ma_sound_config ma_sound_config_init(void) { return ma_sound_config_init_2(NULL); @@ -77428,7 +76357,6 @@ MA_API ma_sound_group_config ma_sound_group_config_init_2(ma_engine* pEngine) return config; } - MA_API ma_engine_config ma_engine_config_init(void) { ma_engine_config config; @@ -77444,7 +76372,6 @@ MA_API ma_engine_config ma_engine_config_init(void) return config; } - #if !defined(MA_NO_DEVICE_IO) static void ma_engine_data_callback_internal(ma_device* pDevice, void* pFramesOut, const void* pFramesIn, ma_uint32 frameCount) { @@ -77620,7 +76547,6 @@ MA_API ma_result ma_engine_init(const ma_engine_config* pConfig, ma_engine* pEng #endif } - /* The engine is a node graph. This needs to be initialized after we have the device so we can determine the channel count. */ nodeGraphConfig = ma_node_graph_config_init(engineConfig.channels); nodeGraphConfig.processingSizeInFrames = engineConfig.periodSizeInFrames; @@ -77631,7 +76557,6 @@ MA_API ma_result ma_engine_init(const ma_engine_config* pConfig, ma_engine* pEng goto on_error_1; } - /* We need at least one listener. */ if (engineConfig.listenerCount == 0) { engineConfig.listenerCount = 1; @@ -77671,7 +76596,6 @@ MA_API ma_result ma_engine_init(const ma_engine_config* pConfig, ma_engine* pEng pEngine->listenerCount += 1; } - /* Gain smoothing for spatialized sounds. */ pEngine->gainSmoothTimeInFrames = engineConfig.gainSmoothTimeInFrames; if (pEngine->gainSmoothTimeInFrames == 0) { @@ -77683,7 +76607,6 @@ MA_API ma_result ma_engine_init(const ma_engine_config* pConfig, ma_engine* pEng pEngine->gainSmoothTimeInFrames = (gainSmoothTimeInMilliseconds * ma_engine_get_sample_rate(pEngine)) / 1000; /* 8ms by default. */ } - /* We need a resource manager. */ #ifndef MA_NO_RESOURCE_MANAGER { @@ -77967,7 +76890,6 @@ MA_API ma_uint32 ma_engine_get_sample_rate(const ma_engine* pEngine) return pEngine->sampleRate; } - MA_API ma_result ma_engine_start(ma_engine* pEngine) { ma_result result; @@ -78054,7 +76976,6 @@ MA_API float ma_engine_get_gain_db(ma_engine* pEngine) return ma_volume_linear_to_db(ma_engine_get_volume(pEngine)); } - MA_API ma_uint32 ma_engine_get_listener_count(const ma_engine* pEngine) { if (pEngine == NULL) { @@ -78209,7 +77130,6 @@ MA_API ma_bool32 ma_engine_listener_is_enabled(const ma_engine* pEngine, ma_uint return ma_spatializer_listener_is_enabled(&pEngine->listeners[listenerIndex]); } - #ifndef MA_NO_RESOURCE_MANAGER MA_API ma_result ma_engine_play_sound_ex(ma_engine* pEngine, const char* pFilePath, ma_node* pNode, ma_uint32 nodeInputBusIndex) { @@ -78335,7 +77255,6 @@ MA_API ma_result ma_engine_play_sound(ma_engine* pEngine, const char* pFilePath, } #endif - static ma_result ma_sound_preinit(ma_engine* pEngine, ma_sound* pSound) { if (pSound == NULL) { @@ -78405,7 +77324,6 @@ static ma_result ma_sound_init_from_data_source_internal(ma_engine* pEngine, con } } - /* Getting here means we should have a valid channel count and we can initialize the engine node. */ result = ma_engine_node_init(&engineNodeConfig, &pEngine->allocationCallbacks, &pSound->engineNode); if (result != MA_SUCCESS) { @@ -78428,7 +77346,6 @@ static ma_result ma_sound_init_from_data_source_internal(ma_engine* pEngine, con return result; } - /* When pulling data from a data source we need a processing cache to hold onto unprocessed input data from the data source after doing resampling. @@ -78447,7 +77364,6 @@ static ma_result ma_sound_init_from_data_source_internal(ma_engine* pEngine, con } } - /* Apply initial range and looping state to the data source if applicable. */ if (pConfig->rangeBegInPCMFrames != 0 || pConfig->rangeEndInPCMFrames != ~((ma_uint64)0)) { ma_data_source_set_range_in_pcm_frames(ma_sound_get_data_source(pSound), pConfig->rangeBegInPCMFrames, pConfig->rangeEndInPCMFrames); @@ -79204,7 +78120,6 @@ MA_API float ma_sound_get_directional_attenuation_factor(const ma_sound* pSound) return ma_spatializer_get_directional_attenuation_factor(&pSound->engineNode.spatializer); } - MA_API void ma_sound_set_fade_in_pcm_frames(ma_sound* pSound, float volumeBeg, float volumeEnd, ma_uint64 fadeLengthInFrames) { if (pSound == NULL) { @@ -79563,7 +78478,6 @@ MA_API ma_result ma_sound_set_end_callback(ma_sound* pSound, ma_sound_end_proc c return MA_SUCCESS; } - MA_API ma_result ma_sound_group_init(ma_engine* pEngine, ma_uint32 flags, ma_sound_group* pParentGroup, ma_sound_group* pGroup) { ma_sound_group_config config = ma_sound_group_config_init_2(pEngine); @@ -79870,8 +78784,6 @@ MA_API ma_uint64 ma_sound_group_get_time_in_pcm_frames(const ma_sound_group* pGr #endif /* MA_NO_ENGINE */ /* END SECTION: miniaudio_engine.c */ - - /************************************************************************************************************************************************************** *************************************************************************************************************************************************************** @@ -95783,7 +94695,6 @@ MA_API void ma_dr_mp3_free(void* p, const ma_allocation_callbacks* pAllocationCa #endif /* MA_DR_MP3_IMPLEMENTATION */ #endif /* MA_NO_MP3 */ - /* End globally disabled warnings. */ #if defined(_MSC_VER) #pragma warning(pop) @@ -95792,7 +94703,6 @@ MA_API void ma_dr_mp3_free(void* p, const ma_allocation_callbacks* pAllocationCa #endif /* miniaudio_c */ #endif /* MINIAUDIO_IMPLEMENTATION */ - /* This software is available as a choice of the following licenses. Choose whichever you prefer. -- cgit v1.2.3