Files
QtGameMaker/help/files/406_03_3d.html
T

87 lines
3.7 KiB
HTML

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>3D Sound</title>
<link href="style.css" rel="stylesheet" type="text/css">
</head>
<body background="images/back.gif">
<!--START-->
<h3>3D sound</h3>
<i><b>This functionality is only available in the Pro Edition of Game Maker.</b></i>
<p>
3D sounds refers to sound that has a position (and velocity) with respect to the listener.
Although its most prominent use is in 3D games you can also effectively use it in 2D games.
The idea is that a sound has a position in space.
In all functions the listener is assumed to be at position (0,0,0). The system
calculates how the listener would hear the sound and adapt it accordingly. The effect is
especially good when you have a good speaker system but is already works on small speakers.
<p>
Besides a position, the sound can also has a velocity. This leads to well-known
doppler effects which are correctly modelled. Finally the sound can have an
orientation and, again, the sound is adapted accordingly.
<p>
<i>Game Maker</i> supports 3D sound options through the functions below.
They only work for sound resources that were indicated to be 3D. (The disadvantage is that
3D sounds will be mono, not stereo.)
<p>
<blockquote>
<tt><b>sound_3d_set_sound_position(snd,x,y,z)</b></tt>
Sets the position of the indicated sound with respect to
the listener to the indicated position in space.
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. The values are measured in meters. The volume
with which the sound is heard depends on this measure in the same way as in
the real world.<br>
<tt><b>sound_3d_set_sound_velocity(snd,x,y,z)</b></tt>
Sets the velocity of the indicated sound to the indicated vector in space.
Please note that setting the velocity does not mean that the position changes.
The velocity is only used for calculating doppler effects. So if you want to move
the sound you must yourself change the position of the sound.<br>
<tt><b>sound_3d_set_sound_distance(snd,mindist,maxdist)</b></tt>
Sets the minimum distance at which the sound does no longer increase in
loudness and the maximum distance at which the sound can no longer be heard.
So when the distance lies between 0 and the minimum distance the sound
is at maximal amplitude. When between the minimal distance and the maximal
distance the amplitude slowly decreases until either the maximal distance
is reached or the sound is anyway no longer audible. Default the minimum
distance is 1 meter and the maximal distance is 1 billion meters.<br>
<tt><b>sound_3d_set_sound_cone(snd,x,y,z,anglein,angleout,voloutside)</b></tt>
Normally sound has the same amplitude at a given distance in all directions.
You can set the sound cone to change this and make sound directional. x,y,z specify
the direction of the sound cone. <tt>anglein</tt> specifies the inside angle. If
the listener is inside this angle it hears the sound at its normal volume. <tt>angleout</tt>
specifies the outside angle. When the listener is outside this the volume is indicated
with <tt>voloutside</tt>. To be precise, <tt>voloutside</tt> is a negative number
that indicates the number of hundreds of decibel that must be subtracted from the
inside volume. Between the inside and outside angle the volume gradually decreases.<br>
</blockquote>
<!--END-->
</body>
</html>
<!-- KEYWORDS
3d sounds
sound position
sound distance
sound direction
directional sound
doppler effect
sound_3d_set_sound_position()
sound_3d_set_sound_velocity()
sound_3d_set_sound_distance()
sound_3d_set_sound_cone()
-->