113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
|
VAR(stereo, 0, 1, 1);
static void
updatechanvol(int chan, const OFVector3D *loc)
{
int vol = soundvol, pan = 255 / 2;
if (loc) {
vdist(dist, v, *loc, player1.o);
vol -= (int)(dist * 3 * soundvol /
255); // simple mono distance attenuation
if (stereo && (v.x != 0 || v.y != 0)) {
// relative angle of sound along X-Y axis
float yaw =
-atan2(v.x, v.y) - player1.yaw * (PI / 180.0f);
// range is from 0 (left) to 255 (right)
|
|
|
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
|
VAR(stereo, 0, 1, 1);
static void
updatechanvol(int chan, const OFVector3D *loc)
{
int vol = soundvol, pan = 255 / 2;
if (loc) {
vdist(dist, v, *loc, player1.origin);
vol -= (int)(dist * 3 * soundvol /
255); // simple mono distance attenuation
if (stereo && (v.x != 0 || v.y != 0)) {
// relative angle of sound along X-Y axis
float yaw =
-atan2(v.x, v.y) - player1.yaw * (PI / 180.0f);
// range is from 0 (left) to 255 (right)
|