Avfoundation recording levels

MBS users… has anybody tried to get the input levels for recording using AVfoundation?

This was relatively easy in Quicktime: qtrack=new QTGrabberMBS qtrack.InitGrabber qtrack.InitSound qtrack.prepare qtrack.StartPreview qtrack.AudioVolume=0 qtrack.SetAudioInputParameters 16,2,"raw " qtrack.AudioInputRate=44100 qtrack.SoundLevelMeterEnabled=true

and then in a timer

n=qtrack.GetSoundLevelMeterValue

I can’t work out how to get this going with AVfoundation… it looks like the command parameters, but there must be an order you put them in…
Any ideas?