mirror of
https://github.com/MihailRis/voxelcore.git
synced 2026-10-04 18:41:51 +00:00
audio system basic interface
This commit is contained in:
parent
7cde1e8ac9
commit
97539aa9f4
12 changed files with 528 additions and 320 deletions
32
src/audio/audio.cpp
Normal file
32
src/audio/audio.cpp
Normal file
|
|
@ -0,0 +1,32 @@
|
|||
#include "audio.h"
|
||||
|
||||
#include <iostream>
|
||||
|
||||
#include "ALAudio.h"
|
||||
#include "NoAudio.h"
|
||||
|
||||
audio::Backend* audio::backend = nullptr;
|
||||
|
||||
void audio::initialize(bool enabled) {
|
||||
if (enabled) {
|
||||
audio::backend = ALAudio::create();
|
||||
}
|
||||
if (audio::backend == nullptr) {
|
||||
std::cerr << "could not to initialize audio" << std::endl;
|
||||
audio::backend = NoAudio::create();
|
||||
}
|
||||
}
|
||||
|
||||
void audio::setListener(
|
||||
glm::vec3 position,
|
||||
glm::vec3 velocity,
|
||||
glm::vec3 lookAt,
|
||||
glm::vec3 up
|
||||
) {
|
||||
audio::backend->setListener(position, velocity, lookAt, up);
|
||||
}
|
||||
|
||||
void audio::close() {
|
||||
delete audio::backend;
|
||||
audio::backend = nullptr;
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue