mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-02 06:35:52 +08:00
In #85 the voice context will be renamed to audio context, so the CValueObject classes will be renamed to namespace Audio too. As #140 changes many CValueClasses, this crossover change is done in the same unit of work.
This commit is contained in:
76
src/blackmisc/audiodevicelist.cpp
Normal file
76
src/blackmisc/audiodevicelist.cpp
Normal file
@@ -0,0 +1,76 @@
|
||||
/* 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/. */
|
||||
|
||||
#include "audiodevicelist.h"
|
||||
#include "predicates.h"
|
||||
|
||||
namespace BlackMisc
|
||||
{
|
||||
namespace Audio
|
||||
{
|
||||
/*
|
||||
* Default constructor
|
||||
*/
|
||||
CAudioDeviceList::CAudioDeviceList() { }
|
||||
|
||||
/*
|
||||
* Construct from base class object
|
||||
*/
|
||||
CAudioDeviceList::CAudioDeviceList(const CSequence &other) :
|
||||
CSequence(other)
|
||||
{ }
|
||||
|
||||
/*
|
||||
* Output devices
|
||||
*/
|
||||
CAudioDeviceList CAudioDeviceList::getOutputDevices() const
|
||||
{
|
||||
CAudioDeviceList outList;
|
||||
if (this->isEmpty()) return outList;
|
||||
foreach(CAudioDevice device, *this)
|
||||
{
|
||||
if (device.getType() == CAudioDevice::OutputDevice) outList.push_back(device);
|
||||
}
|
||||
return outList;
|
||||
}
|
||||
|
||||
/*
|
||||
* Output devices
|
||||
*/
|
||||
CAudioDeviceList CAudioDeviceList::getInputDevices() const
|
||||
{
|
||||
CAudioDeviceList inList;
|
||||
if (this->isEmpty()) return inList;
|
||||
foreach(CAudioDevice device, *this)
|
||||
{
|
||||
if (device.getType() == CAudioDevice::InputDevice) inList.push_back(device);
|
||||
}
|
||||
return inList;
|
||||
}
|
||||
|
||||
/*
|
||||
* Count as of type
|
||||
*/
|
||||
int CAudioDeviceList::count(CAudioDevice::DeviceType type) const
|
||||
{
|
||||
int c = 0;
|
||||
foreach(CAudioDevice device, *this)
|
||||
{
|
||||
if (device.getType() == type) c++;
|
||||
}
|
||||
return c;
|
||||
}
|
||||
|
||||
/*
|
||||
* Register metadata
|
||||
*/
|
||||
void CAudioDeviceList::registerMetadata()
|
||||
{
|
||||
qRegisterMetaType<CAudioDeviceList>();
|
||||
qDBusRegisterMetaType<CAudioDeviceList>();
|
||||
}
|
||||
|
||||
} // namespace
|
||||
} // namespace
|
||||
Reference in New Issue
Block a user