Author Topic: BASS for Android  (Read 719686 times)

Ian @ un4seen

  • Administrator
  • Posts: 23938
Re: BASS for Android
« Reply #1875 on: 4 Aug '21 - 14:17 »
I'm unfamiliar with LibGDX, so unfortunately I won't be able to help with that. If it includes support for using native libraries then that should hopefully allow BASS to be used with it.

crossinu

  • Posts: 6
Re: BASS for Android
« Reply #1876 on: 6 Aug '21 - 05:10 »
I'm unfamiliar with LibGDX, so unfortunately I won't be able to help with that. If it includes support for using native libraries then that should hopefully allow BASS to be used with it.
Oh okay.

jnyang

  • Guest
Re: BASS for Android
« Reply #1877 on: 6 Aug '21 - 08:59 »
Oh yes, I'm able to reproduce that here too. It's an alignment issue in the tag/comment reading, which seems to have been caused by a compiler change from GCC (NDK 10e) to Clang (NDK 14b) in the latest BASSOPUS build. Here's an update built with NDK 16b, which seems to fix the problem...

The stuff build works well on both 32-bit and 64-bit ARM devices. Thanks for your quick update!

Ian @ un4seen

  • Administrator
  • Posts: 23938
Re: BASS for Android
« Reply #1878 on: 6 Aug '21 - 13:51 »
Great! The BASSOPUS update is up in the main Android BASS package now.

Version diff

  • Guest
Re: BASS for Android
« Reply #1879 on: 9 Aug '21 - 07:40 »
Hi, Where can I know the version difference on August 2?

Ian @ un4seen

  • Administrator
  • Posts: 23938
Re: BASS for Android
« Reply #1880 on: 9 Aug '21 - 13:55 »
That was the BASSOPUS update mentioned above.

artX

  • Guest
Re: BASS for Android
« Reply #1881 on: 11 Aug '21 - 14:41 »
having trouble loading a file with "BASS_Sampleload" like this in java.
Code: [Select]
int sample = BASS.BASS_SampleLoad(fileName, 0, 0, 8, BASS.BASS_SAMPLE_OVER_POS);

example above throws BASS_ERROR_FILEFORM while loading blank wav file. I tried loading same file with BASSTEST.exe too. I would appreciate any help. 😥

google drive link to the WAV file is as.
https://drive.google.com/file/d/1p962g1NrZ7B7tQxOVmTr7v6_DJrCFi-t/view?usp=sharing

Ian @ un4seen

  • Administrator
  • Posts: 23938
Re: BASS for Android
« Reply #1882 on: 11 Aug '21 - 16:51 »
BASS does currently reject empty WAV files (0 length "data" chunk). If you add any data to the file then it should become playable.

artX

  • Guest
Re: BASS for Android
« Reply #1883 on: 22 Aug '21 - 11:10 »
then... are there any methods to discriminate blank files other then error code 2 or a flag that allows BASS to accept blank files? I would very much appreciate any 😇

Ian @ un4seen

  • Administrator
  • Posts: 23938
Re: BASS for Android
« Reply #1884 on: 23 Aug '21 - 16:59 »
I'm afraid there isn't currently any way to detect if a WAV file was rejected specifically due to no data, but the BASS_ERROR_EMPTY error code could perhaps be used for that. I'll look into that for the next update.

Ian @ un4seen

  • Administrator
  • Posts: 23938
Re: BASS for Android
« Reply #1885 on: 8 Sep '21 - 15:02 »
A BASS update (2.4.16.7) is up now in the 1st post. Rather than giving a new error code for them, BASS_StreamCreateFile will now accept empty WAV files (might be useful for tag reading purposes). Note that BASS_SampleLoad will still fail (BASS_ERROR_EMPTY) with an empty file (of any format) though.

hamidi

  • Guest
Re: BASS for Android
« Reply #1886 on: 12 Sep '21 - 12:55 »
hi
how  can play local file from xamarin with this? Bass.ChannelPlay

Ian @ un4seen

  • Administrator
  • Posts: 23938
Re: BASS for Android
« Reply #1887 on: 23 Sep '21 - 15:13 »
The Android version of the BASSmix 2.4.11 release is up in the 1st post.

rrhh_fx

  • Posts: 25
Re: BASS for Android
« Reply #1888 on: 16 Oct '21 - 12:42 »
I am not able to load properly a SF2pack file

Code: [Select]
BASSMIDI.BASS_MIDI_FontInit(new BASS.Asset(getAssets(), packName), 0);

libbassflac.so and libbasswv.so are loaded. If using SF2 files, fonts are loaded properly. Any help is appreciated

EDIT: finally working. BASS_PluginLoad() was being called just before loading the font, and maybe that method works in a thread?
« Last Edit: 16 Oct '21 - 13:40 by rrhh_fx »

nelson13

  • Posts: 13
Re: BASS for Android
« Reply #1889 on: 17 Oct '21 - 17:08 »
Ah, it looks like the issue there is that BASS isn't currently decoding the filename (eg. converting %20 to a space) before sending it to the FTP server. Try using Android's URLDecoder class on the URL:

Code: [Select]
stream = BASS.BASS_StreamCreateURL(URLDecoder.decode(url), ...);
I keep having problems with some URLs

send a private message with an example

rrhh_fx

  • Posts: 25
Re: BASS for Android
« Reply #1890 on: 22 Oct '21 - 13:05 »
I am experiencing an issue after loading and using multiple fonts with the same MIDI stream. I am using the last BASS version, but it also happens on previous ones. The sequence is next

- FontInit
- stream=BASSMIDI.BASS_MIDI_StreamCreate(1,0 ,0);
- Set Font to the stream
- FontFree the previous font
- Process and play some MIDI events over some seconds

If the sequence is made multiple times (even using the same font), after some number of times, the stream will not play anything, instead everything looks fine (SetStreamFont, ChannelPlay returns true, BASS_ErrorGetCode() returns 0 and apparently the events are processed). Simply no sound. Once it starts failing, next sequences will also play no sound, until the app is restarted.

Sometimes it starts failing after 10 sequences, some other with 100 sequences, but at some point it always happen.

Ian @ un4seen

  • Administrator
  • Posts: 23938
Re: BASS for Android
« Reply #1891 on: 22 Oct '21 - 17:14 »
That sounds strange. A few questions... When you say "If the sequence is made multiple times (even using the same font)", are you using the same font handle or are you calling BASS_MIDI_FontInit again each time? If the latter, does reusing the existing font handle prevent the problem? Conversely, does reopening the soundfont and setting it on the same stream also eventually produce the problem? When the problem is happening, is the BASS_ATTRIB_MIDI_VOICES_ACTIVE value (from BASS_ChannelGetAttribute) stuck on 0?

Is the problem only happening when using BASS_MIDI_StreamCreate, eg. not BASS_MIDI_StreamCreateFile? If you're unsure, please see if you can reproduce it with the MIDITEST example included in the BASS package, ie. keep reloading the MIDI file and/or soundfont (whichever is required to produce it) in that and see if you eventually no longer hear the MIDI file. If the problem does happen, also note if the "loaded" display stays on 0 then.

Also confirm that you're using the latest BASSMIDI version (as well as the latest BASS mentioned).

rrhh_fx

  • Posts: 25
Re: BASS for Android
« Reply #1892 on: 22 Oct '21 - 18:21 »
That sounds strange. A few questions... When you say "If the sequence is made multiple times (even using the same font)", are you using the same font handle or are you calling BASS_MIDI_FontInit again each time? If the latter, does reusing the existing font handle prevent the problem? Conversely, does reopening the soundfont and setting it on the same stream also eventually produce the problem? When the problem is happening, is the BASS_ATTRIB_MIDI_VOICES_ACTIVE value (from BASS_ChannelGetAttribute) stuck on 0?

Is the problem only happening when using BASS_MIDI_StreamCreate, eg. not BASS_MIDI_StreamCreateFile? If you're unsure, please see if you can reproduce it with the MIDITEST example included in the BASS package, ie. keep reloading the MIDI file and/or soundfont (whichever is required to produce it) in that and see if you eventually no longer hear the MIDI file. If the problem does happen, also note if the "loaded" display stays on 0 then.

Also confirm that you're using the latest BASSMIDI version (as well as the latest BASS mentioned).

Regarding the first question, each sequence calls

Code: [Select]
int newFont = BASSMIDI.BASS_MIDI_FontInit(new BASS.Asset(getAssets(), packName), 0);
sf = new BASSMIDI.BASS_MIDI_FONTEX[1];

where sf is a global variable that will use newFont. Then, the MIDI handler is reused with BASS_MIDI_StreamCreate, sf is streamed to it, and the previous value of BASS_MIDI_FontInit is released with BASS_MIDI_FontFree. So reusing is not solving the issue. I think it is an approach very similar to the example test.

After creating the MIDI stream, BASS_SetConfig(BASS_CONFIG_MIDI_VOICES,15) is setted, but I have not checked BASS_ATTRIB_MIDI_VOICES_ACTIVE vale. I will test it.

I will try the MIDITEST using a loop to watch if it reproduces the issue too in BASS_MIDI_StreamCreateFile.

Yes, the last version of all libaries are being used.

EDIT: If BASS_StreamFree(midiHandler) is called at the start of the sequence, it seems that the issue is solved. Do BASS_MIDI_FontFree() should not no te enough to release the old font and reuse the previous handlers?

EDIT 2: If not using BASS_StreamFree, and forcing the issue to happen, when there is no sound, BASS_ATTRIB_MIDI_VOICES_ACTIVE is always adding a voice when each note event is processed, but the behaviour is not like when working properly, i.e. in a normal way, when a note arrives, BASS_ATTRIB_MIDI_VOICES_ACTIVE  adds a value when the note is playing, but decreases 1 unit when the note is off. When the issue is happening, no notes are heard, and BASS_ATTRIB_MIDI_VOICES_ACTIVE always adds (no substraction) and no sound.
« Last Edit: 25 Oct '21 - 09:35 by rrhh_fx »

Ian @ un4seen

  • Administrator
  • Posts: 23938
Re: BASS for Android
« Reply #1893 on: 25 Oct '21 - 12:23 »
EDIT: If BASS_StreamFree(midiHandler) is called at the start of the sequence, it seems that the issue is solved. Do BASS_MIDI_FontFree() should not no te enough to release the old font and reuse the previous handlers?

BASS_MIDI_FontFree will free all of a soundfont's resources. Unless there are multiple instances of the same soundfont (from multiple BASS_MIDI_FontInit calls), in which case the resources will only be fully freed when all instances have been freed.

If automatic compacting is enabled via BASS_CONFIG_MIDI_COMPACT (it is by default) then any currently unused samples will be unloaded whenever a MIDI stream is freed, eg. when you call BASS_StreamFree. Were you previously not freeing the MIDI streams? If so, that would result in a memory leak - you should free any streams when you're finished with them. You can use the BASS_CONFIG_HANDLES value (from BASS_GetConfig) to help check for stream handle leaks, ie. if that value keeps rising then there may be a leak.

EDIT 2: If not using BASS_StreamFree, and forcing the issue to happen, when there is no sound, BASS_ATTRIB_MIDI_VOICES_ACTIVE is always adding a voice when each note event is processed, but the behaviour is not like when working properly, i.e. in a normal way, when a note arrives, BASS_ATTRIB_MIDI_VOICES_ACTIVE  adds a value when the note is playing, but decreases 1 unit when the note is off. When the issue is happening, no notes are heard, and BASS_ATTRIB_MIDI_VOICES_ACTIVE always adds (no substraction) and no sound.

That looks like the stream might not be playing. Please also check what BASS_IsStarted and BASS_ChannelIsActive say. If BASS_IsStarted returns 0 then also try calling BASS_Start.

rrhh_fx

  • Posts: 25
Re: BASS for Android
« Reply #1894 on: 25 Oct '21 - 17:11 »
BASS_MIDI_FontFree will free all of a soundfont's resources. Unless there are multiple instances of the same soundfont (from multiple BASS_MIDI_FontInit calls), in which case the resources will only be fully freed when all instances have been freed.

If automatic compacting is enabled via BASS_CONFIG_MIDI_COMPACT (it is by default) then any currently unused samples will be unloaded whenever a MIDI stream is freed, eg. when you call BASS_StreamFree. Were you previously not freeing the MIDI streams? If so, that would result in a memory leak - you should free any streams when you're finished with them. You can use the BASS_CONFIG_HANDLES value (from BASS_GetConfig) to help check for stream handle leaks, ie. if that value keeps rising then there may be a leak.

Exactly, I was reusing the MIDI streams using BASSMIDI.BASS_MIDI_StreamCreate, assuming that the older instances will be freed through the Garbage collector. But BASS is not Java (my fault). As you point, BASS_CONFIG_HANDLES were rising if not using BASS_StreamFree()

That looks like the stream might not be playing. Please also check what BASS_IsStarted and BASS_ChannelIsActive say. If BASS_IsStarted returns 0 then also try calling BASS_Start.
In that case, both methods return values that it seems than the streams are playing. But with your suggestions, it does not matter, since hopefully that situation will not appear again.

Thanks!