11#if defined(__has_include) && __has_include(<optional>)
15#include <experimental/optional>
84 std::shared_ptr<Sound> sound_;
85 std::shared_ptr<
std::vector<
float>> buffer;
An audio channel, different channels could be for example: "Music", "Speech" and "Sound Effects".
Sound loaded from an OGG file.
void play()
Play the sound once. If called twice the sound would also play twice.
SoundFile(const std::string &filename, std::launch policy=std::launch::async)
Load an OGG file called filename.
void load()
Block until the sound file has been fully decompressed and loaded.
bool isPlaying()
Whether the sound is still playing at least once.
void stop()
Stop the last started sound.
std::chrono::milliseconds length() const
Returns the duration in ms.
void setVolume(float v)
Set volume in [0, ∞]. Default is 1.0f.
float progress() const
Returns playing progress in [0, 1], can be used with length() to determine how much time has passed.
void loop()
Play the sound in a loop. Can also be stopped using stop()