2D positional sound using OpenAL.
More...
2D positional sound using OpenAL.
◆ fsSoundFree()
| void fsSoundFree |
( |
FsSound * | sound | ) |
|
Frees a loaded sound.
Frees the sample memory and resets the FsSound structure.
- Parameters
-
| sound | Pointer to the FsSound to free. |
◆ fsSoundListenerSetPosition()
| void fsSoundListenerSetPosition |
( |
FsVec2 | position | ) |
|
Sets the audio listener position.
Defines the position of the audio listener in 2D space. This position is used by the audio system to calculate positional sound effects such as attenuation and panning.
- Parameters
-
| position | Listener position in world space. |
- Note
- Internally maps the 2D position to OpenAL using Z = 0.
◆ fsSoundLoad()
| FsSound fsSoundLoad |
( |
const char * | filename | ) |
|
Loads a sound from file.
Loads a sound file using libsndfile and generates an OpenAL buffer.
- Parameters
-
| filename | Path to the audio file. |
- Returns
- FsSound structure containing audio data and buffer.
◆ fsSoundSourceCreate()
Creates a new sound source.
Initializes a FsSoundSource at a given position.
- Parameters
-
| position | 2D position of the source. |
| looping | Should the source loop when played. |
- Returns
- FsSoundSource initialized but not playing.
◆ fsSoundSourceFree()
Frees a sound source.
Stops playback and deletes the OpenAL source.
- Parameters
-
◆ fsSoundSourceHandle()
Updates multiple sound sources.
Handles playback state, looping, and stopping for an array of sources.
- Parameters
-
| count | Number of sources in the array. |
| sources | Array of FsSoundSource to handle. |
◆ fsSoundSourcePlay()
Plays a sound on a source.
Binds the sound to the source, sets volume, looping, and plays it.
- Parameters
-
| sound | Pointer to the loaded FsSound. |
| source | Pointer to the FsSoundSource. |
| volume | Volume in percentage (0–100). |
◆ fsSoundSourceStop()
Stops a sound source.
Stops playback if the source is currently playing.
- Parameters
-