Control audio recording on mobile device. Audio file is saved in LMA's logical file system. Maximum audio length depends on the device storage space.
Properties
File
A string value indicates the fully qualified name of the file to record.
CompressionLevel
An integer from 1 to 5 that indicates the level of compression (1 is the lowest compression level, best quality, 5 is highest compression level, lowest quality). Default is 2.
Duration
An integer specifies the max recording duration in seconds. No limit when set to 0.
Methods
Record
Start recording.
Stop
Stop recording.
Events
Started
Triggered when recoding is started.
Parameters:
Name | Type | Description |
|---|---|---|
Status | Enum | See Status Code |
|
Completed
Triggered when audio recording is finished.
Parameters:
Name | Type | Description |
|---|---|---|
Status | Enum | See Status Code |
Message | String |
|
RecordFinished
Triggered when recoding has reached to duration limit.
Code Examples
Define_Com Class(#xDeviceAudioRecord) Name(#AudioRecord) Evtroutine Handling(#COM_OWNER.Initialize) #Record.Enabled := false #Stop.Enabled := false Endroutine Evtroutine Handling(#AudioRecord.Initialize) #Record.Enabled := true #Stop.Enabled := true Endroutine Evtroutine Handling(#Record.Click) #AudioRecord.File := 'MyVoice' #AudioRecord.SampleRate := 44100 #AudioRecord.Channels := 2 #AudioRecord.Record() Endroutine Evtroutine Handling(#AudioRecord.Started) Status(#lstatus) If (#lstatus = 'OK') #Status := 'Recording started' Else #Status := 'Error starting recording: ' + #lstatus Endif Endroutine Evtroutine Handling(#AudioRecord.Completed) Status(#lstatus) Case (#lstatus) When ('= OK') #Status := 'Recording finished' Otherwise #Status := 'Error with recording: ' + #lstatus Endcase Endroutine Evtroutine Handling(#Stop.Click) #AudioRecord.Stop Endroutine