The APIs in terms of overall structure should be implemented similar to messages APIs - a separate class in the src/internal directory accessible as a field of the internal Context class, with C API free functions defined in separate files in src directory that would make use of it.
The main difficulties compared to messaging API
Existing code can not be used as is. The relevant code in libraries/audio-client includes and depend on some interface specifics. The code will need to be refactored, separating the network packet handling either into its own library, or into the libraries/networking and then used to implement native APIs. Care must be taken to not introduce new runtime dependencies in the client library (such as QtGui for example).
Audio can be performance sensitive. The general design of the C API is to provide a polling interface, and to be able to hook it up directly to various native audio callbacks we might need to use a lockless ring buffer. We have an implementation in libraries/audio/AudioRingBuffer.h that might be sufficient, but an external library can also be used.
This issue is in context of https://github.com/vircadia/vircadia/tree/unity-sdk/libraries/vircadia-client Work on this issue should be based on
unity-sdk
branch, and PRs made against it.The APIs in terms of overall structure should be implemented similar to messages APIs - a separate class in the
src/internal
directory accessible as a field of the internal Context class, with C API free functions defined in separate files insrc
directory that would make use of it.The main difficulties compared to messaging API
libraries/audio-client
includes and depend on some interface specifics. The code will need to be refactored, separating the network packet handling either into its own library, or into thelibraries/networking
and then used to implement native APIs. Care must be taken to not introduce new runtime dependencies in the client library (such as QtGui for example).libraries/audio/AudioRingBuffer.h
that might be sufficient, but an external library can also be used.Other Notes
While not strictly necessary for the current use case in Unity SDK, the user facing C API headers need to be explicitly added here: https://github.com/namark/vircadia/blob/vircadia-client-package-config/libraries/vircadia-client/CMakeLists.txt#L70-L80 The unit test files also need to be explicitly added in the relevant CMake file here: https://github.com/namark/vircadia/blob/vircadia-client-package-config/libraries/vircadia-client/tests/CMakeLists.txt#L4 Related Unity SDK issue: https://github.com/vircadia/vircadia-unity-sdk/issues/6
Progress checklist