Sub Activity_Create(FirstTime As Boolean)
Activity.LoadLayout("Level")
cn.Initialize(Panel1)
'Calls sub AmplitudeCheck every 500 milliseconds
T.Initialize("AmplitudeCheck",100)
'Set up recorder
A.Initialize
A.AudioSource=A.AS_MIC
A.OutputFormat=A.OF_THREE_GPP
A.AudioEncoder=A.AE_AMR_NB
A.setOutputFile("","/dev/null")
A.prepare
A.start
T.Enabled=True
End Sub
Sub AmplitudeCheck_tick
'level=A.AudioMaxAmplitude/2700.0
level=A.AudioMaxAmplitude/44100
rec.Initialize(20,100,15+level*100,140)
cn.DrawColor(Colors.RGB(0,0,0))
cn.DrawRect(rec,Colors.Red,True,5dip)
Panel1.Invalidate
Label1.Text=level
End Sub