オーディオ再生 - xDeviceAudioPlayback

Define_Com Class(#xDeviceAudioPlayback) Name(#AudioPlayback)

Evtroutine Handling(#COM_OWNER.Initialize)
  #Play.Enabled := false
  #Stop.Enabled := false
Endroutine

Evtroutine Handling(#AudioPlayback.Initialize)
  #Play.Enabled := true
  #Stop.Enabled := true
Endroutine

Evtroutine Handling(#Play.Click)
  #AudioPlayback.File := 'MyVoice'
  #AudioPlayback.Play()
Endroutine

Evtroutine Handling(#Stop.Click)
  #AudioPlayback.Stop
Endroutine

Evtroutine Handling(#AudioPlayback.Started) Status(#lstatus)
  If (#lstatus = 'OK')
    #Status := 'Playback started'
  Else
    #Status := 'Error starting playback:' + #lstatus
  Endif
Endroutine

Evtroutine Handling(#AudioPlayback.Stopped) Status(#lstatus)
  If (#lstatus = OK)
    #Status := 'Playback stopped'
  Else
    #Status := 'Error stopping playback:' + #lstatus
  Endif
Endroutine

Evtroutine Handling(#AudioPlayback.Completed) Status(#lstatus)
  If (#lstatus = OK)
    #Status := 'Playback completed'
  Else
    #Status := 'Playback completed with error:' + #lstatus
  Endif
Endroutine