BASS for iOS (iPhone/iPad)

Started by Ian @ un4seen,

Ian @ un4seen

Unfortunately, there currently aren't any official examples for iOS, but you basically just need to #include the bass.h file (take that from the Windows/Linux/macOS BASS package) in your code and add the libbass.a file to your project's "Link Binary With Libraries" settings (also add the required frameworks from the first post there). That's when using Objective-C, at least. I'm not a Swift user, so I'm not sure about that.

Regarding the actual code, the BASS function calls will be basically the same on all platforms, so you could have a look at the examples included in the other platform packages for pointers.

promusicbisceglie

Nope  :'(
I tryed just compiling  64armv7 or i386 ... same problem...
I use bass, bass_midi, and now bass_enc and them works great... problem is just when i use libbass_fx.a
i need use only and just 2 functions...
//function BASS_FX_GetVersion: DWORD; cdecl; external 'libbass_fx.a' name 'BASS_FX_GetVersion';
  //function BASS_FX_TempoCreate(chan, flags: DWORD): HSTREAM; cdecl; external 'libbass_fx.a' name 'BASS_FX_TempoCreate';

punit.silversky

Quote from: Ian @ un4seenUnfortunately, there currently aren't any official examples for iOS, but you basically just need to #include the bass.h file (take that from the Windows/Linux/macOS BASS package) in your code and add the libbass.a file to your project's "Link Binary With Libraries" settings (also add the required frameworks from the first post there). That's when using Objective-C, at least. I'm not a Swift user, so I'm not sure about that.

Regarding the actual code, the BASS function calls will be basically the same on all platforms, so you could have a look at the examples included in the other platform packages for pointers.

Hi, Ian

Thanks for the quick reply, I will try that you have suggested

Ian @ un4seen

Quote from: promusicbisceglieNope  :'(
I tryed just compiling  64armv7 or i386 ... same problem...
I use bass, bass_midi, and now bass_enc and them works great... problem is just when i use libbass_fx.a
i need use only and just 2 functions...
//function BASS_FX_GetVersion: DWORD; cdecl; external 'libbass_fx.a' name 'BASS_FX_GetVersion';
  //function BASS_FX_TempoCreate(chan, flags: DWORD): HSTREAM; cdecl; external 'libbass_fx.a' name 'BASS_FX_TempoCreate';

The big difference is that none of those other BASS/add-on libraries require the standard C++ library. From the RAD Studio docs, it looks like the solution may be to add "dependency" info in the bass_fx.pas file:

   http://docwiki.embarcadero.com/RADStudio/Seattle/en/Procedures_and_Functions#Specifying_Dependencies_of_the_Library

Something like this?

function BASS_FX_GetVersion: DWORD; cdecl; external 'libbass_fx.a' dependency 'c++';

promusicbisceglie

#1424
I'm become a little crazy  :'( :-\

i add to linker param :         -lc++
My 2 function are..
function BASS_FX_GetVersion: DWORD; cdecl; external 'libbass_fx.a' dependency 'c++' name 'BASS_FX_GetVersion' ;
function BASS_FX_TempoCreate(chan, flags: DWORD): HSTREAM; cdecl; external 'libbass_fx.a' dependency 'c++' name 'BASS_FX_TempoCreate';

same error...
    Error: "__Znwm", referenced from:      l082 in libbass_fx.a(libbass_fx.a-arm64-master.o);      l320 in libbass_fx.a(libbass_fx.a-arm64-master.o);
      Error: "__ZdlPv", referenced from:      _BASS_FX_BPM_Free in libbass_fx.a(libbass_fx.a-arm64-master.o);      l085 in libbass_fx.a(libbass_fx.a-arm64-master.o);      l322 in libbass_fx.a(libbass_fx.a-arm64-master.o);
      Error: "__ZdaPv", referenced from:      l251 in libbass_fx.a(libbass_fx.a-arm64-master.o);      l486 in libbass_fx.a(libbass_fx.a-arm64-master.o);

Why with ios sdk 13.6 this has worked great  without any c++ dependency???(now is not possibile use sdk 13.6 i must use sdk 14.x)

Can this '_BASS_FX_BPM_Free in libbass_fx.a'  be removed or modified ?? may be this 'function' generate problems?? 

this is my order num...... Fattura dell'ordine n. 568310653 del 24-LUG-2018

promusicbisceglie

[DCC Error] E2597 ld: library not found for -lstdc++
 :'(

Chris

which sdk have you in your SETUP?
Tools|Options, Deployment > SDK Manager ?

promusicbisceglie

already sayd 14.5. The previous sdk (13.6) worked great,
don't tell me use 13.6 becouse apple now need 14.5 to publish an app... :'( :'( :'(

Ian @ un4seen

Does RAD Studio have a "Deployment Target" option? If so, what is that set to, and does lowering it help? Can you try other iOS 14 SDK versions (eg. 14.0) or is 14.5 the only version available?

The BASS_APE and TAGS add-ons also require the standard C++ library, so I guess you get the same errors if you try removing BASS_FX from your code and using either of them?

promusicbisceglie

yes i use developement target... A.Store only when i must publish..
Never used BASS_APE , can you tell me some function in .pas like this below??
eg .. function BASS_Encode_Start(handle:HSTREAM; cmdline:PChar; flags:DWORD; proc:ENCODEPROC; user:Pointer): HENCODE;cdecl; external 'libbassenc.a' name 'BASS_Encode_Start';
Actually cannot downgrade less of 14.5 (need this version of xcode)

Ian @ un4seen

Quote from: promusicbisceglieyes i use developement target... A.Store only when i must publish..

No, I meant the "Deployment Target" setting, which sets the minimum iOS version that's required by the app. Here's what it looks like in Xcode:

   https://developer.apple.com/library/archive/documentation/ToolsLanguages/Conceptual/Xcode_Overview/WorkingwithTargets.html

Does RAD Studio have that option?

Quote from: promusicbisceglieNever used BASS_APE , can you tell me some function in .pas like this below??

BASS_APE only has 2 functions: BASS_APE_StreamCreateFile and BASS_APE_StreamCreateFileUser. You can get the BASS_APE.PAS file from the Win32 BASS_APE package (on the BASS webpage).

promusicbisceglie

i found my self...
BASS_APE is OK!! , bass_FX not :-\

promusicbisceglie

i've
in compiler -> linking options
Minimum iOS version supported = 11.0

Ian @ un4seen

Quote from: promusicbiscegliei found my self...
BASS_APE is OK!! , bass_FX not :-\

That's strange. Did you add a BASS_APE function call to your code? If not, please try that, because the linker probably won't include the BASS_APE library in the app if it isn't actually used.

promusicbisceglie

#1435
Yes , if you see the attachement you can see your self..
i added
function BASS_APE_StreamCreateFile(mem: BOOL; f: Pointer; offset, length: QWORD; flags: DWORD): HSTREAM; cdecl; external 'libbass_ape.a' name 'BASS_APE_StreamCreateFile';
and libbass_ape.a in the project root (where is bass, bassmidi etc..)... and it work
edit : In the example i send you i don't call BASS_FX and dont call BASS_APE..just declare bass_fx and crash

EDIT2.... While bassfx fails also if it is not call, bass_ape fails when i call in the code
now i added   : tests:=BASS_APE_StreamCreateFile(false,nil,128,0,0);  and compiler fails with same errors...
_ZdlPv etc.... 
Any solutions?? i need use bass_fx..

promusicbisceglie

#1436
I found a solution!!
I 've copied libc++.dylib from ...SDKs\iPhoneOS13.6.sdk\usr\lib  to ...SDKs\iPhoneOS14.5.sdk\usr\lib
with old libc++.dylib compilation has been success !

Remember to add dependency 'c++' in BASS_FX declare funcion for iOS

Ian @ un4seen

Good to see that you've found a solution! If anyone else encounters the same problem, they'll know what to do now.

Ian @ un4seen

The iOS version of the BASS 2.4.16 release is up in the 1st post. The BASS and add-on libraries are also now in XCFramework form and include arm64 simulator support.

Ian @ un4seen

The iOS version of the BASSOPUS 2.4.2 release is up in the 1st post.