2005-12-07 02:06:22

Hi,
I am trying to do something with DirectSound. I just can't get it to

work. So I got this sound. I am not using Direct Input yet but the form key

down event. I am making a simple program. So the sound starts I did that in

the Form Load section: DSIntro.Play DSBPLAY_DEFAULT. There's that sound,

but now i go to the key down, and what I want to do is when that sound is

done playing, you can press space and the next sound will play, i did get

that to work. The problem is I want after that sound, the second one,

finishes for you to be able to play a third sound. the problem is getting it

to wait til sound2 is done playing then sound3 to start. The other thing is

after Sound 3 plays, I wamt it to be able to press the space bar again, and

Sound 4 to play. Then, my last problem. I want it to loop a sound that pans

from left to right, and if you fire the laser gun with the control key while

its in the center you win.
Well, thats it, hope you can help.

Regards,
Mike
Co-Founder, RS Games
www.rsgames.org

2005-12-07 02:55:36

You

could try having a timer control with code that checks whether the sound is

finished. Don't know if it will work or not.

The timer control lets you

specify a number of milliseconds between 1 and 65,535 and perform an action

every interval of that size. 1000ms is 1 second, so you could have it check

every half second or something.

cx2
-----
To live by honour and to honour life, these are our greatest strengths and our best hopes.

2005-12-07 20:53:38

Myke,
Try the DirectX SDK. From your code it looks like you're using 8.1.

I believe you can grab a copy from bscgames.net under resources. There is a

way to  hault the program until a sound is done playing. I don't have the

specifics as it's been quite a while since I've dealt with DX 8 but what

you are looking for is this. Every sound buffer has a getStatus method. This

method returns a predefined constant (either playing, stopped, looping,

Etc.) You want to start the sound playing, then go into a loop that

terminates only when the getStatus for the buffer in question returns the

stopped constant (again you'll have to look it up in the SDK as I don't

have the specifics on the constants.)
HTH,
Munawar

2005-12-07 23:18:56

Yeah.

But What about when you press the space bar and the next sound plays, blah

blah press the space bar to continue, then how do i get it to play the next

sound? And what about getting it to pan automatically i.e. walking from left

to right and you have to fire at it tin the center?

Regards,
Mike
Co-Founder, RS Games
www.rsgames.org

2005-12-08 00:18:03

Using the getstatus method munawar mentioned in a while loop which

checks to see if the space bar has been pressed before ending should help. 

If you don't know what a while loop is check some basic vb tutorials - I

really don't know any specific sites but google should find loads for

you.

James

2005-12-08 19:13:02

Be

careful with loops. If you don't have some way of setting it at an interval

of so many milliseconds they can drain all the system resources they can get

their hands on. This can upset screen readers, and depending on how VB works

in this respect could even disrupt the sound they're checking the status

of.

cx2
-----
To live by honour and to honour life, these are our greatest strengths and our best hopes.

2005-12-08 20:07:12

hello

mike,

you are asking alot of questions,while I will answer some of them

here,I think it is better you add me to your msn if you want further

help,I'm willing to help anyone
so ok, to check whether a sound is

playing:
If mySound.getStatus = DSBSTATUS_PLAYING Then
' the sound is

currently playing
Else
the sound is not playing currently
end if
as for

panning an object acrosse the screen, that is more complicated,you have to

use the getPan method,but first of all,make sure that
the  desc flags are

set to DSBCAPS_CTRLPAN, then you should have a timer control,that pan's the

object acrosse the screen with the .get pan,.set pan method
hth
btw my msn

is
[email protected]
feell free to add me
regards
yakir

arbib