Gen Code Export iOS
From Cycling '74 Wiki
Revision as of 22:43, 24 September 2013 by Wesley.email@example.com
This document describes the creation of iOS filters with gen~ and Audiobus.
The referenced material is found here: Media:iOSGenFilter.zip
- Xcode 4.6 or later
- Max 6.1 or later
- Download the AudioBus SDK 
- Download The Amazing Audio Engine 
- Download the AudioBus app in order to test (cost $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 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 code
- Open the GenFilter.xcodeproj in the iosGenFilter folder
- In xcode, Change the namespace used in GenFilter.mm to match that of the exported code
- This means, find the statement near top of file starting with “using namespace” and make it look like this: using namespace gen_exported;
- (if you get a bunch of errors – then you 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 and Audiobus API key
- In ‘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 broswer go to  - 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.
- Now copy the API key into the AppDelegate.mm file replacing the existing one – around line 51. – re-build 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