BASS for iOS (iPhone/iPad)

Started by Ian @ un4seen,

teq

I use BASS with Unity. I recently noticed that another 3rd-party project that also uses BASS has subfolder called "Headers" in the iOS folder.
In my experience the app can be compiled without these headers, but may be i did it wrong...So could you please clarify if you need to use headers for iOS builds?

Ian @ un4seen

What are the files in that "Headers" folder? If it's the C/C++ headers (eg. BASS.H) then I don't think they would be needed when using Unity/C#.

Anthony Y

I have linked libbass.xcframework and bass.h files but getting
Undefined symbol: _vDSP_fft_zip
Undefined symbol: _vDSP_create_ffsetup
error messages.

Does it mean I have done something wrong?

The error occurs when calling BASS_Init as below,
if ((BASS_Init(-1, 44100, DWORD(BASS_DEVICE_AUDIOTRACK), nil, nil) == 0)) {
   ...
   ...
}

jnyang

Hi Ian, is there any plan to support XCFramework format for the BASS_FX plugin? It seems that that plugin is not converted to the XCFramework format yet.

jnyang

Also, it seems that configuring BASS_CONFIG_IOS_SESSION with the BASS_SetConfig function does not work on the latest version (BASS_GetVersion() = 33820675).

Ian @ un4seen

Quote from: Anthony YI have linked libbass.xcframework and bass.h files but getting
Undefined symbol: _vDSP_fft_zip
Undefined symbol: _vDSP_create_ffsetup
error messages.

Does it mean I have done something wrong?

The error occurs when calling BASS_Init as below,
if ((BASS_Init(-1, 44100, DWORD(BASS_DEVICE_AUDIOTRACK), nil, nil) == 0)) {
   ...
   ...
}

Adding the Accelerate framework to your project should fix that.

It won't cause a problem, but you can also remove the BASS_DEVICE_AUDIOTRACK flag from the BASS_Init call, as that only has effect on Android.

Quote from: jnyangHi Ian, is there any plan to support XCFramework format for the BASS_FX plugin? It seems that that plugin is not converted to the XCFramework format yet.

The BASS_FX link in the first post has now been updated with an XCFramework version.

Quote from: jnyangAlso, it seems that configuring BASS_CONFIG_IOS_SESSION with the BASS_SetConfig function does not work on the latest version (BASS_GetVersion() = 33820675).

That's strange. What setting are you trying to use in the BASS_SetConfig call? And are you doing that before or after the BASS_Init call? If after, please try before and see if that makes any difference.

jnyang

Quote from: Ian @ un4seenThe BASS_FX link in the first post has now been updated with an XCFramework version.
Thanks for your quick update!

Quote from: Ian @ un4seen
Quote from: jnyangAlso, it seems that configuring BASS_CONFIG_IOS_SESSION with the BASS_SetConfig function does not work on the latest version (BASS_GetVersion() = 33820675).

That's strange. What setting are you trying to use in the BASS_SetConfig call? And are you doing that before or after the BASS_Init call? If after, please try before and see if that makes any difference.

My original code called BASS_SetConfig before calling BASS_Init. Adjusting BASS_CONFIG_IOS_SESSION before calling BASS_Init worked on the previous version.

It seems that adjusting that config just right after calling BASS_Init works well. I also tried to create a new project to test its behavior without any bias, both in Objective-C and Swift, and the same issue happens. Maybe this behaviour needs to be mentioned in the documentation :)

Also, when I created the new project, I found that "AVFoundation.framework" is required to use BASS, which is not mentioned in the 1st post. Thanks!

Ian @ un4seen

The AVFoundation framework is indeed required with the latest BASS version. I've added it to the framework list in the 1st post now.

Regarding the BASS_CONFIG_IOS_SESSION issue, please also confirm what value you're using in the BASS_SetConfig call (in case it's making a difference).

jnyang

Quote from: Ian @ un4seenThe AVFoundation framework is indeed required with the latest BASS version. I've added it to the framework list in the 1st post now.

Regarding the BASS_CONFIG_IOS_SESSION issue, please also confirm what value you're using in the BASS_SetConfig call (in case it's making a difference).

I initially tried to set BASS_CONFIG_IOS_SESSION to 0 for configuring audio session category to AVAudioSessionCategoryPlayback, and it didn't worked. Then I tried to set it to different values (e.g., BASS_IOS_SESSION_MIX, BASS_IOS_SESSION_DISABLE, etc.), but none of them worked.

For your information, I tried to make a new project, configured all required frameworks (Accelerate, AudioToolbox, AVFoundation, CFNetwork, SystemConfiguration), added libbass.xcframework (with setting "Embed & Sign" on the project setting panel), and added some codes in AppDelegate.swift (or AppDelegate.m for Objective-C) like this:
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
  print(BASS_GetVersion())
  BASS_SetConfig(DWORD(BASS_CONFIG_IOS_SESSION), DWORD(BASS_IOS_SESSION_DISABLE))
 
  return true
}

BASS_GetVersion() worked well (i.e., the BASS library is loaded), but calling BASS_SetConfig throws an error "EXC_BAD_ACCESS (code=1, address=0x0)". The test was proceeded on the iPhone with the latest iOS (iOS 14.7) and Simulator. The latest Xcode (12.5.1) was used. Please let me know if I can provide any further information. Thanks.

Anthony Y

Hi Ian,

Is there bass_midi.h file like bass.h?

I am trying to call BASS_MIDI_FontInit(...) to start with.

Ian @ un4seen

Quote from: jnyangI initially tried to set BASS_CONFIG_IOS_SESSION to 0 for configuring audio session category to AVAudioSessionCategoryPlayback, and it didn't worked. Then I tried to set it to different values (e.g., BASS_IOS_SESSION_MIX, BASS_IOS_SESSION_DISABLE, etc.), but none of them worked.

For your information, I tried to make a new project, configured all required frameworks (Accelerate, AudioToolbox, AVFoundation, CFNetwork, SystemConfiguration), added libbass.xcframework (with setting "Embed & Sign" on the project setting panel), and added some codes in AppDelegate.swift (or AppDelegate.m for Objective-C) like this:
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
  print(BASS_GetVersion())
  BASS_SetConfig(DWORD(BASS_CONFIG_IOS_SESSION), DWORD(BASS_IOS_SESSION_DISABLE))
 
  return true
}

BASS_GetVersion() worked well (i.e., the BASS library is loaded), but calling BASS_SetConfig throws an error "EXC_BAD_ACCESS (code=1, address=0x0)". The test was proceeded on the iPhone with the latest iOS (iOS 14.7) and Simulator. The latest Xcode (12.5.1) was used. Please let me know if I can provide any further information. Thanks.

Ah! I see now there is indeed a problem when trying to set BASS_CONFIG_IOS_SESSION before either BASS_Init or BASS_GetDeviceInfo/RecordGetDeviceInfo has been called. An update to fix that is up now in the first post. Please try that and let me know if you still have the problem with it.

Quote from: Anthony YIs there bass_midi.h file like bass.h?

I am trying to call BASS_MIDI_FontInit(...) to start with.

The C/C++ headers are the same on all platforms, so you can take the BASSMIDI.H file from one of the Win32/Linux/macOS BASSMIDI packages on the BASS webpage. The documentation can also be taken from those packages.

jnyang

Quote from: Ian @ un4seenAh! I see now there is indeed a problem when trying to set BASS_CONFIG_IOS_SESSION before either BASS_Init or BASS_GetDeviceInfo/RecordGetDeviceInfo has been called. An update to fix that is up now in the first post. Please try that and let me know if you still have the problem with it.

The latest update works well when I try to set BASS_CONFIG_IOS_SESSION before calling BASS_Init. Thanks for your quick fix! :D

Anthony Y

Regarding your reply:
The C/C++ headers are the same on all platforms, so you can take the BASSMIDI.H file from one of the Win32/Linux/macOS BASSMIDI packages on the BASS webpage. The documentation can also be taken from those packages.

-----

I have downloaded bass24-osx and found bass.h but I can't find bassmidi.h anywhere. Not in bass24-ios.zip too.
Can you please provide me a link where I can download the header files? I need enc, enc_mp3 as well.

jnyang

Quote from: Anthony YI have downloaded bass24-osx and found bass.h but I can't find bassmidi.h anywhere. Not in bass24-ios.zip too.
Can you please provide me a link where I can download the header files? I need enc, enc_mp3 as well.

You can find it on the "add-ons" section of the BASS library page.
http://www.un4seen.com/bass.html#addons

Anthony Y

Quote from: jnyang
Quote from: Anthony YI have downloaded bass24-osx and found bass.h but I can't find bassmidi.h anywhere. Not in bass24-ios.zip too.
Can you please provide me a link where I can download the header files? I need enc, enc_mp3 as well.

You can find it on the "add-ons" section of the BASS library page.
http://www.un4seen.com/bass.html#addons

Holy Moly! why didn't I see that. Thank you so much.

Ian @ un4seen

The iOS version of the BASSHLS 2.4.3 release is up in the 1st post.

Ian @ un4seen

The iOS version of the BASSmix 2.4.11 release is up in the 1st post.

Ian @ un4seen

The iOS versions of BASS and the add-ons have now been moved from this thread to the BASS webpage (alongside the Win32/Linux/macOS packages), so new releases will no longer be posted in this thread (betas may still be).

jnyang

Quote from: Ian @ un4seenThe iOS versions of BASS and the add-ons have now been moved from this thread to the BASS webpage (alongside the Win32/Linux/macOS packages), so new releases will no longer be posted in this thread (betas may still be).

Just a minor finding: the zipped file of BASSOPUS for iOS contains bassopus.dll instead of bassopus.h.

Ian @ un4seen

Oops! That has been corrected now, thanks.