11#ifndef SDLSOUNDBUFFER_HPP_
12#define SDLSOUNDBUFFER_HPP_
16#include <SDL3_mixer/SDL_mixer.h>
39 _audio = MIX_LoadAudio(mixer, path.c_str(),
true);
41 std::cerr <<
"Failed to load sound: " << SDL_GetError() << std::endl;
46 MIX_DestroyAudio(_audio);
49 bool isReady()
const override {
return _audio !=
nullptr; }
61 const Sint64 frames = MIX_GetAudioDuration(_audio);
65 return static_cast<float>(MIX_AudioFramesToMS(_audio, frames)) / 1000.f;
68 MIX_Audio *
handle()
const {
return _audio; }
71 MIX_Audio *_audio =
nullptr;
Un echantillon decode en memoire, partageable par plusieurs sons.
Definition SdlSoundBuffer.hpp:30
~SdlSoundBuffer()
Definition SdlSoundBuffer.hpp:44
float getLength() const override
La duree, en secondes.
Definition SdlSoundBuffer.hpp:57
bool isReady() const override
notice if the buffer is ready
Definition SdlSoundBuffer.hpp:49
SdlSoundBuffer(MIX_Mixer *mixer, std::string path)
Definition SdlSoundBuffer.hpp:38
MIX_Audio * handle() const
Definition SdlSoundBuffer.hpp:68
Loaded audio samples, independent of any ISound that plays them - deleting every ISound built from a ...
Definition ISoundBuffer.hpp:24