#pragma once #include #include #include #include #include #include class AudioPlayer { public: AudioPlayer(); ~AudioPlayer(); // Для музыки с зацикливанием (если filename пустой - продолжает играть текущую) bool playMusic(const std::string& filename = ""); // Для одноразовых звуковых эффектов bool playSound(const std::string& filename); void stop(); bool isPlaying() const; private: ALCdevice* device; ALCcontext* context; ALuint musicSource; // Источник для музыки ALuint soundSource; // Источник для звуков ALuint musicBuffer; // Буфер для музыки ALuint soundBuffer; // Буфер для звуков bool playing; std::string currentMusic; // Хранит имя текущего музыкального файла std::vector loadOgg(const std::string& filename, ALuint buffer); std::string findFileInSounds(const std::string& filename); bool isOggFile(const std::string& filename) const; };