2011-01-31 3 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

이 용액을 발견했다. 와 함께 audioSession = [[AVAudioSession sharedInstance] retain]; [audioSession setCategory : AVAudioSessionCategoryRecord 오류 : nil]; [audioSession setActive : 예 오류 : nil];

관련 문제