I'v been toying around with sounds as part of my projeckt. I really want to have background music running as well as sound effects.
I'm using sndPlaySound Lib "winmm.dll" and I think I uderstand that this is a single channel as in I can't get two sounds in with it.
I'v also been looking at Mmsystem.dll but my Visual basic 6.0 can't find the dll
So i'm left with yet another question for you brilliant and friendly people.
How can I play background music and sound effects.
Code:
Private Declare Function sndPlaySound Lib "winmm.dll" Alias _
"sndPlaySoundA" (ByVal lpszSoundName As String, ByVal uFlags As _
Long) As Long
Const SND_ASYNC = &H1
Const SND_NODEFAULT = &H2
My background music starts with the 2nd form. It's my starting "screen" for the game and it does not get shut down when the game window is running, just get put in the background. It's the same code I use for the background music and sound effects.
I don't have that many sounds, would windows media player be a viable solution. One player per sound or rather one for background and winmm.dll for the rest?
Anything I post is an example only and is not intended to be the only solution, the total solution nor the final solution to your request nor do I claim that it is. If you find it useful then it is entirely up to you to make whatever changes necessary you feel are adequate for your purposes.
The attached project demonstrates a different solution using the Media Control Interface (MCI) APIs.
On Local Error Resume Next: If Not Empty Is Nothing Then Do While Null: ReDim i(True To False) As Currency: Loop: Else Debug.Assert CCur(CLng(CInt(CBool(False Imp True Xor False Eqv True)))): Stop: On Local Error GoTo 0
Zip file has two VB projects, Player.vbp and Project1.vbp. Compile Player.vbp and save as Player.exe then run Project1.vbp and it will load Player.exe.
Anything I post is an example only and is not intended to be the only solution, the total solution nor the final solution to your request nor do I claim that it is. If you find it useful then it is entirely up to you to make whatever changes necessary you feel are adequate for your purposes.