Sub Class_Globals
Private Root As B4XView
Private xui As XUI
Private recorder As AudioRecorder
Private recording As Boolean
End Sub
Public Sub Initialize
End Sub
'This event will be called once, before the page becomes visible.
Private Sub B4XPage_Created (Root1 As B4XView)
Root = Root1
Root.LoadLayout("MainPage")
recorder.Initialize(xui.DefaultFolder, "1.mp4", 44100, False, 8, True)
recorder.As(NativeObject).SetField("meteringEnabled", True)
End Sub
Private Sub Button1_Click
recorder.Record
recording = True
Dim nRecorder As NativeObject = recorder
Do While recording
nRecorder.RunMethod("updateMeters", Null)
Sleep(50)
If recording Then
Log(nRecorder.RunMethod("averagePowerForChannel:", Array(0)).AsNumber)
End If
Loop
End Sub
Private Sub Button2_Click
recording = False
recorder.Stop
End Sub