Browse Source

AM, M17, NFM, SSB, WFM: Fix audio feedback when sample is different from output. #710

chirpmodem-v8.0.0
Jon Beniston 2 months ago
parent
commit
3f22f01330
  1. 6
      plugins/channeltx/modam/ammodsource.cpp
  2. 6
      plugins/channeltx/modm17/m17modsource.cpp
  3. 3
      plugins/channeltx/modnfm/nfmmod.cpp
  4. 6
      plugins/channeltx/modnfm/nfmmod.h
  5. 9
      plugins/channeltx/modnfm/nfmmodsource.cpp
  6. 2
      plugins/channeltx/modnfm/nfmmodsource.h
  7. 1
      plugins/channeltx/modnfm/nfmmodwebapiadapter.cpp
  8. 6
      plugins/channeltx/modssb/ssbmodsource.cpp
  9. 6
      plugins/channeltx/modwfm/wfmmodsource.cpp

6
plugins/channeltx/modam/ammodsource.cpp

@ -343,10 +343,12 @@ void AMModSource::applyFeedbackAudioSampleRate(int sampleRate) @@ -343,10 +343,12 @@ void AMModSource::applyFeedbackAudioSampleRate(int sampleRate)
qDebug("AMModSource::applyFeedbackAudioSampleRate: %u", sampleRate);
// Resample from the audio input rate to the feedback device rate. The distance is
// input samples per output sample and the filter is designed at the input rate.
m_feedbackInterpolatorDistanceRemain = 0;
m_feedbackInterpolatorDistance = (Real) sampleRate / (Real) m_audioSampleRate;
m_feedbackInterpolatorDistance = (Real) m_audioSampleRate / (Real) sampleRate;
Real cutoff = ((float) std::min(sampleRate, m_audioSampleRate)) / 2.2f;
m_feedbackInterpolator.create(48, sampleRate, cutoff, 3.0);
m_feedbackInterpolator.create(48, m_audioSampleRate, cutoff, 3.0);
m_feedbackAudioSampleRate = sampleRate;
}

6
plugins/channeltx/modm17/m17modsource.cpp

@ -518,11 +518,13 @@ void M17ModSource::applyFeedbackAudioSampleRate(int sampleRate) @@ -518,11 +518,13 @@ void M17ModSource::applyFeedbackAudioSampleRate(int sampleRate)
qDebug("NFMModSource::applyFeedbackAudioSampleRate: %d", sampleRate);
// Resample from the audio input rate to the feedback device rate. The distance is
// input samples per output sample and the filter is designed at the input rate.
m_feedbackInterpolatorDistanceRemain = 0;
m_feedbackInterpolatorConsumed = false;
m_feedbackInterpolatorDistance = (Real) sampleRate / (Real) m_audioSampleRate;
m_feedbackInterpolatorDistance = (Real) m_audioSampleRate / (Real) sampleRate;
Real cutoff = std::min(sampleRate, m_audioSampleRate) / 2.2f;
m_feedbackInterpolator.create(48, sampleRate, cutoff, 3.0);
m_feedbackInterpolator.create(48, m_audioSampleRate, cutoff, 3.0);
m_feedbackAudioSampleRate = sampleRate;
}

3
plugins/channeltx/modnfm/nfmmod.cpp

@ -17,7 +17,6 @@ @@ -17,7 +17,6 @@
// along with this program. If not, see <http://www.gnu.org/licenses/>. //
///////////////////////////////////////////////////////////////////////////////////
#include <QTime>
#include <QDebug>
#include <QMutexLocker>
#include <QNetworkAccessManager>
@ -31,8 +30,6 @@ @@ -31,8 +30,6 @@
#include "SWGChannelReport.h"
#include "SWGNFMModReport.h"
#include <stdio.h>
#include <complex.h>
#include <algorithm>
#include "dsp/dspcommands.h"

6
plugins/channeltx/modnfm/nfmmod.h

@ -248,11 +248,6 @@ public: @@ -248,11 +248,6 @@ public:
static const char* const m_channelId;
private:
enum RateState {
RSInitialFill,
RSRunning
};
DeviceAPI* m_deviceAPI;
QThread *m_thread;
bool m_running = false;
@ -261,7 +256,6 @@ private: @@ -261,7 +256,6 @@ private:
int m_basebandSampleRate;
qint64 m_centerFrequency;
SampleVector m_sampleBuffer;
QRecursiveMutex m_settingsMutex;
std::ifstream m_ifstream;

9
plugins/channeltx/modnfm/nfmmodsource.cpp

@ -364,7 +364,6 @@ void NFMModSource::applyAudioSampleRate(int sampleRate) @@ -364,7 +364,6 @@ void NFMModSource::applyAudioSampleRate(int sampleRate)
qDebug("NFMModSource::applyAudioSampleRate: %d", sampleRate);
m_interpolatorDistanceRemain = 0;
m_interpolatorConsumed = false;
m_interpolatorDistance = (Real) sampleRate / (Real) m_channelSampleRate;
m_interpolator.create(48, sampleRate, m_settings.m_rfBandwidth / 2.2, 3.0);
m_lowpass.create(301, sampleRate, m_settings.m_afBandwidth);
@ -409,11 +408,12 @@ void NFMModSource::applyFeedbackAudioSampleRate(int sampleRate) @@ -409,11 +408,12 @@ void NFMModSource::applyFeedbackAudioSampleRate(int sampleRate)
qDebug("NFMModSource::applyFeedbackAudioSampleRate: %d", sampleRate);
// Resample from the audio input rate to the feedback device rate. The distance is
// input samples per output sample and the filter is designed at the input rate.
m_feedbackInterpolatorDistanceRemain = 0;
m_feedbackInterpolatorConsumed = false;
m_feedbackInterpolatorDistance = (Real) sampleRate / (Real) m_audioSampleRate;
m_feedbackInterpolatorDistance = (Real) m_audioSampleRate / (Real) sampleRate;
Real cutoff = (float) std::min(sampleRate, m_audioSampleRate) / 2.2f;
m_feedbackInterpolator.create(48, sampleRate, cutoff, 3.0);
m_feedbackInterpolator.create(48, m_audioSampleRate, cutoff, 3.0);
m_feedbackAudioSampleRate = sampleRate;
}
@ -474,7 +474,6 @@ void NFMModSource::applyChannelSettings(int channelSampleRate, int channelFreque @@ -474,7 +474,6 @@ void NFMModSource::applyChannelSettings(int channelSampleRate, int channelFreque
if ((channelSampleRate != m_channelSampleRate) || force)
{
m_interpolatorDistanceRemain = 0;
m_interpolatorConsumed = false;
m_interpolatorDistance = (Real) m_audioSampleRate / (Real) channelSampleRate;
m_interpolator.create(48, m_audioSampleRate, m_settings.m_rfBandwidth / 2.2, 3.0);
}

2
plugins/channeltx/modnfm/nfmmodsource.h

@ -88,12 +88,10 @@ private: @@ -88,12 +88,10 @@ private:
Interpolator m_interpolator;
Real m_interpolatorDistance;
Real m_interpolatorDistanceRemain;
bool m_interpolatorConsumed;
Interpolator m_feedbackInterpolator;
Real m_feedbackInterpolatorDistance;
Real m_feedbackInterpolatorDistanceRemain;
bool m_feedbackInterpolatorConsumed;
QVector<qint16> m_demodBuffer;
int m_demodBufferFill;

1
plugins/channeltx/modnfm/nfmmodwebapiadapter.cpp

@ -59,7 +59,6 @@ int NFMModWebAPIAdapter::webapiSettingsPutPatch( @@ -59,7 +59,6 @@ int NFMModWebAPIAdapter::webapiSettingsPutPatch(
SWGSDRangel::SWGCWKeyerSettings *apiCwKeyerSettings = response.getNfmModSettings()->getCwKeyer();
CWKeyer::webapiSettingsPutPatch(channelSettingsKeys, newCWKeyerSettings, apiCwKeyerSettings);
m_settings.setCWKeyerSettings(newCWKeyerSettings);
const QByteArray& serializedNewSettings = m_settings.serialize(); // effectively update CW keyer settings
}
NFMMod::webapiFormatChannelSettings(response, m_settings);

6
plugins/channeltx/modssb/ssbmodsource.cpp

@ -644,11 +644,13 @@ void SSBModSource::applyFeedbackAudioSampleRate(int sampleRate) @@ -644,11 +644,13 @@ void SSBModSource::applyFeedbackAudioSampleRate(int sampleRate)
qDebug("SSBModSource::applyFeedbackAudioSampleRate: %d", sampleRate);
// Resample from the audio input rate to the feedback device rate. The distance is
// input samples per output sample and the filter is designed at the input rate.
m_feedbackInterpolatorDistanceRemain = 0;
m_feedbackInterpolatorConsumed = false;
m_feedbackInterpolatorDistance = (Real) sampleRate / (Real) m_audioSampleRate;
m_feedbackInterpolatorDistance = (Real) m_audioSampleRate / (Real) sampleRate;
Real cutoff = (float) (std::min(sampleRate, m_audioSampleRate)) / 2.2f;
m_feedbackInterpolator.create(48, sampleRate, cutoff, 3.0);
m_feedbackInterpolator.create(48, m_audioSampleRate, cutoff, 3.0);
m_feedbackAudioSampleRate = sampleRate;
}

6
plugins/channeltx/modwfm/wfmmodsource.cpp

@ -398,11 +398,13 @@ void WFMModSource::applyFeedbackAudioSampleRate(int sampleRate) @@ -398,11 +398,13 @@ void WFMModSource::applyFeedbackAudioSampleRate(int sampleRate)
qDebug("WFMModSource::applyFeedbackAudioSampleRate: %d", sampleRate);
// Resample from the audio input rate to the feedback device rate. The distance is
// input samples per output sample and the filter is designed at the input rate.
m_feedbackInterpolatorDistanceRemain = 0;
m_feedbackInterpolatorConsumed = false;
m_feedbackInterpolatorDistance = (Real) sampleRate / (Real) m_audioSampleRate;
m_feedbackInterpolatorDistance = (Real) m_audioSampleRate / (Real) sampleRate;
Real cutoff = std::min(sampleRate, m_audioSampleRate) / 2.2f;
m_feedbackInterpolator.create(48, sampleRate, cutoff, 3.0);
m_feedbackInterpolator.create(48, m_audioSampleRate, cutoff, 3.0);
m_feedbackAudioSampleRate = sampleRate;
}

Loading…
Cancel
Save