473,385 Members | 2,210 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Multiple sound effects in VB6

mrnn
29
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?
Oct 12 '07 #1
4 4470
Ali Rizwan
925 512MB
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
Oct 15 '07 #2
mrnn
29
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?
Oct 15 '07 #3
Ali Rizwan
925 512MB
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
Oct 17 '07 #4
mrnn
29
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
Oct 22 '07 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

5
by: djc | last post by:
what choices do I have to play sounds in a program using vb.net? Or, I guess if nothing vb specific what windows API(s) should I look at? I am interested to find out whats needed for playing short...
77
by: berns | last post by:
Hi All, A coworker and I have been debating the 'correct' expectation of evaluation for the phrase a = b = c. Two different versions of GCC ended up compiling this as b = c; a = b and the other...
2
by: positivebalance41m | last post by:
I have been searching how to do sound capture (record audio input) in VB.NET for days now. I find some references to "winmm.dll" calls, but they give VB5 or VB6 examples which won't code convert...
10
by: Immortalist | last post by:
Various aquisition devices that guide learning along particular pathways towards human biases. And as E.O. Wilson might say mental development appears to be genetically constrained. (1) Language...
1
by: poo22 | last post by:
Please help, i've looked everywhere on the internet for the answer, but nothing works! here is my problem: I have a Pong game, and would like to have a background .wav file playing. I also have...
5
by: | last post by:
Hello, I am wrtting a program that does some sound effects... the files are stored in a subfolder in the application folder... and I check the existence of the files before calling the method to...
26
by: Jake Barnes | last post by:
I did a search on the newsgroup comp.lang.javascript. I was searching for "how to play a sound with Javascript". I'm somewhat suprised that the majority of entries are from the 1990s, and there are...
4
by: kid joe | last post by:
Hello I've got interested in learning some basic sound programming bits in C... mainly I want to know how to go about accessing the sound devices - reading from them mainly - in windows and...
4
by: themadme | last post by:
Is it possible to be able to produce real sound time effects, for example ( bullets hitting off different materials ). Has it already been done?
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.