Update of /cvsroot/audacity/audacity-src/src/effects In directory sfp-cvsdas-1.v30.ch3.sourceforge.com:/tmp/cvs-serv6756/effects
Modified Files: Equalization.cpp Equalization.h Log Message: EXPERIMENTAL_EQ_INVERT which will invert the current curve. If you have an RIAA-EQd recording and it shouldn't have RIAA, you can get rid of it. Or any other. Index: Equalization.cpp =================================================================== RCS file: /cvsroot/audacity/audacity-src/src/effects/Equalization.cpp,v retrieving revision 1.109 retrieving revision 1.110 diff -u -d -r1.109 -r1.110 --- Equalization.cpp 18 Dec 2009 00:48:41 -0000 1.109 +++ Equalization.cpp 30 Dec 2009 01:48:43 -0000 1.110 @@ -939,14 +939,12 @@ CaptureMouse(); } - if (mEnvRect.Contains(event.GetPosition())) { - if (mEnvelope->MouseEvent(event, mEnvRect, 0.0, mEnvRect.width, false, - dBMin, dBMax, dBMin, dBMax)) - { - mParent->EnvelopeUpdated(); - RecalcRequired = true; - Refresh(false); - } + if (mEnvelope->MouseEvent(event, mEnvRect, 0.0, mEnvRect.width, false, + dBMin, dBMax, dBMin, dBMax)) + { + mParent->EnvelopeUpdated(); + RecalcRequired = true; + Refresh(false); } if (event.ButtonUp() && HasCapture()) @@ -990,6 +988,9 @@ EVT_BUTTON( ID_SAVEAS, EqualizationDialog::OnSaveAs ) EVT_BUTTON( ID_DELETE, EqualizationDialog::OnDelete ) EVT_BUTTON( ID_CLEAR, EqualizationDialog::OnClear ) +#ifdef EXPERIMENTAL_EQ_INVERT + EVT_BUTTON( ID_INVERT, EqualizationDialog::OnInvert ) +#endif EVT_BUTTON( ID_EFFECT_PREVIEW, EqualizationDialog::OnPreview ) EVT_BUTTON( wxID_OK, EqualizationDialog::OnOk ) @@ -1400,6 +1401,10 @@ btn = new wxButton( this, ID_CLEAR, _("Flat")); szrC->Add( btn, 0, wxALIGN_CENTRE | wxALL, 4 ); +#ifdef EXPERIMENTAL_EQ_INVERT + btn = new wxButton( this, ID_INVERT, _("Invert")); + szrC->Add( btn, 0, wxALIGN_CENTRE | wxALL, 4 ); +#endif mGridOnOff = new wxCheckBox(this, GridOnOffID, _("Grids"), wxDefaultPosition, wxDefaultSize, wxALIGN_RIGHT); @@ -2818,6 +2823,82 @@ EnvelopeUpdated(); } +#ifdef EXPERIMENTAL_EQ_INVERT +void EqualizationDialog::OnInvert(wxCommandEvent &event) // Inverts any curve +{ + if(!drawMode) // Graphic (Slider) mode. Invert the sliders. + { + for (int i = 0; thirdOct[i] <= mHiFreq; ++i) + { + if( i == NUMBER_OF_BANDS ) + break; + m_EQVals[i] = -m_EQVals[i]; + int newPosn = (int)m_EQVals[i]; + m_sliders[i]->SetValue( newPosn ); + m_sliders_old[i] = newPosn; + #if wxUSE_TOOLTIPS + wxString tip; + if( thirdOct[i] < 1000.) + tip.Printf( wxT("%dHz\n%.1fdB"), (int)thirdOct[i], m_EQVals[i] ); + else + tip.Printf( wxT("%gkHz\n%.1fdB"), thirdOct[i]/1000., m_EQVals[i] ); + m_sliders[i]->SetToolTip(tip); + #endif + } + GraphicEQ(mLogEnvelope); + } + else // Draw mode. Invert the points. + { + bool lin; // refers to the 'log' or 'lin' of the frequency scale, not the amplitude + int numPoints; // number of points in the curve/envelope + + // determine if log or lin curve is the current one + // and find out how many points are in the curve + if(mLinFreq->IsChecked()) // lin freq scale and so envelope + { + lin = true; + numPoints = mLinEnvelope->GetNumberOfPoints(); + } + else + { + lin = false; + numPoints = mLogEnvelope->GetNumberOfPoints(); + } + + if( numPoints == 0 ) + return; + + double *when = new double[ numPoints ]; + double *value = new double[ numPoints ]; + + if(lin) + mLinEnvelope->GetPoints( when, value, numPoints ); + else + mLogEnvelope->GetPoints( when, value, numPoints ); + + // invert the curve + for( int i=0; i < numPoints; i++) + { + if(lin) + mLinEnvelope->Move(when[i] , -value[i]); + else + mLogEnvelope->Move(when[i] , -value[i]); + } + + // copy it back to the other one (just in case) + if(lin) + EnvLinToLog(); + else + EnvLogToLin(); + } + + // and update the display etc + mPanel->Recalc(); + mPanel->Refresh(false); + EnvelopeUpdated(); +} +#endif + void EqualizationDialog::OnErase(wxEraseEvent &event) { // Ignore it Index: Equalization.h =================================================================== RCS file: /cvsroot/audacity/audacity-src/src/effects/Equalization.h,v retrieving revision 1.43 retrieving revision 1.44 diff -u -d -r1.43 -r1.44 --- Equalization.h 17 Aug 2009 10:45:55 -0000 1.43 +++ Equalization.h 30 Dec 2009 01:48:43 -0000 1.44 @@ -282,6 +282,9 @@ ID_SAVEAS, ID_DELETE, ID_CLEAR, +#ifdef EXPERIMENTAL_EQ_INVERT + ID_INVERT, +#endif drawRadioID, sliderRadioID, ID_INTERP, @@ -311,6 +314,9 @@ void OnSaveAs( wxCommandEvent &event ); void OnDelete( wxCommandEvent &event ); void OnClear( wxCommandEvent &event ); +#ifdef EXPERIMENTAL_EQ_INVERT + void OnInvert( wxCommandEvent &event ); +#endif void OnPreview(wxCommandEvent &event); void OnOk( wxCommandEvent &event ); void OnCancel( wxCommandEvent &event ); ------------------------------------------------------------------------------ This SF.Net email is sponsored by the Verizon Developer Community Take advantage of Verizon's best-in-class app development support A streamlined, 14 day to market process makes app distribution fast and easy Join now and get one step closer to millions of Verizon customers http://p.sf.net/sfu/verizon-dev2dev _______________________________________________ Audacity-cvs mailing list Audacity-cvs@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/audacity-cvs