'ifnot' template property + hpp

This commit is contained in:
MihailRis
2024-05-06 00:45:43 +03:00
parent 8b1c102cfe
commit 9ea67deb13
59 changed files with 204 additions and 201 deletions
+88
View File
@@ -0,0 +1,88 @@
#ifndef AUDIO_NOAUDIO_HPP_
#define AUDIO_NOAUDIO_HPP_
#include "audio.hpp"
namespace audio {
class NoSound : public Sound {
std::shared_ptr<PCM> pcm;
duration_t duration;
public:
NoSound(std::shared_ptr<PCM> pcm, bool keepPCM);
~NoSound() {}
duration_t getDuration() const override {
return duration;
}
std::shared_ptr<PCM> getPCM() const override {
return pcm;
}
Speaker* newInstance(int priority, int channel) const override {
return nullptr;
}
};
class NoStream : public Stream {
std::shared_ptr<PCMStream> source;
duration_t duration;
public:
NoStream(std::shared_ptr<PCMStream> source, bool keepSource) {
duration = source->getTotalDuration();
if (keepSource) {
this->source = source;
}
}
std::shared_ptr<PCMStream> getSource() const override {
return source;
}
void bindSpeaker(speakerid_t speaker) override {
}
Speaker* createSpeaker(bool loop, int channel) override{
return nullptr;
}
speakerid_t getSpeaker() const override {
return 0;
}
void update(double delta) override {
}
duration_t getTime() const override {
return 0.0;
}
void setTime(duration_t time) override {
}
};
class NoAudio : public Backend {
public:
~NoAudio() {}
Sound* createSound(std::shared_ptr<PCM> pcm, bool keepPCM) override;
Stream* openStream(std::shared_ptr<PCMStream> stream, bool keepSource) override;
void setListener(
glm::vec3 position,
glm::vec3 velocity,
glm::vec3 at,
glm::vec3 up
) override {}
void update(double delta) override {}
bool isDummy() const override {
return true;
}
static NoAudio* create();
};
}
#endif // AUDIO_NOAUDIO_HPP_