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
Nevyn Bengtsson
0265babef4
Android: Ask for permissions on demand
...
By looking for failed start and requesting then;
and then emitting a new event type when
permission has been granted or rejected;
and then using that event in the default
boot.lua to re-start capture.
2021-02-08 16:08:29 -07:00
Nevyn Bengtsson
aa3dc76176
Audio: Don't open capture at start, allow it to be enabled later
...
So that we can try once on demand,
and again when permissions are granted
2021-02-08 16:08:29 -07:00