some tweaks to mic in filter
authordrowe67 <drowe67@01035d8c-6547-0410-b346-abe4f91aad63>
Sun, 2 Dec 2012 02:26:13 +0000 (02:26 +0000)
committerdrowe67 <drowe67@01035d8c-6547-0410-b346-abe4f91aad63>
Sun, 2 Dec 2012 02:26:13 +0000 (02:26 +0000)
git-svn-id: https://svn.code.sf.net/p/freetel/code@1108 01035d8c-6547-0410-b346-abe4f91aad63

fdmdv2/src/dlg_audiooptions.cpp
fdmdv2/src/dlg_filter.cpp

index 5687f3818e1fd9690c8e0e67632755392f15b714..91ce27490c885bfacf447a37cb87a02ed4fd6727 100644 (file)
@@ -275,10 +275,12 @@ AudioOptsDialog::AudioOptsDialog(wxWindow* parent, wxWindowID id, const wxString
     m_panel1->Layout();
     bSizer4->Fit(m_panel1);
     mainSizer->Add(m_panel1, 1, wxEXPAND | wxALL, 1);
+
     wxBoxSizer* bSizer6;
     bSizer6 = new wxBoxSizer(wxHORIZONTAL);
     m_btnRefresh = new wxButton(this, wxID_ANY, _("Refresh"), wxDefaultPosition, wxDefaultSize, 0);
     bSizer6->Add(m_btnRefresh, 0, wxALIGN_CENTER|wxALL, 2);
+
     m_sdbSizer1 = new wxStdDialogButtonSizer();
     m_sdbSizer1OK = new wxButton(this, wxID_OK);
     m_sdbSizer1->AddButton(m_sdbSizer1OK);
@@ -287,6 +289,7 @@ AudioOptsDialog::AudioOptsDialog(wxWindow* parent, wxWindowID id, const wxString
     m_sdbSizer1Cancel = new wxButton(this, wxID_CANCEL);
     m_sdbSizer1->AddButton(m_sdbSizer1Cancel);
     m_sdbSizer1->Realize();
+
     bSizer6->Add(m_sdbSizer1, 1, wxALIGN_CENTER_VERTICAL, 2);
     mainSizer->Add(bSizer6, 0, wxEXPAND, 2);
     this->SetSizer(mainSizer);
index f0a03c9679f75c70704976b9e0934b823306790a..321b9138188a3e7675cbdfe4befce319138b512a 100644 (file)
@@ -62,7 +62,7 @@ FilterDlg::FilterDlg(wxWindow* parent, bool running, wxWindowID id, const wxStri
 
     wxStaticBoxSizer* lpcpfs = new wxStaticBoxSizer(new wxStaticBox(this, wxID_ANY, _("LPC Post Filter")), wxHORIZONTAL);
 
-#define GRID
+    //#define GRID
 #ifdef GRID
    wxGridSizer* gs = new wxGridSizer(2,2,0,0);
 
@@ -79,7 +79,7 @@ FilterDlg::FilterDlg(wxWindow* parent, bool running, wxWindowID id, const wxStri
     lpcpfs->Add(gs, 0, wxALL, 0);
 
 #else
-   wxBoxSizer* left = new wxBoxSizer(wxVERTICAL);
+    wxBoxSizer* left = new wxBoxSizer(wxVERTICAL);
 
     m_codec2LPCPostFilterEnable = new wxCheckBox(this, wxID_ANY, _("Enable"), wxDefaultPosition,wxDefaultSize, wxCHK_2STATE);
     left->Add(m_codec2LPCPostFilterEnable);
@@ -92,7 +92,7 @@ FilterDlg::FilterDlg(wxWindow* parent, bool running, wxWindowID id, const wxStri
 
     newLPCPFControl(&m_codec2LPCPostFilterBeta, &m_staticTextBeta, right, "Beta");
     newLPCPFControl(&m_codec2LPCPostFilterGamma, &m_staticTextGamma, right, "Gamma");
-    lpcpfs->Add(right, 0, wxALL, 5);
+    lpcpfs->Add(right, 0, wxALL|wxBOTTOM, 5);
 #endif
 
     bSizer30->Add(lpcpfs, 0, wxALL, 0);
@@ -142,15 +142,16 @@ FilterDlg::FilterDlg(wxWindow* parent, bool running, wxWindowID id, const wxStri
     m_SpkOutFreqRespPlot = new PlotSpectrum((wxFrame*)m_auiNotebook, m_SpkOutMagdB, F_MAG_N, FILTER_MIN_MAG_DB, FILTER_MAX_MAG_DB);
     m_auiNotebook->AddPage(m_SpkOutFreqRespPlot, _("Speaker Out Equaliser"));
 
-    // OK - Cancel - Default Buttons at the bottom --------------------------
+    // Default - Cancel - OK   Buttons at the bottom --------------------------
 
     wxBoxSizer* bSizer31 = new wxBoxSizer(wxHORIZONTAL);
-    m_sdbSizer5OK = new wxButton(this, wxID_OK);
-    bSizer31->Add(m_sdbSizer5OK, 0, wxALL, 2);
     m_sdbSizer5Default = new wxButton(this, wxID_ANY, wxT("Default"));
     bSizer31->Add(m_sdbSizer5Default, 0, wxALL, 2);
+
     m_sdbSizer5Cancel = new wxButton(this, wxID_CANCEL);
     bSizer31->Add(m_sdbSizer5Cancel, 0, wxALL, 2);
+    m_sdbSizer5OK = new wxButton(this, wxID_OK);
+    bSizer31->Add(m_sdbSizer5OK, 0, wxALL, 2);
 
     bSizer30->Add(bSizer31, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 0);
 
@@ -371,7 +372,8 @@ void FilterDlg::OnDefault(wxCommandEvent& event)
 
     m_MicInMid.freqHz = 1500.0;
     m_MicInMid.gaindB = 0.0;
-    setFreq(&m_MicInMid); setGain(&m_MicInMid); 
+    m_MicInMid.Q = 1.0;
+    setFreq(&m_MicInMid); setGain(&m_MicInMid); setQ(&m_MicInMid); 
 
     plotMicInFilterSpectrum();    
 }
@@ -471,7 +473,7 @@ void FilterDlg::sliderToFreq(EQ *eq, bool micIn)
 void FilterDlg::setGain(EQ *eq)
 {
     wxString buf;
-    buf.Printf(wxT("%3.0f"), eq->gaindB);
+    buf.Printf(wxT("%3.1f"), eq->gaindB);
     eq->valueGain->SetLabel(buf);
     int slider = (int)(((eq->gaindB-MIN_GAIN)/(MAX_GAIN-MIN_GAIN))*SLIDER_MAX + 0.5);
     eq->sliderGain->SetValue(slider);
@@ -491,7 +493,7 @@ void FilterDlg::sliderToGain(EQ *eq, bool micIn)
 void FilterDlg::setQ(EQ *eq)
 {
     wxString buf;
-    buf.Printf(wxT("%3.0f"), eq->Q);
+    buf.Printf(wxT("%2.1f"), eq->Q);
     eq->valueQ->SetLabel(buf);
 
     float log10_range = MAX_LOG10_Q - MIN_LOG10_Q;
@@ -588,7 +590,7 @@ void FilterDlg::calcFilterSpectrum(float magdB[], int argc, char *argv[]) {
     // doing this from basic principles rather than FFT for no good reason
 
     for(f=0,i=0; f<MAX_F_HZ; f+=F_STEP_DFT,i++) {
-        w = M_PI*f/MAX_F_HZ;
+        w = M_PI*f/(FS/2);
         X[i].real = 0.0; X[i].imag = 0.0;
         for(k=0; k<NIMP; k++) {
             X[i].real += ((float)out[k]/IMP_AMP) * cos(w*k);