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

@@ -29,6 +29,8 @@ namespace Nz
virtual UInt32 GetSize() const = 0;
virtual UInt32 GetSampleRate() const = 0;
virtual bool IsCompatibleWith(const AudioDevice& device) const = 0;
virtual bool Reset(AudioFormat format, UInt64 sampleCount, UInt32 sampleRate, const void* samples) = 0;
AudioBuffer& operator=(const AudioBuffer&) = default;

View File

@@ -38,6 +38,7 @@ namespace Nz
virtual Quaternionf GetListenerRotation() const = 0;
virtual Vector3f GetListenerVelocity() const = 0;
virtual float GetSpeedOfSound() const = 0;
virtual const void* GetSubSystemIdentifier() const = 0;
virtual bool IsFormatSupported(AudioFormat format) const = 0;

View File

@@ -32,6 +32,8 @@ namespace Nz
UInt32 GetSize() const override;
UInt32 GetSampleRate() const override;
bool IsCompatibleWith(const AudioDevice& device) const override;
bool Reset(AudioFormat format, UInt64 sampleCount, UInt32 sampleRate, const void* samples) override;
OpenALBuffer& operator=(const OpenALBuffer&) = delete;

View File

@@ -39,9 +39,10 @@ namespace Nz
float GetGlobalVolume() const override;
Vector3f GetListenerDirection(Vector3f* up = nullptr) const override;
Vector3f GetListenerPosition() const override;
Quaternionf GetListenerRotation(Vector3f* up = nullptr) const override;
Quaternionf GetListenerRotation() const override;
Vector3f GetListenerVelocity() const override;
float GetSpeedOfSound() const override;
const void* GetSubSystemIdentifier() const override;
bool IsFormatSupported(AudioFormat format) const override;

View File

@@ -50,7 +50,7 @@ namespace Nz
SoundBuffer(SoundBuffer&&) = delete;
~SoundBuffer() = default;
const std::shared_ptr<AudioBuffer>& GetBuffer(AudioDevice* device);
const std::shared_ptr<AudioBuffer>& GetAudioBuffer(AudioDevice* device);
inline UInt32 GetDuration() const;
inline AudioFormat GetFormat() const;