Commit Graph

44 Commits

Author SHA1 Message Date
bjorn d70619ec96 Source:isSpatial; Separate spatial from effects; 2022-03-27 19:09:25 -07:00
bjorn 2da18d419b mv util src; 2022-03-22 00:13:38 -07:00
bjorn d32d9f6d67 Source directivity power defaults to 1; 2021-04-03 11:22:23 -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 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 e63099ba6a Flatten api.h; 2021-03-15 18:54:27 -06: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 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 3055cd718c rm shared sources; 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 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 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 ea64f32c1f Source:clone; 2021-02-16 21:34:53 -07:00
bjorn dca79f83f0 SoundData is now named Sound!; 2021-02-08 19:52:56 -07:00
bjorn d1801cfcde Fix Source:getTime; 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
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 f5fcb73324 duration and time for stream sounddata 2021-02-08 16:08:29 -07:00
Nevyn Bengtsson b7b63a268b review: getSpatial > isSpatial 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 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 f7169ec236 Source:pause; Source:stop; Source:isPlaying; 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 3bc2c00b79 api doesn't include util; 2020-12-25 12:50:26 -07:00
Patrik Sjöberg ec501903d5 Correct the argument indices for Source:setCone 2020-11-11 22:17:10 +01:00
bjorn 51f470cf85 Easier enums; 2020-09-27 17:13:00 -07: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 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 18dcb07b98 Convert stuff over to use new enum system; 2020-02-16 18:31:02 -08:00
bjorn c9b1f257bf api: try new file naming convention; Tupfile: cleanup;
I assume full responsibility for any catastrophes this causes.
2019-12-31 19:31:44 -08:00
Renamed from src/api/l_source.c (Browse further)