How do I play a .wav file from Resources?

Please support our VB.NET advertiser: $4.95 a Month - ASP.NET Web Hosting – Click Here!
Thread Solved
Reply

Join Date: Mar 2006
Posts: 23
Reputation: furjaw is an unknown quantity at this point 
Solved Threads: 0
furjaw furjaw is offline Offline
Newbie Poster

How do I play a .wav file from Resources?

 
0
  #1
May 28th, 2006
Visual Basic 2005 Express Edition:

This works, but, I need to get the .wav file from Resources:
My.Computer.Audio.Play("C:\Documents and Settings\Owner\My Documents\Visual Studio 2005\Projects\OrthoLabRx\OrthoLabRx\Resources\PodVwBy.wav")

I placed the .wav file in Resources, but, I can't seem to access it from there.
This does not work:
My.Computer.Audio.Play(My.Resources.PodVwBy)
It says "value of type 'System.IO.UnmangedMemoryStream' cannot be converted to 'String'.

This worked, but, instead of a click, it played a grinding noise:
Dim sndPing As New SoundPlayer(My.Resources.PodVwBy)
sndPing.Play()
My.Computer.Audio.Play(My.Resources.PodVwBy)
Reply With Quote Quick reply to this message  
Join Date: Dec 2005
Posts: 7
Reputation: jacobi is an unknown quantity at this point 
Solved Threads: 1
jacobi jacobi is offline Offline
Newbie Poster

Re: How do I play a .wav file from Resources?

 
1
  #2
Jan 6th, 2009
Hi furjaw!
(1)Make sure your path is absolutely correct. It is very long!
(2)Have you not omitted the AudioPlayMode? After wav" add
,AudioPlayMode.Background or.BackgroundLoop or .WaitToComplete)
Reply With Quote Quick reply to this message  
Join Date: Mar 2006
Posts: 23
Reputation: furjaw is an unknown quantity at this point 
Solved Threads: 0
furjaw furjaw is offline Offline
Newbie Poster

Re: How do I play a .wav file from Resources?

 
0
  #3
Jan 6th, 2009
"WaitToComplete" did the trick!
Thanks!
Reply With Quote Quick reply to this message  
Reply

This thread has been marked solved.
Perhaps start a new thread instead?
Message:


Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC