UDPSink plugin: added feedback message from UDPSinkUDPHandler to correct sample rate

pull/60/head
f4exb 2017-08-16 04:00:33 +02:00
rodzic b14647c028
commit edcf3a9d63
6 zmienionych plików z 86 dodań i 2 usunięć

Wyświetl plik

@ -5,6 +5,7 @@ set(udpsink_SOURCES
udpsinkgui.cpp
udpsinkplugin.cpp
udpsinkudphandler.cpp
udpsinkmsg.cpp
)
set(udpsink_HEADERS
@ -12,6 +13,7 @@ set(udpsink_HEADERS
udpsinkgui.h
udpsinkplugin.h
udpsinkudphandler.h
udpsinkmsg.h
)
set(udpsink_FORMS

Wyświetl plik

@ -17,6 +17,7 @@
#include <QDebug>
#include "dsp/upchannelizer.h"
#include "udpsinkmsg.h"
#include "udpsink.h"
MESSAGE_CLASS_DEFINITION(UDPSink::MsgUDPSinkConfigure, Message)
@ -31,7 +32,7 @@ UDPSink::UDPSink(MessageQueue* uiMessageQueue, UDPSinkGUI* udpSinkGUI, BasebandS
m_settingsMutex(QMutex::Recursive)
{
setObjectName("UDPSink");
m_udpHandler.setFeedbackMessageQueue(&m_inputMessageQueue);
apply(true);
}
@ -164,6 +165,11 @@ bool UDPSink::handleMessage(const Message& cmd)
return true;
}
else if (UDPSinkMessages::MsgSampleRateCorrection::match(cmd))
{
// TODO
return true;
}
else
{
return false;

Wyświetl plik

@ -0,0 +1,20 @@
///////////////////////////////////////////////////////////////////////////////////
// Copyright (C) 2017 Edouard Griffiths, F4EXB //
// //
// This program is free software; you can redistribute it and/or modify //
// it under the terms of the GNU General Public License as published by //
// the Free Software Foundation as version 3 of the License, or //
// //
// This program is distributed in the hope that it will be useful, //
// but WITHOUT ANY WARRANTY; without even the implied warranty of //
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
// GNU General Public License V3 for more details. //
// //
// You should have received a copy of the GNU General Public License //
// along with this program. If not, see <http://www.gnu.org/licenses/>. //
///////////////////////////////////////////////////////////////////////////////////
#include "udpsinkmsg.h"
MESSAGE_CLASS_DEFINITION(UDPSinkMessages::MsgSampleRateCorrection, Message)

Wyświetl plik

@ -0,0 +1,50 @@
///////////////////////////////////////////////////////////////////////////////////
// Copyright (C) 2017 Edouard Griffiths, F4EXB //
// //
// This program is free software; you can redistribute it and/or modify //
// it under the terms of the GNU General Public License as published by //
// the Free Software Foundation as version 3 of the License, or //
// //
// This program is distributed in the hope that it will be useful, //
// but WITHOUT ANY WARRANTY; without even the implied warranty of //
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
// GNU General Public License V3 for more details. //
// //
// You should have received a copy of the GNU General Public License //
// along with this program. If not, see <http://www.gnu.org/licenses/>. //
///////////////////////////////////////////////////////////////////////////////////
#ifndef PLUGINS_CHANNELTX_UDPSINK_UDPSINKMSG_H_
#define PLUGINS_CHANNELTX_UDPSINK_UDPSINKMSG_H_
#include "util/message.h"
/**
* Message(s) used to communicate back from UDPSinkUDPHandler to UDPSink
*/
class UDPSinkMessages
{
public:
class MsgSampleRateCorrection : public Message {
MESSAGE_CLASS_DECLARATION
public:
float getCorrectionFactor() const { return m_correctionFactor; }
static MsgSampleRateCorrection* create(float correctionFactor)
{
return new MsgSampleRateCorrection(correctionFactor);
}
private:
float m_correctionFactor;
MsgSampleRateCorrection(float correctionFactor) :
Message(),
m_correctionFactor(correctionFactor)
{ }
};
};
#endif /* PLUGINS_CHANNELTX_UDPSINK_UDPSINKMSG_H_ */

Wyświetl plik

@ -28,7 +28,8 @@ UDPSinkUDPHandler::UDPSinkUDPHandler() :
m_writeIndex(0),
m_readFrameIndex(m_nbUDPFrames/2),
m_readIndex(0),
m_rwDelta(m_nbUDPFrames/2)
m_rwDelta(m_nbUDPFrames/2),
m_feedbackMessageQueue(0)
{
}

Wyświetl plik

@ -24,6 +24,8 @@
#include "dsp/dsptypes.h"
class MessageQueue;
class UDPSinkUDPHandler : public QObject
{
Q_OBJECT
@ -39,6 +41,8 @@ public:
void readSample(Real &t);
void readSample(Sample &s);
void setFeedbackMessageQueue(MessageQueue *messageQueue) { m_feedbackMessageQueue = messageQueue; }
/** Get buffer gauge value in % of buffer size ([-50:50])
* [-50:0] : write leads or read lags
* [0:50] : read leads or write lags
@ -71,6 +75,7 @@ private:
int m_readFrameIndex;
int m_readIndex;
int m_rwDelta;
MessageQueue *m_feedbackMessageQueue;
};