Commit Graph

2482 Commits

Author SHA1 Message Date
David Reid fca829edef Version 0.10.33 2021-04-04 08:04:50 +10:00
David Reid f814a10c02 Try fixing a bug with doppler effect and rotations. 2021-04-02 13:50:16 +10:00
David Reid cb983db535 Attempt another fix for reversed front/back spatialization panning. 2021-04-02 12:39:41 +10:00
David Reid 544ec856f7 Another attempt at fixing a spatialization error. 2021-04-02 12:24:19 +10:00
David Reid 6d414a359b An experimental fix for some spatialization issues. 2021-04-02 10:52:26 +10:00
David Reid 215621f15e Fix an spatialization edge case relating to listener direction.
When the listener is looking at exactly the same direction as the world
up vector the 3D math breaks down due to a cross product evaluating to
a zero length vector.
2021-04-02 10:06:52 +10:00
David Reid ca5023415f Fix a division by 0 when normalizing a vector. 2021-04-02 09:48:00 +10:00
David Reid 88687fdc43 Try fixing a bug with calculating the relative position of a sound. 2021-04-02 09:27:08 +10:00
David Reid 881fa6063e Update dr_flac. 2021-04-02 08:52:00 +10:00
David Reid 045ee8ae18 Experimental fix for a memory leak in the resource manager. 2021-03-21 09:38:21 +10:00
David Reid eef66940c2 Fix a bug when calculating buffer sizes.
This fixes the following APIs:

  * ma_calculate_buffer_size_in_milliseconds_from_frames()
  * ma_calculate_buffer_size_in_frames_from_milliseconds()

Public issue https://github.com/mackron/miniaudio/issues/283
2021-03-21 08:07:57 +10:00
David Reid ba3e73cb22 Update revision history. 2021-03-21 07:57:53 +10:00
David Reid 64749431dd Update c89atomic. 2021-03-21 07:56:29 +10:00
David Reid f57673d861 Merge pull request #284 from tycho/pr/clang-optimizations
Clang auto-vectorization hints
2021-03-21 07:51:37 +10:00
David Reid a02f559581 JACK: Add support for loading JACK from libjack64.dll. 2021-03-16 18:20:14 +10:00
Steven Noonan 8a1858eba6 use MA_ASSUME for channel counts before loops
The range of the value isn't obvious to any compiler, as it could go for
one iteration or 4 billion iterations. Adding MA_ASSUME in these places
helps the compiler understand the range of possible values, and know how
heavily to vectorize (or not vectorize) these loops.

Signed-off-by: Steven Noonan <steven@uplinklabs.net>
2021-03-15 04:10:10 -07:00
Steven Noonan c1451b30a4 apply MA_RESTRICT to linear resampler interpolation functions
This tells the compiler that pFrameOut does not alias to pointers used
within the function, and teaches Clang that the loop is vectorizable.

Signed-off-by: Steven Noonan <steven@uplinklabs.net>
2021-03-15 04:10:09 -07:00
Steven Noonan c88bb8ccd2 extract channel count constants from loops
These values are constant, but Clang has some trouble noticing that,
especially if the loop body is complex enough. This prevents it from
noticing places where vectorization is possible (and desirable).

Signed-off-by: Steven Noonan <steven@uplinklabs.net>
2021-03-15 04:10:08 -07:00
Steven Noonan 2dcce6d53b introduce MA_RESTRICT macro
This allows us to use the __restrict keyword in places where we know
that pointers do not alias.

Signed-off-by: Steven Noonan <steven@uplinklabs.net>
2021-03-13 22:33:54 -08:00
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
David Reid e3c9975e88 Merge pull request #282 from tycho/pr/wasapi-backend-fallback-fix
wasapi: ensure that wasapi context structure is zeroed before filling it
2021-03-11 17:30:59 +10: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 0a7207d5db Merge pull request #281 from morlad/fix-engine-no-resman-1
Fix linker error when MA_NO_RESOURCE_MANAGER is defined
2021-03-10 17:39:43 +10: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 b1e1798771 Merge pull request #276 from tycho/pr/engine-atomic-fixes
engine: use atomics for setting live pitch and spatialization variables
2021-03-10 17:29:23 +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) 3a31faf8f0 Fix linker error when MA_NO_RESOURCE_MANAGER is defined 2021-03-10 06:43:57 +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
Steven Noonan 7a1cc44170 atomics: use "const" pointers for the load-only atomics on MSVC
Signed-off-by: Steven Noonan <steven@uplinklabs.net>
2021-03-09 10:53:33 -08:00
Steven Noonan 6c4937f495 engine: use atomics for setting live pitch and spatialization variables
Thread Sanitizer was unhappy about these variables being modified on one
thread and read on another (data race).

Signed-off-by: Steven Noonan <steven@uplinklabs.net>
2021-03-09 04:46:47 -08:00
David Reid 53eed5b5f2 Silence some -Wmaybe-uninitialized warnings. 2021-03-09 20:51:31 +10:00
David Reid 9c761921ab Try fixing an infinite loop. 2021-03-09 19:28:13 +10:00
David Reid 61f5d4e027 Fix a typo. 2021-03-06 18:55:47 +10:00
Steven Noonan a5db7b6574 resource manager: fix tree hierarchy when removing nodes
Signed-off-by: Steven Noonan <steven@uplinklabs.net>
2021-03-06 08:49:10 +10:00
David Reid 91b4b62bf5 Minor clean up. 2021-03-06 08:42:25 +10:00
Steven Noonan 22414f8c01 miniaudio_engine: fix sample rate conversion for sounds
Signed-off-by: Steven Noonan <steven@uplinklabs.net>
2021-03-06 08:40:39 +10:00
David Reid 062f150dc4 Fix a typo. 2021-03-05 17:39:46 +10:00
David Reid a06ca7ee04 Prevent a division by zero. 2021-03-04 17:19:23 +10:00
David Reid f8dd3780a2 Fix a typo. 2021-03-04 17:12:58 +10:00
David Reid 55e4e59bfa Add support for configuring rolloff. 2021-03-03 17:29:46 +10:00
David Reid c2c32ed1d7 Fix a typo. 2021-03-01 17:39:03 +10:00
David Reid 85cd9c1848 Fix a bug with ma_resource_manager_data_stream relating to seeking. 2021-02-28 06:49:36 +10:00