Sound Positioning Grid?

Started by elias4444, September 13, 2006, 22:31:09

Previous topic - Next topic

elias4444

I've been looking all over this, but haven't found an answer yet. With my current game, I'm really trying to add a professional polish all around, including the sound. I understand that openAL uses a grid like openGL (with the default origin at the center of the screen), but what scale does it use? Is 0,1 the top side of the screen and 0,-1 the bottomside? How does it determine distance? I'm guessing it doesn't change with resolution, since that's an openGL function. In previous games I've mostly just guessed and done what "sounded" right, but I'd like to know exactly how it works.
=-=-=-=-=-======-=-=-=-=-=-
http://www.tommytwisters.com

Sormuras

There is no spoon, and no grid. :)

The OpenAL listener object and source objects have attributes to describe their position, velocity and orientation in three dimensional space. OpenAL -- like OpenGL -- uses a right-handed Cartesian coordinate system (RHS), where in a frontal default view X (thumb) points right, Y (index finger) points up, and Z (middle finger) points towards the viewer/camera.

Now, you place your sound sources and the listener object in your world.

I usually use the coordinates from my game objects as they are, in world coordinates. That means, the listener is always inside my hero and needs to be updated when it moves, as every other sound emitter, too. Be sure, to make all AL source not relative, if you're using world coordinates.

The only thing that needs to be adjusted is the reference distance of each source. AL_REFERENCE_DISTANCE is the distance at which the listener will experience AL_GAIN, meaning your hero hears the sound at the current sources' gain level. Getting closer/staying inside that circle to/around the source, there'll be no difference in gain experience. Only spatial changes, which AL manages for you. Leaving the reference range will make the source go quiet. It all depends on the distance model you choose.

More here: http://openal.org/openal_webstf/specs/oal11spec_html/oal11spec3.html

Is your game 2D or 3D? How do you store the positions of your game objects?

Sor

elias4444

It's a 3D game.

I found the openAL manual and started reading like crazy too. I think a big part of my misunderstanding comes from not being able to set a lot of those things on my Mac - I was starting to think that it must be static or something. Hopefully we'll figure out soon why the Mac is having such a hard time with openAL. In the meantime, I've started doing my sound development on windows, where it seems to work just fine.
=-=-=-=-=-======-=-=-=-=-=-
http://www.tommytwisters.com