PortAudio / portaudio

PortAudio is a cross-platform, open-source C language library for real-time audio input and output.
Other
1.43k stars 296 forks source link

Portaudio Oboe implementation candidate #826

Open hopefulGiupplo opened 1 year ago

hopefulGiupplo commented 1 year ago

I've made some research in PA issues, and I've seen multiple people wanting an implementation of Oboe as a PA HostAPI for Android, however, it seems that no one shared one yet.

This is my take on it - it's still lacking a lot of features that could be used by Oboe, like choosing a performance mode. I started by modifying Croissanne's implementation of OpenSLES, which can be found in another issue. This implies that my implementation is working on an older version of PortAudio.

I'm currently trying to patch it, in order to make it work on PortAudio 19.8, but the CMake structure was basically overhauled, and, since I'm no CMake expert, I'm asking you for some help in solving some linking issues.

You can have a look of what I did here. The main branch is the one that works, but uses the aforementioned old version of PortAudio (disregard the README.md that says "v19"); "PaOboe_Patch" is the branch with PortAudio 19.8 that fails the linking process. Relevant files are:

philburk commented 1 year ago

I'm happy to see this.

I notice that you are including Oboe in the PortAudio repo. Have you tried linking with the Prebuilt Library?

This doc describes how to use a prebuilt with gradle and CMake.

like choosing a performance mode.

You could look at the suggested latency from the open. If under ? msec then choose LowLatency.

Also I recommend syncing with the latest PortAudio. There have been many recent changes to CMAKE support.

philburk commented 1 year ago

I looked some more at the code. Very nice!

Are you calling setErrorCallback when using the data callback? I recommend letting Oboe close the old stream and then reopen the new stream in onErrorAfterClose(). See docs

hopefulGiupplo commented 1 year ago

Good morning, and sorry for taking so long to respond.

I have implemented what you suggested, and the PaOboe_Patch branch is now ready and functional. Let me know if more work is needed, I'd really like to see this implementation in the next official Portaudio release :)

philburk commented 1 year ago

now ready and functional. @hopefulGiupplo - Cool! There is a lot of great work here.

The next step is to create a Pull Request. Then we can see all the changes and begin the review process.

We can also add a GitHub action for continuous integration.