how can i put background sound in program?

how can i put background sound into my VB program ? what is the source code for doing that ?

Comments

  • : how can i put background sound into my VB program ? what is the source code for doing that ?
    :
    Depends what type of sound you are wanting to play, but I'd check out using MCI stuff. See here:-

    http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vbcon98/html/vbconusingmultimediamcicontrol.asp

    Or here:-

    http://msdn.microsoft.com/library/default.asp?url=/library/en-us/multimed/htm/_win32_mci.asp?frame=true

    Jonathan

    ###
    for(74,117,115,116){$::a.=chr};(($_.='qwertyui')&&
    (tr/yuiqwert/her anot/))for($::b);for($::c){$_.=$^X;
    /(p.{2}l)/;$_=$1}$::b=~/(..)$/;print("$::a$::b $::c hack$1.");

  • : how can i put background sound into my VB program ? what is the source code for doing that ?
    :
    [blue] Hi
    U can play very easily an sound in ur VB program but first tell me what kind of format u r choosing to play.
    If the sound duration is small then u can use wav format which is very easily played by SndPlaySound API but if the duration is large then u will probably try to use MP3 due to its size.

    But first thing is the duration and hence the size of file.

    If Size doesnt matters choose wav and SndPlaySound. A perfect combination for beginners. Any comments regulars ?
    [/blue]
    [b]Regards
    Er. [blue]Gurpreet Singh [/blue](B.E [blue]Mech.)[/blue][/b]
    [hr]



  • [b][red]This message was edited by Jonathan at 2004-2-22 12:31:35[/red][/b][hr]
    : : how can i put background sound into my VB program ? what is the source code for doing that ?
    : :
    : [blue] Hi
    : U can play very easily an sound in ur VB program but first tell me what kind of format u r choosing to play.
    : If the sound duration is small then u can use wav format which is very easily played by SndPlaySound API but if the duration is large then u will probably try to use MP3 due to its size.
    :
    : But first thing is the duration and hence the size of file.
    :
    : If Size doesnt matters choose wav and SndPlaySound. A perfect combination for beginners. Any comments regulars ?
    : [/blue]
    Well, in fact size does matter. Especially when it comes to sndPlaySound, if I remember correctly. When you use this API, then entire wave file must be loaded into a memory buffer. So if it's a long wave file, it'll fail or just not work. Important thing is also to use the ASYNC flag so it really is background music. I think there is a flag to pass to make it loop too. I'll leave someone else to go dig into the MSDN and check that. :-)

    Jonathan

    ###
    for(74,117,115,116){$::a.=chr};(($_.='qwertyui')&&
    (tr/yuiqwert/her anot/))for($::b);for($::c){$_.=$^X;
    /(p.{2}l)/;$_=$1}$::b=~/(..)$/;print("$::a$::b $::c hack$1.");



  • : : how can i put background sound into my VB program ? what is the source code for doing that ?
    : :
    : Depends what type of sound you are wanting to play, but I'd check out using MCI stuff. See here:-
    :
    : http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vbcon98/html/vbconusingmultimediamcicontrol.asp
    :
    : Or here:-
    :
    : http://msdn.microsoft.com/library/default.asp?url=/library/en-us/multimed/htm/_win32_mci.asp?frame=true
    :
    : Jonathan
    :
    : ###
    : Thanks, Jonathan. I'll explore that info you gave me.


  • : : how can i put background sound into my VB program ? what is the source code for doing that ?
    : :
    : [blue] Hi
    : U can play very easily an sound in ur VB program but first tell me what kind of format u r choosing to play.
    : If the sound duration is small then u can use wav format which is very easily played by SndPlaySound API but if the duration is large then u will probably try to use MP3 due to its size.
    :
    : But first thing is the duration and hence the size of file.
    :
    : If Size doesnt matters choose wav and SndPlaySound. A perfect combination for beginners. Any comments regulars ?
    .
    I want to play wave and MP3. When I use the SndPLaySound command in my VB 6, I get an error message that says the function is not defined. You say I need to use API? How do I do that? (and thanks for your above reply)

  • : I want to play wave and MP3. When I use the SndPLaySound command in my VB 6, I get an error message that says the function is not defined.

    [blue] Well the only reason for that error is that u had not defined the SndPlaySound.
    Now I assume that u dont know how to do that. Its very simple.

    [code]
    Goto Addins -> Add In Manager
    This will open an Add In manager Window.
    Then Double click to VB API Viewer and make sure that a loaded
    message appear in right of it.

    Click ok.

    Now again Goto Addins Now u will see API viewer as one of its tab. press it.

    Now this API viewer contains the declaration of many API's
    we use and also values of constants.
    But first U have to load the text or database file of API declarations.
    Goto file menu and click on add textfile or database (databse is faster to load).

    Now type sndplaysound in the text box or u can browse in the window below.

    Now click on the private checkbox on ur right side.
    This is important because U cant declare public definations in ur vb forms.

    Now just press add and then Insert.
    And the declaration of that api will be added to ur vb form
    And u will not get a function defination error.

    [/code]

    But u will still get an error if u play MP3 with it
    because SndPlaySound API plays only wave and midi files.

    And I have deveoped an application for a person like U a
    week ago which u can use to put background sound of any kind
    ie wav,mp3,wma and so on to ur project using embedded Windows Media Player in ur form.

    But I am afraid Microsoft doesnt allows redistribution
    of its WMP so if u want to have a private kind of software
    which will not be redistributed to general public. U can have my code for free.
    Give ur contact info and i will send u the zipped code(its only 11 kbs)
    right now.

    Any other doubts Pls be free to ask

    [/blue]




    [b]Regards
    Er. [blue]Gurpreet Singh [/blue](B.E [blue]Mech.)[/blue][/b]
    [hr]



  • : Now this API viewer contains the declaration of many API's

    VB6's API Viewer is quite obviously far better than VB5's... No private/public checkbox in VB5, no textbox to type in...
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories