22 May '13 - 02:33 *
Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
 
   Home   Help Search Login Register  
Pages: [1] 2 3 ... 18
  Reply  |  Print  
Author Topic: BASS for Android  (Read 48010 times)
Ian @ un4seen
Administrator
Posts: 15259


« on: 21 Nov '11 - 16:23 »
Reply with quoteQuote

Android versions of BASS and the BASSFLAC/MIDI/OPUS/WV/mix add-ons are available here:

   www.un4seen.com/stuff/bass24-android.zip (updated: 3 May '13)

These add-ons are also available:

   www.un4seen.com/stuff/bass_aac-android.zip
   www.un4seen.com/stuff/bass_alac-android.zip
   www.un4seen.com/stuff/bass_ape-android.zip
   www.un4seen.com/stuff/tags-android.zip
   www.un4seen.com/files/z/0/bass_fx24-android.zip     (currently doesn't include most BASS_FX_BFX_xxx effects, see BASS_FX.java)

All of the usual stuff should be supported but, like the WinCE version, fixed-point is used rather than floating-point for better performance, with the following consequences: Floating-point channels aren't supported (BASS_SAMPLE_FLOAT will result in BASS_ERROR_FORMAT). The BASS_CONFIG_FLOATDSP option is still available, but it will give 8.24 fixed-point data instead of floating-point; that goes for BASS_ChannelGetData too when getting FFT data or using the BASS_DATA_FLOAT flag. In the case of the BASSMIDI add-on, MIDI input isn't supported, BASS_MIDI_FontPack isn't included because there are no command-line encoders to use, and BASS_MIDI_StreamGetChannel isn't currently supported because it creates floating-point streams (using the BASS_SAMPLE_FLOAT flag). A workaround for the latter will probably be added at a later date.

The libraries include support for Java code (via BASS classes), as well as native code (via the usual BASS headers). The Java API follows the C/C++ API as much as possible, but there are some unavoidable differences, mainly in parameter/return types. The BASS classes are included in source form (eg. BASS.JAVA file), so you can see exactly what's what in there. Java versions of the FXTEST/NETRADIO/PLUGINS/RECTEST and MIDITEST examples are included to demonstrate things. To play with the examples, you can use the "New > Android Project > Create project from existing source" option to create projects for them in Eclipse. You will also need to import the root SRC folder (containing the BASS class) via the "Build Path > Link Source" option and copy the root LIBS folder (containing the BASS library) into the example's folder. When using an add-on (eg. with the PLUGINS or MIDITEST example), you should do the same with the add-on's SRC and LIBS folders. Note the SRC folder (containing the add-on's class) is only needed when calling the add-on's functions (as in MIDITEST), not when using the plugin system (as in PLUGINS).

The libraries come in ARMv5 and ARMv7 architecture builds, the latter giving improved performance with supporting CPUs. One or both can be included in an app (the system will load the most appropriate one if both are).

Android's native audio API (OpenSL ES-based) is used for audio output/input, which requires Android 2.3, but the "no sound" device is still available with older versions (decoding channels could be fed into the AudioTrack stuff then). The BASS_CONFIG_DEV_BUFFER config option determines the device/output buffer size used by BASS. That currently defaults to 30ms, which I guess may be a bit low for some devices; try increasing that if you get stuttering output.

For convenience, the stream/sample/music creation functions include support for assets, via an "Asset" class. For example, a stream could be created from a "music.ogg" asset like this...

stream = BASS.BASS_StreamCreateFile(new BASS.Asset(getAssets(), "music.ogg"), 0, 0, 0);

An "mp3-free" BASS version is included, but it simply doesn't support MP3 rather than using an OS-provided MP3 decoder, as Android currently doesn't have any good way to do that. That will hopefully change in future.

Please report any problems/ideas/etc.
« Last Edit: 3 May '13 - 17:30 by Ian @ un4seen » Logged
zenon
Posts: 86


« Reply #1 on: 21 Nov '11 - 20:14 »
Reply with quoteQuote

Congratulations !!!

BASS library rocks !!!  Cool
Logged
Ionut Cristea
Posts: 1374


« Reply #2 on: 21 Nov '11 - 23:45 »
Reply with quoteQuote

  I've tried to make an application with Eclipse. I've build with both ARMv5 and ARMv7. Every bass call i make make application to crash.
Logged
Ian @ un4seen
Administrator
Posts: 15259


« Reply #3 on: 22 Nov '11 - 14:04 »
Reply with quoteQuote

What does Eclipse say about the crash, eg. is there an exception and/or is there anything in the log? If it's happening with every BASS call, perhaps the problem is that the BASS library can't be found. Did you copy the LIBS folder into your project's folder? After doing that, you may also need to refresh the Eclipse project (the LIBS folder should be shown in the project's contents).

If you're still having any trouble with it, please check whether the same thing happens when you try to run the examples.
Logged
Ionut Cristea
Posts: 1374


« Reply #4 on: 22 Nov '11 - 14:11 »
Reply with quoteQuote

"The application .... has stopped unexpectedly. PLease try again"


this happens with my application, and bass samples also. I've included libbass
Logged
Ian @ un4seen
Administrator
Posts: 15259


« Reply #5 on: 22 Nov '11 - 15:02 »
Reply with quoteQuote

That looks like a message displayed on the device rather than in Eclipse? Please also check what Eclipse has to say about it in its debug perspective, eg. there should be some details in the "LogCat" view.

To confirm that the problem is happening on the first BASS call, have you placed a breakpoint on the call and then tried stepping over (F6) it? If it reaches the breakpoint and then crashes when you step over the call, does it make any difference what the call is, eg. does it happen even with a BASS_GetVersion call? Note the app should be started in "Debug" mode (rather than "Run") when doing this.
Logged
Ionut Cristea
Posts: 1374


« Reply #6 on: 22 Nov '11 - 15:20 »
Reply with quoteQuote

Thread [<1> main] (Suspended (exception UnsatisfiedLinkError))   
   Runtime.loadLibrary(String, ClassLoader) line: 429   
   System.loadLibrary(String) line: 554   
   BASS.<clinit>() line: 612   
   NetRadio.onCreate(Bundle) line: 183   
   Instrumentation.callActivityOnCreate(Activity, Bundle) line: 1047   
   ActivityThread.performLaunchActivity(ActivityThread$ActivityClientRecord, Intent) line: 1611   
   ActivityThread.handleLaunchActivity(ActivityThread$ActivityClientRecord, Intent) line: 1663   
   ActivityThread.access$1500(ActivityThread, ActivityThread$ActivityClientRecord, Intent) line: 117   
   ActivityThread$H.handleMessage(Message) line: 931   
   ActivityThread$H(Handler).dispatchMessage(Message) line: 99   
   Looper.loop() line: 123   
   ActivityThread.main(String[]) line: 3683   
   Method.invokeNative(Object, Object[], Class, Class[], Class, int, boolean) line: not available [native method]   
   Method.invoke(Object, Object...) line: 507   
   ZygoteInit$MethodAndArgsCaller.run() line: 839   
   ZygoteInit.main(String[]) line: 597   
   NativeStart.main(String[]) line: not available [native method]   
Logged
Ian @ un4seen
Administrator
Posts: 15259


« Reply #7 on: 22 Nov '11 - 15:45 »
Reply with quoteQuote

Thread [<1> main] (Suspended (exception UnsatisfiedLinkError))   
   Runtime.loadLibrary(String, ClassLoader) line: 429   
   System.loadLibrary(String) line: 554   
   BASS.<clinit>() line: 612   

That does look very much like the BASS library can't be found Smiley

Is the LIBS folder shown in Eclipse, and if you open it, do you see the ARMEABI(-V7A) subfolders and LIBBASS.SO files in there? If not, try refreshing the project (right-click and choose "Refresh").
Logged
Ionut Cristea
Posts: 1374


« Reply #8 on: 22 Nov '11 - 22:56 »
Reply with quoteQuote

Quote
Is the LIBS folder shown in Eclipse, and if you open it, do you see the ARMEABI(-V7A) subfolders and LIBBASS.SO files in there? If not, try refreshing the project (right-click and choose "Refresh").

Yes is there Sad
Logged
Ian @ un4seen
Administrator
Posts: 15259


« Reply #9 on: 23 Nov '11 - 14:14 »
Reply with quoteQuote

Does your "Package Explorer" view in Eclipse look like the attached image? To confirm whether the BASS library is being included in the app's package, you can go to the project's BIN directory and open the APK file with a ZIP archiver; you should find a LIB folder in there (with the same contents as the project's LIBS folder).

* eclipse.png (15.91 KB - downloaded 978 times.)
Logged
Ionut Cristea
Posts: 1374


« Reply #10 on: 23 Nov '11 - 15:06 »
Reply with quoteQuote

Yes the tree folder is similar and i can find libbass.so in the .apk file Smiley
Here is my compiled netradio example

* NetRadio.zip (155.81 KB - downloaded 150 times.)
Logged
Ian @ un4seen
Administrator
Posts: 15259


« Reply #11 on: 23 Nov '11 - 16:07 »
Reply with quoteQuote

The LIBBASS.SO file is in the root of your package instead of in a LIB folder, so that explains why it isn't being found. When you say your project looks similar, how similar is that? Smiley ... The LIBS branch should look identical. If it is identical and still not working, please upload the entire project folder to have a look at, to hopefully find out what is going wrong with it.
Logged
Ian @ un4seen
Administrator
Posts: 15259


« Reply #12 on: 24 Nov '11 - 16:47 »
Reply with quoteQuote

There were problems with the MO3 and IT file loaders, so an updated library is up (in the 1st post) to fix that. An FXTEST example has also been added.
Logged
bjadams
Posts: 9


« Reply #13 on: 28 Nov '11 - 20:45 »
Reply with quoteQuote

Does it support the Android NDK or is it Java only, as I could not find and NDK examples in the zip archive?
« Last Edit: 28 Nov '11 - 21:57 by bjadams » Logged
Ian @ un4seen
Administrator
Posts: 15259


« Reply #14 on: 29 Nov '11 - 15:25 »
Reply with quoteQuote

Yes, it should be possible to use the BASS library in native code too, with the standard BASS.H header. The header isn't included in the package above, but it can be taken from one of the other BASS platform packages (it's the same header for all platforms).

Meanwhile... Android versions of the BASSFLAC and BASSWV add-ons have been added to the package, as well as a PLUGINS example. The BASS library has also had a little update to add support for that stuff.
Logged
bjadams
Posts: 9


« Reply #15 on: 29 Nov '11 - 23:11 »
Reply with quoteQuote

I still can't find 1 example or some step-by-step guide how to add all the necessary BASS bits to my current Android project so that I can use it natively.
Is there any chance to put in at least 1 simple example or some quick guide?
Logged
materialworlds
Posts: 17


« Reply #16 on: 30 Nov '11 - 10:41 »
Reply with quoteQuote

Any timescale for an Android version of BASS FX ? Smiley
« Last Edit: 30 Nov '11 - 10:58 by materialworlds » Logged
Ian @ un4seen
Administrator
Posts: 15259


« Reply #17 on: 30 Nov '11 - 17:09 »
Reply with quoteQuote

I still can't find 1 example or some step-by-step guide how to add all the necessary BASS bits to my current Android project so that I can use it natively.
Is there any chance to put in at least 1 simple example or some quick guide?

I'm afraid there aren't currently any examples for using BASS in native Android projects. Are you looking for help on using BASS (function calls/etc) or on how to include the library in a native Android project? The BASS calls will be the same as on other platforms, so you could have a look at the examples from the other platform BASS packages (be sure to also check the documentation for usage details). Regarding including the library in a native project, I think you would do something like this in your "Android.mk" file...

include $(CLEAR_VARS)
LOCAL_MODULE := bass
LOCAL_SRC_FILES := path/to/bass/libs/$(TARGET_ARCH_ABI)/libbass.so
LOCAL_EXPORT_C_INCLUDES := path/to/bass
include $(PREBUILT_SHARED_LIBRARY)

And then add this to your app's build rules...

LOCAL_SHARED_LIBRARIES := bass
Logged
bjadams
Posts: 9


« Reply #18 on: 30 Nov '11 - 21:11 »
Reply with quoteQuote

I was mainly just looking for the steps necessary to setup the bass in my android project, not the actual BASS calls which would be the same for Windows (which I already had used once in the past).

Will test the suggested setup and report back!

Thanks for the great support!
Logged
bjadams
Posts: 9


« Reply #19 on: 1 Dec '11 - 07:09 »
Reply with quoteQuote

As soon as I include the BASS lib details in Android.mk, and put all the relevant library files in place, I am getting a process closed error as soon as my app launches. I am not even doing any BASS api calls in my app yet!

I unzipped the apk and LIBbass is being included in the package.
Logged
Pages: [1] 2 3 ... 18
  Reply  |  Print  
 
Jump to:  

Powered by SMF 1.1.18 | SMF © 2013, Simple Machines