-
Sound problem
Declare Function sndPlaySound Lib "winmm.dll" Alias _
"sndPlaySoundA" (ByVal lpszSoundName As String, ByVal _
uFlags As Long) As Long
Declare Function sndPlaySoundB Lib "winmm.dll" Alias _
"sndPlaySoundA" (ByVal lpszSoundName As String, ByVal _
uFlags As Long) As Long
I make declariations for two different sounds like this, then I play one sound:
Call sndPlaySound(App.Path & "\sound.wav", &H1 Or &H8)
Then later on in the game I play a different sound the same way except not looping, and the first sound interupts and no longer loops. How can I play two sounds at once. I have one sound that is looping and one sound that does not, it only plays sometimes. Please Help!
Thanks.
-
Use DirectX's DirectSound.
-
Machaira or anyone,
Could you help with code on "how" not on "what" to use to achive this. Others probably would like this answer also. Could you please post your DirectSound code?
Thanks
-
-
The reason for this is SndPlaySound (now depricated apparently) can't mix waves. Before Win98 we had to use WaveMix.dll for this purpose, but it's easier and faster now to use DirectSound. So look at http://www.directx4vb.com/ in all of its horrible-new-layout glory, and go to the DirectX8 - DirectAudio section. You should find playing Wave files there-- and you can also, quite easily, play any media for which there is a codec for on the system (in other words, any media you can play in wmplayer).
-
Thanks, but I already know how to use DX. My game has to be in pure VB.
THanks anyways.
-
The sndPlaySound function isn't pure VB, it's an API call.
-
Use WaveOutOpen. Here's a C example (easily ported to VB).
http://www.borg.com/~jglatt/tech/lowaud.htm
-
Try Windows Media Player
I Found Out The Easiest Way To Play Sound, And Yet, you can do practically anything with it!
Just add the windows media player (msdxm.ocx)
To your components,
if you want to add many songs a once, just load and unload them while checking the duration with a timer.
Why do I use win. player?
Cuz its easy to lower & upper the volume,
Cuz you can ummm, lower & upper the volume,
and umm, I dont remember Why else I used it...
But there must be some reason......
Lol, I'll check that out immidiately... see y@