Skip to content

Adding new components

Igor Zinken edited this page May 13, 2018 · 5 revisions

Adding new components

While MWEngine aims to offer enough out-of-the-box functionality, it was written as a framework upon which you can easily build and extend to cater your own needs.

So how do you go about adding new components to the library ?

Updating make file

When adding new C(++) classes that should be part of the compiled library, be sure to add them to the makefile in src/main/cpp/Android.mk, which is something you'd probably knew anyways, but if you wish to use the engine within a Java application be sure to remember:

...updating the SWIG interface file

If you wish to use the library from Java via JNI, you might want to update the SWIG interface file in src/main/cpp/mwengine.i. This file describes which components of the library you want to make accessible from Java. Note that you can include new C++ classes in the make file to be part of the library, but you can exclude these from mwengine.i to make sure they are invisible to Java (for instance to use a shared component that should never be interacted with directly).

To expose a C++ class via SWIG to Java, you include its header in twofold like so :

#include "path/to/custom_class.h"
%include "path/to/custom_class.h"

That's it ? Anything else ?

If you feel you have written an excellent DSP / written an awesome alternative to existing components or improved existing functionalities, don't hesitate to make a pull request to add to the engine!

Clone this wiki locally