Cycling74 / rnbo.unity.audioplugin

RNBO Adapter for Unity's Native Audio Plugin
MIT License
40 stars 8 forks source link

plugin not working on Quest when building from Windows #33

Closed jinpavg closed 4 months ago

jinpavg commented 8 months ago

After building an android build of the plugin on macOS, and then building a Quest game on macOS that includes that plugin, a user reports that the plugin works on Quest, loaded either as a "custom filter," or as a plugin effect loaded on an AudioMixer. However, when building the Quest game from a Windows machine, the AudioMixer-loaded version of the plugin no longer works (the user reports that the filter version still works).

I can reproduce with slightly different variables -- if I build the plugin for android on Windows (using Ninja), the plugin builds successfully but I don't hear it working as a filter or mixer-loaded plugin on the Quest. The Windows version works fine in the Unity Editor, and other audio (non-RNBO) works fine on the Quest.

x37v commented 8 months ago

@jinpavg just to be sure, when you built the plugin on windows, did you supply this option -DANDROID_CPP_FEATURES=exceptions

jinpavg commented 8 months ago

Ah, I tried both with and without, with the same results so far.

x37v commented 7 months ago

I just built and ran successfully from my windows machine: I'm using 'Ninja' to build.

cmake .. -G "Ninja" -DANDROID_PLATFORM=29 -DANDROID_ABI=arm64-v8a -DCMAKE_TOOLCHAIN_FILE="C:\Program Files\Unity\Hub\Editor\2021.3.23f1\Editor\Data\PlaybackEngines\AndroidPlayer\NDK\build\cmake/android.toolchain.cmake" -DRNBO_EXPORT_DIR="C:\Users\xnor\Documents\export\simple-freq-param\" -DRNBO_CPP_DIR="C:\Users\xnor\Documents\export\simple-freq-param\rnbo" -DPLUGIN_NAME="SimpleFreqParam" -DANDROID_CPP_FEATURES=exceptions
cmake --build .

then I copied my native windows plugin into correct folder:

PS C:\Users\xnor\dev\rnbo.unity.audioplugin\build> ls .\SimpleFreqParam\Assets\Plugins\Windows\

    Directory: C:\Users\xnor\dev\rnbo.unity.audioplugin\build\SimpleFreqParam\Assets\Plugins\Windows

Mode                 LastWriteTime         Length Name
----                 -------------         ------ ----
-a----          1/2/2024   4:34 PM        1958912 SimpleFreqParam.dll
-a----          1/2/2024   4:03 PM           1366 SimpleFreqParam.dll.meta
-a----          1/2/2024   4:34 PM       15192064 SimpleFreqParam.pdb
-a----          1/2/2024   4:34 PM            155 SimpleFreqParam.pdb.meta

I wonder if there is something going on with signatures when you build the android plugin on mac and then try to deploy to android from windows?

x37v commented 7 months ago

I'm using Unity Editor version 2021.3.23f1, I used the VR template and these instructions for setting it up further: https://www.circuitstream.com/blog/oculus-quest-2-setup

in powershell, in the unity plugin project directory

cd .\build\ 
cmake .. -G "Ninja" -DANDROID_PLATFORM=29 -DANDROID_ABI=arm64-v8a -DCMAKE_TOOLCHAIN_FILE="C:\Program Files\Unity\Hub\Editor\2021.3.23f1\Editor\Data\PlaybackEngines\AndroidPlayer\NDK\build\cmake/android.toolchain.cmake" -DRNBO_EXPORT_DIR="C:\Users\xnor\Documents\export\simple-freq-param\" -DRNBO_CPP_DIR="C:\Users\xnor\Documents\export\simple-freq-param\rnbo" -DPLUGIN_NAME="SimpleFreqParam" -DANDROID_CPP_FEATURES=exceptions
cmake --build .
cd ..
mkdir build-windows
cd build-windows
cmake .. -G "Visual Studio 19" -DRNBO_EXPORT_DIR="C:\Users\xnor\Documents\export\simple-freq-param\" -DRNBO_CPP_DIR="C:\Users\xnor\Documents\export\simple-freq-param\rnbo" -DPLUGIN_NAME="SimpleFreqParam"
cmake --build .
Copy-Item -Path .\SimpleFreqParam\Assets\Plugins\Windows -Destination ..\build\SimpleFreqParam\Assets\Plugins\ -Recurse

In my Unity project, I add the RNBOTypes package and also SimpleFreqParam by path (I didn't move them), I also edited the "Audio" project settings and setup the occulus spacializer, then I created a mixer and then found an object in the scene, added an audio source to it, selected an audio file (not sure if i needed to do that), then set the mixer for the source to the mixer I just created, finally I added my plugin to the top of the mixer I just created and deployed to my occulus via 'Build and Run'

x37v commented 7 months ago

I suspect the issue some people are seeing is with a mismatch of player and plugin architectures.. the plugin is being built for ARM64, make sure that your player is also targeting ARM64

jinpavg commented 4 months ago

closing this for now, i think this is working if folks set this up as described above