Trivia Game Sound Help
Trivia Game Sound Help
Trivia Game Sound Help
Trivia Game Sound Help
Trivia Game Sound Help
Trivia Game Sound Help Trivia Game Sound Help Trivia Game Sound Help Trivia Game Sound Help Trivia Game Sound Help Trivia Game Sound Help Trivia Game Sound Help Trivia Game Sound Help
Trivia Game Sound Help Trivia Game Sound Help
Trivia Game Sound Help
Go Back  Xtreme Visual Basic Talk > > > Trivia Game Sound Help


Reply
 
Thread Tools Display Modes
  #1  
Old 01-13-2004, 09:03 PM
Helpless Helpless is offline
Regular
 
Join Date: Oct 2003
Location: Ontario, Canada
Posts: 94
Default Trivia Game Sound Help


Hi, I'm making a trivia game. I have a sound file that plays, but it only lasts 2 or so minutes. Once it is down, how do I get it to start playing again by itself. Im using Microsoft Multimedia somethingn or other.

Thanks!
Reply With Quote
  #2  
Old 01-14-2004, 05:08 PM
Iceplug's Avatar
IceplugTrivia Game Sound Help Iceplug is offline
MetaCenturion

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

*sigh*
PlaySound API.
Code:
Declare Function PlaySound Lib "winmm.dll" _ (ByVal lpszName As String, ByVal hModule As Long, ByVal dwFlags As Long) As Long Private Const SND_ASYNC = &H1 ' play asynchronously Private Const SND_FILENAME = &H20000 ' name is a file name Private Const SND_LOOP = &H8 Private Sub Form_Load() PlaySound App.Path & "\test.wav", 0, SND_FILENAME Or SND_ASYNC Or SND_LOOP End Sub
__________________

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-14-2004, 05:12 PM
Helpless Helpless is offline
Regular
 
Join Date: Oct 2003
Location: Ontario, Canada
Posts: 94
Default

ahh! its playing sound when i startred the game, but vb froze. where am i supposed to put the first part?
__________________
Posting Guidelines
Reply With Quote
  #4  
Old 01-14-2004, 05:16 PM
Iceplug's Avatar
IceplugTrivia Game Sound Help Iceplug is offline
MetaCenturion

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

Can you escape by pressing Ctrl+Break? Did the form show? Or is this some other kind of error?
__________________

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
  #5  
Old 01-14-2004, 05:17 PM
Helpless Helpless is offline
Regular
 
Join Date: Oct 2003
Location: Ontario, Canada
Posts: 94
Default

no error, just music, and no form either. I already ctrl alt deleted it. but where do i put the stuff
__________________
Posting Guidelines
Reply With Quote
  #6  
Old 01-14-2004, 05:22 PM
Iceplug's Avatar
IceplugTrivia Game Sound Help Iceplug is offline
MetaCenturion

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

Where did you put it? Did you remember to add Option Explicit? Because the most probable thing that is happening is that there are no values for those 3 constants and PlaySound is playing the file synchronously with your program (that means you have to wait for the file to end before execution continues).
__________________

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
  #7  
Old 01-14-2004, 05:23 PM
Helpless Helpless is offline
Regular
 
Join Date: Oct 2003
Location: Ontario, Canada
Posts: 94
Default

i put
Code:
Declare Function PlaySound Lib "winmm.dll" _ (ByVal lpszName As String, ByVal hModule As Long, ByVal dwFlags As Long) As Long Private Const SND_ASYNC = &H1 ' play asynchronously Private Const SND_FILENAME = &H20000 ' name is a file name Private Const SND_LOOP = &H8

in my module and the other thing in my first form under formload

btw how do I make the form load and the song start so I dont have to wait 3 min?
__________________
Posting Guidelines

Last edited by Helpless; 01-14-2004 at 05:36 PM.
Reply With Quote
  #8  
Old 01-14-2004, 05:42 PM
Iceplug's Avatar
IceplugTrivia Game Sound Help Iceplug is offline
MetaCenturion

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

Declare the Function and the Constants as Public.
Those private consts are only accessible in the module .
__________________

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
  #9  
Old 01-14-2004, 06:07 PM
Helpless Helpless is offline
Regular
 
Join Date: Oct 2003
Location: Ontario, Canada
Posts: 94
Default

ok, it works... but... when I close the program, the sound still runs until I close visual basic.
__________________
Posting Guidelines
Reply With Quote
  #10  
Old 01-14-2004, 07:05 PM
Iceplug's Avatar
IceplugTrivia Game Sound Help Iceplug is offline
MetaCenturion

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

Try calling PlaySound with the SND_PURGE flag.
Private Const SND_PURGE = &H40
__________________

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
  #11  
Old 01-14-2004, 08:06 PM
Helpless Helpless is offline
Regular
 
Join Date: Oct 2003
Location: Ontario, Canada
Posts: 94
Default

Ok, it's doing the same thing. What I did was same as before, only on my module I added
Code:
Public Const SND_PURGE = &H40
And then, on my form load, I put
Code:
PlaySound App.Path & "\Liberace - Alley Cat.wav", 0, SND_FILENAME _ Or SND_ASYNC Or SND_LOOP Or SND_PURGE
ugh lol
__________________
Posting Guidelines
Reply With Quote
  #12  
Old 01-14-2004, 08:28 PM
Iceplug's Avatar
IceplugTrivia Game Sound Help Iceplug is offline
MetaCenturion

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

The PlaySound call with SND_PURGE should be a separate call from the first one .
Call it in the Form_Unload event.
__________________

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
  #13  
Old 01-14-2004, 08:39 PM
Helpless Helpless is offline
Regular
 
Join Date: Oct 2003
Location: Ontario, Canada
Posts: 94
Default

how do I write the play sound procedure with the snd_purge in it, i tried a few ways none seem to work
__________________
Posting Guidelines
Reply With Quote
  #14  
Old 01-15-2004, 05:04 AM
Iceplug's Avatar
IceplugTrivia Game Sound Help Iceplug is offline
MetaCenturion

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

What did you try? The only thing you need in the third argument is SND_PURGE, no Ors.
__________________

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
  #15  
Old 01-15-2004, 08:05 AM
Helpless Helpless is offline
Regular
 
Join Date: Oct 2003
Location: Ontario, Canada
Posts: 94
Default

Quote:
Originally Posted by Iceplug
What did you try? The only thing you need in the third argument is SND_PURGE, no Ors.


I finally figured out what I was doing wrong. After I started my program, I closed it by pressing the stop button via VB. But, when I add a command button to the form, and I put the code on it:
Code:
Unload Me
When I started it again, I pushed the button to exit, and the music stopped. I just need to put another way of exiting the program.

Thanks for your help.
__________________
Posting Guidelines
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

Similar Threads
Thread Thread Starter Forum Replies Last Post
Adding Sound to Game Troubles Helpless Game Programming 1 10-15-2003 08:14 AM
Game Loop Tutorial Optikal Tutors' Corner 0 03-12-2003 11:19 PM
SolarQuest game project jsharbour Game Programming 53 01-10-2003 06:21 PM
Warbirds 1944: Complete WinAPI/DirectX Game jsharbour Game Programming 21 09-10-2002 06:42 PM

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
Trivia Game Sound Help
Trivia Game Sound Help
Trivia Game Sound Help Trivia Game Sound Help
Trivia Game Sound Help
Trivia Game Sound Help
Trivia Game Sound Help Trivia Game Sound Help Trivia Game Sound Help Trivia Game Sound Help Trivia Game Sound Help Trivia Game Sound Help Trivia Game Sound Help
Trivia Game Sound Help
Trivia Game Sound Help
 
Trivia Game Sound Help
Trivia Game Sound Help
 
-->