mirror of
https://github.com/libSDL2pp/libSDL2pp.git
synced 2025-08-03 02:45:57 -04:00
Provide copy operations for AudioDevice::LockHandle
This commit is contained in:
parent
3dd739d4a3
commit
486dbb7bf4
@ -50,8 +50,8 @@ public:
|
||||
LockHandle(LockHandle&& other) noexcept;
|
||||
LockHandle& operator=(LockHandle&& other) noexcept;
|
||||
|
||||
LockHandle(const LockHandle& other) = delete;
|
||||
LockHandle& operator=(const LockHandle& other) = delete;
|
||||
LockHandle(const LockHandle& other);
|
||||
LockHandle& operator=(const LockHandle& other);
|
||||
};
|
||||
|
||||
typedef std::function<void(Uint8* stream, int len)> AudioCallback;
|
||||
|
@ -53,4 +53,21 @@ AudioDevice::LockHandle& AudioDevice::LockHandle::operator=(AudioDevice::LockHan
|
||||
return *this;
|
||||
}
|
||||
|
||||
AudioDevice::LockHandle::LockHandle(const AudioDevice::LockHandle& other) : device_(other.device_) {
|
||||
SDL_LockAudioDevice(device_->device_id_);
|
||||
}
|
||||
|
||||
AudioDevice::LockHandle& AudioDevice::LockHandle::operator=(const AudioDevice::LockHandle& other) {
|
||||
if (&other == this)
|
||||
return *this;
|
||||
|
||||
if (device_ != nullptr)
|
||||
SDL_UnlockAudioDevice(device_->device_id_);
|
||||
|
||||
device_ = other.device_;
|
||||
SDL_LockAudioDevice(device_->device_id_);
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user