mirror of
https://github.com/MihailRis/voxelcore.git
synced 2026-10-04 18:41:51 +00:00
audio streaming interfaces update
This commit is contained in:
parent
4d15ebb7de
commit
ee5ebaf8db
4 changed files with 148 additions and 6 deletions
|
|
@ -46,6 +46,14 @@ Sound* audio::createSound(std::shared_ptr<PCM> pcm, bool keepPCM) {
|
|||
return backend->createSound(pcm, keepPCM);
|
||||
}
|
||||
|
||||
PCMStream* audio::openPCMStream(const fs::path& file) {
|
||||
std::string ext = file.extension().u8string();
|
||||
if (ext == ".ogg" || ext == ".OGG") {
|
||||
return ogg::create_stream(file);
|
||||
}
|
||||
throw std::runtime_error("unsupported audio stream format");
|
||||
}
|
||||
|
||||
void audio::setListener(
|
||||
glm::vec3 position,
|
||||
glm::vec3 velocity,
|
||||
|
|
@ -121,6 +129,7 @@ void audio::update(double delta) {
|
|||
}
|
||||
|
||||
void audio::close() {
|
||||
speakers.clear();
|
||||
delete backend;
|
||||
backend = nullptr;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue