mirror of
https://github.com/cjcliffe/CubicSDR.git
synced 2024-09-27 15:56:48 -04:00
Fix to record below-squelch levels as audio silence
This commit is contained in:
parent
be75c62778
commit
1dbfcedcd2
@ -225,9 +225,17 @@ void DemodulatorThread::run() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Capture audioSinkOutputQueue state in a local variable
|
||||||
|
DemodulatorThreadOutputQueuePtr localAudioSinkOutputQueue = nullptr;
|
||||||
|
{
|
||||||
|
std::lock_guard < std::mutex > lock(m_mutexAudioVisOutputQueue);
|
||||||
|
localAudioSinkOutputQueue = audioSinkOutputQueue;
|
||||||
|
}
|
||||||
|
|
||||||
if (audioOutputQueue != nullptr && ati && ati->data.size() && !squelched) {
|
if (audioOutputQueue != nullptr && ati && ati->data.size() && !squelched) {
|
||||||
std::vector<float>::iterator data_i;
|
|
||||||
ati->peak = 0;
|
ati->peak = 0;
|
||||||
|
|
||||||
for (auto data_i : ati->data) {
|
for (auto data_i : ati->data) {
|
||||||
float p = fabs(data_i);
|
float p = fabs(data_i);
|
||||||
if (p > ati->peak) {
|
if (p > ati->peak) {
|
||||||
@ -235,6 +243,16 @@ void DemodulatorThread::run() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (ati) {
|
} else if (ati) {
|
||||||
|
//squelch situation, but recording is on-going, so record "silence" to AudioSink:
|
||||||
|
if (localAudioSinkOutputQueue != nullptr) {
|
||||||
|
|
||||||
|
//Zero the ati samples
|
||||||
|
ati->peak = 0;
|
||||||
|
ati->data.assign(ati->data.size(), 0.0f);
|
||||||
|
|
||||||
|
localAudioSinkOutputQueue->try_push(ati);
|
||||||
|
}
|
||||||
|
|
||||||
ati = nullptr;
|
ati = nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -316,13 +334,6 @@ void DemodulatorThread::run() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Capture audioSinkOutputQueue state in a local
|
|
||||||
DemodulatorThreadOutputQueuePtr localAudioSinkOutputQueue = nullptr;
|
|
||||||
{
|
|
||||||
std::lock_guard < std::mutex > lock(m_mutexAudioVisOutputQueue);
|
|
||||||
localAudioSinkOutputQueue = audioSinkOutputQueue;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (ati != nullptr) {
|
if (ati != nullptr) {
|
||||||
if (!muted.load() && (!wxGetApp().getSoloMode() || (demodInstance == wxGetApp().getDemodMgr().getLastActiveDemodulator().get()))) {
|
if (!muted.load() && (!wxGetApp().getSoloMode() || (demodInstance == wxGetApp().getDemodMgr().getLastActiveDemodulator().get()))) {
|
||||||
//non-blocking push needed for audio out
|
//non-blocking push needed for audio out
|
||||||
@ -334,7 +345,7 @@ void DemodulatorThread::run() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (localAudioSinkOutputQueue != nullptr) {
|
if (localAudioSinkOutputQueue != nullptr) {
|
||||||
if (!audioSinkOutputQueue->try_push(ati)) {
|
if (!localAudioSinkOutputQueue->try_push(ati)) {
|
||||||
std::cout << "DemodulatorThread::run() cannot push ati into audioSinkOutputQueue, is full !" << std::endl;
|
std::cout << "DemodulatorThread::run() cannot push ati into audioSinkOutputQueue, is full !" << std::endl;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user