Skip to content

Commit

Permalink
Move misc. audio settings.
Browse files Browse the repository at this point in the history
  • Loading branch information
tmiw committed Jul 2, 2023
1 parent 4253b4f commit 9b4467c
Show file tree
Hide file tree
Showing 6 changed files with 22 additions and 15 deletions.
10 changes: 10 additions & 0 deletions src/config/FreeDVConfiguration.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,10 @@ FreeDVConfiguration::FreeDVConfiguration()
, soundCard2InSampleRate("/Audio/soundCard2InSampleRate", -1)
, soundCard2OutDeviceName("/Audio/soundCard2OutDeviceName", "none")
, soundCard2OutSampleRate("/Audio/soundCard2OutSampleRate", -1)

/* Misc. audio settings */
, fifoSizeMs("/Audio/fifoSize_ms", (int)FIFO_SIZE)
, transmitLevel("/Audio/transmitLevel", 0)
{
// empty
}
Expand Down Expand Up @@ -84,6 +88,9 @@ void FreeDVConfiguration::load(wxConfigBase* config)
load_(config, soundCard2InSampleRate);
load_(config, soundCard2OutDeviceName);
load_(config, soundCard2OutSampleRate);

load_(config, fifoSizeMs);
load_(config, transmitLevel);
}

void FreeDVConfiguration::save(wxConfigBase* config)
Expand All @@ -110,5 +117,8 @@ void FreeDVConfiguration::save(wxConfigBase* config)
save_(config, soundCard2OutDeviceName);
save_(config, soundCard2OutSampleRate);

save_(config, fifoSizeMs);
save_(config, transmitLevel);

config->Flush();
}
3 changes: 3 additions & 0 deletions src/config/FreeDVConfiguration.h
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,9 @@ class FreeDVConfiguration
ConfigurationDataElement<wxString> soundCard2OutDeviceName;
ConfigurationDataElement<int> soundCard2OutSampleRate;

ConfigurationDataElement<int> fifoSizeMs;
ConfigurationDataElement<int> transmitLevel;

void load(wxConfigBase* config);
void save(wxConfigBase* config);

Expand Down
4 changes: 2 additions & 2 deletions src/dlg_options.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -667,7 +667,7 @@ void OptionsDlg::ExchangeData(int inout, bool storePersistent)
m_ckboxAttnCarrierEn->SetValue(wxGetApp().m_attn_carrier_en);
m_txtAttnCarrier->SetValue(wxString::Format(wxT("%i"),wxGetApp().m_attn_carrier));

m_txtCtrlFifoSize->SetValue(wxString::Format(wxT("%i"),wxGetApp().m_fifoSize_ms));
m_txtCtrlFifoSize->SetValue(wxString::Format(wxT("%i"),wxGetApp().appConfiguration.fifoSizeMs.get()));

m_ckboxTxRxThreadPriority->SetValue(wxGetApp().m_txRxThreadHighPriority);
m_ckboxTxRxDumpTiming->SetValue(g_dump_timing);
Expand Down Expand Up @@ -803,7 +803,7 @@ void OptionsDlg::ExchangeData(int inout, bool storePersistent)

long FifoSize_ms;
m_txtCtrlFifoSize->GetValue().ToLong(&FifoSize_ms);
wxGetApp().m_fifoSize_ms = (int)FifoSize_ms;
wxGetApp().appConfiguration.fifoSizeMs = (int)FifoSize_ms;

wxGetApp().m_txRxThreadHighPriority = m_ckboxTxRxThreadPriority->GetValue();
g_dump_timing = m_ckboxTxRxDumpTiming->GetValue();
Expand Down
16 changes: 6 additions & 10 deletions src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -388,10 +388,8 @@ void MainFrame::loadConfiguration_()
if (h < size.GetHeight()) h = size.GetHeight();
SetClientSize(w, h);
SetSizeHints(size);

wxGetApp().m_fifoSize_ms = pConfig->Read(wxT("/Audio/fifoSize_ms"), (int)FIFO_SIZE);

g_txLevel = pConfig->Read(wxT("/Audio/transmitLevel"), (int)0);
g_txLevel = wxGetApp().appConfiguration.transmitLevel;
char fmt[15];
m_sliderTxLevel->SetValue(g_txLevel);
snprintf(fmt, 15, "%0.1f dB", (double)g_txLevel / 10.0);
Expand Down Expand Up @@ -911,9 +909,7 @@ MainFrame::~MainFrame()
wxGetApp().appConfiguration.squelchActive = g_SquelchActive;
wxGetApp().appConfiguration.squelchLevel = (int)(g_SquelchLevel*2.0);

pConfig->Write(wxT("/Audio/fifoSize_ms"), wxGetApp().m_fifoSize_ms);

pConfig->Write(wxT("/Audio/transmitLevel"), g_txLevel);
wxGetApp().appConfiguration.transmitLevel = g_txLevel;

pConfig->Write(wxT("/VoiceKeyer/WaveFilePath"), wxGetApp().m_txtVoiceKeyerWaveFilePath);
pConfig->Write(wxT("/VoiceKeyer/WaveFile"), wxGetApp().m_txtVoiceKeyerWaveFile);
Expand Down Expand Up @@ -1945,7 +1941,7 @@ void MainFrame::performFreeDVOn_()
g_sfTxFs = FS;

wxGetApp().m_prevMode = g_mode;
freedvInterface.start(g_mode, wxGetApp().m_fifoSize_ms, !wxGetApp().m_boolMultipleRx || wxGetApp().m_boolSingleRxThread, wxGetApp().m_reportingEnabled);
freedvInterface.start(g_mode, wxGetApp().appConfiguration.fifoSizeMs, !wxGetApp().m_boolMultipleRx || wxGetApp().m_boolSingleRxThread, wxGetApp().m_reportingEnabled);

// Codec 2 VQ Equaliser
freedvInterface.setEq(wxGetApp().m_700C_EQ);
Expand Down Expand Up @@ -2651,7 +2647,7 @@ void MainFrame::startRxStream()
// transmit processng are all performed in the tx/rxProcessing
// loop.

int m_fifoSize_ms = wxGetApp().m_fifoSize_ms;
int m_fifoSize_ms = wxGetApp().appConfiguration.fifoSizeMs;
int soundCard1InFifoSizeSamples = m_fifoSize_ms*wxGetApp().appConfiguration.soundCard1InSampleRate/1000;
int soundCard1OutFifoSizeSamples = m_fifoSize_ms*wxGetApp().appConfiguration.soundCard1OutSampleRate/1000;
g_rxUserdata->infifo1 = codec2_fifo_create(soundCard1InFifoSizeSamples);
Expand All @@ -2665,11 +2661,11 @@ void MainFrame::startRxStream()
g_rxUserdata->infifo2 = codec2_fifo_create(soundCard2InFifoSizeSamples);

if (g_verbose) fprintf(stderr, "fifoSize_ms: %d infifo2: %d/outfilo2: %d\n",
wxGetApp().m_fifoSize_ms, soundCard2InFifoSizeSamples, soundCard2OutFifoSizeSamples);
wxGetApp().appConfiguration.fifoSizeMs.get(), soundCard2InFifoSizeSamples, soundCard2OutFifoSizeSamples);
}

if (g_verbose) fprintf(stderr, "fifoSize_ms: %d infifo1: %d/outfilo1 %d\n",
wxGetApp().m_fifoSize_ms, soundCard1InFifoSizeSamples, soundCard1OutFifoSizeSamples);
wxGetApp().appConfiguration.fifoSizeMs.get(), soundCard1InFifoSizeSamples, soundCard1OutFifoSizeSamples);

// reset debug stats for FIFOs

Expand Down
2 changes: 0 additions & 2 deletions src/main.h
Original file line number Diff line number Diff line change
Expand Up @@ -266,8 +266,6 @@ class MainApp : public wxApp

wxRect m_rTopWindow;

int m_fifoSize_ms;

// General reporting configuration
bool m_reportingEnabled;
wxString m_reportingCallsign;
Expand Down
2 changes: 1 addition & 1 deletion src/ongui.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -366,7 +366,7 @@ void MainFrame::OnChangeTxLevel( wxScrollEvent& event )
wxString fmtString(fmt);
m_txtTxLevelNum->SetLabel(fmtString);

pConfig->Write(wxT("/Audio/transmitLevel"), g_txLevel);
wxGetApp().appConfiguration.transmitLevel = g_txLevel;
}

//-------------------------------------------------------------------------
Expand Down

0 comments on commit 9b4467c

Please sign in to comment.