Results 1 to 19 of 19

Thread: Waves and Waves!

  1. #1

    Thread Starter
    Fanatic Member
    Join Date
    Feb 2000
    Location
    Israel
    Posts
    636

    Arrow

    Hi!

    I want to ask something:
    There is this function:
    Private Declare Function sndPlaySound Lib "winmm.dll" Alias "sndPlaySoundA" (ByVal lpszSoundName As String, ByVal uFlags As Long) As Long
    Right?
    Now, how can I: Play, Stop and Pause?
    Explain...

    Thank you,
    Arie.

  2. #2
    Good Ol' Platypus Sastraxi's Avatar
    Join Date
    Jan 2000
    Location
    Ontario, Canada
    Posts
    5,134
    Use SND_PURGE to stop, SND_SYNC or SND_ASYNC to play, and SND_??? to pause. (SND_??? isn't a varb.)
    All contents of the above post that aren't somebody elses are mine, not the property of some media corporation.
    (Just a heads-up)

  3. #3

    Thread Starter
    Fanatic Member
    Join Date
    Feb 2000
    Location
    Israel
    Posts
    636

    Wink Thank you!!

    Thanx...

  4. #4
    Guest
    Just a note. sndPlaySound has been upgraded by PlaySound.

  5. #5
    Good Ol' Platypus Sastraxi's Avatar
    Join Date
    Jan 2000
    Location
    Ontario, Canada
    Posts
    5,134
    Yeah, I heard 'bout that too. Is it any better (using DSOUND)
    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
    Fanatic Member
    Join Date
    Feb 2000
    Location
    Israel
    Posts
    636

    Talking

    Does anyone have a tutorial for sndPlaySound or DSOUND?

    Thank you,
    Arie.

  7. #7

    Thread Starter
    Fanatic Member
    Join Date
    Feb 2000
    Location
    Israel
    Posts
    636

    Wink Ok, I found it...

    But now...
    When I play a WAV file it slows the computer down.
    WHY?
    Maybe you FOX, do you know why?
    Help, Please...
    Arie.

  8. #8
    Guest

    Slow wave

    Make sure you only load the wav once(put it in you form_load). It should go allot faster(but it will take longer for your program to load).

  9. #9

    Thread Starter
    Fanatic Member
    Join Date
    Feb 2000
    Location
    Israel
    Posts
    636
    But...
    How do I run a WAV file.
    How do I load it?
    What do you mean???
    I am loading a WAV file like this:
    Dim SND as Long
    SND = sndPlaySound("C:\1.wav",&H0)

    What do you mean?

    Thank you,
    Arie.

  10. #10
    Guest
    Check out this tutorial:

    DirectSound:
    http://rookscape.com/vbgaming/tutP.php

    Put the following line of the tutorial somewhere in your form_load(after directsound is initialised):

    Set DSBuffer = ds.CreateSoundBufferFromFile(App.Path & "\WaveFile.WAV", DSBufferDescription, DSFormat)

  11. #11

    Thread Starter
    Fanatic Member
    Join Date
    Feb 2000
    Location
    Israel
    Posts
    636

    Thumbs up

    Thank you,
    Arie.

  12. #12
    Good Ol' Platypus Sastraxi's Avatar
    Join Date
    Jan 2000
    Location
    Ontario, Canada
    Posts
    5,134
    If using PlaySnd, use the LoadBuffer Function:

    Code:
    Function LoadBuffer(ByVal FileName as String) as String
    Dim SB as String
    Dim Data as String
    Dim f as Integer
    
       Data = Space$(1024)
    
       f = FreeFile
       Open FileName for Binary as f
          Do While Not EOF(f)
             Get #f, , Data
             SB = SB & Data
          Loop
       Close f
    
       LoadBuffer = Trim$(SB)
    
    End Function
    All contents of the above post that aren't somebody elses are mine, not the property of some media corporation.
    (Just a heads-up)

  13. #13
    transcendental analytic kedaman's Avatar
    Join Date
    Mar 2000
    Location
    0x002F2EA8
    Posts
    7,221
    how about this sas?
    Code:
    Function LoadBuffer(ByVal FileName as String) as String
       f = FreeFile
       Open FileName for Binary as f
         LoadBuffer = Space(lof(f))
         Get #f, , LoadBuffer
       Close f
    End Function

  14. #14
    Guest
    Originally posted by Sastraxi
    Yeah, I heard 'bout that too. Is it any better (using DSOUND)
    No, DirectSound is a lot better, but the downside is that it requires the type library, whereas PalySound doesn't. But then again, if you're using DirectX in your application anyways, this isn't a problem.

  15. #15
    Addicted Member Jorj's Avatar
    Join Date
    Jun 2000
    Posts
    167
    I had that code originally on a 486 with VB3, it gives you crashes if you do any more than 1k. I just had the time to put it on and not edit it for "fun".

    BTW. kedaman, do you know that your avatar is completely black?
    I am not a bowel.
    NON SVM BOVELLVS.
    Je ne suis pas des entrailles.
    Ich bin nicht ein Darm.
    No soy un intestino.
    Chan eil mi innigh.
    Ik ben niet een organenstelsel.
    Jeg er ikke en tarm.
    Jag är inte en tarm.
    Я не кишка.

    Can you say it in another language?
    If so, don't hesitate to tell me!

  16. #16
    Addicted Member Jorj's Avatar
    Join Date
    Jun 2000
    Posts
    167
    No, I mean by:

    (using DSOUND) - means that I am using DSOUND and haven't used the new PlaySnd before, so I wouldnt know if it's any bettert than sndPlaySnd. What are the differences between PlaySound and sndPlaySound?
    I am not a bowel.
    NON SVM BOVELLVS.
    Je ne suis pas des entrailles.
    Ich bin nicht ein Darm.
    No soy un intestino.
    Chan eil mi innigh.
    Ik ben niet een organenstelsel.
    Jeg er ikke en tarm.
    Jag är inte en tarm.
    Я не кишка.

    Can you say it in another language?
    If so, don't hesitate to tell me!

  17. #17
    Good Ol' Platypus Sastraxi's Avatar
    Join Date
    Jan 2000
    Location
    Ontario, Canada
    Posts
    5,134

    Whoops!

    Sorry, I'm on a friends computer so I was in their account.. that was actaully ME posting there...
    All contents of the above post that aren't somebody elses are mine, not the property of some media corporation.
    (Just a heads-up)

  18. #18
    Good Ol' Platypus Sastraxi's Avatar
    Join Date
    Jan 2000
    Location
    Ontario, Canada
    Posts
    5,134
    And posting the one before... silly me. *hits himself several times with his friend's english etymological dictionary*
    All contents of the above post that aren't somebody elses are mine, not the property of some media corporation.
    (Just a heads-up)

  19. #19

    Thread Starter
    Fanatic Member
    Join Date
    Feb 2000
    Location
    Israel
    Posts
    636

    Cool

    Ok... Ok.
    Thank you.
    I've already got to play many many WAV files.
    Thank you, All.
    If I'll have more questions, I'll come here...

    Arie.

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