S
Scott H
I'm just starting to learn directaudio, and want to start off not with
playing a WAV, thats all too easy, I want to generate the waveform, so
to start off I'm trying to generate white noise, using the code below,
but its erroring with a "Index out of range" Exception on the line of
code inditcated:
Private DSdev As New Device
Private DSbuffer As SecondaryBuffer
Private IOstream As System.IO.MemoryStream
Now some code to make it happen:
DSdev.SetCooperativeLevel(Me.Handle, CooperativeLevel.Normal)
IOstream = New System.IO.MemoryStream(22000)
Dim x As Integer
For x = 1 To 20000
IOstream.WriteByte(Int(Rnd() * 254))
Next
DSbuffer = New SecondaryBuffer(IOstream, DSdev) '<<<< ERROR
If Not DSbuffer Is Nothing Then DSbuffer.Play(0,
BufferPlayFlags.Default)
playing a WAV, thats all too easy, I want to generate the waveform, so
to start off I'm trying to generate white noise, using the code below,
but its erroring with a "Index out of range" Exception on the line of
code inditcated:
Private DSdev As New Device
Private DSbuffer As SecondaryBuffer
Private IOstream As System.IO.MemoryStream
Now some code to make it happen:
DSdev.SetCooperativeLevel(Me.Handle, CooperativeLevel.Normal)
IOstream = New System.IO.MemoryStream(22000)
Dim x As Integer
For x = 1 To 20000
IOstream.WriteByte(Int(Rnd() * 254))
Next
DSbuffer = New SecondaryBuffer(IOstream, DSdev) '<<<< ERROR
If Not DSbuffer Is Nothing Then DSbuffer.Play(0,
BufferPlayFlags.Default)