The most interesting part about sound effects is yet to come. An immersive atmosphere only builds up if sounds are properly located within the game world. Like graphical objects, sounds can have a position.
The coordinate system for sounds is three-dimensional. SFML's sound API works with the
sf::Vector3f type, a 3D vector with the members
z. SFML internally uses Open Audio Library (OpenAL), an interface for low-level audio functionality, which is also the origin of the sound spatialization concepts we are going to discuss here.
Spatializing sounds means nothing more than to locate them in the 3D space, that is, to give them a spatial representation.
The audition of spatial sound effects depends on the listener. ...