Commit Graph

4070 Commits

Author SHA1 Message Date
David Reid 7f2f0a5a36 Fix a C89 error. 2025-08-20 16:56:04 +10:00
David Reid 5eb78ec819 Merge branch 'dev' into dev-0.12 2025-08-20 16:40:57 +10:00
David Reid 18055f34bb voclib: Fix a compilation error. 2025-08-20 16:40:46 +10:00
David Reid 47f08262a0 For a C89 error. 2025-08-20 16:36:53 +10:00
David Reid 415c50e2f5 Fix a -Wpedantic warning. 2025-08-20 16:12:10 +10:00
David Reid db38f0b003 Merge branch 'dev' into dev-0.12 2025-08-20 16:09:58 +10:00
David Reid f6bae251bd verblib: Try fixing a compilation error on macOS. 2025-08-20 16:09:44 +10:00
David Reid 3567d5cfef Fix compilation error with MA_NO_SSE2. 2025-08-20 16:04:15 +10:00
David Reid 4e3b778c62 Silence some warnings about unused functions. 2025-08-20 15:56:43 +10:00
David Reid ba35370f74 Merge branch 'dev' into dev-0.12 2025-08-19 08:32:35 +10:00
David Reid 6315130ec6 Make ma_lcg.state uint32 to avoid UB on signed arthimethic overflow 2025-08-19 08:32:06 +10:00
David Reid 6e1cd41622 tests: fix memory leak in filtering and generation tests 2025-08-19 08:26:22 +10:00
David Reid 62c10ddd58 Fix an error with duplex mode for the new null backend. 2025-08-15 06:10:34 +10:00
David Reid d0af92764f Big simplification to the null backend.
This is the first backend to experiment with the new wait/step backend
model which, if it works out, will allow miniaudio to work in a single
threaded mode which in turn will open up the opportunity for
applications to have greater control over thread management and to
possibly allow miniaudio to work on single threaded systems like DOS.
2025-08-14 17:32:45 +10:00
David Reid 59566edddf Some fixes to the audio thread. 2025-08-11 15:53:32 +10:00
David Reid 3f3353ee39 Remove an unused variable. 2025-08-11 15:39:47 +10:00
David Reid a1bee2c673 Get device IO APIs compiling with MA_NO_THREADING.
This is only concerned with getting miniaudio compiling. As of this
commit, device IO will not actually work with this option enabled.
2025-08-11 11:45:09 +10:00
David Reid 10700ec157 Address some MA_NO_THREADING compatibility with ma_device. 2025-08-11 08:57:46 +10:00
David Reid 9b6e9b6985 Remove some now unused code. 2025-08-11 08:08:59 +10:00
David Reid 5db8fe5094 Make it so backend start/stop callbacks are fired from the audio thread. 2025-08-11 07:58:33 +10:00
David Reid 87dee0e20c Some cleanup to the new audio thread. 2025-08-11 06:47:49 +10:00
David Reid fa5f282d65 Throw down some early work for some backend refactoring.
This is still heavily WIP and should be considered unstable as of this
commit.

This is the foundation work for getting all device backend callbacks
executing from a single thread. This will not include context related
callbacks, nor the wakeup callback.

Once this work is done, backends can rely on the property that all the
main callbacks, except wakeup, will be executed from the same thread.
Where this is particularly useful is thread hostile backends like
WASAPI. In particular, we'll be able to do isolate the initialization of
COM to only the miniaudio-managed thread which make it easier to use
miniaudio alongside frameworks which do their own COM initialization,
such as Qt.
2025-08-10 17:38:18 +10:00
David Reid fc15cc66ed Minor code rearrangement to reflect correct backend prioritization. 2025-08-08 06:41:40 +10:00
David Reid a9bdbc3033 Update backend priority order in documentation. 2025-08-07 19:23:22 +10:00
David Reid e6483d8bd9 Add some fallback stubs for threading APIs.
These will be used when a platform lacks any kind of threading support,
such as DOS. This is in preparation for future work to allow the device
API to work without threading support.

With this commit, the DJGPP DOS build can be compiled without
`MA_NO_THREADING`.
2025-08-07 19:16:02 +10:00
David Reid 08b8fcd4c6 Fix timing functions with the DJGPP build. 2025-08-07 19:12:43 +10:00
David Reid 0923a484ee Merge branch 'dev' into dev-0.12 2025-08-07 18:00:40 +10:00
David Reid 78cdb9c1cb Add batch file for setting up DJGPP environment. 2025-08-07 17:44:55 +10:00
David Reid 1ea69211ad Fix some errors with the DJGPP build.
This forces `MA_NO_THREADING` and `MA_NO_RUNTIME_LINKING`.

The DOS/DJGPP build currently requires `MA_NO_DEVICE_IO`.
2025-08-07 17:44:19 +10:00
David Reid e9e8f90137 Fix an error when setting loop points.
Public issue https://github.com/mackron/miniaudio/issues/1019
2025-08-07 16:20:00 +10:00
David Reid d93552283f Unify MA_NX and MA_SWITCH platform macros. 2025-08-07 16:17:51 +10:00
David Reid 61a85dca42 Fix NXDK build for Xbox.
This disables the WASAPI, DirectSound and WinMM backends which means
you will not get any actual audio output working. An Xbox backend will
need to come later. The main purpose of this commit is to get the main
library compiling.

The main complication arises from the fact that both _WIN32 and
_MSC_VER are defined which makes miniaudio think it's using a normal
desktop Windows build. In practice it mostly works, but there's a few
things needing to be changed specifically for NXDK:

  - `fopen_s()` is not a thing with NXDK. It always uses `fopen()`.
  - There is no `_wfopen()`, nor `wcsrtombs()`, so attempting to open
    a file from a wide character string will fail.
  - There is also no `CreateFileW()`, so this code path will also
    result in an error if you attempt to open a file from a wide
    character path.
  - `CoInitialize()` is not a thing with NXDK and has therefore been
    excluded from the build.
  - `GetFileInformationByHandle()` does not exist, and neither does
    `struct stat` or `stat()`. Since the only file information miniaudio
    attempts to retrieve is the file size, I've implemented a fall back
    which uses the seek/tell/seek pattern when info retrieval is
    unavailable.
  - A fall back has been implemented for comparing wide character path
    extensions which performs a case-sensitive compare instead. This
    means that if you are using wide character paths, miniaudio will not
    detect an extension like "wav" and "WAV" as the same thing. This
    might be made more robust later if there is enough demand.

Public issue https://github.com/mackron/miniaudio/issues/1023
2025-08-07 13:45:11 +10:00
David Reid c87f207f4e Win32: Use CreateSemaphore() instead of CreateSemaphoreW()
This should improve compiler compatibility for those that do not
define `CreateSemaphoreW()`, such as NXDK.
2025-08-07 13:23:35 +10:00
David Reid 02ae7e41f0 Update dr_libs. 2025-08-07 13:18:56 +10:00
David Reid 8bb1dc5a88 Merge branch 'dev' into dev-0.12 2025-07-23 12:12:53 +10:00
David Reid 457a7279fa Update dr_wav. 2025-07-23 12:08:35 +10:00
David Reid fe1da60e1e Update change history. 2025-07-23 10:11:14 +10:00
David Reid 0b70a990ca Minor update to documentation. 2025-07-23 09:16:20 +10:00
David Reid 26c347e506 Merge branch 'dev' into dev-0.12 2025-07-22 16:34:01 +10:00
David Reid 556160909e Try fixing the Switch build. 2025-07-22 15:46:17 +10:00
David Reid 2d4cc9c910 ALSA: Add a new config option to use the default channel layout.
This can sometimes be more reliable than `snd_pcm_get_chmap()`.
2025-07-22 15:29:51 +10:00
David Reid 20b9b9c533 Android: Remove enableCompatibilityWorkarounds config options. 2025-07-22 07:53:11 +10:00
David Reid 76e97c6254 PipeWire: Try fixing some compilation errors. 2025-07-22 06:18:46 +10:00
David Reid 384afa3a5f Whitespace. 2025-07-21 17:09:09 +10:00
David Reid 397cadbd64 Merge branch 'dev' into dev-0.12 2025-07-21 17:07:08 +10:00
David Reid c48975f4a9 Don't link against dl with NO_RUNTIME_LINKING. 2025-07-21 17:06:34 +10:00
David Reid db9ad08bf0 Merge branch 'dev' into dev-0.12 2025-07-21 17:04:02 +10:00
David Reid 79b4ddc27d Fix CMake script for NetBSD and OpenBSD. 2025-07-21 16:54:27 +10:00
David Reid 377f589a01 Merge branch 'dev' into dev-0.12 2025-07-21 16:51:09 +10:00
Marcin Serwin 0b9f03a376 Respect CMAKE_INSTALL_INCLUDEDIR when installing headers
Signed-off-by: Marcin Serwin <marcin@serwin.dev>
2025-07-21 16:48:25 +10:00