Firemonkey third-party static libraries using iOS (Link Binary with Libraries)

Source: Internet
Author: User

The recent need to play audio directly from the memory stream, thinking of using a third-party audio library bass. It is easy to use the corresponding dynamic library on Windows (in the case of blogs), but there is no corresponding usage description on iOS, which is exactly not an example for Firemonkey. In its official forum to find a demo for OSX, through analysis and testing, the Firemonkey on iOS development using third-party static library processes and methods.

The following is an example of a static library LIBBASS.A using bass on the Delphi XE10.

1, obtain the static library LIBBASS.A file to use, put the LIBBASS.A file in the project can search to the directory, generally placed in the current project directory.

2, to obtain the corresponding header file Bass.h, translated to Pascal interface file Bass.pas, the specific process and methods please Baidu. This is because the official website has OSX's demo, which has OSX's call declaration file Bass.pas, just slightly modify the beginning to add support iOS. Because the Delphi mobile platform does not support Ansichar, in order not to modify the other places, the introduction of the online bytestrings unit DCU, which defines the Ansichar to support the mobile platform.

[Delphi]View Plaincopyprint?
  1. Unit BASS;
  2. Interface
  3. {$IFDEF MSWindows}
  4. Uses
  5. Windows;
  6. {$ELSE}
  7. {$IFDEF MACOS}
  8. Uses
  9. Macapi. Dispatch
  10. {$IFDEF NEXTGEN}
  11. , System. Bytestrings
  12. {$ENDIF}
  13. ;
  14. {$ENDIF}
  15. {$ENDIF}
  16. Functions
  17. Const
  18. {$IFDEF MSWindows}
  19. Bassdll = ' Bass.dll ';
  20. {$ENDIF}
  21. {$IFDEF LINUX}
  22. Bassdll = ' libbass.so ';
  23. {$ENDIF}
  24. {$IFDEF MACOS}
  25. {$IFDEF iOS} //Add iOS support
  26. Bassdll = ' LIBBASS.A ';
  27. {$ELSE} //Add iOS support
  28. Bassdll = ' Libbass.dylib ';
  29. {$ENDIF}
  30. {$ENDIF}

3. If you compile the project in this way, the compiler will report an error that the identifier did not find, as shown in. This is because the static library LIBBASS.A relies on iOS audiotoolbox.framework.

4. Add Audiotoolbox.framework in SDK Manager.

5, Project->options->delphi Compiler->linker->options passed to the LD Linker added "-framework audiotoolbox".

6. You can now compile and publish the program with LIBBASS.A. But if the Bass_streamcreatefile function is used in the program code, the compiler will report an error that the identifier did not find, as shown in. This is because the function uses the iOS cfnetwork.framework.

7, similarly, need to increase the cfnetwork reference. Since Cfnetwork is already synchronized by default in the SDK, it is only possible to add a "-framework cfnetwork" in the 5th step of link option.

8. At this point, you can compile and publish a program that uses bass to play memory MP3.

PS: The official website says bass relies on the framework: Audiotoolbox, SystemConfiguration, Cfnetwork, Accelerate, Coremidi (if Bassmidi is used). So please add the Systemconfiguration,accelerate reference yourself.

Demo Source Download

libbass.a:http://s.cdz.la/file/7690588

bass.pas:http://s.cdz.la/file/7690589

demo:http://s.cdz.la/file/7690592

http://blog.csdn.net/tht2009/article/details/50183721

Firemonkey third-party static libraries using iOS (Link Binary with Libraries)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.