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]);
}
and
[recorder updatemeters];
NSLog(@"%f",[recorder peakPowerForChannel:0]);
the mic detects the firs found (i think) because every new runs the value displayed is different, but on the same run the value is not changing at all
any ideas?
found the solution. with audioSession = [[AVAudioSession sharedInstance] retain];
[audioSession setCategory:AVAudioSessionCategoryRecord error: nil];
[audioSession setActive:YES error: nil];