forked from wave2future/MicBlow
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Dan Grigsby
committed
Aug 19, 2009
0 parents
commit 4d1236d
Showing
12 changed files
with
840 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
build | ||
*.pbxuser | ||
*.perspective | ||
*.perspectivev3 | ||
*.mode1v3 | ||
*.mode2v3 | ||
.DS_Store |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
// | ||
// MicBlowAppDelegate.h | ||
// MicBlow | ||
// | ||
// Created by Dan Grigsby on 8/19/09. | ||
// Copyright __MyCompanyName__ 2009. All rights reserved. | ||
// | ||
|
||
#import <UIKit/UIKit.h> | ||
|
||
@class MicBlowViewController; | ||
|
||
@interface MicBlowAppDelegate : NSObject <UIApplicationDelegate> { | ||
UIWindow *window; | ||
MicBlowViewController *viewController; | ||
} | ||
|
||
@property (nonatomic, retain) IBOutlet UIWindow *window; | ||
@property (nonatomic, retain) IBOutlet MicBlowViewController *viewController; | ||
|
||
@end | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
// | ||
// MicBlowAppDelegate.m | ||
// MicBlow | ||
// | ||
// Created by Dan Grigsby on 8/19/09. | ||
// Copyright __MyCompanyName__ 2009. All rights reserved. | ||
// | ||
|
||
#import "MicBlowAppDelegate.h" | ||
#import "MicBlowViewController.h" | ||
|
||
@implementation MicBlowAppDelegate | ||
|
||
@synthesize window; | ||
@synthesize viewController; | ||
|
||
|
||
- (void)applicationDidFinishLaunching:(UIApplication *)application { | ||
|
||
// Override point for customization after app launch | ||
[window addSubview:viewController.view]; | ||
[window makeKeyAndVisible]; | ||
} | ||
|
||
|
||
- (void)dealloc { | ||
[viewController release]; | ||
[window release]; | ||
[super dealloc]; | ||
} | ||
|
||
|
||
@end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
#import <UIKit/UIKit.h> | ||
#import <AVFoundation/AVFoundation.h> | ||
#import <CoreAudio/CoreAudioTypes.h> | ||
|
||
@interface MicBlowViewController : UIViewController { | ||
AVAudioRecorder *recorder; | ||
NSTimer *levelTimer; | ||
double lowPassResults; | ||
} | ||
|
||
- (void)levelTimerCallback:(NSTimer *)timer; | ||
|
||
@end | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
#import "MicBlowViewController.h" | ||
|
||
@implementation MicBlowViewController | ||
|
||
- (void)viewDidLoad { | ||
[super viewDidLoad]; | ||
|
||
NSURL *url = [NSURL fileURLWithPath:@"/dev/null"]; | ||
|
||
NSDictionary *settings = [NSDictionary dictionaryWithObjectsAndKeys: | ||
[NSNumber numberWithFloat: 44100.0], AVSampleRateKey, | ||
[NSNumber numberWithInt: kAudioFormatAppleLossless], AVFormatIDKey, | ||
[NSNumber numberWithInt: 1], AVNumberOfChannelsKey, | ||
[NSNumber numberWithInt: AVAudioQualityMax], AVEncoderAudioQualityKey, | ||
nil]; | ||
|
||
NSError *error; | ||
|
||
recorder = [[AVAudioRecorder alloc] initWithURL:url settings:settings error:&error]; | ||
|
||
if (recorder) { | ||
[recorder prepareToRecord]; | ||
recorder.meteringEnabled = YES; | ||
[recorder record]; | ||
levelTimer = [NSTimer scheduledTimerWithTimeInterval: 0.03 target: self selector: @selector(levelTimerCallback:) userInfo: nil repeats: YES]; | ||
} else | ||
NSLog([error description]); | ||
} | ||
|
||
|
||
- (void)levelTimerCallback:(NSTimer *)timer { | ||
[recorder updateMeters]; | ||
|
||
const double ALPHA = 0.05; | ||
double peakPowerForChannel = pow(10, (0.05 * [recorder peakPowerForChannel:0])); | ||
lowPassResults = ALPHA * peakPowerForChannel + (1.0 - ALPHA) * lowPassResults; | ||
|
||
if (lowPassResults < 0.95) | ||
NSLog(@"Mic blow detected"); | ||
} | ||
|
||
|
||
- (void)dealloc { | ||
[levelTimer release]; | ||
[recorder release]; | ||
[super dealloc]; | ||
} | ||
|
||
@end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,218 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<archive type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="7.10"> | ||
<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> | ||
<object class="NSMutableArray" key="IBDocument.EditedObjectIDs"> | ||
<bool key="EncodedWithXMLCoder">YES</bool> | ||
<integer value="10"/> | ||
</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" id="0"> | ||
<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="841351856"> | ||
<string key="IBProxiedObjectIdentifier">IBFilesOwner</string> | ||
</object> | ||
<object class="IBProxyObject" id="427554174"> | ||
<string key="IBProxiedObjectIdentifier">IBFirstResponder</string> | ||
</object> | ||
<object class="IBUICustomObject" id="664661524"/> | ||
<object class="IBUIViewController" id="943309135"> | ||
<string key="IBUINibName">MicBlowViewController</string> | ||
<object class="IBUISimulatedStatusBarMetrics" key="IBUISimulatedStatusBarMetrics"/> | ||
</object> | ||
<object class="IBUIWindow" id="117978783"> | ||
<nil key="NSNextResponder"/> | ||
<int key="NSvFlags">292</int> | ||
<string key="NSFrameSize">{320, 480}</string> | ||
<object class="NSColor" key="IBUIBackgroundColor"> | ||
<int key="NSColorSpace">1</int> | ||
<bytes key="NSRGB">MSAxIDEAA</bytes> | ||
</object> | ||
<bool key="IBUIOpaque">NO</bool> | ||
<bool key="IBUIClearsContextBeforeDrawing">NO</bool> | ||
<object class="IBUISimulatedStatusBarMetrics" key="IBUISimulatedStatusBarMetrics"/> | ||
</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">delegate</string> | ||
<reference key="source" ref="841351856"/> | ||
<reference key="destination" ref="664661524"/> | ||
</object> | ||
<int key="connectionID">4</int> | ||
</object> | ||
<object class="IBConnectionRecord"> | ||
<object class="IBCocoaTouchOutletConnection" key="connection"> | ||
<string key="label">viewController</string> | ||
<reference key="source" ref="664661524"/> | ||
<reference key="destination" ref="943309135"/> | ||
</object> | ||
<int key="connectionID">11</int> | ||
</object> | ||
<object class="IBConnectionRecord"> | ||
<object class="IBCocoaTouchOutletConnection" key="connection"> | ||
<string key="label">window</string> | ||
<reference key="source" ref="664661524"/> | ||
<reference key="destination" ref="117978783"/> | ||
</object> | ||
<int key="connectionID">14</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"/> | ||
<reference key="children" ref="1000"/> | ||
<nil key="parent"/> | ||
</object> | ||
<object class="IBObjectRecord"> | ||
<int key="objectID">-1</int> | ||
<reference key="object" ref="841351856"/> | ||
<reference key="parent" ref="0"/> | ||
<string key="objectName">File's Owner</string> | ||
</object> | ||
<object class="IBObjectRecord"> | ||
<int key="objectID">3</int> | ||
<reference key="object" ref="664661524"/> | ||
<reference key="parent" ref="0"/> | ||
<string key="objectName">MicBlow App Delegate</string> | ||
</object> | ||
<object class="IBObjectRecord"> | ||
<int key="objectID">-2</int> | ||
<reference key="object" ref="427554174"/> | ||
<reference key="parent" ref="0"/> | ||
</object> | ||
<object class="IBObjectRecord"> | ||
<int key="objectID">10</int> | ||
<reference key="object" ref="943309135"/> | ||
<reference key="parent" ref="0"/> | ||
</object> | ||
<object class="IBObjectRecord"> | ||
<int key="objectID">12</int> | ||
<reference key="object" ref="117978783"/> | ||
<reference key="parent" ref="0"/> | ||
</object> | ||
</object> | ||
</object> | ||
<object class="NSMutableDictionary" key="flattenedProperties"> | ||
<bool key="EncodedWithXMLCoder">YES</bool> | ||
<object class="NSArray" key="dict.sortedKeys"> | ||
<bool key="EncodedWithXMLCoder">YES</bool> | ||
<string>-1.CustomClassName</string> | ||
<string>-2.CustomClassName</string> | ||
<string>10.CustomClassName</string> | ||
<string>10.IBEditorWindowLastContentRect</string> | ||
<string>10.IBPluginDependency</string> | ||
<string>12.IBEditorWindowLastContentRect</string> | ||
<string>12.IBPluginDependency</string> | ||
<string>3.CustomClassName</string> | ||
<string>3.IBPluginDependency</string> | ||
</object> | ||
<object class="NSMutableArray" key="dict.values"> | ||
<bool key="EncodedWithXMLCoder">YES</bool> | ||
<string>UIApplication</string> | ||
<string>UIResponder</string> | ||
<string>MicBlowViewController</string> | ||
<string>{{512, 351}, {320, 480}}</string> | ||
<string>com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string> | ||
<string>{{525, 346}, {320, 480}}</string> | ||
<string>com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string> | ||
<string>MicBlowAppDelegate</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="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="NSMutableArray" key="dict.values"> | ||
<bool key="EncodedWithXMLCoder">YES</bool> | ||
</object> | ||
</object> | ||
<nil key="sourceID"/> | ||
<int key="maxID">14</int> | ||
</object> | ||
<object class="IBClassDescriber" key="IBDocument.Classes"> | ||
<object class="NSMutableArray" key="referencedPartialClassDescriptions"> | ||
<bool key="EncodedWithXMLCoder">YES</bool> | ||
<object class="IBPartialClassDescription"> | ||
<string key="className">MicBlowAppDelegate</string> | ||
<string key="superclassName">NSObject</string> | ||
<object class="NSMutableDictionary" key="outlets"> | ||
<bool key="EncodedWithXMLCoder">YES</bool> | ||
<object class="NSArray" key="dict.sortedKeys"> | ||
<bool key="EncodedWithXMLCoder">YES</bool> | ||
<string>viewController</string> | ||
<string>window</string> | ||
</object> | ||
<object class="NSMutableArray" key="dict.values"> | ||
<bool key="EncodedWithXMLCoder">YES</bool> | ||
<string>MicBlowViewController</string> | ||
<string>UIWindow</string> | ||
</object> | ||
</object> | ||
<object class="IBClassDescriptionSource" key="sourceIdentifier"> | ||
<string key="majorKey">IBProjectSource</string> | ||
<string key="minorKey">Classes/MicBlowAppDelegate.h</string> | ||
</object> | ||
</object> | ||
<object class="IBPartialClassDescription"> | ||
<string key="className">MicBlowAppDelegate</string> | ||
<string key="superclassName">NSObject</string> | ||
<object class="IBClassDescriptionSource" key="sourceIdentifier"> | ||
<string key="majorKey">IBUserSource</string> | ||
<string key="minorKey"/> | ||
</object> | ||
</object> | ||
<object class="IBPartialClassDescription"> | ||
<string key="className">MicBlowViewController</string> | ||
<string key="superclassName">UIViewController</string> | ||
<object class="IBClassDescriptionSource" key="sourceIdentifier"> | ||
<string key="majorKey">IBProjectSource</string> | ||
<string key="minorKey">Classes/MicBlowViewController.h</string> | ||
</object> | ||
</object> | ||
</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">MicBlow.xcodeproj</string> | ||
<int key="IBDocument.defaultPropertyAccessControl">3</int> | ||
</data> | ||
</archive> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
<?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>English</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.yourcompany.${PRODUCT_NAME:rfc1034identifier}</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> | ||
<key>LSRequiresIPhoneOS</key> | ||
<true/> | ||
<key>NSMainNibFile</key> | ||
<string>MainWindow</string> | ||
</dict> | ||
</plist> |
Oops, something went wrong.