Is cSoundUnity trying to talk to the hardware directly?

Iv’e been using the csoundUnity plugin to build a synth on an external X64 device. I added the libs to support x64 (cause this plugin doesn’t have this native library) but Im still getting a crash here :
libandroid.AHardwareBuffer_allocate(AHardwareBuffer_allocate:533)

Is csound-Unity trying to talk to the hardware directly? or it is just used for processing and then going through unity for playback?

Hi @Sh_dev and welcome to the forum.
No, CsoundUnity doesn’t talk with the hardware, it simply fills its AudioSource’ samples using OnAudioFilterRead.
Where did you get the x64 lib? Did you build it?
Btw I had crashes too when trying with Android Arm7 builds (it works when using Arm64), there is some issue with malloc building with that version. I’m not sure what causes the crash but it could be related with the size of floats. Csound uses doubles, that for example are not supported on Android.
It would be nice digging a bit more into this issue, and being able to support other platforms, thanks for reporting it!

Thank you for the quick response @g_b . I’ve been following your work for years, glad I found a way to chat with you.

I built the x86_64 lib myself, with the help of another engineer.
Honestly not sure I did the right thing, Ive been messing with csound for a while now, but its my first time trying to connect it to an android device. Can you try to make a build for x84_64 and see if it works on your end? it will be great to see more platforms supported by cSound and cSoundUnity

Thank you, that’s very nice to hear.
Can I ask you what platform are you targeting?
It should already work on MacOS and Windows at 64bit.
It would be great porting CsoundUnity to other platforms, but the hardware is needed to test them :sweat_smile:

Im using an external Android x86_64 device. If you can build the lib I can test it on my end.

I have no idea how to build for x86_64, I tried again the whole building process and was able to produce arm64-v8a and armeabi-v7a libs only, I couldn’t find any setting where to choose a different output.
Maybe @stevenyi can be more helpful than me here!
When we have the lib it shouldn’t be too difficult to add it to CsoundUnity.

@g_b Is there any place I can send you the libs I created, and you can try to integrate them into the plugin?

Yes sure, send me the lib (upload it somewhere and paste the link here) and I will add it to the CsoundUnity package.
Btw It should be a matter of copying the lib into the CsoundUnity package folder, Runtime/Android/x86_64

Take a look here: csound/Application.mk at develop · csound/csound · GitHub

You might try modifying this line to add x86_64 as an architecture. I am unsure if or what further changes would be necessary from there as I haven’t tried building for this architecture and Android.

2 Likes

Thanks Steven!
I was able to build successfully, I added the lib to the CsoundUnity package, @Sh_dev let us know how it goes!

1 Like

Thanks for this guys. :clap:

1 Like

You guys rock! thank you so much! I’ll keep you posted!

any update on this? did it work?

Hi! its been a while, but I’m happy to inform you that it definitely worked! runs with no issues! Thank you so much! Im so happy there will be another device that is supported by cSound in the market!

1 Like