I’d like to modify a sound component. I does not seem possible, reading the forum, and the api.
For playing a sound, you need to create it in the gui, and then send a play message to it.
The problem is i want to generate sound stream, so i can do it two ways:
modify the same buffer (or modify a buffer while the other is playing). Even if it was possible (i’m doubting about it), there would be synchronisations problem : even with an accurate timing, it will be difficult to restart the playing without hiss in the music.
generate all the music in a wave, that would be loaded once and for all. But, apart it would hog ram on small devices, i don’t see how to dynamically load the generated wave.
Is there a trick ? Both ways seems blocked.
I had a look to the OpenAL extensions from Sergey Lerg, but it seems more oriented for 3D positionning of sound. I had a look in the C code and saw some functions about sound generation, though.
OpenAL is used for sound rendering, and replaces (shunts) the internal sound API.
– dmsdk/sdk.h is included in OpenAL.cpp, but it is only used in CheckError function , for logging purposes. So indeed, only OpenAL is used for for sound output.
in blip.cpp , there is both:
– the binding of the C code to Lua module.
– after Lua module definition, the glue code to dmsdk, with constructor/destructor for integration into Defold (according to this doc , i think i can manage this).
Now the things i don’t understand:
In the Makefile , only sfxr.c is compiled. But we need also to compile … hum i just see this file doesn’t even exists. Is the makefile comes from other location and has been left here ?
In the example directory: i was expecting to find something like blip=require"blip", for using the blip module. Is is implicit when you are using natives extensions ?
In the Defold native extension documentation, it is written that you have to provide external libs, in /libs.
– As OpenAL is an external lib, it should be provided for every targets (Linux, Windows, OSX…), shouldn’t it ?
That said, i think it could be a solid base for what i want to do…
There are no make files. Any folder containing an ext.manifest will be treated as a folder that is expected to contain a native extension. All of the native code will be shipped to build.defold.com where it is built into a custom engine that is shipped back and cached locally. The build server takes care of the entire build pipeline. This is documented quite clearly in the Native Extension manual.
Aaaaand I just noticed that I had left an old Makefile in the Blip repo. It should NOT be there. I just deleted it. Thanks for making me aware of it!
The native extensions export a “namespace” that is available globally, just like the engine itself does for things such as factory.*, facebook.*, go.* etc
This is generally true, BUT Defold uses OpenAL internally for playing sounds so there’s no need to ship the libs. They are prebuilt and included in the engine. Blip and the OpenAL extension by Sergey only ship the header files.