Author Topic: BASS for iOS (iPhone/iPad)  (Read 460331 times)

Ian @ un4seen

  • Administrator
  • Posts: 20437
Re: BASS for iOS (iPhone/iPad)
« Reply #1200 on: 4 Aug '17 - 15:20 »
Great to hear that you have got it working. I was unaware of the main thread requirement myself until Google suggested it (I don't think it's mentioned anywhere in Apple's documentation). I will add a note to the BASS_MIDI_InGetDeviceInfo documentation.

Are you sure BASS_Init needs to be called in the main thread too? I wouldn't have thought that would affect MIDI device enumeration (unless they're somehow linked internally within iOS).

AldoIlsant

  • Guest
Re: BASS for iOS (iPhone/iPad)
« Reply #1201 on: 4 Aug '17 - 15:34 »
"Are you sure BASS_Init needs to be called in the main thread too? I wouldn't have thought that would affect MIDI device enumeration (unless they're somehow linked internally within iOS)."

I couldn't get it to work until I moved BASS_Init to the main thread. So yes, I am sure. I think you should recommend that in Bass_Init documentation as well.

Thanks

Olek

  • Posts: 21
Re: BASS for iOS (iPhone/iPad)
« Reply #1202 on: 10 Aug '17 - 08:00 »
We faced with major battery drain on iOS devices. ~20% over eight hours. I'm not sure what caused the issue but one of the guesses it's mixer channel on pause while app in background mode.
Is it possible that paused mixer channel works in background and consumes power even if user doesn't use the app?

Oleg N

  • Posts: 86
Re: BASS for iOS (iPhone/iPad)
« Reply #1203 on: 10 Aug '17 - 09:58 »
@Olek,
 
Mixer should not consume anything when paused, as far as I know...

Are You calling BASS_Pause() when not playing? could save some 0.5 - 1 % of CPU load when paused in foreground.

But even without this - I hardly understand how it can consume something in background since in background iOS throttles down Your app once it stops playing audio, anyway.
Please make sure that Your channels are stopped/paused and BASS is paused when not playing, because it looks like iOS is thinking that the app is still playing, when, in fact, it isn't. Also check what other means may force iOS to keep the app running even though it is in background (Geolocation, Background task, e t.c.)

I've got app (player) that uses mixer too and CPU load is 0% when paused, both in background and foreground. We too had issues with battery drain but it turned out to be the problem of app organization, not related to BASS as such.
« Last Edit: 10 Aug '17 - 10:14 by Oleg N »

Olek

  • Posts: 21
Re: BASS for iOS (iPhone/iPad)
« Reply #1204 on: 10 Aug '17 - 15:03 »
@Oleg N,

Thanks for your reply!

I use BASS_ChannelPause() but going to try BASS_Pause() .

We use Audio and Air play background mode. It's needed feature.
I'm not sure that problem caused by BASS. But we don't have any other background tasks that might cause issue.





Oleg N

  • Posts: 86
Re: BASS for iOS (iPhone/iPad)
« Reply #1205 on: 11 Aug '17 - 17:15 »
@Olek,

Yes, "Audio & Airplay" is for staying alive in background for playback, but as soon as You pause playback - iOS will suddenly throttle down Your app anyway.
Why You just don't look at those gears in XCode (CPU, threads) and analyze what is eating up resources in Your case? You can see everything app consumes both in foreground and in background, playing or paused.
« Last Edit: 23 Aug '17 - 09:54 by Oleg N »

Ian @ un4seen

  • Administrator
  • Posts: 20437
Re: BASS for iOS (iPhone/iPad)
« Reply #1206 on: 28 Aug '17 - 17:39 »
The iOS version of the new BASSFLAC 2.4.4 release is up in the 1st post.

Ian @ un4seen

  • Administrator
  • Posts: 20437
Re: BASS for iOS (iPhone/iPad)
« Reply #1207 on: 30 Aug '17 - 17:56 »
The iOS version of the new BASSmix 2.4.9 release is up in the 1st post.

norbert

  • Posts: 122
Re: BASS for iOS (iPhone/iPad)
« Reply #1208 on: 10 Sep '17 - 16:32 »
I'm getting BASS_ERROR_FILEOPEN for PluginLoad only on real device iOS 10.2/3, on iOS Simulator it works fine (and it worked fine for over a year on real devices too!) !

Using Xamarin.iOS and the latest libbass<xy>.a:

Suddenly, after the last Xamarin.iOS update,  the bassflac,~wv,~opus plugins can't be loaded any more on my iPad:
The return code is 0 and BASS reports "BASS_ERROR_FILEOPEN".
The libbbass itself loads correctly.  And on simulator it works fine (iOS 10.2) !

Any ideas ?

Ian @ un4seen

  • Administrator
  • Posts: 20437
Re: BASS for iOS (iPhone/iPad)
« Reply #1209 on: 11 Sep '17 - 16:55 »
Please confirm how you using the BASS plugin system. Note that it's a bit different on iOS due to the fact that the BASS add-on libraries are statically linked into the app rather than dynamically loaded. I'm not familiar with how it should be done with Xamarin, but in C/C++/Objective-C, it should look something like this:

Code: [Select]
extern void BASSWVplugin;
BASS_PluginLoad(BASSWVplugin, 0);

Also confirm that the add-on libraries are being linked into your app.

norbert

  • Posts: 122
Re: BASS for iOS (iPhone/iPad)
« Reply #1210 on: 11 Sep '17 - 18:12 »
Yes I can confirm this. (the call is Bass.BASS_PluginLoad("BASSFLAC")  but internally  a flag BASS_UNICODE (=-2147483648) is passed as 2nd param.

Anyway, I have not changed neither the the plugin initialisation code  nor the linking for over a year, because it always worked both on device and simulator.

The strange thing is that it still works on the simulator!

norbert

  • Posts: 122
Re: BASS for iOS (iPhone/iPad)
« Reply #1211 on: 12 Sep '17 - 11:04 »
Solved: The actual problem was  that my device also got updated -  from iOS 10.2 to  10.3, which is not supported by  XCode 8.2.1.
Now I'm  using some "hack" to be able to deploy to "correctly" -to iOS 10.3.
Obviously this former incomatibilty caused some kind of "partial deployment"...probably the plugin *.a files were not included or linked incorrectly...

Ian @ un4seen

  • Administrator
  • Posts: 20437
Re: BASS for iOS (iPhone/iPad)
« Reply #1212 on: 3 Oct '17 - 18:00 »
The iOS version of the BASSHLS add-on is now included in the 1st post.

Wesley

  • Guest
Re: BASS for iOS (iPhone/iPad)
« Reply #1213 on: 24 Oct '17 - 12:50 »
When I play an AAC streaming with a preroll I get this error:

Code: [Select]
Packet with multiple raw data blocks was found - unsupported
ScanForPackets (AAC) failed

Is there any way to fix this?

I'm using these configs:

Code: [Select]
BASS_SetConfig(BASS_CONFIG_IOS_MIXAUDIO, 0);
BASS_SetConfig(BASS_CONFIG_NET_PLAYLIST, 1);
BASS_SetConfig(BASS_CONFIG_NET_PREBUF, 0);
BASS_SetConfig(BASS_CONFIG_IOS_NOCATEGORY, 0);

Ian @ un4seen

  • Administrator
  • Posts: 20437
Re: BASS for iOS (iPhone/iPad)
« Reply #1214 on: 24 Oct '17 - 13:29 »
BASS doesn't parse/decode MP4/AAC itself on iOS, but rather uses the OS's parser/decoder, so that is where that error message will be coming from. Unfortunately, that means there probably isn't much that can be done about it. If you're creating the MP4 files yourself, perhaps you can change the options that you're using to avoid the problem? Are you having the problem with a particular iOS version or is it happening with all versions?

Ian @ un4seen

  • Administrator
  • Posts: 20437
Re: BASS for iOS (iPhone/iPad)
« Reply #1215 on: 7 Nov '17 - 14:51 »
The iOS version of the new BASSenc_FLAC add-on is now up in the 1st post.

norbert

  • Posts: 122
Re: BASS for iOS (iPhone/iPad)
« Reply #1216 on: 18 Nov '17 - 10:59 »
I'm getting BASS_ERROR_FILEOPEN for BASSWV on a real device running iOS 11:

- Only in release mode (using the submitted .ipa via Testflight)
- It loads correctly when deploying in debug mode
- BASS itself loads correctly in release mode

So it shouldn't be a bitcode issue (I've set it to disabled, and getting not errors anyway, the app works, just plugin loading fails) ?
I've also tried disabling llvm.

What else could be the problem ? (I'm using Xamarin.iOS) ? The mtouch arguments are the same for debug and release buid, assembly linking is always set to "all".

Ian @ un4seen

  • Administrator
  • Posts: 20437
Re: BASS for iOS (iPhone/iPad)
« Reply #1217 on: 20 Nov '17 - 15:25 »
I assume you're getting the BASS_ERROR_FILEOPEN error from BASS_PluginLoad. Are you having that problem only with the BASSWV add-on, or all add-ons? If it's fine in debug mode but not release mode, perhaps the linker is optimizing the BASSWV library out because you're not directly calling any functions in it? If that is the case, perhaps there is a linker option to tell it not to do that with specific libraries? If there isn't such an option, you could try adding a BASS_WV_StreamCreateFile call with an empty filename during initialization.

norbert

  • Posts: 122
Re: BASS for iOS (iPhone/iPad)
« Reply #1218 on: 20 Nov '17 - 18:25 »
Yes all plugins fail to load. And I already did the trick with "BASS_WV_StreamCreateFile call with an empty filename".

But I just found that if I un-check "Strip native debugging symbols", the plugins are loaded. But normally you don't want to have debugging stuff in a relase build...and the ipa file becomes larger (about 30%)

Ian @ un4seen

  • Administrator
  • Posts: 20437
Re: BASS for iOS (iPhone/iPad)
« Reply #1219 on: 21 Nov '17 - 16:43 »
That sounds like the "Strip native debugging symbols" option is removing the "BASSWVplugin" symbol, which BASS_PluginLoad will look for when you pass it "BASSWV". Perhaps you can tell the linker to keep that particular symbol?

On iOS, there are 2 ways to load plugins with BASS_PluginLoad. You can either pass the add-on's name like on other platforms, or you can pass its plugin symbol. The latter method should prevent the symbol being removed. I'm not sure how you would do it with Xamarin, but in C/C++, it can be used like this:

Code: [Select]
extern void BASSWVplugin;
BASS_PluginLoad(&BASSWVplugin, 0);

For other add-ons, you would simply replace the "BASSWV" part.

norbert

  • Posts: 122
Re: BASS for iOS (iPhone/iPad)
« Reply #1220 on: 21 Nov '17 - 20:20 »
At least there is no other way of loading a plugin in the C# Wrapper library, only the one with "string filename".
However I'm also calling
Code: [Select]
BassWv.BASS_WV_StreamCreateFile("", 0, 0, BASSFlag.BASS_STREAM_DECODE) after BAss.BASS_PluginLoad, so the linker sees that the type BassWv is used and it does not strip it (otherwise it would need to remove the call BassWv.BASS_WV_StreamCreateFile, too). But somehow the libbasswv.a is not included/loaded.

There is an option to tell the linker whether the native reference contains C++ code. Is there any ?
« Last Edit: 21 Nov '17 - 20:30 by norbert »

Ian @ un4seen

  • Administrator
  • Posts: 20437
Re: BASS for iOS (iPhone/iPad)
« Reply #1221 on: 22 Nov '17 - 14:00 »
I'm not a .Net or Xamarin user myself, so I don't know if this is possible, but perhaps you can let it know about the plugin symbol with DllImport?

Code: [Select]
[DllImport("__Internal")]
public static extern void BASSWVplugin();

And then use that symbol somehow (don't call it - it isn't a function) to stop it being stripped.

norbert

  • Posts: 122
Re: BASS for iOS (iPhone/iPad)
« Reply #1222 on: 22 Nov '17 - 17:42 »
Thanks - that did the trick ! I just put this declaration into the BassWv class. Interesting: I did not do this with the other plugins (flac, opus, I guess it would be BASSFLACplugin() ?) but suddenly they also load correctly - as if the one plugin would pull the others with it...