CSFML 3.0.0
Loading...
Searching...
No Matches
Classes | Functions
Listener.h File Reference
`#include <CSFML/Audio/Export.h>`
`#include <CSFML/System/Vector3.h>`

Go to the source code of this file.

## Classes
struct | sfListenerCone
| Structure defining the properties of a directional cone. More...

## Functions
void | sfListener_setGlobalVolume (float volume)
| Change the global volume of all the sounds and musics.
float | sfListener_getGlobalVolume (void)
| Get the current value of the global volume.
void | sfListener_setPosition (sfVector3f position)
| Set the position of the listener in the scene.
sfVector3f | sfListener_getPosition (void)
| Get the current position of the listener in the scene.
void | sfListener_setDirection (sfVector3f direction)
| Set the orientation of the forward vector in the scene.
sfVector3f | sfListener_getDirection (void)
| Get the current forward vector of the listener in the scene.
void | sfListener_setVelocity (sfVector3f velocity)
| Set the velocity of the listener in the scene.
sfVector3f | sfListener_getVelocity (void)
| Get the current forward vector of the listener in the scene.
void | sfListener_setCone (sfListenerCone cone)
| Set the cone properties of the listener in the audio scene.
sfListenerCone | sfListener_getCone (void)
| Get the cone properties of the listener in the audio scene.
void | sfListener_setUpVector (sfVector3f upVector)
| Set the upward vector of the listener in the scene.
sfVector3f | sfListener_getUpVector (void)
| Get the current upward vector of the listener in the scene.

## Function Documentation

## ◆ sfListener_getCone()

sfListenerCone sfListener_getCone | ( | void |  | ) |

Get the cone properties of the listener in the audio scene.

Returns
  Cone properties of the listener

## ◆ sfListener_getDirection()

sfVector3f sfListener_getDirection | ( | void |  | ) |

Get the current forward vector of the listener in the scene.

Returns
  Listener's forward vector (not normalized)

## ◆ sfListener_getGlobalVolume()

float sfListener_getGlobalVolume | ( | void |  | ) |

Get the current value of the global volume.

Returns
  Current global volume, in the range [0, 100]

## ◆ sfListener_getPosition()

sfVector3f sfListener_getPosition | ( | void |  | ) |

Get the current position of the listener in the scene.

Returns
  The listener's position

## ◆ sfListener_getUpVector()

sfVector3f sfListener_getUpVector | ( | void |  | ) |

Get the current upward vector of the listener in the scene.

Returns
  Listener's upward vector (not normalized)

## ◆ sfListener_getVelocity()

sfVector3f sfListener_getVelocity | ( | void |  | ) |

Get the current forward vector of the listener in the scene.

Returns
  Listener's velocity

## ◆ sfListener_setCone()

void sfListener_setCone | ( | sfListenerCone | cone | ) |

Set the cone properties of the listener in the audio scene.

The cone defines how directional attenuation is applied. The default cone of a sound is (2 * PI, 2 * PI, 1).

Parameters

  cone | Cone properties of the listener in the scene

## ◆ sfListener_setDirection()

void sfListener_setDirection | ( | sfVector3f | direction | ) |

Set the orientation of the forward vector in the scene.

The direction (also called "at vector") is the vector pointing forward from the listener's perspective. Together with the up vector, it defines the 3D orientation of the listener in the scene. The direction vector doesn't have to be normalized. The default listener's direction is (0, 0, -1).

Parameters

  direction | New listener's direction

## ◆ sfListener_setGlobalVolume()

void sfListener_setGlobalVolume | ( | float | volume | ) |

Change the global volume of all the sounds and musics.

The volume is a number between 0 and 100; it is combined with the individual volume of each sound / music. The default value for the volume is 100 (maximum).

Parameters

  volume | New global volume, in the range [0, 100]

## ◆ sfListener_setPosition()

void sfListener_setPosition | ( | sfVector3f | position | ) |

Set the position of the listener in the scene.

The default listener's position is (0, 0, 0).

Parameters

  position | New position of the listener

## ◆ sfListener_setUpVector()

void sfListener_setUpVector | ( | sfVector3f | upVector | ) |

Set the upward vector of the listener in the scene.

The up vector is the vector that points upward from the listener's perspective. Together with the direction, it defines the 3D orientation of the listener in the scene. The up vector doesn't have to be normalized. The default listener's up vector is (0, 1, 0). It is usually not necessary to change it, especially in 2D scenarios.

Parameters

  upVector | New listener's up vector

## ◆ sfListener_setVelocity()

void sfListener_setVelocity | ( | sfVector3f | velocity | ) |

Set the velocity of the listener in the scene.

The default listener's velocity is (0, 0, -1).

Parameters

  velocity | New listener's velocity