kopia lustrzana https://github.com/f4exb/sdrangel
AaroniaRTSA output: fixed center frequency and sample rate getter and setter
rodzic
a6fa12ab3b
commit
2b6f033b89
|
@ -44,14 +44,12 @@ MESSAGE_CLASS_DEFINITION(AaroniaRTSAOutput::MsgSetStatus, Message)
|
|||
AaroniaRTSAOutput::AaroniaRTSAOutput(DeviceAPI *deviceAPI) :
|
||||
m_deviceAPI(deviceAPI),
|
||||
m_settings(),
|
||||
m_centerFrequency(0),
|
||||
m_sampleRate(48000),
|
||||
m_deviceDescription("AaroniaRTSAOutput"),
|
||||
m_worker(nullptr),
|
||||
m_workerThread(nullptr),
|
||||
m_running(false)
|
||||
{
|
||||
m_sampleSourceFifo.resize(SampleSourceFifo::getSizePolicy(m_sampleRate));
|
||||
m_sampleSourceFifo.resize(SampleSourceFifo::getSizePolicy(m_settings.m_sampleRate));
|
||||
m_deviceAPI->setNbSinkStreams(1);
|
||||
m_networkManager = new QNetworkAccessManager();
|
||||
QObject::connect(
|
||||
|
@ -174,40 +172,26 @@ const QString& AaroniaRTSAOutput::getDeviceDescription() const
|
|||
|
||||
int AaroniaRTSAOutput::getSampleRate() const
|
||||
{
|
||||
return m_sampleRate;
|
||||
}
|
||||
|
||||
void AaroniaRTSAOutput::setSampleRate(int sampleRate)
|
||||
{
|
||||
m_sampleRate = sampleRate;
|
||||
m_sampleSourceFifo.resize(SampleSourceFifo::getSizePolicy(m_sampleRate));
|
||||
|
||||
DSPSignalNotification *notif = new DSPSignalNotification(m_sampleRate, m_centerFrequency); // Frequency in Hz for the DSP engine
|
||||
m_deviceAPI->getDeviceEngineInputMessageQueue()->push(notif);
|
||||
|
||||
if (getMessageQueueToGUI())
|
||||
{
|
||||
MsgReportSampleRateAndFrequency *msg = MsgReportSampleRateAndFrequency::create(m_sampleRate, m_centerFrequency);
|
||||
getMessageQueueToGUI()->push(msg);
|
||||
}
|
||||
return m_settings.m_sampleRate;
|
||||
}
|
||||
|
||||
quint64 AaroniaRTSAOutput::getCenterFrequency() const
|
||||
{
|
||||
return m_centerFrequency;
|
||||
return m_settings.m_centerFrequency;
|
||||
}
|
||||
|
||||
void AaroniaRTSAOutput::setCenterFrequency(qint64 centerFrequency)
|
||||
{
|
||||
m_centerFrequency = centerFrequency;
|
||||
AaroniaRTSAOutputSettings settings = m_settings;
|
||||
settings.m_centerFrequency = centerFrequency;
|
||||
|
||||
DSPSignalNotification *notif = new DSPSignalNotification(m_sampleRate, m_centerFrequency); // Frequency in Hz for the DSP engine
|
||||
m_deviceAPI->getDeviceEngineInputMessageQueue()->push(notif);
|
||||
MsgConfigureAaroniaRTSAOutput* message = MsgConfigureAaroniaRTSAOutput::create(settings, QList<QString>{"centerFrequency"}, false);
|
||||
m_inputMessageQueue.push(message);
|
||||
|
||||
if (getMessageQueueToGUI())
|
||||
if (m_guiMessageQueue)
|
||||
{
|
||||
MsgReportSampleRateAndFrequency *msg = MsgReportSampleRateAndFrequency::create(m_sampleRate, m_centerFrequency);
|
||||
getMessageQueueToGUI()->push(msg);
|
||||
MsgConfigureAaroniaRTSAOutput* messageToGUI = MsgConfigureAaroniaRTSAOutput::create(settings, QList<QString>{"centerFrequency"}, false);
|
||||
m_guiMessageQueue->push(messageToGUI);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -139,7 +139,7 @@ public:
|
|||
virtual void setMessageQueueToGUI(MessageQueue *queue);
|
||||
virtual const QString& getDeviceDescription() const;
|
||||
virtual int getSampleRate() const;
|
||||
virtual void setSampleRate(int sampleRate);
|
||||
virtual void setSampleRate(int sampleRate) { (void) sampleRate; }
|
||||
virtual quint64 getCenterFrequency() const;
|
||||
virtual void setCenterFrequency(qint64 centerFrequency);
|
||||
std::time_t getStartingTimeStamp() const;
|
||||
|
@ -182,8 +182,6 @@ private:
|
|||
DeviceAPI *m_deviceAPI;
|
||||
QMutex m_mutex;
|
||||
AaroniaRTSAOutputSettings m_settings;
|
||||
qint64 m_centerFrequency;
|
||||
int m_sampleRate;
|
||||
QString m_deviceDescription;
|
||||
QNetworkAccessManager *m_networkManager;
|
||||
QNetworkRequest m_networkRequest;
|
||||
|
|
|
@ -150,7 +150,7 @@ void AaroniaRTSAOutputWorker::callbackPart(int16_t *buf, SampleVector& data, uns
|
|||
void AaroniaRTSAOutputWorker::postData(QJsonDocument jdoc, int16_t *samplesArray, int nSamples)
|
||||
{
|
||||
QUrl url(tr("http://%1/sample").arg(m_serverAddress));
|
||||
qDebug() << "AaroniaRTSAOutputWorker::postData:" << url;
|
||||
// qDebug() << "AaroniaRTSAOutputWorker::postData:" << url;
|
||||
QNetworkRequest request(url);
|
||||
request.setHeader(QNetworkRequest::ContentTypeHeader, QString("application/json"));
|
||||
QByteArray byteArray = jdoc.toJson(QJsonDocument::Compact);
|
||||
|
|
Ładowanie…
Reference in New Issue