Skip to content

Commit

Permalink
Merge pull request #673 from drowe67/ms-single-device-filter
Browse files Browse the repository at this point in the history
Fix bug where FreeDV crashes if only RX sound devices are configured with mic filters turned on.
  • Loading branch information
tmiw authored Jan 27, 2024
2 parents 9cda957 + 54a9876 commit d205dc7
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 7 deletions.
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

0 comments on commit d205dc7

Please sign in to comment.