InetReceiveSound Example for Visual Basic

Dim bInit As Boolean

Private Sub LEADNet1_InetReceiveSound (ByVal iComputer As Integer, ByVal iFormatTag As
Integer, ByVal nChannels As Integer, ByVal lSamplesPerSec As Long, ByVal lAvgBytesPerSec
As Long, ByVal iBlockAlign As Integer, ByVal iBitsPerSample As Integer, ByVal
iExtraDataSize As Integer, ByVal pExtraData As Variant, ByVal pData As Variant, ByVal
lDataSize As Long)
   ' this example uses the LEAD Capture Module for sound playback

   If Not bInit Then
      LEADCap1.CapWaveFormatTag(CAP_AUDIO_FEED) = iFormatTag
      LEADCap1.CapWaveChannels(CAP_AUDIO_FEED) = nChannels
      LEADCap1.CapWaveSamplesPerSec(CAP_AUDIO_FEED) = lSamplesPerSec
      LEADCap1.CapWaveAvgBytesPerSec(CAP_AUDIO_FEED) = lAvgBytesPerSec
      LEADCap1.CapWaveBlockAlign(CAP_AUDIO_FEED) = iBlockAlign
      LEADCap1.CapWaveBitsPerSample(CAP_AUDIO_FEED) = iBitsPerSample
      LEADCap1.CapWaveExtraData(CAP_AUDIO_FEED) = pExtraData
      LEADCap1.CapWaveExtraSize(CAP_AUDIO_FEED) = iExtraDataSize
      ' initialize feed sound process
      LEADCap1.CapStartFeedSound " c:\capture.wav", 0, 2, CAP_FEED_SAVEDATA, hSound
      bInit = True
   Else
      LEADCap1.CapFeedSound hSound, pData, lDataSize
   End If

   ' when finished playing sound LEADCap1.CapStopFeedSound should be called, a good
   ' place to do it would be in the InetDisconnected event
End Sub