Objective-C AVAudioRecorder SDK 3.0
July 6, 2009
AVAudioRecorder class is only available on OS3.0.
// Properties
@property (readonly) NSTimeInterval currentTime;
@property (assign) id <AVAudioRecorderDelegate> delegate;
@property (getter=isMeteringEnabled) BOOL meteringEnabled;
@property (readonly, getter=isRecording) BOOL recording;
@property (readonly) NSDictionary *settings;
@property (readonly) NSURL *url;
// Returns the average power for a given channel, in decibels, for the sound being recorded
- (float)averagePowerForChannel:(NSUInteger)channelNumber
// Deletes a recorded audio file
- (BOOL)deleteRecording
// Initializes and returns an audio recorder
- (id)initWithURL:(NSURL *)url settings:(NSDictionary *)settings error:(NSError **)outError
// Pauses a recording
- (void)pause
// Returns the peak power for a given channel, in decibels, for the sound being recorded
- (float)peakPowerForChannel:(NSUInteger)channelNumber
// Creates an audio file and prepares the system for recording
- (BOOL)prepareToRecord
// Starts or resumes recording
- (BOOL)record
// Records for a specified duration of time
- (BOOL)recordForDuration:(NSTimeInterval)duration
// Stops recording and closes the audio file
- (void)stop
// Refreshes the average and peak power values for all channels of an audio recorder
- (void)updateMeters
Audio Format Settings
NSString *const AVFormatIDKey;NSString *const AVSampleRateKey;NSString *const AVNumberOfChannelsKey;
AVFormatIDKeyA format identifier.
AVSampleRateKeyA sample rate, in hertz, expressed as an NSNumber floating point value.
AVNumberOfChannelsKeyThe number of channels expressed as an NSNumber integer value.
Linear PCM Format Settings
NSString *const AVLinearPCMBitDepthKey;NSString *const AVLinearPCMIsBigEndianKey;NSString *const AVLinearPCMIsFloatKey;AVLinearPCMBitDepthKeyAnNSNumberinteger that indicates the bit depth for a linear PCM audio format—one of 8, 16, 24, or 32.
AVLinearPCMIsBigEndianKeyA Boolean value that indicates whether the audio format is big endian (YES) or little endian (NO).
AVLinearPCMIsFloatKeyA Boolean value that indicates that the audio format is floating point (YES) or fixed point (NO).
Audio Encoder Settings
NSString *const AVEncoderAudioQualityKey;NSString *const AVEncoderBitRateKey;NSString *const AVEncoderBitDepthHintKey;
Sample Rate Conversion Settings
NSString *const AVSampleRateConverterAudioQualityKey;
Audio Quality Flags
Keys that specify sample rate conversion quality, used for theAVSampleRateConverterAudioQualityKeyproperty.enum { AVAudioQualityMin = 0, AVAudioQualityLow = 0x20, AVAudioQualityMedium = 0x40, AVAudioQualityHigh = 0x60, AVAudioQualityMax = 0x7F};typedef NSInteger AVAudioQuality;