Plutonium framework API 1.0.0
Easy-to-use, SDL2-based UI framework for Nintendo Switch homebrew
Loading...
Searching...
No Matches
audio_Sfx.hpp
Go to the documentation of this file.
1/**
2 * Plutonium library
3 * @file audio_Sfx.hpp
4 * @brief Sfx (sound effects) support
5 * @author XorTroll
6 * @copyright XorTroll
7 */
8
9#pragma once
10#include <SDL2/SDL_mixer.h>
11#include <pu/pu_Include.hpp>
12
13namespace pu::audio {
14
15 /**
16 * @brief Type representing a sound effect.
17 */
18 using Sfx = Mix_Chunk*;
19
20 /**
21 * @brief Loads a sound effect from the specified path.
22 * @note pu::audio::Initialize must be called before using this function.
23 * @note The sound effect must be manually freed with pu::audio::DestroySfx when it is no longer needed.
24 * @param path Path to the sound effect file.
25 * @return Sound effect loaded, or NULL if an error occurred.
26 */
27 Sfx LoadSfx(const std::string &path);
28
29 /**
30 * @brief Plays a sound effect.
31 * @note pu::audio::Initialize must be called before using this function.
32 * @param sfx Sound effect to play. If NULL is passed, nothing will happen.
33 */
34 void PlaySfx(Sfx sfx);
35
36 /**
37 * @brief Destroys a sound effect.
38 * @param sfx Sound effect to destroy. If NULL is passed, nothing will happen.
39 */
40 void DestroySfx(Sfx &sfx);
41
42}
void PlaySfx(Sfx sfx)
Plays a sound effect.
void DestroySfx(Sfx &sfx)
Destroys a sound effect.
Sfx LoadSfx(std::string &path)
Loads a sound effect from the specified path.
Definition audio_Audio.hpp:13