Results 1 to 2 of 2

Thread: [RESOLVED] Using Direct Sound

Threaded View

  1. #1

    Thread Starter
    Lively Member Brian M.'s Avatar
    Join Date
    Nov 2006
    Location
    Moberly MO
    Posts
    94

    Resolved [RESOLVED] Using Direct Sound

    Hello. I am trying to use direct sound to play a wav file, so I may animate a picture box while the wav file is playing. I have made a device object and a secondary buffer object and when I run the program I get an error message(see attached image), but after I click continue, the wav file plays and it plays every time I click the play wav button. I am using a test project to work out the bugs before I implement the direct sound in my other project. Below is the the code I am using. Can someone tell me what I am doing wrong? I would greatly appreciate it. The code needs a form named form1, and a button named xPlayButton.

    Code:
    Imports Microsoft.DirectX.DirectSound
    
    Public Class Form1
    
        Private Sub xPlayButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles xPlayButton.Click
    
            Dim sDevice As New Device
            sDevice.SetCooperativeLevel(Me, CooperativeLevel.Normal)
            Dim secBuffer As New SecondaryBuffer(My.Resources.b, My.Resources.b.Length, sDevice)
    
            secBuffer.Play(0, BufferPlayFlags.Default)
    
        End Sub
    
    End Class
    Attached Images Attached Images  

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width