Skip to content

Platforms_Mac_OS_X

Wiki converter edited this page Sep 24, 2020 · 3 revisions

Developing PortAudio on Mac

Create an XCode Command Line project.

Add Mac OS Frameworks

  1. click on the project
  2. click on "Build Phases"
  3. click on "Link Binary with Libraries"
  4. click on "+" then add
    • AudioToolbox.framework
    • AudioUnit.framework
    • Carbon.framework
    • CoreAudio.framework
    • CoreServices.framework

Add PortAudio Source Code

  1. right click on the project
  2. select "Add files to {your project}"
  3. navigate to the "portaudio/src/common" folder and "Add" it
  4. repeat for "portaudio/src/hostapis/coreaudio"
  5. repeat for "portaudio/src/os/unix"
  6. repeat for "portaudio/includes"

You will need to delete the reference to "coreaudio/pa_mac_core_old.c" because it has some duplicate symbol names.

Now use the same procedure to add an example program, eg. "portaudio/examples/paex_sine.c".

If you tried to build and run that program now you would probably get an error like: "Error: No default output device."

So we need to define some preprocessor variables:

  1. click on project
  2. click on "Build Settings"
  3. scroll down to "Apple LLVM # Preprocessing"
  4. Add PA_USE_COREAUDIO=1 to both the Debug and Release Preprocessor Macros
Clone this wiki locally