Audio: Handle AudioBuffer compatibility

OpenAL buffers are shared between contextes
This commit is contained in:
Jérôme Leclercq
2022-03-17 13:36:09 +01:00
parent 01061380ee
commit 667a4a0c08
10 changed files with 44 additions and 9 deletions

View File

@@ -150,7 +150,7 @@ namespace Nz
void OpenALSource::QueueBuffer(std::shared_ptr<AudioBuffer> audioBuffer)
{
NazaraAssert(audioBuffer, "invalid buffer");
NazaraAssert(audioBuffer->GetAudioDevice() == GetAudioDevice(), "incompatible buffer");
NazaraAssert(audioBuffer->IsCompatibleWith(*GetAudioDevice()), "incompatible buffer");
std::shared_ptr<OpenALBuffer> newBuffer = std::static_pointer_cast<OpenALBuffer>(std::move(audioBuffer));
@@ -185,7 +185,7 @@ namespace Nz
void OpenALSource::SetBuffer(std::shared_ptr<AudioBuffer> audioBuffer)
{
NazaraAssert(audioBuffer->GetAudioDevice() == GetAudioDevice(), "incompatible buffer");
NazaraAssert(audioBuffer->IsCompatibleWith(*GetAudioDevice()), "incompatible buffer");
std::shared_ptr<OpenALBuffer> newBuffer = std::static_pointer_cast<OpenALBuffer>(std::move(audioBuffer));