Multiple sound effects in VB6

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • mrnn
    New Member
    • Sep 2007
    • 29

    #1

    Multiple sound effects in VB6

    Hello, just one last issue i'd like to figure out for my game...i'm tryin to figure out how to play sound effects in the game. i know how to get background music but for sounds i'd like it somethin like this...

    Private Sub KeyDown(KeyCode as Integer)

    If KeyCode = (whatever it is for spacebar) Then
    Play Sound1 (or whatever)
    End If

    End Sub

    but as for the sounds multiple sounds have to be able to play at once, sometimes the same sound...maybe somethin like

    X = X + 1
    Load Sound1(X) 'so it makes a new control so if the one b4 is playing, it loads a new one so multiple sounds will play at once)
    Play Sound1(X)
    Unload Sound1(X)

    but could u help me out please? somethin that can play .wav files is preferred...and i've tried all i could think of (even Play Sound1) and even googled it and searched around for awhile but couldnt find what i wanted.

    ---NEW TOPIC (but short)--

    also i have a dumb transparent color problem on my imagelist, i want black to be my transparent color and i've set it to it (Use Maskcolor = True and all), even made sure the RGB values for black were the same in each the image and the imagelist control, yet the black is still not transparent, even searched articles on this site and tried what they said and it didnt work for me...

    so help please?...again ?
  • Ali Rizwan
    Banned
    Contributor
    • Aug 2007
    • 931

    #2
    Hello,
    This will help you to play sounds but the problem is that the sound files must be of .wav format and only 1 sound will be play at a time if second will play then the recently playing file will be stoped and the new will be played.

    Declaration

    Code:
    Private Declare Function sndPlaySound& Lib "winmm.dll" Alias _
        "sndPlaySoundA" (ByVal lpszSoundName As String, ByVal uFlags As Long)
     Const SND_SYNC = &H0
     Const SND_ASYNC = &H1
     Const SND_NODEFAULT = &H2
     Const SND_LOOP = &H8
     Const SND_NOSTOP = &H10
    Add this code for playing a sound once
    Code:
    sndPlaySound "File Path", SND_ASYNC Or SND_NODEFAULT
    Add this code for loop play
    Code:
    sndPlaySound "File Path", SND_ASYNC Or SND_NODEFAULT Or SND_LOOP
    GOOD LUCK
    ALI

    Comment

    • mrnn
      New Member
      • Sep 2007
      • 29

      #3
      Originally posted by Ali Rizwan
      Hello,
      This will help you to play sounds but the problem is that the sound files must be of .wav format and only 1 sound will be play at a time if second will play then the recently playing file will be stoped and the new will be played...
      Thanks Ali :) its not really too big of a deal that i can't play multiple sounds; sounds aren't really too important, just to add some more spice to the program

      ...so how about the transparency problem then? please?

      Comment

      • Ali Rizwan
        Banned
        Contributor
        • Aug 2007
        • 931

        #4
        Originally posted by mrnn
        Thanks Ali :) its not really too big of a deal that i can't play multiple sounds; sounds aren't really too important, just to add some more spice to the program

        ...so how about the transparency problem then? please?
        Hello,
        What type of transperency?
        Are you mean to set transperency to a form?
        Are you want to make Fade and transperency effects to your app?

        GoodLuck
        ALI

        Comment

        • mrnn
          New Member
          • Sep 2007
          • 29

          #5
          Originally posted by Ali Rizwan
          Hello,
          What type of transperency?
          Are you mean to set transperency to a form?
          Are you want to make Fade and transperency effects to your app?

          GoodLuck
          ALI
          nope, i don't...though that would be rather cool :)

          i just want to have pictures with a transparency so that i can have a moving background underneath the images...even when i use a PNG file with transparency all the area that should be transparent is made white in visual basic.

          i've looked around on here and seen things about the Use Mask Color in an ImageList Control but it doesn't work, the color i want to be the mask color is black, and the RGB values are both the same in the image and in the imagelist control, yet it still is not transparent :( ...and yes UseMaskColor is set to true

          also note my avatar, its the pic i want to have transparency... and the cockpit is a dark grey, not black, so that shouldn't be affected...just the black around the ship is what i'm trying to get transparent
          Last edited by mrnn; Oct 22 '07, 12:25 AM. Reason: New Avatar

          Comment

          Working...