Audio: Make Music, Sound, SoundEmitter movable

This commit is contained in:
Lynix
2018-04-08 17:51:25 +02:00
parent 31fc8c9dad
commit 3c4c0fab66
7 changed files with 104 additions and 18 deletions

View File

@@ -38,7 +38,7 @@ namespace Nz
public:
Music() = default;
Music(const Music&) = delete;
Music(Music&&) = delete;
Music(Music&&) noexcept = default;
~Music();
bool Create(SoundStream* soundStream);
@@ -67,10 +67,10 @@ namespace Nz
void Stop() override;
Music& operator=(const Music&) = delete;
Music& operator=(Music&&) = delete;
Music& operator=(Music&&) noexcept = default;
private:
MovablePtr<MusicImpl> m_impl = nullptr;
MovablePtr<MusicImpl> m_impl;
bool FillAndQueueBuffer(unsigned int buffer);
void MusicThread();

View File

@@ -20,7 +20,7 @@ namespace Nz
Sound() = default;
Sound(const SoundBuffer* soundBuffer);
Sound(const Sound& sound);
Sound(Sound&&) = default;
Sound(Sound&&) noexcept = default;
~Sound();
void EnableLooping(bool loop) override;
@@ -47,7 +47,7 @@ namespace Nz
void Stop() override;
Sound& operator=(const Sound&) = delete; ///TODO?
Sound& operator=(Sound&&) = default;
Sound& operator=(Sound&&) noexcept = default;
private:
SoundBufferConstRef m_buffer;

View File

@@ -11,6 +11,7 @@
#include <Nazara/Audio/Config.hpp>
#include <Nazara/Audio/Enums.hpp>
#include <Nazara/Math/Vector3.hpp>
#include <limits>
///TODO: Inherit SoundEmitter from Node
@@ -19,6 +20,7 @@ namespace Nz
class NAZARA_AUDIO_API SoundEmitter
{
public:
SoundEmitter(SoundEmitter&& emitter) noexcept;
virtual ~SoundEmitter();
virtual void EnableLooping(bool loop) = 0;
@@ -51,16 +53,17 @@ namespace Nz
virtual void Stop() = 0;
SoundEmitter& operator=(const SoundEmitter&) = delete; ///TODO
SoundEmitter& operator=(SoundEmitter&&) = delete;
SoundEmitter& operator=(const SoundEmitter&) = delete;
SoundEmitter& operator=(SoundEmitter&&) noexcept;
protected:
SoundEmitter();
SoundEmitter(const SoundEmitter& emitter);
SoundEmitter(SoundEmitter&&) = delete;
SoundStatus GetInternalStatus() const;
static constexpr unsigned int InvalidSource = std::numeric_limits<unsigned int>::max();
unsigned int m_source;
};
}