Author Topic: BASS for Android  (Read 392027 times)

norbert

  • Posts: 122
Re: BASS for Android
« Reply #925 on: 2 Jul '15 - 17:41 »
Again I'm having trouble with some bassmidi playback (mabye I'm doing sth "bad" in my code, but perhaps you can already identify an error from the log):

JNI ERROR (app bug): accessed deleted global reference
native code passing in reference to invalid global reference

The error occurs when stopping the current midi sequence (mixer) and attempt to start playing a new one, which involves removing and setting up new syncs.
At least I have ensured that a sync is not removed (from UI thread) while some code is executed in it.
The last action befiore the error is a Channel_SetSync call.

Code: [Select]
07-02 17:57:07.085    9878-9901/com.my.testapp D/MXY﹕ SetSync: syncHandle=-2147483574;
07-02 17:57:09.123    9878-9901/com.my.testapp E/art﹕ JNI ERROR (app bug): accessed deleted global reference 0x4ce
07-02 17:57:09.123    9878-9901/com.my.testapp E/art﹕ 0xb90d06e8 SpaceTypeMallocSpace begin=0x12c00000,end=0x13b1b000,limit=0x1ac00000,size=15MB,capacity=128MB,non_growth_limit_capacity=128MB,name="main rosalloc space"]
07-02 17:57:09.123    9878-9901/com.my.testapp E/art﹕ 0xb8ffd8b0 allocspace main rosalloc space live-bitmap 3[begin=0x12c00000,end=0x1ac00000]
07-02 17:57:09.123    9878-9901/com.my.testapp E/art﹕ 0xb90aa600 allocspace main rosalloc space mark-bitmap 3[begin=0x12c00000,end=0x1ac00000]
07-02 17:57:09.123    9878-9901/com.my.testapp E/art﹕ 0xb8e72210 SpaceTypeImageSpace begin=0x70dd2000,end=0x719435f8,size=11MB,name="/data/dalvik-cache/arm/system@framework@boot.art"]
07-02 17:57:09.123    9878-9901/com.my.testapp E/art﹕ 0xb8e71f90 imagespace /data/dalvik-cache/arm/system@framework@boot.art live-bitmap 0[begin=0x70dd2000,end=0x71943600]
07-02 17:57:09.123    9878-9901/com.my.testapp E/art﹕ 0xb8e71f90 imagespace /data/dalvik-cache/arm/system@framework@boot.art live-bitmap 0[begin=0x70dd2000,end=0x71943600]
07-02 17:57:09.123    9878-9901/com.my.testapp E/art﹕ 0xb90c60a0 SpaceTypeZygoteSpace begin=0x74bef000,end=0x75159000,size=5MB,name="Zygote space"]
07-02 17:57:09.123    9878-9901/com.my.testapp E/art﹕ 0xb8e71ea8 allocspace zygote / non moving space live-bitmap 0[begin=0x74bef000,end=0x75159000]
07-02 17:57:09.123    9878-9901/com.my.testapp E/art﹕ 0xb8e732c0 allocspace zygote / non moving space mark-bitmap 0[begin=0x74bef000,end=0x75159000]
07-02 17:57:09.123    9878-9901/com.my.testapp E/art﹕ 0xb8e6f370 SpaceTypeMallocSpace begin=0x75159000,end=0x75221000,limit=0x78bef000,size=800KB,capacity=58MB,non_growth_limit_capacity=58MB,name="alloc space"]
07-02 17:57:09.123    9878-9901/com.my.testapp E/art﹕ 0xb90a8890 allocspace alloc space live-bitmap 4[begin=0x75159000,end=0x78bef000]
07-02 17:57:09.123    9878-9901/com.my.testapp E/art﹕ 0xb90b03e0 allocspace alloc space mark-bitmap 4[begin=0x75159000,end=0x78bef000]
07-02 17:57:09.123    9878-9901/com.my.testapp E/art﹕ 0xb8e76650 large object space:GcRetentionPolicyAlwaysCollect
07-02 17:57:09.123    9878-9901/com.my.testapp E/art﹕ [ 07-02 17:57:09.163  9878: 9901 F/art      ]
    art/runtime/check_jni.cc:65] JNI DETECTED ERROR IN APPLICATION: native code passing in reference to invalid global reference: 0x4ce
07-02 17:57:09.163    9878-9901/com.my.testapp A/art﹕ art/runtime/check_jni.cc:65]     in call to CallVoidMethodV
07-02 17:57:09.164    9878-9901/com.my.testapp A/art﹕ art/runtime/check_jni.cc:65] "Thread-1333" prio=6 tid=24 Runnable
07-02 17:57:09.164    9878-9901/com.my.testapp A/art﹕ art/runtime/check_jni.cc:65]   | group="main" sCount=0 dsCount=0 obj=0x12c49320 self=0xb979aab0
07-02 17:57:09.164    9878-9901/com.my.testapp A/art﹕ art/runtime/check_jni.cc:65]   | sysTid=9901 nice=-1 cgrp=apps sched=0/0 handle=0xb912a138
07-02 17:57:09.164    9878-9901/com.my.testapp A/art﹕ art/runtime/check_jni.cc:65]   | state=R schedstat=( 37274849 202401205 421 ) utm=0 stm=3 core=0 HZ=100
07-02 17:57:09.164    9878-9901/com.my.testapp A/art﹕ art/runtime/check_jni.cc:65]   | stack=0xa5dcc000-0xa5dce000 stackSize=1012KB
07-02 17:57:09.164    9878-9901/com.my.testapp A/art﹕ art/runtime/check_jni.cc:65]   | held mutexes= "mutator lock"(shared held)
07-02 17:57:09.164    9878-9901/com.my.testapp A/art﹕ art/runtime/check_jni.cc:65]   native: #00 pc 00004dd8  /system/lib/libbacktrace_libc++.so (UnwindCurrent::Unwind(unsigned int, ucontext*)+23)
07-02 17:57:09.164    9878-9901/com.my.testapp A/art﹕ art/runtime/check_jni.cc:65]   native: #01 pc 00003531  /system/lib/libbacktrace_libc++.so (Backtrace::Unwind(unsigned int, ucontext*)+8)
07-02 17:57:09.164    9878-9901/com.my.testapp A/art﹕ art/runtime/check_jni.cc:65]   native: #02 pc 0024844d  /system/lib/libart.so (art::DumpNativeStack(std::__1::basic_ostream<char, std::__1::char_traits<char> >&, int, char const*, art::mirror::ArtMethod*)+68)
07-02 17:57:09.164    9878-9901/com.my.testapp A/art﹕ art/runtime/check_jni.cc:65]   native: #03 pc 0022d7f7  /system/lib/libart.so (art::Thread::Dump(std::__1::basic_ostream<char, std::__1::char_traits<char> >&) const+146)
07-02 17:57:09.164    9878-9901/com.my.testapp A/art﹕ art/runtime/check_jni.cc:65]   native: #04 pc 000b01eb  /system/lib/libart.so (art::JniAbort(char const*, char const*)+582)
07-02 17:57:09.164    9878-9901/com.my.testapp A/art﹕ art/runtime/check_jni.cc:65]   native: #05 pc 000b0925  /system/lib/libart.so (art::JniAbortF(char const*, char const*, ...)+60)
07-02 17:57:09.164    9878-9901/com.my.testapp A/art﹕ art/runtime/check_jni.cc:65]   native: #06 pc 000b2cad  /system/lib/libart.so (art::ScopedCheck::Check(bool, char const*, ...) (.constprop.128)+672)
07-02 17:57:09.164    9878-9901/com.my.testapp A/art﹕ art/runtime/check_jni.cc:65]   native: #07 pc 000baf03  /system/lib/libart.so (art::CheckJNI::CallVoidMethodV(_JNIEnv*, _jobject*, _jmethodID*, std::__va_list)+50)
07-02 17:57:09.164    9878-9901/com.my.testapp A/art﹕ art/runtime/check_jni.cc:65]   native: #08 pc 000041b3  /data/app/com.my.testapp-2/lib/arm/libbassmix.so (???)
07-02 17:57:09.164    9878-9901/com.my.testapp A/art﹕ art/runtime/check_jni.cc:65]   native: #09 pc 000041e5  /data/app/com.my.testapp-2/lib/arm/libbassmix.so (???)
07-02 17:57:09.165    9878-9901/com.my.testapp A/art﹕ art/runtime/check_jni.cc:65]   native: #10 pc 0000369d  /data/app/com.my.testapp-2/lib/arm/libbassmix.so (???)
07-02 17:57:09.165    9878-9901/com.my.testapp A/art﹕ art/runtime/check_jni.cc:65]   native: #11 pc 00027bf1  /data/app/com.my.testapp-2/lib/arm/libbass.so (???)
07-02 17:57:09.165    9878-9901/com.my.testapp A/art﹕ art/runtime/check_jni.cc:65]   native: #12 pc 0000f17f  /data/app/com.my.testapp-2/lib/arm/libbass.so (???)
07-02 17:57:09.165    9878-9901/com.my.testapp A/art﹕ art/runtime/check_jni.cc:65]   native: #13 pc 00015d9b  /system/lib/libc.so (__pthread_start(void*)+30)
07-02 17:57:09.165    9878-9901/com.my.testapp A/art﹕ art/runtime/check_jni.cc:65]   native: #14 pc 00013d5b  /system/lib/libc.so (__start_thread+6)
07-02 17:57:09.165    9878-9901/com.my.testapp A/art﹕ art/runtime/check_jni.cc:65]   (no managed stack frames)
07-02 17:57:09.165    9878-9901/com.my.testapp A/art﹕ art/runtime/check_jni.cc:65]
07-02 17:57:09.204    9878-9901/com.my.testapp A/libc﹕ Fatal signal 11 (SIGSEGV), code 1, fault addr 0x3a in tid 9901 (Thread-1333)
Thanks.

Ian @ un4seen

  • Administrator
  • Posts: 20427
Re: BASS for Android
« Reply #926 on: 3 Jul '15 - 17:29 »
I guess this may be a similar issue to the one you had with "onetime" syncs set with BASS_ChannelSetSync recently, but with BASS_Mixer_ChannelSetSync this time. I'll send you a debug version to check that stuff.

leonardo

  • Posts: 5
Re: BASS for Android
« Reply #927 on: 5 Jul '15 - 09:55 »
waiting for support hls, m3u8. thanks

julesD

  • Guest
Re: BASS for Android
« Reply #928 on: 6 Jul '15 - 13:20 »
Hello Ian,

I have a nexus 9 and need the build of Bass and BassAAC for 64 bit arm devices?

I'm really supprised there is nothing on the subject? Is there a workaround? Thank you!

Ian @ un4seen

  • Administrator
  • Posts: 20427
Re: BASS for Android
« Reply #929 on: 6 Jul '15 - 17:32 »
waiting for support hls, m3u8. thanks

HLS support is currently in development, so it will probably be available in the not too distant future. If you would like to test the current state of the HLS support (and you use Windows), the latest XMPlay build includes it (you will also need the XMPlay AAC plugin).

   www.un4seen.com/stuff/xmplay.exe

I have a nexus 9 and need the build of Bass and BassAAC for 64 bit arm devices?

I'm really supprised there is nothing on the subject? Is there a workaround? Thank you!

I haven't tried the Nexus 9 myself so far, but is it not possible to use armeabi-v7a libraries on it? Anyway, I will try to get 64-bit (arm64-v8a) libraries for you to try this week.

julesD

  • Guest
Re: BASS for Android
« Reply #930 on: 7 Jul '15 - 10:07 »
Hello Ian,
Thanks for your answer, I just found the workaround and yes it is possible to run armeabi-v7a architecture library.

Only problem was I use multiple statics libraries and Android will only fallback to 32 bit if none of the libraries are 64bit compatible.. So I struggled a little to figure out I needed to remove all my 64 bits build to let the 32 one be used (including libbass).

This works great at the moment if anyone has same problem ;)

Ian @ un4seen

  • Administrator
  • Posts: 20427
Re: BASS for Android
« Reply #931 on: 7 Jul '15 - 17:35 »
Thanks for your answer, I just found the workaround and yes it is possible to run armeabi-v7a architecture library.

Only problem was I use multiple statics libraries and Android will only fallback to 32 bit if none of the libraries are 64bit compatible.. So I struggled a little to figure out I needed to remove all my 64 bits build to let the 32 one be used (including libbass).

This works great at the moment if anyone has same problem ;)

It's good to hear that you have got the armeabi-v7a libraries working. In case you're still interested in using 64-bit libraries, here's an arm64-v8a build for you to try:

   www.un4seen.com/stuff/bass24-android-arm64.zip

Let me know if you encounter any problems with it.

...
Code: [Select]
07-02 17:57:09.164    9878-9901/com.my.testapp A/art﹕ art/runtime/check_jni.cc:65]   native: #00 pc 00004dd8  /system/lib/libbacktrace_libc++.so (UnwindCurrent::Unwind(unsigned int, ucontext*)+23)
07-02 17:57:09.164    9878-9901/com.my.testapp A/art﹕ art/runtime/check_jni.cc:65]   native: #01 pc 00003531  /system/lib/libbacktrace_libc++.so (Backtrace::Unwind(unsigned int, ucontext*)+8)
07-02 17:57:09.164    9878-9901/com.my.testapp A/art﹕ art/runtime/check_jni.cc:65]   native: #02 pc 0024844d  /system/lib/libart.so (art::DumpNativeStack(std::__1::basic_ostream<char, std::__1::char_traits<char> >&, int, char const*, art::mirror::ArtMethod*)+68)
07-02 17:57:09.164    9878-9901/com.my.testapp A/art﹕ art/runtime/check_jni.cc:65]   native: #03 pc 0022d7f7  /system/lib/libart.so (art::Thread::Dump(std::__1::basic_ostream<char, std::__1::char_traits<char> >&) const+146)
07-02 17:57:09.164    9878-9901/com.my.testapp A/art﹕ art/runtime/check_jni.cc:65]   native: #04 pc 000b01eb  /system/lib/libart.so (art::JniAbort(char const*, char const*)+582)
07-02 17:57:09.164    9878-9901/com.my.testapp A/art﹕ art/runtime/check_jni.cc:65]   native: #05 pc 000b0925  /system/lib/libart.so (art::JniAbortF(char const*, char const*, ...)+60)
07-02 17:57:09.164    9878-9901/com.my.testapp A/art﹕ art/runtime/check_jni.cc:65]   native: #06 pc 000b2cad  /system/lib/libart.so (art::ScopedCheck::Check(bool, char const*, ...) (.constprop.128)+672)
07-02 17:57:09.164    9878-9901/com.my.testapp A/art﹕ art/runtime/check_jni.cc:65]   native: #07 pc 000baf03  /system/lib/libart.so (art::CheckJNI::CallVoidMethodV(_JNIEnv*, _jobject*, _jmethodID*, std::__va_list)+50)
07-02 17:57:09.164    9878-9901/com.my.testapp A/art﹕ art/runtime/check_jni.cc:65]   native: #08 pc 000041b3  /data/app/com.my.testapp-2/lib/arm/libbassmix.so (???)
...

For anyone else that has encountered this problem when using BASS_Mixer_ChannelSetSync, a BASSmix update (2.4.8.1) to fix it is now up in the 1st post.

julesD

  • Guest
Re: BASS for Android
« Reply #932 on: 8 Jul '15 - 09:17 »
Thanks for the 64 bit libs!! I tried them and seems working fine.

I will still continue using only 32bit fallback at the moment as it is better for APK size but in case I encounter any problem I'll get to the 64 ;)

UserAlexandr

  • Posts: 37
Re: BASS for Android
« Reply #933 on: 15 Jul '15 - 11:31 »
Hello, how to get a list of devices? Like BBK Vivo XPlay have two audio devices, how to use second device?

Ian @ un4seen

  • Administrator
  • Posts: 20427
Re: BASS for Android
« Reply #934 on: 15 Jul '15 - 16:19 »
Android's OpenSL ES implementation doesn't appear to currently give the option of choosing the output device. It has audio stream options, and BASS currently provides the "media" and "alarm" stream options via the "Default" and "Default (alarm)" devices. Perhaps it would be possible to access 2 output devices at the same time if Android can route those 2 streams to different output devices. Do you see any such option on your device?

UserAlexandr

  • Posts: 37
Re: BASS for Android
« Reply #935 on: 15 Jul '15 - 18:21 »
Android's OpenSL ES implementation doesn't appear to currently give the option of choosing the output device. It has audio stream options, and BASS currently provides the "media" and "alarm" stream options via the "Default" and "Default (alarm)" devices. Perhaps it would be possible to access 2 output devices at the same time if Android can route those 2 streams to different output devices. Do you see any such option on your device?

Thx for the answer, i not see this option in my device ((

norbert

  • Posts: 122
Re: BASS for Android
« Reply #936 on: 16 Jul '15 - 20:33 »
I noticed that on some Android devices the value 0 for the freq parameter (=use rate specified in BASS_INIT)
Code: [Select]
BASS_MIDI_StreamCreateFile(file, 0, 0, BASSMIDI.BASS_MIDI_NOFX | BASS.BASS_STREAM_DECODE, freq=0);
does NOT result in the rate specified in BASS_INIT. You 've got to set it to 44100 explict (as in BASS_INIT), otherwise - if you export the file (decoding channel) to wav using BASS_ChannelGetData ,samplerate 44100 - then the pitch and speed will be too low (~factor 1.08 regrading the total duration).
This currently happens on Android 5.02 (but maybe it's rather the device than the os version). However on all devices with Android <= 4.X it works as expected...

Ian @ un4seen

  • Administrator
  • Posts: 20427
Re: BASS for Android
« Reply #937 on: 17 Jul '15 - 15:37 »
Oh yes, I see that freq=0 will be behaving like freq=1 in the current Android version of BASS, ie. it's using BASS's output rate instead of the BASS_Init "freq" parameter, which may be different if the BASS_DEVICE_FREQ flag wasn't used. I'll correct that for the next BASS update (the issue is in BASS rather than BASSMIDI). You can use BASS_ChannelGetInfo to confirm what the MIDI stream's rate actually is.

In case you happen to be also using freq=0 for playback (not only file writing), I would recommend changing it to freq=1 in that case, so that the MIDI stream will still use BASS's output rate and avoid resampling with the next BASS update.

UserAlexandr

  • Posts: 37
Re: BASS for Android
« Reply #938 on: 26 Jul '15 - 12:09 »
Hello, I use "example.livespec" code to display the spectrum but in the new version of the bass lib he stopped working, constantly shows peaks.
In old lib:

In new lib:

How to fix this?

P.S. I find my error, not need help more, thx.
« Last Edit: 27 Jul '15 - 13:55 by UserAlexandr »

mrjoey

  • Posts: 31
Re: BASS for Android
« Reply #939 on: 3 Aug '15 - 10:59 »
hello mr Ian , i would like to apply some dsp effects on the main audio stream of the phone , there is lots of apps like music volume eq , it takes the data from the main output stream ,apply a eq and send it back to the stream,i would like to know how is that possible,what schould i use for that? Audiotrack? I just need to get data from the main output apply a dsp or fx or whatever via bass and then send the modified data back to the output stream , thank you.

WiredCat

  • Posts: 4
Re: BASS for Android
« Reply #940 on: 11 Aug '15 - 23:59 »
how can i initialize the bass in native c++ under android?

for now i got
08-12 02:24:38.589: E/libOpenSLES(32139): pAudioSrc: formatType=4


maybe i need to link opensles ? or what?


i basically call:

Code: [Select]
ool LoadBASS()
{

AnsiString bass_path = appdir+"libbass.so";
// load the BASS library and get the needed functions
void *basslib=dlopen(bass_path.c_str(), RTLD_LAZY); // (if (!basslib) <-- is executed so i dont check it and go right away to LOADBASSFUNCTION()
#define LOADBASSFUNCTION(f) *((void**)&f)=dlsym(basslib, #f)
LOADBASSFUNCTION(BASS_ErrorGetCode);
LOADBASSFUNCTION(BASS_Init);
if (BASS_Init(-1, 44100, BASS_DEVICE_DEFAULT,0,NULL)) return true;  //-< this returns true

ALOG(dlerror()); //no error

if (!basslib) return false; // its executed if i dont call if (bassinit) return true;

return true;


i get error:
08-12 02:28:47.939: E/libOpenSLES(2265): pAudioSrc: formatType=4
08-12 02:28:47.939: W/libOpenSLES(2265): Leaving Engine::CreateAudioPlayer (SL_RESULT_PARAMETER_INVALID)

and additionally
logcat throws millions of those lines:
08-12 02:31:18.899: V/AudioHardwareMSM76XXA(147): AudioStreamOutMSM72xx::getParameters() voip_flag=



also i am using bass.h from linux port since i couldnt find any header for android.




this is my android mk also maybe i do not ling opensles?

Code: [Select]
LOCAL_PATH := $(call my-dir)



include $(CLEAR_VARS)
LOCAL_MODULE := bass
LOCAL_SRC_FILES := libbass.so
include $(PREBUILT_SHARED_LIBRARY)

include $(CLEAR_VARS)

LOCAL_MODULE := game
LOCAL_CFLAGS := -Wall -Wextra
LOCAL_SHARED_LIBRARIES := bass
LOCAL_SRC_FILES := main.cpp game.cpp globalvars.cpp FileHandling.h glwrapper.h txtfile/stringlist.cpp shaderclass.h Textures.h Spectator.h shadermodel_struct.h DxcMath.h DxcMatrix.h DxCRotationMath.h modelloading/TachoGLModelSRC.cpp logme.cpp Timer.cpp Textures.h sim/ocean.cpp sim/fftsg2d.cpp sim/SUN_AND_ATMOSPHERE.cpp sim/PixelBuffer.cpp sim/ships/ship.cpp csg.cpp sim/clouds.cpp sim/cloud_dome.cpp sim/ships/battle_mp.cpp sim/game/game_init.cpp HUD/HUD.cpp perlin3d.h HUD/menu/menu.cpp HUD/menu/prgvarInit.cpp sim/weather.cpp android_pointers.cpp sim/ships/ship_shared_data.cpp glAnimTexture.cpp perlin2d.h sim/Fire/mega_smoke.cpp bass.h libbass.so
LOCAL_LDLIBS := -llog -landroid -lGLESv2 -ldl -lOpenSLES <- this works however adding  libOpenSLES returns error in runtime cannot load library cannot load library /system/lib/egl/libGLESv2S3D_adreno200.so
LOCAL_ALLOW_UNDEFINED_SYMBOLS := true

include $(BUILD_SHARED_LIBRARY)

any help woudl be apprecieated :)
« Last Edit: 12 Aug '15 - 01:45 by WiredCat »

Ian @ un4seen

  • Administrator
  • Posts: 20427
Re: BASS for Android
« Reply #941 on: 12 Aug '15 - 16:37 »
Code: [Select]
include $(CLEAR_VARS)
LOCAL_MODULE := bass
LOCAL_SRC_FILES := libbass.so
include $(PREBUILT_SHARED_LIBRARY)

I think that should look something like this:

Code: [Select]
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)

Where "path/to/bass" is where you have unzipped the BASS package.

WiredCat

  • Posts: 4
Re: BASS for Android
« Reply #942 on: 13 Aug '15 - 11:21 »
Setting full path to so file didn't help me much
Code: [Select]
LOCAL_PATH := $(call my-dir)



include $(CLEAR_VARS)
LOCAL_MODULE := bass
LOCAL_SRC_FILES := C:/Users/WiredCat/workspace/myproject/libs/libbass.so
include $(PREBUILT_SHARED_LIBRARY)

include $(CLEAR_VARS)

LOCAL_MODULE := game
LOCAL_CFLAGS := -Wall -Wextra
LOCAL_SHARED_LIBRARIES := bass
LOCAL_SRC_FILES := main.cpp game.cpp globalvars.cpp FileHandling.h glwrapper.h txtfile/stringlist.cpp shaderclass.h Textures.h Spectator.h shadermodel_struct.h DxcMath.h DxcMatrix.h DxCRotationMath.h modelloading/TachoGLModelSRC.cpp logme.cpp Timer.cpp Textures.h sim/ocean.cpp sim/fftsg2d.cpp sim/SUN_AND_ATMOSPHERE.cpp sim/PixelBuffer.cpp sim/ships/ship.cpp csg.cpp sim/clouds.cpp sim/cloud_dome.cpp sim/ships/battle_mp.cpp sim/game/game_init.cpp HUD/HUD.cpp perlin3d.h HUD/menu/menu.cpp HUD/menu/prgvarInit.cpp sim/weather.cpp android_pointers.cpp sim/ships/ship_shared_data.cpp glAnimTexture.cpp perlin2d.h sim/Fire/mega_smoke.cpp bass.h
LOCAL_LDLIBS := -llog -landroid -lGLESv2 -ldl -lOpenSLES
LOCAL_ALLOW_UNDEFINED_SYMBOLS := true

include $(BUILD_SHARED_LIBRARY)




Code: [Select]
void *basslib=dlopen("/mnt/sdcard/myprojectname/files/libaas.so", RTLD_LAZY); <- gives number like 102031010450
#define LOADBASSFUNCTION(f) *((void**)&f)=dlsym(basslib, #f)

LOADBASSFUNCTION(BASS_ErrorGetCode); <- actual crash here ;] crash on LOADBASSFUNCTION()
LOADBASSFUNCTION(BASS_Init);









output result with handle number

Code: [Select]
08-13 12:17:59.150: V/WNB_LOG(6090): DLOPEN: /mnt/sdcard/myprojectname/files/libbass.so    ======    1075150896
08-13 12:17:59.150: V/WNB_LOG(6090): LOADING BASS funcs
08-13 12:17:59.150: A/libc(6090): Fatal signal 11 (SIGSEGV) at 0x4fa7d55d (code=2), thread 6108 (Thread-903)


Ian @ un4seen

  • Administrator
  • Posts: 20427
Re: BASS for Android
« Reply #943 on: 13 Aug '15 - 16:33 »
What happens if you don't try to load BASS dynamically with dlopen/dlsym, ie. just include the BASS.H header and call the functions from that?

Also, are you building your app for a single architecture? If not, I think BASS's LOCAL_SRC_FILES line should include $(TARGET_ARCH_ABI) so that it can use the appropriate libbass.so file for each architecture, as described here:

   https://developer.android.com/ndk/guides/prebuilts.html

Regarding the earlier "pAudioSrc: formatType=4" message, that isn't a problem. It just means that the device's Android version doesn't support floating-point output (ie. it's not Android 5), and BASS will fallback to 16-bit output.

WiredCat

  • Posts: 4
Re: BASS for Android
« Reply #944 on: 14 Aug '15 - 10:10 »
well with not loading that through dlopen and leaving only static link then i get output like:

Code: [Select]
08-14 11:01:44.349: E/libOpenSLES(31560): pAudioSrc: formatType=4
08-14 11:01:44.349: W/libOpenSLES(31560): Leaving Engine::CreateAudioPlayer (SL_RESULT_PARAMETER_INVALID)
08-14 11:01:44.359: V/WNB_LOG(31560): BASS_ErrorGetCode 0
08-14 11:01:44.359: V/WNB_LOG(31560): BASS_Init(1, 44100, BASS_DEVICE_DEFAULT,0,0); true


then i actually try to play something and cant hear anything
Code: [Select]
HSAMPLE SNDHandle; //defined in header ;]

SNDHandle =  BASS_StreamCreateFile(FALSE, FileName.c_str(), 0, 0, BASS_SAMPLE_MONO); //FileName consists valid path to wav file

BASS_ChannelPlay(SNDHandle, false);


BASS_StreamCreateFile() returns BASS_ERROR_INIT <-- i call bass init like: BASS_Init(0, 44100, BASS_DEVICE_DEFAULT,0,0);


also dont know why but libs/armeabi-v7a/libbass.so keeps being deleted so i passed it to to libs/ i know very little of eclipse and that tool that compiles/links things for android anyway passing fixed path to the file shouldn't be problem its still *.so for armeabi-v7a
« Last Edit: 14 Aug '15 - 10:47 by WiredCat »

Ian @ un4seen

  • Administrator
  • Posts: 20427
Re: BASS for Android
« Reply #945 on: 14 Aug '15 - 12:36 »
BASS_StreamCreateFile() returns BASS_ERROR_INIT <-- i call bass init like: BASS_Init(0, 44100, BASS_DEVICE_DEFAULT,0,0);

A BASS_ERROR_INIT error indicates that BASS_Init hasn't been successfully called. If you definitely have called BASS_Init, then perhaps you have also called BASS_Free?

For normal playback (not just decoding), you will need to use a non-0 device number in the BASS_Init call. Device 0 is the "no sound" device, which only supports decoding. I would recommend using device -1 for the default output. Also, BASS_DEVICE_DEFAULT is a BASS.Net constant (it's not defined in BASS.H); if you're not using .Net you can replace it with 0.

also dont know why but libs/armeabi-v7a/libbass.so keeps being deleted so i passed it to to libs/ i know very little of eclipse and that tool that compiles/links things for android anyway passing fixed path to the file shouldn't be problem its still *.so for armeabi-v7a

Is that "libs" folder the same place that the NDK is placing your built library? If so, you should place the BASS libraries outside of there (the NDK will copy them there when building your library), eg. instead of "libs/<arch>/libbass.so" put them in "bass/libs/<arch>/libbass.so"

WiredCat

  • Posts: 4
Re: BASS for Android
« Reply #946 on: 14 Aug '15 - 15:07 »
yeah ndk copies them to arch7vabi folder, actually i was calling BASS_Free() right after BASS_Init() <- i didint see it also i set
BASS_Init(-1, 44100, 0,0,0);

BASS_StreamCreateFile(FALSE, FileName.c_str(), 0, 0, BASS_SAMPLE_MONO);
wasnt changed

it works now, big thanks! :)

Valdi

  • Posts: 8
Re: BASS for Android
« Reply #947 on: 18 Aug '15 - 15:18 »
Hello!

I'm getting GC collect madness when using fileprocs onfileread event.
Until the track is not downloaded, GC is triggered every second which has an influence on performance.
This issue occur only on low end devices like moto e.

Might this be related with bass.net?
I followed all the steps mentioned here
http://www.bass.radio42.com/help/html/1fbaeb6b-e04f-89fe-7058-25f5dd3ccb8f.htm
Basically I'm reading byte[] from http client and passing it to Marshal.Copy method.

Thanks is advance for any help with this.

radio42

  • Posts: 4576
Re: BASS for Android
« Reply #948 on: 18 Aug '15 - 15:52 »
Do you actually get an error (e.g. the callback delegate is being GCed while you/Bass still use it)?
Or is it more an issue, that a GC-Run might have an impact on your latency (the GC-Run takes too long) and thus the audio is starting to stutter?

If it is the latter, please see here: https://www.un4seen.com/forum/?topic=13811


bracken

  • Posts: 9
Re: BASS for Android
« Reply #949 on: 21 Aug '15 - 18:27 »
Ian, is there a pre-scan option that makes seeking an mp3 VBR file more accurate?  Some VBR mp3 files are not accurate at all when seeking.  For example, if I seek directly to minute 5 of a file, the audio playing is a couple of minutes off than if I just played it from the beginning to minute 5.  Does that make sense?  This only happens with some files but I have users consistently writing to complain about this issue (or leave negative reviews) and was hoping there is something that can be done to make the seek more accurate on this type of file.  If it would be helpful I can email you a sample file.