Author Topic: BASS for Android  (Read 402553 times)

gicci

  • Posts: 45
Re: BASS for Android
« Reply #1375 on: 4 Apr '18 - 07:45 »
The BASSWV update posted above is the 2.4.6 release version minus the armv7 optimizations. If it turns out that the armv7 optimizations are indeed causing the crashes, I will replace the current release version (in the 1st post) with the update. Let me know what you find with your app.

I have fully released the app with the BASSWV without optimizations and no crashes have been reported. Users with devices crashing with previous version are reporting it is working again.
So it seems that somehow those optimizations are not working properly with Android 6.0 (at least on some devices).

Ian @ un4seen

  • Administrator
  • Posts: 20719
Re: BASS for Android
« Reply #1376 on: 4 Apr '18 - 17:01 »
Thanks Ian, I hear sound now.
However, do I need to create a AudioTrack object directly and write a buffer to it and invoke audioTrack.play()?

No, BASS handles the AudioTrack stuff; you only need to specify the BASS_DEVICE_AUDIOTRACK flag to enable it.

I have fully released the app with the BASSWV without optimizations and no crashes have been reported. Users with devices crashing with previous version are reporting it is working again.
So it seems that somehow those optimizations are not working properly with Android 6.0 (at least on some devices).

OK. I have now moved the BASSWV update to the package in the 1st post.

denis_shakinov

  • Posts: 3
Re: BASS for Android
« Reply #1377 on: 5 Apr '18 - 12:35 »
Thanks Ian, I hear sound now.
However, do I need to create a AudioTrack object directly and write a buffer to it and invoke audioTrack.play()?

No, BASS handles the AudioTrack stuff; you only need to specify the BASS_DEVICE_AUDIOTRACK flag to enable it.

Actually, I'm trying to record video/audio with Everyplay sdk https://developers.everyplay.com/. Everyplay only works with audiotrack API. When I just use
Code: [Select]
BASS.BASS_Init(-1, 44100, BASS.BASS_DEVICE_AUDIOTRACK)then I notice some lag when playing midi events with soundfont, and Everyplay sdk recorded just noise instead of notes sound. When I created audiotrack explicitly
Code: [Select]
...
res = BASS.BASS_ChannelGetData(channel, buffer, bufferSize)
audioTrack.write(buffer.array(), 0, res)
...
then I hear doubled sounds apparently, and Everyplay sdk recorded noise along with normal notes sound
also I've noticed such a logcat output:
Code: [Select]
W/AudioTrack: Use of stream types is deprecated for operations other than volume control
    See the documentation of AudioTrack() for what to use instead with android.media.AudioAttributes to qualify your playback use case
Do you know something about how to deal with Everyplay sdk, audiotrack and BASS?
« Last Edit: 5 Apr '18 - 12:40 by denis_shakinov »

Ian @ un4seen

  • Administrator
  • Posts: 20719
Re: BASS for Android
« Reply #1378 on: 5 Apr '18 - 17:39 »
I'm not familiar with that SDK, but if it's currently capturing noise from your app then perhaps it's a matter of floating-point vs 16-bit output? BASS will use floating-point by default when available (Andriod 5+) but you can request 16-bit output by adding the BASS_DEVICE_16BITS flag to your BASS_Init call:

Code: [Select]
BASS.BASS_Init(-1, 44100, BASS.BASS_DEVICE_AUDIOTRACK | BASS.BASS_DEVICE_16BITS);

Regarding the "lag", that is probably due to the MIDI stream's playback buffering. You can try disabling playback buffering via the BASS_ATTRIB_BUFFER option:

Code: [Select]
BASS.BASS_ChannelSetAttribute(midihandle, BASS.BASS_ATTRIB_BUFFER, 0);

chadr

  • Guest
Re: BASS for Android
« Reply #1379 on: 12 Apr '18 - 15:18 »
In August 2019 we will be forced to include the 64 bit version of the native libraries when publishing on Google Play (see https://android-developers.googleblog.com/2017/12/improving-app-security-and-performance.html). It seems a lot of time, but preparing ahead will help in troubleshooting possible problems and give better performance already now. Will it be possible to have 64 bit versions of the BASS libraries included in the Android release? Thank you for the excellent work.

Yes, I think arm64-v8a architecture builds will probably added to be Android BASS package early next year.


When will you add arm64-v8a architecture builds to official Android BASS package?
You said that it will be added in this early year.  :)

Ian @ un4seen

  • Administrator
  • Posts: 20719
Re: BASS for Android
« Reply #1380 on: 12 Apr '18 - 17:26 »
Soon, hopefully :)

otherside

  • Posts: 27
Re: BASS for Android
« Reply #1381 on: 14 Apr '18 - 11:32 »
Hello.
Question related to new BASS_DEVICE_AUDIOTRACK.
How to get audioSessionId? (it is necessary in order to use System equalizer)

It is available as field in AudioTrack and MediaPlayer.

Ian @ un4seen

  • Administrator
  • Posts: 20719
Re: BASS for Android
« Reply #1382 on: 16 Apr '18 - 17:12 »
The latest build (not yet up in the 1st post) does provide that option. You can get it here:

   www.un4seen.com/stuff/bass-android-test.zip

It adds this BASS_GetConfig option to get the audio session ID:

Code: [Select]
public static final int BASS_CONFIG_ANDROID_SESSIONID = 62;

otherside

  • Posts: 27
Re: BASS for Android
« Reply #1383 on: 18 Apr '18 - 21:43 »
I tried. Thanks! It works as I expect and there's no bugs at first glance.

otherside

  • Posts: 27
Re: BASS for Android
« Reply #1384 on: 19 Apr '18 - 18:27 »
Another question:

I have a channel which is created from a file and is currently playing.
Plus I need to analyze levels of the whole channel. I create separate channel because I use seekToPosition in order to analyze track from beginnig until end. Playing channel has different position.

Currently I create 2 streams, like this:
for play - BASS.BASS_StreamCreateFile(url, 0, 0, 0)
for analyzing - BASS.BASS_StreamCreateFile(url, 0, 0, BASS.BASS_STREAM_DECODE)

is there a way to optimize it by avoding creation of the duplicate stream?