This manager handles music and sound by listening to game events.
This manager should also support 3D sounds by changing pitch, panning and volume properly, depending on where the camera currently is.
Calculating panning
Here is speudo code to calculate the panning value of each audio effect:
vec3 side = cross(listener.up, listener.look_at);
side.normalize();
float x = dot(source.position - listener.position, side);
// You can now use this value to determine the pan, e.g. by using a linear mapping:
float pan = clamp(x / max_pan_distance, -1, 1);
This manager handles music and sound by listening to game events.
This manager should also support 3D sounds by changing pitch, panning and volume properly, depending on where the camera currently is.
Calculating panning
Here is speudo code to calculate the panning value of each audio effect: