1
0
mirror of https://github.com/f4exb/sdrangel.git synced 2025-06-25 05:25:27 -04:00

UDP Sink: use settings in sink (5)

This commit is contained in:
f4exb 2017-10-17 00:21:19 +02:00
parent b8564edbc9
commit 199d7a054e
2 changed files with 253 additions and 253 deletions

View File

@ -23,7 +23,7 @@
MESSAGE_CLASS_DEFINITION(UDPSink::MsgConfigureUDPSink, Message) MESSAGE_CLASS_DEFINITION(UDPSink::MsgConfigureUDPSink, Message)
MESSAGE_CLASS_DEFINITION(UDPSink::MsgConfigureChannelizer, Message) MESSAGE_CLASS_DEFINITION(UDPSink::MsgConfigureChannelizer, Message)
MESSAGE_CLASS_DEFINITION(UDPSink::MsgUDPSinkConfigure, Message) //MESSAGE_CLASS_DEFINITION(UDPSink::MsgUDPSinkConfigure, Message)
MESSAGE_CLASS_DEFINITION(UDPSink::MsgUDPSinkSpectrum, Message) MESSAGE_CLASS_DEFINITION(UDPSink::MsgUDPSinkSpectrum, Message)
MESSAGE_CLASS_DEFINITION(UDPSink::MsgResetReadIndex, Message) MESSAGE_CLASS_DEFINITION(UDPSink::MsgResetReadIndex, Message)
@ -359,46 +359,46 @@ bool UDPSink::handleMessage(const Message& cmd)
return true; return true;
} }
else if (MsgUDPSinkConfigure::match(cmd)) // else if (MsgUDPSinkConfigure::match(cmd))
{ // {
MsgUDPSinkConfigure& cfg = (MsgUDPSinkConfigure&) cmd; // MsgUDPSinkConfigure& cfg = (MsgUDPSinkConfigure&) cmd;
//
m_config.m_sampleFormat = cfg.getSampleFormat(); // m_config.m_sampleFormat = cfg.getSampleFormat();
m_config.m_inputSampleRate = cfg.getInputSampleRate(); // m_config.m_inputSampleRate = cfg.getInputSampleRate();
m_config.m_rfBandwidth = cfg.getRFBandwidth(); // m_config.m_rfBandwidth = cfg.getRFBandwidth();
m_config.m_fmDeviation = cfg.getFMDeviation(); // m_config.m_fmDeviation = cfg.getFMDeviation();
m_config.m_udpAddressStr = cfg.getUDPAddress(); // m_config.m_udpAddressStr = cfg.getUDPAddress();
m_config.m_udpPort = cfg.getUDPPort(); // m_config.m_udpPort = cfg.getUDPPort();
m_config.m_channelMute = cfg.getChannelMute(); // m_config.m_channelMute = cfg.getChannelMute();
m_config.m_gainIn = cfg.getGainIn(); // m_config.m_gainIn = cfg.getGainIn();
m_config.m_gainOut = cfg.getGainOut(); // m_config.m_gainOut = cfg.getGainOut();
m_config.m_squelch = CalcDb::powerFromdB(cfg.getSquelchDB()); // m_config.m_squelch = CalcDb::powerFromdB(cfg.getSquelchDB());
m_config.m_squelchGate = cfg.getSquelchGate(); // m_config.m_squelchGate = cfg.getSquelchGate();
m_config.m_squelchEnabled = cfg.getSquelchEnabled(); // m_config.m_squelchEnabled = cfg.getSquelchEnabled();
m_config.m_autoRWBalance = cfg.getAutoRWBalance(); // m_config.m_autoRWBalance = cfg.getAutoRWBalance();
m_config.m_stereoInput = cfg.getStereoInput(); // m_config.m_stereoInput = cfg.getStereoInput();
//
//apply(cfg.getForce()); // //apply(cfg.getForce());
//
qDebug() << "UDPSink::handleMessage: MsgUDPSinkConfigure:" // qDebug() << "UDPSink::handleMessage: MsgUDPSinkConfigure:"
<< " m_sampleFormat: " << m_config.m_sampleFormat // << " m_sampleFormat: " << m_config.m_sampleFormat
<< " m_inputSampleRate: " << m_config.m_inputSampleRate // << " m_inputSampleRate: " << m_config.m_inputSampleRate
<< " m_rfBandwidth: " << m_config.m_rfBandwidth // << " m_rfBandwidth: " << m_config.m_rfBandwidth
<< " m_fmDeviation: " << m_config.m_fmDeviation // << " m_fmDeviation: " << m_config.m_fmDeviation
<< " m_udpAddressStr: " << m_config.m_udpAddressStr // << " m_udpAddressStr: " << m_config.m_udpAddressStr
<< " m_udpPort: " << m_config.m_udpPort // << " m_udpPort: " << m_config.m_udpPort
<< " m_channelMute: " << m_config.m_channelMute // << " m_channelMute: " << m_config.m_channelMute
<< " m_gainIn: " << m_config.m_gainIn // << " m_gainIn: " << m_config.m_gainIn
<< " m_gainOut: " << m_config.m_gainOut // << " m_gainOut: " << m_config.m_gainOut
<< " squelchDB: " << cfg.getSquelchDB() // << " squelchDB: " << cfg.getSquelchDB()
<< " m_squelchGate: " << m_config.m_squelchGate // << " m_squelchGate: " << m_config.m_squelchGate
<< " m_squelch: " << m_config.m_squelch // << " m_squelch: " << m_config.m_squelch
<< " m_squelchEnabled: " << m_config.m_squelchEnabled // << " m_squelchEnabled: " << m_config.m_squelchEnabled
<< " m_autoRWBalance: " << m_config.m_autoRWBalance // << " m_autoRWBalance: " << m_config.m_autoRWBalance
<< " m_stereoInput: " << m_config.m_stereoInput; // << " m_stereoInput: " << m_config.m_stereoInput;
//
return true; // return true;
} // }
else if (UDPSinkMessages::MsgSampleRateCorrection::match(cmd)) else if (UDPSinkMessages::MsgSampleRateCorrection::match(cmd))
{ {
UDPSinkMessages::MsgSampleRateCorrection& cfg = (UDPSinkMessages::MsgSampleRateCorrection&) cmd; UDPSinkMessages::MsgSampleRateCorrection& cfg = (UDPSinkMessages::MsgSampleRateCorrection&) cmd;
@ -482,42 +482,42 @@ bool UDPSink::handleMessage(const Message& cmd)
} }
} }
void UDPSink::configure(MessageQueue* messageQueue, //void UDPSink::configure(MessageQueue* messageQueue,
UDPSinkSettings::SampleFormat sampleFormat, // UDPSinkSettings::SampleFormat sampleFormat,
Real inputSampleRate, // Real inputSampleRate,
Real rfBandwidth, // Real rfBandwidth,
int fmDeviation, // int fmDeviation,
Real amModFactor, // Real amModFactor,
const QString& udpAddress, // const QString& udpAddress,
int udpPort, // int udpPort,
bool channelMute, // bool channelMute,
Real gainIn, // Real gainIn,
Real gainOut, // Real gainOut,
Real squelchDB, // Real squelchDB,
Real squelchGate, // Real squelchGate,
bool squelchEnabled, // bool squelchEnabled,
bool autoRWBalance, // bool autoRWBalance,
bool stereoInput, // bool stereoInput,
bool force) // bool force)
{ //{
Message* cmd = MsgUDPSinkConfigure::create(sampleFormat, // Message* cmd = MsgUDPSinkConfigure::create(sampleFormat,
inputSampleRate, // inputSampleRate,
rfBandwidth, // rfBandwidth,
fmDeviation, // fmDeviation,
amModFactor, // amModFactor,
udpAddress, // udpAddress,
udpPort, // udpPort,
channelMute, // channelMute,
gainIn, // gainIn,
gainOut, // gainOut,
squelchDB, // squelchDB,
squelchGate, // squelchGate,
squelchEnabled, // squelchEnabled,
autoRWBalance, // autoRWBalance,
stereoInput, // stereoInput,
force); // force);
messageQueue->push(cmd); // messageQueue->push(cmd);
} //}
void UDPSink::setSpectrum(MessageQueue* messageQueue, bool enabled) void UDPSink::setSpectrum(MessageQueue* messageQueue, bool enabled)
{ {

View File

@ -96,23 +96,23 @@ public:
int32_t getBufferGauge() const { return m_udpHandler.getBufferGauge(); } int32_t getBufferGauge() const { return m_udpHandler.getBufferGauge(); }
bool getSquelchOpen() const { return m_squelchOpen; } bool getSquelchOpen() const { return m_squelchOpen; }
void configure(MessageQueue* messageQueue, // void configure(MessageQueue* messageQueue,
UDPSinkSettings::SampleFormat sampleFormat, // UDPSinkSettings::SampleFormat sampleFormat,
Real inputSampleRate, // Real inputSampleRate,
Real rfBandwidth, // Real rfBandwidth,
int fmDeviation, // int fmDeviation,
Real amModFactor, // Real amModFactor,
const QString& udpAddress, // const QString& udpAddress,
int udpPort, // int udpPort,
bool channelMute, // bool channelMute,
Real gainIn, // Real gainIn,
Real gainOut, // Real gainOut,
Real squelchDB, // Real squelchDB,
Real squelchGate, // Real squelchGate,
bool squelchEnabled, // bool squelchEnabled,
bool autoRWBalance, // bool autoRWBalance,
bool stereoInput, // bool stereoInput,
bool force = false); // bool force = false);
void setSpectrum(MessageQueue* messageQueue, bool enabled); void setSpectrum(MessageQueue* messageQueue, bool enabled);
void resetReadIndex(MessageQueue* messageQueue); void resetReadIndex(MessageQueue* messageQueue);
@ -126,118 +126,118 @@ signals:
void levelChanged(qreal rmsLevel, qreal peakLevel, int numSamples); void levelChanged(qreal rmsLevel, qreal peakLevel, int numSamples);
private: private:
class MsgUDPSinkConfigure : public Message { // class MsgUDPSinkConfigure : public Message {
MESSAGE_CLASS_DECLARATION // MESSAGE_CLASS_DECLARATION
//
public: // public:
UDPSinkSettings::SampleFormat getSampleFormat() const { return m_sampleFormat; } // UDPSinkSettings::SampleFormat getSampleFormat() const { return m_sampleFormat; }
Real getInputSampleRate() const { return m_inputSampleRate; } // Real getInputSampleRate() const { return m_inputSampleRate; }
Real getRFBandwidth() const { return m_rfBandwidth; } // Real getRFBandwidth() const { return m_rfBandwidth; }
int getFMDeviation() const { return m_fmDeviation; } // int getFMDeviation() const { return m_fmDeviation; }
Real getAMModFactor() const { return m_amModFactor; } // Real getAMModFactor() const { return m_amModFactor; }
const QString& getUDPAddress() const { return m_udpAddress; } // const QString& getUDPAddress() const { return m_udpAddress; }
int getUDPPort() const { return m_udpPort; } // int getUDPPort() const { return m_udpPort; }
bool getChannelMute() const { return m_channelMute; } // bool getChannelMute() const { return m_channelMute; }
Real getGainIn() const { return m_gainIn; } // Real getGainIn() const { return m_gainIn; }
Real getGainOut() const { return m_gainOut; } // Real getGainOut() const { return m_gainOut; }
Real getSquelchDB() const { return m_squelchDB; } // Real getSquelchDB() const { return m_squelchDB; }
Real getSquelchGate() const { return m_squelchGate; } // Real getSquelchGate() const { return m_squelchGate; }
bool getSquelchEnabled() const { return m_squelchEnabled; } // bool getSquelchEnabled() const { return m_squelchEnabled; }
bool getForce() const { return m_force; } // bool getForce() const { return m_force; }
bool getAutoRWBalance() const { return m_autoRWBalance; } // bool getAutoRWBalance() const { return m_autoRWBalance; }
bool getStereoInput() const { return m_stereoInput; } // bool getStereoInput() const { return m_stereoInput; }
//
static MsgUDPSinkConfigure* create( // static MsgUDPSinkConfigure* create(
UDPSinkSettings::SampleFormat sampleFormat, // UDPSinkSettings::SampleFormat sampleFormat,
Real inputSampleRate, // Real inputSampleRate,
Real rfBandwidth, // Real rfBandwidth,
int fmDeviation, // int fmDeviation,
Real amModFactor, // Real amModFactor,
const QString& udpAddress, // const QString& udpAddress,
int udpPort, // int udpPort,
bool channelMute, // bool channelMute,
Real gainIn, // Real gainIn,
Real gainOut, // Real gainOut,
Real squelchDB, // Real squelchDB,
Real squelchGate, // Real squelchGate,
bool squelchEnabled, // bool squelchEnabled,
bool autoRWBalance, // bool autoRWBalance,
bool stereoInput, // bool stereoInput,
bool force) // bool force)
{ // {
return new MsgUDPSinkConfigure( // return new MsgUDPSinkConfigure(
sampleFormat, // sampleFormat,
inputSampleRate, // inputSampleRate,
rfBandwidth, // rfBandwidth,
fmDeviation, // fmDeviation,
amModFactor, // amModFactor,
udpAddress, // udpAddress,
udpPort, // udpPort,
channelMute, // channelMute,
gainIn, // gainIn,
gainOut, // gainOut,
squelchDB, // squelchDB,
squelchGate, // squelchGate,
squelchEnabled, // squelchEnabled,
autoRWBalance, // autoRWBalance,
stereoInput, // stereoInput,
force); // force);
} // }
//
private: // private:
UDPSinkSettings::SampleFormat m_sampleFormat; // UDPSinkSettings::SampleFormat m_sampleFormat;
Real m_inputSampleRate; // Real m_inputSampleRate;
Real m_rfBandwidth; // Real m_rfBandwidth;
int m_fmDeviation; // int m_fmDeviation;
Real m_amModFactor; // Real m_amModFactor;
QString m_udpAddress; // QString m_udpAddress;
int m_udpPort; // int m_udpPort;
bool m_channelMute; // bool m_channelMute;
Real m_gainIn; // Real m_gainIn;
Real m_gainOut; // Real m_gainOut;
Real m_squelchDB; // Real m_squelchDB;
Real m_squelchGate; // Real m_squelchGate;
bool m_squelchEnabled; // bool m_squelchEnabled;
bool m_autoRWBalance; // bool m_autoRWBalance;
bool m_stereoInput; // bool m_stereoInput;
bool m_force; // bool m_force;
//
MsgUDPSinkConfigure( // MsgUDPSinkConfigure(
UDPSinkSettings::SampleFormat sampleFormat, // UDPSinkSettings::SampleFormat sampleFormat,
Real inputSampleRate, // Real inputSampleRate,
Real rfBandwidth, // Real rfBandwidth,
int fmDeviation, // int fmDeviation,
Real amModFactor, // Real amModFactor,
const QString& udpAddress, // const QString& udpAddress,
int udpPort, // int udpPort,
bool channelMute, // bool channelMute,
Real gainIn, // Real gainIn,
Real gainOut, // Real gainOut,
Real squelchDB, // Real squelchDB,
Real squelchGate, // Real squelchGate,
bool squelchEnabled, // bool squelchEnabled,
bool autoRWBalance, // bool autoRWBalance,
bool stereoInput, // bool stereoInput,
bool force) : // bool force) :
Message(), // Message(),
m_sampleFormat(sampleFormat), // m_sampleFormat(sampleFormat),
m_inputSampleRate(inputSampleRate), // m_inputSampleRate(inputSampleRate),
m_rfBandwidth(rfBandwidth), // m_rfBandwidth(rfBandwidth),
m_fmDeviation(fmDeviation), // m_fmDeviation(fmDeviation),
m_amModFactor(amModFactor), // m_amModFactor(amModFactor),
m_udpAddress(udpAddress), // m_udpAddress(udpAddress),
m_udpPort(udpPort), // m_udpPort(udpPort),
m_channelMute(channelMute), // m_channelMute(channelMute),
m_gainIn(gainIn), // m_gainIn(gainIn),
m_gainOut(gainOut), // m_gainOut(gainOut),
m_squelchDB(squelchDB), // m_squelchDB(squelchDB),
m_squelchGate(squelchGate), // m_squelchGate(squelchGate),
m_squelchEnabled(squelchEnabled), // m_squelchEnabled(squelchEnabled),
m_autoRWBalance(autoRWBalance), // m_autoRWBalance(autoRWBalance),
m_stereoInput(stereoInput), // m_stereoInput(stereoInput),
m_force(force) // m_force(force)
{ } // { }
}; // };
class MsgUDPSinkSpectrum : public Message { class MsgUDPSinkSpectrum : public Message {
MESSAGE_CLASS_DECLARATION MESSAGE_CLASS_DECLARATION
@ -276,53 +276,53 @@ private:
{ } { }
}; };
struct Config { // struct Config {
int m_basebandSampleRate; // int m_basebandSampleRate;
Real m_outputSampleRate; // Real m_outputSampleRate;
int m_sampleFormat; // int m_sampleFormat;
Real m_inputSampleRate; // Real m_inputSampleRate;
qint64 m_inputFrequencyOffset; // qint64 m_inputFrequencyOffset;
Real m_rfBandwidth; // Real m_rfBandwidth;
Real m_lowCutoff; // Real m_lowCutoff;
int m_fmDeviation; // int m_fmDeviation;
Real m_amModFactor; // Real m_amModFactor;
bool m_channelMute; // bool m_channelMute;
Real m_gainIn; // Real m_gainIn;
Real m_gainOut; // Real m_gainOut;
Real m_squelch; //!< squared magnitude // Real m_squelch; //!< squared magnitude
Real m_squelchGate; //!< seconds // Real m_squelchGate; //!< seconds
bool m_squelchEnabled; // bool m_squelchEnabled;
bool m_autoRWBalance; // bool m_autoRWBalance;
bool m_stereoInput; // bool m_stereoInput;
//
QString m_udpAddressStr; // QString m_udpAddressStr;
quint16 m_udpPort; // quint16 m_udpPort;
//
Config() : // Config() :
m_basebandSampleRate(48000), // m_basebandSampleRate(48000),
m_outputSampleRate(48000), // m_outputSampleRate(48000),
m_sampleFormat(0), // m_sampleFormat(0),
m_inputSampleRate(48000), // m_inputSampleRate(48000),
m_inputFrequencyOffset(0), // m_inputFrequencyOffset(0),
m_rfBandwidth(12500), // m_rfBandwidth(12500),
m_lowCutoff(300), // m_lowCutoff(300),
m_fmDeviation(1.0), // m_fmDeviation(1.0),
m_amModFactor(0.95), // m_amModFactor(0.95),
m_channelMute(false), // m_channelMute(false),
m_gainIn(1.0), // m_gainIn(1.0),
m_gainOut(1.0), // m_gainOut(1.0),
m_squelch(-50.0), // m_squelch(-50.0),
m_squelchGate(0.05), // m_squelchGate(0.05),
m_squelchEnabled(true), // m_squelchEnabled(true),
m_autoRWBalance(true), // m_autoRWBalance(true),
m_stereoInput(false), // m_stereoInput(false),
m_udpAddressStr("127.0.0.1"), // m_udpAddressStr("127.0.0.1"),
m_udpPort(9999) // m_udpPort(9999)
{} // {}
}; // };
//
Config m_config; // Config m_config;
Config m_running; // Config m_running;
UDPSinkSettings m_settings; UDPSinkSettings m_settings;
Real m_squelch; Real m_squelch;