DevMaster.net Forums
[[ Home | Forums | 3D Engines Database | Wiki | Articles/Tutorials | Game Dev Jobs | IRC Chat Network | Contact Us ]]

Go Back   DevMaster.net Forums > Programming & Development > Sound and Music Programming
User Name
Password
Register FAQ Members List Search Today's Posts Mark Forums Read

Reply
 
Thread Tools Search this Thread Display Modes
Old 04-27-2005, 09:50 PM   #1
Gatus
New Member
 
Join Date: Apr 2005
Posts: 4
Default

Hi, I happily got openAL working after reading the tutorials, however, there's one question that arose and that seems it was left wo. answer.

I have a fps camera and it moves when I press the up arrow key, I've a keydown checker (set to tell me which key is being pressed or released, in my main loop). How can I bind an openAL sound to it, so while it is pressed the sound plays but if released, it pauses?

Thanks.
Gatus is offline   Reply With Quote
Old 04-27-2005, 11:59 PM   #2
Reedbeta
DevMaster Staff
 
Join Date: Oct 2004
Location: Seattle, WA
Posts: 3,707
Default

I haven't used OpenAL myself, but I assume it gives you interfaces to stop and start sounds. Then you just need to keep a flag to indicate the state of the key last frame. Each frame, you can check: if the key was up last time, but down this time, start the sound. And if it was down last time but up this time, stop the sound. Then update the flag to hold the current state of the key.
___________________________________________
Currently working at Sucker Punch
reedbeta.com - OpenGL demos and other projects
Luabridge - a lightweight, dependency-free C++/Lua binding library.
CD Lite - an unobtrusive, minimal CD player application for Windows.
Reedbeta is offline   Reply With Quote
Old 04-28-2005, 09:56 AM   #3
Gatus
New Member
 
Join Date: Apr 2005
Posts: 4
Default

Thank you, that worked fine
Gatus is offline   Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Forum Jump


All times are GMT -7. The time now is 04:52 AM.


Powered by vBulletin
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.