From 7dae981ad5382e0e4a26ae52a4596e0c1ceedfbb Mon Sep 17 00:00:00 2001 From: David Reid Date: Sat, 17 Jan 2026 07:32:18 +1000 Subject: [PATCH 1/7] Add some helpers for resetting a sound after a fade and stop. Public issue https://github.com/mackron/miniaudio/issues/714 --- miniaudio.h | 29 +++++++++++++++++++++++++++-- 1 file changed, 27 insertions(+), 2 deletions(-) diff --git a/miniaudio.h b/miniaudio.h index 06ba1df2..da1f43fe 100644 --- a/miniaudio.h +++ b/miniaudio.h @@ -11399,8 +11399,12 @@ MA_API ma_engine* ma_sound_get_engine(const ma_sound* pSound); MA_API ma_data_source* ma_sound_get_data_source(const ma_sound* pSound); MA_API ma_result ma_sound_start(ma_sound* pSound); MA_API ma_result ma_sound_stop(ma_sound* pSound); -MA_API ma_result ma_sound_stop_with_fade_in_pcm_frames(ma_sound* pSound, ma_uint64 fadeLengthInFrames); /* Will overwrite any scheduled stop and fade. */ -MA_API ma_result ma_sound_stop_with_fade_in_milliseconds(ma_sound* pSound, ma_uint64 fadeLengthInFrames); /* Will overwrite any scheduled stop and fade. */ +MA_API ma_result ma_sound_stop_with_fade_in_pcm_frames(ma_sound* pSound, ma_uint64 fadeLengthInFrames); /* Will overwrite any scheduled stop and fade. If you want to restart the sound, first reset it with `ma_sound_reset_stop_time_and_fade()`. There are plans to make this less awkward in the future. */ +MA_API ma_result ma_sound_stop_with_fade_in_milliseconds(ma_sound* pSound, ma_uint64 fadeLengthInFrames); /* Will overwrite any scheduled stop and fade. If you want to restart the sound, first reset it with `ma_sound_reset_stop_time_and_fade()`. There are plans to make this less awkward in the future. */ +MA_API void ma_sound_reset_start_time(ma_sound* pSound); +MA_API void ma_sound_reset_stop_time(ma_sound* pSound); +MA_API void ma_sound_reset_fade(ma_sound* pSound); +MA_API void ma_sound_reset_stop_time_and_fade(ma_sound* pSound); /* Resets fades and scheduled stop time. Does not seek back to the start. */ MA_API void ma_sound_set_volume(ma_sound* pSound, float volume); MA_API float ma_sound_get_volume(const ma_sound* pSound); MA_API void ma_sound_set_pan(ma_sound* pSound, float pan); @@ -78779,6 +78783,27 @@ MA_API ma_result ma_sound_stop_with_fade_in_milliseconds(ma_sound* pSound, ma_ui return ma_sound_stop_with_fade_in_pcm_frames(pSound, (fadeLengthInMilliseconds * sampleRate) / 1000); } +MA_API void ma_sound_reset_start_time(ma_sound* pSound) +{ + ma_sound_set_start_time_in_pcm_frames(pSound, 0); +} + +MA_API void ma_sound_reset_stop_time(ma_sound* pSound) +{ + ma_sound_set_stop_time_in_pcm_frames(pSound, ~(ma_uint64)0); +} + +MA_API void ma_sound_reset_fade(ma_sound* pSound) +{ + ma_sound_set_fade_in_pcm_frames(pSound, 0, 1, 0); +} + +MA_API void ma_sound_reset_stop_time_and_fade(ma_sound* pSound) +{ + ma_sound_reset_stop_time(pSound); + ma_sound_reset_fade(pSound); +} + MA_API void ma_sound_set_volume(ma_sound* pSound, float volume) { if (pSound == NULL) { From a551f0e70b10246dcddad2ecd657511913257175 Mon Sep 17 00:00:00 2001 From: Richard Keller Date: Fri, 16 Jan 2026 22:19:08 +0100 Subject: [PATCH 2/7] Free pa_context if connecting to PulseAudio fails. --- miniaudio.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/miniaudio.h b/miniaudio.h index da1f43fe..2a3b39c0 100644 --- a/miniaudio.h +++ b/miniaudio.h @@ -31242,6 +31242,7 @@ static ma_result ma_init_pa_mainloop_and_pa_context__pulse(ma_context* pContext, result = ma_result_from_pulse(((ma_pa_context_connect_proc)pContext->pulse.pa_context_connect)((ma_pa_context*)pPulseContext, pServerName, (tryAutoSpawn) ? MA_PA_CONTEXT_NOFLAGS : MA_PA_CONTEXT_NOAUTOSPAWN, NULL)); if (result != MA_SUCCESS) { ma_log_postf(ma_context_get_log(pContext), MA_LOG_LEVEL_ERROR, "[PulseAudio] Failed to connect PulseAudio context."); + ((ma_pa_context_unref_proc)pContext->pulse.pa_context_unref)((ma_pa_context*)(pPulseContext)); ((ma_pa_mainloop_free_proc)pContext->pulse.pa_mainloop_free)((ma_pa_mainloop*)(pMainLoop)); return result; } @@ -31250,6 +31251,7 @@ static ma_result ma_init_pa_mainloop_and_pa_context__pulse(ma_context* pContext, result = ma_wait_for_pa_context_to_connect__pulse(pContext, pMainLoop, pPulseContext); if (result != MA_SUCCESS) { ma_log_postf(ma_context_get_log(pContext), MA_LOG_LEVEL_ERROR, "[PulseAudio] Waiting for connection failed."); + ((ma_pa_context_unref_proc)pContext->pulse.pa_context_unref)((ma_pa_context*)(pPulseContext)); ((ma_pa_mainloop_free_proc)pContext->pulse.pa_mainloop_free)((ma_pa_mainloop*)(pMainLoop)); return result; } From 74912d525bf9452876f190a6e20a6670538c54e1 Mon Sep 17 00:00:00 2001 From: David Reid Date: Sat, 17 Jan 2026 08:58:02 +1000 Subject: [PATCH 3/7] Add SECURITY.md --- .github/SECURITY.md | 4 ++++ README.md | 5 +---- 2 files changed, 5 insertions(+), 4 deletions(-) create mode 100644 .github/SECURITY.md diff --git a/.github/SECURITY.md b/.github/SECURITY.md new file mode 100644 index 00000000..7ace9644 --- /dev/null +++ b/.github/SECURITY.md @@ -0,0 +1,4 @@ +I deal with all security related issues publicly and transparently, and it can sometimes take a while before I +get a chance to address it. If this is an issue for you, you need to use another library. The fastest way to get +a bug fixed is to submit a pull request, but if this is impractical for you please post a ticket to the public +GitHub issue tracker. \ No newline at end of file diff --git a/README.md b/README.md index ee7f46e0..7d885375 100644 --- a/README.md +++ b/README.md @@ -205,10 +205,7 @@ Backends Security ======== -I deal with all security related issues publicly and transparently, and it can sometimes take a while before I -get a chance to address it. If this is an issue for you, you need to use another library. The fastest way to get -a bug fixed is to submit a pull request, but if this is impractical for you please post a ticket to the public -GitHub issue tracker. +See the miniaudio [security policy](.github/SECURITY.md). License From d0b98eee6b0e22cdf607969050e6134b9bbb3e85 Mon Sep 17 00:00:00 2001 From: David Reid Date: Sat, 17 Jan 2026 09:25:06 +1000 Subject: [PATCH 4/7] Update change history. --- CHANGES.md | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/CHANGES.md b/CHANGES.md index ca54ea91..9c41d8ae 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -1,7 +1,16 @@ -v0.11.24 - TBD +v0.11.24 - 2026-01-17 ===================== -* Fix a possible double-uninit error when a decoder fails to initialize. -* Fix a compilation error with the MSVC Aarch64 build. +* Fixed a possible glitch when processing the audio of a `ma_sound` when doing resampling. +* Fixed a possible crash in the node graph relating to scheduled starts and stops. +* Fixed a bug where MA_NO_DECODING would disable the WAV encoder. +* Fixed a pthread compatibility issue, particularly with Android. +* Fixed a possible crash in the resource manager. +* Fixed a possible double-uninit error when a decoder fails to initialize. +* Fixed a compilation error with the MSVC Aarch64 build. +* Addressed a few errors found through static analysis, particularly around possible null pointer dereferences. +* `ma_sound_is_playing()` will now correctly return false when called from inside the end callback of a sound. +* Miscellaneous compiler compatibility and warning fixes. +* PulseAudio: Fix a resource leak when a context fails to connect. * Web: Fixed an error when uninitializing a context. From 8e6283aa31b36707580917b0a02a4d3fd6ad4aad Mon Sep 17 00:00:00 2001 From: David Reid Date: Sat, 17 Jan 2026 09:34:34 +1000 Subject: [PATCH 5/7] Fix a warning. --- miniaudio.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/miniaudio.h b/miniaudio.h index 2a3b39c0..fe314099 100644 --- a/miniaudio.h +++ b/miniaudio.h @@ -76954,7 +76954,7 @@ static void ma_engine_node_process_pcm_frames__sound(ma_node* pNode, const float while (totalFramesConverted < pSound->processingCacheCap) { ma_uint64 framesConverted; - ma_uint32 framesToConvertThisIteration = pSound->processingCacheCap - totalFramesConverted; + ma_uint32 framesToConvertThisIteration = pSound->processingCacheCap - (ma_uint32)totalFramesConverted; if (framesToConvertThisIteration > tempCapInFrames) { framesToConvertThisIteration = tempCapInFrames; } From da94cf2bc606f607d4bc04ed154b191100c60429 Mon Sep 17 00:00:00 2001 From: David Reid Date: Sat, 17 Jan 2026 09:34:51 +1000 Subject: [PATCH 6/7] Update fs. --- external/fs/fs.c | 6 +++--- external/fs/fs.h | 1 + 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/external/fs/fs.c b/external/fs/fs.c index eefd2abe..20bd803b 100644 --- a/external/fs/fs.c +++ b/external/fs/fs.c @@ -5410,7 +5410,7 @@ static fs_result fs_serialize_directory(fs* pFS, const char* pDirectoryPath, con *pRunningFileOffset += fileSize; /* Add padding zeros to align the data to 8 bytes. */ - result = fs_stream_write(pOutputStream, padding, FS_ALIGN(*pRunningFileOffset, 8) - *pRunningFileOffset, NULL); + result = fs_stream_write(pOutputStream, padding, (size_t)(FS_ALIGN(*pRunningFileOffset, 8) - *pRunningFileOffset), NULL); if (result != FS_SUCCESS) { fs_string_free(&path, fs_get_allocation_callbacks(pFS)); return result; @@ -5487,7 +5487,7 @@ FS_API fs_result fs_serialize(fs* pFS, const char* pDirectoryPath, int options, return result; } - result = fs_stream_write(pOutputStream, "\0\0\0\0\0\0\0\0", FS_ALIGN(initialPos, 8) - initialPos, NULL); + result = fs_stream_write(pOutputStream, "\0\0\0\0\0\0\0\0", (size_t)(FS_ALIGN(initialPos, 8) - initialPos), NULL); if (result != FS_SUCCESS) { fs_memory_stream_uninit(&toc); return result; @@ -5532,7 +5532,7 @@ FS_API fs_result fs_serialize(fs* pFS, const char* pDirectoryPath, int options, fs_uint32 reserved; /* Padding to align to 8 bytes. */ - result = fs_stream_write(pOutputStream, padding, FS_ALIGN(runningOffset, 8) - runningOffset, NULL); + result = fs_stream_write(pOutputStream, padding, (size_t)(FS_ALIGN(runningOffset, 8) - runningOffset), NULL); if (result != FS_SUCCESS) { return result; } diff --git a/external/fs/fs.h b/external/fs/fs.h index 3d961a67..da716042 100644 --- a/external/fs/fs.h +++ b/external/fs/fs.h @@ -3689,6 +3689,7 @@ FS_API void* fs_sorted_search(const void* pKey, const void* pList, size_t count, FS_API int fs_strncmp(const char* str1, const char* str2, size_t maxLen); FS_API int fs_strnicmp(const char* str1, const char* str2, size_t count); +FS_API int fs_strncat_s(char* dst, size_t dstCap, const char* src, size_t count); /* END fs_utils.h */ From 347321b27c58d42567e905c715de60ad43a6cb8e Mon Sep 17 00:00:00 2001 From: David Reid Date: Sat, 17 Jan 2026 09:37:44 +1000 Subject: [PATCH 7/7] Version 0.11.24 --- miniaudio.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/miniaudio.h b/miniaudio.h index fe314099..24e676bb 100644 --- a/miniaudio.h +++ b/miniaudio.h @@ -1,6 +1,6 @@ /* Audio playback and capture library. Choice of public domain or MIT-0. See license statements at the end of this file. -miniaudio - v0.11.24 - TBD +miniaudio - v0.11.24 - 2026-01-17 David Reid - mackron@gmail.com