DUMB question about native extension (SOLVED)

Hello,

I want to play music modules in Defold with DUMB library..

If i understand well, i have to do two things:

  1. Implementing OpenAL sound queue buffering.
  2. Using DUMB library for filling OpenAL queue.

My Defold extension will manage OpenAL things (context, buffers, queues…)
I’m not sure how to link DUMB library to Defold extension.

Should i provide binaries of DUMB for each platform ?
Or can i define another native extension just for DUMB. And then, i could use the DUMB extension from my “main” extension ?

Thank you for reading :slight_smile:

1 Like

Yes, I would recommend that your extension contains prebuilt libraries for DUMB for all of your target platforms (as opposed to putting all of the DUMB source code and includes into your extension and building them every time). More on compiling DUMB here: https://github.com/kode54/dumb/blob/master/COMPILING.md

If you read our manual on Native Extensions you see where to put the built libs.

Your extension will then use DUMB to generate and fill OpenAL sound buffers, just like you describe.

2 Likes

Thank you for the answer.

Yes i have several options, like compiling DUMB for each platform with the Defold build platform. It would be slow, especially for development of my extension, but i can get all the platforms more easily this way.

I can also build myself DUMB, but for the moment, i’m only sure to succeed with Linux and Windows. For Android, i guess i can do it with the NDK, but for Apple ecosystem, i have no clue. Apple seems a lot of troubles when you are not using their tools and systems.

So I think to build for Linux, provide in libs this binary, and coding my extension like that. When the development is done, I will use Delfold build platform for the rest (that is, DUMB will be integrated to the extension and won’t be a lib anymore).

Thank you for reading :slight_smile:

You should be able to build for apple using clang on linux by using cross compilation.
Set the target appropriately:

  • clang++ -arch x86_64 -target x86_64-apple-darwin12 for 64 bit OSX
  • clang++ -arch arm64 -target arm-apple-darwin12 for iOS.

You also have to have the SDK somewhere, so you can specify e.g. -isysroot /opt/iPhoneOS10.3.sdk/

2 Likes

Ok @Mathias_Westerdahl, thank for the informations. I’m usually using gcc for compiling, but Linux-Arch packages clang too.

For the moment i stick on gcc, but anyway i’ve collected the SDK part of xcode (yes, it’s in xcode package for those who wonder like me earlier).

1 Like