Sub Globals
'These global variables will be redeclared each time the activity is created.
'These variables can only be accessed from this module.
Dim AudioSource As Int
Dim BufferSize As Int
Dim SampleRate() As Int
Dim AudioFormat() As Int
Dim ChannelConfig() As Int
Dim AudioFormats() As String
Dim ChannelConfigs() As String
Dim AR As AudioRecord
End Sub
Sub Activity_Create(FirstTime As Boolean)
'Do not forget to load the layout file created with the visual designer. For example:
'Activity.LoadLayout("Layout1")
AudioSource = AR.A_Src_Mic
SampleRate = Array As Int(8000, 11025, 22050, 44100)
ChannelConfig = Array As Int(AR.CH_CONF_MONO, AR.CH_CONF_STEREO)
ChannelConfigs = Array As String("CH_CONF_MONO", "CH_CONF_STEREO")
AudioFormat = Array As Int(AR.AF_PCM_8, AR.AF_PCM_16)
AudioFormats = Array As String("AF_PCM_8", "AF_PCM_16")
Dim i, ii, iii As Int
For i = 0 To SampleRate.Length - 1
For ii = 0 To ChannelConfig.Length - 1
For iii = 0 To AudioFormat.Length - 1
BufferSize = AR.GetMinBufferSize(SampleRate(i), ChannelConfig(ii), AudioFormat(iii))
If BufferSize <> AR.ERROR_BAD_VALUE Then
AR.Initialize(AudioSource, SampleRate(i), ChannelConfig(ii), AudioFormat(iii), BufferSize)
If AR.GetState = AR.STATE_INITIALIZED Then
Log(SampleRate(i) & ", " & ChannelConfigs(ii) & ", " & AudioFormats(iii))
'' AR.StartRecording
End If
End If
Next
Next
Next
'' If AR.GetState = AR.STATE_INITIALIZED Then
'' AR.Stop
'' AR.release
'' End If
End Sub