mirror of
https://github.com/f4exb/sdrangel.git
synced 2024-11-16 05:11:49 -05:00
AMMod: adapt to MO devices
This commit is contained in:
parent
4aa4f829c6
commit
8123f128b2
@ -35,6 +35,7 @@
|
|||||||
#include "dsp/dspengine.h"
|
#include "dsp/dspengine.h"
|
||||||
#include "dsp/threadedbasebandsamplesource.h"
|
#include "dsp/threadedbasebandsamplesource.h"
|
||||||
#include "dsp/dspcommands.h"
|
#include "dsp/dspcommands.h"
|
||||||
|
#include "dsp/devicesamplemimo.h"
|
||||||
#include "device/deviceapi.h"
|
#include "device/deviceapi.h"
|
||||||
#include "util/db.h"
|
#include "util/db.h"
|
||||||
|
|
||||||
@ -111,6 +112,11 @@ AMMod::~AMMod()
|
|||||||
DSPEngine::instance()->getAudioDeviceManager()->removeAudioSource(&m_audioFifo);
|
DSPEngine::instance()->getAudioDeviceManager()->removeAudioSource(&m_audioFifo);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
uint32_t AMMod::getNumberOfDeviceStreams() const
|
||||||
|
{
|
||||||
|
return m_deviceAPI->getNbSinkStreams();
|
||||||
|
}
|
||||||
|
|
||||||
void AMMod::pull(Sample& sample)
|
void AMMod::pull(Sample& sample)
|
||||||
{
|
{
|
||||||
if (m_settings.m_channelMute)
|
if (m_settings.m_channelMute)
|
||||||
@ -559,6 +565,7 @@ void AMMod::applySettings(const AMModSettings& settings, bool force)
|
|||||||
<< " m_playLoop: " << settings.m_playLoop
|
<< " m_playLoop: " << settings.m_playLoop
|
||||||
<< " m_modAFInput " << settings.m_modAFInput
|
<< " m_modAFInput " << settings.m_modAFInput
|
||||||
<< " m_audioDeviceName: " << settings.m_audioDeviceName
|
<< " m_audioDeviceName: " << settings.m_audioDeviceName
|
||||||
|
<< " m_streamIndex: " << settings.m_streamIndex
|
||||||
<< " m_useReverseAPI: " << settings.m_useReverseAPI
|
<< " m_useReverseAPI: " << settings.m_useReverseAPI
|
||||||
<< " m_reverseAPIAddress: " << settings.m_reverseAPIAddress
|
<< " m_reverseAPIAddress: " << settings.m_reverseAPIAddress
|
||||||
<< " m_reverseAPIAddress: " << settings.m_reverseAPIPort
|
<< " m_reverseAPIAddress: " << settings.m_reverseAPIPort
|
||||||
@ -639,6 +646,25 @@ void AMMod::applySettings(const AMModSettings& settings, bool force)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (m_settings.m_streamIndex != settings.m_streamIndex)
|
||||||
|
{
|
||||||
|
if (m_deviceAPI->getSampleMIMO()) // change of stream is possible for MIMO devices only
|
||||||
|
{
|
||||||
|
m_deviceAPI->removeChannelSourceAPI(this, m_settings.m_streamIndex);
|
||||||
|
m_deviceAPI->removeChannelSource(m_threadedChannelizer, m_settings.m_streamIndex);
|
||||||
|
m_deviceAPI->addChannelSource(m_threadedChannelizer, settings.m_streamIndex);
|
||||||
|
m_deviceAPI->addChannelSourceAPI(this, settings.m_streamIndex);
|
||||||
|
// apply stream sample rate to itself
|
||||||
|
applyChannelSettings(
|
||||||
|
m_basebandSampleRate,
|
||||||
|
m_deviceAPI->getSampleMIMO()->getSinkSampleRate(settings.m_streamIndex),
|
||||||
|
m_inputFrequencyOffset
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
reverseAPIKeys.append("streamIndex");
|
||||||
|
}
|
||||||
|
|
||||||
if (settings.m_useReverseAPI)
|
if (settings.m_useReverseAPI)
|
||||||
{
|
{
|
||||||
bool fullUpdate = ((m_settings.m_useReverseAPI != settings.m_useReverseAPI) && settings.m_useReverseAPI) ||
|
bool fullUpdate = ((m_settings.m_useReverseAPI != settings.m_useReverseAPI) && settings.m_useReverseAPI) ||
|
||||||
|
@ -252,6 +252,7 @@ public:
|
|||||||
SWGSDRangel::SWGChannelSettings& response);
|
SWGSDRangel::SWGChannelSettings& response);
|
||||||
|
|
||||||
double getMagSq() const { return m_magsq; }
|
double getMagSq() const { return m_magsq; }
|
||||||
|
uint32_t getNumberOfDeviceStreams() const;
|
||||||
|
|
||||||
CWKeyer *getCWKeyer() { return &m_cwKeyer; }
|
CWKeyer *getCWKeyer() { return &m_cwKeyer; }
|
||||||
|
|
||||||
|
@ -31,6 +31,7 @@
|
|||||||
#include "gui/crightclickenabler.h"
|
#include "gui/crightclickenabler.h"
|
||||||
#include "gui/audioselectdialog.h"
|
#include "gui/audioselectdialog.h"
|
||||||
#include "gui/basicchannelsettingsdialog.h"
|
#include "gui/basicchannelsettingsdialog.h"
|
||||||
|
#include "gui/devicestreamselectiondialog.h"
|
||||||
#include "mainwindow.h"
|
#include "mainwindow.h"
|
||||||
|
|
||||||
#include "ui_ammodgui.h"
|
#include "ui_ammodgui.h"
|
||||||
@ -317,6 +318,20 @@ void AMModGUI::onMenuDialogCalled(const QPoint &p)
|
|||||||
|
|
||||||
applySettings();
|
applySettings();
|
||||||
}
|
}
|
||||||
|
else if ((m_contextMenuType == ContextMenuStreamSettings) && (m_deviceUISet->m_deviceMIMOEngine))
|
||||||
|
{
|
||||||
|
DeviceStreamSelectionDialog dialog(this);
|
||||||
|
dialog.setNumberOfStreams(m_amMod->getNumberOfDeviceStreams());
|
||||||
|
dialog.setStreamIndex(m_settings.m_streamIndex);
|
||||||
|
dialog.move(p);
|
||||||
|
dialog.exec();
|
||||||
|
|
||||||
|
m_settings.m_streamIndex = dialog.getSelectedStreamIndex();
|
||||||
|
m_channelMarker.clearStreamIndexes();
|
||||||
|
m_channelMarker.addStreamIndex(m_settings.m_streamIndex);
|
||||||
|
displayStreamIndex();
|
||||||
|
applySettings();
|
||||||
|
}
|
||||||
|
|
||||||
resetContextMenuType();
|
resetContextMenuType();
|
||||||
}
|
}
|
||||||
@ -460,9 +475,20 @@ void AMModGUI::displaySettings()
|
|||||||
ui->feedbackVolume->setValue(roundf(m_settings.m_feedbackVolumeFactor * 100.0));
|
ui->feedbackVolume->setValue(roundf(m_settings.m_feedbackVolumeFactor * 100.0));
|
||||||
ui->feedbackVolumeText->setText(QString("%1").arg(m_settings.m_feedbackVolumeFactor, 0, 'f', 2));
|
ui->feedbackVolumeText->setText(QString("%1").arg(m_settings.m_feedbackVolumeFactor, 0, 'f', 2));
|
||||||
|
|
||||||
|
displayStreamIndex();
|
||||||
|
|
||||||
blockApplySettings(false);
|
blockApplySettings(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void AMModGUI::displayStreamIndex()
|
||||||
|
{
|
||||||
|
if (m_deviceUISet->m_deviceMIMOEngine) {
|
||||||
|
setStreamIndicator(tr("%1").arg(m_settings.m_streamIndex));
|
||||||
|
} else {
|
||||||
|
setStreamIndicator("S"); // single channel indicator
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void AMModGUI::leaveEvent(QEvent*)
|
void AMModGUI::leaveEvent(QEvent*)
|
||||||
{
|
{
|
||||||
m_channelMarker.setHighlighted(false);
|
m_channelMarker.setHighlighted(false);
|
||||||
|
@ -83,6 +83,7 @@ private:
|
|||||||
void blockApplySettings(bool block);
|
void blockApplySettings(bool block);
|
||||||
void applySettings(bool force = false);
|
void applySettings(bool force = false);
|
||||||
void displaySettings();
|
void displaySettings();
|
||||||
|
void displayStreamIndex();
|
||||||
void updateWithStreamData();
|
void updateWithStreamData();
|
||||||
void updateWithStreamTime();
|
void updateWithStreamTime();
|
||||||
|
|
||||||
|
@ -45,6 +45,7 @@ void AMModSettings::resetToDefaults()
|
|||||||
m_feedbackAudioDeviceName = AudioDeviceManager::m_defaultDeviceName;
|
m_feedbackAudioDeviceName = AudioDeviceManager::m_defaultDeviceName;
|
||||||
m_feedbackVolumeFactor = 0.5f;
|
m_feedbackVolumeFactor = 0.5f;
|
||||||
m_feedbackAudioEnable = false;
|
m_feedbackAudioEnable = false;
|
||||||
|
m_streamIndex = 0;
|
||||||
m_useReverseAPI = false;
|
m_useReverseAPI = false;
|
||||||
m_reverseAPIAddress = "127.0.0.1";
|
m_reverseAPIAddress = "127.0.0.1";
|
||||||
m_reverseAPIPort = 8888;
|
m_reverseAPIPort = 8888;
|
||||||
@ -84,6 +85,7 @@ QByteArray AMModSettings::serialize() const
|
|||||||
s.writeString(17, m_feedbackAudioDeviceName);
|
s.writeString(17, m_feedbackAudioDeviceName);
|
||||||
s.writeReal(18, m_feedbackVolumeFactor);
|
s.writeReal(18, m_feedbackVolumeFactor);
|
||||||
s.writeBool(19, m_feedbackAudioEnable);
|
s.writeBool(19, m_feedbackAudioEnable);
|
||||||
|
s.writeS32(20, m_streamIndex);
|
||||||
|
|
||||||
return s.final();
|
return s.final();
|
||||||
}
|
}
|
||||||
@ -151,6 +153,7 @@ bool AMModSettings::deserialize(const QByteArray& data)
|
|||||||
d.readString(17, &m_feedbackAudioDeviceName, AudioDeviceManager::m_defaultDeviceName);
|
d.readString(17, &m_feedbackAudioDeviceName, AudioDeviceManager::m_defaultDeviceName);
|
||||||
d.readReal(18, &m_feedbackVolumeFactor, 1.0);
|
d.readReal(18, &m_feedbackVolumeFactor, 1.0);
|
||||||
d.readBool(19, &m_feedbackAudioEnable, false);
|
d.readBool(19, &m_feedbackAudioEnable, false);
|
||||||
|
d.readS32(20, &m_streamIndex, 0);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -49,6 +49,7 @@ struct AMModSettings
|
|||||||
QString m_feedbackAudioDeviceName; //!< This is the audio device you send the audio samples to for audio feedback
|
QString m_feedbackAudioDeviceName; //!< This is the audio device you send the audio samples to for audio feedback
|
||||||
float m_feedbackVolumeFactor;
|
float m_feedbackVolumeFactor;
|
||||||
bool m_feedbackAudioEnable;
|
bool m_feedbackAudioEnable;
|
||||||
|
int m_streamIndex; //!< MIMO channel. Not relevant when connected to SO (single Tx).
|
||||||
bool m_useReverseAPI;
|
bool m_useReverseAPI;
|
||||||
QString m_reverseAPIAddress;
|
QString m_reverseAPIAddress;
|
||||||
uint16_t m_reverseAPIPort;
|
uint16_t m_reverseAPIPort;
|
||||||
|
Loading…
Reference in New Issue
Block a user