AudioQueue.CurrentLevelMeterDB Property
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Current Level meters, one per channel in decibels.
public AudioToolbox.AudioQueueLevelMeterState[] CurrentLevelMeterDB { get; }
member this.CurrentLevelMeterDB : 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 CurrentLevelMeter if you want to get the values normalized to the range zero (minimum) to one (maximum).
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);
}
}
}