added sounds library

This commit is contained in:
albrut committed 2025-03-01 17:26:04 +06:00
1 parent 098f2b4005
commit d9038fee44
5 files changed
+241

No files matched your search

+29
View File
@@ -0,0 +1,29 @@
#pragma once
#include <string>
#include <AL/al.h>
#include <AL/alc.h>
#include <vorbis/vorbisfile.h>
#include <vector>
#include <cstdint>
class AudioPlayer {
public:
AudioPlayer();
~AudioPlayer();
bool playFromSoundsDir(const std::string& filename);
void stop();
bool isPlaying() const;
private:
ALCdevice* device;
ALCcontext* context;
ALuint source;
ALuint buffer;
bool playing;
std::vector<char> loadOgg(const std::string& filename);
std::string findFileInSounds(const std::string& filename);
bool isOggFile(const std::string& filename) const;
};