Skip to content

waywardgeek/sonic-ndk

Repository files navigation

This is the libsonic Android NDK wrapper.  I, Bill Cox, wrote it in 2011, with
the exception of AndroidAudioDevice.java, which was written by Mario Zechner,
who posted it on his blog at

    http://www.badlogicgames.com/wordpress/?p=228

Mario has given me permission to place this code into the public domain as well.
I place all of the files created for this project into the public domain.
However, the files sonic.c and sonic.h are from the Vinux "sonic" package and
are licensed under GNU Lesser General Public License version 2.1. You can freely
use this NDK application with your commercial application, but if you make
changes to sonic.c or sonic.h, those changes must be shared as described in the
file COPYING.

Note: While this code works well, maintaining JNI wrapped C code in your Java
project will be painful.  There in the main sonic project, there is Sonic.java,
which is a pure Java port of the sonic algorithm.  The main sonic repo is at:

    https://github.com/waywardgeek/sonic

I recently pulled a patch from the main sonic repo that fixes some bugs in this
version.  I release all the code in that patch to the public domain as well.
For users who need an actual license, the main repo is licensed under Apache 2.0.
If you need some other license, just drop me an email.  My intent is to make
this algorithm free software to all who want it, for any purpose whatsoever.

Installing into your Android app
--------------------------------

Unfortunately, Android makes sharing code very hard.  The simplest way to use
Sonic in your app is to import the Sonic class into your Eclipse project, and to
import the sonic-ndk/libs directory into your apps libs directory.  To import
the Sonic class, use Import->File System, set "From directory: to
sonic-ndk/src", and "Into folder" to your src direcory.  After you've imported
the sonic source, delete the two uneeded files from your project, which are:

src/org/vinuxproject/SonicTest.java
src/org/vinuxproject/AndroidAudioDevice.java

If you don't have a libs directory in your project yet, create it using Eclipse.
Then, import the libs directory from sonic-ndk into your libs directory.