JNGL
Easy to use cross-platform 2D game library
|
Sound loaded from an OGG file. More...
#include <jngl/SoundFile.hpp>
Public Member Functions | |
SoundFile (const std::string &filename, std::launch policy=std::launch::async) | |
Load an OGG file called filename. More... | |
SoundFile (const SoundFile &)=delete | |
SoundFile & | operator= (const SoundFile &)=delete |
SoundFile (SoundFile &&) noexcept | |
SoundFile & | operator= (SoundFile &&) noexcept |
void | play () |
Play the sound once. If called twice the sound would also play twice. | |
void | play (Channel &) |
void | stop () |
Stop the last started sound. | |
void | stop (Channel &) |
bool | isPlaying () |
Whether the sound is still playing at least once. | |
void | loop () |
Play the sound in a loop. Can also be stopped using stop() | |
void | loop (Channel &) |
void | setVolume (float v) |
Set volume in [0, ∞]. Default is 1.0f. | |
void | load () |
Block until the sound file has been fully decompressed and loaded. More... | |
Sound loaded from an OGG file.
JNGL keeps a list of loaded sound files, so there's no need for you to use this class directly - you can just use jngl::play.
Definition at line 29 of file SoundFile.hpp.
|
explicit |
Load an OGG file called filename.
Loading can either happen on its own thread (std::launch::async) or the first time you try to play the file (std::launch::deferred).
void load | ( | ) |
Block until the sound file has been fully decompressed and loaded.
std::runtime_error | File not found or decoding errors |