mirror of
https://github.com/f4exb/sdrangel.git
synced 2026-08-01 16:38:06 -04:00
TestSink: fixes crash on interpolation change. Fixes #1864
This commit is contained in:
@@ -14,6 +14,8 @@ The top and bottom bars of the device window are described [here](../../../sdrgu
|
||||
|
||||

|
||||
|
||||
Note: the associated spectrum in the independent spectrum window shows the baseband. The interpolated output appears in the attached spectrum view below the settings.
|
||||
|
||||
<h3>1: Start/Stop</h3>
|
||||
|
||||
Device start / stop button.
|
||||
|
||||
@@ -67,7 +67,7 @@ private:
|
||||
int m_lastEngineState;
|
||||
MessageQueue m_inputMessageQueue;
|
||||
SpectrumVis* m_spectrumVis;
|
||||
static const int m_MinimumWidth = 360;
|
||||
static const int m_MinimumWidth = 364;
|
||||
static const int m_MinimumHeight = 200 + 20 + 10 + 4*22 + 5;
|
||||
|
||||
void blockApplySettings(bool block) { m_doApplySettings = !block; }
|
||||
|
||||
@@ -280,13 +280,6 @@
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="Line" name="linePlay2">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
@@ -347,12 +340,6 @@
|
||||
<extends>QToolButton</extends>
|
||||
<header>gui/buttonswitch.h</header>
|
||||
</customwidget>
|
||||
<customwidget>
|
||||
<class>ValueDial</class>
|
||||
<extends>QWidget</extends>
|
||||
<header>gui/valuedial.h</header>
|
||||
<container>1</container>
|
||||
</customwidget>
|
||||
<customwidget>
|
||||
<class>GLSpectrum</class>
|
||||
<extends>QWidget</extends>
|
||||
@@ -365,6 +352,12 @@
|
||||
<header>gui/glspectrumgui.h</header>
|
||||
<container>1</container>
|
||||
</customwidget>
|
||||
<customwidget>
|
||||
<class>ValueDial</class>
|
||||
<extends>QWidget</extends>
|
||||
<header>gui/valuedial.h</header>
|
||||
<container>1</container>
|
||||
</customwidget>
|
||||
</customwidgets>
|
||||
<resources>
|
||||
<include location="../../../sdrgui/resources/res.qrc"/>
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
// Copyright (C) 2019-2020, 2022 Edouard Griffiths, F4EXB <f4exb06@gmail.com> //
|
||||
// Copyright (C) 2019-2026 Edouard Griffiths, F4EXB <f4exb06@gmail.com> //
|
||||
// //
|
||||
// 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 //
|
||||
@@ -65,8 +65,6 @@ void TestSinkOutput::init()
|
||||
|
||||
bool TestSinkOutput::start()
|
||||
{
|
||||
QMutexLocker mutexLocker(&m_mutex);
|
||||
|
||||
if (m_running) {
|
||||
return true;
|
||||
}
|
||||
@@ -94,8 +92,6 @@ bool TestSinkOutput::start()
|
||||
|
||||
void TestSinkOutput::stop()
|
||||
{
|
||||
QMutexLocker mutexLocker(&m_mutex);
|
||||
|
||||
if (!m_running) {
|
||||
return;
|
||||
}
|
||||
@@ -206,8 +202,8 @@ bool TestSinkOutput::handleMessage(const Message& message)
|
||||
void TestSinkOutput::applySettings(const TestSinkSettings& settings, const QList<QString>& settingsKeys, bool force)
|
||||
{
|
||||
qDebug() << "TestSinkOutput::applySettings: force:" << force << settings.getDebugString(settingsKeys, force);
|
||||
QMutexLocker mutexLocker(&m_mutex);
|
||||
bool forwardChange = false;
|
||||
bool needRestart = false;
|
||||
|
||||
if (force || settingsKeys.contains("centerFrequency"))
|
||||
{
|
||||
@@ -218,25 +214,21 @@ void TestSinkOutput::applySettings(const TestSinkSettings& settings, const QList
|
||||
if (force || settingsKeys.contains("sampleRate"))
|
||||
{
|
||||
m_settings.m_sampleRate = settings.m_sampleRate;
|
||||
|
||||
if (m_running) {
|
||||
m_testSinkWorker->setSamplerate(m_settings.m_sampleRate);
|
||||
}
|
||||
|
||||
needRestart = true;
|
||||
forwardChange = true;
|
||||
}
|
||||
|
||||
if (force || settingsKeys.contains("log2Interp"))
|
||||
{
|
||||
m_settings.m_log2Interp = settings.m_log2Interp;
|
||||
|
||||
if (m_running) {
|
||||
m_testSinkWorker->setLog2Interpolation(m_settings.m_log2Interp);
|
||||
}
|
||||
|
||||
needRestart = true;
|
||||
forwardChange = true;
|
||||
}
|
||||
|
||||
if (needRestart && m_running)
|
||||
{
|
||||
stop();
|
||||
start();
|
||||
}
|
||||
if (forwardChange)
|
||||
{
|
||||
qDebug("TestSinkOutput::applySettings: forward: m_centerFrequency: %llu m_sampleRate: %llu m_log2Interp: %d",
|
||||
@@ -275,5 +267,3 @@ int TestSinkOutput::webapiRun(
|
||||
|
||||
return 200;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
// Copyright (C) 2012 maintech GmbH, Otto-Hahn-Str. 15, 97204 Hoechberg, Germany //
|
||||
// written by Christian Daniel //
|
||||
// Copyright (C) 2014 John Greb <hexameron@spam.no> //
|
||||
// Copyright (C) 2015-2020, 2022 Edouard Griffiths, F4EXB <f4exb06@gmail.com> //
|
||||
// Copyright (C) 2015-2020, 2026 Edouard Griffiths, F4EXB <f4exb06@gmail.com> //
|
||||
// //
|
||||
// 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 //
|
||||
@@ -117,7 +117,6 @@ public:
|
||||
|
||||
private:
|
||||
DeviceAPI *m_deviceAPI;
|
||||
QMutex m_mutex;
|
||||
TestSinkSettings m_settings;
|
||||
SpectrumVis m_spectrumVis;
|
||||
std::ofstream m_ofstream;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
// Copyright (C) 2016-2017, 2019-2020 Edouard Griffiths, F4EXB <f4exb06@gmail.com> //
|
||||
// Copyright (C) 2016-2017, 2019-2026 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 //
|
||||
@@ -71,14 +71,6 @@ void TestSinkWorker::setSamplerate(int samplerate)
|
||||
<< " new:" << samplerate
|
||||
<< " old:" << m_samplerate;
|
||||
|
||||
bool wasRunning = false;
|
||||
|
||||
if (m_running)
|
||||
{
|
||||
stopWork();
|
||||
wasRunning = true;
|
||||
}
|
||||
|
||||
// resize sample FIFO
|
||||
if (m_sampleFifo) {
|
||||
m_sampleFifo->resize(SampleSourceFifo::getSizePolicy(samplerate));
|
||||
@@ -87,13 +79,8 @@ void TestSinkWorker::setSamplerate(int samplerate)
|
||||
// resize output buffer
|
||||
if (m_buf) delete[] m_buf;
|
||||
m_buf = new int16_t[samplerate*(1<<m_log2Interpolation)*2];
|
||||
|
||||
m_samplerate = samplerate;
|
||||
m_samplesChunkSize = (m_samplerate * m_throttlems) / 1000;
|
||||
|
||||
if (wasRunning) {
|
||||
startWork();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -109,23 +96,10 @@ void TestSinkWorker::setLog2Interpolation(int log2Interpolation)
|
||||
<< " new:" << log2Interpolation
|
||||
<< " old:" << m_log2Interpolation;
|
||||
|
||||
bool wasRunning = false;
|
||||
|
||||
if (m_running)
|
||||
{
|
||||
stopWork();
|
||||
wasRunning = true;
|
||||
}
|
||||
|
||||
// resize output buffer
|
||||
if (m_buf) delete[] m_buf;
|
||||
m_buf = new int16_t[m_samplerate*(1<<log2Interpolation)*2];
|
||||
|
||||
m_log2Interpolation = log2Interpolation;
|
||||
|
||||
if (wasRunning) {
|
||||
startWork();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user