Playlist Generator  1.0
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Properties Defines
Playlist2/InputRecorder.mm
Go to the documentation of this file.
00001 //
00002 //  InputRecorder.m
00003 //  Playlist2
00004 //
00005 //  Created by Max Woolf on 25/11/2011.
00006 //  Copyright (c) 2011 __MyCompanyName__. All rights reserved.
00007 //
00008 
00009 #import "InputRecorder.h"
00010 
00011 
00012 #pragma mark - Initialisation
00013 @implementation InputRecorder
00014 -(id)initWithURL:(NSURL *)url settings:(NSDictionary *)settings error:(NSError *__autoreleasing *)outError
00015 {
00016     //Initialise object with forced settings.
00017     self = [super initWithURL:[self getFilePath] settings:[self getSettingsDictionary] error:outError];
00018     return self;
00019 }
00020 
00021 
00022 #pragma mark - Get Settings
00023 -(NSDictionary *)getSettingsDictionary
00024 {
00025     NSMutableDictionary *settings = [[NSMutableDictionary alloc] init];
00026     [settings setValue:[NSNumber numberWithInt:kAudioFormatLinearPCM] forKey:AVFormatIDKey];
00027     [settings setValue:[NSNumber numberWithFloat:11025.00] forKey:AVSampleRateKey];
00028     [settings setValue:[NSNumber numberWithInt: 2] forKey:AVNumberOfChannelsKey];
00029     [settings setValue:[NSNumber numberWithInt:32] forKey:AVLinearPCMBitDepthKey];
00030     return settings;
00031 }
00032 
00033 -(NSURL *)getFilePath
00034 {
00035     NSArray *dirPaths;
00036     NSString *docsDir;
00037     dirPaths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);    
00038     docsDir = [dirPaths objectAtIndex:0];
00039     NSString *soundFilePath = [docsDir stringByAppendingPathComponent:@"sound.wav"];
00040     NSURL *newURL = [[NSURL alloc] initFileURLWithPath:soundFilePath];
00041     return newURL;
00042 }
00043 @end