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
045ee8ae18
Experimental fix for a memory leak in the resource manager.
2021-03-21 09:38:21 +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
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
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
morlad (iLeitgeb)
3a31faf8f0
Fix linker error when MA_NO_RESOURCE_MANAGER is defined
2021-03-10 06:43:57 +00: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
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
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
85cd9c1848
Fix a bug with ma_resource_manager_data_stream relating to seeking.
2021-02-28 06:49:36 +10:00
David Reid
fc8f50457d
Fixes to the C89 build.
2021-02-20 08:30:08 +10:00
David Reid
f27a330a32
Experiment with improving async decoding on the Emscripten build.
2021-02-07 08:10:41 +10:00
David Reid
b8f00dc4f9
Disable threading on the Emscripten build when init-ing the engine.
2021-02-07 07:51:43 +10:00
David Reid
1e0ccd6201
Fix a bug with start and stop times.
2021-02-05 22:11:12 +10:00
David Reid
2e32eca6dd
Ensure the engine device uses ma_format_f32 for it's format.
2021-02-05 20:54:23 +10:00
David Reid
553c7f0093
Add some new APIs.
...
* ma_sound_set_start_time_in_milliseconds()
* ma_sound_set_stop_time_in_milliseconds()
* ma_sound_group_set_start_time_in_milliseconds()
* ma_sound_group_set_stop_time_in_milliseconds()
2021-02-05 20:29:06 +10:00
David Reid
76640272be
Rename some APIs for consistency with other APIs.
...
* ma_sound_set_fade_in_frames() > ma_sound_set_fade_in_pcm_frames()
* ma_sound_get_time_in_frames() > ma_sound_get_time_in_pcm_frames()
* ma_sound_set_start_time() > ma_sound_set_start_time_in_pcm_frames()
* ma_sound_set_stop_time() > ma_sound_set_stop_time_in_pcm_frames()
* ma_sound_group_set_fade_in_frames() > ma_sound_group_set_fade_in_pcm_frames()
* ma_sound_group_get_time_in_frames() > ma_sound_group_get_time_in_pcm_frames()
* ma_sound_group_set_start_time() > ma_sound_group_set_start_time_in_pcm_frames()
* ma_sound_group_set_stop_time() > ma_sound_group_set_stop_time_in_pcm_frames()
2021-02-05 19:33:37 +10:00
David Reid
cc2365b2b8
Fix a warning due to use of non-standard functionality.
2021-02-05 19:19:33 +10:00
David Reid
59db61d9f3
Add ma_sound_get_engine().
2021-02-05 19:17:28 +10:00
David Reid
fbb953ff01
Fix an unused variable warning.
2021-02-05 18:30:23 +10:00
David Reid
3265107cbd
Fix a bug in ma_sound_is_playing().
...
This bug is due to the current time not being taken into account when
determining the node state.
Public issue https://github.com/mackron/miniaudio/issues/269
2021-02-05 17:16:30 +10:00
David Reid
1bd587e59f
Fix the C++ build.
2021-01-31 19:52:35 +10:00
David Reid
626463a13e
Fix a bug where a base node is being uninitialized twice.
2021-01-29 17:40:14 +10:00
David Reid
6281ed3165
Add some optimizations to inlined sounds.
2021-01-28 17:59:28 +10:00
David Reid
0f29839549
Remove the notification parameter from ma_sound_init_from_file().
...
This is buggy and unsafe. A complete rethink of the resource management
notification system needs to be done.
2021-01-28 17:46:09 +10:00
David Reid
8f6f72f188
Fix compilation error.
2021-01-27 18:12:58 +10:00
David Reid
8cd72f46a0
Temporary hack to fix some clicking glitches relating to resampling.
2021-01-26 17:21:31 +10:00
David Reid
243df7ebe0
Fix a copy/paste bug in ma_sound/group_set_positioning().
2021-01-26 15:12:04 +10:00
David Reid
a364b4ef96
Fix a bug with pitch shifting.
...
This bug results in the first period of samples being pitched at 1.0
regardless of whether or not ma_sound_set_pitch() had been called. What
happens is that the first period is processed at a rate of 1.0, and
then the pitch is applied after the fact. Then, the next period comes
along and resamples at the pitch set by ma_sound_set_pitch() which
results in a harsh sounding glitch.
2021-01-26 09:27:49 +10:00
David Reid
9fcb167476
Fix a bug relating to doppler pitching.
2021-01-26 08:20:51 +10:00
David Reid
bd80a409d3
Remove some stale and misleading comments.
2021-01-25 16:04:53 +10:00
David Reid
78910a922a
Simplify some APIs.
2021-01-25 15:39:42 +10:00
David Reid
d571435566
Remove a debugging printf().
2021-01-25 15:02:55 +10:00
David Reid
cfff5f3192
Add support for angular attenuation to the spatializer.
2021-01-25 15:01:40 +10:00
David Reid
525dd7cb23
Add support for multiple listeners.
2021-01-25 11:38:18 +10:00
David Reid
33025bace2
Add support for doppler effect to the engine.
2021-01-25 10:12:05 +10:00
David Reid
4cdd892c54
Prep work in preparation for doppler effect.
2021-01-25 09:18:22 +10:00
David Reid
9677cdc1e9
Initial work on spatialization.
...
This does not yet support the following:
* Cone based attenuation
* Doppler effect
* Multiple listeners
2021-01-24 21:06:15 +10:00
David Reid
8bd061b6c8
Add support for channel maps to ma_convert_pcm_frames_channels_f32().
2021-01-24 16:54:33 +10:00
David Reid
f040e3a1c1
Clean up in preparation for some spatialization work.
2021-01-24 09:03:32 +10:00
David Reid
722089d928
Fix the duplex_effect example.
...
This had the naming of source and excite the wrong way around.
2021-01-24 09:00:43 +10:00
David Reid
9ab7866237
Minor changes to resource_manager_advanced example.
2021-01-22 09:32:54 +10:00