kopia lustrzana https://github.com/f4exb/sdrangel
FreeDV demod
rodzic
d4a32affc2
commit
f8d367c569
|
@ -172,6 +172,7 @@ FreeDVDemod::FreeDVDemod(DeviceAPI *deviceAPI) :
|
||||||
m_speechOut(0),
|
m_speechOut(0),
|
||||||
m_modIn(0),
|
m_modIn(0),
|
||||||
m_levelInNbSamples(480), // 10ms @ 48 kS/s
|
m_levelInNbSamples(480), // 10ms @ 48 kS/s
|
||||||
|
m_enable(true),
|
||||||
m_settingsMutex(QMutex::Recursive)
|
m_settingsMutex(QMutex::Recursive)
|
||||||
{
|
{
|
||||||
setObjectName(m_channelId);
|
setObjectName(m_channelId);
|
||||||
|
@ -203,6 +204,7 @@ FreeDVDemod::FreeDVDemod(DeviceAPI *deviceAPI) :
|
||||||
|
|
||||||
m_networkManager = new QNetworkAccessManager();
|
m_networkManager = new QNetworkAccessManager();
|
||||||
connect(m_networkManager, SIGNAL(finished(QNetworkReply*)), this, SLOT(networkManagerFinished(QNetworkReply*)));
|
connect(m_networkManager, SIGNAL(finished(QNetworkReply*)), this, SLOT(networkManagerFinished(QNetworkReply*)));
|
||||||
|
connect(&m_timer, SIGNAL(timeout()), this, SLOT(timerHandlerFunction()));
|
||||||
}
|
}
|
||||||
|
|
||||||
FreeDVDemod::~FreeDVDemod()
|
FreeDVDemod::~FreeDVDemod()
|
||||||
|
@ -253,12 +255,23 @@ void FreeDVDemod::configure(MessageQueue* messageQueue,
|
||||||
void FreeDVDemod::feed(const SampleVector::const_iterator& begin, const SampleVector::const_iterator& end, bool positiveOnly)
|
void FreeDVDemod::feed(const SampleVector::const_iterator& begin, const SampleVector::const_iterator& end, bool positiveOnly)
|
||||||
{
|
{
|
||||||
(void) positiveOnly;
|
(void) positiveOnly;
|
||||||
|
|
||||||
|
if (!m_freeDV) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
Complex ci;
|
Complex ci;
|
||||||
fftfilt::cmplx *sideband;
|
fftfilt::cmplx *sideband;
|
||||||
int n_out;
|
int n_out;
|
||||||
|
|
||||||
m_settingsMutex.lock();
|
m_settingsMutex.lock();
|
||||||
|
|
||||||
|
if (!m_enable)
|
||||||
|
{
|
||||||
|
m_settingsMutex.unlock();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
int decim = 1<<(m_spanLog2 - 1);
|
int decim = 1<<(m_spanLog2 - 1);
|
||||||
unsigned char decim_mask = decim - 1; // counter LSB bit mask for decimation by 2^(m_scaleLog2 - 1)
|
unsigned char decim_mask = decim - 1; // counter LSB bit mask for decimation by 2^(m_scaleLog2 - 1)
|
||||||
|
|
||||||
|
@ -639,7 +652,7 @@ void FreeDVDemod::applyFreeDVMode(FreeDVDemodSettings::FreeDVMode mode)
|
||||||
int Rs = freedv_get_modem_symbol_rate(m_freeDV);
|
int Rs = freedv_get_modem_symbol_rate(m_freeDV);
|
||||||
m_freeDVStats.init();
|
m_freeDVStats.init();
|
||||||
|
|
||||||
if (nSpeechSamples != m_nSpeechSamples)
|
if (nSpeechSamples > m_nSpeechSamples)
|
||||||
{
|
{
|
||||||
if (m_speechOut) {
|
if (m_speechOut) {
|
||||||
delete[] m_speechOut;
|
delete[] m_speechOut;
|
||||||
|
@ -649,7 +662,7 @@ void FreeDVDemod::applyFreeDVMode(FreeDVDemodSettings::FreeDVMode mode)
|
||||||
m_nSpeechSamples = nSpeechSamples;
|
m_nSpeechSamples = nSpeechSamples;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (nMaxModemSamples != m_nMaxModemSamples)
|
if (nMaxModemSamples > m_nMaxModemSamples)
|
||||||
{
|
{
|
||||||
if (m_modIn) {
|
if (m_modIn) {
|
||||||
delete[] m_modIn;
|
delete[] m_modIn;
|
||||||
|
@ -679,6 +692,14 @@ void FreeDVDemod::applyFreeDVMode(FreeDVDemodSettings::FreeDVMode mode)
|
||||||
<< " m_nin: " << m_nin
|
<< " m_nin: " << m_nin
|
||||||
<< " FPS: " << m_freeDVStats.m_fps;
|
<< " FPS: " << m_freeDVStats.m_fps;
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
qCritical("FreeDVMod::applyFreeDVMode: m_freeDV was not allocated");
|
||||||
|
}
|
||||||
|
|
||||||
|
m_enable = false;
|
||||||
|
m_timer.setSingleShot(true);
|
||||||
|
m_timer.start(2000);
|
||||||
|
|
||||||
m_settingsMutex.unlock();
|
m_settingsMutex.unlock();
|
||||||
}
|
}
|
||||||
|
@ -1036,3 +1057,8 @@ void FreeDVDemod::networkManagerFinished(QNetworkReply *reply)
|
||||||
answer.chop(1); // remove last \n
|
answer.chop(1); // remove last \n
|
||||||
qDebug("FreeDVDemod::networkManagerFinished: reply:\n%s", answer.toStdString().c_str());
|
qDebug("FreeDVDemod::networkManagerFinished: reply:\n%s", answer.toStdString().c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void FreeDVDemod::timerHandlerFunction()
|
||||||
|
{
|
||||||
|
m_enable = true;
|
||||||
|
}
|
|
@ -20,6 +20,7 @@
|
||||||
|
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
|
#include <QTimer>
|
||||||
#include <QMutex>
|
#include <QMutex>
|
||||||
#include <QNetworkRequest>
|
#include <QNetworkRequest>
|
||||||
|
|
||||||
|
@ -416,6 +417,8 @@ private:
|
||||||
LevelRMS m_levelIn;
|
LevelRMS m_levelIn;
|
||||||
int m_levelInNbSamples;
|
int m_levelInNbSamples;
|
||||||
|
|
||||||
|
QTimer m_timer;
|
||||||
|
bool m_enable;
|
||||||
QMutex m_settingsMutex;
|
QMutex m_settingsMutex;
|
||||||
|
|
||||||
void pushSampleToDV(int16_t sample);
|
void pushSampleToDV(int16_t sample);
|
||||||
|
@ -430,6 +433,7 @@ private:
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void networkManagerFinished(QNetworkReply *reply);
|
void networkManagerFinished(QNetworkReply *reply);
|
||||||
|
void timerHandlerFunction();
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // INCLUDE_FREEDVDEMOD_H
|
#endif // INCLUDE_FREEDVDEMOD_H
|
||||||
|
|
Ładowanie…
Reference in New Issue