Skip to content
Snippets Groups Projects
Commit 8d94fbbe authored by Andreas Traczyk's avatar Andreas Traczyk Committed by Sébastien Blin
Browse files

avmodel: parse output indices too when getting device name by type

Change-Id: I71a777a73dc64c1f418b00cbf1839e25a02dbb81
parent 98e922bc
Branches
No related tags found
No related merge requests found
...@@ -292,11 +292,11 @@ AVModel::getAudioManager() const ...@@ -292,11 +292,11 @@ AVModel::getAudioManager() const
std::vector<std::string> std::vector<std::string>
AVModel::getAudioOutputDevices() const AVModel::getAudioOutputDevices() const
{ {
QStringList managers = ConfigurationManager::instance() QStringList devices = ConfigurationManager::instance()
.getAudioOutputDeviceList(); .getAudioOutputDeviceList();
std::vector<std::string> result; std::vector<std::string> result;
for (const auto& manager : managers) { for (const auto& device : devices) {
result.emplace_back(manager.toStdString()); result.emplace_back(device.toStdString());
} }
return result; return result;
} }
...@@ -304,11 +304,11 @@ AVModel::getAudioOutputDevices() const ...@@ -304,11 +304,11 @@ AVModel::getAudioOutputDevices() const
std::vector<std::string> std::vector<std::string>
AVModel::getAudioInputDevices() const AVModel::getAudioInputDevices() const
{ {
QStringList managers = ConfigurationManager::instance() QStringList devices = ConfigurationManager::instance()
.getAudioInputDeviceList(); .getAudioInputDeviceList();
std::vector<std::string> result; std::vector<std::string> result;
for (const auto& manager : managers) { for (const auto& device : devices) {
result.emplace_back(manager.toStdString()); result.emplace_back(device.toStdString());
} }
return result; return result;
} }
...@@ -740,7 +740,18 @@ AVModelPimpl::getDevice(int type) const ...@@ -740,7 +740,18 @@ AVModelPimpl::getDevice(int type) const
} }
auto deviceIdx = currentDevicesIdx[type].toUInt(); auto deviceIdx = currentDevicesIdx[type].toUInt();
for (const auto& dev : devices) { for (const auto& dev : devices) {
int idx = ConfigurationManager::instance().getAudioInputDeviceIndex(dev.c_str()); int idx;
switch (type) {
case 1: // INPUT
idx = ConfigurationManager::instance().getAudioInputDeviceIndex(dev.c_str());
break;
case 0: // OUTPUT
case 2: // RINGTONE
idx = ConfigurationManager::instance().getAudioOutputDeviceIndex(dev.c_str());
break;
default:
break;
}
if (idx == deviceIdx) { if (idx == deviceIdx) {
return dev; return dev;
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment