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]);
}
и
[recorder updatemeters];
NSLog(@"%f",[recorder peakPowerForChannel:0]);
микрофон обнаруживает первые найденные (я думаю), потому что при каждом новом запуске отображаемое значение отличается, но при одном и том же запуске значение не меняется вообще