Code Monkey home page Code Monkey logo

android-fluidsynth's Introduction

This is a build setup for Android build of fluidsynth.

Why? Because building fluidsynth for Android from the origin(al source) is somewhat complicated.

fluidsynth depends on glib. Building glib for Android is not easy because it has several components.

There is existing build system that makes it to build glib: cerbero.

But cerbero seems to be intended for almost only for their build system and not flexible enough to build with custom configuration. So I have somewhat revised version.

Next, setting up cerbero and passing appropriate configuration parameters to build libraries for Android and laying out the outcome is messy. Also, the resulting binaries need some binary fixups. So this build script also takes care of it.

I posted some introduction and rationale stories here: https://dev.to/atsushieno/fluidsynth-for-android--269i

Usage

"make prepare" to set up cerbero and its dependencies.

"make" to checkout and build fluidsynth and deps.

"make buildone-cerbero" to kick forced build. It is useful when hacking fluidsynth that is checked out by cerbero.

Finally, as part of an attempt to build libfluidsynth.so that does not depend on any other libraries, run ./build-single-lib.sh.

Missing

There is no JNI bridge in Java because no one had implemented it. I'm using Xamarin and my nfluidsynth project, so I don't need JNI interop. Contributions are welcome.

Hacking

This is the basic directory layout:

build/
  sources/
    android_armv7/
      fluidsynth-*/
    android_x86/
      fluidsynth-*/

You would like to hack fluidsynth sources for your Android target. For me it is build/sources/android\_armv7/fluidsynth-1.1.6.

The fluidsynth repo is particularly a fork to support OpenSLES and the most significant source is fludsynth/src/drivers/fluid\_opensles.c in the fluidsynth source tree (the one I mentioned above).

cerbero build operations, by default, resets the repo. So if you edit fluidsynth sources to fix issues, it will be lost when you run "make". To avoid that, make changes to external/cerbero/recipes/fluidsynth.recipe to not point to specific commit hash but specify "master" or any current branch to prevent the forcible reset.

Also, note that the sources you should make changes are of the target specific architecture e.g. build/sources/android_armv7/fluidsynth-1.1.16/ and not build/sources/local. It is ignored when you run "buildone".

Here is my workflow:

  • make changes under build/sources/android_x86/fluidsynth-1.1.6 (under android_x86, NOT under build/sources/local/fluidsynth: I don't want fullbuilds triggered by making changes there.)
  • run make. It will build x86 and arm binaries (ndk-build for x86, binary-hack for arm)
  • When I'm ready to commit and push the changes:
    • cd build/sources/android_x86/fluidsynth-1.1.6
    • git diff > tmp.patch
    • mv tmp.patch ../../local/fluidsynth
    • patch -i tmp.patch -p1
    • cd ../../local/fluidsynth
    • For the first time:
      • git checkout master
      • edit .git/config and point to my committable URL.
    • git commit -a
    • git push origin master
    • Make sure that the worktree has the latest git commits i.e.
      • cd ../../android_x86_fluidsynth_1.1.6
      • git checkout master
      • git pull

android-fluidsynth's People

Contributors

atsushieno avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

android-fluidsynth's Issues

"make prepare" is not work.

I have a problem with the build you provided.

Running $ make prepare will cause the following problem.

cd external / cerbero && CERBERO_LOCAL_CONFIG = .. / .. / custom.cbc ./cerbero-uninstalled -c config / cross-android-armv7.cbc bootstrap
/ bin / sh: ./cerbero-uninstalled: No such file or directory
make: *** [prepare] Error 127

Perhaps "cerbero" is not connected or it can not be found in git.

"make prepare" fails

After recursively cloning, I launch make prepare and I get this:

cd external/cerbero && CERBERO_LOCAL_CONFIG=../../custom.cbc ./cerbero-uninstalled -c config/cross-android-armv7.cbc bootstrap
Traceback (most recent call last):
  File "./cerbero-uninstalled", line 8, in <module>
    from cerbero.main import main
  File "./cerbero/main.py", line 19, in <module>
    from cerbero import hacks
  File "./cerbero/hacks.py", line 132, in <module>
    from cerbero.utils.shell import call as shell_call
  File "./cerbero/utils/shell.py", line 42, in <module>
    PLATFORM = system_info()[0]
  File "./cerbero/utils/__init__.py", line 206, in system_info
    raise FatalError("Distribution '%s' not supported" % str(d))
cerbero.errors.FatalError
Makefile:12: recipe for target 'prepare' failed
make: *** [prepare] Error 1

I am on Ubuntu 17.10 64 bit

ndk-build-arm

It is desirable to build it with ndk-build without binary hack for arm, but so far it fails to build with ndk-build:

[armeabi-v7a] Compile thumb  : fluidsynth <= fluid_gen.c
In file included from /home/atsushi/android-ndk-r10e/toolchains/arm-linux-androideabi-4.9/prebuilt/linux-x86_64/lib/gcc/arm-linux-androideabi/4.9/include-fixed/syslimits.h:7:0,
                 from /home/atsushi/android-ndk-r10e/toolchains/arm-linux-androideabi-4.9/prebuilt/linux-x86_64/lib/gcc/arm-linux-androideabi/4.9/include-fixed/limits.h:34,
                 from build/dist/android_armv7/lib/glib-2.0/include/glibconfig.h:11,
                 from build/dist/android_armv7/include/glib-2.0/glib/gtypes.h:32,
                 from build/dist/android_armv7/include/glib-2.0/glib/galloca.h:32,
                 from build/dist/android_armv7/include/glib-2.0/glib.h:30,
                 from build/sources/android_armv7/fluidsynth-1.1.6/fluidsynth/src/utils/fluidsynth_priv.h:25,
                 from jni/../build/sources/android_armv7/fluidsynth-1.1.6/fluidsynth/src/synth/fluid_gen.h:25,
                 from jni/../build/sources/android_armv7/fluidsynth-1.1.6/fluidsynth/src/synth/fluid_gen.c:22:
/home/atsushi/android-ndk-r10e/toolchains/arm-linux-androideabi-4.9/prebuilt/linux-x86_64/lib/gcc/arm-linux-androideabi/4.9/include-fixed/limits.h:168:61: error: no include path in which to search for limits.h
 #include_next <limits.h>  /* recurse down to the real one */
                                                             ^
In file included from build/dist/android_armv7/include/glib-2.0/glib/galloca.h:32:0,
                 from build/dist/android_armv7/include/glib-2.0/glib.h:30,
                 from build/sources/android_armv7/fluidsynth-1.1.6/fluidsynth/src/utils/fluidsynth_priv.h:25,
                 from jni/../build/sources/android_armv7/fluidsynth-1.1.6/fluidsynth/src/synth/fluid_gen.h:25,
                 from jni/../build/sources/android_armv7/fluidsynth-1.1.6/fluidsynth/src/synth/fluid_gen.c:22:
build/dist/android_armv7/include/glib-2.0/glib/gtypes.h:35:18: fatal error: time.h: No such file or directory
 #include <time.h>
                  ^
compilation terminated.

And I have no idea how to fix it.

fatal error :git submodule update

fatal: reference is not a tree: 5b17441d29cbd3044f41448316830c49a77adc8a
Unable to checkout '5b17441d29cbd3044f41448316830c49a77adc8a' in submodule path 'external/cerbero'

Need more detailed info on how to use this

I'm familiar with C/C++, Java, JNI, Android and still completely lost how to build this.

Are you assuming a Linux environment? I'm on Windows and don't understand what I'm supposed to do about this cerbero thing. Took me a long time to even realize the "external" folder points to a separate repo that I apparently need to download separately. Where do I go from there - do I need to copy that into the android-fluidsynth repo somewhere? Do I need to have gcc installed? Many questions...

Switch to Oboe API

AAudio API is new in Android NDK r15 and is supposed to be backported to pre-O platforms using OpenSLES backend implementation. Switch to this API once it became stable.

JNI implementation

Hi! I have idea of creating application of automatic guitar chords synth, i was tryed AudioTrack API but it have a lag, how i can use your library with JNI interface in android studio or Eclipse, can you help me to understand please

build system changes in the original fluidsynth

It turned out that the original Fluidsynth is moved from sourceforge to github about 8 months ago, and their development goes on there. One of the most significant changes that matter here is the build system changes - autotools are not used anymore and they switched to CMake.

It is problematic because 1) fluidsynth cmake does not really care about Android, and 2) cerbero does not really care about CMake for Android (cerbero does care about CMake, but for desktop).

This makes me ponder, it might be time to move away from Cerbero and use something different. That needs to support glib for Android though.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.