Sound
-
Does anyone know how to play ascyncronus sound in VB.Net? Im still getting used to the framework. I was going to thread my class, but im sure there is a better way. Any help would be aprciated. Pablo
-
Does anyone know how to play ascyncronus sound in VB.Net? Im still getting used to the framework. I was going to thread my class, but im sure there is a better way. Any help would be aprciated. Pablo
Your question is rather vague: which framework version? What type of sound? If you're using VB2005 and have a wav file then the easiest way is using the
my.computer.audio.play
reference. The official documentation explain it well (and it's really plain vanilla).' Usage
My.Computer.Audio.Play(location)
My.Computer.Audio.Play(location ,playMode)
My.Computer.Audio.Play(data ,playMode)
My.Computer.Audio.Play(stream ,playMode)
' Declaration
Public Sub Play( _
ByVal location As String _
)
' -or-
Public Sub Play( _
ByVal location As String, _
ByVal playMode As AudioPlayMode _
)
' -or-
Public Sub Play( _
ByVal data As Byte(), _
ByVal playMode As AudioPlayMode _
)
' -or-
Public Sub Play( _
ByVal stream As System.IO.Stream, _
ByVal playMode As AudioPlayMode _
) -
Your question is rather vague: which framework version? What type of sound? If you're using VB2005 and have a wav file then the easiest way is using the
my.computer.audio.play
reference. The official documentation explain it well (and it's really plain vanilla).' Usage
My.Computer.Audio.Play(location)
My.Computer.Audio.Play(location ,playMode)
My.Computer.Audio.Play(data ,playMode)
My.Computer.Audio.Play(stream ,playMode)
' Declaration
Public Sub Play( _
ByVal location As String _
)
' -or-
Public Sub Play( _
ByVal location As String, _
ByVal playMode As AudioPlayMode _
)
' -or-
Public Sub Play( _
ByVal data As Byte(), _
ByVal playMode As AudioPlayMode _
)
' -or-
Public Sub Play( _
ByVal stream As System.IO.Stream, _
ByVal playMode As AudioPlayMode _
)Thanks for the response. I figured it out. I had to import a dll that i wasnt importing. I'm using VB.Net 2003 For playing .wav files for now and latter i will be adding suport for other formats. Im going to write the sound manager in C# now though and just make a DLL from it. Thanks agaian Pablo