Coordinates of 3-D Space

The position, velocity, and orientation of sound sources and listeners in 3-D space are represented by Cartesian coordinates, which are values on three axes: the x-axis, the y-axis, and the z-axis. The axes are relative to a viewpoint established by the application. Values on the x-axis increase from left to right, on the y-axis from down to up, and on the z-axis from near to far.

Left-handed Cartesian coordinates

Microsoft DirectSound uses the left-handed coordinate system shown. If you point the fingers of your left hand in the positive x direction and curl them into the positive y direction, your thumb will point in the positive z direction.

Conventionally, vectors are expressed as three values enclosed in parentheses and separated by commas, in the order (x, y, z). In DirectSound, coordinates of position, velocity, or orientation on the three axes are described in a Vector3 structure.

For position, the values are in meters by default. If your application does not use the meter as its unit of measure for 3-D graphics, you can set a distance factor, which is a floating-point value representing meters per application-specified distance unit. For example, if your application uses the foot as the distance unit, it could specify a distance factor of 0.3048, which is the number of meters in a foot. For more information, see Distance Factor.

For velocity, the vector describes the rate of movement along each axis in units per second. Again, the default unit is meters, but this can be changed by the application.

For orientation, the values are in arbitrary units and are relative to one another. If the base view of the 3-D world is facing north, level to the ground, and the orientation of the listener is (1, 0, 0)-that is, positive on the x-axis and neutral on the other two axes-then the listener is facing due east. If the vector is (1, 0, 1), the listener's orientation is to the northeast. If it is (-1, 0, 1), the listener is facing northwest. Because the values within a vector are not in absolute units, the last example could equally well be expressed in many other ways, such as (-5, 0, 5) or (-0.25, 0, 0.25).

You can see how vectors in 2-D space work by drawing them on a sheet of graph paper. Let the values increase from the bottom of the paper to the top and from left to right. A line drawn from (0, 0) to (1, 1) has the same orientation, or direction, as one drawn from (0, 0), to (5, 5). However, the second line indicates a greater distance, or velocity. 3-D vectors work in just the same way, with an additional axis.