オーディオ レコーディング - xDeviceAudioRecord

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