bjorn
90b33572e1
Use WebGL buffer path on AMD GPUs;
...
AHHHHHHHHHHHHH
2021-04-13 10:52:28 -06:00
mcc
d558996206
Hold lock when changing geometry (prevents crash, see issue #403 )
2021-04-12 13:01:54 -06:00
bjorn
fa47ecbdd3
v0.15.0;
2021-04-11 08:57:11 -06:00
bjorn
7b7c3132b8
vrapi: Fix lovr.headset.animate flipping left hand;
2021-04-11 08:15:17 -06:00
bjorn
70bbbc4549
Use pulseaudio on linux;
2021-04-11 07:19:49 -06:00
bjorn
046762c564
WebXR: Fix isDown; Fix hand tracking;
2021-04-10 19:41:37 -06:00
bjorn
d2a9e230bf
Rework Sound:getFrames;
...
It follows a more predictable argument order.
Fixed crash when reading frames into Blob.
2021-04-05 12:52:16 -06:00
bjorn
1ef99882f7
Fix Mesh vertex map memory leak;
2021-04-05 10:24:43 -06:00
bjorn
f565a7b69b
rm linking to OpenSLES;
2021-04-03 18:42:34 -06:00
bjorn
df6b6516d6
Add required Oculus manifest entries; Add debuggable;
2021-04-03 18:42:34 -06:00
bjorn
3b61dfc8c9
miniaudio: Use AAudio instead of OpenSL;
2021-04-03 18:42:34 -06:00
bjorn
419f281291
rm oculus go support; add oculus quest 2 support;
...
Rest in pieces, oculus gone.
2021-04-03 18:42:34 -06:00
bjorn
5106aaf74c
Audio listener/source default to identity orientations;
2021-04-03 18:38:27 -06:00
bjorn
2b94bcb46e
Add quat_identity;
2021-04-03 18:38:23 -06:00
bjorn
609d7e05ce
simple spatializer supports directivity;
...
Also coming soon to an oculus spatializer near you.
2021-04-03 18:22:23 -06:00
bjorn
19620c7682
wasm: Use default miniaudio buffer size.
...
Audio currently stutters on the wasm build. It is much more severe
in Chrome than in Firefox (very rare/subtle in Firefox). miniaudio
is currently using ScriptProcessorNode, which is deprecated because
it processes audio on the main thread. There's a new API that lets
you programmatically process audio on a thread called AudioWorklet,
but it's hella complicated. miniaudio doesn't want to support this
because it's complicated and requires a separate JavaScript request
but it seems like it would be possible to work around using a Blob.
In the meantime, miniaudio bumps up the buffer size on WebAudio, so
let's just use that in hope that it helps.
2021-04-03 18:04:26 -06:00
bjorn
efa48bda70
Manually disable a few miniaudio features;
2021-04-03 13:57:13 -06:00
bjorn
d32d9f6d67
Source directivity power defaults to 1;
2021-04-03 11:22:23 -06:00
bjorn
15975343ea
Sound:get/setFrames respects channel count;
2021-04-03 10:28:03 -06:00
bjorn
024498b964
Source:clone fixes;
...
Clones no longer try to create converters if they aren't needed, which
was causing an error.
Also handle malloc failure.
2021-04-03 09:49:27 -06:00
bjorn
4469fc99e8
Fix mixer bug; Refactor mixer;
...
- Sources without converters always read into the beginning of the
raw buffer, overwriting previous frames if the source was rewound
due to looping. This resulted in an audible click whenever the
source was rewound.
- After looping, Sources without converters would try to read too
many frames -- they would read a full buffer instead of only the
necessary number of frames.
2021-04-02 23:36:30 -06:00
bjorn
69b5c51388
Fix Sound:setFrames;
2021-04-02 23:35:18 -06:00
bjorn
6f6e7eea1b
Better newSound error messages;
2021-04-02 23:35:18 -06:00
bjorn
6ae0d9f96a
phonon works by default when no mesh is provided;
2021-04-02 23:35:18 -06:00
mcc
6b099e467f
Encapsulate "uses spatializer?" nature in lovrSourceUsesSpatializer
...
Also, remove accessor prototype for old IsSpatial() function
2021-04-02 14:16:39 -06:00
bjorn
0021c70f9f
luax_readmesh supports nested tables;
2021-04-01 18:48:37 -06:00
bjorn
82a309a56d
Draft new effects API;
...
- A list or map of effects can be provided to newSource.
- false can be used to bypass effects.
- All effects are enabled by default.
- Occlusion-y effects should only take effect when setGeometry is called
- Spatializer is responsible for ensuring this.
2021-04-01 16:46:16 -06:00
bjorn
923498a927
webxr: also support velocity of head device;
2021-03-31 22:47:26 -06:00
bjorn
72403de209
webxr: Add support for lovr.headset.getVelocity;
2021-03-31 22:37:29 -06:00
bjorn
35032bb21c
Upgrade miniaudio;
2021-03-31 22:32:16 -06:00
bjorn
441039db19
miniadio: Enable WebAudio backend;
2021-03-31 14:30:06 -06:00
bjorn
cfe0d71520
audio: throw if miniaudio fails to initialize;
...
This prevents a situation where miniaudio fails to initialize but the
audio module is still usable.
2021-03-31 14:01:30 -06:00
bjorn
0ef48d3d26
os_web: fix mouse support;
...
Not sure why this got removed.
2021-03-31 11:24:52 -06:00
bjorn
4a2c315bdb
Fix luax_readmesh with Model;
2021-03-30 12:48:18 -06:00
bjorn
eb8b559e88
phonon: Fix freeing incorrect variable;
2021-03-30 12:45:24 -06:00
Josip Miskovic
f6fbc2ad17
Route ODE messages into LOVR log system
...
ODE errors, debugs and messages are redirected into LOVR's log system
by a callback mechanism for each.
The ODE submodule is updated to revision that does not crash when error
or debug occurs.
2021-03-28 17:34:11 -06:00
bjorn
0daaca7a4f
Merge branch 'master' into dev
2021-03-28 10:09:58 -06:00
bjorn
e346c3f807
Fix standard shader precision issues;
...
- Reduce epsilon
- Also use epsilon in D_GGX
- Reduce shader string length to the minimum required supported length
2021-03-28 10:08:10 -06:00
bjorn
2b1b777e84
Fix crash when passing nothing to newTexture;
2021-03-26 20:02:38 -06:00
bjorn
948b77b7fa
phonon doesn't try to make a mesh if there are no vertices;
2021-03-26 10:30:08 -06:00
bjorn
0dfc80e42e
luax_readmesh assert for index range;
2021-03-26 10:23:24 -06:00
bjorn
61ef2747ee
World:newMeshCollider uses luax_readmesh;
...
This is a breaking API change -- instead of a table of tables, a flat
table of coordinates must be used.
2021-03-25 12:29:11 -06:00
bjorn
6413a6eda2
Fix Model:getTriangles; Add Lua API;
2021-03-25 12:29:11 -06:00
bjorn
fe0eedea20
luax_readtriangles -> luax_readmesh; Model support;
2021-03-25 12:29:11 -06:00
bjorn
e1195a92a0
lovrModelGetTriangles;
2021-03-25 12:29:11 -06:00
bjorn
3a35f81918
Fix underscores not printing;
...
Signed arithmetic strikes again. Before the padding was configurable,
padding was just a #define'd constant, so signedness didn't matter.
2021-03-25 12:18:48 -06:00
bjorn
895589c914
Add even more padding to stb zlib;
2021-03-24 21:13:04 -06:00
bjorn
fd39ed9420
os_android: fix improper cast;
2021-03-24 14:32:56 -06:00
bjorn
634e7210bf
Make Source:clone suck less;
2021-03-23 14:31:04 -06:00
bjorn
5ef5ac5f22
I am once again fixing the mixer EOF case;
2021-03-23 14:31:04 -06:00
bjorn
6a79ffb34a
rm Source::blend;
2021-03-23 14:31:04 -06:00
bjorn
de5099badd
rm SourceInterpolation;
2021-03-23 14:31:04 -06:00
bjorn
98f33dc131
mv falloff attenuation;
2021-03-23 14:31:04 -06:00
mcc
e3c2b5b865
Fix Android build
...
- Fix typos after refactor
- Fix CMake when using ANDROID_PACKAGE
2021-03-22 14:09:16 -06:00
bjorn
a1f768e1a3
lovr.audio.stop properly returns success;
2021-03-20 11:57:46 -06:00
bjorn
b1f7a6c11d
Add optional VolumeUnit to get/setVolume functions;
...
Volume can be specified in linear units or dB.
2021-03-19 17:20:48 -06:00
bjorn
c1c15c46db
Don't share ma_data_converters between Sources;
...
It causes distortions when resampling is involved.
2021-03-18 16:31:14 -06:00
bjorn
96e0cc8b9b
Fix mixer bug when reaching end of source;
2021-03-18 13:47:04 -06:00
bjorn
369bd5d8b4
Clamp source/listener volumes to 0-1 range;
...
Prevents miniaudio errors and horrible clipping on bad input.
2021-03-18 13:06:11 -06:00
bjorn
e677006581
newSource: typecheck second arg;
...
Errors when using old syntax instead of silently working/failing
2021-03-18 13:00:23 -06:00
bjorn
e008dd2323
Fix stb_vorbis bug with empty comment list files;
2021-03-18 12:43:36 -06:00
bjorn
0bb556554d
Probably work around stb_image bug that breaks zips;
...
30e01f upgraded stb_image to include its 95560b commit from its #960
pull request. This made stb_image fail more aggressively on EOF
conditions when refilling huffman buffers in deflate streams. I think
it might be failing _too_ aggressively, though. We are able to pad our
input compressed buffers since the zip file format is guaranteed to have
extra data at the end (for, e.g., the end of central directory record).
This appears to be sufficient to fix compressed zip archives for the
time being. It's possible that more virtual padding needs to be added,
and it may be good to try to fix this in stb_image itself.
2021-03-18 00:05:34 -06:00
bjorn
2d43620d3c
rm LOVR_ALIGN;
...
It isn't very portable, the effects aren't significant.
2021-03-15 18:56:02 -06:00
bjorn
e63099ba6a
Flatten api.h;
2021-03-15 18:54:27 -06:00
bjorn
f9f4907a50
phonon fixes;
2021-03-07 22:42:54 -07:00
bjorn
45e43bacb3
os_web fixes;
2021-03-07 22:04:23 -07:00
bjorn
0435694225
simple spatializer interpolation;
...
prevents snaps, crackles, and pops
2021-03-07 21:19:25 -07:00
bjorn
30a0556f1d
Fix oculus spatializer;
2021-03-07 21:19:24 -07:00
bjorn
deb756392b
Fix 'attempt to flush unmapped buffer' when creating empty Mesh;
2021-03-07 21:19:24 -07:00
bjorn
a3b791a7e7
Fix Canvas flushing;
2021-03-07 21:19:24 -07:00
mcc
9f0826e3b7
Add missing header in headset_oculus, this fixes a warning.
2021-03-05 15:07:18 -08:00
mcc
4bed6f6834
Fix crash on startup on Oculus driver
2021-03-05 15:07:18 -08:00
bjorn
6de00cf2b8
crush ico;
2021-03-04 19:24:33 -07:00
bjorn
058700f970
Allow lovr.audio.setDevice(type, nil);
2021-03-04 18:19:05 -07:00
bjorn
0c3351331e
Sink attempt;
2021-03-03 20:01:56 -07:00
bjorn
f806c07bfa
Simplify spatializer interface temporarily;
2021-03-03 15:49:28 -07:00
bjorn
bc41eecf09
oculus spatializer: free memory; use MAX_SOURCES
2021-03-03 15:46:01 -07:00
bjorn
8188e51060
lovr.audio.get/setAbsorption;
...
I HOPE THIS LETS US DO UNDERWATER EFFECT
2021-03-03 15:40:27 -07:00
bjorn
2c0875087f
Source:getSound;
2021-03-03 15:32:41 -07:00
bjorn
dd98b11b3f
Effect;
...
Basically replace each individual accessor with a general one.
2021-03-03 15:25:03 -07:00
bjorn
746735259c
Windows: Always use WinMain for UTF8 command line arguments;
...
This fixes problems with paths containing special characters on windows.
2021-03-02 11:49:08 -07:00
bjorn
dd0891d087
Fix simple spatializer;
2021-03-02 11:49:00 -07:00
bjorn
e1e21def82
More consistent spatializer symbol names;
2021-03-01 17:53:49 -07:00
bjorn
1c3a01de2a
Add windows icon;
2021-03-01 17:45:12 -07:00
bjorn
bb302c3336
Fix OpenXR hand tracking on Quest;
2021-03-01 11:55:27 -07:00
bjorn
cf4bb36d03
AudioMaterial;
2021-02-28 15:27:33 -07:00
mcc
d233d5ccd3
Fix MSVC build
...
- stdatomic.h had not defined ATOMIC_INT_LOCK_FREE, but it is now required
- It's _MSC_VER, not _MSVC_VER
2021-02-28 14:12:16 -08:00
bjorn
5f4e5c5721
rm Source:play loop shortcut;
2021-02-26 13:41:58 -07:00
bjorn
92492dcef1
rm spatial blend for now;
2021-02-26 13:24:01 -07:00
bjorn
cb1b78f2cc
Rename Source:get/setTime to Source:seek and Source:tell;
2021-02-26 13:21:40 -07:00
bjorn
7bb6861180
Source:get/setPosition; Source:get/setOrientation;
2021-02-26 13:10:59 -07:00
bjorn
f3482fc15a
lovr.audio.get/setPosition; lovr.audio.get/setOrientation;
2021-02-26 13:05:23 -07:00
bjorn
d1a2ded4db
Fix luaopen_lovr_filesystem stack index;
2021-02-25 16:29:52 -07:00
bjorn
f82e8112fe
Simplify filesystem arguments;
2021-02-25 10:45:45 -07:00
bjorn
a09b7de545
lovr.system.getCoreCount;
2021-02-25 09:30:05 -07:00
bjorn
4f5adbc64c
lovr.system;
2021-02-25 09:00:12 -07:00
bjorn
a94a1c22bf
simple spatializer uses physically correct attenuation;
...
This matches phonon.
2021-02-24 17:51:44 -07:00
bjorn
39a4d2c1d5
rm lovr.graphics.triangle;
2021-02-24 17:45:31 -07:00
bjorn
3055cd718c
rm shared sources;
2021-02-24 17:43:42 -07:00
bjorn
f47a688d53
phonon: configuration options;
2021-02-24 17:43:42 -07:00
bjorn
bec4fc3169
phonon: implement convolution reverb;
2021-02-24 17:43:42 -07:00
bjorn
ec96a126d7
phonon: accessors; multiple sources; start reverb;
2021-02-24 17:43:42 -07:00
bjorn
5f2cdf0c22
phonon: Directivity adjustments;
2021-02-24 17:43:42 -07:00
bjorn
f60d6c8900
phonon: I hate typing dipole;
2021-02-24 17:43:42 -07:00
bjorn
7f032b7a3e
phonon: Change absorption to a boolean;
2021-02-24 17:43:42 -07:00
bjorn
90ca17c454
phonon: Change falloff to a boolean;
2021-02-24 17:43:42 -07:00
bjorn
87bbec7018
phonon: setGeometry test;
2021-02-24 17:43:42 -07:00
bjorn
16cfb7bad5
phonon: binaural renderer, binaural effect, HRTF;
2021-02-24 17:43:42 -07:00
bjorn
ac96556a13
phonon: Source:get/setDirectivity;
2021-02-24 17:43:42 -07:00
bjorn
66e574baac
phonon: Source:get/setAbsorption;
2021-02-24 17:43:42 -07:00
bjorn
c531243d7d
phonon: Source:get/setFalloff;
...
The falloff is the minimum distance at which inverse distance
attenuation takes place.
A non-positive value disables distance attenuation.
In the Lua API, nil can be used to disable attenuation, a boolean can be
used to enable attenuation with a default minimum distance, or a number
can be used for full control over the parameter.
2021-02-24 17:43:42 -07:00
bjorn
0af7e98fad
phonon: rearrange Source accessors;
2021-02-24 17:43:42 -07:00
bjorn
584138c937
phonon: Compute listener/source basis vectors;
2021-02-24 17:43:42 -07:00
bjorn
f4a8a4d388
WIP;
2021-02-24 17:43:42 -07:00
bjorn
8bbb092497
Start phonon spatializer;
2021-02-24 17:43:42 -07:00
bjorn
5d542eb2ea
Minor Sound cleanup;
2021-02-24 14:11:49 -07:00
bjorn
7d0dfc9cdd
Sound: Ambisonic support;
...
Add support for importing ambisonic WAV files and 24/32 bit PCM WAV files.
The standard ambisonic format used internally in LÖVR is ACN channel ordering with SN3D normalization.
Anything else will be converted to this form.
There are a few restrictions and assumptions:
- Only 1st order ambisonics are supported. They need to have 4 channels.
- They can be in AMB format (Furse-Malham order/normalization), detected via WAVE_EXTENSIBLE GUID.
- Any other 4 channel file is assumed to be in "AmbiX" ACN/SN3D format.
- It seems that most ambisonic files in the wild that claim to be AmbiX are just 4 channel WAVs without any metadata.
- This means that non-ambisonic 4 channel WAVs could ambiguously be mistaken as ambisonic. This is incurred as a limitation of LÖVR.
- Ambisonic files can not currently be played back. SteamAudio currently has numerous bugs with this.
- Perhaps it would be possible to write an ambisonic rotator/panning decoder to use as a default implementation.
2021-02-24 14:11:49 -07:00
bjorn
1d1a2de124
Only use CTZL in audio;
2021-02-24 14:11:49 -07:00
bjorn
72a54bce2f
Support STL models;
...
Only binary STL files are supported right now, ASCII is more challenging.
2021-02-23 12:07:16 -07:00
bjorn
a430ae06b8
Early-reject OBJ files;
...
OBJ files must start with a vertex, object, mtllib, or comment.
2021-02-23 12:05:11 -07:00
bjorn
f1922e22c8
Sharpen nogame screen;
2021-02-22 17:53:47 -07:00
bjorn
1145085446
macOS fixes;
2021-02-22 17:07:28 -07:00
bjorn
fb1447503b
Fix gcc warnings;
2021-02-19 23:44:23 -07:00
bjorn
ef438d48b3
Upgrade stb_vorbis;
2021-02-19 23:44:23 -07:00
mcc
ffa63e9912
Allow the creation of a (potentially infinite-length) Sound created by a dynamically run callback
2021-02-19 21:30:16 -07:00
bjorn
57a215a0aa
Minor MeshShape cleanup;
...
- Fix memory leak
- Minor error message improvements
2021-02-19 17:28:04 -07:00
bjorn
880d06a1d1
Only enable compute extensions on desktop GL;
2021-02-19 14:09:40 -07:00
bjorn
1757d30a59
Compute shader feature detection adjustment;
...
- Compute feature requires compute shaders, image load/store, and SSBOs.
- GLSL 330 is always used, instead of changing depending on compute shader extension.
- Explicitly enable compute shaders, image load/store, and SSBO extensions when needed.
This allows implementations that don't support GLSL 430 to run compute shaders,
and keeps the min supported GL version more consistently at GL3.3.
2021-02-19 14:07:27 -07:00
bjorn
a0b2200bef
Fix lovr.graphics.getBlendMode when blending is off;
2021-02-19 14:05:18 -07:00
bjorn
26d009aada
Fix sample conversion when only channel count conversion is required;
2021-02-19 12:35:52 -07:00
bjorn
9c1af7427f
Fix restart cookie on wasm;
2021-02-19 09:06:16 -07:00
bjorn
a2b7e1619d
Fix wasm compilation issues;
2021-02-19 09:05:57 -07:00
bjorn
0365f51f9d
Fix crash when drawing zero lines;
2021-02-19 08:38:45 -07:00
bjorn
7ef215c312
simulator: fix aspect ratio;
2021-02-19 08:30:57 -07:00
bjorn
6c74a61ae3
simulator: Fix getDisplayDimensions;
...
getDisplayDimensions is supposed to return the dimensions of one eye.
2021-02-19 08:29:38 -07:00
bjorn
36170678f0
Sound: Change channel count to channel layout;
2021-02-18 21:17:25 -07:00
bjorn
08916df2f1
Tell spatializers about sources only when they're active;
...
apply will still only be called with sources after they have been created.
2021-02-18 20:49:20 -07:00
bjorn
952fee3bd1
Rework audio converters;
...
They are stored by value in the array so they are contiguous.
Source stores the index of its converter to save a bit of space and avoid realloc.
2021-02-17 22:47:50 -07:00
bjorn
7b7f6bbaeb
Simplify FOREACH_SOURCE;
2021-02-17 22:36:24 -07:00
bjorn
cb8a1e8962
Free playing Sources properly;
2021-02-17 22:31:03 -07:00
bjorn
75fda2336f
Enforce strict limit of 64 active sources;
...
If 64 sources are playing and a new one is started, Source:play will
return false.
Instead of a linked list, a static list of 64 Sources is used.
Bit scanning intrinsics are used to efficiently iterate the list,
using a mask (still deciding on this).
2021-02-17 20:46:33 -07:00
bjorn
ea64f32c1f
Source:clone;
2021-02-16 21:34:53 -07:00
bjorn
8cc96847a8
Fix sign warnings;
2021-02-16 21:02:12 -07:00
mcc
a3c76a95ab
Two additional arguments to shaderBlock:send(): an offset and a size. If present, only part of the shaderBlock will be sent.
2021-02-16 17:26:18 -07:00
bjorn
72284c2c5b
Merge branch 'master' into dev
2021-02-12 08:16:36 -07:00
bjorn
023067ec27
util.h no longer uses atomics;
2021-02-11 16:37:55 -07:00
bjorn
28e88d7598
Reorganize spatializer files/CMake; Oculus Audio tup support;
2021-02-10 12:41:15 -07:00
bjorn
5ae5acfb18
Make Font texture rgba16f;
...
Sampling from rg11b10f does not appear to work on mobile.
2021-02-10 15:22:30 -07:00
bjorn
0919da4091
Improve MSDF font shader; Add spread/padding settings to Font;
2021-02-10 07:08:29 -07:00
bjorn
7b136b914c
Update msdfgen;
...
- Rasterizer (maybe temporarily) uses 32 bit float textures.
2021-02-10 04:03:43 -07:00
bjorn
f8ed6c3a34
physics: Use dReal in more places;
...
This makes it easier to swap between float/double.
2021-02-09 23:24:27 -07:00
bjorn
b343f50f1c
mv l_data_textureData->l_data_image;
2021-02-09 21:14:09 -07:00
bjorn
351d1ae200
Fix vrapi includes;
2021-02-09 20:03:53 -07:00
bjorn
50ee404b91
Default lovr.run no longer requires timer and event modules;
2021-02-09 08:27:11 -07:00
bjorn
7db979b655
Fix arr_free;
...
realloc(NULL, 0) isn't valid.
2021-02-09 08:15:43 -07:00
bjorn
9377406854
Fix font wrap issue with spaces;
...
If a space starts before the wrap limit, but ends after it, the next
word won't wrap properly even though it should.
2021-02-09 08:06:37 -07:00
bjorn
39c0fa6e99
Don't set audio listener pose automatically;
...
It isn't always correct once you add locomotion to a project, and
it actually becomes harmful because the pose ping-pongs between
the default pose and the user pose, causing distortion.
2021-02-09 07:52:12 -07:00
bjorn
84f65c26e4
Move utf8 back into util;
2021-02-08 20:55:51 -07:00
bjorn
907cf35dda
rm string.h from api.h;
2021-02-08 20:29:57 -07:00
bjorn
78ddcf7d6e
rm extra reference to AudioStream;
2021-02-08 20:24:21 -07:00
bjorn
8164e0b6e8
TextureData is now named Image!;
...
The existing Image construct was renamed StorageImage.
2021-02-08 20:17:47 -07:00
bjorn
dca79f83f0
SoundData is now named Sound!;
2021-02-08 19:52:56 -07:00
bjorn
8c714c45b0
Clean up some includes;
2021-02-08 11:16:00 -07:00
bjorn
0e318aa46e
Make Rasterizer opaque;
2021-02-08 10:58:39 -07:00
bjorn
6d92d54079
Try having arr_t in util;
2021-02-08 18:25:05 -07:00
bjorn
bc4cde1653
Adjust lovrRelease signature;
2021-02-08 17:52:26 -07:00
bjorn
3ded60948f
rm core/ref; rm lovrAlloc; util does refcounting;
2021-02-08 17:26:44 -07:00
bjorn
1c3e29b3e5
Start windows atomics;
2021-02-08 16:50:43 -07:00
bjorn
4f5f5b2289
Start stdatomic.h shim;
2021-02-08 16:50:43 -07:00
bjorn
ccc53a10aa
Cleanup;
2021-02-08 16:08:29 -07:00
bjorn
0877edf9d1
Fix capture;
2021-02-08 16:08:29 -07:00
bjorn
8bf0acd2eb
Add minimp3;
2021-02-08 16:08:29 -07:00
bjorn
2c37bd1a58
Only enable specific miniaudio backends;
...
Start with a conservative set, expand as needed.
2021-02-08 16:08:29 -07:00
bjorn
1995aae7e9
Simplify enumeration more;
2021-02-08 16:08:29 -07:00
bjorn
d1801cfcde
Fix Source:getTime;
2021-02-08 16:08:29 -07:00
bjorn
ab81361494
Require an argument for an audio device id;
...
(It can still be nil or a non-userdata value to use the default)
2021-02-08 16:08:29 -07:00
bjorn
60809268e7
Add the ability to request exclusive access to an audio device;
2021-02-08 16:08:29 -07:00
bjorn
111a376a2e
SoundData;
2021-02-08 16:08:29 -07:00
bjorn
e0ac328a72
SoundData WIP; WAV importer;
2021-02-08 16:08:29 -07:00
bjorn
e3e7b265a3
Add the ability to opt-out of default output device initialization;
2021-02-08 16:08:29 -07:00
bjorn
782c22448e
Mixer fast paths;
...
- If no converter is needed, don't create/use it
- If no spatialization is needed, don't copy
In the best case, samples willi now be read into a buffer and immediately mixed into the output.
2021-02-08 16:08:29 -07:00
bjorn
177a94738d
48khz sample rate; fixes;
2021-02-08 16:08:29 -07:00
bjorn
93ea56155e
scribbling;
2021-02-08 16:08:29 -07:00
bjorn
025865461c
Cleanup;
2021-02-08 16:08:29 -07:00
bjorn
13e100275e
Fix style issues;
2021-02-08 16:08:29 -07:00
bjorn
68f5bb3095
Fix style issues;
2021-02-08 16:08:29 -07:00
bjorn
cb8e1b5b91
Fix compile errors;
2021-02-08 16:08:29 -07:00
bjorn
a3a5b29d6d
Minor style changes;
2021-02-08 16:08:29 -07:00
mcc
f515d8e84f
Code review adjustments (code clarity, constness) for oculus spatializer
2021-02-08 16:08:29 -07:00
mcc
46bb053e0f
Late changes on oculus spatializer: Fix memory corruption bug on source delete, add comment
2021-02-08 16:08:29 -07:00
mcc
9ba4037e74
LOVR_USE_OCULUS_AUDIO
...
This is a large patch which adds a new Oculus Audio spatializer. Oculus Audio is slightly different from the dummy spatializer in a few ways:
- It *must* receive fixed-size input buffers, every time, always.
- It can only handle a fixed number of spatialized sound sources at a time.
- It has a concept of "tails"; the spatialization of a sound can continue after the sound itself ends (eg echo).
Changes to audio.c were needed to support Oculus Audio's quirks:
- audio.c now supports a "fixedBuffer" mode which invokes the generator/spatializer in fixed size chunks
- Each source now has an intptr_t "memo" field that the spatializer may use to store whatever (Oculus spatializer uses this to handle the sound source limit).
- The spatializer interface got a couple new methods: A "tail" method which returns a sound buffer after all sources are processed; and "create" and "destroy" methods that are called when a sound source is created or destroyed (Oculus spatializer uses this to populate/clear the "memo" field).
Along the way some other miscellaneous changes got made:
- lovr.audio.getSpatializerName() returns the current spatializer
- Spatializer init now takes in "config in" and "config out" structs (Spatializer changes fields in config out to request things, currently fixed buffer mode).
- lovr.conf now takes t.audio.spatializer (string name of desired spatializer) and t.audio.spatializerMaxSourcesHint (Spatializers with max sources limits like Oculus will use this as the limit).
- audio.c went back to tracking position/orientation as vectors rather than a matrix
- A file oculus_spatializer_math_shim.h was added containing a minimal copypaste of OVR_CAPI.h from Oculus SDK to support a ovrPoseStatef the spatializer API needs. This may have license consequences but we are probably OK via a combination of fair use and the fact that a user cannot use this header file without accepting Oculus's license through other means.
Some work remains to be done, in particular there is an entire reverb feature I did not touch and LOVR_USE_OCULUS_AUDIO cannot be activated from tup. Oculus Spatializer works better when it has velocity and time information but this patch does not supply it.
2021-02-08 16:08:29 -07:00
mcc
bbf26ad4eb
LOVR_DEBUG_AUDIOTAP debug helper in audio.c
2021-02-08 16:08:29 -07:00
mcc
fb2d4fe0ca
Fix build on MSVC2019 (ptr arithmetic on void * is nonstandard)
2021-02-08 16:08:29 -07:00
Nevyn Bengtsson
5cc33b3ee5
oops, use capture device for capture, not playback
2021-02-08 16:08:29 -07:00
Nevyn Bengtsson
d618a2e629
lovr.audio.isRunning
2021-02-08 16:08:29 -07:00
Nevyn Bengtsson
f5a684f359
Fix broken listener orientation code in dummy spatializer
...
it's a quat, not an axis-angle. now it works :)
2021-02-08 16:08:29 -07:00
Nevyn Bengtsson
84bfac984c
l_audio: less code
...
why is this so hard for my brain? :S
2021-02-08 16:08:29 -07:00
Nevyn Bengtsson
7f5e46ad0b
audio: don't uninit device on stop
...
in case initing a device is expensive, don't do it
unnecessarily, and treat 'stop' as more of a 'pause'.
2021-02-08 16:08:29 -07:00
Nevyn Bengtsson
c542be254e
setDevice fix on android
2021-02-08 16:08:29 -07:00
Nevyn Bengtsson
2719eba1ba
lovrAudioSetCaptureFormat
...
instead of mixing up using device with using format
2021-02-08 16:08:29 -07:00
Nevyn Bengtsson
49288b7547
ma_result_descripion all the things
2021-02-08 16:08:29 -07:00
Nevyn Bengtsson
a7b0780bfc
Don't allow invalid sample format
2021-02-08 16:08:29 -07:00
Nevyn Bengtsson
9ba8638028
Audio: Simplify enabled/started/reset
...
* Stop also uninitializes
* Reset doesn't exist. Just stop and start instead.
* lovrAudioInit no longer takes config, and config is now private.
Call lovrAudioStart if you want to start.
* ma_device_{un}init and start/stop are only called from one place each,
reducing the risk of dangling state
2021-02-08 16:08:29 -07:00
Nevyn Bengtsson
138853ef01
Fix getDevices API
...
* Takes device type, so you only get either playback or capture devices
* Doesn't store devices in state, reducing risk of dangling pointers
* Uses names instead of identifiers, since miniaudio identifiers become
invalid if you call "getDevices" again
* Better diagnostics
* Split up lovrAudioInitDevice to be per-type, cleaner that way
* UseDevice now takes type and name, instead of just identifier
2021-02-08 16:08:29 -07:00
Nevyn Bengtsson
9c7bc7c8db
stub out pico permissions so we can compile
2021-02-08 16:08:29 -07:00
Nevyn Bengtsson
a5d073c5db
stop void* arith
2021-02-08 16:08:29 -07:00
Nevyn Bengtsson
9ea635199d
Forgot a return...
2021-02-08 16:08:29 -07:00
Nevyn Bengtsson
10af0e5748
oops, capturing with wrong bytesPerFrame
2021-02-08 16:08:29 -07:00
Nevyn Bengtsson
46e9ae8ef5
oops
2021-02-08 16:08:29 -07:00
Nevyn Bengtsson
5fcaad9bde
Change mic capture API to return SoundData stream instead of individual chunks
2021-02-08 16:08:29 -07:00
Nevyn Bengtsson
044a5a47d9
allow configuring sound format and sample rate
2021-02-08 16:08:29 -07:00
Nevyn Bengtsson
035f48927a
fix various audio logging
2021-02-08 16:08:29 -07:00
Nevyn Bengtsson
f98140c601
make converters array one of pointers
...
so that converters are allocated on heap and the converters
array can be expanded later without moving the converter
itself
2021-02-08 16:08:29 -07:00
Nevyn Bengtsson
f8c29d1c79
bump to miniaudio with Quest fix
...
This is a WIP version v0.10.28 aka 6c60953e9cb587
2021-02-08 16:08:29 -07:00
Nevyn Bengtsson
8133966148
take out lovrDataNewSoundDataStream
2021-02-08 16:08:29 -07:00
Nevyn Bengtsson
0d36cdd443
nicer assert in sound data append
2021-02-08 16:08:29 -07:00
Nevyn Bengtsson
213c721d1f
oops
2021-02-08 16:08:29 -07:00
Nevyn Bengtsson
eee1d09cc4
SoundDataSetSample: only allowed on raw; and check frames instead of blob size
2021-02-08 16:08:29 -07:00
Nevyn Bengtsson
5df40bb103
don't try to forward-declare mb_pcm_rb
2021-02-08 16:08:29 -07:00
Nevyn Bengtsson
e1c94c3084
stop depending on audio from data
2021-02-08 16:08:29 -07:00
Nevyn Bengtsson
8b594332dc
Revert miniaudio to 0.10.12
...
aka a9541579f38a0c1bab4bba294f3602fa0b80f127, plus cherry-pick of
2dc604ecde0f02280690c72f943bfb8bf52dd820.
There is a crasher in 0.10.13 and newer on Oculus Quest
(See https://github.com/mackron/miniaudio/issues/247 )
2021-02-08 16:08:29 -07:00
Nevyn Bengtsson
d8dd09eb8d
oops, initialize source's transform
...
otherwise we'll get NaNs up in here
2021-02-08 16:08:29 -07:00
Nevyn Bengtsson
6d62e634d4
oops
2021-02-08 16:08:29 -07:00
Nevyn Bengtsson
e46079b368
lovrAudioUseDevice
2021-02-08 16:08:29 -07:00
Nevyn Bengtsson
9381e2027d
audio.getDevices full impl
2021-02-08 16:08:29 -07:00
Nevyn Bengtsson
ebcc5f51d7
Devices WIP
2021-02-08 16:08:29 -07:00
Nevyn Bengtsson
53d3568528
don't assert on audio thread
2021-02-08 16:08:29 -07:00
Nevyn Bengtsson
3e003d55b9
Separate SoundData and SoundDataStrema constructors
...
they take the same arguments so we can't overload
the function parameterically.
also I find it pretty confusing that lovr uses
overloads so much in the api,
so I really don't mind having
a separate constructor :S
2021-02-08 16:08:29 -07:00
Nevyn Bengtsson
35ac33f184
SoundData:setSample
2021-02-08 16:08:29 -07:00
Nevyn Bengtsson
f5fcb73324
duration and time for stream sounddata
2021-02-08 16:08:29 -07:00
Nevyn Bengtsson
8c1aa5a8ef
lua API for SoundData:append
2021-02-08 16:08:29 -07:00
Nevyn Bengtsson
2a875b129b
Fix a few bugs and style fixes
...
* We can't realloc converters, that'll break internal pointers
* inverted condition in an assert
* less magic numbers
* can't loop streams
2021-02-08 16:08:29 -07:00
Nevyn Bengtsson
3c535986f0
SoundData: deallocate rb
2021-02-08 16:08:29 -07:00
Nevyn Bengtsson
d1f6e27437
SoundData stream lua API
2021-02-08 16:08:29 -07:00
Nevyn Bengtsson
7b58561c03
lovrSoundFormat
2021-02-08 16:08:29 -07:00
Nevyn Bengtsson
cd1cddcd93
WIP streaming SoundData
...
It seems Bjorn had the idea to back SoundData with
an array of buffers, so I'm running
with that but changing the array
into a ringbuffer.
2021-02-08 16:08:29 -07:00
Nevyn Bengtsson
55b5a9947c
audio_internal.h with some shared utilities
2021-02-08 16:08:29 -07:00
Nevyn Bengtsson
381e3f3850
Bump miniaudio to 0.10.27
...
aka caad0bc436ade1633cdc47892bd0d9a36623a298
2021-02-08 16:08:29 -07:00
Nevyn Bengtsson
f7d027a3ce
Audio permissions seem to work without AppCompat
2021-02-08 16:08:29 -07:00
Nevyn Bengtsson
7efc855929
Fix various Capture bugs
2021-02-08 16:08:29 -07:00
Nevyn Bengtsson
1e05f29da4
Fix broken SoundData _Reg
2021-02-08 16:08:29 -07:00
Nevyn Bengtsson
33e4524fd8
oops, this method can't use assert...
...
because then mic capture can't use the failure to trigger a permissions check
2021-02-08 16:08:29 -07:00
Nevyn Bengtsson
8678414628
audio_capture -> audiocapture
...
to follow ENTRY naming standard
2021-02-08 16:08:29 -07:00
Nevyn Bengtsson
d4a5e06932
no need for a capture lock
2021-02-08 16:08:29 -07:00
Nevyn Bengtsson
e05d554528
review: fprintf -> lovrAssert
2021-02-08 16:08:29 -07:00
Nevyn Bengtsson
ebf5fbef24
state.spatializer must never be null
2021-02-08 16:08:29 -07:00
Nevyn Bengtsson
cdbefafc1a
review: style fixes
2021-02-08 16:08:29 -07:00
Nevyn Bengtsson
5e66ecf000
lovrPlatformRequest{AudioCapture->Permission}(Perm) + platform stubs
2021-02-08 16:08:29 -07:00
Nevyn Bengtsson
084ac9d880
review: newSource() gets options table
2021-02-08 16:08:29 -07:00
Nevyn Bengtsson
b7b63a268b
review: getSpatial > isSpatial
2021-02-08 16:08:29 -07:00