91 lines
2.2 KiB
C++
91 lines
2.2 KiB
C++
#include "ApplicationData.h"
|
|
|
|
AudioDevice::AudioDevice()
|
|
{
|
|
}
|
|
|
|
AudioDevice::AudioDevice(AudioDevice&& other) noexcept
|
|
: device(other.device), volumeInterface(other.volumeInterface), meterInterface(other.meterInterface),
|
|
id(other.id), name(other.name), state(other.state),
|
|
isDefaultConsole(other.isDefaultConsole), isDefaultMedia(other.isDefaultMedia), isDefaultCommunication(other.isDefaultCommunication)
|
|
{
|
|
other.device = nullptr;
|
|
other.volumeInterface = nullptr;
|
|
other.meterInterface = nullptr;
|
|
}
|
|
|
|
AudioDevice& AudioDevice::operator=(AudioDevice&& other) noexcept
|
|
{
|
|
this->device = other.device;
|
|
this->volumeInterface = other.volumeInterface;
|
|
this->meterInterface = other.meterInterface;
|
|
this->id = other.id;
|
|
this->name = other.name;
|
|
this->state = other.state;
|
|
this->isDefaultConsole = other.isDefaultConsole;
|
|
this->isDefaultMedia = other.isDefaultMedia;
|
|
this->isDefaultCommunication = other.isDefaultCommunication;
|
|
|
|
other.device = nullptr;
|
|
other.volumeInterface = nullptr;
|
|
other.meterInterface = nullptr;
|
|
return *this;
|
|
}
|
|
|
|
AudioDevice::~AudioDevice()
|
|
{
|
|
if (volumeInterface)
|
|
{
|
|
volumeInterface->Release();
|
|
volumeInterface = nullptr;
|
|
}
|
|
if (meterInterface)
|
|
{
|
|
meterInterface->Release();
|
|
meterInterface = nullptr;
|
|
}
|
|
if (device)
|
|
{
|
|
device->Release();
|
|
device = nullptr;
|
|
}
|
|
}
|
|
|
|
AudioData::AudioData()
|
|
{
|
|
}
|
|
|
|
AudioData::AudioData(AudioData&& other) noexcept
|
|
: playbackDevices(std::move(other.playbackDevices)), recordingDevices(std::move(other.recordingDevices)),
|
|
deviceEnumerator(other.deviceEnumerator), audioNotificationListener(other.audioNotificationListener)
|
|
{
|
|
other.deviceEnumerator = nullptr;
|
|
other.audioNotificationListener = nullptr;
|
|
}
|
|
|
|
AudioData& AudioData::operator=(AudioData&& other) noexcept
|
|
{
|
|
playbackDevices = std::move(other.playbackDevices);
|
|
recordingDevices = std::move(other.recordingDevices);
|
|
deviceEnumerator = other.deviceEnumerator;
|
|
audioNotificationListener = other.audioNotificationListener;
|
|
|
|
other.deviceEnumerator = nullptr;
|
|
other.audioNotificationListener = nullptr;
|
|
return *this;
|
|
}
|
|
|
|
AudioData::~AudioData()
|
|
{
|
|
if (deviceEnumerator)
|
|
{
|
|
deviceEnumerator->Release();
|
|
deviceEnumerator = nullptr;
|
|
}
|
|
if (audioNotificationListener)
|
|
{
|
|
audioNotificationListener->Release();
|
|
audioNotificationListener = nullptr;
|
|
}
|
|
}
|