mirror of
https://github.com/f4exb/sdrangel.git
synced 2026-06-01 21:54:55 -04:00
Web API: /sdrangel/audio (GET) implementation (1)
This commit is contained in:
@@ -36,6 +36,7 @@
|
||||
#include "SWGInstanceDevicesResponse.h"
|
||||
#include "SWGInstanceChannelsResponse.h"
|
||||
#include "SWGDeviceListItem.h"
|
||||
#include "SWGAudioDevices.h"
|
||||
#include "SWGErrorResponse.h"
|
||||
|
||||
#include "webapiadaptergui.h"
|
||||
@@ -249,6 +250,38 @@ int WebAPIAdapterGUI::instanceLoggingPut(
|
||||
return 200;
|
||||
}
|
||||
|
||||
int WebAPIAdapterGUI::instanceAudioGet(
|
||||
Swagger::SWGAudioDevices& response,
|
||||
Swagger::SWGErrorResponse& error __attribute__((unused)))
|
||||
{
|
||||
const QList<QAudioDeviceInfo>& audioInputDevices = m_mainWindow.m_audioDeviceInfo.getInputDevices();
|
||||
const QList<QAudioDeviceInfo>& audioOutputDevices = m_mainWindow.m_audioDeviceInfo.getOutputDevices();
|
||||
int nbInputDevices = audioInputDevices.size();
|
||||
int nbOutputDevices = audioOutputDevices.size();
|
||||
|
||||
response.init();
|
||||
response.setNbInputDevices(nbInputDevices);
|
||||
response.setInputDeviceSelectedIndex(m_mainWindow.m_audioDeviceInfo.getInputDeviceIndex());
|
||||
response.setNbOutputDevices(nbOutputDevices);
|
||||
response.setOutputDeviceSelectedIndex(m_mainWindow.m_audioDeviceInfo.getOutputDeviceIndex());
|
||||
QList<QString*> *inputDeviceNames = response.getInputDevices();
|
||||
QList<QString*> *outputDeviceNames = response.getOutputDevices();
|
||||
|
||||
for (int i = 0; i < nbInputDevices; i++)
|
||||
{
|
||||
inputDeviceNames->append(new QString());
|
||||
*inputDeviceNames->back() = audioInputDevices[i].deviceName();
|
||||
}
|
||||
|
||||
for (int i = 0; i < nbOutputDevices; i++)
|
||||
{
|
||||
outputDeviceNames->append(new QString());
|
||||
*outputDeviceNames->back() = audioOutputDevices[i].deviceName();
|
||||
}
|
||||
|
||||
return 200;
|
||||
}
|
||||
|
||||
QtMsgType WebAPIAdapterGUI::getMsgTypeFromString(const QString& msgTypeString)
|
||||
{
|
||||
if (msgTypeString == "debug") {
|
||||
|
||||
Reference in New Issue
Block a user