diff --git a/plugins/channeltx/modssb/ssbmod.cpp b/plugins/channeltx/modssb/ssbmod.cpp index a0b76024e..dc3183008 100644 --- a/plugins/channeltx/modssb/ssbmod.cpp +++ b/plugins/channeltx/modssb/ssbmod.cpp @@ -126,7 +126,8 @@ void SSBMod::configure(MessageQueue* messageQueue, bool audioBinaural, bool audioFlipChannels, bool dsb, - bool audioMute) + bool audioMute, + bool playLoop) { Message* cmd = MsgConfigureSSBMod::create(bandwidth, lowCutoff, @@ -136,7 +137,8 @@ void SSBMod::configure(MessageQueue* messageQueue, audioBinaural, audioFlipChannels, dsb, - audioMute); + audioMute, + playLoop); messageQueue->push(cmd); } @@ -218,6 +220,15 @@ void SSBMod::pullAF(Complex& sample) // ffplay -f f32le -ar 48k -ac 1 f4exb_call.raw if (m_ifstream.is_open()) { + if (m_ifstream.eof()) + { + if (m_running.m_playLoop) + { + m_ifstream.clear(); + m_ifstream.seekg(0, std::ios::beg); + } + } + if (m_ifstream.eof()) { ci.real(0.0f); @@ -482,6 +493,7 @@ bool SSBMod::handleMessage(const Message& cmd) m_config.m_audioFlipChannels = cfg.getAudioFlipChannels(); m_config.m_dsb = cfg.getDSB(); m_config.m_audioMute = cfg.getAudioMute(); + m_config.m_playLoop = cfg.getPlayLoop(); apply(); @@ -496,7 +508,8 @@ bool SSBMod::handleMessage(const Message& cmd) << " m_audioBinaural: " << m_config.m_audioBinaural << " m_audioFlipChannels: " << m_config.m_audioFlipChannels << " m_dsb: " << m_config.m_dsb - << " m_audioMute: " << m_config.m_audioMute; + << " m_audioMute: " << m_config.m_audioMute + << " m_playLoop: " << m_config.m_playLoop; return true; } @@ -551,9 +564,6 @@ void SSBMod::apply() (m_config.m_audioSampleRate != m_running.m_audioSampleRate)) { m_settingsMutex.lock(); -// m_SSBFilter = new fftfilt(m_config.m_lowCutoff / m_config.m_audioSampleRate, m_config.m_bandwidth / m_config.m_audioSampleRate, m_ssbFftLen); -// m_DSBFilter = new fftfilt((2.0f * m_config.m_bandwidth) / m_config.m_audioSampleRate, 2 * m_ssbFftLen); - m_SSBFilter->create_filter(m_config.m_lowCutoff / m_config.m_audioSampleRate, m_config.m_bandwidth / m_config.m_audioSampleRate); m_DSBFilter->create_dsb_filter((2.0f * m_config.m_bandwidth) / m_config.m_audioSampleRate); m_settingsMutex.unlock(); @@ -619,6 +629,7 @@ void SSBMod::apply() m_running.m_audioFlipChannels = m_config.m_audioFlipChannels; m_running.m_dsb = m_config.m_dsb; m_running.m_audioMute = m_config.m_audioMute; + m_running.m_playLoop = m_config.m_playLoop; } void SSBMod::openFileStream() diff --git a/plugins/channeltx/modssb/ssbmod.h b/plugins/channeltx/modssb/ssbmod.h index 33995cafe..cdf0c8386 100644 --- a/plugins/channeltx/modssb/ssbmod.h +++ b/plugins/channeltx/modssb/ssbmod.h @@ -186,7 +186,8 @@ public: bool audioBinaural, bool audioFlipChannels, bool dsb, - bool audioMute); + bool audioMute, + bool playLoop); virtual void pull(Sample& sample); virtual void start(); @@ -222,6 +223,7 @@ private: bool getAudioFlipChannels() const { return m_audioFlipChannels; } bool getDSB() const { return m_dsb; } bool getAudioMute() const { return m_audioMute; } + bool getPlayLoop() const { return m_playLoop; } static MsgConfigureSSBMod* create(Real bandwidth, Real lowCutoff, @@ -231,7 +233,8 @@ private: bool audioBinaural, bool audioFlipChannels, bool dsb, - bool audioMute) + bool audioMute, + bool playLoop) { return new MsgConfigureSSBMod(bandwidth, lowCutoff, @@ -241,7 +244,8 @@ private: audioBinaural, audioFlipChannels, dsb, - audioMute); + audioMute, + playLoop); } private: @@ -254,6 +258,7 @@ private: bool m_audioFlipChannels; bool m_dsb; bool m_audioMute; + bool m_playLoop; MsgConfigureSSBMod(Real bandwidth, Real lowCutoff, @@ -263,7 +268,8 @@ private: bool audioBinaural, bool audioFlipChannels, bool dsb, - bool audioMute) : + bool audioMute, + bool playLoop) : Message(), m_bandwidth(bandwidth), m_lowCutoff(lowCutoff), @@ -273,7 +279,8 @@ private: m_audioBinaural(audioBinaural), m_audioFlipChannels(audioFlipChannels), m_dsb(dsb), - m_audioMute(audioMute) + m_audioMute(audioMute), + m_playLoop(playLoop) { } }; @@ -304,6 +311,7 @@ private: bool m_audioFlipChannels; bool m_dsb; bool m_audioMute; + bool m_playLoop; Config() : m_outputSampleRate(0), @@ -318,7 +326,8 @@ private: m_audioBinaural(false), m_audioFlipChannels(false), m_dsb(false), - m_audioMute(false) + m_audioMute(false), + m_playLoop(false) { } }; diff --git a/plugins/channeltx/modssb/ssbmodgui.cpp b/plugins/channeltx/modssb/ssbmodgui.cpp index 8fab33a4e..d8652a3c9 100644 --- a/plugins/channeltx/modssb/ssbmodgui.cpp +++ b/plugins/channeltx/modssb/ssbmodgui.cpp @@ -338,9 +338,15 @@ void SSBModGUI::on_volume_valueChanged(int value) void SSBModGUI::on_audioMute_toggled(bool checked) { + qDebug() << "SSBModGUI::on_audioMute_toggled: " << checked << ":" << ui->audioMute->isChecked(); applySettings(); } +void SSBModGUI::on_playLoop_toggled(bool checked) +{ + applySettings(); +} + void SSBModGUI::on_play_toggled(bool checked) { ui->tone->setEnabled(!checked); // release other source inputs @@ -601,7 +607,8 @@ void SSBModGUI::applySettings() ui->audioBinaural->isChecked(), ui->audioFlipChannels->isChecked(), ui->dsb->isChecked(), - ui->audioMute->isChecked()); + ui->audioMute->isChecked(), + ui->playLoop->isChecked()); } } diff --git a/plugins/channeltx/modssb/ssbmodgui.h b/plugins/channeltx/modssb/ssbmodgui.h index d393f7b32..03e2f8968 100644 --- a/plugins/channeltx/modssb/ssbmodgui.h +++ b/plugins/channeltx/modssb/ssbmodgui.h @@ -71,6 +71,7 @@ private slots: void on_toneFrequency_valueChanged(int value); void on_mic_toggled(bool checked); void on_play_toggled(bool checked); + void on_playLoop_toggled(bool checked); void on_morseKeyer_toggled(bool checked); void on_navTimeSlider_valueChanged(int value); diff --git a/plugins/channeltx/modssb/ssbmodgui.ui b/plugins/channeltx/modssb/ssbmodgui.ui index 47f9afde5..d75c0e589 100644 --- a/plugins/channeltx/modssb/ssbmodgui.ui +++ b/plugins/channeltx/modssb/ssbmodgui.ui @@ -614,6 +614,23 @@ + + + + Play file in a loop + + + ... + + + + :/playloop.png:/playloop.png + + + true + + +