mirror of
https://github.com/eried/portapack-mayhem.git
synced 2025-08-03 20:24:13 -04:00
Add second pocsag proc for experimenting (#1428)
This commit is contained in:
parent
900086c1c9
commit
5d602ece5c
10 changed files with 820 additions and 30 deletions
|
@ -3,6 +3,7 @@
|
|||
* Copyright (C) 2012-2014 Elias Oenal (multimon-ng@eliasoenal.com)
|
||||
* Copyright (C) 2015 Jared Boone, ShareBrained Technology, Inc.
|
||||
* Copyright (C) 2016 Furrtek
|
||||
* Copyright (C) 2016 Kyle Reed
|
||||
*
|
||||
* This file is part of PortaPack.
|
||||
*
|
||||
|
@ -41,16 +42,29 @@ void POCSAGProcessor::execute(const buffer_c8_t& buffer) {
|
|||
const auto channel_out = channel_filter.execute(decim_1_out, dst_buffer);
|
||||
auto audio = demod.execute(channel_out, audio_buffer);
|
||||
|
||||
// When use_squelch_ is true, AudioOutput applies filters
|
||||
// which should eliminate the need to do this smoothing.
|
||||
if (use_squelch_ == false)
|
||||
smooth.Process(audio.p, audio.count);
|
||||
|
||||
// NB: This applies audio filters in-place when use_squelch_ is true.
|
||||
audio_output.write(audio);
|
||||
// If squelching, check for audio before smoothing because smoothing
|
||||
// causes the squelch noise detection to fail. Likely because squelch
|
||||
// looks for HF noise and smoothing is basically a lowpass filter.
|
||||
// NB: Squelch in this processor is only for the the audio output.
|
||||
// Squelching will likely drop data "noise" and break processing.
|
||||
if (squelch_.enabled()) {
|
||||
bool has_audio = squelch_.execute(audio);
|
||||
squelch_history = (squelch_history << 1) | (has_audio ? 1 : 0);
|
||||
}
|
||||
|
||||
smooth.Process(audio.p, audio.count);
|
||||
processDemodulatedSamples(audio.p, 16);
|
||||
extractFrames();
|
||||
|
||||
// Clear the output before sending to audio chip.
|
||||
// Only clear the audio buffer when there hasn't been any audio for a while.
|
||||
if (squelch_.enabled() && squelch_history == 0) {
|
||||
for (size_t i = 0; i < audio.count; ++i) {
|
||||
audio.p[i] = 0.0;
|
||||
}
|
||||
}
|
||||
|
||||
audio_output.write(audio);
|
||||
}
|
||||
|
||||
// ====================================================================
|
||||
|
@ -83,13 +97,7 @@ void POCSAGProcessor::on_message(const Message* const message) {
|
|||
|
||||
case Message::ID::NBFMConfigure: {
|
||||
auto config = reinterpret_cast<const NBFMConfigureMessage*>(message);
|
||||
|
||||
use_squelch_ = config->squelch_level > 0;
|
||||
audio_output.configure(
|
||||
audio_24k_hpf_300hz_config,
|
||||
audio_24k_lpf_2400hz_config,
|
||||
config->squelch_level / 100.0);
|
||||
audio_output.configure(use_squelch_);
|
||||
squelch_.set_threshold(config->squelch_level / 100.0);
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -119,6 +127,9 @@ void POCSAGProcessor::configure() {
|
|||
// 24k / 3.2k = 7.5
|
||||
smooth.SetSize(8);
|
||||
|
||||
// Don't have audio process the stream.
|
||||
audio_output.configure(false);
|
||||
|
||||
// Set up the frame extraction, limits of baud
|
||||
setFrameExtractParams(demod_input_fs, 4000, 300, 32);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue