Results 1 to 9 of 9

Thread: Asynchronous sounds...

  1. #1

    Thread Starter
    Fanatic Member tim_l_012's Avatar
    Join Date
    Mar 2001
    Location
    Next to a Coffee Cup.
    Posts
    641

    Unhappy Asynchronous sounds...

    I am using the following code:

    Code:
    Private Declare Function PlaySound Lib "winmm.dll" Alias "PlaySoundA" (ByVal lpszName As String, ByVal hModule As Long, ByVal dwFlags As Long) As Long
    
    Const SND_ASYNC As Long = &H1
    
    Public Sub Command1_Click()
    PlaySound "SystemExclamation", 0&, SND_ASYNC
    End Sub
    
    Public Sub Command2_Click()
    PlaySound "SystemExit", 0&, SND_ASYNC
    End Sub
    I can't get it to play the two sounds at the same time..
    I click command2, then I quickly click command1, and it stops 2 automatically....

    How can I get them both playing at the same time?

    Thanks,
    /: Tim :\____________________
    \: VB, HTML, ASP, VBScript, QBASIC, JavaScript :/

  2. #2
    jim mcnamara
    Guest
    They can't play at the same time because of device contention.
    Once a sound starts playing the thread playing it 'owns' the sound card, for instance.

  3. #3
    Your Ad Here! Edneeis's Avatar
    Join Date
    Feb 2000
    Location
    Moreno Valley, CA (SoCal)
    Posts
    7,339
    Well you can play multiple sounds at the same time, at least in different applications. I can be playing mp3s through winamp, test playing a sound from the sound thing in the control panel, and run the code you posted and have all three playing at the sametime.

    Of course I'm not sure how you do this in VB, maybe research on using DirectSound.

  4. #4

    Thread Starter
    Fanatic Member tim_l_012's Avatar
    Join Date
    Mar 2001
    Location
    Next to a Coffee Cup.
    Posts
    641
    well, I 'spose winamp is probably using DirectSound, but is there an easy way to add this to my app.

    It isn't extremely important, but I think it would make it sound better..

    BTW: Anyone got any links to free sound FX sites?

    Thanks,
    /: Tim :\____________________
    \: VB, HTML, ASP, VBScript, QBASIC, JavaScript :/

  5. #5

    Thread Starter
    Fanatic Member tim_l_012's Avatar
    Join Date
    Mar 2001
    Location
    Next to a Coffee Cup.
    Posts
    641
    I need car alarm arming & disarming sounds!!

    Help is good

    Thanks,
    /: Tim :\____________________
    \: VB, HTML, ASP, VBScript, QBASIC, JavaScript :/

  6. #6
    Your Ad Here! Edneeis's Avatar
    Join Date
    Feb 2000
    Location
    Moreno Valley, CA (SoCal)
    Posts
    7,339
    Can't help with the DirectSound issue although I'm sure a search on Google will come up with something, but as for a sounds site here is one:
    http://wavcentral.com/

  7. #7
    Hyperactive Member Animelion's Avatar
    Join Date
    Jan 2001
    Location
    Jacksonville NC
    Posts
    283

    Sounds

    Here are the sounds, they work great for a password protected program. I use them sometimes
    Attached Files Attached Files
    ~ Animelion

  8. #8
    Frenzied Member KayJay's Avatar
    Join Date
    Jul 2001
    Location
    Chennai
    Posts
    1,849
    To have two or more different sounds play at the same time, the most effective, though not the most efficient, way is to load two or more instances of the Windows Media Player control, and play the sound files.

    If the souds you are playing are just System Feedback sounds, system overhead in using two to four MPlayer controls should not be an issue.

  9. #9

    Thread Starter
    Fanatic Member tim_l_012's Avatar
    Join Date
    Mar 2001
    Location
    Next to a Coffee Cup.
    Posts
    641
    thanks for the site!

    (just looking through it for my sounds!)

    anyone else got car alarm (arming & dis-arming) sounds??

    I need them for my app!!

    Also, how can I send a file (errlog.txt) to my email ([email protected]) through vb?

    My friend suggests shelling a VB Script file, but I'm not sure what he meant by that. Anyway hes gone away for a few days, and I would like to know more on the issue.


    Thanks for all your help so far,
    /: Tim :\____________________
    \: VB, HTML, ASP, VBScript, QBASIC, JavaScript :/

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