Commit Graph

168 Commits

Author SHA1 Message Date
bjorn fcac1b13bf Fix bug in dmon_deinit;
Stale state prevented library from working when reinitialized.
2024-05-27 03:08:38 -07:00
bjorn 9301c73f14 Live reloading;
Use -w or --watch to watch source directory for changes and call
lovr.filechanged when a file is changed.

By default lovr.filechanged will restart lovr.

It's powered by lovr.filesystem.watch/lovr.filesystem.unwatch functions,
but these are currently hardcoded to only watch the whole source folder.

Currently there is a bug where it only restarts on the first change,
this is seemingly a problem with dmon.
2024-05-27 03:08:38 -07:00
bjorn 1701409763 threads polyfill defines thread_local;
Might need to be removed for C23.
2024-02-28 12:31:34 -08:00
bjorn 35b5693a19 Add some more windows atomics; 2024-02-28 12:31:34 -08:00
bjorn 4a175c4cf8 Fix atomic intrinsics; 2024-02-28 12:31:34 -08:00
bjorn 19ac219b0c Add File object; 2023-11-21 18:49:32 -08:00
bjorn f50e9f6fe1 Use miniz to decompress files; 2023-11-21 18:49:32 -08:00
bjorn 1d91ea1fde Replace tinycthread with C11 threads.h polyfill; 2023-09-21 23:26:16 -07:00
bjorn 2144b5f81d Backport Lua utf8 library; 2023-02-03 23:17:43 -08:00
bjorn b8b40bac40 Update stb_image to 2.28; 2023-01-31 18:20:26 -08:00
bjorn 37221afbc6 rm graphics module; 2022-04-21 17:39:58 -07:00
bjorn b115e5865f Fix miniaudio warning; 2022-03-30 21:15:51 -07:00
bjorn e47f3eb108 Use doubles for noise; 2022-03-27 14:51:06 -07:00
bjorn f347ac98d9 Switch to simplex noise;
Pending test
2022-03-27 01:21:52 -07:00
bjorn 20caeca69a Upgrade miniaudio; 2022-03-23 10:57:30 -07:00
bjorn b132eaf889 Patch tinycthread to work with Visual Studio C11; 2022-03-20 01:42:31 -07:00
bjorn 998b355e30 Make some private functions static; 2021-10-31 12:35:49 -07:00
bjorn ecd7769ba0 Convert Tupfile to Lua; 2021-07-18 22:24:00 -07:00
Nevyn Bengtsson ff4f594a62 switch back from aaudio to opensl
because capture on quest is broken with miniaudio's aaudio backend :/
2021-05-31 09:07:38 -06:00
bjorn 51f81c9db6 Switch back to ALSA on Linux; 2021-04-27 22:20:56 -06:00
bjorn 87bf9c7b27 Merge branch 'master' into dev 2021-04-27 22:20:38 -06:00
bjorn 4a4aff210d Upgrade miniaudio; 2021-04-27 22:17:07 -06:00
bjorn 70bbbc4549 Use pulseaudio on linux; 2021-04-11 07:19:49 -06:00
bjorn f565a7b69b rm linking to OpenSLES; 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 efa48bda70 Manually disable a few miniaudio features; 2021-04-03 13:57:13 -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 e008dd2323 Fix stb_vorbis bug with empty comment list files; 2021-03-18 12:43:36 -06: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 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
bjorn 72284c2c5b Merge branch 'master' into dev 2021-02-12 08:16:36 -07:00
bjorn 0e318aa46e Make Rasterizer opaque; 2021-02-08 10:58:39 -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 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 93ea56155e scribbling; 2021-02-08 16:08:29 -07:00
bjorn 13e100275e Fix style issues; 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
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 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 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 381e3f3850 Bump miniaudio to 0.10.27
aka caad0bc436ade1633cdc47892bd0d9a36623a298
2021-02-08 16:08:29 -07:00
Nevyn Bengtsson 2317ae31cd miniaudio: cherry-pick 2dc604ecde0f02280690c72f943bfb8bf52dd820
This fixes capture on linux/pulseaudio
2021-02-08 16:08:29 -07:00
bjorn 40cffbe590 Remove integer conversion APIs from stb_vorbis; 2021-02-08 16:08:29 -07:00
bjorn 1eb4070c92 Mixing; 2021-02-08 16:08:29 -07:00
bjorn c92b47e3a6 Another miniaudio attempt WIP; 2021-02-08 16:08:29 -07:00