added sounds and music in main cpp by cliking wasd or arrow will play sound of steps and music in setup start playing
This commit is contained in:
1 parent
bed5ae7a40
commit
27ecda3124
4 files changed
+97
-33
No files matched your search
@@ -12,18 +12,26 @@ public:
|
||||
AudioPlayer();
|
||||
~AudioPlayer();
|
||||
|
||||
bool playFromSoundsDir(const std::string& filename);
|
||||
// Для музыки с зацикливанием (если filename пустой - продолжает играть текущую)
|
||||
bool playMusic(const std::string& filename = "");
|
||||
|
||||
// Для одноразовых звуковых эффектов
|
||||
bool playSound(const std::string& filename);
|
||||
|
||||
void stop();
|
||||
bool isPlaying() const;
|
||||
|
||||
private:
|
||||
ALCdevice* device;
|
||||
ALCcontext* context;
|
||||
ALuint source;
|
||||
ALuint buffer;
|
||||
ALuint musicSource; // Источник для музыки
|
||||
ALuint soundSource; // Источник для звуков
|
||||
ALuint musicBuffer; // Буфер для музыки
|
||||
ALuint soundBuffer; // Буфер для звуков
|
||||
bool playing;
|
||||
std::string currentMusic; // Хранит имя текущего музыкального файла
|
||||
|
||||
std::vector<char> loadOgg(const std::string& filename);
|
||||
std::vector<char> loadOgg(const std::string& filename, ALuint buffer);
|
||||
std::string findFileInSounds(const std::string& filename);
|
||||
bool isOggFile(const std::string& filename) const;
|
||||
};
|
||||
Reference in new issue
Block a user