# audio::AudioManager

[More...](#detailed-description)

`#include <AudioManager.hpp>`

## Public Functions

|                         | Name                                                                                                                                                                                                                                                    |
| ----------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|                         | [**\~AudioManager**](https://github.com/TEAM-AAAAAAAAAAAAAAAA/RTYPE-TECHNICAL-DOCS/blob/main/Classes/Classes/classaudio_1_1_audio_manager.md#function-~audiomanager)() =default                                                                         |
| bool                    | <p><a href="https://github.com/TEAM-AAAAAAAAAAAAAAAA/RTYPE-TECHNICAL-DOCS/blob/main/Classes/Classes/classaudio_1_1_audio_manager.md#function-loadbgm"><strong>loadBGM</strong></a>(const std::string & key)<br>load a background music to be played</p> |
| bool                    | [**playBGM**](https://github.com/TEAM-AAAAAAAAAAAAAAAA/RTYPE-TECHNICAL-DOCS/blob/main/Classes/Classes/classaudio_1_1_audio_manager.md#function-playbgm)(bool loop =true)                                                                                |
| bool                    | [**stopBGM**](https://github.com/TEAM-AAAAAAAAAAAAAAAA/RTYPE-TECHNICAL-DOCS/blob/main/Classes/Classes/classaudio_1_1_audio_manager.md#function-stopbgm)()                                                                                               |
| bool                    | [**setBGMVolume**](https://github.com/TEAM-AAAAAAAAAAAAAAAA/RTYPE-TECHNICAL-DOCS/blob/main/Classes/Classes/classaudio_1_1_audio_manager.md#function-setbgmvolume)(float volume)                                                                         |
| float                   | [**getBGMVolume**](https://github.com/TEAM-AAAAAAAAAAAAAAAA/RTYPE-TECHNICAL-DOCS/blob/main/Classes/Classes/classaudio_1_1_audio_manager.md#function-getbgmvolume)()                                                                                     |
| sf::SoundSource::Status | [**getBGMStatus**](https://github.com/TEAM-AAAAAAAAAAAAAAAA/RTYPE-TECHNICAL-DOCS/blob/main/Classes/Classes/classaudio_1_1_audio_manager.md#function-getbgmstatus)()                                                                                     |
| void                    | [**loopBGM**](https://github.com/TEAM-AAAAAAAAAAAAAAAA/RTYPE-TECHNICAL-DOCS/blob/main/Classes/Classes/classaudio_1_1_audio_manager.md#function-loopbgm)(bool loop)                                                                                      |
| void                    | <p><a href="https://github.com/TEAM-AAAAAAAAAAAAAAAA/RTYPE-TECHNICAL-DOCS/blob/main/Classes/Classes/classaudio_1_1_audio_manager.md#function-loadsfx"><strong>loadSFX</strong></a>(const std::string & key)<br>load a sound effect to be played</p>     |
| void                    | [**playSFX**](https://github.com/TEAM-AAAAAAAAAAAAAAAA/RTYPE-TECHNICAL-DOCS/blob/main/Classes/Classes/classaudio_1_1_audio_manager.md#function-playsfx)(const std::string & key)                                                                        |
| void                    | [**setSFXVolume**](https://github.com/TEAM-AAAAAAAAAAAAAAAA/RTYPE-TECHNICAL-DOCS/blob/main/Classes/Classes/classaudio_1_1_audio_manager.md#function-setsfxvolume)(float volume)                                                                         |
| float                   | [**getSFXVolume**](https://github.com/TEAM-AAAAAAAAAAAAAAAA/RTYPE-TECHNICAL-DOCS/blob/main/Classes/Classes/classaudio_1_1_audio_manager.md#function-getsfxvolume)()                                                                                     |

## Detailed Description

```cpp
class audio::AudioManager;
```

This class manages all the sounds and musics of the game Basic operations on background musics and sound effects are supported

## Public Functions Documentation

### function \~AudioManager

```cpp
~AudioManager() =default
```

### function loadBGM

```cpp
static bool loadBGM(
    const std::string & key
)
```

load a background music to be played

**Parameters**:

* **key** the key relative to the AssetLoader

**Return**: true if the music was loaded

### function playBGM

```cpp
static bool playBGM(
    bool loop =true
)
```

**Parameters**:

* **loop** if the music should loop, defaulted to true
* **volume** the volume of the music, defaulted to 100

**Return**: true if the music is playing, false otherwise

play the current background music

### function stopBGM

```cpp
static bool stopBGM()
```

**Return**: true if the music is stopped, false otherwise

stop the current background music

### function setBGMVolume

```cpp
static bool setBGMVolume(
    float volume
)
```

**Parameters**:

* **volume0** = min, 100 = max

**Return**: true if the volume is set, false otherwise

Set the background music volume

### function getBGMVolume

```cpp
static float getBGMVolume()
```

### function getBGMStatus

```cpp
static sf::SoundSource::Status getBGMStatus()
```

### function loopBGM

```cpp
static void loopBGM(
    bool loop
)
```

**Parameters**:

* **loop** true to play in loop, false to play once

Set whether or not the stream should loop after reaching the end.

### function loadSFX

```cpp
static void loadSFX(
    const std::string & key
)
```

load a sound effect to be played

**Parameters**:

* **key** the key relative to the AssetLoader

**Warning**: Do not use, this is for development only

### function playSFX

```cpp
static void playSFX(
    const std::string & key
)
```

### function setSFXVolume

```cpp
static void setSFXVolume(
    float volume
)
```

**Parameters**:

* **volume0** = min, 100 = max

**Return**: true if the volume is set, false otherwise

Set the sound effects volume

### function getSFXVolume

```cpp
static float getSFXVolume()
```

***

Updated on 2022-11-13 at 17:21:37 +0100


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://cavonstavants-organization.gitbook.io/rtype-technical-documentation/index_classes/classaudio_1_1_audio_manager.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
