Instance Method

peakPower(forChannel:)

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

Declaration

func peakPower(forChannel channelNumber: Int) -> Float

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.

See Also

Using Audio Level Metering

var isMeteringEnabled: Bool

A Boolean value that specifies the audio-level metering on/off state for the audio player.

func averagePower(forChannel: Int) -> Float

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

func updateMeters()

Refreshes the average and peak power values for all channels of an audio player.