3.9 KiB
Readme
Setup
CocoaPods (Recommended)
-
Add
pod 'STK', '~> 4.6'to your Podfile. -
Run
pod install
Manual
-
Clone or download the STK into your project's directory.
-
Open the STK for iOS folder, and drag and drop STK.xcodeproj into your Xcode project.
-
Open your project's settings, open the Build Phases tab. In the Link Binary with Libraries section, add libSTK.a.

-
In the Dependencies section, add "rawwaves"
-
In your project's settings, open the Build Settings tab. In the Search Paths section, double click on the field to the right of Header Search Paths, and add the path to the STK's include directory relative to your Xcode project's directory.

Usage
- Import the STK classes you require in your Objective-C source files (Swift does not yet support importing C++ code)
- E.g.
#import "SineWave.h"
- Change the extension of any Objective-C files that import STK files to .mm.
- E.g. ViewController.m —> ViewController.mm
- If you use a class that makes use of raw wave files (such as
Mandolin), make sure you callStk::setRawwavePathbeforehand in your code.
See the iOS Demo project for a sample usage.
Troubleshooting
'FileName.h' file not found
If you get this error when #importing an STK header, you have added the wrong header search path for the STK in your project's settings (see Step 4 in Setup)
The STK's header search path you need to add is the path to the STK's include directory relative to your project's directory (as if you were cding into it). For example, it is stk/include/ if the stk directory is inside your project's directory, but it is ../stk/include/ if both share the same directory.
If this problem doesn't go away:
- Delete STK.xcodeproj from your Xcode project
- Move the STK directory within your project's directory.
- Follow step 1 from Setup, add
stk/includeto the Header Search Paths.
If that doesn't solve it: Install CocoaPods and use it to install the STK. It takes one minute and will make your life easier. Visit the CocoaPods website for installation instructions.
FileRead::open: could not open or find file (../../rawwaves/filename.raw)!
If you use a class that makes use of raw waves (such as Mandolin, Wurley, or Rhodey) you need to make sure that the STK's raw wave files are copied into your bundle and that the STK knows where they are. You'll know you need to if you get this runtime error:
FileRead::open: could not open or find file (../../rawwaves/filename.raw)!
If you're using CocoaPods
Add this code before using a class that needs the raw waves:
stk::Stk::setRawwavePath([[[NSBundle mainBundle] pathForResource:@"rawwaves" ofType:@"bundle"] UTF8String]);
If you're not using CocoaPods
- Open your project's settings, open the Build Phases tab.
- In the Copy Bundle Resources, drag and drop rawwaves.bundle (it's located in STK.xcodeproj's Helpers folder).
- Then add this code before using a class that needs the raw waves:
NSBundle *rawwaveBundle = [NSBundle bundleWithURL:[[NSBundle mainBundle] URLForResource:@"rawwaves" withExtension:@"bundle"]];
stk::Stk::setRawwavePath([[rawwaveBundle resourcePath] UTF8String]);
Apple Mach-O Linker Error
This means that STKLib.a isn't being linked to your binary. Follow step 2 above in Setup.