Commit Graph

1629 Commits

Author SHA1 Message Date
David Reid b98acd2422 Update amalgamation of dr_wav.
With this change, dr_wav is now namespaced with "ma" which means dr_wav
can now be used alongside miniaudio.

In addition, some duplicate code has been removed, such as sized types,
result codes, allocation callbacks, etc. which reduces the size of the
file slightly.

This should address the following public issue:
  https://github.com/mackron/miniaudio/issues/673
2023-05-22 16:52:16 +10:00
David Reid 5c099791ee Clean up decoding documentation.
miniaudio is updating it's amalgamation of dr_wav, etc. so that it's
all namespaced with "ma" which will make the amalgamated versions of
dr_libs entirely independent. There's no longer any need to mention
the decoding backends.

Documentation regarding stb_vorbis is removed so as to discourage
new users from using it. Support will not be removed until a
replacement Vorbis decoder can be amalgamated, but new users should
instead be guided to the libvorbis custom decoder in the extras folder.
2023-05-22 16:06:13 +10:00
David Reid 773d97a95c Fix a compilation error with VC6 and VS2003.
These compilers do not support noinline.
2023-05-22 14:48:55 +10:00
David Reid fa7cd81027 Improvements to c89atomic amalgamation.
* Sized types will now use miniaudio's types.
  * Architecture macros now use miniaudio's macros.
  * The c89atomic namespace has been renamed to ma_atomic which makes
    it so c89atomic can be used alongside miniaudio without naming
    conflicts.

Public issue https://github.com/mackron/miniaudio/issues/673
2023-05-21 09:41:49 +10:00
David Reid af46c1fcc0 Minor changes to architecture detection.
This is in preparation for some amalgamation improvements.
2023-05-21 08:25:14 +10:00
David Reid f05bb5306d Try fixing Windows 95/98 build.
This commit makes it so SetFilePointer/Ex() are dynamically loaded at
runtime which allows miniaudio to branch dynamically based on available
support.

This is necessary because versions of Windows prior to XP do not
support the Ex version which results in an error when trying to run the
program.

Public issue https://github.com/mackron/miniaudio/issues/672
2023-05-18 20:44:46 +10:00
David Reid 6eeea700f0 Silence a very minor linting warning in VS2022. 2023-05-17 18:22:24 +10:00
David Reid 04a6fe6eea Work around some bad code generation by Clang. 2023-05-17 18:20:15 +10:00
David Reid ea205fb7b0 Version 0.11.16 2023-05-15 09:36:42 +10:00
David Reid 26c11a7771 Process jobs on the calling thread when WAIT_INIT is used.
Since the calling thread is waiting anyway, it's better to just do the
processing on the calling thread rather than posting it to the job
queue and waiting. This ensures the calling thread stays busy which
will improve performance, but it also makes it so the calling thread
doesn't get stalled while already-queued jobs are getting processed.
2023-05-12 09:11:29 +10:00
David Reid 870ac8a22c Don't link to advapi32.dll for the GDK build. 2023-05-06 08:59:13 +10:00
David Reid a1ea4438ee Fix ma_dlopen() on the GDK build. 2023-05-06 08:50:55 +10:00
David Reid 902c19d6ab WASAPI: Another fix for the GDK build. 2023-05-06 08:41:08 +10:00
David Reid 64f14070a7 WASAPI: Revert an experimental change and try fixing GDK build. 2023-05-06 08:31:32 +10:00
David Reid 6d20ccb701 WASAPI: Experimental change for rerouting. 2023-05-05 10:26:39 +10:00
David Reid 96ac03f184 WASAPI: Log error codes when a device fails to start. 2023-05-05 09:34:31 +10:00
David Reid e913a6d1aa Silence a warning. 2023-05-05 09:24:46 +10:00
David Reid de706d44b8 Experimental fix for better handling of AUDCLNT_E_DEVICE_INVALIDATED. 2023-05-05 09:18:18 +10:00
David Reid 2bf7e03777 WASAPI: Relax validation checks when doing device reroutes. 2023-05-05 08:55:23 +10:00
David Reid ae25dbcdac Fix a memory leak in ma_sound_init_copy().
Public issue https://github.com/mackron/miniaudio/issues/667
2023-05-03 08:02:42 +10:00
David Reid 26b0a9ffc0 Version 0.11.15 2023-04-30 08:32:13 +10:00
David Reid 1ac2abc36e Update c89atomic. 2023-04-28 09:39:59 +10:00
David Reid 97663b349d WASAPI: Work on process loopback support.
This is still not working on my machine. The device will initialize and
run, but the captured data is always silent for some reason. I have
been unable to figure out how to make this work.

This commit allows initialization of the device to complete at the very
least.

Public issue https://github.com/mackron/miniaudio/issues/484
2023-04-25 18:29:36 +10:00
David Reid 5541983ff0 WASAPI: Make format retrieval more robust.
Public issue https://github.com/mackron/miniaudio/issues/660
2023-04-24 18:56:13 +10:00
David Reid e386435af9 WASAPI: Fix a possible memory access bug.
The issue here is that it's possible for miniaudio to attempt to access
data from a WAVEFORMATEXTENSIBLE structure when the object is actually
only a WAVEFORMATEX structure which is smaller which can therefore
result in trying to access unallocated memory.

Public issue https://github.com/mackron/miniaudio/issues/660
2023-04-20 08:23:02 +10:00
David Reid 12fa73db2a Fix an error when initializing a duplex device on some backends.
Public issue https://github.com/mackron/miniaudio/issues/659
2023-04-19 08:16:33 +10:00
David Reid f068a7934c Have ma_sound_init_copy() inherit volume smoothing settings. 2023-04-08 09:28:58 +10:00
David Reid 713093d67d Add support for setting the default volume smooth time for sounds.
This is set via the engine config.
2023-04-08 09:26:57 +10:00
David Reid 23345b47e8 Add support for volume smoothing to sounds.
Smoothing is disabled by default. To enable it, you must use
ma_sound_init_ex() and configure it via the volumeSmoothTimeInPCMFrames
member of ma_sound_config.

This commit also fixes a bug where ma_gainer is not properly applying
smoothing.
2023-04-07 17:34:33 +10:00
David Reid 9a7663496f Version 0.11.14 2023-03-29 07:52:40 +10:00
David Reid 249c7386ae PulseAudio: Use the channel map used when initializing the PA stream.
This is an attempt to work around an issue with PipeWire.
2023-03-28 19:53:21 +10:00
David Reid 2ce573d0d6 Try fixing a channel mapping related error with PipeWire. 2023-03-28 18:07:46 +10:00
David Reid 21cf0e38a8 Simply some platform detection macros. 2023-03-28 13:30:50 +10:00
David Reid 2944461a88 Fix compilation on Haiku. 2023-03-28 12:50:40 +10:00
David Reid 6ada2501e8 Update some flags to prevent some conflicts. 2023-03-27 09:52:25 +10:00
David Reid bf90b04a3f Try fixing a compilation error with MA_NO_DEVICE_IO.
Public issue https://github.com/mackron/miniaudio/issues/652
2023-03-26 19:23:28 +10:00
David Reid 15aa776955 Minor code rearrangement in preparation for some updates. 2023-03-26 18:42:50 +10:00
David Reid 8ce4857bcd Add support for using ma_pcm_rb as a data source. 2023-03-25 12:05:28 +10:00
David Reid 025afa464a Update dr_wav and c89atomic. 2023-03-25 10:23:49 +10:00
David Reid 58855d3d34 Fix some pedantic warnings when compiling with GCC. 2023-03-25 09:10:28 +10:00
David Reid 315087be30 Add MA_THREAD_DEFAULT_STACK_SIZE for threads. 2023-03-25 08:16:20 +10:00
David Reid 5fc5c4d4ed Add new functions for getting and setting the engine's global time.
* ma_engine_get_time_in_pcm_frames() (replaces ma_engine_get_time())
  * ma_engine_get_time_in_milliseconds()
  * ma_engine_set_time_in_pcm_frames() (replaces ma_engine_set_time())
  * ma_engine_set_time_in_milliseconds()

These changes are consistent with the naming of other time based
functions, eliminates ambiguity and just makes it clearer as to what
you're working with.

ma_engine_get_time() and ma_engine_set_time() have been deprecated.
2023-03-24 13:19:03 +10:00
David Reid e1a3abe9e7 Fix a bug with ma_vfs_read().
This is not pre-initializing the variable that receives the number of
bytes read to 0 which can result in custom VFS implementations
returning an invalid value if they return early from an error or
whatnot.
2023-03-23 10:43:56 +10:00
David Reid fb9c18c705 Version 0.11.13 2023-03-23 07:33:23 +10:00
David Reid 4c199f9164 Fix some compilation errors with the C++ build. 2023-03-21 13:56:43 +10:00
David Reid c5f47fe7f1 Fix a compilation error when WASAPI is disabled. 2023-03-21 11:01:41 +10:00
David Reid 6d71ce4121 Fix compilation errors with WIN32_LEAN_AND_MEAN.
Public issue https://github.com/mackron/miniaudio/discussions/647
2023-03-21 09:53:24 +10:00
David Reid 0433ac9eca Fix some warnings. 2023-03-21 09:25:26 +10:00
David Reid 0a19c74417 Version 0.11.12 2023-03-19 20:58:13 +10:00
David Reid 17744f69c2 audio4: Try improving default channel and sample rate detection. 2023-03-19 20:07:05 +10:00