Commit Graph

1755 Commits

Author SHA1 Message Date
Steven Noonan 5472d84180 introduce MA_ASSUME macro
This macro can be used to tell the compiler's optimization passes static
assumptions which you *know* are true about code behavior.

Use of these can be risky -- if you assume incorrectly, the compiler may
emit code that will not work in circumstances you didn't anticipate.

On the other hand, use of this macro in places where the optimizer is
missing an assumption that would have been safe to make can cause it to
emit more compact/optimal code.

Signed-off-by: Steven Noonan <steven@uplinklabs.net>
2021-03-13 21:07:11 -08:00
Steven Noonan c9e2258dae introduce MA_COMPILER_HAS_BUILTIN macro
Both GCC and Clang can use this feature, so let's make it more general.

I didn't touch the dr_wav/dr_flac parts using this, since I figure the
amalgamated miniaudio.h header isn't the primary source for those.

Signed-off-by: Steven Noonan <steven@uplinklabs.net>
2021-03-13 21:07:10 -08:00
Steven Noonan e4ff49d558 wasapi: ensure that wasapi context structure is zeroed before filling it
I had a situation where I was doing:

    ma_backend backends[] = {
	ma_backend_jack,
	ma_backend_wasapi,
    };
    ma_context_init(backends, sizeof(backends)/sizeof(backends[0]),
	&contextConfig, &context);

And since JACK was unavailable, it fell back to WASAPI. When this
happened, the WASAPI commandIndex and commandCount variables were
already stomped on by the JACK backend initialization, but the WASAPI
backend assumes they are zero-initialized.

Signed-off-by: Steven Noonan <steven@uplinklabs.net>
2021-03-10 07:48:26 -08:00
David Reid de1219158d Merge pull request #280 from morlad/fix-warning-1
Fix -Wcast-qual by using correct ma_offset_pcm_frames_ptr()
2021-03-10 17:38:11 +10:00
David Reid feae709042 Update revision history. 2021-03-10 17:34:41 +10:00
David Reid 551ce040ae Merge pull request #279 from morlad/fix-audio-latency-1
Fix CoreAudio's performanceProfile for playback not being set
2021-03-10 17:35:35 +10:00
David Reid d9016e2036 Merge branch 'dev' of https://github.com/mackron/miniaudio into dev 2021-03-10 17:31:49 +10:00
David Reid cd65ffe939 Merge pull request #278 from morlad/fix-memory-leak-1
Fix memory leak (macOS)
2021-03-10 17:32:36 +10:00
David Reid ecffc00ccf Update revision history. 2021-03-10 17:31:42 +10:00
David Reid c12730bcab Update c89atomic. 2021-03-10 17:23:38 +10:00
morlad (iLeitgeb) c2fd23c983 Fix CoreAudio's performanceProfile for playback not being set 2021-03-10 06:45:21 +00:00
morlad (iLeitgeb) eadd717397 Fix -Wcast-qual by using correct ma_offset_pcm_frames_ptr() 2021-03-10 06:42:46 +00:00
morlad (iLeitgeb) 6f22b36eb7 Fix memory leak (macOS) 2021-03-10 06:39:10 +00:00
David Reid 53eed5b5f2 Silence some -Wmaybe-uninitialized warnings. 2021-03-09 20:51:31 +10:00
David Reid a06ca7ee04 Prevent a division by zero. 2021-03-04 17:19:23 +10:00
David Reid c2c32ed1d7 Fix a typo. 2021-03-01 17:39:03 +10:00
David Reid d5ba84605c Fix a typo in the date for the previous version in revision history. 2021-02-26 17:09:29 +10:00
David Reid d06d4983d3 Version 0.10.32 2021-02-23 18:09:47 +10:00
David Reid 2290c10704 Fix build on older versions of MSVC. 2021-02-23 17:46:45 +10:00
David Reid dd319dc92a WASAPI: Attempt to fix some bugs with device uninitialization. 2021-02-22 20:30:47 +10:00
David Reid 25938c8197 Update dr_libs. 2021-02-21 08:50:46 +10:00
David Reid dc343d37d8 Fix a warning due to referencing _MSC_VER when it is undefined. 2021-02-21 08:26:13 +10:00
David Reid 0271f1424b Merge branch 'dev' of https://github.com/mackron/miniaudio into dev 2021-02-20 07:09:25 +10:00
ilyak 3750211e6d fix iOS NSNotificationCenter removeObserver name which leads to NC deadlock for another operations 2021-02-17 15:12:21 +03:00
David Reid 83dd65938d Update revision history. 2021-02-16 17:44:46 +10:00
ilyak ac1a161c5a webaudio: audio context resume only for started devices 2021-02-09 22:01:10 +03:00
ilyak 5e8534cfec webaudio: unlock audio context on user interaction 2021-02-08 20:48:35 +03:00
ilyak 2f29cdb5dc webaudio: fix default sampleRate buffer size configuration 2021-02-08 20:47:46 +03:00
David Reid 8767422fb9 WASAPI: Fix a typo and some formatting changes. 2021-02-06 08:14:58 +10:00
David Reid 577123762b Fix a double release bug. 2021-02-05 20:34:07 +10:00
David Reid 67786740c4 PulseAudio: Fix a failed assertion. 2021-02-05 18:00:02 +10:00
David Reid ee73374dab Fix a documentation error. 2021-02-04 19:55:23 +10:00
David Reid ad919ebae6 WASAPI: Don't post an error when no exclusive format can be found. 2021-02-03 17:25:20 +10:00
David Reid 96db99f6eb Update revision history. 2021-02-02 18:51:22 +10:00
David Reid e98ec370a1 Merge branch 'dev' of https://github.com/mackron/miniaudio into dev 2021-02-02 18:49:59 +10:00
David Reid ea7f42ead0 Update revision history. 2021-02-02 18:49:44 +10:00
David Reid 3191f1a20a iOS: Fix a typo. 2021-02-02 18:16:29 +10:00
David Reid 781ce447fd iOS: Experimental fixes to automatic stream routing.
Public issue https://github.com/mackron/miniaudio/issues/101
2021-02-02 18:12:52 +10:00
David Reid c5469536c6 iOS: Remove an experimental conditional. 2021-02-02 17:39:41 +10:00
David Reid 2b3f860304 WASAPI: Refactoring to automatic stream routing system.
Public issue https://github.com/mackron/miniaudio/issues/258
2021-02-01 21:23:06 +10:00
David Reid 78a226107c Remove some old unused code. 2021-02-01 17:22:46 +10:00
David Reid bb63705a5a Revert an experimental fix for WASAPI automatic stream routing. 2021-02-01 17:22:17 +10:00
David Reid 56abb1100b Rename a badly named variable. 2021-01-31 18:13:35 +10:00
David Reid 2f46aaf126 Rename a callback. 2021-01-31 18:09:03 +10:00
David Reid 8a8917dfe9 Remove the "usingDefault*" members of ma_device. 2021-01-31 18:01:07 +10:00
David Reid 1c493d6fa4 More post-refactoring cleanup. 2021-01-31 17:58:08 +10:00
David Reid 6c74b309c9 Cleanup old backend callback stuff. 2021-01-31 17:40:31 +10:00
David Reid 81ab94685b sndio: Migrate over to the new backend callback system. 2021-01-31 17:13:36 +10:00
David Reid 7023f7e7fe audio4: Migrate over to the new backend callback system. 2021-01-31 16:28:15 +10:00
David Reid c68700baaf OSS: Migrate over to the new backend callback system. 2021-01-31 14:16:13 +10:00