11#ifndef SFMLSOUNDBUFFER_HPP_
12#define SFMLSOUNDBUFFER_HPP_
15#include <SFML/Audio.hpp>
18#include "ISoundBuffer.hpp"
33 _buffer.emplace(path);
34 }
catch (
const sf::Exception &e) {
35 std::cerr <<
"Failed to load sound buffer: " << e.what() << std::endl;
42 return _buffer.has_value();
46 return _buffer.has_value() ? _buffer->getDuration().asSeconds() : 0.f;
49 const sf::SoundBuffer &
handle()
const {
50 return _buffer.value();
54 std::optional<sf::SoundBuffer> _buffer;
Sfml SoundBuffer class - owns the loaded samples. SfmlSound only references it (sf::Sound itself alre...
Definition SfmlSoundBuffer.hpp:28
bool isReady() const override
Definition SfmlSoundBuffer.hpp:41
SfmlSoundBuffer(std::string path)
Definition SfmlSoundBuffer.hpp:31
float getLength() const override
Definition SfmlSoundBuffer.hpp:45
~SfmlSoundBuffer()=default
const sf::SoundBuffer & handle() const
Definition SfmlSoundBuffer.hpp:49