Here SoundFile
can be a BufferDescription
, but from the context I would guess that it is most likely here either a Stream
(could be FileStream, MemoryStream, etc) or a string
for the file path to the .wav file. See the various constructor overloads for SecondaryBuffer
.
The only other incomplete thing about the code you've posted is that it has scrapped the Sub arguments for the sake of brevity (it is a Click
handler so it needs the standard arguments). To make this work you would only need to do something like this :
Private Sub PlaySound(ByVal SoundFilePath as String)
Try
SoundDevice = New Microsoft.DirectX.DirectSound.Device
SoundDevice.SetCooperativeLevel(Me.Handle, _
Microsoft.DirectX.DirectSound.CooperativeLevel.Normal)
SbufferOriginal = New _ Microsoft.DirectX.DirectSound._
SecondaryBuffer(SoundFilePath, SoundDevice)
SbufferOriginal.Play(0, _
Microsoft.DirectX.DirectSound.BufferPlayFlags.Looping)
Catch ex As Exception
'do something for exception
End Try
End Sub
Where you would call it like
PlaySound("C:\MySounds\Foo.wav")
This should probably get you started. If you continue working through the tutorial you originally posted (where this code came from) and post back here with questions when you get stuck you should be able to work to a point where you can get the visualizations you are after. Most of what you need is in that tutorial.