Sound files
Sound files
Sound files
Sound files
Sound files
Sound files Sound files Sound files Sound files Sound files Sound files Sound files Sound files
Sound files Sound files
Sound files
Go Back  Xtreme Visual Basic Talk > > > Sound files


Reply
 
Thread Tools Display Modes
  #1  
Old 01-17-2010, 11:39 PM
Gruberik Gruberik is offline
Newcomer
 
Join Date: Mar 2009
Posts: 5
Default Sound files


Hello,

I am very new to programming and have a question with sound files. I am trying to figure out the basics and here is what I did: I created a button that is supposed to play a sound.

My.Computer.Audio.Play("C:\.......file.wav")

When I click this button in my .exe file it obviously plays because I am using the computer with the above location for the .wav file. When I use the .exe on another computer it doesn't play because it does not recognize that .wav location.

How do I make this work for me? Do I need to embed the .wav with my .exe somehow?

Thanks much.
Reply With Quote
  #2  
Old 01-18-2010, 10:05 AM
Iceplug's Avatar
IceplugSound files Iceplug is offline
MetaCenturion

Retired Moderator
* Guru *
 
Join Date: Aug 2001
Location: Iowa, USA
Posts: 16,583
Default

  1. Place the .wav file in the same folder as your .exe file
  2. Realize that Application.StartupPath returns the path to your executable.
  3. Reference the .wav file using Application.StartupPath for the path instead of "C:\Users\Iceplug\Wave Folder"
e.g.
Filename = Application.StartupPath & "\some.wav"
__________________

Iceplug, USN
Quadrill 1 Quadrill 2 (full) Quadrill 3 JumpCross .NET Website is ALIVE! - DL Platform Tour for VB.NET! Posting Guidelines Hint: Specify your location in your user cp profile if you want compassion!
Reply With Quote
  #3  
Old 01-18-2010, 11:06 AM
Gruberik Gruberik is offline
Newcomer
 
Join Date: Mar 2009
Posts: 5
Default

I got it to work! I feel like such a noob because of how simple it was but I am just happy it works now. Thanks so much!

Last edited by Gruberik; 01-18-2010 at 11:41 AM.
Reply With Quote
  #4  
Old 01-18-2010, 01:36 PM
snarfblam's Avatar
snarfblamSound files snarfblam is offline
Senior Contributor

Forum Leader
* Expert *
 
Join Date: Apr 2005
Location: USA
Posts: 896
Default

Quote:
Originally Posted by Iceplug View Post
Filename = Application.StartupPath & "\some.wav"
I believe that you meant to write:
Filename = Path.Comine(Application.StartupPath, "some.wav")
Reply With Quote
  #5  
Old 01-18-2010, 07:38 PM
Iceplug's Avatar
IceplugSound files Iceplug is offline
MetaCenturion

Retired Moderator
* Guru *
 
Join Date: Aug 2001
Location: Iowa, USA
Posts: 16,583
Default

Yes, that would be the *correct* way to do it in all cases...
but, since the exe is usually in the bin folder and not in the root, I just write the traditional solution of Application.StartupPath & "\file.wav"... .

However, I think that you meant to write
Filename = Path.Combine(Application.StartupPath, "some.wav")
__________________

Iceplug, USN
Quadrill 1 Quadrill 2 (full) Quadrill 3 JumpCross .NET Website is ALIVE! - DL Platform Tour for VB.NET! Posting Guidelines Hint: Specify your location in your user cp profile if you want compassion!
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump

Advertisement:





Free Publications
The ASP.NET 2.0 Anthology
101 Essential Tips, Tricks & Hacks - Free 156 Page Preview. Learn the most practical features and best approaches for ASP.NET.
subscribe
Programmers Heaven C# School Book -Free 338 Page eBook
The Programmers Heaven C# School book covers the .NET framework and the C# language.
subscribe
Build Your Own ASP.NET 3.5 Web Site Using C# & VB, 3rd Edition - Free 219 Page Preview!
This comprehensive step-by-step guide will help get your database-driven ASP.NET web site up and running in no time..
subscribe
Sound files
Sound files
Sound files Sound files
Sound files
Sound files
Sound files Sound files Sound files Sound files Sound files Sound files Sound files
Sound files
Sound files
 
Sound files
Sound files
 
-->