Keyboard and Sound questions...

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

Keyboard and Sound questions...

Christopher J. Demers
During the development of the game mentioned in my previous post I came
across a few curiosities.

At first I tried using code like this to monitor the state of an arrow key
(there were no push buttons):
(Keyboard default isKeyDown: ##(Keyboard virtualKey: 'RIGHT'))
I did not get any errors, but it did not appear to work.  Did I do this
wrong, is there something I am missing?  I used a similar approach for
letter keys and they work fine.

I have some sound effects in my game.  I am loading a Sound from a wav file
and then using woof to play it.  The problem is that the sounds cut each
other off.  I would like the sounds to overlap.  Can that be done with
Sound, or do I have to use another API?  I guess I could use DirectSound if
I have to, but I was hoping to avoid that for now.

Chris


Reply | Threaded
Open this post in threaded view
|

Re: Keyboard and Sound questions...

Mark Wilden
"Christopher J. Demers" <[hidden email]> wrote in
message news:b9ppm0$m799v$[hidden email]...
>
> I have some sound effects in my game.  I am loading a Sound from a wav
file
> and then using woof to play it.  The problem is that the sounds cut each
> other off.

I was thinking of doing a woofAndWait in another thread...


Reply | Threaded
Open this post in threaded view
|

Re: Keyboard and Sound questions...

Andy Bower
In reply to this post by Christopher J. Demers
Chris,

> I have some sound effects in my game.  I am loading a Sound from a wav
file
> and then using woof to play it.  The problem is that the sounds cut each
> other off.  I would like the sounds to overlap.  Can that be done with
> Sound, or do I have to use another API?  I guess I could use DirectSound
if
> I have to, but I was hoping to avoid that for now.

I think you will have to use DirectSound. Actually, it's not as bad as is
sounds (my pun) since DirectSound is fairly easy. I have dug out the old
Dolphin 2.1 DirectX Kit and (wow) it still loads into D5. You can find it
at:

http://www.object-arts.co.uk/downloads/directx.zip

I have upgraded the packages to D5 format. Just load the Direct Sound
package, which will also pull in Direct X Base. Go to the package comment
and, with the current directory set to the DirectX directory (so the sound
files can be located) try running through the examples in the pacakge
comments. I'm not sure the added complexity of DirectSound is worth it for
your game (I liked the real simplicity) but as you see it's not that hard.

BTW, all the other DX packages load into D5 (there might be a few
compilation errors) but I haven't tried them to see if they work. If you
want to do so, you will have to remove the "Bouncing Balls" sample first
because there is a global name clash with Ball in one of the DX samples.

Good luck.

Best Regards,

Andy Bower
Dolphin Support
http://www.object-arts.com
---
Are you trying too hard?
http://www.object-arts.com/Relax.htm
---


Reply | Threaded
Open this post in threaded view
|

Re: Keyboard and Sound questions...

Andy Bower
Folks,

> BTW, all the other DX packages load into D5 (there might be a few
> compilation errors) but I haven't tried them to see if they work. If you
> want to do so, you will have to remove the "Bouncing Balls" sample first
> because there is a global name clash with Ball in one of the DX samples.

Actually, if you change the following method, you should find that all most
of the examples will work straight away. I didn't have much luck with the
DirectDraw samples but, then again, I didn't try very  hard. If you do mess
with them remember that Alt-F4 will close the example.

DirectX class>>queryMediaSearchPath
    "Private - Answer an ordered collection of directory Strings to be
searched
    when Actor3D media are loaded from files. By default this is just the
current directory
    and the media directory below it"

    ^Array with: '' with: 'media'

Better still change it to use a FileLocator.

Best Regards,

Andy Bower
Dolphin Support
http://www.object-arts.com
---
Are you trying too hard?
http://www.object-arts.com/Relax.htm
---