Author Topic: BASS for Android  (Read 394425 times)

Ian @ un4seen

  • Administrator
  • Posts: 20489
Re: BASS for Android
« Reply #1325 on: 19 Oct '17 - 16:11 »
A BASS update that adds support for using AudioTrack output (instead of OpenSL ES) is up now in the 1st post. See the post for details.

otherside

  • Posts: 24
Re: BASS for Android
« Reply #1326 on: 22 Oct '17 - 10:47 »

Ian @ un4seen

  • Administrator
  • Posts: 20489
Re: BASS for Android
« Reply #1327 on: 7 Nov '17 - 14:52 »
The Android version of the new BASSenc_FLAC add-on is now up in the 1st post.

dieppa

  • Posts: 3
Re: BASS for Android
« Reply #1328 on: 28 Nov '17 - 11:04 »
Hi. I am trying to play songs but it always returns 0 to the channel. Can someone tell me what am I doing wrong? Thanks!

int channel =222;
BASS.BASS_MusicFree(channel);
                BASS.BASS_StreamFree(channel);


                channel = BASS.BASS_StreamCreateFile(choosedSong, 0, 0, BASS.BASS_SAMPLE_LOOP);
                channel = BASS.BASS_MusicLoad(choosedSong, 0, 0, BASS.BASS_SAMPLE_LOOP | BASS.BASS_MUSIC_RAMP, 1);
                BASS.BASS_ChannelPlay(channel, false);

Edit:

I forgot to initialize the device  8) 8) 8) 8)
« Last Edit: 28 Nov '17 - 12:02 by dieppa »

dieppa

  • Posts: 3
Re: BASS for Android
« Reply #1329 on: 29 Nov '17 - 09:52 »
Hello, is there a way to set Bass boost and gain levels using FX? Thanks in advance.

Ian @ un4seen

  • Administrator
  • Posts: 20489
Re: BASS for Android
« Reply #1330 on: 30 Nov '17 - 14:02 »
You can use the BASS_FX_DX8_PARAMEQ effect via BASS_ChannelSetFX to apply a bass boost. For example, something like this:

Code: [Select]
int bboostfx = BASS.BASS_ChannelSetFX(channel, BASS.BASS_FX_DX8_PARAMEQ, 0); // set an EQ effect on a BASS channel
BASS.BASS_DX8_PARAMEQ param = new BASS.BASS_DX8_PARAMEQ();
param.fCenter = 100;
param.fBandwidth = 12;
param.fGain = 6;
BASS.BASS_FXSetParamters(bboostfx, param); // apply the parameters

You can play around with the parameters to find something that you like.

The BASS_ATTRIB_VOL option can be used (via BASS_ChannelSetAttribute) to control overall level, but it currently doesn't allow amplification with standard playback (it does with a mixer). For that, you can use the BASS_FX add-on's BASS_FX_BFX_VOLUME effect, again via BASS_ChannelSetFX. For example:

Code: [Select]
int volfx = BASS.BASS_ChannelSetFX(channel, BASS_FX.BASS_FX_BFX_VOLUME, 0);
BASS_FX.BASS_BFX_VOLUME param = new BASS_FX.BASS_BFX_VOLUME();
param.lChannel = 0;
param.fVolume = Math.pow(10.0, gaindb / 20.0);
BASS.BASS_FXSetParameters(volfx, param);

Note that the BASS_FX library needs to loaded before you can use its effects. You can force it to be loaded by calling a function from it, eg. BASS_FX_GetVersion during initialization.

dejan

  • Guest
Re: BASS for Android
« Reply #1331 on: 19 Dec '17 - 13:11 »
Is there a Bass support for playing MOD/IT/XM on Android?

Ian @ un4seen

  • Administrator
  • Posts: 20489
Re: BASS for Android
« Reply #1332 on: 19 Dec '17 - 17:16 »
Yes, the BASS library includes built-in support for those file formats. You would use the BASS_MusicLoad function to load them. Please see the BASS_MusicLoad documentation for details.

Ian @ un4seen

  • Administrator
  • Posts: 20489
Re: BASS for Android
« Reply #1333 on: 19 Dec '17 - 18:10 »
The Android version of the new BASS 2.4.13 release is up in the 1st post.

gicci

  • Posts: 35
Re: BASS for Android
« Reply #1334 on: 20 Dec '17 - 09:32 »
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.

dejan

  • Guest
Re: BASS for Android
« Reply #1335 on: 20 Dec '17 - 15:48 »
I have tried using BASS.BASS_MusicLoad() to play any MOD/IT/XM file, unfortunately it does not work, I am using new Android Studio 3.0.
I have tried all three method variants of MusicLoad(), file, asset, bytebuffer that is -- file and asset just do not work while passing the song bytebuffer actually crashes the app.

Is there any available example of doing it on Android?

Ian @ un4seen

  • Administrator
  • Posts: 20489
Re: BASS for Android
« Reply #1336 on: 20 Dec '17 - 16:41 »
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.

I have tried using BASS.BASS_MusicLoad() to play any MOD/IT/XM file, unfortunately it does not work, I am using new Android Studio 3.0.
I have tried all three method variants of MusicLoad(), file, asset, bytebuffer that is -- file and asset just do not work while passing the song bytebuffer actually crashes the app.

Please check the error code by calling BASS_ErrorGetCode straight after the failed BASS_MusicLoad call.

Is there any available example of doing it on Android?

The DSPTEST and FXTEST examples in the Android BASS package include support for MOD files. They try to open the user's selected file like this:

Code: [Select]
if ((chan=BASS.BASS_StreamCreateFile(file, 0, 0, BASS.BASS_SAMPLE_LOOP))==0
&& (chan=BASS.BASS_MusicLoad(file, 0, 0, BASS.BASS_SAMPLE_LOOP|BASS.BASS_MUSIC_RAMP, 1))==0) {

dejan

  • Guest
Re: BASS for Android
« Reply #1337 on: 20 Dec '17 - 17:09 »
Thanks for your help Ian.

I am trying to load a module from the application asset folder. When I try to pass the ByteBuffer to MusicLoad() native crash happens and I do not know how to catch that one. :(

Anyhow here is the log of an error if that would be of any help:
https://hastebin.com/fivuqovexi

Also, what is the proper way of doing MusicLoad() with BASS.Asset? Where the module file should be exactly stored?

Ian @ un4seen

  • Administrator
  • Posts: 20489
Re: BASS for Android
« Reply #1338 on: 20 Dec '17 - 18:11 »
I think the "BASS.Asset" method will unfortunately only work with non-compressed assets. Already compressed audio (MP3/etc) is likely to be just stored in the app's APK file, but MOD files will probably be compressed. In that case, you could read the asset into a ByteBuffer and pass that to BASS_MusicLoad. When doing that, make sure you pass the length of the file in the "length" parameter.