Author Topic: BASS for Android  (Read 653860 times)

Ian @ un4seen

  • Administrator
  • Posts: 22253
Re: BASS for Android
« Reply #1625 on: 5 Sep '19 - 14:42 »
To perhaps narrow down where the problem is, please try this latest build:

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

If the problem still happens then check whether it also happens after adding the BASS_DEVICE_AUDIOTRACK flag to your BASS_Init call. If it happens then too, you can next try enabling AAudio output like this before calling BASS_Init (and don't use the BASS_DEVICE_AUDIOTRACK flag):

Code: [Select]
BASS.BASS_SetConfig(BASS.BASS_CONFIG_ANDROID_AAUDIO, 1); // enable AAudio

Ian @ un4seen

  • Administrator
  • Posts: 22253
Re: BASS for Android
« Reply #1626 on: 11 Sep '19 - 14:48 »
An updated version of BASS up now in the 1st post. It adds support for AAudio output (BASS_CONFIG_ANDROID_AAUDIO option), and allows a preallocated session ID (from audioManager.generateAudioSessionId) to be set via the BASS_CONFIG_ANDROID_SESSIONID option. It also adds support for some Android 10 features/restrictions. The ParcelFileDescriptor class can be used with the stream/sample/music creation funcions, which allows access to scoped storage (https://developer.android.com/training/data-storage/files/external-scoped). A new FloatValue class is introduced, which should be used instead of the standard Float class to receive float values via BASS function parameters (eg. with BASS_ChannelGetAttribute) because the Float class value can no longer be modified by native code in Android 10.

teq

  • Posts: 47
Re: BASS for Android
« Reply #1627 on: 13 Sep '19 - 12:20 »
Hi! Could you clarify about FloatValue, if am using .net wrapper on Android? Should i wait for an update of wrapper?

Ian @ un4seen

  • Administrator
  • Posts: 22253
Re: BASS for Android
« Reply #1628 on: 13 Sep '19 - 13:07 »
I'm not actually sure how the Float Java class change in Android 10 affects .Net. BASS.Net is using System.Single in its place. My guess would be that Xamarin will implement that in a way that isn't affected, so you can continue using it and there's no need for something like a separate FloatValue class.

teq

  • Posts: 47
Re: BASS for Android
« Reply #1629 on: 27 Sep '19 - 17:43 »
Hi there! What do you think about using bass with Flutter? Will it be convenient or pain with writing dart->java wrappers? =) 

Ian @ un4seen

  • Administrator
  • Posts: 22253
Re: BASS for Android
« Reply #1630 on: 30 Sep '19 - 17:21 »
I'm not familiar with Flutter, but if it allows you to use native libraries then it seems like it should be possible to use BASS with it.

BassPassion

  • Posts: 31
Re: BASS for Android
« Reply #1631 on: 3 Oct '19 - 20:41 »
Dart (the language used by Flutter), has an experimental(currently under development) support for native C bindings:
https://flutter.dev/docs/development/platform-integration/c-interop

You would have to be on the Dev Channel of Flutter, so I would say it's a moving target currently.
Having said that, I am tempted to have a go at it.

teq

  • Posts: 47
Re: BASS for Android
« Reply #1632 on: 6 Oct '19 - 17:02 »
Dart (the language used by Flutter), has an experimental(currently under development) support for native C bindings:
https://flutter.dev/docs/development/platform-integration/c-interop

You would have to be on the Dev Channel of Flutter, so I would say it's a moving target currently.
Having said that, I am tempted to have a go at it.
Correct me, if i wrong, but why don't just use java bass with flutter?

Ionut Cristea

  • Posts: 1557
Re: BASS for Android
« Reply #1633 on: 9 Oct '19 - 06:49 »
Hello,

I am experiencing some issues with latest BASS version. BASS_ACTIVE_PLAYING is returned by BASS_ChannelIsActive but no audio is heard. The channel is a PUSH_STREAM and it has enough data to play. This usually happens after pause / play. When the play command is sent, BASS_ACTIVE_PLAYING is returned but not audio. Also, it seems that it recovers if pause / play commands are send again. Note that this issue wasn't present on the previous BASS version.
Thank you.
« Last Edit: 9 Oct '19 - 06:52 by Ionut Cristea »

Ian @ un4seen

  • Administrator
  • Posts: 22253
Re: BASS for Android
« Reply #1634 on: 9 Oct '19 - 15:31 »
If you put the previous BASS library version back in (and change nothing else), does the problem go away? If so, please confirm your current and previous BASS version numbers (with BASS_GetVersion), to check what may have changed. Also confirm what BASS_ATTRIB_BUFFER setting you're using on the stream, and that it's a normal playback stream (doesn't have BASS_STREAM_DECODE set).

Ionut Cristea

  • Posts: 1557
Re: BASS for Android
« Reply #1635 on: 10 Oct '19 - 07:22 »
Hi Ian,
I can confirm that reverting to the old libs the problem is not showing.

BASS.BASS_GetVersion returns 33820164
BASS_ATTRIB_BUFFER is not set and also stream BASS_STREAM_DECODE is not set, its a normal playback stream
Please let me know if you have any other questions.


Ian @ un4seen

  • Administrator
  • Posts: 22253
Re: BASS for Android
« Reply #1636 on: 10 Oct '19 - 13:16 »
Is that version number the one that you're currently using or the previous one? In either case, please give the other one too, so that I can then check what changed between them. If your current version isn't the latest version (in the 1st post), please also try that.

Ionut Cristea

  • Posts: 1557
Re: BASS for Android
« Reply #1637 on: 10 Oct '19 - 17:24 »
33820164 version is the one of the current libs that are working. The ones that didn't worked were the one which i tried few days ago (were taken from the 1st post)

Ian @ un4seen

  • Administrator
  • Posts: 22253
Re: BASS for Android
« Reply #1638 on: 11 Oct '19 - 13:11 »
OK. The main difference since 2.4.14.4 (33820164) is that AAudio output is used by default (instead of OpenSLES) on Android 8.1 or above now. What Android version does your device have? If 8.1 or above, please try disabling AAudio (before calling BASS_Init) like this:

Code: [Select]
BASS.BASS_SetConfig(BASS.BASS_CONFIG_ANDROID_AAUDIO, 0); // disable AAudio

And see if the problem still happens then. You could also try AudioTrack output by adding BASS_DEVICE_AUDIOTRACK to your BASS_Init call. Also confirm whether the problem is only affecting "push" streams, or all streams?

Ionut Cristea

  • Posts: 1557
Re: BASS for Android
« Reply #1639 on: 11 Oct '19 - 15:13 »
I have tested with Android P & 10 and reproduced the issue. I will try your suggestions in few days. Thank you.

RickAnton

  • Posts: 1
Re: BASS for Android
« Reply #1640 on: 31 Oct '19 - 16:54 »
A huge thanks for you guys making these libs available for us all for free. Kudos. Propz. 
« Last Edit: 31 Oct '19 - 17:06 by RickAnton »

gicci

  • Posts: 67
Re: BASS for Android
« Reply #1641 on: 2 Nov '19 - 12:04 »
Hi Ian,

the latest BASS release (0x02040E15) does not play properly MIDI files in my app: there are lots of cracklings in the playback, something that does not happen at all if I restore the previous one (0x02040E04).
Disabling AAudio, as you suggested to another user make it work again correctly, so it is for sure connected to that. If this could help I am using playback with 32 bits at 48000 kHz.

Ian @ un4seen

  • Administrator
  • Posts: 22253
Re: BASS for Android
« Reply #1642 on: 4 Nov '19 - 14:57 »
Please confirm what device and Android version you're using, and whether you're customising the BASS_CONFIG_DEV_BUFFER or BASS_CONFIG_DEV_PERIOD settings. Please also see if setting BASS_CONFIG_ANDROID_AAUDIO to 2 (via BASS_SetConfig) makes any difference.

Greenmile

  • Posts: 167
Re: BASS for Android
« Reply #1643 on: 4 Nov '19 - 16:14 »
Sorry about my maybe bad question, but ... Is there an easy instruction of how to use Bass in Delphi 10.2 Firemonkey Android?
What files do i need to build as a ressource? libbass.so? What Unit to get my commands like "init"? I download the package but don't now, wich files i exactly need. The .SO files? For ARM ..?

Ian @ un4seen

  • Administrator
  • Posts: 22253
Re: BASS for Android
« Reply #1644 on: 5 Nov '19 - 16:05 »
I'm not familiar with Firemonkey, so I'm afraid I can't help with the specifics of that, but the "libs" directory from the BASS package needs to be included in your app (you can remove any unwanted architectures from it, eg. the old "armeabi"). If you open the app's generated APK file in ZIP software, you should see the BASS libraries in a "lib" folder.

Perhaps there are some generic instructions for using native libraries (like BASS) with Firemonkey on Android?

gicci

  • Posts: 67
Re: BASS for Android
« Reply #1645 on: 8 Nov '19 - 19:49 »
Please confirm what device and Android version you're using, and whether you're customising the BASS_CONFIG_DEV_BUFFER or BASS_CONFIG_DEV_PERIOD settings. Please also see if setting BASS_CONFIG_ANDROID_AAUDIO to 2 (via BASS_SetConfig) makes any difference.

Sorry for the late reply. I am testing on Android 9 with a Samsung S10+.
I do not set BASS_CONFIG_DEV_BUFFER or BASS_CONFIG_DEV_PERIOD.
With BASS_CONFIG_ANDROID_AAUDIO set to 2 (or to 0) the files play ok. Setting it to 1 the crackings are present.

Ian @ un4seen

  • Administrator
  • Posts: 22253
Re: BASS for Android
« Reply #1646 on: 11 Nov '19 - 14:07 »
Setting BASS_CONFIG_ANDROID_AAUDIO to 2 disables AAudio's low latency mode, so it sounds like the problem is related to that. I will send you a debug version for more info.

otherside

  • Posts: 53
Re: BASS for Android
« Reply #1647 on: 14 Nov '19 - 09:57 »
Hello. I have a problem with new version of bass that is related to AAudio.

If I press 1) play 2) pause 3) after 1-2 seconds play - AAudioStream_requestStop is getting called without AAudioStream_requestStart and audio is not being played.

Also I tried to disable AAudio mode without success. Nothing changed in terms of sound and I still saw messages:
AAudioStream_requestStart - (when play)
AAudioStream_requestStop - (2-3 seconds after pause)

This is how I tried to disable it:
Code: [Select]
BASS.BASS_Init(-1, strToIntDef, 0)
BASS.BASS_SetConfig(BASS.BASS_CONFIG_ANDROID_AAUDIO, 0)

Actually I was able to disable it by setting
Code: [Select]
BASS.BASS_Init(-1, strToIntDef, BASS_DEVICE_AUDIOTRACK)But it is not the way I need


Ian @ un4seen

  • Administrator
  • Posts: 22253
Re: BASS for Android
« Reply #1648 on: 14 Nov '19 - 16:31 »
Hello. I have a problem with new version of bass that is related to AAudio.

If I press 1) play 2) pause 3) after 1-2 seconds play - AAudioStream_requestStop is getting called without AAudioStream_requestStart and audio is not being played.

Also I tried to disable AAudio mode without success. Nothing changed in terms of sound and I still saw messages:
AAudioStream_requestStart - (when play)
AAudioStream_requestStop - (2-3 seconds after pause)

I don't seem to be able to reproduce that problem here. Please confirm what Android and BASS versions you're using (what BASS_GetVersion reports). Also confirm whether you're using BASS_ChannelPause/Play or BASS_Pause/Start, and are the calls reporting success in their return values?

This is how I tried to disable it:
Code: [Select]
BASS.BASS_Init(-1, strToIntDef, 0)
BASS.BASS_SetConfig(BASS.BASS_CONFIG_ANDROID_AAUDIO, 0)

BASS_CONFIG_ANDROID_AAUDIO needs to be set before calling BASS_Init for the new setting to take effect.

otherside

  • Posts: 53
Re: BASS for Android
« Reply #1649 on: 20 Nov '19 - 10:53 »
BASS_CONFIG_ANDROID_AAUDIO needs to be set before calling BASS_Init for the new setting to take effect.

Thanks. That solved the problem