Added CAudioDevice and cleaning up IVoice

refs #36
- Added a common class CAudioDevice encapsulating each audio device
- One subclass for input and output devices
- Changed IVoice interface slightly to better fit into the event flow

refs #81
This commit is contained in:
Roland Winklmeier
2013-11-29 00:25:51 +01:00
committed by Mathew Sutcliffe
parent fcebc44b02
commit 158de31c0b
7 changed files with 340 additions and 21 deletions

View File

@@ -0,0 +1,91 @@
/* Copyright (C) 2013 VATSIM Community / authors
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
/*!
\file
*/
#include "vaudiodevice.h"
#include "blackmisc/blackmiscfreefunctions.h"
namespace BlackMisc
{
namespace Voice
{
bool CAudioDevice::operator ==(const CAudioDevice &other) const
{
if (&other == this)
{
return true;
}
if (m_deviceIndex == other.m_deviceIndex)
{
return true;
}
// otherwise
return false;
}
/*
* Unequal?
*/
bool CAudioDevice::operator !=(const CAudioDevice &other) const
{
return !((*this) == other);
}
uint CAudioDevice::getValueHash() const
{
QList<uint> hashs;
hashs << qHash(m_deviceIndex);
hashs << qHash(m_deviceName);
return BlackMisc::calculateHash(hashs, "CAudioDevice");
}
void CAudioDevice::registerMetadata()
{
qRegisterMetaType<CAudioDevice>();
qDBusRegisterMetaType<CAudioDevice>();
}
QString CAudioDevice::convertToQString(bool i18n) const
{
return m_deviceName;
}
/*
* Marshall to DBus
*/
void CAudioDevice::marshallToDbus(QDBusArgument &argument) const
{
argument << m_deviceIndex;
argument << m_deviceName;
}
/*
* Unmarshall from DBus
*/
void CAudioDevice::unmarshallFromDbus(const QDBusArgument &argument)
{
argument >> m_deviceIndex;
argument >> m_deviceName;
}
void CInputAudioDevice::registerMetadata()
{
qRegisterMetaType<CInputAudioDevice>();
qDBusRegisterMetaType<CInputAudioDevice>();
}
void COutputAudioDevice::registerMetadata()
{
qRegisterMetaType<COutputAudioDevice>();
qDBusRegisterMetaType<COutputAudioDevice>();
}
} // Voice
} // BlackMisc