Connecting Tech Pros Worldwide Forums | Help | Site Map

Multiple sound effects in VB6

mrnn's Avatar
Newbie
 
Join Date: Sep 2007
Location: north of nowhere, USA
Posts: 29
#1: Oct 12 '07
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's Avatar
Banned
 
Join Date: Aug 2007
Location: Lahore Pakistan
Posts: 929
#2: Oct 15 '07

re: Multiple sound effects in VB6


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

Expand|Select|Wrap|Line Numbers
  1. Private Declare Function sndPlaySound& Lib "winmm.dll" Alias _
  2.     "sndPlaySoundA" (ByVal lpszSoundName As String, ByVal uFlags As Long)
  3.  Const SND_SYNC = &H0
  4.  Const SND_ASYNC = &H1
  5.  Const SND_NODEFAULT = &H2
  6.  Const SND_LOOP = &H8
  7.  Const SND_NOSTOP = &H10
Add this code for playing a sound once
Expand|Select|Wrap|Line Numbers
  1. sndPlaySound "File Path", SND_ASYNC Or SND_NODEFAULT
Add this code for loop play
Expand|Select|Wrap|Line Numbers
  1. sndPlaySound "File Path", SND_ASYNC Or SND_NODEFAULT Or SND_LOOP
GOOD LUCK
ALI
mrnn's Avatar
Newbie
 
Join Date: Sep 2007
Location: north of nowhere, USA
Posts: 29
#3: Oct 15 '07

re: Multiple sound effects in VB6


Quote:

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?
Ali Rizwan's Avatar
Banned
 
Join Date: Aug 2007
Location: Lahore Pakistan
Posts: 929
#4: Oct 17 '07

re: Multiple sound effects in VB6


Quote:

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
mrnn's Avatar
Newbie
 
Join Date: Sep 2007
Location: north of nowhere, USA
Posts: 29
#5: Oct 22 '07

re: Multiple sound effects in VB6


Quote:

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
Reply