tamlyn / react-native-elementary

Use Elementary Audio in your React Native app

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Android support

tamlyn opened this issue · comments

Currently the repo supports iOS only.

Over on Discord, Nick wrote this which might be helpful when working on Android support:

Yea! I've done this before for a client project and the integration looks a lot like the integration in the elem cli: https://github.com/elemaudio/elementary/blob/main/cli/Realtime.cpp
Obviously it's your choice how you want to deal with the driver but I highly recommend miniaudio, as used in that cli example. For a react-native integration it's basically the same: make a native module that has methods for opening and closing the device, then configure an elem runtime instance to write the buffers from the device, and add another method for the applyInstructions step. Then from javascript you can (1) open the device, (2) make a custom renderer that sends its payloads to the applyInstructions hook, and then when the app closes (3) close the device

If someone gets it working nice with miniaudio on Android, I might end up throwing away the current CoreAudio stuff and using miniaudio on iOS too.

cc @txbrown

@tamlyn Thanks for this. I will have tackle first on android with mini audio. I also saw Oboe mentioned but mini audio being cross platform - and referred by Nick - seems to be the option to go with.

@tamlyn I got Android working. This PR will have loads of changes basically because there are libraries in ios/vendor that can be shared with android so I moved all of that under a cpp/... directory at the root as per latest RN library generator / recommended structure.

I will do some cleanup tomorrow morning and raise the PR closing this issue.