sfml_impl 0.1.0
Vendor SFML 3.0.2 : IGraphic2Module / IAudioModule
Loading...
Searching...
No Matches
SfmlAudioModule.hpp
Go to the documentation of this file.
1
13#ifndef SFMLAUDIO_MODULE_HPP
14#define SFMLAUDIO_MODULE_HPP
15
16#include "IAudioModule.hpp"
17
18#include "audio/SfmlMusic.hpp"
19#include "audio/SfmlSound.hpp"
21
26class SfmlAudioModule : public IAudioModule {
27
28public:
29 SfmlAudioModule() = default;
30 ~SfmlAudioModule() = default;
31
32 const char *type() const override { return IAudioModule::contract; }
33 const char *name() const override { return "sfml"; }
34
35 // music
36 audio::IMusic *createMusic(std::string path) override {
37 return new SfmlMusic(path);
38 }
39 void deleteMusic(audio::IMusic *music) override {
40 delete music;
41 }
42
43 // sound buffer
44 audio::ISoundBuffer *createSoundBuffer(std::string path) override {
45 return new SfmlSoundBuffer(path);
46 }
47 void deleteSoundBuffer(audio::ISoundBuffer *buffer) override {
48 delete buffer;
49 }
50
51 // sound
52 audio::ISound *createSound(audio::ISoundBuffer *buffer) override {
53 return new SfmlSound(*static_cast<SfmlSoundBuffer *>(buffer));
54 }
55 void deleteSound(audio::ISound *sound) override {
56 delete sound;
57 }
58};
59
62#endif /* !SFMLAUDIO_MODULE_HPP */
sfml has no explicit audio device init/close step (unlike raylib), nothing to do at construction/dest...
Definition SfmlAudioModule.hpp:26
const char * name() const override
Definition SfmlAudioModule.hpp:33
void deleteMusic(audio::IMusic *music) override
Definition SfmlAudioModule.hpp:39
void deleteSoundBuffer(audio::ISoundBuffer *buffer) override
Definition SfmlAudioModule.hpp:47
~SfmlAudioModule()=default
audio::ISoundBuffer * createSoundBuffer(std::string path) override
Definition SfmlAudioModule.hpp:44
const char * type() const override
Definition SfmlAudioModule.hpp:32
void deleteSound(audio::ISound *sound) override
Definition SfmlAudioModule.hpp:55
SfmlAudioModule()=default
audio::IMusic * createMusic(std::string path) override
Definition SfmlAudioModule.hpp:36
audio::ISound * createSound(audio::ISoundBuffer *buffer) override
Definition SfmlAudioModule.hpp:52
sfml music stream.
Definition SfmlMusic.hpp:28
Sfml SoundBuffer class - owns the loaded samples. SfmlSound only references it (sf::Sound itself alre...
Definition SfmlSoundBuffer.hpp:28
Sfml Sound class - references a SfmlSoundBuffer, does not own it. Deleting the sound never touches th...
Definition SfmlSound.hpp:27