티스토리 뷰

my Programing/iPhone

peakPowerForChannel

Gandawon 2010. 1. 28. 13:32

http://developer.apple.com/iphone/library/documentation/AVFoundation/Reference/AVAudioPlayerClassReference/Reference/Reference.html#//apple_ref/occ/instm/AVAudioPlayer/peakPowerForChannel:


peakPowerForChannel:

Returns the peak power for a given channel, in decibels, for the sound being played.

- (float)peakPowerForChannel:(NSUInteger)channelNumber

Parameters
channelNumber

The audio channel whose peak power value you want to obtain. Channel numbers are zero-indexed. A monaural signal, or the left channel of a stereo signal, has channel number 0.

Return Value

A floating-point representation, in decibels, of a given audio channel’s current peak power. A return value of 0 dB indicates full scale, or maximum power; a return value of -160 dB indicates minimum power (that is, near silence).

If the signal provided to the audio player exceeds ±full scale, then the return value may exceed 0 (that is, it may enter the positive range).

Discussion

To obtain a current peak power value, you must call the updateMeters method before calling this method.

Availability
  • Available in iPhone OS 2.2 and later.
See Also
Declared In
AVAudioPlayer.h


   
#define XMAX	30.0f
[self.player updateMeters];
// updateMeters 를 호출해줘야 각각의 Power 값이 업데이트됨.
float avg = -1.0f * [self.player averagePowerForChannel:0];
float peak = -1.0f * [self.player peakPowerForChannel:0];
meter1.progress = (XMAX - avg) / XMAX;
meter2.progress = (XMAX - peak) / XMAX;

'my Programing > iPhone' 카테고리의 다른 글

iPhone SDK 구버젼 받기 ...  (0) 2010.07.03
drawSolidPoly  (0) 2010.01.27
UIAcceleration  (0) 2010.01.20
아이폰에 어플 올리기!! 성공!  (0) 2010.01.20
아이폰 개발자 등록없이 앱 올리기 ...펌  (0) 2010.01.18
댓글