Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix bug where FreeDV crashes if only RX sound devices are configured with mic filters turned on. #673

Merged
merged 2 commits into from
Jan 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions USER_MANUAL.md
Original file line number Diff line number Diff line change
Expand Up @@ -897,6 +897,7 @@ LDPC | Low Density Parity Check Codes - a family of powerful FEC codes
* Fix issue preventing errors from being displayed for issues involving the FreeDV->Speaker sound device. (PR #668)
* Fix issue resulting in incorrect audio device usage after validation failure if no valid default exists. (PR #668)
* Fix bug where PTT button background color doesn't change when toggling PTT via space bar. (PR #669)
* Fix bug where FreeDV crashes if only RX sound devices are configured with mic filters turned on. (PR #673)
2. Enhancements:
* Add Frequency column to RX drop-down. (PR #663)
* Update tooltip for the free form text field to indicate that it's not covered by FEC. (PR #665)
Expand Down
4 changes: 3 additions & 1 deletion src/eq.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@

#include "main.h"

extern int g_nSoundCards;

#define SBQ_MAX_ARGS 5

void *MainFrame::designAnEQFilter(const char filterType[], float freqHz, float gaindB, float Q, int sampleRate)
Expand Down Expand Up @@ -59,7 +61,7 @@ void *MainFrame::designAnEQFilter(const char filterType[], float freqHz, float g
void MainFrame::designEQFilters(paCallBackData *cb, int rxSampleRate, int txSampleRate)
{
// init Mic In Equaliser Filters
if (cb->micInEQEnable) {
if (cb->micInEQEnable && g_nSoundCards > 1) {
assert(cb->sbqMicInBass == nullptr && cb->sbqMicInTreble == nullptr && cb->sbqMicInMid == nullptr);
//printf("designing new Min In filters\n");
cb->sbqMicInBass = designAnEQFilter("bass", wxGetApp().appConfiguration.filterConfiguration.micInChannel.bassFreqHz, wxGetApp().appConfiguration.filterConfiguration.micInChannel.bassGaindB, txSampleRate);
Expand Down
21 changes: 15 additions & 6 deletions src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1532,8 +1532,7 @@ void MainFrame::OnTimer(wxTimerEvent &evt)
{
if (g_nSoundCards == 1)
{
// RX In isn't used here but we need to provide it anyway.
designEQFilters(g_rxUserdata, wxGetApp().appConfiguration.audioConfiguration.soundCard1Out.sampleRate, wxGetApp().appConfiguration.audioConfiguration.soundCard1In.sampleRate);
designEQFilters(g_rxUserdata, wxGetApp().appConfiguration.audioConfiguration.soundCard1Out.sampleRate, 0);
}
else
{
Expand Down Expand Up @@ -2696,10 +2695,20 @@ void MainFrame::startRxStream()
wxGetApp().appConfiguration.filterConfiguration.micInChannel.eqEnable ||
wxGetApp().appConfiguration.filterConfiguration.spkOutChannel.eqEnable)
{
designEQFilters(
g_rxUserdata,
wxGetApp().appConfiguration.audioConfiguration.soundCard2Out.sampleRate,
wxGetApp().appConfiguration.audioConfiguration.soundCard2In.sampleRate);
if (g_nSoundCards == 1)
{
designEQFilters(
g_rxUserdata,
wxGetApp().appConfiguration.audioConfiguration.soundCard1Out.sampleRate,
0);
}
else
{
designEQFilters(
g_rxUserdata,
wxGetApp().appConfiguration.audioConfiguration.soundCard2Out.sampleRate,
wxGetApp().appConfiguration.audioConfiguration.soundCard2In.sampleRate);
}
}

m_newMicInFilter = m_newSpkOutFilter = false;
Expand Down
Loading