2011-01-31 18 views
1
bool b; 
NSLog(@"url"); 
NSURL *url = [NSURL fileURLWithPath:@"/dev/null"]; 
NSLog(@"dizionario"); 
NSDictionary *audioSettings = [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:audioSettings error:&error]; 
NSLog(@"audio"); 
if (recorder) { 
[recorder prepareToRecord]; 
recorder.meteringEnabled = YES; 
b=[recorder record]; 
} else { 
NSLog(@"ERRORE:"); 
NSLog([error description]); 
} 

IOS AVAudioRecorderのupdatemetersは、シミュレータ上で動作

[recorder updatemeters]; 
NSLog(@"%f",[recorder peakPowerForChannel:0]); 

マイクが見つかりましたモミを(私は思う)を検出し、すべての新しい実行表示される値は異なりますが、同じであるため値を実行しても全く変化しない アイデア?

答えて

1

が見つかりました。 with audioSession = [[AVAudioSession sharedInstance] retain]; [audioSession setCategory:AVAudioSessionCategoryRecordエラー:nil]; [audioSession setActive:はいエラー:nil];

関連する問題