1
0
mirror of https://github.com/f4exb/sdrangel.git synced 2026-08-14 15:33:34 -04:00

Don't stop source if being deleted. For #2315. Send DSPSignalNotification in audio mods for #2336.

This commit is contained in:
srcejon
2024-11-25 17:16:08 +00:00
parent d0cae88ba8
commit a91fa3b760
73 changed files with 228 additions and 166 deletions
+12 -5
View File
@@ -55,7 +55,9 @@ const char* const AMMod::m_channelId ="AMMod";
AMMod::AMMod(DeviceAPI *deviceAPI) :
ChannelAPI(m_channelIdURI, ChannelAPI::StreamSingleSource),
m_deviceAPI(deviceAPI)
m_deviceAPI(deviceAPI),
m_basebandSampleRate(0),
m_centerFrequency(0)
{
setObjectName(m_channelId);
applySettings(m_settings, true);
@@ -82,9 +84,8 @@ AMMod::~AMMod()
);
delete m_networkManager;
m_deviceAPI->removeChannelSourceAPI(this);
m_deviceAPI->removeChannelSource(this);
AMMod::stop();
m_deviceAPI->removeChannelSource(this, true);
stop();
}
void AMMod::setDeviceAPI(DeviceAPI *deviceAPI)
@@ -92,7 +93,7 @@ void AMMod::setDeviceAPI(DeviceAPI *deviceAPI)
if (deviceAPI != m_deviceAPI)
{
m_deviceAPI->removeChannelSourceAPI(this);
m_deviceAPI->removeChannelSource(this);
m_deviceAPI->removeChannelSource(this, false);
m_deviceAPI = deviceAPI;
m_deviceAPI->addChannelSource(this);
m_deviceAPI->addChannelSinkAPI(this);
@@ -134,6 +135,9 @@ void AMMod::start()
m_thread->start();
DSPSignalNotification *dspMsg = new DSPSignalNotification(m_basebandSampleRate, m_centerFrequency);
m_basebandSource->getInputMessageQueue()->push(dspMsg);
AMModBaseband::MsgConfigureAMModBaseband *msg = AMModBaseband::MsgConfigureAMModBaseband::create(m_settings, true);
m_basebandSource->getInputMessageQueue()->push(msg);
@@ -237,6 +241,9 @@ bool AMMod::handleMessage(const Message& cmd)
// Forward to the source
auto& notif = (const DSPSignalNotification&) cmd;
m_centerFrequency = notif.getCenterFrequency();
m_basebandSampleRate = notif.getSampleRate();
if (m_running) {
m_basebandSource->getInputMessageQueue()->push(new DSPSignalNotification(notif));
}