mirror of
https://github.com/f4exb/sdrangel.git
synced 2025-04-05 11:09:13 -04:00
Audio output device recording: API support. Part of #1330
This commit is contained in:
parent
328cd2046e
commit
a9ffe43f01
@ -2430,6 +2430,18 @@ margin-bottom: 20px;
|
||||
"udpPort" : {
|
||||
"type" : "integer",
|
||||
"description" : "UDP destination port"
|
||||
},
|
||||
"fileRecordName" : {
|
||||
"type" : "string",
|
||||
"description" : "Output record file name"
|
||||
},
|
||||
"recordToFile" : {
|
||||
"type" : "integer",
|
||||
"description" : "Record to file active\n * 0 - not recording\n * 1 - recording\n"
|
||||
},
|
||||
"recordSilenceTime" : {
|
||||
"type" : "integer",
|
||||
"description" : "Record silence time before stopping recording in 10ths of seconds"
|
||||
}
|
||||
},
|
||||
"description" : "Audio output device"
|
||||
@ -56605,7 +56617,7 @@ except ApiException as e:
|
||||
</div>
|
||||
<div id="generator">
|
||||
<div class="content">
|
||||
Generated 2022-08-16T18:08:01.866+02:00
|
||||
Generated 2022-11-12T10:56:38.135+01:00
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -3201,6 +3201,18 @@ definitions:
|
||||
udpPort:
|
||||
description: "UDP destination port"
|
||||
type: integer
|
||||
fileRecordName:
|
||||
description: "Output record file name"
|
||||
type: string
|
||||
recordToFile:
|
||||
type: integer
|
||||
description: >
|
||||
Record to file active
|
||||
* 0 - not recording
|
||||
* 1 - recording
|
||||
recordSilenceTime:
|
||||
description: "Record silence time before stopping recording in 10ths of seconds"
|
||||
type: integer
|
||||
|
||||
LocationInformation:
|
||||
description: "Instance geolocation information"
|
||||
|
@ -503,6 +503,9 @@ int WebAPIAdapter::instanceAudioGet(
|
||||
outputDevices->back()->setUdpDecimationFactor((int) outputDeviceInfo.udpDecimationFactor);
|
||||
*outputDevices->back()->getUdpAddress() = outputDeviceInfo.udpAddress;
|
||||
outputDevices->back()->setUdpPort(outputDeviceInfo.udpPort);
|
||||
*outputDevices->back()->getFileRecordName() = outputDeviceInfo.fileRecordName;
|
||||
outputDevices->back()->setRecordToFile(outputDeviceInfo.recordToFile ? 1 : 0);
|
||||
outputDevices->back()->setRecordSilenceTime(outputDeviceInfo.recordSilenceTime);
|
||||
|
||||
// real output devices
|
||||
for (int i = 0; i < nbOutputDevices; i++)
|
||||
@ -523,6 +526,9 @@ int WebAPIAdapter::instanceAudioGet(
|
||||
outputDevices->back()->setUdpDecimationFactor((int) outputDeviceInfo.udpDecimationFactor);
|
||||
*outputDevices->back()->getUdpAddress() = outputDeviceInfo.udpAddress;
|
||||
outputDevices->back()->setUdpPort(outputDeviceInfo.udpPort);
|
||||
*outputDevices->back()->getFileRecordName() = outputDeviceInfo.fileRecordName;
|
||||
outputDevices->back()->setRecordToFile(outputDeviceInfo.recordToFile ? 1 : 0);
|
||||
outputDevices->back()->setRecordSilenceTime(outputDeviceInfo.recordSilenceTime);
|
||||
}
|
||||
|
||||
return 200;
|
||||
@ -606,6 +612,15 @@ int WebAPIAdapter::instanceAudioOutputPatch(
|
||||
if (audioOutputKeys.contains("udpPort")) {
|
||||
outputDeviceInfo.udpPort = response.getUdpPort() % (1<<16);
|
||||
}
|
||||
if (audioOutputKeys.contains("fileRecordName")) {
|
||||
outputDeviceInfo.fileRecordName = *response.getFileRecordName();
|
||||
}
|
||||
if (audioOutputKeys.contains("recordToFile")) {
|
||||
outputDeviceInfo.recordToFile = response.getRecordToFile() == 0 ? 0 : 1;
|
||||
}
|
||||
if (audioOutputKeys.contains("recordSilenceTime")) {
|
||||
outputDeviceInfo.recordSilenceTime = response.getRecordSilenceTime();
|
||||
}
|
||||
|
||||
dspEngine->getAudioDeviceManager()->setOutputDeviceInfo(deviceIndex, outputDeviceInfo);
|
||||
dspEngine->getAudioDeviceManager()->getOutputDeviceInfo(deviceName, outputDeviceInfo);
|
||||
@ -625,6 +640,15 @@ int WebAPIAdapter::instanceAudioOutputPatch(
|
||||
|
||||
response.setUdpPort(outputDeviceInfo.udpPort % (1<<16));
|
||||
|
||||
if (response.getFileRecordName()) {
|
||||
*response.getFileRecordName() = outputDeviceInfo.fileRecordName;
|
||||
} else {
|
||||
response.setFileRecordName(new QString(outputDeviceInfo.fileRecordName));
|
||||
}
|
||||
|
||||
response.setRecordToFile(outputDeviceInfo.recordToFile == 0 ? 0 : 1);
|
||||
response.setRecordSilenceTime(outputDeviceInfo.recordSilenceTime);
|
||||
|
||||
return 200;
|
||||
}
|
||||
|
||||
|
@ -3937,6 +3937,21 @@ bool WebAPIRequestMapper::validateAudioOutputDevice(
|
||||
audioOutputDevice.setUdpPort(jsonObject["udpPort"].toInt());
|
||||
audioOutputDeviceKeys.append("udpPort");
|
||||
}
|
||||
if (jsonObject.contains("fileRecordName"))
|
||||
{
|
||||
audioOutputDevice.setFileRecordName(new QString(jsonObject["fileRecordName"].toString()));
|
||||
audioOutputDeviceKeys.append("fileRecordName");
|
||||
}
|
||||
if (jsonObject.contains("recordToFile"))
|
||||
{
|
||||
audioOutputDevice.setRecordToFile(jsonObject["recordToFile"].toInt() == 0 ? 0 : 1);
|
||||
audioOutputDeviceKeys.append("recordToFile");
|
||||
}
|
||||
if (jsonObject.contains("recordSilenceTime"))
|
||||
{
|
||||
audioOutputDevice.setRecordSilenceTime(jsonObject["recordSilenceTime"].toInt());
|
||||
audioOutputDeviceKeys.append("recordSilenceTime");
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -3201,6 +3201,18 @@ definitions:
|
||||
udpPort:
|
||||
description: "UDP destination port"
|
||||
type: integer
|
||||
fileRecordName:
|
||||
description: "Output record file name"
|
||||
type: string
|
||||
recordToFile:
|
||||
type: integer
|
||||
description: >
|
||||
Record to file active
|
||||
* 0 - not recording
|
||||
* 1 - recording
|
||||
recordSilenceTime:
|
||||
description: "Record silence time before stopping recording in 10ths of seconds"
|
||||
type: integer
|
||||
|
||||
LocationInformation:
|
||||
description: "Instance geolocation information"
|
||||
|
@ -2430,6 +2430,18 @@ margin-bottom: 20px;
|
||||
"udpPort" : {
|
||||
"type" : "integer",
|
||||
"description" : "UDP destination port"
|
||||
},
|
||||
"fileRecordName" : {
|
||||
"type" : "string",
|
||||
"description" : "Output record file name"
|
||||
},
|
||||
"recordToFile" : {
|
||||
"type" : "integer",
|
||||
"description" : "Record to file active\n * 0 - not recording\n * 1 - recording\n"
|
||||
},
|
||||
"recordSilenceTime" : {
|
||||
"type" : "integer",
|
||||
"description" : "Record silence time before stopping recording in 10ths of seconds"
|
||||
}
|
||||
},
|
||||
"description" : "Audio output device"
|
||||
@ -56605,7 +56617,7 @@ except ApiException as e:
|
||||
</div>
|
||||
<div id="generator">
|
||||
<div class="content">
|
||||
Generated 2022-08-16T18:08:01.866+02:00
|
||||
Generated 2022-11-12T10:56:38.135+01:00
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -52,6 +52,12 @@ SWGAudioOutputDevice::SWGAudioOutputDevice() {
|
||||
m_udp_address_isSet = false;
|
||||
udp_port = 0;
|
||||
m_udp_port_isSet = false;
|
||||
file_record_name = nullptr;
|
||||
m_file_record_name_isSet = false;
|
||||
record_to_file = 0;
|
||||
m_record_to_file_isSet = false;
|
||||
record_silence_time = 0;
|
||||
m_record_silence_time_isSet = false;
|
||||
}
|
||||
|
||||
SWGAudioOutputDevice::~SWGAudioOutputDevice() {
|
||||
@ -84,6 +90,12 @@ SWGAudioOutputDevice::init() {
|
||||
m_udp_address_isSet = false;
|
||||
udp_port = 0;
|
||||
m_udp_port_isSet = false;
|
||||
file_record_name = new QString("");
|
||||
m_file_record_name_isSet = false;
|
||||
record_to_file = 0;
|
||||
m_record_to_file_isSet = false;
|
||||
record_silence_time = 0;
|
||||
m_record_silence_time_isSet = false;
|
||||
}
|
||||
|
||||
void
|
||||
@ -104,6 +116,11 @@ SWGAudioOutputDevice::cleanup() {
|
||||
delete udp_address;
|
||||
}
|
||||
|
||||
if(file_record_name != nullptr) {
|
||||
delete file_record_name;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
SWGAudioOutputDevice*
|
||||
@ -141,6 +158,12 @@ SWGAudioOutputDevice::fromJsonObject(QJsonObject &pJson) {
|
||||
|
||||
::SWGSDRangel::setValue(&udp_port, pJson["udpPort"], "qint32", "");
|
||||
|
||||
::SWGSDRangel::setValue(&file_record_name, pJson["fileRecordName"], "QString", "QString");
|
||||
|
||||
::SWGSDRangel::setValue(&record_to_file, pJson["recordToFile"], "qint32", "");
|
||||
|
||||
::SWGSDRangel::setValue(&record_silence_time, pJson["recordSilenceTime"], "qint32", "");
|
||||
|
||||
}
|
||||
|
||||
QString
|
||||
@ -193,6 +216,15 @@ SWGAudioOutputDevice::asJsonObject() {
|
||||
if(m_udp_port_isSet){
|
||||
obj->insert("udpPort", QJsonValue(udp_port));
|
||||
}
|
||||
if(file_record_name != nullptr && *file_record_name != QString("")){
|
||||
toJsonValue(QString("fileRecordName"), file_record_name, obj, QString("QString"));
|
||||
}
|
||||
if(m_record_to_file_isSet){
|
||||
obj->insert("recordToFile", QJsonValue(record_to_file));
|
||||
}
|
||||
if(m_record_silence_time_isSet){
|
||||
obj->insert("recordSilenceTime", QJsonValue(record_silence_time));
|
||||
}
|
||||
|
||||
return obj;
|
||||
}
|
||||
@ -317,6 +349,36 @@ SWGAudioOutputDevice::setUdpPort(qint32 udp_port) {
|
||||
this->m_udp_port_isSet = true;
|
||||
}
|
||||
|
||||
QString*
|
||||
SWGAudioOutputDevice::getFileRecordName() {
|
||||
return file_record_name;
|
||||
}
|
||||
void
|
||||
SWGAudioOutputDevice::setFileRecordName(QString* file_record_name) {
|
||||
this->file_record_name = file_record_name;
|
||||
this->m_file_record_name_isSet = true;
|
||||
}
|
||||
|
||||
qint32
|
||||
SWGAudioOutputDevice::getRecordToFile() {
|
||||
return record_to_file;
|
||||
}
|
||||
void
|
||||
SWGAudioOutputDevice::setRecordToFile(qint32 record_to_file) {
|
||||
this->record_to_file = record_to_file;
|
||||
this->m_record_to_file_isSet = true;
|
||||
}
|
||||
|
||||
qint32
|
||||
SWGAudioOutputDevice::getRecordSilenceTime() {
|
||||
return record_silence_time;
|
||||
}
|
||||
void
|
||||
SWGAudioOutputDevice::setRecordSilenceTime(qint32 record_silence_time) {
|
||||
this->record_silence_time = record_silence_time;
|
||||
this->m_record_silence_time_isSet = true;
|
||||
}
|
||||
|
||||
|
||||
bool
|
||||
SWGAudioOutputDevice::isSet(){
|
||||
@ -358,6 +420,15 @@ SWGAudioOutputDevice::isSet(){
|
||||
if(m_udp_port_isSet){
|
||||
isObjectUpdated = true; break;
|
||||
}
|
||||
if(file_record_name && *file_record_name != QString("")){
|
||||
isObjectUpdated = true; break;
|
||||
}
|
||||
if(m_record_to_file_isSet){
|
||||
isObjectUpdated = true; break;
|
||||
}
|
||||
if(m_record_silence_time_isSet){
|
||||
isObjectUpdated = true; break;
|
||||
}
|
||||
}while(false);
|
||||
return isObjectUpdated;
|
||||
}
|
||||
|
@ -78,6 +78,15 @@ public:
|
||||
qint32 getUdpPort();
|
||||
void setUdpPort(qint32 udp_port);
|
||||
|
||||
QString* getFileRecordName();
|
||||
void setFileRecordName(QString* file_record_name);
|
||||
|
||||
qint32 getRecordToFile();
|
||||
void setRecordToFile(qint32 record_to_file);
|
||||
|
||||
qint32 getRecordSilenceTime();
|
||||
void setRecordSilenceTime(qint32 record_silence_time);
|
||||
|
||||
|
||||
virtual bool isSet() override;
|
||||
|
||||
@ -118,6 +127,15 @@ private:
|
||||
qint32 udp_port;
|
||||
bool m_udp_port_isSet;
|
||||
|
||||
QString* file_record_name;
|
||||
bool m_file_record_name_isSet;
|
||||
|
||||
qint32 record_to_file;
|
||||
bool m_record_to_file_isSet;
|
||||
|
||||
qint32 record_silence_time;
|
||||
bool m_record_silence_time_isSet;
|
||||
|
||||
};
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user