Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Start of Chapter 15

  • Loading branch information...
commit ce0492a5381a9e0f5df466280c2ca386ea91f9a5 1 parent e2c6171
Erica Sadun authored
Showing with 2,867 additions and 42 deletions.
  1. +116 −25 C15-Media/01-Play Audio/TestBedViewController.xib
  2. +21 −2 C15-Media/01-Play Audio/main.m
  3. +50 −15 C15-Media/02-Audio Loop/main.m
  4. 0  C15-Media/{03-OffsiteVideo → 03-Audio Interruptions}/Default.png
  5. +251 −0 C15-Media/03-Audio Interruptions/HelloWorld.xcodeproj/project.pbxproj
  6. 0  C15-Media/{03-OffsiteVideo → 03-Audio Interruptions}/HelloWorld_Prefix.pch
  7. 0  C15-Media/{03-OffsiteVideo → 03-Audio Interruptions}/Info.plist
  8. BIN  C15-Media/03-Audio Interruptions/MeetMeInSt.Louis1904.mp3
  9. 0  C15-Media/{03-OffsiteVideo → 03-Audio Interruptions}/TestBedViewController.xib
  10. 0  C15-Media/{03-OffsiteVideo → 03-Audio Interruptions}/cover320x416.png
  11. 0  C15-Media/{03-OffsiteVideo → 03-Audio Interruptions}/icon.png
  12. +104 −0 C15-Media/03-Audio Interruptions/main.m
  13. BIN  C15-Media/04-Record Audio/Default.png
  14. +245 −0 C15-Media/04-Record Audio/HelloWorld.xcodeproj/project.pbxproj
  15. +8 −0 C15-Media/04-Record Audio/HelloWorld_Prefix.pch
  16. +26 −0 C15-Media/04-Record Audio/Info.plist
  17. +15 −0 C15-Media/04-Record Audio/ModalAlert.h
  18. +180 −0 C15-Media/04-Record Audio/ModalAlert.m
  19. +294 −0 C15-Media/04-Record Audio/TestBedViewController.xib
  20. BIN  C15-Media/04-Record Audio/cover320x416.png
  21. BIN  C15-Media/04-Record Audio/icon.png
  22. +234 −0 C15-Media/04-Record Audio/main.m
  23. BIN  C15-Media/05-AudioQueue Recording/Default.png
  24. +271 −0 C15-Media/05-AudioQueue Recording/HelloWorld.xcodeproj/project.pbxproj
  25. +8 −0 C15-Media/05-AudioQueue Recording/HelloWorld_Prefix.pch
  26. +26 −0 C15-Media/05-AudioQueue Recording/Info.plist
  27. +16 −0 C15-Media/05-AudioQueue Recording/LibraryController.h
  28. +135 −0 C15-Media/05-AudioQueue Recording/LibraryController.m
  29. +32 −0 C15-Media/05-AudioQueue Recording/Recorder.h
  30. +178 −0 C15-Media/05-AudioQueue Recording/Recorder.m
  31. +267 −0 C15-Media/05-AudioQueue Recording/TestBedViewController.xib
  32. BIN  C15-Media/05-AudioQueue Recording/cover320x416.png
  33. BIN  C15-Media/05-AudioQueue Recording/green.png
  34. BIN  C15-Media/05-AudioQueue Recording/green2.png
  35. BIN  C15-Media/05-AudioQueue Recording/icon.png
  36. +176 −0 C15-Media/05-AudioQueue Recording/main.m
  37. BIN  C15-Media/05-AudioQueue Recording/red.png
  38. BIN  C15-Media/05-AudioQueue Recording/red2.png
  39. BIN  C15-Media/06-OffsiteVideo/Default.png
  40. 0  C15-Media/{03-OffsiteVideo → 06-OffsiteVideo}/HelloWorld.xcodeproj/project.pbxproj
  41. +8 −0 C15-Media/06-OffsiteVideo/HelloWorld_Prefix.pch
  42. +26 −0 C15-Media/06-OffsiteVideo/Info.plist
  43. +180 −0 C15-Media/06-OffsiteVideo/TestBedViewController.xib
  44. BIN  C15-Media/06-OffsiteVideo/cover320x416.png
  45. BIN  C15-Media/06-OffsiteVideo/icon.png
  46. 0  C15-Media/{03-OffsiteVideo → 06-OffsiteVideo}/main.m
View
141 C15-Media/01-Play Audio/TestBedViewController.xib
@@ -93,7 +93,7 @@
<object class="IBUILabel" id="1043436336">
<reference key="NSNextResponder" ref="440620744"/>
<int key="NSvFlags">292</int>
- <string key="NSFrame">{{122, 134}, {75, 21}}</string>
+ <string key="NSFrame">{{122, 112}, {75, 21}}</string>
<reference key="NSSuperview" ref="440620744"/>
<bool key="IBUIOpaque">NO</bool>
<bool key="IBUIClipsSubviews">YES</bool>
@@ -108,7 +108,7 @@
<object class="IBUILabel" id="990874159">
<reference key="NSNextResponder" ref="440620744"/>
<int key="NSvFlags">-2147483356</int>
- <string key="NSFrame">{{20, 217}, {108, 21}}</string>
+ <string key="NSFrame">{{20, 226}, {108, 21}}</string>
<reference key="NSSuperview" ref="440620744"/>
<bool key="IBUIOpaque">NO</bool>
<bool key="IBUIClipsSubviews">YES</bool>
@@ -124,7 +124,7 @@
<object class="IBUILabel" id="336577192">
<reference key="NSNextResponder" ref="440620744"/>
<int key="NSvFlags">292</int>
- <string key="NSFrame">{{39, 241}, {261, 21}}</string>
+ <string key="NSFrame">{{39, 250}, {261, 21}}</string>
<reference key="NSSuperview" ref="440620744"/>
<bool key="IBUIOpaque">NO</bool>
<bool key="IBUIClipsSubviews">YES</bool>
@@ -159,7 +159,7 @@
<object class="IBUISlider" id="461991692">
<reference key="NSNextResponder" ref="440620744"/>
<int key="NSvFlags">292</int>
- <string key="NSFrame">{{18, 163}, {284, 23}}</string>
+ <string key="NSFrame">{{18, 139}, {284, 23}}</string>
<reference key="NSSuperview" ref="440620744"/>
<bool key="IBUIOpaque">NO</bool>
<bool key="IBUIClipsSubviews">YES</bool>
@@ -168,6 +168,33 @@
<int key="IBUIContentHorizontalAlignment">0</int>
<int key="IBUIContentVerticalAlignment">0</int>
</object>
+ <object class="IBUISlider" id="116071415">
+ <reference key="NSNextResponder" ref="440620744"/>
+ <int key="NSvFlags">292</int>
+ <string key="NSFrame">{{17, 198}, {284, 23}}</string>
+ <reference key="NSSuperview" ref="440620744"/>
+ <bool key="IBUIOpaque">NO</bool>
+ <bool key="IBUIClipsSubviews">YES</bool>
+ <bool key="IBUIMultipleTouchEnabled">YES</bool>
+ <bool key="IBUIEnabled">NO</bool>
+ <int key="IBUIContentHorizontalAlignment">0</int>
+ <int key="IBUIContentVerticalAlignment">0</int>
+ </object>
+ <object class="IBUILabel" id="789369671">
+ <reference key="NSNextResponder" ref="440620744"/>
+ <int key="NSvFlags">292</int>
+ <string key="NSFrame">{{122, 169}, {75, 21}}</string>
+ <reference key="NSSuperview" ref="440620744"/>
+ <bool key="IBUIOpaque">NO</bool>
+ <bool key="IBUIClipsSubviews">YES</bool>
+ <bool key="IBUIUserInteractionEnabled">NO</bool>
+ <string key="IBUIText">Volume</string>
+ <reference key="IBUIFont" ref="297482992"/>
+ <reference key="IBUITextColor" ref="541787610"/>
+ <nil key="IBUIHighlightedColor"/>
+ <int key="IBUIBaselineAdjustment">1</int>
+ <float key="IBUIMinimumFontSize">1.000000e+01</float>
+ </object>
</object>
<string key="NSFrameSize">{320, 416}</string>
<reference key="NSSuperview"/>
@@ -190,14 +217,6 @@
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="IBConnectionRecord">
<object class="IBCocoaTouchOutletConnection" key="connection">
- <string key="label">view</string>
- <reference key="source" ref="372490531"/>
- <reference key="destination" ref="440620744"/>
- </object>
- <int key="connectionID">33</int>
- </object>
- <object class="IBConnectionRecord">
- <object class="IBCocoaTouchOutletConnection" key="connection">
<string key="label">meter1</string>
<reference key="source" ref="372490531"/>
<reference key="destination" ref="576115091"/>
@@ -222,14 +241,6 @@
<int key="connectionID">44</int>
</object>
<object class="IBConnectionRecord">
- <object class="IBCocoaTouchOutletConnection" key="connection">
- <string key="label">scrubber</string>
- <reference key="source" ref="372490531"/>
- <reference key="destination" ref="461991692"/>
- </object>
- <int key="connectionID">45</int>
- </object>
- <object class="IBConnectionRecord">
<object class="IBCocoaTouchEventConnection" key="connection">
<string key="label">scrubbingDone:</string>
<reference key="source" ref="461991692"/>
@@ -246,6 +257,66 @@
</object>
<int key="connectionID">49</int>
</object>
+ <object class="IBConnectionRecord">
+ <object class="IBCocoaTouchEventConnection" key="connection">
+ <string key="label">scrubbingDone:</string>
+ <reference key="source" ref="461991692"/>
+ <reference key="destination" ref="372490531"/>
+ <int key="IBEventType">8</int>
+ </object>
+ <int key="connectionID">50</int>
+ </object>
+ <object class="IBConnectionRecord">
+ <object class="IBCocoaTouchEventConnection" key="connection">
+ <string key="label">scrubbingDone:</string>
+ <reference key="source" ref="461991692"/>
+ <reference key="destination" ref="372490531"/>
+ <int key="IBEventType">9</int>
+ </object>
+ <int key="connectionID">51</int>
+ </object>
+ <object class="IBConnectionRecord">
+ <object class="IBCocoaTouchEventConnection" key="connection">
+ <string key="label">scrub:</string>
+ <reference key="source" ref="461991692"/>
+ <reference key="destination" ref="372490531"/>
+ <int key="IBEventType">1</int>
+ </object>
+ <int key="connectionID">53</int>
+ </object>
+ <object class="IBConnectionRecord">
+ <object class="IBCocoaTouchOutletConnection" key="connection">
+ <string key="label">view</string>
+ <reference key="source" ref="372490531"/>
+ <reference key="destination" ref="440620744"/>
+ </object>
+ <int key="connectionID">59</int>
+ </object>
+ <object class="IBConnectionRecord">
+ <object class="IBCocoaTouchOutletConnection" key="connection">
+ <string key="label">scrubber</string>
+ <reference key="source" ref="372490531"/>
+ <reference key="destination" ref="461991692"/>
+ </object>
+ <int key="connectionID">60</int>
+ </object>
+ <object class="IBConnectionRecord">
+ <object class="IBCocoaTouchOutletConnection" key="connection">
+ <string key="label">volumeSlider</string>
+ <reference key="source" ref="372490531"/>
+ <reference key="destination" ref="116071415"/>
+ </object>
+ <int key="connectionID">64</int>
+ </object>
+ <object class="IBConnectionRecord">
+ <object class="IBCocoaTouchEventConnection" key="connection">
+ <string key="label">setVolume:</string>
+ <reference key="source" ref="116071415"/>
+ <reference key="destination" ref="372490531"/>
+ <int key="IBEventType">13</int>
+ </object>
+ <int key="connectionID">65</int>
+ </object>
</object>
<object class="IBMutableOrderedSet" key="objectRecords">
<object class="NSArray" key="orderedObjects">
@@ -278,11 +349,13 @@
<reference ref="690815452"/>
<reference ref="65144128"/>
<reference ref="284396597"/>
- <reference ref="461991692"/>
- <reference ref="1043436336"/>
- <reference ref="1064941195"/>
<reference ref="990874159"/>
<reference ref="336577192"/>
+ <reference ref="1043436336"/>
+ <reference ref="461991692"/>
+ <reference ref="1064941195"/>
+ <reference ref="116071415"/>
+ <reference ref="789369671"/>
</object>
<reference key="parent" ref="884947135"/>
</object>
@@ -331,6 +404,16 @@
<reference key="object" ref="336577192"/>
<reference key="parent" ref="440620744"/>
</object>
+ <object class="IBObjectRecord">
+ <int key="objectID">54</int>
+ <reference key="object" ref="789369671"/>
+ <reference key="parent" ref="440620744"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">62</int>
+ <reference key="object" ref="116071415"/>
+ <reference key="parent" ref="440620744"/>
+ </object>
</object>
</object>
<object class="NSMutableDictionary" key="flattenedProperties">
@@ -349,12 +432,16 @@
<string>43.IBPluginDependency</string>
<string>47.IBPluginDependency</string>
<string>48.IBPluginDependency</string>
+ <string>54.IBPluginDependency</string>
+ <string>62.IBPluginDependency</string>
</object>
<object class="NSMutableArray" key="dict.values">
<bool key="EncodedWithXMLCoder">YES</bool>
<string>TestBedViewController</string>
<string>UIResponder</string>
- <string>{{649, 120}, {320, 480}}</string>
+ <string>{{649, 121}, {320, 480}}</string>
+ <string>com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
+ <string>com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
<string>com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
<string>com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
<string>com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
@@ -386,7 +473,7 @@
</object>
</object>
<nil key="sourceID"/>
- <int key="maxID">49</int>
+ <int key="maxID">65</int>
</object>
<object class="IBClassDescriber" key="IBDocument.Classes">
<object class="NSMutableArray" key="referencedPartialClassDescriptions">
@@ -399,11 +486,13 @@
<bool key="EncodedWithXMLCoder">YES</bool>
<string>scrub:</string>
<string>scrubbingDone:</string>
+ <string>setVolume:</string>
</object>
<object class="NSMutableArray" key="dict.values">
<bool key="EncodedWithXMLCoder">YES</bool>
<string>id</string>
<string>id</string>
+ <string>id</string>
</object>
</object>
<object class="NSMutableDictionary" key="outlets">
@@ -415,6 +504,7 @@
<string>nowPlaying</string>
<string>scrubber</string>
<string>view</string>
+ <string>volumeSlider</string>
</object>
<object class="NSMutableArray" key="dict.values">
<bool key="EncodedWithXMLCoder">YES</bool>
@@ -423,6 +513,7 @@
<string>UILabel</string>
<string>UISlider</string>
<string>UIView</string>
+ <string>UISlider</string>
</object>
</object>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
View
23 C15-Media/01-Play Audio/main.m
@@ -19,6 +19,7 @@ @interface TestBedViewController : UIViewController <AVAudioPlayerDelegate>
IBOutlet UIProgressView *meter1;
IBOutlet UIProgressView *meter2;
IBOutlet UISlider *scrubber;
+ IBOutlet UISlider *volumeSlider;
IBOutlet UILabel *nowPlaying;
NSString *path;
}
@@ -61,16 +62,27 @@ - (void) pause: (id) sender
meter1.progress = 0.0f;
meter2.progress = 0.0f;
[timer invalidate];
+ volumeSlider.enabled = NO;
+ scrubber.enabled = NO;
}
- (void) play: (id) sender
{
if (self.player) [self.player play];
+
+ volumeSlider.value = self.player.volume;
+ volumeSlider.enabled = YES;
+
self.navigationItem.rightBarButtonItem = SYSBARBUTTON(UIBarButtonSystemItemPause, self, @selector(pause:));
timer = [NSTimer scheduledTimerWithTimeInterval:0.1f target:self selector:@selector(updateMeters) userInfo:nil repeats:YES];
scrubber.enabled = YES;
}
+- (void) setVolume: (id) sender
+{
+ if (self.player) self.player.volume = volumeSlider.value;
+}
+
- (void) scrubbingDone: (id) sender
{
[self play:nil];
@@ -78,8 +90,13 @@ - (void) scrubbingDone: (id) sender
- (void) scrub: (id) sender
{
+ // Pause the player
[self.player pause];
+
+ // Calculate the new current time
self.player.currentTime = scrubber.value * self.player.duration;
+
+ // Update the title, nav bar
self.title = [NSString stringWithFormat:@"%@ of %@", [self formatTime:self.player.currentTime], [self formatTime:self.player.duration]];
self.navigationItem.rightBarButtonItem = SYSBARBUTTON(UIBarButtonSystemItemPlay, self, @selector(play:));
}
@@ -100,7 +117,7 @@ - (BOOL) prepAudio
self.player.meteringEnabled = YES;
meter1.progress = 0.0f;
meter2.progress = 0.0f;
-
+
self.player.delegate = self;
self.navigationItem.rightBarButtonItem = SYSBARBUTTON(UIBarButtonSystemItemPlay, self, @selector(play:));
scrubber.enabled = NO;
@@ -112,12 +129,14 @@ - (void)audioPlayerDidFinishPlaying:(AVAudioPlayer *)player successfully:(BOOL)f
{
self.navigationItem.rightBarButtonItem = nil;
scrubber.value = 0.0f;
- scrubber.enabled = YES;
+ scrubber.enabled = NO;
+ volumeSlider.enabled = NO;
[self prepAudio];
}
- (void) pick
{
+ // Each of these media files is in the public domain via archive.org
NSArray *choices = [@"Alexander's Ragtime Band*Hello My Baby*Ragtime Echoes*Rhapsody In Blue*A Tisket A Tasket*In the Mood*Cancel" componentsSeparatedByString:@"*"];
NSArray *media = [@"ARB-AJ*HMB1936*ragtime*RhapsodyInBlue*Tisket*InTheMood" componentsSeparatedByString:@"*"];
View
65 C15-Media/02-Audio Loop/main.m
@@ -21,24 +21,14 @@ @interface TestBedViewController : UIViewController
@implementation TestBedViewController
@synthesize player;
-- (void) pause: (id) sender
-{
- if (self.player) [self.player pause];
- self.navigationItem.rightBarButtonItem = SYSBARBUTTON(UIBarButtonSystemItemPlay, self, @selector(play:));
-}
-
-- (void) play: (id) sender
-{
- if (self.player) [self.player play];
- self.navigationItem.rightBarButtonItem = SYSBARBUTTON(UIBarButtonSystemItemPause, self, @selector(pause:));
-}
-
- (BOOL) prepAudio
{
+ // Check for the file. "Drumskul" was released as a public domain audio loop on archive.org as part of "loops2try2".
NSError *error;
NSString *path = [[NSBundle mainBundle] pathForResource:@"loop" ofType:@"mp3"];
if (![[NSFileManager defaultManager] fileExistsAtPath:path]) return NO;
+ // Initialize the player
self.player = [[AVAudioPlayer alloc] initWithContentsOfURL:[NSURL fileURLWithPath:path] error:&error];
if (!self.player)
{
@@ -46,19 +36,64 @@ - (BOOL) prepAudio
return NO;
}
+ // Prepare the player and set the loops to, basically, unlimited
[self.player prepareToPlay];
[self.player setNumberOfLoops:999999];
-
- [self.player play];
- self.navigationItem.rightBarButtonItem = SYSBARBUTTON(UIBarButtonSystemItemPause, self, @selector(pause:));
+
return YES;
}
+- (void) viewDidAppear: (BOOL) animated
+{
+ // Start playing at no-volume
+ self.player.volume = 0.0f;
+ [self.player play];
+
+ // fade in the audio over a second
+ for (int i = 1; i <= 10; i++)
+ {
+ self.player.volume = i / 10.0f;
+ [NSThread sleepUntilDate:[NSDate dateWithTimeIntervalSinceNow:0.1f]];
+ }
+
+ // Add the push button
+ self.navigationItem.rightBarButtonItem = BARBUTTON(@"Push", @selector(push));
+}
+
+- (void) viewWillDisappear: (BOOL) animated
+{
+ // fade out the audio over a second
+ for (int i = 9; i >= 0; i--)
+ {
+ self.player.volume = i / 10.0f;
+ [NSThread sleepUntilDate:[NSDate dateWithTimeIntervalSinceNow:0.1f]];
+ }
+
+ [self.player pause];
+}
+
+- (void) push
+{
+ // Create a simple new view controller
+ UIViewController *vc = [[UIViewController alloc] init];
+ vc.view.backgroundColor = [UIColor whiteColor];
+ vc.title = @"No Sounds";
+
+ // Disable the now-pressed right-button
+ self.navigationItem.rightBarButtonItem = nil;
+
+ // push the new view controller
+ [self.navigationController pushViewController:[vc autorelease] animated:YES];
+}
+
- (void) viewDidLoad
{
self.navigationController.navigationBar.tintColor = COOKBOOK_PURPLE_COLOR;
+ self.navigationItem.rightBarButtonItem = BARBUTTON(@"Push", @selector(push));
+ self.title = @"Looped Sounds";
[self prepAudio];
}
+
@end
@interface TestBedAppDelegate : NSObject <UIApplicationDelegate>
View
0  C15-Media/03-OffsiteVideo/Default.png → C15-Media/03-Audio Interruptions/Default.png
File renamed without changes
View
251 C15-Media/03-Audio Interruptions/HelloWorld.xcodeproj/project.pbxproj
@@ -0,0 +1,251 @@
+// !$*UTF8*$!
+{
+ archiveVersion = 1;
+ classes = {
+ };
+ objectVersion = 45;
+ objects = {
+
+/* Begin PBXBuildFile section */
+ 1D3623EC0D0F72F000981E51 /* CoreGraphics.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1D3623EB0D0F72F000981E51 /* CoreGraphics.framework */; };
+ 1D60589B0D05DD56006BFB54 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 29B97316FDCFA39411CA2CEA /* main.m */; };
+ 1D60589F0D05DD5A006BFB54 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1D30AB110D05D00D00671497 /* Foundation.framework */; };
+ 1DF5F4E00D08C38300B7A737 /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1DF5F4DF0D08C38300B7A737 /* UIKit.framework */; };
+ 8E3A1F090FAA199F009B0518 /* cover320x416.png in Resources */ = {isa = PBXBuildFile; fileRef = 8E3A1F080FAA199F009B0518 /* cover320x416.png */; };
+ 8E4156E90FA4EE0E0006D27C /* Default.png in Resources */ = {isa = PBXBuildFile; fileRef = 8E4156E70FA4EE0E0006D27C /* Default.png */; };
+ 8E4156EA0FA4EE0E0006D27C /* icon.png in Resources */ = {isa = PBXBuildFile; fileRef = 8E4156E80FA4EE0E0006D27C /* icon.png */; };
+ 8E785FCB0FCDB853006EA81F /* TestBedViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = 8E785FCA0FCDB853006EA81F /* TestBedViewController.xib */; };
+ 8EC63C35102BAA4A003CC314 /* AVFoundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 8EC63C34102BAA4A003CC314 /* AVFoundation.framework */; };
+ 8EF80421103324E60007C539 /* MeetMeInSt.Louis1904.mp3 in Resources */ = {isa = PBXBuildFile; fileRef = 8EF80420103324E60007C539 /* MeetMeInSt.Louis1904.mp3 */; };
+/* End PBXBuildFile section */
+
+/* Begin PBXFileReference section */
+ 1D30AB110D05D00D00671497 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; };
+ 1D3623EB0D0F72F000981E51 /* CoreGraphics.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreGraphics.framework; path = System/Library/Frameworks/CoreGraphics.framework; sourceTree = SDKROOT; };
+ 1D6058910D05DD3D006BFB54 /* HelloWorld.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = HelloWorld.app; sourceTree = BUILT_PRODUCTS_DIR; };
+ 1DF5F4DF0D08C38300B7A737 /* UIKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = UIKit.framework; path = System/Library/Frameworks/UIKit.framework; sourceTree = SDKROOT; };
+ 29B97316FDCFA39411CA2CEA /* main.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = "<group>"; };
+ 32CA4F630368D1EE00C91783 /* HelloWorld_Prefix.pch */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HelloWorld_Prefix.pch; sourceTree = "<group>"; };
+ 8D1107310486CEB800E47090 /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
+ 8E3A1F080FAA199F009B0518 /* cover320x416.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = cover320x416.png; sourceTree = "<group>"; };
+ 8E4156E70FA4EE0E0006D27C /* Default.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = Default.png; sourceTree = "<group>"; };
+ 8E4156E80FA4EE0E0006D27C /* icon.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = icon.png; sourceTree = "<group>"; };
+ 8E785FCA0FCDB853006EA81F /* TestBedViewController.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = TestBedViewController.xib; sourceTree = "<group>"; };
+ 8EC63C34102BAA4A003CC314 /* AVFoundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AVFoundation.framework; path = "../01-Play Audio/iphoneos2.0/System/Library/Frameworks/AVFoundation.framework"; sourceTree = SOURCE_ROOT; };
+ 8EF80420103324E60007C539 /* MeetMeInSt.Louis1904.mp3 */ = {isa = PBXFileReference; lastKnownFileType = audio.mp3; path = MeetMeInSt.Louis1904.mp3; sourceTree = "<group>"; };
+/* End PBXFileReference section */
+
+/* Begin PBXFrameworksBuildPhase section */
+ 1D60588F0D05DD3D006BFB54 /* Frameworks */ = {
+ isa = PBXFrameworksBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ 1D60589F0D05DD5A006BFB54 /* Foundation.framework in Frameworks */,
+ 1DF5F4E00D08C38300B7A737 /* UIKit.framework in Frameworks */,
+ 1D3623EC0D0F72F000981E51 /* CoreGraphics.framework in Frameworks */,
+ 8EC63C35102BAA4A003CC314 /* AVFoundation.framework in Frameworks */,
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ };
+/* End PBXFrameworksBuildPhase section */
+
+/* Begin PBXGroup section */
+ 19C28FACFE9D520D11CA2CBB /* Products */ = {
+ isa = PBXGroup;
+ children = (
+ 1D6058910D05DD3D006BFB54 /* HelloWorld.app */,
+ );
+ name = Products;
+ sourceTree = "<group>";
+ };
+ 29B97314FDCFA39411CA2CEA /* CustomTemplate */ = {
+ isa = PBXGroup;
+ children = (
+ 29B97316FDCFA39411CA2CEA /* main.m */,
+ 8E785FCA0FCDB853006EA81F /* TestBedViewController.xib */,
+ 8EB688610FA64AD100489E4B /* Support */,
+ 29B97323FDCFA39411CA2CEA /* Frameworks */,
+ 19C28FACFE9D520D11CA2CBB /* Products */,
+ );
+ name = CustomTemplate;
+ sourceTree = "<group>";
+ };
+ 29B97323FDCFA39411CA2CEA /* Frameworks */ = {
+ isa = PBXGroup;
+ children = (
+ 8EC63C34102BAA4A003CC314 /* AVFoundation.framework */,
+ 1D3623EB0D0F72F000981E51 /* CoreGraphics.framework */,
+ 1D30AB110D05D00D00671497 /* Foundation.framework */,
+ 1DF5F4DF0D08C38300B7A737 /* UIKit.framework */,
+ );
+ name = Frameworks;
+ sourceTree = "<group>";
+ };
+ 8EB688610FA64AD100489E4B /* Support */ = {
+ isa = PBXGroup;
+ children = (
+ 8EF80420103324E60007C539 /* MeetMeInSt.Louis1904.mp3 */,
+ 8E3A1F080FAA199F009B0518 /* cover320x416.png */,
+ 32CA4F630368D1EE00C91783 /* HelloWorld_Prefix.pch */,
+ 8D1107310486CEB800E47090 /* Info.plist */,
+ 8E4156E80FA4EE0E0006D27C /* icon.png */,
+ 8E4156E70FA4EE0E0006D27C /* Default.png */,
+ );
+ name = Support;
+ sourceTree = "<group>";
+ };
+/* End PBXGroup section */
+
+/* Begin PBXNativeTarget section */
+ 1D6058900D05DD3D006BFB54 /* HelloWorld */ = {
+ isa = PBXNativeTarget;
+ buildConfigurationList = 1D6058960D05DD3E006BFB54 /* Build configuration list for PBXNativeTarget "HelloWorld" */;
+ buildPhases = (
+ 1D60588D0D05DD3D006BFB54 /* Resources */,
+ 1D60588E0D05DD3D006BFB54 /* Sources */,
+ 1D60588F0D05DD3D006BFB54 /* Frameworks */,
+ );
+ buildRules = (
+ );
+ dependencies = (
+ );
+ name = HelloWorld;
+ productName = HelloWorld;
+ productReference = 1D6058910D05DD3D006BFB54 /* HelloWorld.app */;
+ productType = "com.apple.product-type.application";
+ };
+/* End PBXNativeTarget section */
+
+/* Begin PBXProject section */
+ 29B97313FDCFA39411CA2CEA /* Project object */ = {
+ isa = PBXProject;
+ buildConfigurationList = C01FCF4E08A954540054247B /* Build configuration list for PBXProject "HelloWorld" */;
+ compatibilityVersion = "Xcode 3.1";
+ hasScannedForEncodings = 1;
+ mainGroup = 29B97314FDCFA39411CA2CEA /* CustomTemplate */;
+ projectDirPath = "";
+ projectRoot = "";
+ targets = (
+ 1D6058900D05DD3D006BFB54 /* HelloWorld */,
+ );
+ };
+/* End PBXProject section */
+
+/* Begin PBXResourcesBuildPhase section */
+ 1D60588D0D05DD3D006BFB54 /* Resources */ = {
+ isa = PBXResourcesBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ 8E4156E90FA4EE0E0006D27C /* Default.png in Resources */,
+ 8E4156EA0FA4EE0E0006D27C /* icon.png in Resources */,
+ 8E3A1F090FAA199F009B0518 /* cover320x416.png in Resources */,
+ 8E785FCB0FCDB853006EA81F /* TestBedViewController.xib in Resources */,
+ 8EF80421103324E60007C539 /* MeetMeInSt.Louis1904.mp3 in Resources */,
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ };
+/* End PBXResourcesBuildPhase section */
+
+/* Begin PBXSourcesBuildPhase section */
+ 1D60588E0D05DD3D006BFB54 /* Sources */ = {
+ isa = PBXSourcesBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ 1D60589B0D05DD56006BFB54 /* main.m in Sources */,
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ };
+/* End PBXSourcesBuildPhase section */
+
+/* Begin XCBuildConfiguration section */
+ 1D6058940D05DD3E006BFB54 /* Debug */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer: Erica Sadun";
+ COPY_PHASE_STRIP = NO;
+ DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
+ FRAMEWORK_SEARCH_PATHS = (
+ "$(inherited)",
+ "\"$(SRCROOT)/../01-Play Audio/iphoneos2.0/System/Library/Frameworks\"",
+ );
+ GCC_DYNAMIC_NO_PIC = NO;
+ GCC_ENABLE_FIX_AND_CONTINUE = NO;
+ GCC_OPTIMIZATION_LEVEL = 0;
+ GCC_PRECOMPILE_PREFIX_HEADER = YES;
+ GCC_PREFIX_HEADER = HelloWorld_Prefix.pch;
+ INFOPLIST_FILE = Info.plist;
+ PREBINDING = NO;
+ PRODUCT_NAME = HelloWorld;
+ };
+ name = Debug;
+ };
+ 1D6058950D05DD3E006BFB54 /* Release */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ COPY_PHASE_STRIP = YES;
+ DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
+ FRAMEWORK_SEARCH_PATHS = (
+ "$(inherited)",
+ "\"$(SRCROOT)/../01-Play Audio/iphoneos2.0/System/Library/Frameworks\"",
+ );
+ GCC_ENABLE_FIX_AND_CONTINUE = NO;
+ GCC_PRECOMPILE_PREFIX_HEADER = YES;
+ GCC_PREFIX_HEADER = HelloWorld_Prefix.pch;
+ INFOPLIST_FILE = Info.plist;
+ PREBINDING = NO;
+ PRODUCT_NAME = HelloWorld;
+ WRAPPER_EXTENSION = app;
+ };
+ name = Release;
+ };
+ C01FCF4F08A954540054247B /* Debug */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ ALWAYS_SEARCH_USER_PATHS = NO;
+ ARCHS = "$(ARCHS_STANDARD_32_BIT)";
+ CODE_SIGN_IDENTITY = "Erica Sadun";
+ "CODE_SIGN_IDENTITY[sdk=iphonesimulator*]" = "iPhone Developer";
+ GCC_C_LANGUAGE_STANDARD = c99;
+ GCC_WARN_ABOUT_RETURN_TYPE = YES;
+ GCC_WARN_UNUSED_VARIABLE = YES;
+ ONLY_ACTIVE_ARCH = YES;
+ PREBINDING = NO;
+ PRODUCT_NAME = "Oh Hello";
+ SDKROOT = iphoneos2.0;
+ };
+ name = Debug;
+ };
+ C01FCF5008A954540054247B /* Release */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ ARCHS = "$(ARCHS_STANDARD_32_BIT)";
+ PREBINDING = NO;
+ SDKROOT = iphoneos2.0;
+ };
+ name = Release;
+ };
+/* End XCBuildConfiguration section */
+
+/* Begin XCConfigurationList section */
+ 1D6058960D05DD3E006BFB54 /* Build configuration list for PBXNativeTarget "HelloWorld" */ = {
+ isa = XCConfigurationList;
+ buildConfigurations = (
+ 1D6058940D05DD3E006BFB54 /* Debug */,
+ 1D6058950D05DD3E006BFB54 /* Release */,
+ );
+ defaultConfigurationIsVisible = 0;
+ defaultConfigurationName = Release;
+ };
+ C01FCF4E08A954540054247B /* Build configuration list for PBXProject "HelloWorld" */ = {
+ isa = XCConfigurationList;
+ buildConfigurations = (
+ C01FCF4F08A954540054247B /* Debug */,
+ C01FCF5008A954540054247B /* Release */,
+ );
+ defaultConfigurationIsVisible = 0;
+ defaultConfigurationName = Release;
+ };
+/* End XCConfigurationList section */
+ };
+ rootObject = 29B97313FDCFA39411CA2CEA /* Project object */;
+}
View
0  C15-Media/03-OffsiteVideo/HelloWorld_Prefix.pch → ...edia/03-Audio Interruptions/HelloWorld_Prefix.pch
File renamed without changes
View
0  C15-Media/03-OffsiteVideo/Info.plist → C15-Media/03-Audio Interruptions/Info.plist
File renamed without changes
View
BIN  C15-Media/03-Audio Interruptions/MeetMeInSt.Louis1904.mp3
Binary file not shown
View
0  C15-Media/03-OffsiteVideo/TestBedViewController.xib → .../03-Audio Interruptions/TestBedViewController.xib
File renamed without changes
View
0  C15-Media/03-OffsiteVideo/cover320x416.png → C15-Media/03-Audio Interruptions/cover320x416.png
File renamed without changes
View
0  C15-Media/03-OffsiteVideo/icon.png → C15-Media/03-Audio Interruptions/icon.png
File renamed without changes
View
104 C15-Media/03-Audio Interruptions/main.m
@@ -0,0 +1,104 @@
+/*
+ Erica Sadun, http://ericasadun.com
+ iPhone Developer's Cookbook, 3.0 Edition
+ BSD License, Use at your own risk
+ */
+
+#import <UIKit/UIKit.h>
+#import <AVFoundation/AVFoundation.h>
+
+#define COOKBOOK_PURPLE_COLOR [UIColor colorWithRed:0.20392f green:0.19607f blue:0.61176f alpha:1.0f]
+#define BARBUTTON(TITLE, SELECTOR) [[[UIBarButtonItem alloc] initWithTitle:TITLE style:UIBarButtonItemStylePlain target:self action:SELECTOR] autorelease]
+#define SYSBARBUTTON(ITEM, TARGET, SELECTOR) [[[UIBarButtonItem alloc] initWithBarButtonSystemItem:ITEM target:TARGET action:SELECTOR] autorelease]
+
+@interface TestBedViewController : UIViewController <AVAudioPlayerDelegate>
+{
+ AVAudioPlayer *player;
+}
+@property (retain) AVAudioPlayer *player;
+@end
+
+@implementation TestBedViewController
+@synthesize player;
+
+- (BOOL) prepAudio
+{
+ // Check for the file. "Drumskul" was released as a public domain audio loop on archive.org as part of "loops2try2".
+ NSError *error;
+ NSString *path = [[NSBundle mainBundle] pathForResource:@"MeetMeInSt.Louis1904" ofType:@"mp3"];
+ if (![[NSFileManager defaultManager] fileExistsAtPath:path]) return NO;
+
+ // Initialize the player
+ self.player = [[AVAudioPlayer alloc] initWithContentsOfURL:[NSURL fileURLWithPath:path] error:&error];
+ self.player.delegate = self;
+ if (!self.player)
+ {
+ NSLog(@"Error: %@", [error localizedDescription]);
+ return NO;
+ }
+
+ [self.player prepareToPlay];
+
+ return YES;
+}
+
+- (void)audioPlayerDidFinishPlaying:(AVAudioPlayer *)player successfully:(BOOL)flag
+{
+ // just keep playing
+ [self.player play];
+}
+
+- (void)audioPlayerBeginInterruption:(AVAudioPlayer *)player
+{
+ // perform any interruption handling here
+ printf("Interruption Detected\n");
+ [[NSUserDefaults standardUserDefaults] setFloat:[self.player currentTime] forKey:@"Interruption"];
+}
+
+- (void)audioPlayerEndInterruption:(AVAudioPlayer *)player
+{
+ // resume playback at the end of the interruption
+ printf("Interruption ended\n");
+ [self.player play];
+
+ // remove the interruption key. it won't be needed
+ [[NSUserDefaults standardUserDefaults] removeObjectForKey:@"Interruption"];
+}
+
+- (void) viewDidLoad
+{
+ self.navigationController.navigationBar.tintColor = COOKBOOK_PURPLE_COLOR;
+ [self prepAudio];
+
+ // Check for previous interruption
+ if ([[NSUserDefaults standardUserDefaults] objectForKey:@"Interruption"])
+ {
+ self.player.currentTime = [[NSUserDefaults standardUserDefaults] floatForKey:@"Interruption"];
+ [[NSUserDefaults standardUserDefaults] removeObjectForKey:@"Interruption"];
+ }
+
+ // Start playback
+ [self.player play];
+}
+
+@end
+
+@interface TestBedAppDelegate : NSObject <UIApplicationDelegate>
+@end
+
+@implementation TestBedAppDelegate
+- (void)applicationDidFinishLaunching:(UIApplication *)application {
+ UIWindow *window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
+ UINavigationController *nav = [[UINavigationController alloc] initWithRootViewController:[[TestBedViewController alloc] init]];
+ [window addSubview:nav.view];
+ [window makeKeyAndVisible];
+}
+@end
+
+int main(int argc, char *argv[])
+{
+ NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];
+ int retVal = UIApplicationMain(argc, argv, nil, @"TestBedAppDelegate");
+ [pool release];
+ return retVal;
+}
View
BIN  C15-Media/04-Record Audio/Default.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
245 C15-Media/04-Record Audio/HelloWorld.xcodeproj/project.pbxproj
@@ -0,0 +1,245 @@
+// !$*UTF8*$!
+{
+ archiveVersion = 1;
+ classes = {
+ };
+ objectVersion = 45;
+ objects = {
+
+/* Begin PBXBuildFile section */
+ 1D3623EC0D0F72F000981E51 /* CoreGraphics.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1D3623EB0D0F72F000981E51 /* CoreGraphics.framework */; };
+ 1D60589B0D05DD56006BFB54 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 29B97316FDCFA39411CA2CEA /* main.m */; };
+ 1D60589F0D05DD5A006BFB54 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1D30AB110D05D00D00671497 /* Foundation.framework */; };
+ 1DF5F4E00D08C38300B7A737 /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1DF5F4DF0D08C38300B7A737 /* UIKit.framework */; };
+ 8E01E031102B8F5000B0C539 /* AVFoundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 8E01E030102B8F5000B0C539 /* AVFoundation.framework */; };
+ 8E3A1F090FAA199F009B0518 /* cover320x416.png in Resources */ = {isa = PBXBuildFile; fileRef = 8E3A1F080FAA199F009B0518 /* cover320x416.png */; };
+ 8E4156E90FA4EE0E0006D27C /* Default.png in Resources */ = {isa = PBXBuildFile; fileRef = 8E4156E70FA4EE0E0006D27C /* Default.png */; };
+ 8E4156EA0FA4EE0E0006D27C /* icon.png in Resources */ = {isa = PBXBuildFile; fileRef = 8E4156E80FA4EE0E0006D27C /* icon.png */; };
+ 8E785FCB0FCDB853006EA81F /* TestBedViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = 8E785FCA0FCDB853006EA81F /* TestBedViewController.xib */; };
+ 8EF804BC103333DE0007C539 /* ModalAlert.m in Sources */ = {isa = PBXBuildFile; fileRef = 8EF804BB103333DE0007C539 /* ModalAlert.m */; };
+/* End PBXBuildFile section */
+
+/* Begin PBXFileReference section */
+ 1D30AB110D05D00D00671497 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; };
+ 1D3623EB0D0F72F000981E51 /* CoreGraphics.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreGraphics.framework; path = System/Library/Frameworks/CoreGraphics.framework; sourceTree = SDKROOT; };
+ 1D6058910D05DD3D006BFB54 /* HelloWorld.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = HelloWorld.app; sourceTree = BUILT_PRODUCTS_DIR; };
+ 1DF5F4DF0D08C38300B7A737 /* UIKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = UIKit.framework; path = System/Library/Frameworks/UIKit.framework; sourceTree = SDKROOT; };
+ 29B97316FDCFA39411CA2CEA /* main.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = "<group>"; };
+ 32CA4F630368D1EE00C91783 /* HelloWorld_Prefix.pch */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HelloWorld_Prefix.pch; sourceTree = "<group>"; };
+ 8D1107310486CEB800E47090 /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
+ 8E01E030102B8F5000B0C539 /* AVFoundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AVFoundation.framework; path = System/Library/Frameworks/AVFoundation.framework; sourceTree = SDKROOT; };
+ 8E3A1F080FAA199F009B0518 /* cover320x416.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = cover320x416.png; sourceTree = "<group>"; };
+ 8E4156E70FA4EE0E0006D27C /* Default.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = Default.png; sourceTree = "<group>"; };
+ 8E4156E80FA4EE0E0006D27C /* icon.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = icon.png; sourceTree = "<group>"; };
+ 8E785FCA0FCDB853006EA81F /* TestBedViewController.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = TestBedViewController.xib; sourceTree = "<group>"; };
+ 8EF804BA103333DE0007C539 /* ModalAlert.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ModalAlert.h; sourceTree = "<group>"; };
+ 8EF804BB103333DE0007C539 /* ModalAlert.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ModalAlert.m; sourceTree = "<group>"; };
+/* End PBXFileReference section */
+
+/* Begin PBXFrameworksBuildPhase section */
+ 1D60588F0D05DD3D006BFB54 /* Frameworks */ = {
+ isa = PBXFrameworksBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ 1D60589F0D05DD5A006BFB54 /* Foundation.framework in Frameworks */,
+ 1DF5F4E00D08C38300B7A737 /* UIKit.framework in Frameworks */,
+ 1D3623EC0D0F72F000981E51 /* CoreGraphics.framework in Frameworks */,
+ 8E01E031102B8F5000B0C539 /* AVFoundation.framework in Frameworks */,
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ };
+/* End PBXFrameworksBuildPhase section */
+
+/* Begin PBXGroup section */
+ 19C28FACFE9D520D11CA2CBB /* Products */ = {
+ isa = PBXGroup;
+ children = (
+ 1D6058910D05DD3D006BFB54 /* HelloWorld.app */,
+ );
+ name = Products;
+ sourceTree = "<group>";
+ };
+ 29B97314FDCFA39411CA2CEA /* CustomTemplate */ = {
+ isa = PBXGroup;
+ children = (
+ 29B97316FDCFA39411CA2CEA /* main.m */,
+ 8E785FCA0FCDB853006EA81F /* TestBedViewController.xib */,
+ 8EB688610FA64AD100489E4B /* Support */,
+ 29B97323FDCFA39411CA2CEA /* Frameworks */,
+ 19C28FACFE9D520D11CA2CBB /* Products */,
+ );
+ name = CustomTemplate;
+ sourceTree = "<group>";
+ };
+ 29B97323FDCFA39411CA2CEA /* Frameworks */ = {
+ isa = PBXGroup;
+ children = (
+ 8E01E030102B8F5000B0C539 /* AVFoundation.framework */,
+ 1D3623EB0D0F72F000981E51 /* CoreGraphics.framework */,
+ 1D30AB110D05D00D00671497 /* Foundation.framework */,
+ 1DF5F4DF0D08C38300B7A737 /* UIKit.framework */,
+ );
+ name = Frameworks;
+ sourceTree = "<group>";
+ };
+ 8EB688610FA64AD100489E4B /* Support */ = {
+ isa = PBXGroup;
+ children = (
+ 8EF804BA103333DE0007C539 /* ModalAlert.h */,
+ 8EF804BB103333DE0007C539 /* ModalAlert.m */,
+ 8E3A1F080FAA199F009B0518 /* cover320x416.png */,
+ 32CA4F630368D1EE00C91783 /* HelloWorld_Prefix.pch */,
+ 8D1107310486CEB800E47090 /* Info.plist */,
+ 8E4156E80FA4EE0E0006D27C /* icon.png */,
+ 8E4156E70FA4EE0E0006D27C /* Default.png */,
+ );
+ name = Support;
+ sourceTree = "<group>";
+ };
+/* End PBXGroup section */
+
+/* Begin PBXNativeTarget section */
+ 1D6058900D05DD3D006BFB54 /* HelloWorld */ = {
+ isa = PBXNativeTarget;
+ buildConfigurationList = 1D6058960D05DD3E006BFB54 /* Build configuration list for PBXNativeTarget "HelloWorld" */;
+ buildPhases = (
+ 1D60588D0D05DD3D006BFB54 /* Resources */,
+ 1D60588E0D05DD3D006BFB54 /* Sources */,
+ 1D60588F0D05DD3D006BFB54 /* Frameworks */,
+ );
+ buildRules = (
+ );
+ dependencies = (
+ );
+ name = HelloWorld;
+ productName = HelloWorld;
+ productReference = 1D6058910D05DD3D006BFB54 /* HelloWorld.app */;
+ productType = "com.apple.product-type.application";
+ };
+/* End PBXNativeTarget section */
+
+/* Begin PBXProject section */
+ 29B97313FDCFA39411CA2CEA /* Project object */ = {
+ isa = PBXProject;
+ buildConfigurationList = C01FCF4E08A954540054247B /* Build configuration list for PBXProject "HelloWorld" */;
+ compatibilityVersion = "Xcode 3.1";
+ hasScannedForEncodings = 1;
+ mainGroup = 29B97314FDCFA39411CA2CEA /* CustomTemplate */;
+ projectDirPath = "";
+ projectRoot = "";
+ targets = (
+ 1D6058900D05DD3D006BFB54 /* HelloWorld */,
+ );
+ };
+/* End PBXProject section */
+
+/* Begin PBXResourcesBuildPhase section */
+ 1D60588D0D05DD3D006BFB54 /* Resources */ = {
+ isa = PBXResourcesBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ 8E4156E90FA4EE0E0006D27C /* Default.png in Resources */,
+ 8E4156EA0FA4EE0E0006D27C /* icon.png in Resources */,
+ 8E3A1F090FAA199F009B0518 /* cover320x416.png in Resources */,
+ 8E785FCB0FCDB853006EA81F /* TestBedViewController.xib in Resources */,
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ };
+/* End PBXResourcesBuildPhase section */
+
+/* Begin PBXSourcesBuildPhase section */
+ 1D60588E0D05DD3D006BFB54 /* Sources */ = {
+ isa = PBXSourcesBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ 1D60589B0D05DD56006BFB54 /* main.m in Sources */,
+ 8EF804BC103333DE0007C539 /* ModalAlert.m in Sources */,
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ };
+/* End PBXSourcesBuildPhase section */
+
+/* Begin XCBuildConfiguration section */
+ 1D6058940D05DD3E006BFB54 /* Debug */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer: Erica Sadun";
+ COPY_PHASE_STRIP = NO;
+ DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
+ GCC_DYNAMIC_NO_PIC = NO;
+ GCC_ENABLE_FIX_AND_CONTINUE = NO;
+ GCC_OPTIMIZATION_LEVEL = 0;
+ GCC_PRECOMPILE_PREFIX_HEADER = YES;
+ GCC_PREFIX_HEADER = HelloWorld_Prefix.pch;
+ INFOPLIST_FILE = Info.plist;
+ PREBINDING = NO;
+ PRODUCT_NAME = HelloWorld;
+ };
+ name = Debug;
+ };
+ 1D6058950D05DD3E006BFB54 /* Release */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ COPY_PHASE_STRIP = YES;
+ DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
+ GCC_ENABLE_FIX_AND_CONTINUE = NO;
+ GCC_PRECOMPILE_PREFIX_HEADER = YES;
+ GCC_PREFIX_HEADER = HelloWorld_Prefix.pch;
+ INFOPLIST_FILE = Info.plist;
+ PREBINDING = NO;
+ PRODUCT_NAME = HelloWorld;
+ WRAPPER_EXTENSION = app;
+ };
+ name = Release;
+ };
+ C01FCF4F08A954540054247B /* Debug */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ ALWAYS_SEARCH_USER_PATHS = NO;
+ ARCHS = "$(ARCHS_STANDARD_32_BIT)";
+ CODE_SIGN_IDENTITY = "Erica Sadun";
+ "CODE_SIGN_IDENTITY[sdk=iphonesimulator*]" = "iPhone Developer";
+ GCC_C_LANGUAGE_STANDARD = c99;
+ GCC_WARN_ABOUT_RETURN_TYPE = YES;
+ GCC_WARN_UNUSED_VARIABLE = YES;
+ ONLY_ACTIVE_ARCH = YES;
+ PREBINDING = NO;
+ PRODUCT_NAME = "Oh Hello";
+ SDKROOT = iphoneos2.0;
+ };
+ name = Debug;
+ };
+ C01FCF5008A954540054247B /* Release */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ ARCHS = "$(ARCHS_STANDARD_32_BIT)";
+ PREBINDING = NO;
+ SDKROOT = iphoneos2.0;
+ };
+ name = Release;
+ };
+/* End XCBuildConfiguration section */
+
+/* Begin XCConfigurationList section */
+ 1D6058960D05DD3E006BFB54 /* Build configuration list for PBXNativeTarget "HelloWorld" */ = {
+ isa = XCConfigurationList;
+ buildConfigurations = (
+ 1D6058940D05DD3E006BFB54 /* Debug */,
+ 1D6058950D05DD3E006BFB54 /* Release */,
+ );
+ defaultConfigurationIsVisible = 0;
+ defaultConfigurationName = Release;
+ };
+ C01FCF4E08A954540054247B /* Build configuration list for PBXProject "HelloWorld" */ = {
+ isa = XCConfigurationList;
+ buildConfigurations = (
+ C01FCF4F08A954540054247B /* Debug */,
+ C01FCF5008A954540054247B /* Release */,
+ );
+ defaultConfigurationIsVisible = 0;
+ defaultConfigurationName = Release;
+ };
+/* End XCConfigurationList section */
+ };
+ rootObject = 29B97313FDCFA39411CA2CEA /* Project object */;
+}
View
8 C15-Media/04-Record Audio/HelloWorld_Prefix.pch
@@ -0,0 +1,8 @@
+//
+// Prefix header for all source files of the 'HelloWorld' target in the 'HelloWorld' project
+//
+
+#ifdef __OBJC__
+ #import <Foundation/Foundation.h>
+ #import <UIKit/UIKit.h>
+#endif
View
26 C15-Media/04-Record Audio/Info.plist
@@ -0,0 +1,26 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+<plist version="1.0">
+<dict>
+ <key>CFBundleDevelopmentRegion</key>
+ <string>en</string>
+ <key>CFBundleDisplayName</key>
+ <string>${PRODUCT_NAME}</string>
+ <key>CFBundleExecutable</key>
+ <string>${EXECUTABLE_NAME}</string>
+ <key>CFBundleIconFile</key>
+ <string></string>
+ <key>CFBundleIdentifier</key>
+ <string>com.sadun.${EXECUTABLE_NAME}</string>
+ <key>CFBundleInfoDictionaryVersion</key>
+ <string>6.0</string>
+ <key>CFBundleName</key>
+ <string>${PRODUCT_NAME}</string>
+ <key>CFBundlePackageType</key>
+ <string>APPL</string>
+ <key>CFBundleSignature</key>
+ <string>????</string>
+ <key>CFBundleVersion</key>
+ <string>1.0</string>
+</dict>
+</plist>
View
15 C15-Media/04-Record Audio/ModalAlert.h
@@ -0,0 +1,15 @@
+/*
+ Erica Sadun, http://ericasadun.com
+ iPhone Developer's Cookbook, 3.0 Edition
+ BSD License, Use at your own risk
+ */
+
+#import <UIKit/UIKit.h>
+
+@interface ModalAlert : NSObject
++ (NSString *) ask: (NSString *) question withTextPrompt: (NSString *) prompt;
++ (NSUInteger) ask: (NSString *) question withCancel: (NSString *) cancelButtonTitle withButtons: (NSArray *) buttons;
++ (void) say: (id)formatstring,...;
++ (BOOL) ask: (id)formatstring,...;
++ (BOOL) confirm: (id)formatstring,...;
+@end
View
180 C15-Media/04-Record Audio/ModalAlert.m
@@ -0,0 +1,180 @@
+/*
+ Erica Sadun, http://ericasadun.com
+ iPhone Developer's Cookbook, 3.0 Edition
+ BSD License, Use at your own risk
+ */
+
+/*
+ Thanks to Kevin Ballard for suggesting the UITextField as subview approach
+ All credit to Kenny TM. Mistakes are mine.
+ To Do: Ensure that only one runs at a time -- is that possible?
+ */
+
+#import "ModalAlert.h"
+#import <stdarg.h>
+
+#define TEXT_FIELD_TAG 9999
+
+@interface ModalAlertDelegate : NSObject <UIAlertViewDelegate, UITextFieldDelegate>
+{
+ CFRunLoopRef currentLoop;
+ NSString *text;
+ NSUInteger index;
+}
+@property (assign) NSUInteger index;
+@property (retain) NSString *text;
+@end
+
+@implementation ModalAlertDelegate
+@synthesize index;
+@synthesize text;
+
+-(id) initWithRunLoop: (CFRunLoopRef)runLoop
+{
+ if (self = [super init]) currentLoop = runLoop;
+ return self;
+}
+
+// User pressed button. Retrieve results
+-(void)alertView:(UIAlertView*)aView clickedButtonAtIndex:(NSInteger)anIndex
+{
+ UITextField *tf = (UITextField *)[aView viewWithTag:TEXT_FIELD_TAG];
+ if (tf) self.text = tf.text;
+ self.index = anIndex;
+ CFRunLoopStop(currentLoop);
+}
+
+- (BOOL) isLandscape
+{
+ return ([UIDevice currentDevice].orientation == UIDeviceOrientationLandscapeLeft) || ([UIDevice currentDevice].orientation == UIDeviceOrientationLandscapeRight);
+}
+
+// Move alert into place to allow keyboard to appear
+- (void) moveAlert: (UIAlertView *) alertView
+{
+ CGContextRef context = UIGraphicsGetCurrentContext();
+ [UIView beginAnimations:nil context:context];
+ [UIView setAnimationCurve:UIViewAnimationCurveEaseInOut];
+ [UIView setAnimationDuration:0.25f];
+ if (![self isLandscape])
+ alertView.center = CGPointMake(160.0f, 180.0f);
+ else
+ alertView.center = CGPointMake(240.0f, 90.0f);
+ [UIView commitAnimations];
+
+ [[alertView viewWithTag:TEXT_FIELD_TAG] becomeFirstResponder];
+}
+
+- (void) dealloc
+{
+ self.text = nil;
+ [super dealloc];
+}
+
+@end
+
+@implementation ModalAlert
+
++ (NSUInteger) ask: (NSString *) question withCancel: (NSString *) cancelButtonTitle withButtons: (NSArray *) buttons
+{
+ CFRunLoopRef currentLoop = CFRunLoopGetCurrent();
+
+ // Create Alert
+ ModalAlertDelegate *madelegate = [[ModalAlertDelegate alloc] initWithRunLoop:currentLoop];
+ UIAlertView *alertView = [[UIAlertView alloc] initWithTitle:question message:nil delegate:madelegate cancelButtonTitle:cancelButtonTitle otherButtonTitles:nil];
+ for (NSString *buttonTitle in buttons) [alertView addButtonWithTitle:buttonTitle];
+ [alertView show];
+
+ // Wait for response
+ CFRunLoopRun();
+
+ // Retrieve answer
+ NSUInteger answer = madelegate.index;
+ [alertView release];
+ [madelegate release];
+ return answer;
+}
+
++ (void) say: (id)formatstring,...
+{
+ va_list arglist;
+ va_start(arglist, formatstring);
+ id statement = [[NSString alloc] initWithFormat:formatstring arguments:arglist];
+ va_end(arglist);
+ [ModalAlert ask:statement withCancel:@"Okay" withButtons:nil];
+ [statement release];
+}
+
++ (BOOL) ask: (id)formatstring,...
+{
+ va_list arglist;
+ va_start(arglist, formatstring);
+ id statement = [[NSString alloc] initWithFormat:formatstring arguments:arglist];
+ va_end(arglist);
+ BOOL answer = ([ModalAlert ask:statement withCancel:nil withButtons:[NSArray arrayWithObjects:@"Yes", @"No", nil]] == 0);
+ [statement release];
+ return answer;
+}
+
++ (BOOL) confirm: (id)formatstring,...
+{
+ va_list arglist;
+ va_start(arglist, formatstring);
+ id statement = [[NSString alloc] initWithFormat:formatstring arguments:arglist];
+ va_end(arglist);
+ BOOL answer = [ModalAlert ask:statement withCancel:@"Cancel" withButtons:[NSArray arrayWithObject:@"OK"]];
+ [statement release];
+ return answer;
+}
+
++(NSString *) textQueryWith: (NSString *)question prompt: (NSString *)prompt button1: (NSString *)button1 button2:(NSString *) button2
+{
+ // Create alert
+ CFRunLoopRef currentLoop = CFRunLoopGetCurrent();
+ ModalAlertDelegate *madelegate = [[ModalAlertDelegate alloc] initWithRunLoop:currentLoop];
+ UIAlertView *alertView = [[UIAlertView alloc] initWithTitle:question message:@"\n" delegate:madelegate cancelButtonTitle:button1 otherButtonTitles:button2, nil];
+
+ // Build text field
+ UITextField *tf = [[UITextField alloc] initWithFrame:CGRectMake(0.0f, 0.0f, 260.0f, 30.0f)];
+ tf.borderStyle = UITextBorderStyleRoundedRect;
+ tf.tag = TEXT_FIELD_TAG;
+ tf.placeholder = prompt;
+ tf.clearButtonMode = UITextFieldViewModeWhileEditing;
+ tf.keyboardType = UIKeyboardTypeAlphabet;
+ tf.keyboardAppearance = UIKeyboardAppearanceAlert;
+ tf.autocapitalizationType = UITextAutocapitalizationTypeWords;
+ tf.autocorrectionType = UITextAutocorrectionTypeNo;
+ tf.contentVerticalAlignment = UIControlContentVerticalAlignmentCenter;
+
+ // Show alert and wait for it to finish displaying
+ [alertView show];
+ while (CGRectEqualToRect(alertView.bounds, CGRectZero));
+
+ // Find the center for the text field and add it
+ CGRect bounds = alertView.bounds;
+ tf.center = CGPointMake(bounds.size.width / 2.0f, bounds.size.height / 2.0f - 10.0f);
+ [alertView addSubview:tf];
+ [tf release];
+
+ // Set the field to first responder and move it into place
+ [madelegate performSelector:@selector(moveAlert:) withObject:alertView afterDelay: 0.7f];
+
+ // Start the run loop
+ CFRunLoopRun();
+
+ // Retrieve the user choices
+ NSUInteger index = madelegate.index;
+ NSString *answer = [[madelegate.text copy] autorelease];
+ if (index == 0) answer = nil; // assumes cancel in position 0
+
+ [alertView release];
+ [madelegate release];
+ return answer;
+}
+
++ (NSString *) ask: (NSString *) question withTextPrompt: (NSString *) prompt
+{
+ return [ModalAlert textQueryWith:question prompt:prompt button1:@"Cancel" button2:@"OK"];
+}
+@end
+
View
294 C15-Media/04-Record Audio/TestBedViewController.xib
@@ -0,0 +1,294 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<archive type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="7.03">
+ <data>
+ <int key="IBDocument.SystemTarget">768</int>
+ <string key="IBDocument.SystemVersion">9J61</string>
+ <string key="IBDocument.InterfaceBuilderVersion">680</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"/>
+ </object>
+ <object class="NSArray" key="IBDocument.PluginDependencies">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <string>com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
+ </object>
+ <object class="NSMutableDictionary" key="IBDocument.Metadata">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <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>
+ <object class="NSMutableArray" key="IBDocument.RootObjects" id="1000">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <object class="IBProxyObject" id="372490531">
+ <string key="IBProxiedObjectIdentifier">IBFilesOwner</string>
+ </object>
+ <object class="IBProxyObject" id="843779117">
+ <string key="IBProxiedObjectIdentifier">IBFirstResponder</string>
+ </object>
+ <object class="IBUIView" id="440620744">
+ <reference key="NSNextResponder"/>
+ <int key="NSvFlags">292</int>
+ <object class="NSMutableArray" key="NSSubviews">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <object class="IBUIImageView" id="1064941195">
+ <reference key="NSNextResponder" ref="440620744"/>
+ <int key="NSvFlags">256</int>
+ <string key="NSFrameSize">{320, 416}</string>
+ <reference key="NSSuperview" ref="440620744"/>
+ <bool key="IBUIOpaque">NO</bool>
+ <bool key="IBUIClipsSubviews">YES</bool>
+ <int key="IBUIContentMode">4</int>
+ <bool key="IBUIMultipleTouchEnabled">YES</bool>
+ <object class="NSCustomResource" key="IBUIImage">
+ <string key="NSClassName">NSImage</string>
+ <string key="NSResourceName">cover320x416.png</string>
+ </object>
+ </object>
+ <object class="IBUIProgressView" id="576115091">
+ <reference key="NSNextResponder" ref="440620744"/>
+ <int key="NSvFlags">292</int>
+ <string key="NSFrame">{{20, 41}, {280, 9}}</string>
+ <reference key="NSSuperview" ref="440620744"/>
+ <bool key="IBUIOpaque">NO</bool>
+ <bool key="IBUIClipsSubviews">YES</bool>
+ <bool key="IBUIMultipleTouchEnabled">YES</bool>
+ </object>
+ <object class="IBUIProgressView" id="65144128">
+ <reference key="NSNextResponder" ref="440620744"/>
+ <int key="NSvFlags">292</int>
+ <string key="NSFrame">{{20, 88}, {280, 9}}</string>
+ <reference key="NSSuperview" ref="440620744"/>
+ <bool key="IBUIOpaque">NO</bool>
+ <bool key="IBUIClipsSubviews">YES</bool>
+ <bool key="IBUIMultipleTouchEnabled">YES</bool>
+ </object>
+ <object class="IBUILabel" id="284396597">
+ <reference key="NSNextResponder" ref="440620744"/>
+ <int key="NSvFlags">292</int>
+ <string key="NSFrame">{{20, 64}, {42, 21}}</string>
+ <reference key="NSSuperview" ref="440620744"/>
+ <bool key="IBUIOpaque">NO</bool>
+ <bool key="IBUIClipsSubviews">YES</bool>
+ <bool key="IBUIUserInteractionEnabled">NO</bool>
+ <string key="IBUIText">Peak</string>
+ <object class="NSFont" key="IBUIFont" id="297482992">
+ <string key="NSName">Helvetica-Bold</string>
+ <double key="NSSize">1.700000e+01</double>
+ <int key="NSfFlags">16</int>
+ </object>
+ <object class="NSColor" key="IBUITextColor" id="541787610">
+ <int key="NSColorSpace">1</int>
+ <bytes key="NSRGB">MCAwIDAAA</bytes>
+ </object>
+ <nil key="IBUIHighlightedColor"/>
+ <int key="IBUIBaselineAdjustment">1</int>
+ <float key="IBUIMinimumFontSize">1.000000e+01</float>
+ </object>
+ <object class="IBUILabel" id="690815452">
+ <reference key="NSNextResponder" ref="440620744"/>
+ <int key="NSvFlags">292</int>
+ <string key="NSFrame">{{20, 12}, {64, 21}}</string>
+ <reference key="NSSuperview" ref="440620744"/>
+ <bool key="IBUIOpaque">NO</bool>
+ <bool key="IBUIClipsSubviews">YES</bool>
+ <bool key="IBUIUserInteractionEnabled">NO</bool>
+ <string key="IBUIText">Average</string>
+ <reference key="IBUIFont" ref="297482992"/>
+ <reference key="IBUITextColor" ref="541787610"/>
+ <nil key="IBUIHighlightedColor"/>
+ <int key="IBUIBaselineAdjustment">1</int>
+ <float key="IBUIMinimumFontSize">1.000000e+01</float>
+ </object>
+ </object>
+ <string key="NSFrameSize">{320, 416}</string>
+ <reference key="NSSuperview"/>
+ <object class="NSColor" key="IBUIBackgroundColor">
+ <int key="NSColorSpace">3</int>
+ <bytes key="NSWhite">MQA</bytes>
+ <object class="NSColorSpace" key="NSCustomColorSpace">
+ <int key="NSID">2</int>
+ </object>
+ </object>
+ <bool key="IBUIClearsContextBeforeDrawing">NO</bool>
+ <object class="IBUISimulatedStatusBarMetrics" key="IBUISimulatedStatusBarMetrics"/>
+ <object class="IBUISimulatedNavigationBarMetrics" key="IBUISimulatedTopBarMetrics">
+ <bool key="IBUIPrompted">NO</bool>
+ </object>
+ </object>
+ </object>
+ <object class="IBObjectContainer" key="IBDocument.Objects">
+ <object class="NSMutableArray" key="connectionRecords">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <object class="IBConnectionRecord">
+ <object class="IBCocoaTouchOutletConnection" key="connection">
+ <string key="label">meter1</string>
+ <reference key="source" ref="372490531"/>
+ <reference key="destination" ref="576115091"/>
+ </object>
+ <int key="connectionID">38</int>
+ </object>
+ <object class="IBConnectionRecord">
+ <object class="IBCocoaTouchOutletConnection" key="connection">
+ <string key="label">meter2</string>
+ <reference key="source" ref="372490531"/>
+ <reference key="destination" ref="65144128"/>
+ </object>
+ <int key="connectionID">39</int>
+ </object>
+ <object class="IBConnectionRecord">
+ <object class="IBCocoaTouchOutletConnection" key="connection">
+ <string key="label">view</string>
+ <reference key="source" ref="372490531"/>
+ <reference key="destination" ref="440620744"/>
+ </object>
+ <int key="connectionID">59</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>
+ <object class="NSArray" key="object" id="884947135">
+ <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="884947135"/>
+ <string type="base64-UTF8" key="objectName">RmlsZSdzIE93bmVyA</string>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">-2</int>
+ <reference key="object" ref="843779117"/>
+ <reference key="parent" ref="884947135"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">32</int>
+ <reference key="object" ref="440620744"/>
+ <object class="NSMutableArray" key="children">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <reference ref="576115091"/>
+ <reference ref="690815452"/>
+ <reference ref="65144128"/>
+ <reference ref="284396597"/>
+ <reference ref="1064941195"/>
+ </object>
+ <reference key="parent" ref="884947135"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">34</int>
+ <reference key="object" ref="1064941195"/>
+ <reference key="parent" ref="440620744"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">35</int>
+ <reference key="object" ref="576115091"/>
+ <reference key="parent" ref="440620744"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">37</int>
+ <reference key="object" ref="65144128"/>
+ <reference key="parent" ref="440620744"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">40</int>
+ <reference key="object" ref="284396597"/>
+ <reference key="parent" ref="440620744"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">41</int>
+ <reference key="object" ref="690815452"/>
+ <reference key="parent" ref="440620744"/>
+ </object>
+ </object>
+ </object>
+ <object class="NSMutableDictionary" key="flattenedProperties">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <object class="NSMutableArray" key="dict.sortedKeys">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <string>-1.CustomClassName</string>
+ <string>-2.CustomClassName</string>
+ <string>32.IBEditorWindowLastContentRect</string>
+ <string>32.IBPluginDependency</string>
+ <string>35.IBPluginDependency</string>
+ <string>37.IBPluginDependency</string>
+ <string>40.IBPluginDependency</string>
+ <string>41.IBPluginDependency</string>
+ </object>
+ <object class="NSMutableArray" key="dict.values">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <string>TestBedViewController</string>
+ <string>UIResponder</string>
+ <string>{{649, 121}, {320, 480}}</string>
+ <string>com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
+ <string>com.apple.InterfaceBuilder.IBCocoaTouchPlugin</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>
+ <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>
+ <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">65</int>
+ </object>
+ <object class="IBClassDescriber" key="IBDocument.Classes">
+ <object class="NSMutableArray" key="referencedPartialClassDescriptions">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <object class="IBPartialClassDescription">
+ <string key="className">TestBedViewController</string>
+ <object class="NSMutableDictionary" key="outlets">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <object class="NSMutableArray" key="dict.sortedKeys">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <string>meter1</string>
+ <string>meter2</string>
+ <string>view</string>
+ </object>
+ <object class="NSMutableArray" key="dict.values">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <string>UIProgressView</string>
+ <string>UIProgressView</string>
+ <string>UIView</string>
+ </object>
+ </object>
+ <object class="IBClassDescriptionSource" key="sourceIdentifier">
+ <string key="majorKey">IBUserSource</string>
+ <string key="minorKey"/>
+ </object>
+ </object>
+ </object>
+ </object>
+ <int key="IBDocument.localizationMode">0</int>
+ <string key="IBDocument.LastKnownRelativeProjectPath">HelloWorld.xcodeproj</string>
+ <int key="IBDocument.defaultPropertyAccessControl">3</int>
+ <string key="IBCocoaTouchPluginVersion">3.1</string>
+ </data>
+</archive>
View
BIN  C15-Media/04-Record Audio/cover320x416.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN  C15-Media/04-Record Audio/icon.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
234 C15-Media/04-Record Audio/main.m
@@ -0,0 +1,234 @@
+/*
+ Erica Sadun, http://ericasadun.com
+ iPhone Developer's Cookbook, 3.0 Edition
+ BSD License, Use at your own risk
+ */
+
+#import <UIKit/UIKit.h>
+#import <AVFoundation/AVFoundation.h>
+#import <CoreAudio/CoreAudioTypes.h>
+#import "ModalAlert.h"
+
+#define COOKBOOK_PURPLE_COLOR [UIColor colorWithRed:0.20392f green:0.19607f blue:0.61176f alpha:1.0f]
+#define BARBUTTON(TITLE, SELECTOR) [[[UIBarButtonItem alloc] initWithTitle:TITLE style:UIBarButtonItemStylePlain target:self action:SELECTOR] autorelease]
+#define SYSBARBUTTON(ITEM, TARGET, SELECTOR) [[[UIBarButtonItem alloc] initWithBarButtonSystemItem:ITEM target:TARGET action:SELECTOR] autorelease]
+
+#define DOCUMENTS_FOLDER [NSHomeDirectory() stringByAppendingPathComponent:@"Documents"]
+#define FILEPATH [DOCUMENTS_FOLDER stringByAppendingPathComponent:[self dateString]]
+
+#define XMAX 20.0f
+
+@interface TestBedViewController : UIViewController <AVAudioRecorderDelegate, AVAudioPlayerDelegate>
+{
+ AVAudioRecorder *recorder;
+ AVAudioSession *session;
+ IBOutlet UIProgressView *meter1;
+ IBOutlet UIProgressView *meter2;
+ NSTimer *timer;
+}
+@property (retain) AVAudioSession *session;
+@property (retain) AVAudioRecorder *recorder;
+@end
+
+@implementation TestBedViewController
+@synthesize session;
+@synthesize recorder;
+
+- (NSString *) dateString
+{
+ // return a formatted string for a file name
+ NSDateFormatter *formatter = [[[NSDateFormatter alloc] init] autorelease];
+ formatter.dateFormat = @"ddMMMYY_hhmmssa";
+ return [[formatter stringFromDate:[NSDate date]] stringByAppendingString:@".aif"];
+}
+
+- (NSString *) formatTime: (int) num
+{
+ // return a formatted ellapsed time string
+ int secs = num % 60;
+ int min = num / 60;
+ if (num < 60) return [NSString stringWithFormat:@"0:%02d", num];
+ return [NSString stringWithFormat:@"%d:%02d", min, secs];
+}
+
+- (void) updateMeters
+{
+ // Show the current power levels
+ [self.recorder updateMeters];
+ float avg = [self.recorder averagePowerForChannel:0];
+ float peak = [self.recorder peakPowerForChannel:0];
+ meter1.progress = (XMAX + avg) / XMAX;
+ meter2.progress = (XMAX + peak) / XMAX;
+
+ // Update the current recording time
+ self.title = [NSString stringWithFormat:@"%@", [self formatTime:self.recorder.currentTime]];
+}
+
+- (void)audioPlayerDidFinishPlaying:(AVAudioPlayer *)player successfully:(BOOL)flag
+{
+ // Prepare UI for recording
+ self.title = nil;
+ meter1.hidden = NO;
+ meter2.hidden = NO;
+ self.navigationItem.rightBarButtonItem = BARBUTTON(@"Record", @selector(record));
+
+ // Delete the current recording
+ [ModalAlert say:@"Deleting recording"];
+ //[self.recorder deleteRecording]; <-- too flaky to use
+ NSError *error;
+ if (![[NSFileManager defaultManager] removeItemAtPath:[self.recorder.url path] error:&error])
+ NSLog(@"Error: %@", [error localizedDescription]);
+
+ // Release the player
+ [player release];
+}
+
+- (void)audioRecorderDidFinishRecording:(AVAudioRecorder *)recorder successfully:(BOOL)flag
+{
+ // Stop monitoring levels, time
+ [timer invalidate];
+ meter1.progress = 0.0f;
+ meter1.hidden = YES;
+ meter2.progress = 0.0f;
+ meter2.hidden = YES;
+ self.navigationItem.leftBarButtonItem = nil;
+ self.navigationItem.rightBarButtonItem = nil;
+
+ [ModalAlert say:@"File saved to %@", [[self.recorder.url path] lastPathComponent]];
+ self.title = @"Playing back recording...";
+
+ // Start playback
+ AVAudioPlayer *player = [[AVAudioPlayer alloc] initWithContentsOfURL:self.recorder.url error:nil];
+ player.delegate = self;
+ [player play];
+}
+
+- (void) stopRecording
+{
+ // This causes the didFinishRecording delegate method to fire
+ [self.recorder stop];
+}
+
+- (void) continueRecording
+{
+ // resume from a paused recording
+ [self.recorder record];
+ self.navigationItem.rightBarButtonItem = BARBUTTON(@"Done", @selector(stopRecording));
+ self.navigationItem.leftBarButtonItem = SYSBARBUTTON(UIBarButtonSystemItemPause, self, @selector(pauseRecording));
+}
+
+- (void) pauseRecording
+{
+ // pause an ongoing recording
+ [self.recorder pause];
+ self.navigationItem.leftBarButtonItem = BARBUTTON(@"Continue", @selector(continueRecording));
+ self.navigationItem.rightBarButtonItem = nil;
+}
+
+- (BOOL) record
+{
+ NSError *error;
+
+ // Recording settings
+ NSMutableDictionary *settings = [NSMutableDictionary dictionary];
+ [settings setValue: [NSNumber numberWithInt:kAudioFormatLinearPCM] forKey:AVFormatIDKey];
+ [settings setValue: [NSNumber numberWithFloat:8000.0] forKey:AVSampleRateKey];
+ [settings setValue: [NSNumber numberWithInt: 1] forKey:AVNumberOfChannelsKey]; // mono
+ [settings setValue: [NSNumber numberWithInt:16] forKey:AVLinearPCMBitDepthKey];
+ [settings setValue: [NSNumber numberWithBool:NO] forKey:AVLinearPCMIsBigEndianKey];
+ [settings setValue: [NSNumber numberWithBool:NO] forKey:AVLinearPCMIsFloatKey];
+
+ // File URL
+ NSURL *url = [NSURL fileURLWithPath:FILEPATH];
+
+ // Create recorder
+ self.recorder = [[AVAudioRecorder alloc] initWithURL:url settings:settings error:&error];
+ if (!self.recorder)
+ {
+ NSLog(@"Error: %@", [error localizedDescription]);
+ return NO;
+ }
+
+ // Initialize degate, metering, etc.
+ self.recorder.delegate = self;
+ self.recorder.meteringEnabled = YES;
+ meter1.progress = 0.0f;
+ meter2.progress = 0.0f;
+ self.title = @"0:00";
+
+ if (![self.recorder prepareToRecord])
+ {
+ NSLog(@"Error: Prepare to record failed");
+ [ModalAlert say:@"Error while preparing recording"];
+ return NO;
+ }
+
+ if (![self.recorder record])
+ {
+ NSLog(@"Error: Record failed");
+ [ModalAlert say:@"Error while attempting to record audio"];
+ return NO;
+ }
+
+ // Set a timer to monitor levels, current time
+ timer = [NSTimer scheduledTimerWithTimeInterval:0.1f target:self selector:@selector(updateMeters) userInfo:nil repeats:YES];
+
+ // Update the navigation bar
+ self.navigationItem.rightBarButtonItem = BARBUTTON(@"Done", @selector(stopRecording));
+ self.navigationItem.leftBarButtonItem = SYSBARBUTTON(UIBarButtonSystemItemPause, self, @selector(pauseRecording));
+
+ return YES;
+}
+
+- (BOOL) startAudioSession
+{
+ // Prepare the audio session
+ NSError *error;
+ self.session = [AVAudioSession sharedInstance];
+
+ if (![self.session setCategory:AVAudioSessionCategoryPlayAndRecord error:&error])
+ {
+ NSLog(@"Error: %@", [error localizedDescription]);
+ return NO;
+ }
+
+ if (![self.session setActive:YES error:&error])
+ {
+ NSLog(@"Error: %@", [error localizedDescription]);
+ return NO;
+ }
+
+ return self.session.inputIsAvailable;
+}
+
+- (void) viewDidLoad
+{
+ self.navigationController.navigationBar.tintColor = COOKBOOK_PURPLE_COLOR;
+ self.title = @"Audio Recorder";
+
+ if ([self startAudioSession])
+ self.navigationItem.rightBarButtonItem = BARBUTTON(@"Record", @selector(record));
+ else
+ self.title = @"No Audio Input Available";
+}
+@end
+
+@interface TestBedAppDelegate : NSObject <UIApplicationDelegate>
+@end
+
+@implementation TestBedAppDelegate
+- (void)applicationDidFinishLaunching:(UIApplication *)application {
+ UIWindow *window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
+ UINavigationController *nav = [[UINavigationController alloc] initWithRootViewController:[[TestBedViewController alloc] init]];
+ [window addSubview:nav.view];
+ [window makeKeyAndVisible];
+}
+@end
+
+int main(int argc, char *argv[])
+{
+ NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];
+ int retVal = UIApplicationMain(argc, argv, nil, @"TestBedAppDelegate");
+ [pool release];
+ return retVal;
+}
View
BIN  C15-Media/05-AudioQueue Recording/Default.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
271 C15-Media/05-AudioQueue Recording/HelloWorld.xcodeproj/project.pbxproj
@@ -0,0 +1,271 @@
+// !$*UTF8*$!
+{
+ archiveVersion = 1;
+ classes = {
+ };
+ objectVersion = 45;
+ objects = {
+
+/* Begin PBXBuildFile section */
+ 1D3623EC0D0F72F000981E51 /* CoreGraphics.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1D3623EB0D0F72F000981E51 /* CoreGraphics.framework */; };
+ 1D60589F0D05DD5A006BFB54 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1D30AB110D05D00D00671497 /* Foundation.framework */; };
+ 1DF5F4E00D08C38300B7A737 /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1DF5F4DF0D08C38300B7A737 /* UIKit.framework */; };
+ 8E3A1F090FAA199F009B0518 /* cover320x416.png in Resources */ = {isa = PBXBuildFile; fileRef = 8E3A1F080FAA199F009B0518 /* cover320x416.png */; };
+ 8E4156E90FA4EE0E0006D27C /* Default.png in Resources */ = {isa = PBXBuildFile; fileRef = 8E4156E70FA4EE0E0006D27C /* Default.png */; };
+ 8E4156EA0FA4EE0E0006D27C /* icon.png in Resources */ = {isa = PBXBuildFile; fileRef = 8E4156E80FA4EE0E0006D27C /* icon.png */; };
+ 8E77AF2E10334C8800F570BD /* TestBedViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = 8E77AF2C10334C8800F570BD /* TestBedViewController.xib */; };
+ 8E77AF2F10334C8800F570BD /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 8E77AF2D10334C8800F570BD /* main.m */; };
+ 8E77AF4510334D9600F570BD /* LibraryController.m in Sources */ = {isa = PBXBuildFile; fileRef = 8E77AF4410334D9600F570BD /* LibraryController.m */; };
+ 8EDA991310334B8F00CC11DE /* AudioToolbox.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 8EDA991210334B8F00CC11DE /* AudioToolbox.framework */; };
+ 8EDA993A10334BBC00CC11DE /* AVFoundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 8EDA993910334BBC00CC11DE /* AVFoundation.framework */; };
+ 8EF805E0103348AC0007C539 /* green.png in Resources */ = {isa = PBXBuildFile; fileRef = 8EF805DC103348AC0007C539 /* green.png */; };
+ 8EF805E1103348AC0007C539 /* green2.png in Resources */ = {isa = PBXBuildFile; fileRef = 8EF805DD103348AC0007C539 /* green2.png */; };
+ 8EF805E2103348AC0007C539 /* red.png in Resources */ = {isa = PBXBuildFile; fileRef = 8EF805DE103348AC0007C539 /* red.png */; };
+ 8EF805E3103348AC0007C539 /* red2.png in Resources */ = {isa = PBXBuildFile; fileRef = 8EF805DF103348AC0007C539 /* red2.png */; };
+ 8EF805E7103348C30007C539 /* Recorder.m in Sources */ = {isa = PBXBuildFile; fileRef = 8EF805E6103348C30007C539 /* Recorder.m */; };
+/* End PBXBuildFile section */
+
+/* Begin PBXFileReference section */
+ 1D30AB110D05D00D00671497 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; };
+ 1D3623EB0D0F72F000981E51 /* CoreGraphics.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreGraphics.framework; path = System/Library/Frameworks/CoreGraphics.framework; sourceTree = SDKROOT; };
+ 1D6058910D05DD3D006BFB54 /* HelloWorld.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = HelloWorld.app; sourceTree = BUILT_PRODUCTS_DIR; };
+ 1DF5F4DF0D08C38300B7A737 /* UIKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = UIKit.framework; path = System/Library/Frameworks/UIKit.framework; sourceTree = SDKROOT; };
+ 32CA4F630368D1EE00C91783 /* HelloWorld_Prefix.pch */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HelloWorld_Prefix.pch; sourceTree = "<group>"; };
+ 8D1107310486CEB800E47090 /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
+ 8E3A1F080FAA199F009B0518 /* cover320x416.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = cover320x416.png; sourceTree = "<group>"; };
+ 8E4156E70FA4EE0E0006D27C /* Default.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = Default.png; sourceTree = "<group>"; };
+ 8E4156E80FA4EE0E0006D27C /* icon.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = icon.png; sourceTree = "<group>"; };
+ 8E77AF2C10334C8800F570BD /* TestBedViewController.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = TestBedViewController.xib; sourceTree = "<group>"; };
+ 8E77AF2D10334C8800F570BD /* main.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = "<group>"; };
+ 8E77AF4310334D9600F570BD /* LibraryController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LibraryController.h; sourceTree = "<group>"; };
+ 8E77AF4410334D9600F570BD /* LibraryController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = LibraryController.m; sourceTree = "<group>"; };
+ 8EDA991210334B8F00CC11DE /* AudioToolbox.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AudioToolbox.framework; path = System/Library/Frameworks/AudioToolbox.framework; sourceTree = SDKROOT; };
+ 8EDA993910334BBC00CC11DE /* AVFoundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AVFoundation.framework; path = System/Library/Frameworks/AVFoundation.framework; sourceTree = SDKROOT; };
+ 8EF805DC103348AC0007C539 /* green.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = green.png; sourceTree = "<group>"; };
+ 8EF805DD103348AC0007C539 /* green2.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = green2.png; sourceTree = "<group>"; };
+ 8EF805DE103348AC0007C539 /* red.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = red.png; sourceTree = "<group>"; };
+ 8EF805DF103348AC0007C539 /* red2.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = red2.png; sourceTree = "<group>"; };
+ 8EF805E5103348C30007C539 /* Recorder.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Recorder.h; sourceTree = "<group>"; };
+ 8EF805E6103348C30007C539 /* Recorder.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = Recorder.m; sourceTree = "<group>"; };
+/* End PBXFileReference section */
+
+/* Begin PBXFrameworksBuildPhase section */
+ 1D60588F0D05DD3D006BFB54 /* Frameworks */ = {
+ isa = PBXFrameworksBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ 1D60589F0D05DD5A006BFB54 /* Foundation.framework in Frameworks */,
+ 1DF5F4E00D08C38300B7A737 /* UIKit.framework in Frameworks */,
+ 1D3623EC0D0F72F000981E51 /* CoreGraphics.framework in Frameworks */,
+ 8EDA991310334B8F00CC11DE /* AudioToolbox.framework in Frameworks */,
+ 8EDA993A10334BBC00CC11DE /* AVFoundation.framework in Frameworks */,
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ };
+/* End PBXFrameworksBuildPhase section */
+
+/* Begin PBXGroup section */
+ 19C28FACFE9D520D11CA2CBB /* Products */ = {
+ isa = PBXGroup;
+ children = (
+ 1D6058910D05DD3D006BFB54 /* HelloWorld.app */,
+ );
+ name = Products;
+ sourceTree = "<group>";
+ };
+ 29B97314FDCFA39411CA2CEA /* CustomTemplate */ = {
+ isa = PBXGroup;
+ children = (
+ 8E77AF4310334D9600F570BD /* LibraryController.h */,
+ 8E77AF4410334D9600F570BD /* LibraryController.m */,
+ 8EF805E5103348C30007C539 /* Recorder.h */,
+ 8EF805E6103348C30007C539 /* Recorder.m */,
+ 8E77AF2C10334C8800F570BD /* TestBedViewController.xib */,
+ 8E77AF2D10334C8800F570BD /* main.m */,
+ 8EB688610FA64AD100489E4B /* Support */,
+ 29B97323FDCFA39411CA2CEA /* Frameworks */,
+ 19C28FACFE9D520D11CA2CBB /* Products */,
+ );
+ name = CustomTemplate;
+ sourceTree = "<group>";
+ };
+ 29B97323FDCFA39411CA2CEA /* Frameworks */ = {
+ isa = PBXGroup;
+ children = (
+ 8EDA993910334BBC00CC11DE /* AVFoundation.framework */,
+ 8EDA991210334B8F00CC11DE /* AudioToolbox.framework */,
+ 1D3623EB0D0F72F000981E51 /* CoreGraphics.framework */,
+ 1D30AB110D05D00D00671497 /* Foundation.framework */,
+ 1DF5F4DF0D08C38300B7A737 /* UIKit.framework */,
+ );
+ name = Frameworks;
+ sourceTree = "<group>";
+ };
+ 8EB688610FA64AD100489E4B /* Support */ = {
+ isa = PBXGroup;
+ children = (
+ 8EF805DC103348AC0007C539 /* green.png */,
+ 8EF805DD103348AC0007C539 /* green2.png */,
+ 8EF805DE103348AC0007C539 /* red.png */,
+ 8EF805DF103348AC0007C539 /* red2.png */,
+ 8E3A1F080FAA199F009B0518 /* cover320x416.png */,
+ 32CA4F630368D1EE00C91783 /* HelloWorld_Prefix.pch */,
+ 8D1107310486CEB800E47090 /* Info.plist */,
+ 8E4156E80FA4EE0E0006D27C /* icon.png */,
+ 8E4156E70FA4EE0E0006D27C /* Default.png */,
+ );
+ name = Support;
+ sourceTree = "<group>";
+ };
+/* End PBXGroup section */
+
+/* Begin PBXNativeTarget section */
+ 1D6058900D05DD3D006BFB54 /* HelloWorld */ = {
+ isa = PBXNativeTarget;
+ buildConfigurationList = 1D6058960D05DD3E006BFB54 /* Build configuration list for PBXNativeTarget "HelloWorld" */;
+ buildPhases = (
+ 1D60588D0D05DD3D006BFB54 /* Resources */,
+ 1D60588E0D05DD3D006BFB54 /* Sources */,
+ 1D60588F0D05DD3D006BFB54 /* Frameworks */,
+ );
+ buildRules = (
+ );
+ dependencies = (
+ );
+ name = HelloWorld;
+ productName = HelloWorld;
+ productReference = 1D6058910D05DD3D006BFB54 /* HelloWorld.app */;
+ productType = "com.apple.product-type.application";
+ };
+/* End PBXNativeTarget section */
+
+/* Begin PBXProject section */
+ 29B97313FDCFA39411CA2CEA /* Project object */ = {
+ isa = PBXProject;
+ buildConfigurationList = C01FCF4E08A954540054247B /* Build configuration list for PBXProject "HelloWorld" */;
+ compatibilityVersion = "Xcode 3.1";
+ hasScannedForEncodings = 1;
+ mainGroup = 29B97314FDCFA39411CA2CEA /* CustomTemplate */;
+ projectDirPath = "";
+ projectRoot = "";
+ targets = (
+ 1D6058900D05DD3D006BFB54 /* HelloWorld */,
+ );
+ };
+/* End PBXProject section */
+
+/* Begin PBXResourcesBuildPhase section */
+ 1D60588D0D05DD3D006BFB54 /* Resources */ = {
+ isa = PBXResourcesBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ 8E4156E90FA4EE0E0006D27C /* Default.png in Resources */,
+ 8E4156EA0FA4EE0E0006D27C /* icon.png in Resources */,
+ 8E3A1F090FAA199F009B0518 /* cover320x416.png in Resources */,
+ 8EF805E0103348AC0007C539 /* green.png in Resources */,
+ 8EF805E1103348AC0007C539 /* green2.png in Resources */,
+ 8EF805E2103348AC0007C539 /* red.png in Resources */,
+ 8EF805E3103348AC0007C539 /* red2.png in Resources */,
+ 8E77AF2E10334C8800F570BD /* TestBedViewController.xib in Resources */,
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ };
+/* End PBXResourcesBuildPhase section */
+
+/* Begin PBXSourcesBuildPhase section */
+ 1D60588E0D05DD3D006BFB54 /* Sources */ = {
+ isa = PBXSourcesBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ 8EF805E7103348C30007C539 /* Recorder.m in Sources */,
+ 8E77AF2F10334C8800F570BD /* main.m in Sources */,
+ 8E77AF4510334D9600F570BD /* LibraryController.m in Sources */,
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ };
+/* End PBXSourcesBuildPhase section */
+
+/* Begin XCBuildConfiguration section */
+ 1D6058940D05DD3E006BFB54 /* Debug */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer: Erica Sadun";
+ COPY_PHASE_STRIP = NO;
+ DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
+ GCC_DYNAMIC_NO_PIC = NO;
+ GCC_ENABLE_FIX_AND_CONTINUE = NO;
+ GCC_OPTIMIZATION_LEVEL = 0;
+ GCC_PRECOMPILE_PREFIX_HEADER = YES;
+ GCC_PREFIX_HEADER = HelloWorld_Prefix.pch;
+ INFOPLIST_FILE = Info.plist;
+ PREBINDING = NO;
+ PRODUCT_NAME = HelloWorld;
+ };
+ name = Debug;
+ };
+ 1D6058950D05DD3E006BFB54 /* Release */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ COPY_PHASE_STRIP = YES;
+ DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
+ GCC_ENABLE_FIX_AND_CONTINUE = NO;
+ GCC_PRECOMPILE_PREFIX_HEADER = YES;
+ GCC_PREFIX_HEADER = HelloWorld_Prefix.pch;
+ INFOPLIST_FILE = Info.plist;
+ PREBINDING = NO;
+ PRODUCT_NAME = HelloWorld;
+ WRAPPER_EXTENSION = app;
+ };
+ name = Release;
+ };
+ C01FCF4F08A954540054247B /* Debug */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ ALWAYS_SEARCH_USER_PATHS = NO;
+ ARCHS = "$(ARCHS_STANDARD_32_BIT)";
+ CODE_SIGN_IDENTITY = "Erica Sadun";
+ "CODE_SIGN_IDENTITY[sdk=iphonesimulator*]" = "iPhone Developer";
+ GCC_C_LANGUAGE_STANDARD = c99;
+ GCC_WARN_ABOUT_RETURN_TYPE = YES;
+ GCC_WARN_UNUSED_VARIABLE = YES;
+ ONLY_ACTIVE_ARCH = YES;
+ PREBINDING = NO;
+ PRODUCT_NAME = "Oh Hello";
+ SDKROOT = iphoneos2.0;
+ };
+ name = Debug;
+ };
+ C01FCF5008A954540054247B /* Release */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ ARCHS = "$(ARCHS_STANDARD_32_BIT)";
+ PREBINDING = NO;
+ SDKROOT = iphoneos2.0;
+ };
+ name = Release;
+ };
+/* End XCBuildConfiguration section */
+
+/* Begin XCConfigurationList section */
+ 1D6058960D05DD3E006BFB54 /* Build configuration list for PBXNativeTarget "HelloWorld" */ = {
+ isa = XCConfigurationList;
+ buildConfigurations = (
+ 1D6058940D05DD3E006BFB54 /* Debug */,
+ 1D6058950D05DD3E006BFB54 /* Release */,
+ );
+ defaultConfigurationIsVisible = 0;
+ defaultConfigurationName = Release;
+ };
+ C01FCF4E08A954540054247B /* Build configuration list for PBXProject "HelloWorld" */ = {
+ isa = XCConfigurationList;
+ buildConfigurations = (
+ C01FCF4F08A954540054247B /* Debug */,
+ C01FCF5008A954540054247B /* Release */,
+ );
+ defaultConfigurationIsVisible = 0;
+ defaultConfigurationName = Release;
+ };
+/* End XCConfigurationList section */
+ };
+ rootObject = 29B97313FDCFA39411CA2CEA /* Project object */;
+}
View
8 C15-Media/05-AudioQueue Recording/HelloWorld_Prefix.pch
@@ -0,0 +1,8 @@
+//
+// Prefix header for all source files of the 'HelloWorld' target in the 'HelloWorld' project
+//
+
+#ifdef __OBJC__
+ #import <Foundation/Foundation.h>
+ #import <UIKit/UIKit.h>
+#endif
View
26 C15-Media/05-AudioQueue Recording/Info.plist
@@ -0,0 +1,26 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+<plist version="1.0">
+<dict>
+ <key>CFBundleDevelopmentRegion</key>
+ <string>en</string>
+ <key>CFBundleDisplayName</key>
+ <string>${PRODUCT_NAME}</string>
+ <key>CFBundleExecutable</key>
+ <string>${EXECUTABLE_NAME}</string>
+ <key>CFBundleIconFile</key>
+ <string></string>
+ <key>CFBundleIdentifier</key>
+ <string>com.sadun.${EXECUTABLE_NAME}</string>
+ <key>CFBundleInfoDictionaryVersion</key>
+ <string>6.0</string>
+ <key>CFBundleName</key>
+ <string>${PRODUCT_NAME}</string>
+ <key>CFBundlePackageType</key>
+ <string>APPL</string>
+ <key>CFBundleSignature</key>
+ <string>????</string>
+ <key>CFBundleVersion</key>
+ <string>1.0</string>
+</dict>
+</plist>
View
16 C15-Media/05-AudioQueue Recording/LibraryController.h
@@ -0,0 +1,16 @@
+/*
+ Erica Sadun, http://ericasadun.com
+ iPhone Developer's Cookbook, 3.0 Edition
+ BSD License, Use at your own risk
+ */
+
+#import <Foundation/Foundation.h>
+#import <AVFoundation/AVFoundation.h>
+
+@interface LibraryController : UITableViewController <AVAudioPlayerDelegate>
+{
+ NSArray *fileList;
+ AVAudioPlayer *player;
+}
+@property (retain) NSArray *fileList;
+@end
View
135 C15-Media/05-AudioQueue Recording/LibraryController.m
@@ -0,0 +1,135 @@
+/*
+ Erica Sadun, http://ericasadun.com
+ iPhone Developer's Cookbook, 3.0 Edition
+ BSD License, Use at your own risk
+ */
+
+#import "LibraryController.h"
+
+#define COOKBOOK_PURPLE_COLOR [UIColor colorWithRed:0.20392f green:0.19607f blue:0.61176f alpha:1.0f]
+#define BARBUTTON(TITLE, SELECTOR) [[[UIBarButtonItem alloc] initWithTitle:TITLE style:UIBarButtonItemStylePlain target:self action:SELECTOR] autorelease]
+#define DOCUMENTS_FOLDER [NSHomeDirectory() stringByAppendingPathComponent:@"Documents"]
+
+@implementation LibraryController
+@synthesize fileList;