This commit is contained in:
MihailRis 2025-10-24 23:10:16 +03:00
parent 6c558eb3d5
commit ab7bf9c709
6 changed files with 0 additions and 49 deletions

View file

@ -625,37 +625,6 @@ void ALAudio::freeBuffer(uint buffer) {
freebuffers.push_back(buffer);
}
void ALAudio::setOutputDevice(const std::string& deviceName) {
ALCdevice* newDevice = alcOpenDevice(deviceName.c_str());
if (newDevice == nullptr) {
logger.error() << "failed to open output device: " << deviceName;
return;
}
ALCcontext* newContext = alcCreateContext(newDevice, nullptr);
if (!alcMakeContextCurrent(newContext)) {
logger.error() << "failed to make context current for device: "
<< deviceName;
alcCloseDevice(newDevice);
return;
}
// Clean up old device and context
alcMakeContextCurrent(nullptr);
check_alc_errors(device, "alcMakeContextCurrent");
alcDestroyContext(context);
check_alc_errors(device, "alcDestroyContext");
if (!alcCloseDevice(device)) {
logger.error() << "old device not closed";
}
// Update to new device and context
device = newDevice;
context = newContext;
logger.info() << "switched output device to: " << deviceName;
}
void ALAudio::setListener(
glm::vec3 position, glm::vec3 velocity, glm::vec3 at, glm::vec3 up
) {