Edit

Share via


AudioQueue.CurrentLevelMeter Property

Definition

Current Level meters, one per channel in the range zero (minimum) to one (maximum).

public AudioToolbox.AudioQueueLevelMeterState[] CurrentLevelMeter { get; }
member this.CurrentLevelMeter : AudioToolbox.AudioQueueLevelMeterState[]

Property Value

Array of level meters, one per audio channel.

Remarks

To use this property, make sure that you set the EnableLevelMetering property on the queue.

Use the CurrentLevelMeterDB if you want to get the values in decibels.

class MyInputQueue : InputAudioQueue {
    public MyQueueInput (AudioStreamBasicDescription desc) : base (desc) 
    {
    	inputQueue.EnableLevelMetering = true;
    }

    protected virtual void OnInputCompleted (IntPtr audioQueueBuffer, 
                                             AudioTimeStamp timeStamp, 
                                             AudioStreamPacketDescription [] packetData)
    {
        var levels = CurrentLevelMeterDB;
        for (int channel = 0; channel < levels.Count; channel.Length)
    	Console.WriteLine ("Channel {0} Average Power: {1} Peak Power: {2}", 
                               channel, levels [channel].AveragePower, levels [channel].PeakPower);
        }
    }
}

Applies to