Results 1 to 9 of 9

Thread: Sound problem

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Dec 2001
    Location
    Great White North, ey?
    Posts
    202

    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.

  2. #2
    Addicted Member
    Join Date
    Aug 2002
    Location
    Baltimore, MD
    Posts
    230
    Use DirectX's DirectSound.

  3. #3
    Hyperactive Member
    Join Date
    Jun 1999
    Location
    ma,usa
    Posts
    485
    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

  4. #4
    Addicted Member
    Join Date
    Aug 2002
    Location
    Baltimore, MD
    Posts
    230

  5. #5
    Good Ol' Platypus Sastraxi's Avatar
    Join Date
    Jan 2000
    Location
    Ontario, Canada
    Posts
    5,134
    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).
    All contents of the above post that aren't somebody elses are mine, not the property of some media corporation.
    (Just a heads-up)

  6. #6

    Thread Starter
    Addicted Member
    Join Date
    Dec 2001
    Location
    Great White North, ey?
    Posts
    202
    Thanks, but I already know how to use DX. My game has to be in pure VB.

    THanks anyways.

  7. #7
    Addicted Member
    Join Date
    Aug 2002
    Location
    Baltimore, MD
    Posts
    230
    The sndPlaySound function isn't pure VB, it's an API call.

  8. #8
    Good Ol' Platypus Sastraxi's Avatar
    Join Date
    Jan 2000
    Location
    Ontario, Canada
    Posts
    5,134
    Use WaveOutOpen. Here's a C example (easily ported to VB).
    http://www.borg.com/~jglatt/tech/lowaud.htm
    All contents of the above post that aren't somebody elses are mine, not the property of some media corporation.
    (Just a heads-up)

  9. #9
    Fanatic Member Ruku's Avatar
    Join Date
    Jul 2002
    Location
    Canada
    Posts
    655

    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@

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width