Skip to content
Browse files

added audio toolkit

  • Loading branch information...
1 parent 597ac98 commit d59c5df28fa366e055b93cf3f2c8626b2782a272 @sschroed committed Jul 23, 2009
Showing with 121 additions and 67 deletions.
  1. +4 −0 Classes/MainViewController.h
  2. +13 −28 Classes/MainViewController.m
  3. +96 −39 MainView.xib
  4. +8 −0 bummer-btn.xcodeproj/project.pbxproj
View
4 Classes/MainViewController.h
@@ -8,9 +8,13 @@
#import "FlipsideViewController.h"
+
@interface MainViewController : UIViewController <FlipsideViewControllerDelegate> {
+ UIButton *bummerButton;
}
+@property(nonatomic, retain) IBOutlet UIButton *bummerButton;
+- (IBAction)playTuba;
- (IBAction)showInfo;
@end
View
41 Classes/MainViewController.m
@@ -8,10 +8,11 @@
#import "MainViewController.h"
#import "MainView.h"
-
+#import <AudioToolbox/AudioToolbox.h>
@implementation MainViewController
+@synthesize bummerButton;
- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil {
if (self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil]) {
@@ -20,29 +21,21 @@ - (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
return self;
}
-
-/*
- // Implement viewDidLoad to do additional setup after loading the view, typically from a nib.
- - (void)viewDidLoad {
- [super viewDidLoad];
- }
- */
-
-
-/*
- // Override to allow orientations other than the default portrait orientation.
- - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
- // Return YES for supported orientations
- return (interfaceOrientation == UIInterfaceOrientationPortrait);
- }
- */
-
-
- (void)flipsideViewControllerDidFinish:(FlipsideViewController *)controller {
[self dismissModalViewControllerAnimated:YES];
}
+- (IBAction)playTuba {
+ SystemSoundID soundID;
+
+ // find corresponding CAF file
+ NSURL *cafURL = [NSURL fileURLWithPath:[[[NSBundle mainBundle] resourcePath] stringByAppendingPathComponent:@"sadTuba.caf"]];
+ NSLog(@"cafURL: %@", cafURL);
+ OSStatus error = AudioServicesCreateSystemSoundID((CFURLRef) cafURL, &soundID);
+
+ AudioServicesPlaySystemSound (soundID);
+}
- (IBAction)showInfo {
@@ -56,15 +49,6 @@ - (IBAction)showInfo {
}
-
-/*
- // Override to allow orientations other than the default portrait orientation.
- - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
- // Return YES for supported orientations
- return (interfaceOrientation == UIInterfaceOrientationPortrait);
- }
- */
-
- (void)didReceiveMemoryWarning {
// Releases the view if it doesn't have a superview.
[super didReceiveMemoryWarning];
@@ -79,6 +63,7 @@ - (void)viewDidUnload {
- (void)dealloc {
+ [bummerButton release];
[super dealloc];
}
View
135 MainView.xib
@@ -1,15 +1,11 @@
<?xml version="1.0" encoding="UTF-8"?>
-<archive type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="7.10">
+<archive type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="7.03">
<data>
<int key="IBDocument.SystemTarget">768</int>
- <string key="IBDocument.SystemVersion">10A288</string>
- <string key="IBDocument.InterfaceBuilderVersion">715</string>
- <string key="IBDocument.AppKitVersion">1010</string>
- <string key="IBDocument.HIToolboxVersion">411.00</string>
- <object class="NSMutableDictionary" key="IBDocument.PluginVersions">
- <string key="NS.key.0">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
- <string key="NS.object.0">46</string>
- </object>
+ <string key="IBDocument.SystemVersion">9J61</string>
+ <string key="IBDocument.InterfaceBuilderVersion">677</string>
+ <string key="IBDocument.AppKitVersion">949.46</string>
+ <string key="IBDocument.HIToolboxVersion">353.00</string>
<object class="NSMutableArray" key="IBDocument.EditedObjectIDs">
<bool key="EncodedWithXMLCoder">YES</bool>
<integer value="34"/>
@@ -20,7 +16,7 @@
</object>
<object class="NSMutableDictionary" key="IBDocument.Metadata">
<bool key="EncodedWithXMLCoder">YES</bool>
- <object class="NSArray" key="dict.sortedKeys" id="0">
+ <object class="NSArray" key="dict.sortedKeys">
<bool key="EncodedWithXMLCoder">YES</bool>
</object>
<object class="NSMutableArray" key="dict.values">
@@ -49,32 +45,62 @@
<bool key="IBUIClearsContextBeforeDrawing">NO</bool>
<int key="IBUIContentHorizontalAlignment">0</int>
<int key="IBUIContentVerticalAlignment">0</int>
- <object class="NSFont" key="IBUIFont">
+ <object class="NSFont" key="IBUIFont" id="29176969">
<string key="NSName">Helvetica-Bold</string>
- <double key="NSSize">15</double>
+ <double key="NSSize">1.500000e+01</double>
<int key="NSfFlags">16</int>
</object>
- <int key="IBUIButtonType">3</int>
+ <int key="IBUIButtonType">4</int>
<bool key="IBUIShowsTouchWhenHighlighted">YES</bool>
- <object class="NSColor" key="IBUIHighlightedTitleColor">
+ <object class="NSColor" key="IBUIHighlightedTitleColor" id="437170338">
<int key="NSColorSpace">1</int>
<bytes key="NSRGB">MSAxIDEAA</bytes>
</object>
<object class="NSColor" key="IBUINormalTitleColor">
<int key="NSColorSpace">1</int>
- <bytes key="NSRGB">MC4xOTYwNzg0MzQ2IDAuMzA5ODAzOTMyOSAwLjUyMTU2ODY1NgA</bytes>
+ <bytes key="NSRGB">MC4xOTYwNzg0MyAwLjMwOTgwMzkzIDAuNTIxNTY4NjYAA</bytes>
+ </object>
+ <object class="NSColor" key="IBUINormalTitleShadowColor">
+ <int key="NSColorSpace">3</int>
+ <bytes key="NSWhite">MAA</bytes>
+ </object>
+ </object>
+ <object class="IBUIButton" id="326851665">
+ <reference key="NSNextResponder" ref="883825266"/>
+ <int key="NSvFlags">292</int>
+ <string key="NSFrame">{{0, 61}, {320, 226}}</string>
+ <reference key="NSSuperview" ref="883825266"/>
+ <bool key="IBUIOpaque">NO</bool>
+ <bool key="IBUIClearsContextBeforeDrawing">NO</bool>
+ <int key="IBUIContentHorizontalAlignment">0</int>
+ <int key="IBUIContentVerticalAlignment">0</int>
+ <reference key="IBUIFont" ref="29176969"/>
+ <object class="NSColor" key="IBUIHighlightedTitleColor">
+ <int key="NSColorSpace">3</int>
+ <bytes key="NSWhite">MQA</bytes>
+ </object>
+ <object class="NSColor" key="IBUINormalTitleColor">
+ <int key="NSColorSpace">1</int>
+ <bytes key="NSRGB">MC4xOTYwNzg0MyAwLjMwOTgwMzkzIDAuNTIxNTY4NjYAA</bytes>
+ </object>
+ <object class="NSColor" key="IBUINormalTitleShadowColor">
+ <int key="NSColorSpace">3</int>
+ <bytes key="NSWhite">MC41AA</bytes>
+ </object>
+ <object class="NSCustomResource" key="IBUIHighlightedImage" id="423392334">
+ <string key="NSClassName">NSImage</string>
+ <string key="NSResourceName">Button Down.png</string>
+ </object>
+ <reference key="IBUISelectedImage" ref="423392334"/>
+ <object class="NSCustomResource" key="IBUINormalImage">
+ <string key="NSClassName">NSImage</string>
+ <string key="NSResourceName">Button Up.png</string>
</object>
</object>
</object>
<string key="NSFrameSize">{320, 460}</string>
<reference key="NSSuperview"/>
- <object class="NSColor" key="IBUIBackgroundColor">
- <int key="NSColorSpace">3</int>
- <bytes key="NSWhite">MC4yNQA</bytes>
- <object class="NSColorSpace" key="NSCustomColorSpace">
- <int key="NSID">2</int>
- </object>
- </object>
+ <reference key="IBUIBackgroundColor" ref="437170338"/>
<bool key="IBUIClearsContextBeforeDrawing">NO</bool>
<object class="IBUISimulatedStatusBarMetrics" key="IBUISimulatedStatusBarMetrics"/>
</object>
@@ -99,81 +125,103 @@
</object>
<int key="connectionID">37</int>
</object>
+ <object class="IBConnectionRecord">
+ <object class="IBCocoaTouchOutletConnection" key="connection">
+ <string key="label">bummerButton</string>
+ <reference key="source" ref="372490531"/>
+ <reference key="destination" ref="326851665"/>
+ </object>
+ <int key="connectionID">39</int>
+ </object>
</object>
<object class="IBMutableOrderedSet" key="objectRecords">
<object class="NSArray" key="orderedObjects">
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="IBObjectRecord">
<int key="objectID">0</int>
- <reference key="object" ref="0"/>
+ <object class="NSArray" key="object" id="662168055">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ </object>
<reference key="children" ref="1000"/>
<nil key="parent"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">-1</int>
<reference key="object" ref="372490531"/>
- <reference key="parent" ref="0"/>
- <string key="objectName">File's Owner</string>
+ <reference key="parent" ref="662168055"/>
+ <string type="base64-UTF8" key="objectName">RmlsZSdzIE93bmVyA</string>
</object>
<object class="IBObjectRecord">
<int key="objectID">-2</int>
<reference key="object" ref="815241450"/>
- <reference key="parent" ref="0"/>
+ <reference key="parent" ref="662168055"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">34</int>
<reference key="object" ref="883825266"/>
<object class="NSMutableArray" key="children">
<bool key="EncodedWithXMLCoder">YES</bool>
<reference ref="558454645"/>
+ <reference ref="326851665"/>
</object>
- <reference key="parent" ref="0"/>
+ <reference key="parent" ref="662168055"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">36</int>
<reference key="object" ref="558454645"/>
<reference key="parent" ref="883825266"/>
</object>
+ <object class="IBObjectRecord">
+ <int key="objectID">38</int>
+ <reference key="object" ref="326851665"/>
+ <reference key="parent" ref="883825266"/>
+ </object>
</object>
</object>
<object class="NSMutableDictionary" key="flattenedProperties">
<bool key="EncodedWithXMLCoder">YES</bool>
- <object class="NSArray" key="dict.sortedKeys">
+ <object class="NSMutableArray" key="dict.sortedKeys">
<bool key="EncodedWithXMLCoder">YES</bool>
<string>-1.CustomClassName</string>
<string>-2.CustomClassName</string>
<string>34.CustomClassName</string>
<string>34.IBEditorWindowLastContentRect</string>
<string>34.IBPluginDependency</string>
<string>36.IBPluginDependency</string>
+ <string>38.IBPluginDependency</string>
</object>
<object class="NSMutableArray" key="dict.values">
<bool key="EncodedWithXMLCoder">YES</bool>
<string>MainViewController</string>
<string>UIResponder</string>
<string>MainView</string>
- <string>{{733, 526}, {320, 480}}</string>
+ <string>{{251, 244}, {320, 480}}</string>
+ <string>com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
<string>com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
<string>com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
</object>
</object>
<object class="NSMutableDictionary" key="unlocalizedProperties">
<bool key="EncodedWithXMLCoder">YES</bool>
- <reference key="dict.sortedKeys" ref="0"/>
+ <object class="NSArray" key="dict.sortedKeys">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ </object>
<object class="NSMutableArray" key="dict.values">
<bool key="EncodedWithXMLCoder">YES</bool>
</object>
</object>
<nil key="activeLocalization"/>
<object class="NSMutableDictionary" key="localizations">
<bool key="EncodedWithXMLCoder">YES</bool>
- <reference key="dict.sortedKeys" ref="0"/>
+ <object class="NSArray" key="dict.sortedKeys">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ </object>
<object class="NSMutableArray" key="dict.values">
<bool key="EncodedWithXMLCoder">YES</bool>
</object>
</object>
<nil key="sourceID"/>
- <int key="maxID">37</int>
+ <int key="maxID">39</int>
</object>
<object class="IBClassDescriber" key="IBDocument.Classes">
<object class="NSMutableArray" key="referencedPartialClassDescriptions">
@@ -190,8 +238,21 @@
<string key="className">MainViewController</string>
<string key="superclassName">UIViewController</string>
<object class="NSMutableDictionary" key="actions">
- <string key="NS.key.0">showInfo</string>
- <string key="NS.object.0">id</string>
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <object class="NSMutableArray" key="dict.sortedKeys">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <string>playTuba</string>
+ <string>showInfo</string>
+ </object>
+ <object class="NSMutableArray" key="dict.values">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <string>id</string>
+ <string>id</string>
+ </object>
+ </object>
+ <object class="NSMutableDictionary" key="outlets">
+ <string key="NS.key.0">bummerButton</string>
+ <string key="NS.object.0">UIButton</string>
</object>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBProjectSource</string>
@@ -201,12 +262,8 @@
</object>
</object>
<int key="IBDocument.localizationMode">0</int>
- <object class="NSMutableDictionary" key="IBDocument.PluginDeclaredDevelopmentDependencies">
- <string key="NS.key.0">com.apple.InterfaceBuilder.CocoaTouchPlugin.InterfaceBuilder3</string>
- <integer value="3100" key="NS.object.0"/>
- </object>
- <bool key="IBDocument.PluginDeclaredDependenciesTrackSystemTargetVersion">YES</bool>
<string key="IBDocument.LastKnownRelativeProjectPath">bummer-btn.xcodeproj</string>
<int key="IBDocument.defaultPropertyAccessControl">3</int>
+ <string key="IBCocoaTouchPluginVersion">3.0</string>
</data>
</archive>
View
8 bummer-btn.xcodeproj/project.pbxproj
@@ -16,6 +16,8 @@
2217E9AE1018CEF0006C6FDA /* Button Up.png in Resources */ = {isa = PBXBuildFile; fileRef = 2217E9AA1018CEF0006C6FDA /* Button Up.png */; };
2217E9AF1018CEF0006C6FDA /* logo.png in Resources */ = {isa = PBXBuildFile; fileRef = 2217E9AB1018CEF0006C6FDA /* logo.png */; };
2217E9B01018CEF0006C6FDA /* proton.png in Resources */ = {isa = PBXBuildFile; fileRef = 2217E9AC1018CEF0006C6FDA /* proton.png */; };
+ 2217E9B21018CF86006C6FDA /* AudioToolbox.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 2217E9B11018CF86006C6FDA /* AudioToolbox.framework */; };
+ 2217E9B61018CF90006C6FDA /* MessageUI.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 2217E9B51018CF90006C6FDA /* MessageUI.framework */; };
280E754D0DD40C5E005A515E /* FlipsideView.xib in Resources */ = {isa = PBXBuildFile; fileRef = 280E754A0DD40C5E005A515E /* FlipsideView.xib */; };
280E754E0DD40C5E005A515E /* MainView.xib in Resources */ = {isa = PBXBuildFile; fileRef = 280E754B0DD40C5E005A515E /* MainView.xib */; };
280E754F0DD40C5E005A515E /* MainWindow.xib in Resources */ = {isa = PBXBuildFile; fileRef = 280E754C0DD40C5E005A515E /* MainWindow.xib */; };
@@ -37,6 +39,8 @@
2217E9AA1018CEF0006C6FDA /* Button Up.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "Button Up.png"; sourceTree = "<group>"; };
2217E9AB1018CEF0006C6FDA /* logo.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = logo.png; sourceTree = "<group>"; };
2217E9AC1018CEF0006C6FDA /* proton.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = proton.png; sourceTree = "<group>"; };
+ 2217E9B11018CF86006C6FDA /* AudioToolbox.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AudioToolbox.framework; path = System/Library/Frameworks/AudioToolbox.framework; sourceTree = SDKROOT; };
+ 2217E9B51018CF90006C6FDA /* MessageUI.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = MessageUI.framework; path = System/Library/Frameworks/MessageUI.framework; sourceTree = SDKROOT; };
280E754A0DD40C5E005A515E /* FlipsideView.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = FlipsideView.xib; sourceTree = "<group>"; };
280E754B0DD40C5E005A515E /* MainView.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = MainView.xib; sourceTree = "<group>"; };
280E754C0DD40C5E005A515E /* MainWindow.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = MainWindow.xib; sourceTree = "<group>"; };
@@ -62,6 +66,8 @@
1D60589F0D05DD5A006BFB54 /* Foundation.framework in Frameworks */,
1DF5F4E00D08C38300B7A737 /* UIKit.framework in Frameworks */,
288765590DF743DE002DB57D /* CoreGraphics.framework in Frameworks */,
+ 2217E9B21018CF86006C6FDA /* AudioToolbox.framework in Frameworks */,
+ 2217E9B61018CF90006C6FDA /* MessageUI.framework in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@@ -166,6 +172,8 @@
29B97323FDCFA39411CA2CEA /* Frameworks */ = {
isa = PBXGroup;
children = (
+ 2217E9B51018CF90006C6FDA /* MessageUI.framework */,
+ 2217E9B11018CF86006C6FDA /* AudioToolbox.framework */,
1DF5F4DF0D08C38300B7A737 /* UIKit.framework */,
1D30AB110D05D00D00671497 /* Foundation.framework */,
288765580DF743DE002DB57D /* CoreGraphics.framework */,

0 comments on commit d59c5df

Please sign in to comment.
Something went wrong with that request. Please try again.