Gen Code Export: iOS
Following are the steps for the creation of iOS filters with gen~ and Audiobus.
Requirements
Xcode 4.6 or later
Max 6.1 or later
Preliminaries
Download the AudioBus SDK - take care, this example is not compatible with the new AudioBus 2 SDK
Download the AudioBus app in order to test (cost is approximately $4.99 to install on an iOS device)
Building an Audiobus iOS Project
Show the iOSGenFilter folder from the above download in Finder
Copy The Amazing Audio Engine to the project folder as follows:
Open TheAmazingAudioEngine.xcodeproj in Xcode
Build the project (Cmd+B)
Find the products group in the Xcode navigator and Ctrl+Click on the libTheAmazingAudioEngine.a to show it in Finder
Copy the file (libTheAmazingAudioEngine.a) to the iosGenFilter folder
Close TheAmazingAudioEngine.xcodeproj Xcode project
From the Finder, copy the AmazingAudioEngine with all of the header (.h) and source (.m) files to the iosGenFilter folder
From the Audiobus SDK, copy the Audiobus folder and libAudiobus.a file to the iosGenFilter folder
Open the gen~ patch in the iOSGenFilter folder
In Max, export the gen~ patch as C++ code as follows:
Unlock the patch and select the gen~ object
From the inspector, under the Export header, click on the "choose" button next to the field "Folder to export into"
Choose the GenFilter folder inside project folder, where the code will be exported
Click the
exportcode
message connected to the gen~ object to finally export the codeOpen the GenFilter.xcodeproj in the iosGenFilter folder
In xcode, Change the namespace used in GenFilter.mm to match that of the exported code
Find the statement near the top of file starting with “using namespace” and edit it to look like this:
using namespace gen_exported;
(if you get a bunch of errors, you will need to find out what your exported code is called. It will be the most recent .cpp file in the GenFilter folder.)
Connect your iOS device to your computer (iPhone or iPad)
Build the Xcode project for the device
Generate an Audiobus API key
In the ‘products’ group in Ccode navigator, Ctrl+Click on the GenFilter.app product and select ‘open in finder’.
Ctrl+Click on the GenFilter.app in Finder and select ‘open package contents.’ Leave this finder window open
In a browser, go to [4] - you’ll probably need to login with your user/password set up earlier.
Drag the info.plist file from the Finder window just opened into the dropbox in the browser.
Enable the 'Filter Port' option and click the button on the web page to generate a key
You should get a screen with your temporary API key.
Copy the API key into the AppDelegate.mm file replacing the existing one – around line 51. Rebuild the project to make sure you have no errors
To test the filter:
Ensure the iOS device is still connected
Build and Run the Xcode project
You should now see the GenFilter app running on your device
Switch out of the app and launch AudioBus
In AudioBus, select the microphone input for input, the GenFilter for effect, and the speaker or headphone output for output.
Switch back to GenFilter and twiddle some parameters
You should hear audio coming out of your device
by Cycling '74 on June 20, 2013