Commit Graph

207 Commits

Author SHA1 Message Date
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 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 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
Nevyn Bengtsson 1b8a951007 magic numbers and typos 2021-02-08 16:08:29 -07:00
Nevyn Bengtsson 139c80fc28 Capture audio (and remove more magic numbers, and clean up some misconceptions) 2021-02-08 16:08:29 -07:00
Nevyn Bengtsson 033817bd74 audio capture stubs 2021-02-08 16:08:29 -07:00
Nevyn Bengtsson 5c2e270c3f audio: clean up some magic numbers 2021-02-08 16:08:29 -07:00
Nevyn Bengtsson 407742e8b5 make Source:setSpatial a constructor option instead 2021-02-08 16:08:29 -07:00
Nevyn Bengtsson 8403c9bd70 just a super dummy spatializer 2021-02-08 16:08:29 -07:00
Nevyn Bengtsson 01b8a6baa6 spatializer hooks to mixer 2021-02-08 16:08:29 -07:00
Nevyn Bengtsson fe8a6e8612 expose Source:{get|set}Spatial 2021-02-08 16:08:29 -07:00
bjorn 533939e673 Source:getDuration; Source:get/setTime; 2021-02-08 16:08:29 -07:00
bjorn 70839535f3 WIP; 2021-02-08 16:08:29 -07:00
bjorn 121a4f7108 Start spatialization and data conversion systems; 2021-02-08 16:08:29 -07:00
bjorn 1eb4070c92 Mixing; 2021-02-08 16:08:29 -07:00
bjorn 205e9404e0 Looping, playback; 2021-02-08 16:08:29 -07:00
bjorn c92b47e3a6 Another miniaudio attempt WIP; 2021-02-08 16:08:29 -07:00
bjorn 75c37bf7e9 rm trailing whitespace; 2020-11-12 18:08:05 -07:00
Nevyn Bengtsson e34953f064 lovrMicrophoneGetData: fix potential buffer overrun
With the check for samples==0 being done BELOW the assert for offset+samples<soundData->samples,
setting samples to 0 and then having more samples available in the mic than present in
the created buffer would cause buffer overrun
2020-06-04 14:31:24 +02:00
bjorn ed4b8d1f3d rm unneeded internal Source functions;
Now that things are in the same file, setters for internal source
fields are unnecessary, making things a bit simpler.
2020-05-03 13:02:19 -06:00
bjorn c455b0750e rm unused Source functions from header; 2020-05-03 13:00:02 -06:00
bjorn d847dd663a rm unused audio headers; 2020-05-03 12:57:50 -06:00
bjorn b9a2bddd25 Put all the audio stuff in one file;
If there was ever some sort of hypothetical switch to a different
audio library, this would make such a switch easier.
2020-05-03 12:54:35 -06:00
bjorn 8dcc97745e Tup: emscripten support; LuaJIT flag; 2020-03-02 23:06:42 -08:00
bjorn 69dd0d4674 audio: rm paused and stopped states; rm rewind;
- There is now just one "playing" state.
- Instead of rewind, use :seek(0).

Note that now there is no way to resume or rewind all tracked sources.
This can be improved in the future if there's a need for it, probably
using variadic or table-based variants of the audio module functions.
2020-02-26 00:25:49 -08:00
bjorn 5d8bf1d45a Fix Source:setLooping assert; 2020-02-22 01:01:17 -08:00
bjorn 96d3288dae Update header; 2020-01-22 15:38:57 -08:00
bjorn a5424a1932 Microphone:getData supports sampleCount/destination; 2020-01-22 15:36:41 -08:00
Nevyn Bengtsson e10799b8c8 microphone: less throwy, more MAX()y 2020-01-20 08:52:58 +01:00
Nevyn Bengtsson 790629bc3e SoundData: has-a blob instead of is-a blob 2020-01-19 17:50:04 +01:00
Nevyn Bengtsson 8515cd98fe Add destination buffer size to microphone:getData()
So that we can use OpenAL's internal ring buffer and only dequeue
exactly the amount we need at the moment.
2020-01-19 17:03:35 +01:00
bjorn 3c68e9e97a Fix some compile warnings/style;
Also I am little unsure about the _unused part.  It seems like we
were passing it ALuint** when the spec says it takes ALuint*.
2020-01-13 20:45:36 -08:00
Nevyn Bengtsson 972eb108c0 NULL is not valid for buffers in UnqueueBuffers 2020-01-11 16:31:06 +01:00
Nevyn Bengtsson 3279c0d3f0 Document buffer unqueueing in source play 2020-01-09 16:37:28 +01:00
Nevyn Bengtsson ae5877a299 Rewind raw sources on explicit stop
I missed this one in dbe2edd8
2020-01-05 21:26:41 +01:00
Nevyn Bengtsson 1db932d856 Source: Stop, then unqueue buffers
Doing it the other way around is illegal; you may not unqueue unprocessed buffers, so we need to stop first.
2020-01-05 21:26:14 +01:00
Nevyn Bengtsson dbe2edd89d Source: Do rewind on stop like before, and clear buffers
I changed my mind. Let's use rewind to clear buffers on a raw stream like Bjorn suggested, and put rewind at stop like it was before.
2020-01-05 21:08:30 +01:00
Nevyn Bengtsson e85a9b74c6 Audio source: unqueue before playing 2020-01-04 01:58:03 +01:00
Nevyn Bengtsson 33bee6ce44 Audio: Rewind on play, not stop
Before, streams were rewound when they stopped, so that next time they're played they're played from the start.

Instead, rewind on play instead, so that it's done when it's needed. This gets us a good point to make sure we're not rewinding raw streams too.
2020-01-03 23:00:58 +01:00
Nevyn Bengtsson c6806f50e1 RawAudioStream: getter for isRaw
And disallow looping raw streams
2020-01-03 22:59:37 +01:00
bjorn 2f9400a5f7 Adjust includes; 2019-12-10 13:01:28 -08:00
bjorn 28344928c9 Simplify arr; 2019-08-21 23:16:58 -07:00
bjorn 7690db28af Windows: Fix all the int warnings; 2019-07-31 17:51:49 -07:00
bjorn eb1e257209 Add new array implementation; Upgrade filesystem;
Filesystem:

- Uses streaming file IO.
- Uses less memory when requiring files.
- Simplifies its require path implementation.
2019-06-16 13:30:30 -07:00
bjorn 06c6b172de vec3 has 4 elements; 2019-06-03 07:20:03 -07:00
bjorn dc34ed4570 Start to trend towards 4-element arrays for vec3;
It will be important for enabling more SIMD.
2019-06-02 20:35:52 -07:00
bjorn 22fe333150 Update refcounting (again);
- Ref struct only stores refcount now and is more general.
- Proxy stores a hash of its type name instead of an enum.
- Variants store additional information instead of using a vtable.
- Remove the concept of superclasses from the API.
- Clean up some miscellaneous includes.
2019-06-02 01:02:26 -07:00
bjorn df6b7fc96a Ref is mostly private now;
It's really nice how objects don't need to care about how they're
allocated/managed now.
2019-05-20 15:09:06 -07:00
bjorn 57aad490ae Start sized int conversions; 2019-05-20 14:34:03 -07:00
bjorn 1335ab55ae Warnings/cleanup; 2019-05-20 03:41:12 -07:00
bjorn 7645f4c014 Add core folder; 2019-05-20 02:47:33 -07:00
bjorn a17f10e273 Add modules folder; 2019-05-19 00:38:35 -07:00