Playing Sounds in VBasic.net.

CharlesW

New Member
Messages
9
Reaction score
0
Points
0
I'm designing a simple sidescrolling game using Visual Basic.net. However, I can't find adequate instructions on playing sounds using this language. MSDN suggested something like "my.computer.audio.playsound(filepath as string)", but my compiler tells me there is no such method. I'm using 2003, if that's any help.

Also, how does one go about getting a license to distribute such a game?
 
Last edited:

Pi606

New Member
Messages
85
Reaction score
0
Points
0
I usually use C#, so I have tried to translate correctly. Excuse any obvious syntax errors. ;)

Code:
Imports Microsoft.DirectX.AudioVideoPlayback

Public Class PlayAudio
    Public Static Sub Play(String filename)
        Dim sound as Audio
        sound = New Audio(filename)
        sound.Play()
    End Sub
End Class

Note: You will need to make a reference to the library Microsoft.DirectX.AudioVideoPlayback in your project for this to work.

Usage: Just call PlayAudio.Play(PATH_TO_SOUND_FILE)

As for distributing, I have no idea.:dunno:
 

CharlesW

New Member
Messages
9
Reaction score
0
Points
0
Thanks, but I'm not sure DirectX will work with my application. I'm going to eventually port this to another language in order to run it on non-windows systems, so I'm trying to avoid getting too deep into DirectX.
 
Top