1
0
mirror of https://github.com/f4exb/sdrangel.git synced 2024-09-28 15:56:33 -04:00

SSB Modulator: working... restored file play loop after correction in CW Keyer GUI

This commit is contained in:
f4exb 2016-12-14 02:57:47 +01:00
parent 5000e01063
commit b45ecd2418
5 changed files with 58 additions and 13 deletions

View File

@ -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()

View File

@ -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)
{ }
};

View File

@ -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());
}
}

View File

@ -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);

View File

@ -614,6 +614,23 @@
</property>
</widget>
</item>
<item>
<widget class="ButtonSwitch" name="playLoop">
<property name="toolTip">
<string>Play file in a loop</string>
</property>
<property name="text">
<string>...</string>
</property>
<property name="icon">
<iconset resource="../../../sdrbase/resources/res.qrc">
<normaloff>:/playloop.png</normaloff>:/playloop.png</iconset>
</property>
<property name="checkable">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="ButtonSwitch" name="play">
<property name="toolTip">