###1.2 (August 14, 2012)
- Added example how to use Air Guitar in games using CADisplayLink (AGDisplayLinkViewController)
- Renamed AGViewController to AGDelegateViewController
###1.1 (August 10, 2012)
- Added acceleration property to AGAccessory (of type CMAccelerometer) as alternative to delegate
- Corrected error in read me (thanks Alex!)
###1.0 (iOSDevCamp San Jose, CA July 22, 2012)
- Handles connecting and disconnecting Air Guitar accessories
- Sends raw accelerometer data to your app
In the summer of 2012 we launched Air Guitar Move, a rhythm game and iPhone accessory. I received many requests from developers who wanted to use the Air Guitar Move hardware in their own apps and games. With Air Guitar SDK it's now possible to add support for the Air Guitar Move hardware to any app.
Before submitting to the App Store, please see the note below.
##System Requirements
- Air Guitar Move accessory. (Buy online)
- iOS 4 or higher for using the library in you apps
- iOS 5 to run the included demo app
Open AirGuitarSDKDemo.xcodeproj and build the app for iPhone or iPod touch. Make sure AirGuitarSDKDemo is selected in the scheme selection (and not AirGuitarSDK).
Before you start you will need:
- libAirGuitarSDK.a (created in AirGuitarSDK.xproj -> Products. See Building the Demo App above. If the filename is red, repeat building the demo app)
- AirGuitarSDK.h, AGAccessory.h and AGAccessoryManager.h (AirGuitarSDK -> frameworks)
-
Add Apple's ExternalAccessory.framework to your project by going to Project -> Target -> Link Binary With Libraries and press the + button (note that libAirGuitarSDK.a we added in step 1 should also listed here)
-
Drag AirGuitarSDK.h, AGAccessory.h and AGAccessoryManager.h (under Framworks) to your project. (You don't need to copy AGMotionManager.h , that is still a work in progress)
-
Edit the info.plist by going to Project -> Target -> Info. Right click anywhere in the list and Add Row. Enter 'Supported External Accessory Protocol' and add 'com.yobble.airguitar' as protocol
-
Add delegate and notification observer in your code
Your app needs to implement:
- A delegate to receive accelerometer data from Air Guitar Move
- A notification observer to receive connect and disconnect notifications
In header file or class extension:
@property (nonatomic, strong) AGAccessoryManager *airGuitarManager;
In .m file (e.g. ViewController or AppDelegate):
- (void)viewDidLoad { [super viewDidLoad]; // Set up Air Guitar accessory _airGuitarManager = [AGAccessoryManager sharedAccessoryManager]; } - (void)viewWillAppear:(BOOL)animated { // Receive notifications when Air Guitar connects or disconnects _airGuitarManager.shouldSendNotifications = YES; // We don't receive a notification if Air Guitar Move was already connected when the app started or view was loaded, // so check for already connected accessories if ([_airGuitarManager.connectedAGAccessories count]) { NSArray *accessories = [_airGuitarManager.connectedAGAccessories allValues]; for (AGAccessory *accessory in accessories) { accessory.delegate = self; } } // Register for Air Guitar connect and disconnect notifications [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(accessoryDidConnect:) name:@"AGAccessoryDidConnect" object:nil]; [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(accessoryDidDisconnect:) name:@"AGAccessoryDidDisconnect" object:nil]; } - (void)viewWillDisappear:(BOOL)animated { if ([_airGuitarManager.connectedAGAccessories count]) { NSArray *accessories = [_airGuitarManager.connectedAGAccessories allValues]; for (AGAccessory *accessory in accessories) accessory.delegate = nil; } [[NSNotificationCenter defaultCenter] removeObserver:self]; } #pragma mark - Air Guitar Delegate - (void) accessory: (AGAccessory *)accessory x:(double)x y:(double)y z:(double)z { // delegate method gets called every time the iPhone receives data from the Air Guitar accessory. NSLog(@"%f, %f, %f", x, y, z); } #pragma mark - Air Guitar Notifications - (void)accessoryDidConnect: (NSNotification *)notification { AGAccessory *connectedAccessory = (AGAccessory *) notification.object; connectedAccessory.delegate = self; } - (void)accessoryDidDisconnect: (NSNotification *)notification { // Air Guitar was disconnected, pause the game }
Air Guitar SDK was built in one weekend at the iOSDevCamp hackathon. There will be bugs. Please use the Github Issue tracker to commit bugs.
Air Guitar SDK was developed at iOSDevCamp 2012 in San Jose by Ronald Mannak
BoardMessage code by Colin Karpfinger
- DogFight (iOS game developed by Sage Herron at iOSDevCamp 2012)
You can use Air Guitar SDK in any way you like. However, Apple might have additional requirements when submitting an Air Guitar enabled app to the App Store, such as that your app must be a guitar app. Please contact the author before submitting apps.
Air Guitar SDK is licensed under the Apache Software License, 2.0 ("Apache 2.0")