diff --git a/src/AColor.cpp b/src/AColor.cpp index f606426ac..3a8645a64 100644 --- a/src/AColor.cpp +++ b/src/AColor.cpp @@ -91,12 +91,12 @@ void AColor::Arrow(wxDC & dc, wxCoord x, wxCoord y, int width, bool down) pt[1].x = half; pt[1].y = 0; pt[2].x = width; pt[2].y = half; } - + dc.DrawPolygon(3, pt, x, y); } // -// Draw a line while accounting for differences in wxWidgets versions +// Draw a line while accounting for differences in wxWidgets versions // void AColor::Line(wxDC & dc, wxCoord x1, wxCoord y1, wxCoord x2, wxCoord y2) { @@ -407,20 +407,20 @@ void AColor::Init() // These colors were modified to avoid using reserved colors red and green // for the buttons. - theTheme.SetBrushColour( muteBrush[0], clrMuteButtonActive); - theTheme.SetBrushColour( muteBrush[1], clrMuteButtonVetoed); - theTheme.SetBrushColour( soloBrush, clrMuteButtonActive); - + theTheme.SetBrushColour( muteBrush[0], clrMuteButtonActive); + theTheme.SetBrushColour( muteBrush[1], clrMuteButtonVetoed); + theTheme.SetBrushColour( soloBrush, clrMuteButtonActive); + theTheme.SetPenColour( cursorPen, clrCursorPen); theTheme.SetPenColour( indicatorPen[0], clrRecordingPen); theTheme.SetPenColour( indicatorPen[1], clrPlaybackPen); - theTheme.SetBrushColour( indicatorBrush[0], clrRecordingBrush); - theTheme.SetBrushColour( indicatorBrush[1], clrPlaybackBrush); - - theTheme.SetBrushColour( playRegionBrush[0],clrRulerRecordingBrush); - theTheme.SetPenColour( playRegionPen[0], clrRulerRecordingPen); - theTheme.SetBrushColour( playRegionBrush[1],clrRulerPlaybackBrush); - theTheme.SetPenColour( playRegionPen[1], clrRulerPlaybackPen); + theTheme.SetBrushColour( indicatorBrush[0], clrRecordingBrush); + theTheme.SetBrushColour( indicatorBrush[1], clrPlaybackBrush); + + theTheme.SetBrushColour( playRegionBrush[0],clrRulerRecordingBrush); + theTheme.SetPenColour( playRegionPen[0], clrRulerRecordingPen); + theTheme.SetBrushColour( playRegionBrush[1],clrRulerPlaybackBrush); + theTheme.SetPenColour( playRegionPen[1], clrRulerPlaybackPen); //Determine tooltip color tooltipBrush.SetColour( wxSystemSettingsNative::GetColour(wxSYS_COLOUR_INFOBK) ); @@ -500,7 +500,7 @@ const int AColor_midicolors[16][3] = { {255, 102, 102}, // 1=salmon {204, 0, 0}, // 2=red {255, 117, 23}, // 3=orange - {255, 255, 0}, // 4=yellow + {255, 255, 0}, // 4=yellow {0, 204, 0}, // 5=green {0, 204, 204}, // 6=turquoise {0, 0, 204}, // 7=blue @@ -595,11 +595,11 @@ void AColor::PreComputeGradient() { {float(0.90), float(0.10), float(0.90)}, // violet {float(1.00), float(0.00), float(0.00)}, // red {float(1.00), float(1.00), float(1.00)} // white - }; - + }; + int left = int (value * gsteps); int right = (left == gsteps ? gsteps : left + 1); - + float rweight = (value * gsteps) - left; float lweight = 1.0 - rweight; @@ -607,7 +607,7 @@ void AColor::PreComputeGradient() { g = (gradient[left][1] * lweight) + (gradient[right][1] * rweight); b = (gradient[left][2] * lweight) + (gradient[right][2] * rweight); } - + if (selected) { r *= 0.77f; g *= 0.77f; diff --git a/src/AColor.h b/src/AColor.h index 39e5704b1..5e8907c24 100644 --- a/src/AColor.h +++ b/src/AColor.h @@ -118,7 +118,7 @@ inline void GetColorGradient(float value, *red = AColor::gradient_pre[selected][grayscale][idx][0]; *green = AColor::gradient_pre[selected][grayscale][idx][1]; - *blue = AColor::gradient_pre[selected][grayscale][idx][2]; + *blue = AColor::gradient_pre[selected][grayscale][idx][2]; } #endif diff --git a/src/AboutDialog.cpp b/src/AboutDialog.cpp index 36ab59a96..1dfc58e81 100644 --- a/src/AboutDialog.cpp +++ b/src/AboutDialog.cpp @@ -19,7 +19,7 @@ close it. *//*****************************************************************//** \class AboutDialogCreditItem -\brief AboutDialogCreditItem is a structure used by the AboutDialog to +\brief AboutDialogCreditItem is a structure used by the AboutDialog to hold information about one contributor to Audacity. *//********************************************************************/ @@ -70,7 +70,7 @@ void AboutDialog::CreateCreditsList() // Emeritus: people who were "lead developers" or made an // otherwise distinguished contribution, but who are no // longer active. - + AddCredit(wxT("Matt Brubeck"), roleEmeritusDeveloper); AddCredit(wxT("Michael Chinen"), roleEmeritusDeveloper); AddCredit(wxT("Al Dimond"), roleEmeritusDeveloper); @@ -84,7 +84,7 @@ void AboutDialog::CreateCreditsList() AddCredit(wxT("Alexandre Prokoudine"), roleEmeritusSupport); // All other contributors - + AddCredit(wxT("Lynn Allan"), roleContributor); AddCredit(wxT("David Bailes"), roleContributor); AddCredit(wxT("William Bland"), roleContributor); @@ -119,7 +119,7 @@ void AboutDialog::CreateCreditsList() AddCredit(wxT("Jun Wan"), roleContributor); AddCredit(wxT("Tom Woodhams"), roleContributor); AddCredit(wxT("Wing Yu"), roleContributor); - + AddCredit(wxT("expat"), roleLibrary); AddCredit(wxT("FLAC"), roleLibrary); AddCredit(wxT("LAME"), roleLibrary); @@ -194,10 +194,10 @@ AboutDialog::AboutDialog(wxWindow * parent) PopulateLicensePage( S ); } S.EndNotebook(); - /* i18n-hint: "OK... Audacious" appears on a button at the + /* i18n-hint: "OK... Audacious" appears on a button at the * foot of the 'About Audacity' dialog box, after some text to read. - * In English it is slightly humorous alternative to an 'OK' button. - * If the humour doesn't work in your language, then just use whatever + * In English it is slightly humorous alternative to an 'OK' button. + * If the humour doesn't work in your language, then just use whatever * you would use for a translation for 'OK' on a button. */ wxButton *ok = new wxButton(S.GetParent(), wxID_OK, _("OK... Audacious!")); ok->SetDefault(); @@ -239,23 +239,23 @@ visit our forum."); * your own name(s) to the credits. * * For example: "English translation by Dominic Mazzoni." */ - if (_("translator_credits") != wxString(wxT("translator_credits"))) + if (_("translator_credits") != wxString(wxT("translator_credits"))) { translatorCredits = _("translator_credits"); } wxString localeStr = wxLocale::GetSystemEncodingName(); - wxString creditStr = - wxT("") + - wxT("
") + - wxT("

Audacity ") + wxString(AUDACITY_VERSION_STRING) + wxT("

")+ - _("free, open source, cross-platform software for recording and editing sounds
") + + wxString creditStr = + wxT("") + + wxT("
") + + wxT("

Audacity ") + wxString(AUDACITY_VERSION_STRING) + wxT("

")+ + _("free, open source, cross-platform software for recording and editing sounds
") + wxT("http://audacity.sourceforge.net/") + wxT("


") + par1Str + wxT("

") + par2Str + - wxT("

") + _("Credits") + wxT("

") + + wxT("

") + _("Credits") + wxT("

") + wxT("

") + translatorCredits + wxT("

") + wxString::Format(_("Audacity Developers")) + wxT("
") + @@ -266,7 +266,7 @@ visit our forum."); wxT("

") + _("Emeritus Developers") + wxT("
") + GetCreditsByRole(roleEmeritusDeveloper) + - + wxT("

") + _(" Emeritus Team Members") + wxT("
") + GetCreditsByRole(roleEmeritusSupport) + @@ -275,13 +275,13 @@ visit our forum."); wxT("

") + _("Audacity is based on code from the following projects:") + wxT("
") + GetCreditsByRole(roleLibrary) + - + wxT("

") + _("Special thanks:") + wxT("
") + GetCreditsByRole(roleThanks) + - + wxT("


") + _("Audacity® software is copyright")+ wxT("© 1999-2014 Audacity Team.
") + - _("The name Audacity® is a registered trademark of Dominic Mazzoni.") + + _("The name Audacity® is a registered trademark of Dominic Mazzoni.") + wxT("

"); @@ -305,19 +305,19 @@ visit our forum."); wxBitmap RescaledBitmap( RescaledImage ); icon = - new wxStaticBitmap(S.GetParent(), -1, + new wxStaticBitmap(S.GetParent(), -1, //*logo, //v //v theTheme.Bitmap(bmpAudacityLogo), wxPoint(93, 10), wxSize(215, 190)); - //v theTheme.Bitmap(bmpAudacityLogoWithName), + //v theTheme.Bitmap(bmpAudacityLogoWithName), RescaledBitmap, - wxDefaultPosition, + wxDefaultPosition, wxSize(int(LOGOWITHNAME_WIDTH*fScale), int(LOGOWITHNAME_HEIGHT*fScale))); delete logo; S.Prop(0).AddWindow( icon ); HtmlWindow *html = new LinkingHtmlWindow(S.GetParent(), -1, wxDefaultPosition, - wxSize(ABOUT_DIALOG_WIDTH, 359), + wxSize(ABOUT_DIALOG_WIDTH, 359), wxHW_SCROLLBAR_AUTO | wxSUNKEN_BORDER); html->SetFocus(); html->SetPage(creditStr); @@ -329,7 +329,7 @@ visit our forum."); S.EndNotebookPage(); } -/** \brief: Fills out the "Information" tab of the preferences dialogue +/** \brief: Fills out the "Information" tab of the preferences dialogue * Provides as much information as possible about build-time options and * the libraries used, to try and make Linux support easier. Basically anything * about the build we might wish to know should be visible here */ @@ -339,19 +339,19 @@ void AboutDialog::PopulateInformationPage( ShuttleGui & S ) S.StartNotebookPage( _("Build Information") ); // start the tab S.StartVerticalLay(2); // create the window HtmlWindow *html = new HtmlWindow(S.GetParent(), -1, wxDefaultPosition, - wxSize(ABOUT_DIALOG_WIDTH, 264), + wxSize(ABOUT_DIALOG_WIDTH, 264), wxHW_SCROLLBAR_AUTO | wxSUNKEN_BORDER); // create a html pane in it to put the content in. wxString enabled = _("Enabled"); wxString disabled = _("Disabled"); wxString blank = wxT(""); - + /* this builds up the list of information to go in the window in the string * informationStr */ informationStr = wxT("

"); informationStr += _("Build Information"); informationStr += wxT("

\n"); - // top level heading + // top level heading informationStr += wxT("

"); informationStr += _("File Format Support"); informationStr += wxT("

\n

"); @@ -368,7 +368,7 @@ void AboutDialog::PopulateInformationPage( ShuttleGui & S ) AddBuildinfoRow(&informationStr, wxT("libmad"), _("MP3 Importing"), disabled); #endif - /* i18n-hint: Ogg is the container format. Vorbis is the compression codec. + /* i18n-hint: Ogg is the container format. Vorbis is the compression codec. * Both are proper nouns and shouldn't be translated */ #ifdef USE_LIBVORBIS AddBuildinfoRow(&informationStr, wxT("libvorbis"), @@ -385,7 +385,7 @@ void AboutDialog::PopulateInformationPage( ShuttleGui & S ) AddBuildinfoRow(&informationStr, wxT("libid3tag"), _("ID3 tag support"), disabled); #endif - + /* i18n-hint: FLAC stands for Free Lossless Audio Codec, but is effectively * a proper noun and so shouldn't be translated */ # if USE_LIBFLAC @@ -543,7 +543,7 @@ void AboutDialog::PopulateLicensePage( ShuttleGui & S ) S.StartVerticalLay(1); HtmlWindow *html = new HtmlWindow(S.GetParent(), -1, wxDefaultPosition, - wxSize(ABOUT_DIALOG_WIDTH, 264), + wxSize(ABOUT_DIALOG_WIDTH, 264), wxHW_SCROLLBAR_AUTO | wxSUNKEN_BORDER); // I tried using

 here to get a monospaced font,
@@ -855,7 +855,7 @@ void AboutDialog::AddCredit(const wxString& description, Role role)
 wxString AboutDialog::GetCreditsByRole(AboutDialog::Role role)
 {
    wxString s;
-   
+
    for (AboutDialogCreditItemsList::compatibility_iterator p=creditItems.GetFirst(); p; p = p->GetNext())
    {
       AboutDialogCreditItem* item = p->GetData();
@@ -865,7 +865,7 @@ wxString AboutDialog::GetCreditsByRole(AboutDialog::Role role)
          s += wxT("
"); } } - + // Strip last
, if any if (s.Right(4) == wxT("
")) s = s.Left(s.Length() - 4); diff --git a/src/AboutDialog.h b/src/AboutDialog.h index 6eaee0217..c9ab1169c 100644 --- a/src/AboutDialog.h +++ b/src/AboutDialog.h @@ -39,7 +39,7 @@ class AboutDialog:public wxDialog { wxBitmap *logo; //v DECLARE_EVENT_TABLE() - + private: enum Role { roleTeamDeveloper, @@ -50,7 +50,7 @@ class AboutDialog:public wxDialog { roleLibrary, roleThanks }; - + AboutDialogCreditItemsList creditItems; void PopulateAudacityPage( ShuttleGui & S ); void PopulateLicensePage( ShuttleGui & S ); diff --git a/src/AllThemeResources.h b/src/AllThemeResources.h index 6abef3b4c..7681a04ac 100644 --- a/src/AllThemeResources.h +++ b/src/AllThemeResources.h @@ -19,22 +19,22 @@ and grids used by Audacity. This will be split up into separate include files to reduce the amount of recompilation on a change. -Meantime, do NOT delete any of these declarations, even if they're +Meantime, do NOT delete any of these declarations, even if they're unused, as they're all offset by prior declarations. To add an image, you give its size and name like so: \code DEFINE_IMAGE( bmpPause, wxImage( 16, 16 ), wxT("Pause")); -\endcode +\endcode -If you do this and run the program the image will be black to start -with, but you can go into ThemePrefs and load it (load components) -from there. Audacity will look for a file called "Pause.png". +If you do this and run the program the image will be black to start +with, but you can go into ThemePrefs and load it (load components) +from there. Audacity will look for a file called "Pause.png". - Now save into ImageCache. - From here on you can get the image by loading ImageCache. - - To burn it into the program defaults, use the + - To burn it into the program defaults, use the 'Output Sourcery' button. \see \ref Themability in DOxygen documentation for more details. @@ -209,7 +209,7 @@ from there. Audacity will look for a file called "Pause.png". #define LOGOWITHNAME_WIDTH 506 #define LOGOWITHNAME_HEIGHT 200 - DEFINE_IMAGE( bmpAudacityLogo, wxImage( 215, 190 ), wxT("AudacityLogo")); + DEFINE_IMAGE( bmpAudacityLogo, wxImage( 215, 190 ), wxT("AudacityLogo")); DEFINE_IMAGE( bmpAudacityLogo48x48, wxImage( 48, 48 ), wxT("AudacityLogo48x48")); DEFINE_IMAGE( bmpSyncLockSelTile, wxImage(20, 22), wxT("SyncLockSelTile")); @@ -222,7 +222,7 @@ from there. Audacity will look for a file called "Pause.png". DEFINE_COLOUR( clrSample, wxColour( 50, 50, 200), wxT("Sample")); DEFINE_COLOUR( clrSelSample, wxColour( 50, 50, 200), wxT("SelSample")); DEFINE_COLOUR( clrDragSample, wxColour( 0, 0, 0), wxT("DragSample")); - + DEFINE_COLOUR( clrMuteSample, wxColour(136, 136, 144), wxT("MuteSample")); DEFINE_COLOUR( clrRms, wxColour(100, 100, 220), wxT("Rms")); DEFINE_COLOUR( clrMuteRms, wxColour(136, 136, 144), wxT("MuteRms")); @@ -234,7 +234,7 @@ from there. Audacity will look for a file called "Pause.png". DEFINE_COLOUR( clrSample, wxColour( 63, 77, 155), wxT("Sample")); DEFINE_COLOUR( clrSelSample, wxColour( 50, 50, 200), wxT("SelSample")); DEFINE_COLOUR( clrDragSample, wxColour( 0, 100, 0), wxT("DragSample")); - + DEFINE_COLOUR( clrMuteSample, wxColour(136, 136, 144), wxT("MuteSample")); DEFINE_COLOUR( clrRms, wxColour(107, 154, 247), wxT("Rms")); DEFINE_COLOUR( clrMuteRms, wxColour(136, 136, 144), wxT("MuteRms")); @@ -246,21 +246,21 @@ from there. Audacity will look for a file called "Pause.png". DEFINE_COLOUR( clrTrackPanelText, wxColour(153, 153, 153), wxT("TrackPanelText")); DEFINE_COLOUR( clrLabelTrackText, wxColour( 0, 0, 0), wxT("LabelTrackText")); - + DEFINE_COLOUR( clrMeterPeak, wxColour(102, 102, 255), wxT("MeterPeak")); DEFINE_COLOUR( clrMeterDisabledPen, wxColour(192, 192, 192), wxT("MeterDisabledPen")); DEFINE_COLOUR( clrMeterDisabledBrush, wxColour(160, 160, 160), wxT("MeterDisabledBrush")); - DEFINE_COLOUR( clrMeterInputPen, wxColour(204, 70, 70), wxT("MeterInputPen") ); - DEFINE_COLOUR( clrMeterInputBrush, wxColour(204, 70, 70), wxT("MeterInputBrush") ); - DEFINE_COLOUR( clrMeterInputRMSBrush, wxColour(255, 102, 102), wxT("MeterInputRMSBrush") ); + DEFINE_COLOUR( clrMeterInputPen, wxColour(204, 70, 70), wxT("MeterInputPen") ); + DEFINE_COLOUR( clrMeterInputBrush, wxColour(204, 70, 70), wxT("MeterInputBrush") ); + DEFINE_COLOUR( clrMeterInputRMSBrush, wxColour(255, 102, 102), wxT("MeterInputRMSBrush") ); DEFINE_COLOUR( clrMeterInputClipBrush, wxColour(255, 53, 53), wxT("MeterInputClipBrush") ); - DEFINE_COLOUR( clrMeterInputLightPen, wxColour(255, 153, 153), wxT("MeterInputLightPen") ); - DEFINE_COLOUR( clrMeterInputDarkPen, wxColour(153, 61, 61), wxT("MeterInputDarkPen") ); - - DEFINE_COLOUR( clrMeterOutputPen, wxColour(70, 204, 70), wxT("MeterOutputPen") ); - DEFINE_COLOUR( clrMeterOutputBrush, wxColour(70, 204, 70), wxT("MeterOutputBrush") ); - DEFINE_COLOUR( clrMeterOutputRMSBrush, wxColour(102, 255, 102), wxT("MeterOutputRMSBrush") ); + DEFINE_COLOUR( clrMeterInputLightPen, wxColour(255, 153, 153), wxT("MeterInputLightPen") ); + DEFINE_COLOUR( clrMeterInputDarkPen, wxColour(153, 61, 61), wxT("MeterInputDarkPen") ); + + DEFINE_COLOUR( clrMeterOutputPen, wxColour(70, 204, 70), wxT("MeterOutputPen") ); + DEFINE_COLOUR( clrMeterOutputBrush, wxColour(70, 204, 70), wxT("MeterOutputBrush") ); + DEFINE_COLOUR( clrMeterOutputRMSBrush, wxColour(102, 255, 102), wxT("MeterOutputRMSBrush") ); DEFINE_COLOUR( clrMeterOutputClipBrush, wxColour(255, 53, 53), wxT("MeterOutputClipBrush") ); DEFINE_COLOUR( clrMeterOutputLightPen, wxColour(153, 255, 153), wxT("MeterOutputLightPen") ); DEFINE_COLOUR( clrMeterOutputDarkPen, wxColour(61, 164, 61), wxT("MeterOutputDarkPen") ); @@ -276,20 +276,20 @@ from there. Audacity will look for a file called "Pause.png". DEFINE_COLOUR( clrMuteButtonActive, wxColour( 160, 170, 210), wxT("MuteButtonActive") ); DEFINE_COLOUR( clrMuteButtonVetoed, wxColour( 180, 180, 185), wxT("MuteButtonVetoed") ); - + DEFINE_COLOUR( clrCursorPen, wxColour( 0, 0, 0), wxT("CursorPen") ); DEFINE_COLOUR( clrRecordingPen, wxColour( 176, 0, 28), wxT("RecordingPen") ); DEFINE_COLOUR( clrPlaybackPen, wxColour( 36, 96, 46), wxT("PlaybackPen") ); DEFINE_COLOUR( clrRecordingBrush, wxColour( 190,129,129), wxT("RecordingBrush") ); DEFINE_COLOUR( clrPlaybackBrush, wxColour( 28,171, 51), wxT("PlaybackBrush") ); - + DEFINE_COLOUR( clrRulerRecordingBrush, wxColour( 196,196,196), wxT("RulerRecordingBrush") ); DEFINE_COLOUR( clrRulerRecordingPen, wxColour( 128,128,128), wxT("RulerRecordingPen") ); DEFINE_COLOUR( clrRulerPlaybackBrush, wxColour( 190,129,129), wxT("RulerPlaybackBrush") ); DEFINE_COLOUR( clrRulerPlaybackPen, wxColour( 176, 0, 28), wxT("RulerPlaybackPen") ); - DEFINE_COLOUR( clrTimeFont, wxColour( 0, 0,180), wxT("TimeFont") ); - DEFINE_COLOUR( clrTimeBack, wxColour( 160,160,160), wxT("TimeBack") ); + DEFINE_COLOUR( clrTimeFont, wxColour( 0, 0,180), wxT("TimeFont") ); + DEFINE_COLOUR( clrTimeBack, wxColour( 160,160,160), wxT("TimeBack") ); DEFINE_COLOUR( clrTimeFontFocus, wxColour( 0, 0, 0), wxT("TimeFontFocus") ); DEFINE_COLOUR( clrTimeBackFocus, wxColour( 242,242,255), wxT("TimeBackFocus") ); @@ -330,10 +330,10 @@ from there. Audacity will look for a file called "Pause.png". DEFINE_COLOUR( clrProgressNotYet, wxColour(255, 255, 255,220), wxT("ProgressNotYet")); DEFINE_COLOUR( clrSyncLockSel, wxColour(192, 192, 192), wxT("SyncLockSel")); - // Vaughan, 2010-09-20: clrTrackInfoSyncLockSel is unused so this is cruft, but + // Vaughan, 2010-09-20: clrTrackInfoSyncLockSel is unused so this is cruft, but // do NOT delete it as it's in the theme image, so offsets subsequent colors. DEFINE_COLOUR( clrTrackInfoSyncLockSel, wxColour( 64, 64, 64), wxT("TrackInfoSyncLockSel")); - + DEFINE_COLOUR( clrSelTranslucent, wxColour(104, 104, 148, 127), wxT("SelTranslucent")); // This is for waveform drawing, selected outside of clips DEFINE_COLOUR( clrBlankSelected, wxColour(170, 170, 192), wxT("BlankSelected")); diff --git a/src/Audacity.h b/src/Audacity.h index cf76b08e6..4f1955602 100644 --- a/src/Audacity.h +++ b/src/Audacity.h @@ -23,7 +23,7 @@ #ifndef __AUDACITY_H__ #define __AUDACITY_H__ -// We only do alpha builds and release versions. +// We only do alpha builds and release versions. // Most of the time we're in development, so IS_ALPHA should be defined // to 1. #define IS_ALPHA 1 @@ -35,7 +35,7 @@ #define AUDACITY_MODLEVEL 0 #if IS_ALPHA - #define AUDACITY_SUFFIX wxT("-alpha-") __TDATE__ + #define AUDACITY_SUFFIX wxT("-alpha-") __TDATE__ #else #define AUDACITY_SUFFIX wxT("") // for a stable release #endif @@ -70,8 +70,8 @@ void QuitAudacity(bool bForce); void QuitAudacity(); // Please try to support unlimited path length instead of using PLATFORM_MAX_PATH! -// Define one constant for maximum path value, so we don't have to do -// platform-specific conditionals everywhere we want to check it. +// Define one constant for maximum path value, so we don't have to do +// platform-specific conditionals everywhere we want to check it. #define PLATFORM_MAX_PATH 260 // Play it safe for default, with same value as Windows' MAX_PATH. #ifdef __WXMAC__ @@ -122,7 +122,7 @@ void QuitAudacity(); /* The GCC-elf implementation */ #ifdef HAVE_VISIBILITY // this is provided by the configure script, is only // enabled for suitable GCC versions -/* The incantation is a bit weird here because it uses ELF symbol stuff. If we +/* The incantation is a bit weird here because it uses ELF symbol stuff. If we * make a symbol "default" it makes it visible (for import or export). Making it * "hidden" means it is invisible outside the shared object. */ #ifndef AUDACITY_DLL_API @@ -154,11 +154,11 @@ void QuitAudacity(); // For compilers that support precompilation, includes "wx/wx.h". // Mainly for MSVC developers. // -// This precompilation is only done for non-unicode debug builds. +// This precompilation is only done for non-unicode debug builds. // The rationale is that this is where there is the big time saving // because that's what you build whilst debugging. // Whilst disabling precompilation for other builds will ensure -// that missing headers that would affect other platforms do get +// that missing headers that would affect other platforms do get // seen by MSVC developers too. #ifndef UNICODE diff --git a/src/AudacityApp.cpp b/src/AudacityApp.cpp index c4c77b99f..39f00afe5 100644 --- a/src/AudacityApp.cpp +++ b/src/AudacityApp.cpp @@ -9,7 +9,7 @@ ******************************************************************//** \class AudacityApp -\brief AudacityApp is the 'main' class for Audacity +\brief AudacityApp is the 'main' class for Audacity It handles initialization and termination by subclassing wxApp. @@ -232,7 +232,7 @@ static bool gInited = false; bool gIsQuitting = false; void QuitAudacity(bool bForce) -{ +{ if (gIsQuitting) return; @@ -285,14 +285,14 @@ void QuitAudacity(bool bForce) CloseScoreAlignDialog(); #endif CloseScreenshotTools(); - + //release ODManager Threads ODManager::Quit(); //print out profile if we have one by deleting it //temporarilly commented out till it is added to all projects //delete Profiler::Instance(); - + //delete the static lock for audacity projects AudacityProject::DeleteAllProjectsDeleteLock(); @@ -306,7 +306,7 @@ void QuitAudacity(bool bForce) } void QuitAudacity() -{ +{ QuitAudacity(false); } @@ -397,8 +397,8 @@ void SaveWindowSize() // Most of this was taken from nsNativeAppSupportUnix.cpp from Mozilla. /////////////////////////////////////////////////////////////////////////////// -// TODO: May need updating. Is this code too obsolete (relying on Gnome2 so's) to be -// worth keeping anymore? +// TODO: May need updating. Is this code too obsolete (relying on Gnome2 so's) to be +// worth keeping anymore? // CB suggests we use libSM directly ref: // http://www.x.org/archive/X11R7.7/doc/libSM/SMlib.html#The_Save_Yourself_Callback @@ -599,7 +599,7 @@ public: wxString cmd(data); - // We queue a command event to the project responsible for + // We queue a command event to the project responsible for // opening the file since it can be a long process and we // only have 5 seconds to return the Execute message to the // client. @@ -696,7 +696,7 @@ void AudacityApp::MacNewFile() // This method should only be used on the Mac platform // when no project windows are open. - + if (gAudacityProjects.GetCount() == 0) { CreateNewAudacityProject(); } @@ -727,7 +727,7 @@ BEGIN_EVENT_TABLE(AudacityApp, wxApp) EVT_MENU(wxID_PREFERENCES, AudacityApp::OnMenuPreferences) EVT_MENU(wxID_EXIT, AudacityApp::OnMenuExit) #endif - // Recent file event handlers. + // Recent file event handlers. EVT_MENU(ID_RECENT_CLEAR, AudacityApp::OnMRUClear) EVT_MENU_RANGE(ID_RECENT_FIRST, ID_RECENT_LAST, AudacityApp::OnMRUFile) @@ -735,32 +735,32 @@ BEGIN_EVENT_TABLE(AudacityApp, wxApp) EVT_APP_COMMAND(wxID_ANY, AudacityApp::OnReceiveCommand) END_EVENT_TABLE() -// backend for OnMRUFile +// backend for OnMRUFile // TODO: Would be nice to make this handle not opening a file with more panache. // - Inform the user if DefaultOpenPath not set. // - Switch focus to correct instance of project window, if already open. bool AudacityApp::MRUOpen(wxString fullPathStr) { // Most of the checks below are copied from AudacityProject::OpenFiles. // - some rationalisation might be possible. - + AudacityProject *proj = GetActiveProject(); - - if (!fullPathStr.IsEmpty()) - { - // verify that the file exists - if (wxFile::Exists(fullPathStr)) + + if (!fullPathStr.IsEmpty()) + { + // verify that the file exists + if (wxFile::Exists(fullPathStr)) { - if (!gPrefs->Write(wxT("/DefaultOpenPath"), wxPathOnly(fullPathStr)) || + if (!gPrefs->Write(wxT("/DefaultOpenPath"), wxPathOnly(fullPathStr)) || !gPrefs->Flush()) return false; - + // Make sure it isn't already open. - // Test here even though AudacityProject::OpenFile() also now checks, because - // that method does not return the bad result. + // Test here even though AudacityProject::OpenFile() also now checks, because + // that method does not return the bad result. // That itself may be a FIXME. if (AudacityProject::IsAlreadyOpen(fullPathStr)) return false; - + // DMM: If the project is dirty, that means it's been touched at // all, and it's not safe to open a new project directly in its // place. Only if the project is brand-new clean and the user @@ -781,7 +781,7 @@ bool AudacityApp::MRUOpen(wxString fullPathStr) { } else { // File doesn't exist - remove file from history - wxMessageBox(wxString::Format(_("%s could not be found.\n\nIt has been removed from the list of recent files."), + wxMessageBox(wxString::Format(_("%s could not be found.\n\nIt has been removed from the list of recent files."), fullPathStr.c_str())); return(false); } @@ -794,18 +794,18 @@ void AudacityApp::OnMRUClear(wxCommandEvent& WXUNUSED(event)) mRecentFiles->Clear(); } -//vvv Basically, anything from Recent Files is treated as a .aup, until proven otherwise, -// then it tries to Import(). Very questionable handling, imo. +//vvv Basically, anything from Recent Files is treated as a .aup, until proven otherwise, +// then it tries to Import(). Very questionable handling, imo. // Better, for example, to check the file type early on. void AudacityApp::OnMRUFile(wxCommandEvent& event) { int n = event.GetId() - ID_RECENT_FIRST; wxString fullPathStr = mRecentFiles->GetHistoryFile(n); - // Try to open only if not already open. - // Test IsAlreadyOpen() here even though AudacityProject::MRUOpen() also now checks, + // Try to open only if not already open. + // Test IsAlreadyOpen() here even though AudacityProject::MRUOpen() also now checks, // because we don't want to RemoveFileFromHistory() just because it already exists, // and AudacityApp::OnMacOpenFile() calls MRUOpen() directly. - // that method does not return the bad result. + // that method does not return the bad result. if (!AudacityProject::IsAlreadyOpen(fullPathStr) && !MRUOpen(fullPathStr)) mRecentFiles->RemoveFileFromHistory(n); } @@ -813,7 +813,7 @@ void AudacityApp::OnMRUFile(wxCommandEvent& event) { void AudacityApp::OnTimer(wxTimerEvent& WXUNUSED(event)) { #if defined(__WXMAC__) - // Filenames are queued when Audacity receives the a few of the + // Filenames are queued when Audacity receives the a few of the // AppleEvent messages (via wxWidgets). So, open any that are // in the queue and clean the queue. if (ofqueue.GetCount()) { @@ -833,7 +833,7 @@ void AudacityApp::OnTimer(wxTimerEvent& WXUNUSED(event)) } } #endif - + // Check if a warning for missing aliased files should be displayed if (ShouldShowMissingAliasedFileWarning()) { // find which project owns the blockfile @@ -862,7 +862,7 @@ void AudacityApp::OnTimer(wxTimerEvent& WXUNUSED(event)) if (offendingProject) { offendingProject->Iconize(false); offendingProject->Raise(); - + wxString errorMessage = wxString::Format(_( "One or more external audio files could not be found.\n\ It is possible they were moved, deleted, or the drive they \ @@ -874,7 +874,7 @@ There may be additional missing files.\n\ Choose File > Check Dependencies to view a list of \ locations of the missing files."), missingFileName.c_str()); - // if an old dialog exists, raise it if it is + // if an old dialog exists, raise it if it is if (offendingProject->GetMissingAliasFileDialog()) { offendingProject->GetMissingAliasFileDialog()->Raise(); } else { @@ -965,7 +965,7 @@ void AudacityApp::InitLang( const wxString & lang ) // catalogs are search in LIFO order, so add wxstd first. mLocale->AddCatalog(wxT("wxstd")); -// AUDACITY_NAME is legitimately used on some *nix configurations. +// AUDACITY_NAME is legitimately used on some *nix configurations. #ifdef AUDACITY_NAME mLocale->AddCatalog(wxT(AUDACITY_NAME)); #else @@ -998,7 +998,7 @@ int AudacityApp::FilterEvent(wxEvent & event) if (event.GetEventType() == wxEVT_ACTIVATE) { wxActivateEvent & e = (wxActivateEvent &) event; - + if (e.GetEventObject() && e.GetActive() && e.GetEventObject()->IsKindOf(CLASSINFO(wxDialog))) { ((wxWindow *)e.GetEventObject())->SetFocus(); @@ -1065,7 +1065,7 @@ bool AudacityApp::OnInit() InitPreferences(); #if defined(__WXMSW__) && !defined(__WXUNIVERSAL__) && !defined(__CYGWIN__) - this->AssociateFileTypes(); + this->AssociateFileTypes(); #endif // TODO - read the number of files to store in history from preferences @@ -1080,7 +1080,7 @@ bool AudacityApp::OnInit() theTheme.EnsureInitialised(); // AColor depends on theTheme. - AColor::Init(); + AColor::Init(); /* Search path (for plug-ins, translations etc) is (in this order): * The AUDACITY_PATH environment variable @@ -1090,7 +1090,7 @@ bool AudacityApp::OnInit() #ifdef __WXGTK__ /* On Unix systems, the default temp dir is in /var/tmp. */ defaultTempDir.Printf(wxT("/var/tmp/audacity-%s"), wxGetUserId().c_str()); - + wxString pathVar = wxGetenv(wxT("AUDACITY_PATH")); if (pathVar != wxT("")) AddMultiPathsToPathList(pathVar, audacityPathList); @@ -1134,8 +1134,8 @@ bool AudacityApp::OnInit() wxString progPath = wxPathOnly(argv[0]); AddUniquePathToPathList(progPath, audacityPathList); AddUniquePathToPathList(progPath+wxT("\\Languages"), audacityPathList); - - defaultTempDir.Printf(wxT("%s\\audacity_temp"), + + defaultTempDir.Printf(wxT("%s\\audacity_temp"), tmpDirLoc.c_str()); #endif //__WXWSW__ @@ -1152,7 +1152,7 @@ bool AudacityApp::OnInit() AddUniquePathToPathList(progPath+wxT("/../"), audacityPathList); AddUniquePathToPathList(progPath+wxT("/../Resources"), audacityPathList); - defaultTempDir.Printf(wxT("%s/audacity-%s"), + defaultTempDir.Printf(wxT("%s/audacity-%s"), tmpDirLoc.c_str(), wxGetUserId().c_str()); #endif //__WXMAC__ @@ -1248,14 +1248,14 @@ bool AudacityApp::OnInit() } delete temporarywindow; - + if( project->mShowSplashScreen ) project->OnHelpWelcome(); // JKC 10-Sep-2007: Enable monitoring from the start. // (recommended by lprod.org). - // Monitoring stops again after any - // PLAY or RECORD completes. + // Monitoring stops again after any + // PLAY or RECORD completes. // So we also call StartMonitoring when STOP is called. project->MayStartMonitoring(); @@ -1343,12 +1343,12 @@ bool AudacityApp::OnInit() } // if (argc>1) #else //__CYGWIN__ - + // Cygwin command line parser (by Dave Fancella) if (argc > 1 && !didRecoverAnything) { int optionstart = 1; bool startAtOffset = false; - + // Scan command line arguments looking for trouble for (int option = 1; option < argc; option++) { if (!argv[option]) @@ -1360,14 +1360,14 @@ bool AudacityApp::OnInit() optionstart = option + 1; } } - + for (int option = optionstart; option < argc; option++) { if (!argv[option]) continue; bool handled = false; bool openThisFile = false; wxString fileToOpen; - + if (!wxString(wxT("-help")).CmpNoCase(argv[option])) { PrintCommandLineHelp(); // print the help message out exit(0); @@ -1397,10 +1397,10 @@ bool AudacityApp::OnInit() wxPrintf(_("Unknown command line option: %s\n"), argv[option]); exit(0); } - + if(handled) fileToOpen.Clear(); - + if (!handled) fileToOpen = fileToOpen + wxT(" ") + argv[option]; if(wxString(argv[option]).Lower().Contains(wxT(".aup"))) @@ -1422,7 +1422,7 @@ bool AudacityApp::OnInit() #endif // __CYGWIN__ (Cygwin command-line parser) gInited = true; - + ModuleManager::Dispatch(AppInitialized); mWindowRectAlreadySaved = FALSE; @@ -1588,7 +1588,7 @@ bool AudacityApp::CreateSingleInstanceChecker(wxString dir) } #endif // There is another copy of Audacity running. Force quit. - + wxString prompt = _("The system has detected that another copy of Audacity is running.\n") + runningTwoCopiesStr + @@ -1820,7 +1820,7 @@ int AudacityApp::OnExit() // where it's possible to have a menu bar but no windows open. // It doesn't hurt any other platforms, though. -// ...That is, as long as you check to see if no windows are open +// ...That is, as long as you check to see if no windows are open // before executing the stuff. // To fix this, check to see how many project windows are open, // and skip the event unless none are open (which should only happen @@ -1830,7 +1830,7 @@ void AudacityApp::OnMenuAbout(wxCommandEvent & event) { // This function shadows a similar function // in Menus.cpp, but should only be used on the Mac platform - // when no project windows are open. This check assures that + // when no project windows are open. This check assures that // this happens, and enable the same code to be present on // all platforms. if(gAudacityProjects.GetCount() == 0) { @@ -1845,10 +1845,10 @@ void AudacityApp::OnMenuNew(wxCommandEvent & event) { // This function shadows a similar function // in Menus.cpp, but should only be used on the Mac platform - // when no project windows are open. This check assures that + // when no project windows are open. This check assures that // this happens, and enable the same code to be present on // all platforms. - + if(gAudacityProjects.GetCount() == 0) CreateNewAudacityProject(); else @@ -1860,7 +1860,7 @@ void AudacityApp::OnMenuOpen(wxCommandEvent & event) { // This function shadows a similar function // in Menus.cpp, but should only be used on the Mac platform - // when no project windows are open. This check assures that + // when no project windows are open. This check assures that // this happens, and enable the same code to be present on // all platforms. @@ -1877,7 +1877,7 @@ void AudacityApp::OnMenuPreferences(wxCommandEvent & event) { // This function shadows a similar function // in Menus.cpp, but should only be used on the Mac platform - // when no project windows are open. This check assures that + // when no project windows are open. This check assures that // this happens, and enable the same code to be present on // all platforms. @@ -1887,33 +1887,33 @@ void AudacityApp::OnMenuPreferences(wxCommandEvent & event) } else event.Skip(); - + } void AudacityApp::OnMenuExit(wxCommandEvent & event) { // This function shadows a similar function // in Menus.cpp, but should only be used on the Mac platform - // when no project windows are open. This check assures that + // when no project windows are open. This check assures that // this happens, and enable the same code to be present on // all platforms. // LL: Removed "if" to allow closing based on final project count. // if(gAudacityProjects.GetCount() == 0) QuitAudacity(); - + // LL: Veto quit if projects are still open. This can happen // if the user selected Cancel in a Save dialog. event.Skip(gAudacityProjects.GetCount() == 0); - + } //BG: On Windows, associate the aup file type with Audacity -/* We do this in the Windows installer now, - to avoid issues where user doesn't have admin privileges, but +/* We do this in the Windows installer now, + to avoid issues where user doesn't have admin privileges, but in case that didn't work, allow the user to decide at startup. - //v Should encapsulate this & allow access from Prefs, too, + //v Should encapsulate this & allow access from Prefs, too, // if people want to manually change associations. */ #if defined(__WXMSW__) && !defined(__WXUNIVERSAL__) && !defined(__CYGWIN__) @@ -1927,18 +1927,18 @@ void AudacityApp::AssociateFileTypes() associateFileTypes.SetName(wxT("HKCU\\Software\\Classes\\.AUP")); bKeyExists = associateFileTypes.Exists(); } - if (!bKeyExists) { - // File types are not currently associated. + if (!bKeyExists) { + // File types are not currently associated. // Check pref in case user has already decided against it. bool bWantAssociateFiles = true; - if (!gPrefs->Read(wxT("/WantAssociateFiles"), &bWantAssociateFiles) || + if (!gPrefs->Read(wxT("/WantAssociateFiles"), &bWantAssociateFiles) || bWantAssociateFiles) { - // Either there's no pref or user does want associations + // Either there's no pref or user does want associations // and they got stepped on, so ask. - int wantAssoc = + int wantAssoc = wxMessageBox( - _("Audacity project (.AUP) files are not currently \nassociated with Audacity. \n\nAssociate them, so they open on double-click?"), - _("Audacity Project Files"), + _("Audacity project (.AUP) files are not currently \nassociated with Audacity. \n\nAssociate them, so they open on double-click?"), + _("Audacity Project Files"), wxYES_NO | wxICON_QUESTION); if (wantAssoc == wxYES) { gPrefs->Write(wxT("/WantAssociateFiles"), true); @@ -1952,7 +1952,7 @@ void AudacityApp::AssociateFileTypes() // Not at HKEY_CLASSES_USER. Try HKEY_CURRENT_ROOT. root_key = wxT("HKCR\\"); associateFileTypes.SetName(root_key + wxT(".AUP")); - if (!associateFileTypes.Create(true)) { + if (!associateFileTypes.Create(true)) { // Actually, can't create keys. Empty root_key to flag failure. root_key.Empty(); } @@ -1984,7 +1984,7 @@ void AudacityApp::AssociateFileTypes() if(associateFileTypes.Exists()) { tmpRegAudPath = wxString(associateFileTypes).Lower(); } - if (!associateFileTypes.Exists() || + if (!associateFileTypes.Exists() || (tmpRegAudPath.Find(wxT("audacity.exe")) >= 0)) { associateFileTypes.Create(true); associateFileTypes = (wxString)argv[0] + (wxString)wxT(" \"%1\""); diff --git a/src/AudacityApp.h b/src/AudacityApp.h index ae769c9c3..6c945489a 100644 --- a/src/AudacityApp.h +++ b/src/AudacityApp.h @@ -54,12 +54,12 @@ DECLARE_EXPORTED_EVENT_TYPE(AUDACITY_DLL_API, EVT_CAPTURE_KEY, -1); // These flags represent the majority of the states that affect // whether or not items in menus are enabled or disabled. -enum +enum { AlwaysEnabledFlag = 0x00000000, AudioIONotBusyFlag = 0x00000001, - TimeSelectedFlag = 0x00000002, // This is equivalent to check if there is a valid selection, so it's used for Zoom to Selection too + TimeSelectedFlag = 0x00000002, // This is equivalent to check if there is a valid selection, so it's used for Zoom to Selection too TracksSelectedFlag = 0x00000004, TracksExistFlag = 0x00000008, LabelTracksExistFlag = 0x00000010, @@ -144,11 +144,11 @@ class AudacityApp:public wxApp { /** \brief Changes the behavior of missing aliased blockfiles warnings */ void SetMissingAliasedFileWarningShouldShow(bool b); - + /** \brief Returns true if the user should be notified of missing alias warnings */ bool ShouldShowMissingAliasedFileWarning(); - + #ifdef __WXMAC__ // In response to Apple Events virtual void MacOpenFile(const wxString &fileName) ; @@ -161,7 +161,7 @@ class AudacityApp:public wxApp { #endif /** \brief A list of directories that should be searched for Audacity files - * (plug-ins, help files, etc.). + * (plug-ins, help files, etc.). * * On Unix this will include the directory Audacity was installed into, * plus the current user's .audacity-data/Plug-Ins directory. Additional @@ -207,10 +207,10 @@ class AudacityApp:public wxApp { wxSingleInstanceChecker *mChecker; wxTimer *mTimer; - + bool m_aliasMissingWarningShouldShow; BlockFile *m_LastMissingBlockFile; - + ODLock m_LastMissingBlockFileLock; void InitCommandHandler(); diff --git a/src/AudacityHeaders.h b/src/AudacityHeaders.h index ca1132480..2219e93cc 100644 --- a/src/AudacityHeaders.h +++ b/src/AudacityHeaders.h @@ -76,7 +76,7 @@ //#ifdef __WXMSW__ // Enable this to diagnose memory leaks too! -// #include // redefines the new() operator +// #include // redefines the new() operator //#endif #if __WXMSW__ diff --git a/src/AudioIO.cpp b/src/AudioIO.cpp index 0564b5c54..291e85297 100644 --- a/src/AudioIO.cpp +++ b/src/AudioIO.cpp @@ -23,7 +23,7 @@ Great care and attention to detail are necessary for understanding and modifying this system. The code in this file is run from three different thread contexts: the UI thread, the disk thread (which - this file creates and maintains; in the code, this is called the + this file creates and maintains; in the code, this is called the Audio Thread), and the PortAudio callback thread. To highlight this deliniation, the file is divided into three parts based on what thread context each function is intended to run in. @@ -32,7 +32,7 @@ If EXPERIMENTAL_MIDI_PLAYBACK is defined, this class also manages MIDI playback. The reason for putting MIDI here rather than in, say, class MidiIO, is that there is no high-level synchronization and - transport architecture, so Audio and MIDI must be coupled in order + transport architecture, so Audio and MIDI must be coupled in order to start/stop/pause and synchronize them. \par MIDI With Audio @@ -51,12 +51,12 @@ actually sends samples to the output device. The relatively low latency to the output device allows Audacity to stop audio output quickly. We want the same behavior for MIDI, but there is not - periodic callback from PortMidi (because MIDI is asynchronous), so + periodic callback from PortMidi (because MIDI is asynchronous), so this function is performed by the MidiThread class. \par When Audio is running, MIDI is synchronized to Audio. Globals are set - in the Audio callback (audacityAudioCallback) for use by a time + in the Audio callback (audacityAudioCallback) for use by a time function that reports milliseconds to PortMidi. (Details below.) \par MIDI Without Audio @@ -65,7 +65,7 @@ \par Implementation Notes and Details for MIDI When opening devices, successAudio and successMidi indicate errors - if false, so normally both are true. Use playbackChannels, + if false, so normally both are true. Use playbackChannels, captureChannels and mMidiPlaybackTracks.IsEmpty() to determine if Audio or MIDI is actually in use. @@ -73,32 +73,32 @@ Normally, the current time during playback is given by the variable mTime. mTime normally advances by frames / samplerate each time an audio buffer is output by the audio callback. However, Audacity has - a speed control that can perform continuously variable time stretching + a speed control that can perform continuously variable time stretching on audio. This is achieved in two places: the playback "mixer" that - generates the samples for output processes the audio according to + generates the samples for output processes the audio according to the speed control. In a separate algorithm, the audio callback updates mTime by (frames / samplerate) * factor, where factor reflects the speed at mTime. This effectively integrates speed to get position. - + \par Midi Time - MIDI is not warped according to the speed control. This might be - something that should be changed. (Editorial note: Wouldn't it - make more sense to display audio at the correct time and allow + MIDI is not warped according to the speed control. This might be + something that should be changed. (Editorial note: Wouldn't it + make more sense to display audio at the correct time and allow users to stretch audio the way they can stretch MIDI?) For now, MIDI plays at 1 second per second, so it requires an unwarped clock. In fact, MIDI time synchronization requires a millisecond clock that does not pause. Note that mTime will stop progress when the Pause - button is pressed, even though audio samples (zeros) continue to + button is pressed, even though audio samples (zeros) continue to be output. - \par + \par Therefore, we define the following interface for MIDI timing: \li \c AudioTime() is the time based on all samples written so far, including zeros output during pauses. AudioTime() is based on the start location mT0, not zero. \li \c PauseTime() is the amount of time spent paused, based on a count of zero samples output. \li \c MidiTime() is an estimate in milliseconds of the current audio output time + 1s. In other words, what audacity track time corresponds to the audio (including pause insertions) at the output? \par AudioTime() and PauseTime() computation - AudioTime() is simply mT0 + mNumFrames / mRate. + AudioTime() is simply mT0 + mNumFrames / mRate. mNumFrames is incremented in each audio callback. Similarly, PauseTime() is mNumPauseFrames / mRate. mNumPauseFrames is also incremented in each audio callback when a pause is in effect. @@ -107,10 +107,10 @@ MidiTime() is computed based on information from PortAudio's callback, which estimates the system time at which the current audio buffer will be output. Consider the (unimplemented) function RealToTrack() that - maps real time to track time. If outputTime is PortAudio's time + maps real time to track time. If outputTime is PortAudio's time estimate for the most recent output buffer, then \n RealToTrack(outputTime) = AudioTime() - PauseTime() - bufferDuration \n - We want to know RealToTrack of the current time, so we use this + We want to know RealToTrack of the current time, so we use this approximation for small d: \n RealToTrack(t + d) = RealToTrack(t) + d \n Letting t = outputTime and d = (systemTime - outputTime), we can @@ -121,19 +121,19 @@ time at startup, so add 1 to both sides: MidiTime() in seconds = RealToTrack(systemTime) + PauseTime() + 1 = \n AudioTime() - bufferduration + (systemTime - outputTime) + 1 - + \par - The difference AudioTime() - PauseTime() is the time "cursor" for - MIDI. When the speed control is used, MIDI and Audio will become - unsynchronized. In particular, MIDI will not be synchronized with + The difference AudioTime() - PauseTime() is the time "cursor" for + MIDI. When the speed control is used, MIDI and Audio will become + unsynchronized. In particular, MIDI will not be synchronized with the visual cursor, which moves with scaled time reported in mTime. - + \par Midi Synchronization The goal of MIDI playback is to deliver MIDI messages synchronized to audio (assuming no speed variation for now). If a midi event has time tmidi, then the timestamp for that message should be \n timestamp (in seconds) = tmidi + PauseTime() + 1.0 - latency.\n - (This is actually off by 1ms; see "PortMidi Latency Parameter" below for + (This is actually off by 1ms; see "PortMidi Latency Parameter" below for more detail.) Notice the extra 1.0, added because MidiTime() is offset by 1s to avoid starting at a negative value. Also notice that we subtract latency. @@ -145,31 +145,31 @@ is synchronized to audio output. So the only thing we need to do is output Midi messages shortly before they will be played with the correct timestamp. We will take "shortly before" to mean "at about the same time - as corresponding audio". Based on this, output the event when + as corresponding audio". Based on this, output the event when AudioTime() - PauseTime() > mtime - latency, - adjusting the event time by adding PauseTime() + 1 - latency. - This gives at least mAudioOutputLatency for + adjusting the event time by adding PauseTime() + 1 - latency. + This gives at least mAudioOutputLatency for the MIDI output to be generated (we want to generate MIDI output before - the actual output time because events generated early are accurately timed - according to their timestamp). However, the MIDI thread sleeps for - MIDI_SLEEP in its polling loop, so the worst case is really - mAudioOutputLatency + MIDI_SLEEP. In case the audio output latency is - very low, we will output events when + the actual output time because events generated early are accurately timed + according to their timestamp). However, the MIDI thread sleeps for + MIDI_SLEEP in its polling loop, so the worst case is really + mAudioOutputLatency + MIDI_SLEEP. In case the audio output latency is + very low, we will output events when AudioTime() + MIDI_SLEEP - PauseTime() > mtime - latency. \par Interaction between MIDI, Audio, and Pause When Pause is used, PauseTime() will increase at the same rate as - AudioTime(), and no more events will be output. Because of the - time advance of mAudioOutputLatency + MIDI_SLEEP + latency and the + AudioTime(), and no more events will be output. Because of the + time advance of mAudioOutputLatency + MIDI_SLEEP + latency and the fact that - AudioTime() advances stepwise by mAudioBufferDuration, some extra MIDI + AudioTime() advances stepwise by mAudioBufferDuration, some extra MIDI might be output, but the same is true of audio: something like mAudioOutputLatency audio samples will be in the output buffer - (with up to mAudioBufferDuration additional samples, depending on + (with up to mAudioBufferDuration additional samples, depending on when the Pause takes effect). When playback is resumed, there will be a slight delay corresponding to the extra data previously sent. Again, the same is true of audio. Audio and MIDI will not pause and - resume at exactly the same times, but their pause and resume times + resume at exactly the same times, but their pause and resume times will be within the low tens of milliseconds, and the streams will be synchronized in any case. I.e. if audio pauses 10ms earlier than MIDI, it will resume 10ms earlier as well. @@ -193,7 +193,7 @@ \par Midi Without Audio Playback When there is no audio playback, MIDI runs according to its own clock. - The midi timestamp clock starts at approximately the same time as + The midi timestamp clock starts at approximately the same time as audio recording (if any). A timestamp of 0 corresponds to mT0, the starting time in the Midi track(s). Thus the timestamp for an event at time tmidi should be: \n @@ -204,8 +204,8 @@ \par Midi Output Without Audio Playback Midi events should be written before their timestamp expires. Since the loop that checks for events to write pauses for MIDI_SLEEP, the - events should be written at least MIDI_SLEEP early, and due to - other delays and computation, we want some extra time, so let's + events should be written at least MIDI_SLEEP early, and due to + other delays and computation, we want some extra time, so let's allow 2*MIDI_SLEEP. Therefore, the write time should be when:\n tmidi - mT0 + PauseTime() - latency - 0.001 - 2 * MIDI_SLEEP < Pt_Time()\n, which can be rearranged to:\n @@ -216,14 +216,14 @@ \par The code for Midi Without Audio was developed by simply trying to play Midi alone and fixing everything that did not work. The - "normal" AudioIO execution was full of assumptions about audio, so + "normal" AudioIO execution was full of assumptions about audio, so there is no systematic design for running without audio, merely a - number of "patches" to make it work. The expression + number of "patches" to make it work. The expression "mNumPlaybackChannels > 0" is used to detect whether audio playback is active, and "mNumFrames > 0" is used to indicate that playback - of either Midi or Audio has actually started. (mNumFrames is + of either Midi or Audio has actually started. (mNumFrames is normally incremented by the audio callback, but if there is no - audio playback or recording, it is set to 1 at the end of + audio playback or recording, it is set to 1 at the end of initialization. \par NoteTrack PlayLooped @@ -231,17 +231,17 @@ For NoteTracks, we interpret this to mean that any note-on or control change in the range mT0 <= t < mT1 is sent (notes that start before mT0 are not played even if they extend beyond mT0). Then, all notes - are turned off. Events in the range mT0 <= t < mT1 are then repeated, - offset by (mT1 - mT0), etc. We do NOT go back to the beginning and - play all control changes (update events) up to mT0, nor do we "undo" - any state changes between mT0 and mT1. + are turned off. Events in the range mT0 <= t < mT1 are then repeated, + offset by (mT1 - mT0), etc. We do NOT go back to the beginning and + play all control changes (update events) up to mT0, nor do we "undo" + any state changes between mT0 and mT1. \par NoteTrack PlayLooped Implementation The mIterator object (an Alg_iterator) returns NULL when there are - no more events scheduled before mT1. At mT1, we want to output + no more events scheduled before mT1. At mT1, we want to output all notes off messages, but the FillMidiBuffers() loop will exit if mNextEvent is NULL, so we create a "fake" mNextEvent for this - special "event" of sending all notes off. After that, we destroy + special "event" of sending all notes off. After that, we destroy the iterator and use PrepareMidiIterator() to set up a new one. At each iteration, time must advance by (mT1 - mT0), so the accumulated time is held in mMidiLoopOffset. @@ -258,7 +258,7 @@ \class AudioThread \brief Defined different on Mac and other platforms (on Mac it does not -use wxWidgets wxThread), this class sits in a thread loop reading and +use wxWidgets wxThread), this class sits in a thread loop reading and writing audio. *//*******************************************************************/ @@ -577,7 +577,7 @@ AudioIO::AudioIO() PmError pmErr = Pm_Initialize(); if (pmErr != pmNoError) { - wxString errStr = + wxString errStr = _("There was an error initializing the midi i/o layer.\n"); errStr += _("You will not be able to play midi.\n\n"); wxString pmErrStr = LAT1CTOWX(Pm_GetErrorText(pmErr)); @@ -632,8 +632,8 @@ AudioIO::~AudioIO() (Kill is the not-graceful way.) */ wxTheApp->Yield(); mThread->Delete(); - - if(mSilentBuf) + + if(mSilentBuf) DeleteSamples(mSilentBuf); delete mThread; @@ -743,9 +743,9 @@ wxArrayString AudioIO::GetInputSourceNames() void AudioIO::HandleDeviceChange() { // This should not happen, but it would screw things up if it did. - // Vaughan, 2010-10-08: But it *did* happen, due to a bug, and nobody + // Vaughan, 2010-10-08: But it *did* happen, due to a bug, and nobody // caught it because this method just returned. Added wxASSERT(). - wxASSERT(!IsStreamActive()); + wxASSERT(!IsStreamActive()); if (IsStreamActive()) return; @@ -813,10 +813,10 @@ void AudioIO::HandleDeviceChange() playbackParameters.suggestedLatency = Pa_GetDeviceInfo(playDeviceNum)->defaultLowOutputLatency; else - playbackParameters.suggestedLatency = DEFAULT_LATENCY_CORRECTION/1000.0; + playbackParameters.suggestedLatency = DEFAULT_LATENCY_CORRECTION/1000.0; PaStreamParameters captureParameters; - + captureParameters.device = recDeviceNum; captureParameters.sampleFormat = paFloat32;; captureParameters.hostApiSpecificStreamInfo = NULL; @@ -825,7 +825,7 @@ void AudioIO::HandleDeviceChange() captureParameters.suggestedLatency = Pa_GetDeviceInfo(recDeviceNum)->defaultLowInputLatency; else - captureParameters.suggestedLatency = DEFAULT_LATENCY_CORRECTION/1000.0; + captureParameters.suggestedLatency = DEFAULT_LATENCY_CORRECTION/1000.0; // try opening for record and playback error = Pa_OpenStream(&stream, @@ -833,7 +833,7 @@ void AudioIO::HandleDeviceChange() highestSampleRate, paFramesPerBufferUnspecified, paClipOff | paDitherOff, audacityAudioCallback, NULL); - + if (!error) { // Try portmixer for this stream mPortMixer = Px_OpenMixer(stream, 0); @@ -867,7 +867,7 @@ void AudioIO::HandleDeviceChange() highestSampleRate, paFramesPerBufferUnspecified, paClipOff | paDitherOff, audacityAudioCallback, NULL); - + if (!error) { mPortMixer = Px_OpenMixer(stream, 0); if (!mPortMixer) { @@ -922,7 +922,7 @@ void AudioIO::HandleDeviceChange() Px_SetInputVolume(mPortMixer, inputVol); Pa_CloseStream(stream); - + #if 0 printf("PortMixer: Output: %s Input: %s\n", @@ -966,11 +966,11 @@ bool AudioIO::StartPortAudioStream(double sampleRate, // advertise the chosen I/O sample rate to the UI mListener->OnAudioIORate((int)mRate); } - + // Special case: Our 24-bit sample format is different from PortAudio's // 3-byte packed format. So just make PortAudio return float samples, // since we need float values anyway to apply the gain. - // ANSWER-ME: So we *never* actually handle 24-bit?! This causes mCapture to be set to floatSample below. + // ANSWER-ME: So we *never* actually handle 24-bit?! This causes mCapture to be set to floatSample below. if (captureFormat == int24Sample) captureFormat = floatSample; @@ -979,7 +979,7 @@ bool AudioIO::StartPortAudioStream(double sampleRate, PaStreamParameters *playbackParameters = NULL; PaStreamParameters *captureParameters = NULL; - + double latencyDuration = DEFAULT_LATENCY_DURATION; gPrefs->Read(wxT("/AudioIO/LatencyDuration"), &latencyDuration); @@ -989,16 +989,16 @@ bool AudioIO::StartPortAudioStream(double sampleRate, // this sets the device index to whatever is "right" based on preferences, // then defaults playbackParameters->device = getPlayDevIndex(); - + const PaDeviceInfo *playbackDeviceInfo; playbackDeviceInfo = Pa_GetDeviceInfo( playbackParameters->device ); - + if( playbackDeviceInfo == NULL ) { delete playbackParameters; return false; } - + // regardless of source formats, we always mix to float playbackParameters->sampleFormat = paFloat32; playbackParameters->hostApiSpecificStreamInfo = NULL; @@ -1014,7 +1014,7 @@ bool AudioIO::StartPortAudioStream(double sampleRate, if( numCaptureChannels > 0) { mCaptureFormat = captureFormat; - + captureParameters = new PaStreamParameters; const PaDeviceInfo *captureDeviceInfo; // retrieve the index of the device set in the prefs, or a sensible @@ -1043,7 +1043,7 @@ bool AudioIO::StartPortAudioStream(double sampleRate, captureParameters->suggestedLatency = latencyDuration/1000.0; } #ifdef EXPERIMENTAL_MIDI_OUT - if (numPlaybackChannels == 0 && numCaptureChannels == 0) + if (numPlaybackChannels == 0 && numCaptureChannels == 0) return true; #endif @@ -1150,7 +1150,7 @@ int AudioIO::StartStream(WaveTrackArray playbackTracks, if (mPortStreamV19) { StopStream(); while(mPortStreamV19) - wxMilliSleep( 50 ); + wxMilliSleep( 50 ); } gPrefs->Read(wxT("/AudioIO/SWPlaythrough"), &mSoftwarePlaythrough, false); @@ -1234,7 +1234,7 @@ int AudioIO::StartStream(WaveTrackArray playbackTracks, // track wouldn't get the benefit of all 24 bits the card is capable // of. captureFormat = mCaptureTracks[0]->GetSampleFormat(); - + // Tell project that we are about to start recording if (mListener) mListener->OnAudioIOStartRecording(); @@ -1247,7 +1247,7 @@ int AudioIO::StartStream(WaveTrackArray playbackTracks, #ifdef EXPERIMENTAL_MIDI_OUT // TODO: it may be that midi out will not work unless audio in or out is - // active -- this would be a bug and may require a change in the + // active -- this would be a bug and may require a change in the // logic here. bool successMidi = true; @@ -1268,7 +1268,7 @@ int AudioIO::StartStream(WaveTrackArray playbackTracks, // // The (audio) stream has been opened successfully (assuming we tried - // to open it). We now proceed to + // to open it). We now proceed to // allocate the memory structures the stream will need. // @@ -1283,7 +1283,7 @@ int AudioIO::StartStream(WaveTrackArray playbackTracks, // a ring buffer of five seconds sampleCount playbackBufferSize = (sampleCount)(mRate * mPlaybackRingBufferSecs + 0.5f); - sampleCount playbackMixBufferSize = + sampleCount playbackMixBufferSize = (sampleCount)(mRate * mMaxPlaybackSecsToCopy + 0.5f); // In the extraordinarily rare case that we can't even afford 100 samples, just give up. @@ -1492,7 +1492,7 @@ void AudioIO::PrepareMidiIterator(bool send, double offset) // Start MIDI from current cursor position mSendMidiState = true; - while (mNextEvent && + while (mNextEvent && mNextEventTime < mT0 + offset) { if (send) OutputEvent(); GetNextEvent(); @@ -1500,23 +1500,23 @@ void AudioIO::PrepareMidiIterator(bool send, double offset) mSendMidiState = false; } -bool AudioIO::StartPortMidiStream() +bool AudioIO::StartPortMidiStream() { - int i; + int i; int nTracks = mMidiPlaybackTracks.GetCount(); // Only start MIDI stream if there is an open track if (nTracks == 0) return false; mMidiLatency = 1; // arbitrary, but small - //printf("StartPortMidiStream: mT0 %g mTime %g\n", + //printf("StartPortMidiStream: mT0 %g mTime %g\n", // gAudioIO->mT0, gAudioIO->mTime); /* get midi playback device */ PmDeviceID playbackDevice = Pm_GetDefaultOutputDeviceID(); - wxString playbackDeviceName = gPrefs->Read(wxT("/MidiIO/PlaybackDevice"), + wxString playbackDeviceName = gPrefs->Read(wxT("/MidiIO/PlaybackDevice"), wxT("")); - mSynthLatency = gPrefs->Read(wxT("/MidiIO/SynthLatency"), + mSynthLatency = gPrefs->Read(wxT("/MidiIO/SynthLatency"), DEFAULT_SYNTH_LATENCY); if (wxStrcmp(playbackDeviceName, wxT("")) != 0) { for (i = 0; i < Pm_CountDevices(); i++) { @@ -1533,12 +1533,12 @@ bool AudioIO::StartPortMidiStream() } // (else playback device has Pm_GetDefaultOuputDeviceID()) /* open output device */ - mLastPmError = Pm_OpenOutput(&mMidiStream, - playbackDevice, + mLastPmError = Pm_OpenOutput(&mMidiStream, + playbackDevice, NULL, - 0, + 0, &::MidiTime, - NULL, + NULL, mMidiLatency); if (mLastPmError == pmNoError) { mMidiStreamActive = true; @@ -1555,7 +1555,7 @@ bool AudioIO::StartPortMidiStream() // start midi output flowing (pending first audio callback) mMidiThreadFillBuffersLoopRunning = true; } - return (mLastPmError == pmNoError); + return (mLastPmError == pmNoError); } #endif @@ -1579,16 +1579,16 @@ void AudioIO::SetMeters(Meter *inputMeter, Meter *outputMeter) void AudioIO::StopStream() { - if( mPortStreamV19 == NULL + if( mPortStreamV19 == NULL #ifdef EXPERIMENTAL_MIDI_OUT - && mMidiStream == NULL + && mMidiStream == NULL #endif ) return; - if( Pa_IsStreamStopped( mPortStreamV19 ) + if( Pa_IsStreamStopped( mPortStreamV19 ) #ifdef EXPERIMENTAL_MIDI_OUT - && !mMidiStreamActive + && !mMidiStreamActive #endif ) return; @@ -1671,7 +1671,7 @@ void AudioIO::StopStream() // if output in progress, send all off, etc. AllNotesOff(); // AllNotesOff() should be sufficient to stop everything, but - // in Linux, if you Pm_Close() immediately, it looks like + // in Linux, if you Pm_Close() immediately, it looks like // messages are dropped. ALSA then seems to send All Sound Off // and Reset All Controllers messages, but not all synthesizers // respond to these messages. This is probably a bug in PortMidi @@ -1719,7 +1719,7 @@ void AudioIO::StopStream() // Everything is taken care of. Now, just free all the resources // we allocated in StartStream() // - + if( mPlaybackTracks.GetCount() > 0 ) { for( unsigned int i = 0; i < mPlaybackTracks.GetCount(); i++ ) @@ -1727,7 +1727,7 @@ void AudioIO::StopStream() delete mPlaybackBuffers[i]; delete mPlaybackMixers[i]; } - + delete[] mPlaybackBuffers; delete[] mPlaybackMixers; } @@ -1746,7 +1746,7 @@ void AudioIO::StopStream() // double latencyCorrection = DEFAULT_LATENCY_CORRECTION; gPrefs->Read(wxT("/AudioIO/LatencyCorrection"), &latencyCorrection); - + double recordingOffset = mLastRecordingOffset + latencyCorrection / 1000.0; @@ -1754,7 +1754,7 @@ void AudioIO::StopStream() { delete mCaptureBuffers[i]; delete mResample[i]; - + WaveTrack* track = mCaptureTracks[i]; track->Flush(); @@ -1799,7 +1799,7 @@ void AudioIO::StopStream() } } } - + delete[] mCaptureBuffers; delete[] mResample; } @@ -1817,7 +1817,7 @@ void AudioIO::StopStream() if (mListener && mNumCaptureChannels > 0) mListener->OnAudioIOStopRecording(); - + // // Only set token to 0 after we're totally finished with everything // @@ -1892,7 +1892,7 @@ double AudioIO::NormalizeStreamTime(double absoluteTime) const if (absoluteTime > mT1) absoluteTime = mT1; - + if (mCutPreviewGapLen > 0) { // msmeyer: We're in cut preview mode, so if we are on the right @@ -1933,7 +1933,7 @@ wxArrayLong AudioIO::GetSupportedPlaybackRates(int devIndex, double rate) int i; devInfo = Pa_GetDeviceInfo(devIndex); - + if (!devInfo) { wxLogDebug(wxT("GetSupportedPlaybackRates() Could not get device info!")); @@ -1952,7 +1952,7 @@ wxArrayLong AudioIO::GetSupportedPlaybackRates(int devIndex, double rate) pars.sampleFormat = paFloat32; pars.suggestedLatency = devInfo->defaultHighOutputLatency; pars.hostApiSpecificStreamInfo = NULL; - + for (i = 0; i < NumRatesToTry; i++) { // LLL: Remove when a proper method of determining actual supported @@ -2018,7 +2018,7 @@ wxArrayLong AudioIO::GetSupportedCaptureRates(int devIndex, double rate) pars.sampleFormat = paFloat32; pars.suggestedLatency = latencyDuration / 1000.0; pars.hostApiSpecificStreamInfo = NULL; - + for (i = 0; i < NumRatesToTry; i++) { // LLL: Remove when a proper method of determining actual supported @@ -2051,7 +2051,7 @@ wxArrayLong AudioIO::GetSupportedSampleRates(int playDevice, int recDevice, doub } // Check if we can use the cached rates - if (mCachedPlaybackIndex != -1 && mCachedCaptureIndex != -1 && + if (mCachedPlaybackIndex != -1 && mCachedCaptureIndex != -1 && playDevice == mCachedPlaybackIndex && recDevice == mCachedCaptureIndex && (rate == 0.0 || mCachedSampleRates.Index(rate) != wxNOT_FOUND)) @@ -2080,7 +2080,7 @@ wxArrayLong AudioIO::GetSupportedSampleRates(int playDevice, int recDevice, doub return result; } -/** \todo: should this take into account PortAudio's value for +/** \todo: should this take into account PortAudio's value for * PaDeviceInfo::defaultSampleRate? In principal this should let us work out * which rates are "real" and which resampled in the drivers, and so prefer * the real rates. */ @@ -2126,14 +2126,14 @@ double AudioIO::GetBestRate(bool capturing, bool playing, double sampleRate) else if (playing && !capturing) { rates = GetSupportedPlaybackRates(-1, sampleRate); } - else { // we assume capturing and playing - the alternative would be a + else { // we assume capturing and playing - the alternative would be a // bit odd rates = GetSupportedSampleRates(-1, -1, sampleRate); } /* rem rates is the array of hardware-supported sample rates (in the current * configuration), sampleRate is the Project Rate (desired sample rate) */ long rate = (long)sampleRate; - + if (rates.Index(rate) != wxNOT_FOUND) { wxLogDebug(wxT("GetBestRate() Returning %.0ld Hz"), rate); retval = rate; @@ -2177,7 +2177,7 @@ finished: mCachedBestRateIn = sampleRate; mCachedBestRateOut = retval; return retval; -} +} ////////////////////////////////////////////////////////////////////// @@ -2239,25 +2239,25 @@ MidiThread::ExitCode MidiThread::Entry() gAudioIO->FillMidiBuffers(); // test for end - double realTime = gAudioIO->mT0 + gAudioIO->MidiTime() * 0.001 - + double realTime = gAudioIO->mT0 + gAudioIO->MidiTime() * 0.001 - gAudioIO->PauseTime(); if (gAudioIO->mNumPlaybackChannels != 0) { realTime -= 1; // with audio, MidiTime() runs ahead 1s } - // The TrackPanel::OnTimer() method updates the time position - // indicator every 200ms, so it tends to not advance the + // The TrackPanel::OnTimer() method updates the time position + // indicator every 200ms, so it tends to not advance the // indicator to the end of the selection (mT1) but instead stop // up to 200ms before the end. At this point, output is shut // down and the indicator is removed, but for a brief time, the // indicator is clearly stopped before reaching mT1. To avoid // this, we do not set mMidiOutputComplete until we are actually // 0.22s beyond mT1 (even though we stop playing at mT1. This - // gives OnTimer() time to wake up and draw the final time + // gives OnTimer() time to wake up and draw the final time // position at mT1 before shutting down the stream. - double timeAtSpeed = (realTime - gAudioIO->mT0) * + double timeAtSpeed = (realTime - gAudioIO->mT0) * gAudioIO->mMidiPlaySpeed + gAudioIO->mT0; - gAudioIO->mMidiOutputComplete = + gAudioIO->mMidiOutputComplete = (!gAudioIO->mPlayLooped && timeAtSpeed >= gAudioIO->mT1 + 0.220); // !gAudioIO->mNextEvent); } @@ -2453,7 +2453,7 @@ wxString AudioIO::GetDeviceInfo() } const PaDeviceInfo* info; - + for (j = 0; j < cnt; j++) { s << wxT("==============================") << e; @@ -2510,7 +2510,7 @@ wxString AudioIO::GetDeviceInfo() s << wxT("Selected playback device: ") << playDeviceNum << wxT(" - ") << playDevice << e; }else{ s << wxT("No playback device found.") << e; - } + } wxArrayLong supportedSampleRates; @@ -2538,7 +2538,7 @@ wxString AudioIO::GetDeviceInfo() int error; PaStream *stream; - + PaStreamParameters playbackParameters; playbackParameters.device = playDeviceNum; @@ -2550,11 +2550,11 @@ wxString AudioIO::GetDeviceInfo() Pa_GetDeviceInfo(playDeviceNum)->defaultLowOutputLatency; } else{ - playbackParameters.suggestedLatency = DEFAULT_LATENCY_CORRECTION/1000.0; + playbackParameters.suggestedLatency = DEFAULT_LATENCY_CORRECTION/1000.0; } PaStreamParameters captureParameters; - + captureParameters.device = recDeviceNum; captureParameters.sampleFormat = paFloat32;; captureParameters.hostApiSpecificStreamInfo = NULL; @@ -2563,7 +2563,7 @@ wxString AudioIO::GetDeviceInfo() captureParameters.suggestedLatency = Pa_GetDeviceInfo(recDeviceNum)->defaultLowInputLatency; }else{ - captureParameters.suggestedLatency = DEFAULT_LATENCY_CORRECTION/1000.0; + captureParameters.suggestedLatency = DEFAULT_LATENCY_CORRECTION/1000.0; } error = Pa_OpenStream(&stream, @@ -2643,13 +2643,13 @@ wxString AudioIO::GetDeviceInfo() Px_GetInputVolume(PortMixer) > 0.3) EmulateMixerInputVol = true; Px_SetInputVolume(PortMixer, MixerInputVol); - + Pa_CloseStream(stream); - + s << wxT("==============================") << e; s << wxT("Capture volume is ") << (EmulateMixerInputVol? wxT("emulated"): wxT("native")) << e; s << wxT("Playback volume is ") << (EmulateMixerOutputVol? wxT("emulated"): wxT("native")) << e; - + Px_CloseMixer(PortMixer); } //end of massive if statement if a valid sample rate has been found @@ -2714,7 +2714,7 @@ void AudioIO::FillBuffers() { mWarpedTime += deltat; } - + secsAvail -= deltat; for( i = 0; i < mPlaybackTracks.GetCount(); i++ ) @@ -2741,7 +2741,7 @@ void AudioIO::FillBuffers() if(mLastSilentBufSize < lrint(deltat * mRate)) { //delete old if necessary - if(mSilentBuf) + if(mSilentBuf) DeleteSamples(mSilentBuf); mLastSilentBufSize=lrint(deltat * mRate); mSilentBuf = NewSamples(mLastSilentBufSize, floatSample); @@ -2780,7 +2780,7 @@ void AudioIO::FillBuffers() // The WaveTracks have their own buffering for efficiency. XMLStringWriter blockFileLog; int numChannels = mCaptureTracks.GetCount(); - + for( i = 0; (int)i < numChannels; i++ ) { int avail = commonlyAvail; @@ -2792,7 +2792,7 @@ void AudioIO::FillBuffers() { samplePtr temp = NewSamples(avail, trackFormat); mCaptureBuffers[i]->Get (temp, trackFormat, avail); - mCaptureTracks[i]-> Append(temp, trackFormat, avail, 1, + mCaptureTracks[i]-> Append(temp, trackFormat, avail, 1, &appendLog); DeleteSamples(temp); } @@ -2808,7 +2808,7 @@ void AudioIO::FillBuffers() */ size = mResample[i]->Process(mFactor, (float *)temp1, avail, !IsStreamActive(), &size, (float *)temp2, size); - mCaptureTracks[i]-> Append(temp2, floatSample, size, 1, + mCaptureTracks[i]-> Append(temp2, floatSample, size, 1, &appendLog); DeleteSamples(temp1); DeleteSamples(temp2); @@ -2823,7 +2823,7 @@ void AudioIO::FillBuffers() blockFileLog.EndTag(wxT("recordingrecovery")); } } - + if (mListener && !blockFileLog.IsEmpty()) mListener->OnAudioIONewBlockFiles(blockFileLog); } @@ -2851,7 +2851,7 @@ void AudioIO::OutputEvent() int data2 = -1; // 0.0005 is for rounding double eventTime = (mNextEventTime - mT0) / mMidiPlaySpeed + mT0; - double time = eventTime + PauseTime() + 0.0005 - + double time = eventTime + PauseTime() + 0.0005 - ((mMidiLatency + mSynthLatency) * 0.001); if (mNumPlaybackChannels > 0) { // is there audio playback? @@ -2859,7 +2859,7 @@ void AudioIO::OutputEvent() } else { time -= mT0; // Midi is not synced to audio } - // state changes have to go out without delay because the + // state changes have to go out without delay because the // midi stream time gets reset when playback starts, and // we don't want to leave any control changes scheduled for later if (time < 0 || mSendMidiState) time = 0; @@ -2882,25 +2882,25 @@ void AudioIO::OutputEvent() // if mNextEvent's channel is visible, play it, visibility can // be updated while playing. Be careful: if we have a note-off, // then we must not pay attention to the channel selection - // or mute/solo buttons because we must turn the note off + // or mute/solo buttons because we must turn the note off // even if the user changed something after the note began // Note that because multiple tracks can output to the same // MIDI channels, it is not a good idea to send "All Notes Off" // when the user presses the mute button. We have no easy way // to know what notes are sounding on any given muted track, so // we'll just wait for the note-off events to happen. - // Also note that note-offs are only sent when we call + // Also note that note-offs are only sent when we call // mIterator->request_note_off(), so notes that are not played // will note generate random note-offs. There is the interesting // case that if the playback is paused, all-notes-off WILL be sent // and if playback resumes, the pending note-off events WILL also // be sent (but if that is a problem, there would also be a problem // in the non-pause case. - if (((mNextEventTrack->GetVisibleChannels() & (1 << channel)) && + if (((mNextEventTrack->GetVisibleChannels() & (1 << channel)) && // only play if note is not muted: - !((mHasSolo || mNextEventTrack->GetMute()) && + !((mHasSolo || mNextEventTrack->GetMute()) && !mNextEventTrack->GetSolo())) || - (mNextEvent->is_note() && !mNextIsNoteOn)) { + (mNextEvent->is_note() && !mNextIsNoteOn)) { // Note event if (mNextEvent->is_note() && !mSendMidiState) { // Pitch and velocity @@ -2921,7 +2921,7 @@ void AudioIO::OutputEvent() // by comparing attribute pointers instead of string compares Alg_update_ptr update = (Alg_update_ptr) mNextEvent; const char *name = update->get_attribute(); - + if (!strcmp(name, "programi")) { // Instrument change data1 = update->parameter.i; @@ -2962,12 +2962,12 @@ void AudioIO::OutputEvent() } } if (command != -1) { - Pm_WriteShort(mMidiStream, timestamp, - Pm_Message((int) (command + channel), + Pm_WriteShort(mMidiStream, timestamp, + Pm_Message((int) (command + channel), (long) data1, (long) data2)); - /* printf("Pm_WriteShort %lx (%p) @ %d, advance %d\n", - Pm_Message((int) (command + channel), - (long) data1, (long) data2), + /* printf("Pm_WriteShort %lx (%p) @ %d, advance %d\n", + Pm_Message((int) (command + channel), + (long) data1, (long) data2), mNextEvent, timestamp, timestamp - Pt_Time()); */ } } @@ -2986,7 +2986,7 @@ void AudioIO::GetNextEvent() (void **) &mNextEventTrack, &nextOffset, mT1 + mMidiLoopOffset); if (mNextEvent) { - mNextEventTime = (mNextIsNoteOn ? mNextEvent->time : + mNextEventTime = (mNextIsNoteOn ? mNextEvent->time : mNextEvent->get_end_time()) + nextOffset;; } else { // terminate playback at mT1 mNextEvent = &gAllNotesOff; @@ -3048,14 +3048,14 @@ void AudioIO::FillMidiBuffers() // atomically now that we have the final value: mTime = trackTime; } - // advance time so that midi messages are written a little early, + // advance time so that midi messages are written a little early, // timestamps will insure accurate output timing. This is an "extra" // MIDI_SLEEP interval; another is added below to compensate for the // fact that we need to output messages that will become due while // we are sleeping. time += MIDI_SLEEP * 0.001; } - while (mNextEvent && + while (mNextEvent && (mNextEventTime - mT0) / mMidiPlaySpeed + mT0 < time + ((MIDI_SLEEP + mSynthLatency) * 0.001)) { OutputEvent(); @@ -3066,7 +3066,7 @@ void AudioIO::FillMidiBuffers() double AudioIO::PauseTime() { if (mNumPlaybackChannels > 0) { - return mNumPauseFrames / mRate; + return mNumPauseFrames / mRate; } else { return mPauseTime * 0.001; } @@ -3080,8 +3080,8 @@ PmTimestamp AudioIO::MidiTime() // PaUtil_GetTime(), mAudioCallbackOutputTime, PaUtil_GetTime() - mAudioCallbackOutputTime); // note: the extra 0.0005 is for rounding. Round down by casting to // unsigned long, then convert to PmTimeStamp (currently signed) - return (PmTimestamp) ((unsigned long) (1000 * (AudioTime() + 1.0005 - - mAudioFramesPerBuffer / mRate + + return (PmTimestamp) ((unsigned long) (1000 * (AudioTime() + 1.0005 - + mAudioFramesPerBuffer / mRate + PaUtil_GetTime() - mAudioCallbackOutputTime))); } else { return Pt_Time(); @@ -3106,7 +3106,7 @@ void AudioIO::AILAInitialize() { gPrefs->Read(wxT("/AudioIO/AnalysisTime"), &mAILAAnalysisTime, AILA_DEF_ANALYSIS_TIME); gPrefs->Read(wxT("/AudioIO/NumberAnalysis"), &mAILATotalAnalysis, AILA_DEF_NUMBER_ANALYSIS); mAILAGoalDelta /= 100.0; - mAILAGoalPoint /= 100.0; + mAILAGoalPoint /= 100.0; mAILAAnalysisTime /= 1000.0; mAILAMax = 0.0; mAILALastStartTime = max(0.0, mT0); @@ -3142,9 +3142,9 @@ void AudioIO::AILAProcess(double maxPeak) { mAILAClipped = true; printf("clipped"); } - + mAILAMax = max(mAILAMax, maxPeak); - + if ((mAILATotalAnalysis == 0 || mAILAAnalysisCounter < mAILATotalAnalysis) && mTime - mAILALastStartTime >= mAILAAnalysisTime) { putchar('\n'); mAILAMax = mInputMeter->ToLinearIfDB(mAILAMax); @@ -3184,7 +3184,7 @@ void AudioIO::AILAProcess(double maxPeak) { } else if ( mAILAMax < mAILAGoalPoint - mAILAGoalDelta ) { //if too low - printf("too low:\n"); + printf("too low:\n"); if (iv >= UPPER_BOUND || iv + 0.005 > mAILATopLevel) { //condition for too low volumes and/or variable volumes that cause mAILATopLevel to decrease too much //we can't improve it more if (mAILATotalAnalysis != 0) { @@ -3219,9 +3219,9 @@ void AudioIO::AILAProcess(double maxPeak) { mAILAAnalysisEndTime = Pa_GetStreamTime(mPortStreamV19) - mAILAAbsolutStartTime; mAILAMax = 0; printf("\tA decision was made @ %f\n", mAILAAnalysisEndTime); - mAILAClipped = false; + mAILAClipped = false; mAILALastStartTime = mTime; - + if (changetype == 0) mAILAChangeFactor *= 0.8; //time factor else if (mAILALastChangeType == changetype) @@ -3383,12 +3383,12 @@ int audacityAudioCallback(const void *inputBuffer, void *outputBuffer, // // Mix and copy to PortAudio's output buffer // - + if( outputBuffer && (numPlaybackChannels > 0) ) { bool cut = false; bool linkFlag = false; - + float *outputFloats = (float *)outputBuffer; for( i = 0; i < framesPerBuffer*numPlaybackChannels; i++) outputFloats[i] = 0.0; @@ -3422,7 +3422,7 @@ int audacityAudioCallback(const void *inputBuffer, void *outputBuffer, else if (gAudioIO->mTime > gAudioIO->mT1) gAudioIO->mTime = gAudioIO->mT1; gAudioIO->mSeek = 0.0; - + // Reset mixer positions and flush buffers for all tracks if(gAudioIO->mTimeTrack) gAudioIO->mWarpedTime = gAudioIO->mTimeTrack->ComputeWarpedLength(gAudioIO->mT0, gAudioIO->mTime); @@ -3443,7 +3443,7 @@ int audacityAudioCallback(const void *inputBuffer, void *outputBuffer, // Reenable the audio thread gAudioIO->mAudioThreadFillBuffersLoopRunning = true; - + return paContinue; } @@ -3456,27 +3456,27 @@ int audacityAudioCallback(const void *inputBuffer, void *outputBuffer, for( t = 0; t < numMidiPlaybackTracks; t++ ) if( gAudioIO->mMidiPlaybackTracks[t]->GetSolo() ) numSolo++; -#endif +#endif for( t = 0; t < numPlaybackTracks; t++) { WaveTrack *vt = gAudioIO->mPlaybackTracks[t]; - + if (linkFlag) linkFlag = false; else { cut = false; - + // Cut if somebody else is soloing if (numSolo>0 && !vt->GetSolo()) cut = true; - + // Cut if we're muted (unless we're soloing) if (vt->GetMute() && !vt->GetSolo()) cut = true; - + linkFlag = vt->GetLinked(); } - + #define ORIGINAL_DO_NOT_PLAY_ALL_MUTED_TRACKS_TO_END #ifdef ORIGINAL_DO_NOT_PLAY_ALL_MUTED_TRACKS_TO_END // this is original code prior to r10680 -RBD @@ -3503,9 +3503,9 @@ int audacityAudioCallback(const void *inputBuffer, void *outputBuffer, unsigned int len; if (cut) { - len = (unsigned int) + len = (unsigned int) gAudioIO->mPlaybackBuffers[t]->Discard(framesPerBuffer); - } else + } else { len = (unsigned int) gAudioIO->mPlaybackBuffers[t]->Get((samplePtr)tempFloats, @@ -3538,19 +3538,19 @@ int audacityAudioCallback(const void *inputBuffer, void *outputBuffer, for (i = 0; i < len; ++i) outputMeterFloats[numPlaybackChannels*i] += gain*tempFloats[i]; - + if (gAudioIO->mEmulateMixerOutputVol) gain *= gAudioIO->mMixerOutputVol; - + for(i=0; iGetChannel() == Track::RightChannel || vt->GetChannel() == Track::MonoChannel) { float gain = vt->GetChannelGain(1); - + // Output volume emulation (as above) if (outputMeterFloats != outputFloats) for (i = 0; i < len; ++i) @@ -3559,12 +3559,12 @@ int audacityAudioCallback(const void *inputBuffer, void *outputBuffer, if (gAudioIO->mEmulateMixerOutputVol) gain *= gAudioIO->mMixerOutputVol; - + for(i=0; i 0) ) { unsigned int len = framesPerBuffer; @@ -3604,7 +3604,7 @@ int audacityAudioCallback(const void *inputBuffer, void *outputBuffer, if (avail < len) len = avail; } - + if (len < framesPerBuffer) { gAudioIO->mLostSamples += (framesPerBuffer - len); @@ -3613,7 +3613,7 @@ int audacityAudioCallback(const void *inputBuffer, void *outputBuffer, if (len > 0) { for( t = 0; t < numCaptureChannels; t++) { - + // dmazzoni: // Un-interleave. Ugly special-case code required because the // capture channels could be in three different sample formats; @@ -3647,7 +3647,7 @@ int audacityAudioCallback(const void *inputBuffer, void *outputBuffer, } } break; } // switch - + gAudioIO->mCaptureBuffers[t]->Put((samplePtr)tempBuffer, gAudioIO->mCaptureFormat, len); @@ -3684,15 +3684,15 @@ int audacityAudioCallback(const void *inputBuffer, void *outputBuffer, // 08/27/2006: too inconsistent for now...just leave it a zero. // // 04/16/2008: Looks like si->inputLatency comes back with something useful though. - // This rearranged logic uses si->inputLatency, but if PortAudio fixes inputBufferAdcTime, - // this code won't have to be modified to use it. + // This rearranged logic uses si->inputLatency, but if PortAudio fixes inputBufferAdcTime, + // this code won't have to be modified to use it. // Also avoids setting mLastRecordingOffset except when simultaneously playing and recording. // if (numCaptureChannels > 0 && numPlaybackChannels > 0) // simultaneously playing and recording { if (timeInfo->inputBufferAdcTime > 0) gAudioIO->mLastRecordingOffset = timeInfo->inputBufferAdcTime - timeInfo->outputBufferDacTime; - else if (gAudioIO->mLastRecordingOffset == 0.0) + else if (gAudioIO->mLastRecordingOffset == 0.0) { const PaStreamInfo* si = Pa_GetStreamInfo( gAudioIO->mPortStreamV19 ); gAudioIO->mLastRecordingOffset = -si->inputLatency; @@ -3703,12 +3703,12 @@ int audacityAudioCallback(const void *inputBuffer, void *outputBuffer, else { // No tracks to play, but we should clear the output, and // possibly do software playthrough... - + if( outputBuffer && (numPlaybackChannels > 0) ) { float *outputFloats = (float *)outputBuffer; for( i = 0; i < framesPerBuffer*numPlaybackChannels; i++) outputFloats[i] = 0.0; - + if (inputBuffer && gAudioIO->mSoftwarePlaythrough) { DoSoftwarePlaythrough(inputBuffer, gAudioIO->mCaptureFormat, numCaptureChannels, @@ -3725,15 +3725,15 @@ int audacityAudioCallback(const void *inputBuffer, void *outputBuffer, } /* Send data to playback VU meter if applicable */ - if (gAudioIO->mOutputMeter && + if (gAudioIO->mOutputMeter && !gAudioIO->mOutputMeter->IsMeterDisabled() && outputMeterFloats) { - // Get here if playback meter is live + // Get here if playback meter is live /* It's critical that we don't update the meters while StopStream is * trying to stop PortAudio, otherwise it can lead to a freeze. We use * two variables to synchronize: * mUpdatingMeters tells StopStream when the callback is about to enter - * the code where it might update the meters, and + * the code where it might update the meters, and * mUpdateMeters is how the rest of the code tells the callback when it * is allowed to actually do the updating. * Note that mUpdatingMeters must be set first to avoid a race condition. @@ -3744,15 +3744,15 @@ int audacityAudioCallback(const void *inputBuffer, void *outputBuffer, framesPerBuffer, outputMeterFloats); - //v Vaughan, 2011-02-25: Moved this update back to TrackPanel::OnTimer() + //v Vaughan, 2011-02-25: Moved this update back to TrackPanel::OnTimer() // as it helps with playback issues reported by Bill and noted on Bug 258. - // The problem there occurs if Software Playthrough is on. - // Could conditionally do the update here if Software Playthrough is off, - // and in TrackPanel::OnTimer() if Software Playthrough is on, but not now. + // The problem there occurs if Software Playthrough is on. + // Could conditionally do the update here if Software Playthrough is off, + // and in TrackPanel::OnTimer() if Software Playthrough is on, but not now. //AudacityProject* pProj = GetActiveProject(); //MixerBoard* pMixerBoard = pProj->GetMixerBoard(); //if (pMixerBoard) - // pMixerBoard->UpdateMeters(gAudioIO->GetStreamTime(), + // pMixerBoard->UpdateMeters(gAudioIO->GetStreamTime(), // (pProj->mLastPlayMode == loopedPlay)); } gAudioIO->mUpdatingMeters = false; diff --git a/src/AudioIO.h b/src/AudioIO.h index 8c2d8bb07..bfb73ac8e 100644 --- a/src/AudioIO.h +++ b/src/AudioIO.h @@ -57,7 +57,7 @@ class AUDACITY_DLL_API AudioIOListener { public: AudioIOListener() {} virtual ~AudioIOListener() {} - + virtual void OnAudioIORate(int rate) = 0; virtual void OnAudioIOStartRecording() = 0; virtual void OnAudioIOStopRecording() = 0; @@ -87,11 +87,11 @@ class AUDACITY_DLL_API AudioIO { AudioIOListener* GetListener() { return mListener; } void SetListener(AudioIOListener* listener); - + /** \brief Start up Portaudio for capture and recording as needed for * input monitoring and software playthrough only * - * This uses the Default project sample format, current sample rate, and + * This uses the Default project sample format, current sample rate, and * selected number of input channels to open the recording device and start * reading input data. If software playthrough is enabled, it also opens * the output device in stereo to play the data through */ @@ -124,7 +124,7 @@ class AUDACITY_DLL_API AudioIO { /** \brief Move the playback / recording position of the current stream * by the specified amount from where it is now */ void SeekStream(double seconds) { mSeek = seconds; }; - + /** \brief Returns true if audio i/o is busy starting, stopping, playing, * or recording. * @@ -142,7 +142,7 @@ class AUDACITY_DLL_API AudioIO { #ifdef EXPERIMENTAL_MIDI_OUT /** \brief Compute the current PortMidi timestamp time. - * + * * This is used by PortMidi to synchronize midi time to audio samples */ PmTimestamp MidiTime(); @@ -152,14 +152,14 @@ class AUDACITY_DLL_API AudioIO { // We do the same for Midi, but it seems wasteful for at least two // threads to be frequently polling to update status. This could be // eliminated (also with a reduction in code I think) by updating mHasSolo - // each time a solo button is activated or deactivated. For now, I'm + // each time a solo button is activated or deactivated. For now, I'm // going to do this polling in the FillMidiBuffer routine to localize // changes for midi to the midi code, but I'm declaring the variable // here so possibly in the future, Audio code can use it too. -RBD private: bool mHasSolo; // is any playback solo button pressed? public: - bool SetHasSolo(bool hasSolo); + bool SetHasSolo(bool hasSolo); bool GetHasSolo() { return mHasSolo; } void SetMidiPlaySpeed(double s) { mMidiPlaySpeed = s * 0.01; } #endif @@ -171,7 +171,7 @@ class AUDACITY_DLL_API AudioIO { * recorded, and it's safe to flush to disk. */ bool IsAudioTokenActive(int token); - /** \brief Returns true if we're monitoring input (but not recording or + /** \brief Returns true if we're monitoring input (but not recording or * playing actual audio) */ bool IsMonitoring(); @@ -183,7 +183,7 @@ class AUDACITY_DLL_API AudioIO { /* Mixer services are always available. If no stream is running, these * methods use whatever device is specified by the preferences. If a * stream *is* running, naturally they manipulate the mixer associated - * with that stream. If no mixer is available, output is emulated and + * with that stream. If no mixer is available, output is emulated and * input is stuck at 1.0f (a gain is applied to output samples). */ void SetMixer(int inputSource); @@ -209,11 +209,11 @@ class AUDACITY_DLL_API AudioIO { /** \brief Get the list of inputs to the current mixer device * - * Returns an array of strings giving the names of the inputs to the + * Returns an array of strings giving the names of the inputs to the * soundcard mixer (driven by PortMixer) */ wxArrayString GetInputSourceNames(); - /** \brief update state after changing what audio devices are selected + /** \brief update state after changing what audio devices are selected * * Called when the devices stored in the preferences are changed to update * the audio mixer capabilities @@ -223,10 +223,10 @@ class AUDACITY_DLL_API AudioIO { * GetSupported*Rate functions considerably */ void HandleDeviceChange(); - /** \brief Set the current VU meters - this should be done once after + /** \brief Set the current VU meters - this should be done once after * each call to StartStream currently */ void SetMeters(Meter *inputMeter, Meter *outputMeter); - + /** \brief Get a list of sample rates the output (playback) device * supports. * @@ -380,7 +380,7 @@ private: /** \brief Get the number of audio samples ready in all of the recording * buffers. * - * Returns the smallest of the number of samples available for storage in + * Returns the smallest of the number of samples available for storage in * the recording buffers (i.e. the number of samples that can be read from * all record buffers without underflow). */ int GetCommonlyAvailCapture(); @@ -539,7 +539,7 @@ private: bool mEmulateMixerOutputVol; /** @brief Can we control the hardware input level? * - * This flag is set to true if using portmixer to control the + * This flag is set to true if using portmixer to control the * input volume seems to be working (and so we offer the user the control), * and to false (locking the control out) otherwise. This avoids stupid * scaled clipping problems when trying to do software emulated input volume @@ -550,10 +550,10 @@ private: bool mPlayLooped; double mCutPreviewGapStart; double mCutPreviewGapLen; - + samplePtr mSilentBuf; sampleCount mLastSilentBufSize; - + AudioIOListener* mListener; friend class AudioThread; diff --git a/src/AutoRecovery.cpp b/src/AutoRecovery.cpp index 2d97ee6c7..727097d0f 100644 --- a/src/AutoRecovery.cpp +++ b/src/AutoRecovery.cpp @@ -9,7 +9,7 @@ *******************************************************************//** \class AutoRecoveryDialog -\brief The AutoRecoveryDialog prompts the user whether to +\brief The AutoRecoveryDialog prompts the user whether to recover previous Audacity projects that were closed incorrectly. *//********************************************************************/ @@ -41,7 +41,7 @@ public: private: void PopulateList(); void PopulateOrExchange(ShuttleGui & S); - + void OnQuitAudacity(wxCommandEvent &evt); void OnRecoverNone(wxCommandEvent &evt); void OnRecoverAll(wxCommandEvent &evt); @@ -75,7 +75,7 @@ void AutoRecoveryDialog::PopulateOrExchange(ShuttleGui& S) S.AddVariableText(_("Some projects were not saved properly the last time Audacity was run.\nFortunately, the following projects can automatically be recovered:"), false); S.StartStatic(_("Recoverable projects")); - { + { mFileList = S.Id(ID_FILE_LIST).AddListControlReportMode(); /*i18n-hint: (noun). It's the name of the project to recover.*/ mFileList->InsertColumn(0, _("Name")); @@ -105,17 +105,17 @@ void AutoRecoveryDialog::PopulateOrExchange(ShuttleGui& S) void AutoRecoveryDialog::PopulateList() { mFileList->DeleteAllItems(); - + wxDir dir(FileNames::AutoSaveDir()); if (!dir.IsOpened()) return; - + wxString filename; int i = 0; for (bool c = dir.GetFirst(&filename, wxT("*.autosave"), wxDIR_FILES); c; c = dir.GetNext(&filename)) mFileList->InsertItem(i++, wxFileName(filename).GetName()); - + mFileList->SetColumnWidth(0, wxLIST_AUTOSIZE); } @@ -150,10 +150,10 @@ static bool HaveFilesToRecover() _("Error"), wxICON_STOP); return false; } - + wxString filename; bool c = dir.GetFirst(&filename, wxT("*.autosave"), wxDIR_FILES); - + return c; } @@ -174,7 +174,7 @@ static bool RemoveAllAutoSaveFiles() return false; } } - + return true; } @@ -187,11 +187,11 @@ static bool RecoverAllProjects(AudacityProject** pproj) _("Error"), wxICON_STOP); return false; } - + // Open a project window for each auto save file wxString filename; AudacityProject* proj = NULL; - + wxArrayString files; wxDir::GetAllFiles(FileNames::AutoSaveDir(), &files, wxT("*.autosave"), wxDIR_FILES); @@ -214,7 +214,7 @@ static bool RecoverAllProjects(AudacityProject** pproj) // is created. proj->OpenFile(files[i], false); } - + return true; } @@ -227,12 +227,12 @@ bool ShowAutoRecoveryDialogIfNeeded(AudacityProject** pproj, { AutoRecoveryDialog dlg(*pproj); int ret = dlg.ShowModal(); - + switch (ret) { case ID_RECOVER_NONE: return RemoveAllAutoSaveFiles(); - + case ID_RECOVER_ALL: if (didRecoverAnything) *didRecoverAnything = true; @@ -284,7 +284,7 @@ bool RecordingRecoveryHandler::HandleXMLTag(const wxChar *tag, WaveTrack* track = tracks.Item(index); WaveClip* clip = track->GetLastOrCreateClip(); Sequence* seq = clip->GetSequence(); - + // Load the blockfile from the XML BlockFile* blockFile = NULL; DirManager* dirManager = mProject->GetDirManager(); @@ -312,7 +312,7 @@ bool RecordingRecoveryHandler::HandleXMLTag(const wxChar *tag, if (!value) break; - + const wxString strValue = value; //this channels value does not correspond to WaveTrack::Left/Right/Mono, but which channel of the recording device //it came from, and thus we can't use XMLValueChecker::IsValidChannel on it. Rather we compare to the next attribute value. @@ -324,17 +324,17 @@ bool RecordingRecoveryHandler::HandleXMLTag(const wxChar *tag, } else if (wxStrcmp(attr, wxT("numchannels")) == 0) { - if (!XMLValueChecker::IsGoodInt(strValue) || !strValue.ToLong(&nValue) || + if (!XMLValueChecker::IsGoodInt(strValue) || !strValue.ToLong(&nValue) || (nValue < 1)) return false; if(mChannel >= nValue ) - return false; + return false; mNumChannels = nValue; } - + } } - + return true; } @@ -342,6 +342,6 @@ XMLTagHandler* RecordingRecoveryHandler::HandleXMLChild(const wxChar *tag) { if (wxStrcmp(tag, wxT("simpleblockfile")) == 0) return this; // HandleXMLTag also handles - + return NULL; } diff --git a/src/AutoRecovery.h b/src/AutoRecovery.h index deac73861..ffed7cfac 100644 --- a/src/AutoRecovery.h +++ b/src/AutoRecovery.h @@ -26,9 +26,9 @@ // Returns: True, if the start of Audacity should continue as normal // False if Audacity should be quit immediately // -// The didRecoverAnything param is strictly for a return value. +// The didRecoverAnything param is strictly for a return value. // Any value passed in is ignored. -// +// bool ShowAutoRecoveryDialogIfNeeded(AudacityProject** pproj, bool *didRecoverAnything); @@ -41,7 +41,7 @@ public: RecordingRecoveryHandler(AudacityProject* proj); virtual bool HandleXMLTag(const wxChar *tag, const wxChar **attrs); virtual XMLTagHandler *HandleXMLChild(const wxChar *tag); - + // This class only knows reading tags virtual void WriteXML(XMLWriter & WXUNUSED(xmlFile)) { wxASSERT(false); } diff --git a/src/BatchCommandDialog.cpp b/src/BatchCommandDialog.cpp index 50b59461a..d88cb9a5d 100644 --- a/src/BatchCommandDialog.cpp +++ b/src/BatchCommandDialog.cpp @@ -12,7 +12,7 @@ \class BatchCommandDialog \brief Provides a list of configurable commands for use with BatchCommands -Provides a list of commands, mostly effects, which can be chained +Provides a list of commands, mostly effects, which can be chained together in a simple linear sequence. Can configure parameters on each selected command. diff --git a/src/BatchCommands.cpp b/src/BatchCommands.cpp index 3bdfb7b5a..85450a82d 100644 --- a/src/BatchCommands.cpp +++ b/src/BatchCommands.cpp @@ -48,7 +48,7 @@ See also BatchCommandDialog and BatchProcessDialog. // - Specials (which we deal with specially here) enum eCommandType { CtEffect, CtMenu, CtSpecial }; -// TIDY-ME: Not currently translated, +// TIDY-ME: Not currently translated, // but there are issues to address if we do. // CLEANSPEECH remnant static wxString SpecialCommands[] = { @@ -134,7 +134,7 @@ bool BatchCommands::ReadChain(const wxString & chain) // Parse and clean wxString cmd = tf[i].Left(splitAt).Strip(wxString::both); wxString parm = tf[i].Mid(splitAt + 1).Strip(wxString::trailing); - + // Backward compatibility for old Chain scripts // Please comment the version of audacity these are introduced in, so // that old ones can easily be removed once users have had a chance to @@ -250,7 +250,7 @@ bool BatchCommands::RenameChain(const wxString & oldchain, const wxString & newc void BatchCommands::SetWavToMp3Chain() // a function per default chain? This is flawed design! MJS { ResetChain(); - + AddToChain( wxT("Normalize") ); AddToChain( wxT("ExportMP3") ); } @@ -275,7 +275,7 @@ wxArrayString BatchCommands::GetAllCommands() commands.Add( SpecialCommands[i] ); } // end CLEANSPEECH remnant - + int additionalEffects=ADVANCED_EFFECT; effects = EffectManager::Get().GetEffects(PROCESS_EFFECT | BUILTIN_EFFECT | PLUGIN_EFFECT | additionalEffects); @@ -419,7 +419,7 @@ bool BatchCommands::WriteMp3File( const wxString Name, int bitrate ) // commands take a selection as their parameter. // // If you find yourself adding lots of existing commands from the menus here, STOP -// and think again. +// and think again. // ======= IMPORTANT ======== // CLEANSPEECH remnant bool BatchCommands::ApplySpecialCommand(int WXUNUSED(iCommand), const wxString command,const wxString params) @@ -446,7 +446,7 @@ bool BatchCommands::ApplySpecialCommand(int WXUNUSED(iCommand), const wxString c extension = wxT(".flac"); else extension = wxT(".mp3"); - if (mFileName.IsEmpty()) { + if (mFileName.IsEmpty()) { filename = project->BuildCleanFileName(project->GetFileName(), extension); } else { @@ -508,7 +508,7 @@ bool BatchCommands::ApplySpecialCommand(int WXUNUSED(iCommand), const wxString c wxMessageBox(_("FLAC support is not included in this build of Audacity")); return false; #endif - } + } wxMessageBox(wxString::Format(_("Command %s not implemented yet"),command.c_str())); return false; } @@ -542,7 +542,7 @@ bool BatchCommands::ApplyEffectCommand( Effect * f, const wxString command, co AudacityProject *project = GetActiveProject(); //FIXME: for later versions may want to not select-all in batch mode. - //IF nothing selected, THEN select everything + //IF nothing selected, THEN select everything // (most effects require that you have something selected). project->SelectAllIfNone(); @@ -562,7 +562,7 @@ bool BatchCommands::ApplyCommand(const wxString command, const wxString params) return ApplySpecialCommand( i, command, params ); } // end CLEANSPEECH remnant - + // Test for an effect. Effect * f = EffectManager::Get().GetEffectByIdentifier( command ); if( f!=NULL ) diff --git a/src/BatchCommands.h b/src/BatchCommands.h index 3ccd98b19..c88b20899 100644 --- a/src/BatchCommands.h +++ b/src/BatchCommands.h @@ -44,7 +44,7 @@ class BatchCommands { static bool SetCurrentParametersFor( Effect * f, const wxString command, const wxString params); static wxArrayString GetAllCommands(); - // These commands do depend on the command list. + // These commands do depend on the command list. void ResetChain(); bool ReadChain(const wxString & chain); diff --git a/src/BatchProcessDialog.cpp b/src/BatchProcessDialog.cpp index b2071604c..d87805da0 100644 --- a/src/BatchProcessDialog.cpp +++ b/src/BatchProcessDialog.cpp @@ -90,7 +90,7 @@ void BatchProcessDialog::PopulateOrExchange(ShuttleGui &S) { S.StartVerticalLay(true); { - /*i18n-hint: A chain is a sequence of commands that can be applied + /*i18n-hint: A chain is a sequence of commands that can be applied * to one or more audio files.*/ S.StartStatic(_("&Select Chain"), true); { @@ -205,7 +205,7 @@ void BatchProcessDialog::OnApplyToFiles(wxCommandEvent & WXUNUSED(event)) wxString path = gPrefs->Read(wxT("/DefaultOpenPath"), ::wxGetCwd()); wxString prompt = _("Select file(s) for batch processing..."); - + FormatList l; wxString filter; wxString all; @@ -387,9 +387,9 @@ BEGIN_EVENT_TABLE(EditChainsDialog, wxDialog) END_EVENT_TABLE() enum { - BlankColumn, - ItemNumberColumn, - ActionColumn, + BlankColumn, + ItemNumberColumn, + ActionColumn, ParamsColumn, }; @@ -457,12 +457,12 @@ void EditChainsDialog::PopulateOrExchange(ShuttleGui & S) // JKC: Experimenting with an alternative way to get multiline // translated strings to work correctly without very long lines. // My appologies Alexandre if this way didn't work either. - // + // // With this method: // 1) it compiles fine under windows unicode and normal mode. // 2) xgettext source code has handling for the trailing '\' // - // It remains to see if linux and mac can cope and if xgettext + // It remains to see if linux and mac can cope and if xgettext // actually does do fine with strings presented like this. // If it doesn't work out, revert to all-on-one-line. S.SetStyle(wxSUNKEN_BORDER | wxLC_REPORT | wxLC_HRULES | wxLC_SINGLE_SEL | @@ -485,7 +485,7 @@ void EditChainsDialog::PopulateOrExchange(ShuttleGui & S) wxLC_SINGLE_SEL); mList = S.Id(CommandsListID).AddListControlReportMode(); - //An empty first column is a workaround - under Win98 the first column + //An empty first column is a workaround - under Win98 the first column //can't be right aligned. mList->InsertColumn(BlankColumn, wxT(""), wxLIST_FORMAT_LEFT); /* i18n-hint: This is the number of the command in the list */ @@ -663,7 +663,7 @@ void EditChainsDialog::FitColumns() mList->SetColumnWidth(1, wxLIST_AUTOSIZE_USEHEADER); mList->SetColumnWidth(2, wxLIST_AUTOSIZE_USEHEADER); mList->SetColumnWidth(3, wxLIST_AUTOSIZE); -#endif +#endif int bestfit = mList->GetColumnWidth(3); int clientsize = mList->GetClientSize().GetWidth(); @@ -703,7 +703,7 @@ void EditChainsDialog::OnChainsEndEdit(wxListEvent &event) PopulateChains(); } -/// +/// void EditChainsDialog::OnAdd(wxCommandEvent & WXUNUSED(event)) { while (true) { diff --git a/src/Benchmark.cpp b/src/Benchmark.cpp index 71a4745ff..af4d25631 100644 --- a/src/Benchmark.cpp +++ b/src/Benchmark.cpp @@ -9,7 +9,7 @@ *******************************************************************//** \class BenchmarkDialog -\brief BenchmarkDialog is used for measuring performance and accuracy +\brief BenchmarkDialog is used for measuring performance and accuracy of the BlockFile system. *//*******************************************************************/ @@ -46,9 +46,9 @@ class BenchmarkDialog: public wxDialog public: // constructors and destructors BenchmarkDialog( wxWindow *parent ); - + void MakeBenchmarkDialog(); - + private: // WDR: handler declarations void OnRun( wxCommandEvent &event ); @@ -72,7 +72,7 @@ private: bool mEditDetail; wxTextCtrl *mText; - + private: DECLARE_EVENT_TABLE() }; @@ -153,7 +153,7 @@ void BenchmarkDialog::MakeBenchmarkDialog() { ShuttleGui S(this, eIsCreating); wxControl *item; - + // Strings don't need to be translated because this class doesn't // ever get used in a stable release. @@ -293,7 +293,7 @@ void BenchmarkDialog::FlushPrint() void BenchmarkDialog::OnRun( wxCommandEvent & WXUNUSED(event)) { TransferDataFromWindow(); - + if (!Validate()) return; @@ -353,7 +353,7 @@ void BenchmarkDialog::OnRun( wxCommandEvent & WXUNUSED(event)) } // The chunks are the pieces we move around in the test. - // They are (and are supposed to be) a different size to + // They are (and are supposed to be) a different size to // the blocks that make the blockfiles. That way we get to // do some testing of when edit chunks cross blockfile boundaries. Printf(wxT("Using %d chunks of %d samples each, for a total of ") @@ -511,7 +511,7 @@ void BenchmarkDialog::OnRun( wxCommandEvent & WXUNUSED(event)) elapsed = timer.Time(); Printf(wxT("Time to check all data (2): %ld ms\n"), elapsed); - + Printf(wxT("At 44100 Hz, 16-bits per sample, the estimated number of\n") wxT("simultaneous tracks that could be played at once: %.1f\n"), (nChunks*chunkSize/44100.0)/(elapsed/1000.0)); diff --git a/src/BlockFile.cpp b/src/BlockFile.cpp index 790d6ebc3..ed94a1a58 100644 --- a/src/BlockFile.cpp +++ b/src/BlockFile.cpp @@ -36,8 +36,8 @@ counts. *//****************************************************************//** \class SummaryInfo -\brief Works with BlockFile to hold info about max and min and RMS -over multiple samples, which in turn allows rapid drawing when zoomed +\brief Works with BlockFile to hold info about max and min and RMS +over multiple samples, which in turn allows rapid drawing when zoomed out. *//*******************************************************************/ @@ -367,7 +367,7 @@ void BlockFile::FixSummary(void *data) for(i=0; i mSummaryInfo.frames64K) len = mSummaryInfo.frames64K - start; - CopySamples(summary + mSummaryInfo.offset64K + + CopySamples(summary + mSummaryInfo.offset64K + (start * mSummaryInfo.bytesPerFrame), mSummaryInfo.format, (samplePtr)buffer, floatSample, len*mSummaryInfo.fields); @@ -538,9 +538,9 @@ AliasBlockFile::AliasBlockFile(wxFileName baseFileName, } AliasBlockFile::AliasBlockFile(wxFileName existingSummaryFileName, - wxFileName aliasedFileName, + wxFileName aliasedFileName, sampleCount aliasStart, - sampleCount aliasLen, + sampleCount aliasLen, int aliasChannel, float min, float max, float rms): BlockFile(existingSummaryFileName, aliasLen), @@ -616,7 +616,7 @@ bool AliasBlockFile::ReadSummary(void *data) mSilentLog=TRUE; return true; - }else mSilentLog=FALSE; // worked properly, any future error is new + }else mSilentLog=FALSE; // worked properly, any future error is new if(silence) delete silence; diff --git a/src/BlockFile.h b/src/BlockFile.h index f24b57623..b8254cc43 100644 --- a/src/BlockFile.h +++ b/src/BlockFile.h @@ -56,7 +56,7 @@ class BlockFile { sampleCount start, sampleCount len) = 0; // Other Properties - + // Write cache to disk, if it has any virtual bool GetNeedWriteCacheToDisk() { return false; } virtual void WriteCacheToDisk() { /* no cache by default */ } @@ -96,16 +96,16 @@ class BlockFile { /// Returns TRUE if this block references another disk file virtual bool IsAlias() { return false; } - + /// Returns TRUE if this block's complete summary has been computed and is ready (for OD) virtual bool IsSummaryAvailable(){return true;} /// Returns TRUE if this block's complete data is ready to be accessed by Read() virtual bool IsDataAvailable(){return true;} - - /// Returns TRUE if the summary has not yet been written, but is actively being computed and written to disk + + /// Returns TRUE if the summary has not yet been written, but is actively being computed and written to disk virtual bool IsSummaryBeingComputed(){return false;} - + /// Create a new BlockFile identical to this, using the given filename virtual BlockFile *Copy(wxFileName newFileName) = 0; @@ -125,7 +125,7 @@ class BlockFile { ///when the project closes, it locks the blockfiles. ///Override this in case it needs special treatment virtual void CloseLock(){Lock();} - + /// Prevents a read on other threads. The basic blockfile runs on only one thread, so does nothing. virtual void LockRead(){} /// Allows reading on other threads. diff --git a/src/CrossFade.h b/src/CrossFade.h index 0b45abefe..99adc4a60 100644 --- a/src/CrossFade.h +++ b/src/CrossFade.h @@ -5,15 +5,15 @@ CrossFade.h (c) 2005 The Audacity Team - Licensed under the GPL version 2.0 + Licensed under the GPL version 2.0 **********************************************************************/ #ifndef __AUDACITY_CROSSFADE__ #define __AUDACITY_CROSSFADE__ -/// This defines a crossfader class that +/// This defines a crossfader class that /// accepts a list of WaveClips and can do a mini-mixing -/// to produce the desired crossfading +/// to produce the desired crossfading #include "SampleFormat.h" #include "Resample.h" @@ -39,18 +39,18 @@ class CrossFader void SetMixCrossFade(){mType = FT_MIX;}; void SetTriangularCrossFade(){mType = FT_TRIANGULAR;}; void SetExponentialCrossFade(){mType = FT_EXPONENTIAL;}; - + void AddClip( WaveClip * clip); void ClearClips(); //Produces samples according to crossfading rules. - bool GetSamples(samplePtr buffer, sampleFormat format, + bool GetSamples(samplePtr buffer, sampleFormat format, sampleCount start, sampleCount len); - + protected: WaveClipList mClips; private: - + bool CrossFadeMix(samplePtr buffer, sampleFormat format, sampleCount start, sampleCount len); FadeType mType; diff --git a/src/Dependencies.cpp b/src/Dependencies.cpp index 78af5f481..e412f41a7 100644 --- a/src/Dependencies.cpp +++ b/src/Dependencies.cpp @@ -3,7 +3,7 @@ Audacity: A Digital Audio Editor Audacity(R) is copyright (c) 1999-2008 Audacity Team. License: GPL v2. See License.txt. - + Dependencies.cpp Dominic Mazzoni @@ -12,7 +12,7 @@ LRN Michael Chinen Vaughan Johnson - + The primary function provided in this source file is ShowDependencyDialogIfNeeded. It checks a project to see if any of its WaveTracks contain AliasBlockFiles; if so it @@ -39,8 +39,8 @@ #include "Track.h" // Note, this #include must occur here, not up with the others! -// It must be between the WX_DECLARE_OBJARRAY and WX_DEFINE_OBJARRAY. -#include +// It must be between the WX_DECLARE_OBJARRAY and WX_DEFINE_OBJARRAY. +#include WX_DEFINE_OBJARRAY( AliasedFileArray ); @@ -120,38 +120,38 @@ void FindDependencies(AudacityProject *project, int i; for (i = 0; i < (int)blocks.GetCount(); i++) { BlockFile *f = blocks[i]->f; - if (f->IsAlias() && (blockFileHash.count(f) == 0)) + if (f->IsAlias() && (blockFileHash.count(f) == 0)) { // f is an alias block we have not yet counted. blockFileHash[f] = true; // Don't count the same blockfile twice. AliasBlockFile *aliasBlockFile = (AliasBlockFile *)f; wxFileName fileName = aliasBlockFile->GetAliasedFileName(); - // In DirManager::ProjectFSCK(), if the user has chosen to - // "Replace missing audio with silence", the code there puts in an empty wxFileName. + // In DirManager::ProjectFSCK(), if the user has chosen to + // "Replace missing audio with silence", the code there puts in an empty wxFileName. // Don't count those in dependencies. if (!fileName.IsOk()) continue; - + wxString fileNameStr = fileName.GetFullPath(); int blockBytes = (SAMPLE_SIZE(format) * aliasBlockFile->GetLength()); if (aliasedFileHash.count(fileNameStr) > 0) - // Already put this AliasBlockFile in aliasedFileHash. + // Already put this AliasBlockFile in aliasedFileHash. // Update block count. aliasedFileHash[fileNameStr]->mByteCount += blockBytes; - else + else { - // Haven't counted this AliasBlockFile yet. + // Haven't counted this AliasBlockFile yet. // Add to return array and internal hash. - outAliasedFiles->Add(AliasedFile(fileName, - blockBytes, + outAliasedFiles->Add(AliasedFile(fileName, + blockBytes, fileName.FileExists())); aliasedFileHash[fileNameStr] = &((*outAliasedFiles)[outAliasedFiles->GetCount()-1]); } } - } + } } // Given a project and a list of aliased files that should no @@ -162,12 +162,12 @@ static void RemoveDependencies(AudacityProject *project, { DirManager *dirManager = project->GetDirManager(); - ProgressDialog *progress = + ProgressDialog *progress = new ProgressDialog(_("Removing Dependencies"), _("Copying audio data into project...")); int updateResult = eProgressSuccess; - // Hash aliasedFiles based on their full paths and + // Hash aliasedFiles based on their full paths and // count total number of bytes to process. AliasedFileHash aliasedFileHash; wxLongLong totalBytesToProcess = 0; @@ -177,16 +177,16 @@ static void RemoveDependencies(AudacityProject *project, wxString fileNameStr = aliasedFiles->Item(i).mFileName.GetFullPath(); aliasedFileHash[fileNameStr] = &aliasedFiles->Item(i); } - + BlockArray blocks; GetAllSeqBlocks(project, &blocks); const sampleFormat format = project->GetDefaultFormat(); - ReplacedBlockFileHash blockFileHash; + ReplacedBlockFileHash blockFileHash; wxLongLong completedBytes = 0; for (i = 0; i < blocks.GetCount(); i++) { BlockFile *f = blocks[i]->f; - if (f->IsAlias() && (blockFileHash.count(f) == 0)) + if (f->IsAlias() && (blockFileHash.count(f) == 0)) { // f is an alias block we have not yet processed. AliasBlockFile *aliasBlockFile = (AliasBlockFile *)f; @@ -260,8 +260,8 @@ private: void OnYes(wxCommandEvent &evt); void SaveFutureActionChoice(); - - + + AudacityProject *mProject; AliasedFileArray *mAliasedFiles; bool mIsSaving; @@ -273,7 +273,7 @@ private: wxButton *mCopySelectedFilesButton; wxButton *mCopyAllFilesButton; wxChoice *mFutureActionChoice; - + public: DECLARE_EVENT_TABLE() }; @@ -301,19 +301,19 @@ DependencyDialog::DependencyDialog(wxWindow *parent, bool isSaving) : wxDialog(parent, id, _("Project Depends on Other Audio Files"), wxDefaultPosition, wxDefaultSize, - (isSaving ? + (isSaving ? (wxDEFAULT_DIALOG_STYLE & ~wxCLOSE_BOX) : // no close box when saving - wxDEFAULT_DIALOG_STYLE) | - wxRESIZE_BORDER), + wxDEFAULT_DIALOG_STYLE) | + wxRESIZE_BORDER), mProject(project), mAliasedFiles(aliasedFiles), mIsSaving(isSaving), - mHasMissingFiles(false), - mHasNonMissingFiles(false), + mHasMissingFiles(false), + mHasNonMissingFiles(false), mMessageStaticText(NULL), mFileListCtrl(NULL), mCopySelectedFilesButton(NULL), - mCopyAllFilesButton(NULL), + mCopyAllFilesButton(NULL), mFutureActionChoice(NULL) { ShuttleGui S(this, eIsCreating); @@ -322,11 +322,11 @@ DependencyDialog::DependencyDialog(wxWindow *parent, const wxString kStdMsg = _("Copying these files into your project will remove this dependency.\ -\nThis is safer, but needs more disk space."); +\nThis is safer, but needs more disk space."); const wxString kExtraMsgForMissingFiles = _("\n\nFiles shown as MISSING have been moved or deleted and cannot be copied.\ -\nRestore them to their original location to be able to copy into project."); +\nRestore them to their original location to be able to copy into project."); void DependencyDialog::PopulateOrExchange(ShuttleGui& S) { @@ -336,7 +336,7 @@ void DependencyDialog::PopulateOrExchange(ShuttleGui& S) mMessageStaticText = S.AddVariableText(kStdMsg, false); S.StartStatic(_("Project Dependencies")); - { + { mFileListCtrl = S.Id(FileListID).AddListControlReportMode(); mFileListCtrl->InsertColumn(0, _("Audio File")); mFileListCtrl->SetColumnWidth(0, 220); @@ -344,13 +344,13 @@ void DependencyDialog::PopulateOrExchange(ShuttleGui& S) mFileListCtrl->SetColumnWidth(1, 120); PopulateList(); - mCopySelectedFilesButton = + mCopySelectedFilesButton = S.Id(CopySelectedFilesButtonID).AddButton( - _("Copy Selected Files"), + _("Copy Selected Files"), wxALIGN_LEFT); mCopySelectedFilesButton->Enable( mFileListCtrl->GetSelectedItemCount() > 0); - mCopySelectedFilesButton->SetDefault(); + mCopySelectedFilesButton->SetDefault(); mCopySelectedFilesButton->SetFocus(); } S.EndStatic(); @@ -364,26 +364,26 @@ void DependencyDialog::PopulateOrExchange(ShuttleGui& S) else S.Id(wxID_NO).AddButton(_("Do Not Copy")); - mCopyAllFilesButton = + mCopyAllFilesButton = S.Id(wxID_YES).AddButton(_("Copy All Files (Safer)")); - // Enabling mCopyAllFilesButton is also done in PopulateList, + // Enabling mCopyAllFilesButton is also done in PopulateList, // but at its call above, mCopyAllFilesButton does not yet exist. mCopyAllFilesButton->Enable(!mHasMissingFiles); } S.EndHorizontalLay(); - + if (mIsSaving) { S.StartHorizontalLay(wxALIGN_LEFT); { wxArrayString choices; - /*i18n-hint: One of the choices of what you want Audacity to do when + /*i18n-hint: One of the choices of what you want Audacity to do when * Audacity finds a project depends on another file.*/ choices.Add(_("Ask me")); choices.Add(_("Always copy all files (safest)")); choices.Add(_("Never copy any files")); - mFutureActionChoice = + mFutureActionChoice = S.Id(FutureActionChoiceID).AddChoice( _("Whenever a project depends on other files:"), _("Ask me"), &choices); @@ -419,7 +419,7 @@ void DependencyDialog::PopulateList() mHasNonMissingFiles = true; mFileListCtrl->SetItemState(i, wxLIST_STATE_SELECTED, wxLIST_STATE_SELECTED); } - else + else { mFileListCtrl->InsertItem(i, _("MISSING ") + fileName.GetFullPath()); mHasMissingFiles = true; @@ -429,7 +429,7 @@ void DependencyDialog::PopulateList() mFileListCtrl->SetItem(i, 1, Internat::FormatSize(byteCount)); mFileListCtrl->SetItemData(i, long(bOriginalExists)); } - + wxString msg = kStdMsg; if (mHasMissingFiles) msg += kExtraMsgForMissingFiles; @@ -446,10 +446,10 @@ void DependencyDialog::OnList(wxListEvent &evt) wxString itemStr = evt.GetText(); if (evt.GetData() == 0) - // This list item is one of mAliasedFiles for which + // This list item is one of mAliasedFiles for which // the original is missing, i.e., moved or deleted. - // wxListCtrl does not provide for items that are not - // allowed to be selected, so always deselect these items. + // wxListCtrl does not provide for items that are not + // allowed to be selected, so always deselect these items. mFileListCtrl->SetItemState(evt.GetIndex(), 0, wxLIST_STATE_SELECTED); // Deselect. mCopySelectedFilesButton->Enable( @@ -461,10 +461,10 @@ void DependencyDialog::OnSize(wxSizeEvent &evt) int fileListCtrlWidth, fileListCtrlHeight; mFileListCtrl->GetSize(&fileListCtrlWidth, &fileListCtrlHeight); - // File path is column 0. File size is column 1. - // File size column is always 120 px wide. + // File path is column 0. File size is column 1. + // File size column is always 120 px wide. // Also subtract 8 from file path column width for borders. - mFileListCtrl->SetColumnWidth(0, fileListCtrlWidth - 120 - 8); + mFileListCtrl->SetColumnWidth(0, fileListCtrlWidth - 120 - 8); mFileListCtrl->SetColumnWidth(1, 120); wxDialog::OnSize(evt); } @@ -492,7 +492,7 @@ void DependencyDialog::OnCopySelectedFiles(wxCommandEvent & WXUNUSED(event)) aliasedFilesToDelete.Add(mAliasedFiles->Item(i)); mAliasedFiles->RemoveAt(i); } - } + } RemoveDependencies(mProject, &aliasedFilesToDelete); PopulateList(); @@ -514,7 +514,7 @@ void DependencyDialog::OnCancel(wxCommandEvent& WXUNUSED(event)) if (ret != wxYES) return; } - + EndModal(wxID_CANCEL); } @@ -522,7 +522,7 @@ void DependencyDialog::SaveFutureActionChoice() { if (mFutureActionChoice) { - wxString savePref; + wxString savePref; int sel = mFutureActionChoice->GetSelection(); switch (sel) { @@ -546,26 +546,26 @@ bool ShowDependencyDialogIfNeeded(AudacityProject *project, FindDependencies(project, &aliasedFiles); if (aliasedFiles.GetCount() == 0) { - if (!isSaving) + if (!isSaving) { - wxString msg = + wxString msg = _("Your project is currently self-contained; it does not depend on any external audio files. \ \n\nIf you change the project to a state that has external dependencies on imported \ files, it will no longer be self-contained. If you then Save without copying those files in, \ you may lose data."); - wxMessageBox(msg, + wxMessageBox(msg, _("Dependency Check"), wxOK | wxICON_INFORMATION, project); } return true; // Nothing to do. } - + if (isSaving) { - wxString action = + wxString action = gPrefs->Read( - wxT("/FileFormats/SaveProjectWithDependencies"), + wxT("/FileFormats/SaveProjectWithDependencies"), wxT("ask")); if (action == wxT("copy")) { @@ -582,7 +582,7 @@ you may lose data."); int returnCode = dlog.ShowModal(); if (returnCode == wxID_CANCEL) return false; - else if (returnCode == wxID_YES) + else if (returnCode == wxID_YES) RemoveDependencies(project, &aliasedFiles); return true; diff --git a/src/Dependencies.h b/src/Dependencies.h index d6b4e6c05..c4bda4d57 100644 --- a/src/Dependencies.h +++ b/src/Dependencies.h @@ -3,7 +3,7 @@ Audacity: A Digital Audio Editor Audacity(R) is copyright (c) 1999-2008 Audacity Team. License: GPL v2. See License.txt. - + Dependencies.h Dominic Mazzoni @@ -18,10 +18,10 @@ class AudacityProject; -class AliasedFile +class AliasedFile { public: - AliasedFile(wxFileName fileName, wxLongLong byteCount, bool bOriginalExists) + AliasedFile(wxFileName fileName, wxLongLong byteCount, bool bOriginalExists) { mFileName = fileName; mByteCount = byteCount; diff --git a/src/DeviceManager.cpp b/src/DeviceManager.cpp index 5109390f1..4c23f17a0 100644 --- a/src/DeviceManager.cpp +++ b/src/DeviceManager.cpp @@ -38,12 +38,12 @@ DeviceManager DeviceManager::dm; -/// Gets the singleton instance +/// Gets the singleton instance DeviceManager* DeviceManager::Instance() { return &dm; } - + /// Releases memory assosiated with the singleton void DeviceManager::Destroy() { @@ -89,7 +89,7 @@ DeviceSourceMap* DeviceManager::GetDefaultDevice(int hostIndex, int isInput) if (maps[i].deviceIndex == targetDevice) return &maps[i]; } - + wxLogDebug(wxT("GetDefaultDevice() no default device")); return NULL; } @@ -149,17 +149,17 @@ static void AddSourcesFromStream(int deviceIndex, const PaDeviceInfo *info, std: } //if there is only one source, we don't need to concatenate the source - //or enumerate, because it is something meaningless like 'master' + //or enumerate, because it is something meaningless like 'master' //(as opposed to 'mic in' or 'line in'), and the user doesn't have any choice. //note that some devices have no input sources at all but are still valid. //the behavior we do is the same for 0 and 1 source cases. map.totalSources = Px_GetNumInputSources(portMixer); #endif - + if (map.totalSources <= 1) { map.sourceIndex = 0; maps->push_back(map); - } + } #ifdef USE_PORTMIXER else { //open up a stream with the device so portmixer can get the info out of it. @@ -262,14 +262,14 @@ void DeviceManager::Rescan() // check to see if there is a stream open - can happen if monitoring, // but otherwise Rescan() should not be available to the user. if (gAudioIO) { - if (gAudioIO->IsMonitoring()) + if (gAudioIO->IsMonitoring()) { gAudioIO->StopStream(); while (gAudioIO->IsBusy()) wxMilliSleep(100); } } - + // restart portaudio - this updates the device list Pa_Terminate(); Pa_Initialize(); diff --git a/src/DeviceManager.h b/src/DeviceManager.h index df4fdd938..958d4ccab 100644 --- a/src/DeviceManager.h +++ b/src/DeviceManager.h @@ -37,9 +37,9 @@ wxString MakeDeviceSourceString(const DeviceSourceMap *map); class DeviceManager { public: - /// Gets the singleton instance + /// Gets the singleton instance static DeviceManager* Instance(); - + /// Releases memory assosiated with the singleton static void Destroy(); @@ -64,7 +64,7 @@ class DeviceManager DeviceSourceMap* GetDefaultDevice(int hostIndex, int isInput); bool m_inited; - + std::vector mInputDeviceSourceMaps; std::vector mOutputDeviceSourceMaps; diff --git a/src/DirManager.cpp b/src/DirManager.cpp index a0570ed3a..097bfaa06 100644 --- a/src/DirManager.cpp +++ b/src/DirManager.cpp @@ -47,7 +47,7 @@ The current scheme uses two levels of subdirectories - up to 256 'eXX' and up to 256 'dYY' directories within each of the 'eXX' dirs, where XX and YY are hex chars. In each of the dXX directories there are up to 256 audio files (e.g. .au or .auf). - They have a filename scheme of 'eXXYYZZZZ', where XX and YY refers to the + They have a filename scheme of 'eXXYYZZZZ', where XX and YY refers to the subdirectories as above. The 'ZZZZ' component is generated randomly for some reason. The XX and YY components are sequential. DirManager fills up the current dYY subdir until 256 are created, and moves on to the next one. @@ -56,7 +56,7 @@ 'e00/d00/e000015e8.au', and the 257th may be 'e00/d01/e0001f02a.au'. On close the blockfiles that are no longer referenced by the project (edited or deleted) are removed, along with the consequent empty directories. - + *//*******************************************************************/ @@ -119,7 +119,7 @@ wxMemorySize GetFreeMemory() mach_msg_type_number_t cnt = HOST_VM_INFO_COUNT; vm_statistics_data_t stats; vm_size_t pagesize = 0; - + memset(&stats, 0, sizeof(stats)); host_page_size(port, &pagesize); @@ -139,16 +139,16 @@ wxMemorySize GetFreeMemory() // Behavior of RecursivelyEnumerate is tailored to our uses and not // entirely straightforward. It recurs depth-first from the passed- // in directory into its subdirs according to optional dirspec -// pattern, building a list of directories and (optionally) files +// pattern, building a list of directories and (optionally) files // in the listed order. The dirspec is not applied to // subdirs of subdirs. Files in the passed-in directory will not be // enumerated. Also, the passed-in directory is the last entry added // to the list. -static int RecursivelyEnumerate(wxString dirPath, +static int RecursivelyEnumerate(wxString dirPath, wxArrayString& filePathArray, // output: all files in dirPath tree wxString dirspec, bool bFiles, bool bDirs, - int progress_count = 0, + int progress_count = 0, int progress_bias = 0, ProgressDialog* progress = NULL) { @@ -163,12 +163,12 @@ static int RecursivelyEnumerate(wxString dirPath, cont= dir.GetFirst(&name, dirspec, wxDIR_FILES); while ( cont ){ wxString filepath = dirPath + wxFILE_SEP_PATH + name; - + count++; filePathArray.Add(filepath); - + cont = dir.GetNext(&name); - + if (progress) progress->Update(count + progress_bias, progress_count); @@ -180,13 +180,13 @@ static int RecursivelyEnumerate(wxString dirPath, wxString subdirPath = dirPath + wxFILE_SEP_PATH + name; count += RecursivelyEnumerate( subdirPath, filePathArray, wxEmptyString, - bFiles, bDirs, - progress_count, count + progress_bias, - progress); + bFiles, bDirs, + progress_count, count + progress_bias, + progress); cont = dir.GetNext(&name); } } - + if (bDirs) { filePathArray.Add(dirPath); count++; @@ -209,7 +209,7 @@ static int RecursivelyEnumerateWithProgress(wxString dirPath, progress = new ProgressDialog(_("Progress"), message); int count = RecursivelyEnumerate( - dirPath, filePathArray, dirspec, + dirPath, filePathArray, dirspec, bFiles, bDirs, progress_count, 0, progress); @@ -225,54 +225,54 @@ static int RecursivelyCountSubdirs(wxString dirPath) bool bContinue; int nCount = 0; wxDir dir(dirPath); - if (dir.IsOpened() && dir.HasSubDirs()) + if (dir.IsOpened() && dir.HasSubDirs()) { wxString name; bContinue = dir.GetFirst(&name, wxEmptyString, wxDIR_DIRS); - while (bContinue) + while (bContinue) { nCount++; wxString subdirPath = dirPath + wxFILE_SEP_PATH + name; - nCount += RecursivelyCountSubdirs(subdirPath); + nCount += RecursivelyCountSubdirs(subdirPath); bContinue = dir.GetNext(&name); } } return nCount; } -static int RecursivelyRemoveEmptyDirs(wxString dirPath, - int nDirCount = 0, +static int RecursivelyRemoveEmptyDirs(wxString dirPath, + int nDirCount = 0, ProgressDialog* pProgress = NULL) { bool bContinue; wxDir dir(dirPath); int nCount = 0; - if (dir.IsOpened()) + if (dir.IsOpened()) { - if (dir.HasSubDirs()) + if (dir.HasSubDirs()) { wxString name; bContinue = dir.GetFirst(&name, wxEmptyString, wxDIR_DIRS); - while (bContinue) + while (bContinue) { wxString subdirPath = dirPath + wxFILE_SEP_PATH + name; - nCount += RecursivelyRemoveEmptyDirs(subdirPath, nDirCount, pProgress); + nCount += RecursivelyRemoveEmptyDirs(subdirPath, nDirCount, pProgress); bContinue = dir.GetNext(&name); } } // Have to recheck dir.HasSubDirs() again, in case they all were deleted in recursive calls. if (!dir.HasSubDirs() && !dir.HasFiles() && (dirPath.Right(5) != wxT("_data"))) { - // No subdirs or files. It's empty so delete it. - // Vaughan, 2010-07-07: - // Note that, per http://src.chromium.org/svn/trunk/src/base/file_util_win.cc, among others, + // No subdirs or files. It's empty so delete it. + // Vaughan, 2010-07-07: + // Note that, per http://src.chromium.org/svn/trunk/src/base/file_util_win.cc, among others, // "Some versions of Windows return ERROR_FILE_NOT_FOUND (0x2) when deleting // an empty directory..." Supposedly fixed in Vista and up. - // I discovered this on WinXP. I tried several other Windows SDK functions (e.g., _rmdir - // and RemoveDirectory), and they all give same results. - // I noticed dirs get deleted in RecursivelyRemove, maybe because it doesn't + // I discovered this on WinXP. I tried several other Windows SDK functions (e.g., _rmdir + // and RemoveDirectory), and they all give same results. + // I noticed dirs get deleted in RecursivelyRemove, maybe because it doesn't // consider whether the path is a directory or a file and wxRemoveFile()'s it first. - // Tried it here on WinXP, but no joy. Leave the code in case it works on other Win systems. + // Tried it here on WinXP, but no joy. Leave the code in case it works on other Win systems. #ifdef __WXMSW__ ::wxRemoveFile(dirPath); #endif @@ -285,7 +285,7 @@ static int RecursivelyRemoveEmptyDirs(wxString dirPath, return nCount; } -static void RecursivelyRemove(wxArrayString& filePathArray, int count, +static void RecursivelyRemove(wxArrayString& filePathArray, int count, bool bFiles, bool bDirs, const wxChar* message = NULL) { @@ -303,7 +303,7 @@ static void RecursivelyRemove(wxArrayString& filePathArray, int count, if (progress) progress->Update(i, count); } - + if (progress) delete progress; } @@ -324,7 +324,7 @@ DirManager::DirManager() wxLogDebug(wxT("DirManager: Created new instance.")); mRef = 1; // MM: Initial refcount is 1 by convention - + // Seed the random number generator. // this need not be strictly uniform or random, but it should give // unclustered numbers @@ -332,7 +332,7 @@ DirManager::DirManager() // Set up local temp subdir // Previously, Audacity just named project temp directories "project0", - // "project1" and so on. But with the advent of recovery code, we need a + // "project1" and so on. But with the advent of recovery code, we need a // unique name even after a crash. So we create a random project index // and make sure it is not used already. This will not pose any performance // penalties as long as the number of open Audacity projects is much @@ -341,7 +341,7 @@ DirManager::DirManager() mytemp = globaltemp + wxFILE_SEP_PATH + wxString::Format(wxT("project%d"), rand()); } while (wxDirExists(mytemp)); - + numDirManagers++; projPath = wxT(""); @@ -350,7 +350,7 @@ DirManager::DirManager() mLoadingTarget = NULL; mMaxSamples = -1; - // toplevel pool hash is fully populated to begin + // toplevel pool hash is fully populated to begin { int i; for(i=0; i< 256; i++) dirTopPool[i]=0; @@ -383,14 +383,14 @@ void DirManager::CleanTempDir() { if (dontDeleteTempFiles) return; // do nothing - + wxArrayString filePathArray; - // Subtract 1 because we don't want to delete the global temp directory, + // Subtract 1 because we don't want to delete the global temp directory, // which this will find and list last. - int count = + int count = RecursivelyEnumerate(globaltemp, filePathArray, wxT("project*"), true, true) - 1; - if (count == 0) + if (count == 0) return; RecursivelyRemove(filePathArray, count, true, true, _("Cleaning up temporary files")); @@ -451,10 +451,10 @@ bool DirManager::SetProject(wxString& newProjPath, wxString& newProjName, const BlockHash::iterator iter = mBlockFileHash.begin(); bool success = true; - while ((iter != mBlockFileHash.end()) && success) + while ((iter != mBlockFileHash.end()) && success) { BlockFile *b = iter->second; - + if (b->IsLocked()) success = CopyToNewProjectDirectory(b); else{ @@ -477,7 +477,7 @@ bool DirManager::SetProject(wxString& newProjPath, wxString& newProjName, const projFull = oldLoc; BlockHash::iterator iter = mBlockFileHash.begin(); - while (iter != mBlockFileHash.end()) + while (iter != mBlockFileHash.end()) { BlockFile *b = iter->second; MoveToNewProjectDirectory(b); @@ -510,14 +510,14 @@ bool DirManager::SetProject(wxString& newProjPath, wxString& newProjName, const // and new project directories. The easiest way to do this is to // recurse depth-first and rmdir every directory seen in old and // new; rmdir will fail on non-empty dirs. - + wxArrayString dirlist; count = RecursivelyEnumerate(cleanupLoc1, dirlist, wxEmptyString, false, true); - //This destroys the empty dirs of the OD block files, which are yet to come. + //This destroys the empty dirs of the OD block files, which are yet to come. //Dont know if this will make the project dirty, but I doubt it. (mchinen) // count += RecursivelyEnumerate(cleanupLoc2, dirlist, wxEmptyString, false, true); - + if (count > 0) RecursivelyRemove(dirlist, count, false, true, _("Cleaning up cache directories")); } @@ -528,7 +528,7 @@ wxString DirManager::GetProjectDataDir() { return projFull; } - + wxString DirManager::GetProjectName() { return projName; @@ -559,26 +559,26 @@ void DirManager::SetLocalTempDir(wxString path) } wxFileName DirManager::MakeBlockFilePath(wxString value){ - + wxFileName dir; dir.AssignDir(GetDataFilesDir()); - + if(value.GetChar(0)==wxT('d')){ - // this file is located in a subdirectory tree + // this file is located in a subdirectory tree int location=value.Find(wxT('b')); wxString subdir=value.Mid(0,location); dir.AppendDir(subdir); - + if(!dir.DirExists())dir.Mkdir(); } - + if(value.GetChar(0)==wxT('e')){ - // this file is located in a new style two-deep subdirectory tree + // this file is located in a new style two-deep subdirectory tree wxString topdir=value.Mid(0,3); wxString middir=wxT("d"); middir.Append(value.Mid(3,2)); - dir.AppendDir(topdir); + dir.AppendDir(topdir); dir.AppendDir(middir); if(!dir.DirExists() && !dir.Mkdir(0777,wxPATH_MKDIR_FULL)) @@ -587,34 +587,34 @@ wxFileName DirManager::MakeBlockFilePath(wxString value){ return dir; } -bool DirManager::AssignFile(wxFileName &fileName, +bool DirManager::AssignFile(wxFileName &fileName, wxString value, - bool diskcheck) + bool diskcheck) { wxFileName dir=MakeBlockFilePath(value); if(diskcheck){ // verify that there's no possible collision on disk. If there - // is, log the problem and return FALSE so that MakeBlockFileName + // is, log the problem and return FALSE so that MakeBlockFileName // can try again wxDir checkit(dir.GetFullPath()); if(!checkit.IsOpened()) return FALSE; - + // this code is only valid if 'value' has no extention; that // means, effectively, AssignFile may be called with 'diskcheck' // set to true only if called from MakeFileBlockName(). - + wxString filespec; filespec.Printf(wxT("%s.*"),value.c_str()); if(checkit.HasFiles(filespec)){ // collision with on-disk state! wxString collision; checkit.GetFirst(&collision,filespec); - + wxLogWarning(_("Audacity found an orphan block file: %s. \nPlease consider saving and reloading the project to perform a complete project check."), collision.c_str()); - + return FALSE; } } @@ -674,11 +674,11 @@ void DirManager::BalanceInfoAdd(wxString file) { const wxChar *s=file.c_str(); if(s[0]==wxT('e')){ - // this is one of the modern two-deep managed files - // convert filename to keys - unsigned int topnum = (hexchar_to_int(s[1]) << 4) | + // this is one of the modern two-deep managed files + // convert filename to keys + unsigned int topnum = (hexchar_to_int(s[1]) << 4) | hexchar_to_int(s[2]); - unsigned int midnum = (hexchar_to_int(s[3]) << 4) | + unsigned int midnum = (hexchar_to_int(s[3]) << 4) | hexchar_to_int(s[4]); unsigned int midkey=topnum<<8|midnum; @@ -694,11 +694,11 @@ void DirManager::BalanceInfoDel(wxString file) { const wxChar *s=file.c_str(); if(s[0]==wxT('e')){ - // this is one of the modern two-deep managed files + // this is one of the modern two-deep managed files - unsigned int topnum = (hexchar_to_int(s[1]) << 4) | + unsigned int topnum = (hexchar_to_int(s[1]) << 4) | hexchar_to_int(s[2]); - unsigned int midnum = (hexchar_to_int(s[3]) << 4) | + unsigned int midnum = (hexchar_to_int(s[3]) << 4) | hexchar_to_int(s[4]); unsigned int midkey=topnum<<8|midnum; @@ -775,7 +775,7 @@ wxFileName DirManager::MakeBlockFileName() // the available pool, try to make one if(dirMidPool.empty()){ - + // is there a toplevel directory with space for a new subdir? if(!dirTopPool.empty()){ @@ -785,7 +785,7 @@ wxFileName DirManager::MakeBlockFileName() DirHash::iterator iter = dirTopPool.begin(); int newcount = 0; topnum = iter->first; - + // search for unused midlevels; linear search adequate // add 32 new topnum/midnum dirs full of prospective filenames to midpool @@ -804,7 +804,7 @@ wxFileName DirManager::MakeBlockFileName() // into an infinite loop isn't acceptible. Just in case, // for some reason, we get here, dynamite this toplevel so // we don't just fail. - + // this is 'wrong', but the best we can do given that // something else is also wrong. It will contain the // problem so we can keep going without worry. @@ -827,7 +827,7 @@ wxFileName DirManager::MakeBlockFileName() }else{ - + DirHash::iterator iter = dirMidPool.begin(); midkey = iter->first; @@ -841,9 +841,9 @@ wxFileName DirManager::MakeBlockFileName() baseFileName.Printf(wxT("e%02x%02x%03x"),topnum,midnum,filenum); if (mBlockFileHash.find(baseFileName) == mBlockFileHash.end()){ - // not in the hash, good. + // not in the hash, good. if (!this->AssignFile(ret, baseFileName, true)) - { + { // this indicates an on-disk collision, likely due to an // orphan blockfile. We should try again, but first // alert the balancing info there's a phantom file here; @@ -852,12 +852,12 @@ wxFileName DirManager::MakeBlockFileName() // infinite loop if all possible filenames are taken by // orphans (unlikely but possible) BalanceFileAdd(midkey); - + }else break; } } - // FIXME: Might we get here without midkey having been set? - // Seemed like a possible problem in these changes in .aup directory hierarchy. + // FIXME: Might we get here without midkey having been set? + // Seemed like a possible problem in these changes in .aup directory hierarchy. BalanceFileAdd(midkey); return ret; } @@ -957,8 +957,8 @@ BlockFile *DirManager::CopyBlockFile(BlockFile *b) // Copy the blockfile BlockFile *b2; - if (!b->GetFileName().IsOk()) - // Block files with uninitialized filename (i.e. SilentBlockFile) + if (!b->GetFileName().IsOk()) + // Block files with uninitialized filename (i.e. SilentBlockFile) // just need an in-memory copy. b2 = b->Copy(wxFileName()); else @@ -1039,7 +1039,7 @@ bool DirManager::HandleXMLTag(const wxChar *tag, const wxChar **attrs) if (alias) pBlockFile = LegacyAliasBlockFile::BuildFromXML(projFull, attrs); - else + else pBlockFile = LegacyBlockFile::BuildFromXML(projFull, attrs, mLoadingBlockLen, mLoadingFormat); @@ -1055,13 +1055,13 @@ bool DirManager::HandleXMLTag(const wxChar *tag, const wxChar **attrs) if ((mMaxSamples > -1) && // is initialized (pBlockFile->GetLength() > mMaxSamples)) { - // See http://bugzilla.audacityteam.org/show_bug.cgi?id=451#c13. - // Lock pBlockFile so that the ~BlockFile() will not delete the file on disk. + // See http://bugzilla.audacityteam.org/show_bug.cgi?id=451#c13. + // Lock pBlockFile so that the ~BlockFile() will not delete the file on disk. pBlockFile->Lock(); delete pBlockFile; return false; } - else + else *mLoadingTarget = pBlockFile; // @@ -1070,7 +1070,7 @@ bool DirManager::HandleXMLTag(const wxChar *tag, const wxChar **attrs) // return a reference to the existing object instead. // - wxString name = (*mLoadingTarget)->GetFileName().GetName(); + wxString name = (*mLoadingTarget)->GetFileName().GetName(); BlockFile *retrieved = mBlockFileHash[name]; if (retrieved) { // Lock it in order to delete it safely, i.e. without having @@ -1095,7 +1095,7 @@ bool DirManager::HandleXMLTag(const wxChar *tag, const wxChar **attrs) bool DirManager::MoveOrCopyToNewProjectDirectory(BlockFile *f, bool copy) { // Check that this BlockFile corresponds to a file on disk - //ANSWER-ME: Is this checking only for SilentBlockFiles, in which case + //ANSWER-ME: Is this checking only for SilentBlockFiles, in which case // (!f->GetFileName().IsOk()) is a more correct check? if (f->GetFileName().GetName().IsEmpty()) { return true; @@ -1104,7 +1104,7 @@ bool DirManager::MoveOrCopyToNewProjectDirectory(BlockFile *f, bool copy) wxFileName newFileName; wxFileName oldFileName=f->GetFileName(); if (!this->AssignFile(newFileName, f->GetFileName().GetFullName(), false)) - return false; + return false; if (newFileName != f->GetFileName()) { //check to see that summary exists before we copy. @@ -1116,7 +1116,7 @@ bool DirManager::MoveOrCopyToNewProjectDirectory(BlockFile *f, bool copy) return false; } f->SetFileName(newFileName); - + //there is a small chance that the summary has begun to be computed on a different thread with the //original filename. we need to catch this case by waiting for it to finish and then copy. if (!summaryExisted && (f->IsSummaryAvailable() || f->IsSummaryBeingComputed())) { @@ -1124,8 +1124,8 @@ bool DirManager::MoveOrCopyToNewProjectDirectory(BlockFile *f, bool copy) //(It is important that OD files set this lock while computing their summary files.) while(f->IsSummaryBeingComputed() && !f->IsSummaryAvailable()) ::wxMilliSleep(50); - - //check to make sure the oldfile exists. + + //check to make sure the oldfile exists. //if it doesn't, we can assume it was written to the new name, which is fine. if (oldFileName.FileExists()) { @@ -1193,7 +1193,7 @@ bool DirManager::EnsureSafeFilename(wxFileName fName) return true; /* i18n-hint: 'old' is part of a filename used when a file is renamed. */ - // Figure out what the new name for the existing file would be. + // Figure out what the new name for the existing file would be. /* i18n-hint: e.g. Try to go from "mysong.wav" to "mysong-old1.wav". */ // Keep trying until we find a filename that doesn't exist. @@ -1236,7 +1236,7 @@ bool DirManager::EnsureSafeFilename(wxFileName fName) bool needToRename = false; wxBusyCursor busy; BlockHash::iterator iter = mBlockFileHash.begin(); - while (iter != mBlockFileHash.end()) + while (iter != mBlockFileHash.end()) { BlockFile *b = iter->second; // don't worry, we don't rely on this cast unless IsAlias is true @@ -1244,18 +1244,18 @@ bool DirManager::EnsureSafeFilename(wxFileName fName) if (b->IsAlias() && ab->GetAliasedFileName() == fName) { needToRename = true; - + //ODBlocks access the aliased file on another thread, so we need to pause them before this continues. ab->LockRead(); } - + //now for encoded OD blocks (e.g. flac) // don't worry, we don't rely on this cast unless ISDataAvailable is false // which means that it still needs to access the file. ODDecodeBlockFile *db = (ODDecodeBlockFile*)b; if (!b->IsDataAvailable() && db->GetEncodedAudioFilename() == fName) { needToRename = true; - + //ODBlocks access the aliased file on another thread, so we need to pause them before this continues. db->LockRead(); } @@ -1265,7 +1265,7 @@ bool DirManager::EnsureSafeFilename(wxFileName fName) if (needToRename) { if (!wxRenameFile(fName.GetFullPath(), - renamedFileName.GetFullPath())) + renamedFileName.GetFullPath())) { // ACK!!! The renaming was unsuccessful!!! // (This shouldn't happen, since we tried creating a @@ -1275,7 +1275,7 @@ bool DirManager::EnsureSafeFilename(wxFileName fName) // Put things back where they were BlockHash::iterator iter = mBlockFileHash.begin(); - while (iter != mBlockFileHash.end()) + while (iter != mBlockFileHash.end()) { BlockFile *b = iter->second; AliasBlockFile *ab = (AliasBlockFile*)b; @@ -1299,7 +1299,7 @@ bool DirManager::EnsureSafeFilename(wxFileName fName) { //point the aliases to the new filename. BlockHash::iterator iter = mBlockFileHash.begin(); - while (iter != mBlockFileHash.end()) + while (iter != mBlockFileHash.end()) { BlockFile *b = iter->second; AliasBlockFile *ab = (AliasBlockFile*)b; @@ -1310,7 +1310,7 @@ bool DirManager::EnsureSafeFilename(wxFileName fName) ab->ChangeAliasedFileName(renamedFileName); ab->UnlockRead(); wxPrintf(_("Changed block %s to new alias name\n"), b->GetFileName().GetFullName().c_str()); - + } if (!b->IsDataAvailable() && db->GetEncodedAudioFilename() == fName) { db->ChangeAudioFile(renamedFileName); @@ -1339,7 +1339,7 @@ void DirManager::Ref() void DirManager::Deref() { wxASSERT(mRef > 0); // MM: If mRef is smaller, it should have been deleted already - + --mRef; // MM: Automatically delete if refcount reaches zero @@ -1347,27 +1347,27 @@ void DirManager::Deref() delete this; } -// Check the BlockFiles against the disk state. +// Check the BlockFiles against the disk state. // Missing Blockfile data can be regenerated if possible or replaced with silence. -// Orphan blockfiles can be deleted. +// Orphan blockfiles can be deleted. // Note that even BlockFiles not referenced by the current savefile (but locked // by history) will be reflected in the mBlockFileHash, and that's a // good thing; this is one reason why we use the hash and not the most // recent savefile. int DirManager::ProjectFSCK(const bool bForceError, const bool bAutoRecoverMode) { - // In earlier versions of this method, enumerations of errors were - // all done in sequence, then the user was prompted for each type of error. - // The enumerations are now interleaved with prompting, because, for example, - // user choosing to replace missing aliased block files with silence - // needs to put in SilentBlockFiles and delete the corresponding auf files, - // so those would then not be cumulated in missingAUFHash. - // We still do the FindX methods outside the conditionals, + // In earlier versions of this method, enumerations of errors were + // all done in sequence, then the user was prompted for each type of error. + // The enumerations are now interleaved with prompting, because, for example, + // user choosing to replace missing aliased block files with silence + // needs to put in SilentBlockFiles and delete the corresponding auf files, + // so those would then not be cumulated in missingAUFHash. + // We still do the FindX methods outside the conditionals, // so the log always shows all found errors. int action; // choice of action for each type of error int nResult = 0; - + if (bForceError && !bAutoRecoverMode) { // TODO: Replace with more user friendly error message? @@ -1377,25 +1377,25 @@ int DirManager::ProjectFSCK(const bool bForceError, const bool bAutoRecoverMode) The error message is confusing to users in English, and could just say "Found problems with when checking project file." */ wxString msg = _("Project check read faulty Sequence tags."); - const wxChar *buttons[] = + const wxChar *buttons[] = {_("Close project immediately with no changes"), _("Continue with repairs noted in log, and check for more errors. This will save the project in its current state, unless you \"Close project immediately\" on further error alerts."), NULL}; wxLog::FlushActive(); // MultiDialog has "Show Log..." button, so make sure log is current. action = ShowMultiDialog(msg, _("Warning - Problems Reading Sequence Tags"), buttons); - if (action == 0) + if (action == 0) nResult = FSCKstatus_CLOSE_REQ; - else - nResult = FSCKstatus_CHANGED | FSCKstatus_SAVE_AUP; + else + nResult = FSCKstatus_CHANGED | FSCKstatus_SAVE_AUP; } wxArrayString filePathArray; // *all* files in the project directory/subdirectories wxString dirPath = (projFull != wxT("") ? projFull : mytemp); RecursivelyEnumerateWithProgress( - dirPath, + dirPath, filePathArray, // output: all files in project directory tree - wxEmptyString, - true, false, + wxEmptyString, + true, false, mBlockFileHash.size(), // rough guess of how many BlockFiles will be found/processed, for progress _("Inspecting project file data")); @@ -1407,7 +1407,7 @@ int DirManager::ProjectFSCK(const bool bForceError, const bool bAutoRecoverMode) BlockHash missingAliasedFilePathHash; // full paths of missing aliased files this->FindMissingAliasedFiles(missingAliasedFileAUFHash, missingAliasedFilePathHash); - if ((nResult != FSCKstatus_CLOSE_REQ) && !missingAliasedFileAUFHash.empty()) + if ((nResult != FSCKstatus_CLOSE_REQ) && !missingAliasedFileAUFHash.empty()) { // In auto-recover mode, we always create silent blocks, and do not ask user. // This makes sure the project is complete next time we open it. @@ -1430,38 +1430,38 @@ _("Project check of \"%s\" folder \ \nproject immediately\" on further error alerts."); wxString msg; msg.Printf(msgA, this->projName.c_str(), missingAliasedFilePathHash.size()); - const wxChar *buttons[] = + const wxChar *buttons[] = {_("Close project immediately with no changes"), - _("Treat missing audio as silence (this session only)"), + _("Treat missing audio as silence (this session only)"), _("Replace missing audio with silence (permanent immediately)."), NULL}; wxLog::FlushActive(); // MultiDialog has "Show Log..." button, so make sure log is current. action = ShowMultiDialog(msg, _("Warning - Missing Aliased File(s)"), buttons); } - if (action == 0) + if (action == 0) nResult = FSCKstatus_CLOSE_REQ; else { BlockHash::iterator iter = missingAliasedFileAUFHash.begin(); - while (iter != missingAliasedFileAUFHash.end()) + while (iter != missingAliasedFileAUFHash.end()) { // This type caste is safe. We checked that it's an alias block file earlier. - AliasBlockFile *b = (AliasBlockFile*)iter->second; + AliasBlockFile *b = (AliasBlockFile*)iter->second; if (action == 1) // Silence error logging for this block in this session. - b->SilenceAliasLog(); - else if (action == 2) + b->SilenceAliasLog(); + else if (action == 2) { // silence the blockfiles by yanking the filename - // This is done, eventually, in PCMAliasBlockFile::ReadData() - // and ODPCMAliasBlockFile::ReadData, in the stack of b->Recover(). + // This is done, eventually, in PCMAliasBlockFile::ReadData() + // and ODPCMAliasBlockFile::ReadData, in the stack of b->Recover(). // There, if the mAliasedFileName is bad, it zeroes the data. wxFileName dummy; dummy.Clear(); b->ChangeAliasedFileName(dummy); b->Recover(); - nResult = FSCKstatus_CHANGED | FSCKstatus_SAVE_AUP; + nResult = FSCKstatus_CHANGED | FSCKstatus_SAVE_AUP; } iter++; } @@ -1476,8 +1476,8 @@ _("Project check of \"%s\" folder \ // Alias summary regeneration must happen after checking missing aliased files. // BlockHash missingAUFHash; // missing (.auf) AliasBlockFiles - this->FindMissingAUFs(missingAUFHash); - if ((nResult != FSCKstatus_CLOSE_REQ) && !missingAUFHash.empty()) + this->FindMissingAUFs(missingAUFHash); + if ((nResult != FSCKstatus_CLOSE_REQ) && !missingAUFHash.empty()) { // In auto-recover mode, we just recreate the alias files, and do not ask user. // This makes sure the project is complete next time we open it. @@ -1494,7 +1494,7 @@ _("Project check of \"%s\" folder \ msg.Printf(msgA, this->projName.c_str(), missingAUFHash.size()); const wxChar *buttons[] = {_("Regenerate alias summary files (safe and recommended)"), _("Fill in silence for missing display data (this session only)"), - _("Close project immediately with no further changes"), + _("Close project immediately with no further changes"), NULL}; wxLog::FlushActive(); // MultiDialog has "Show Log..." button, so make sure log is current. action = ShowMultiDialog(msg, _("Warning - Missing Alias Summary File(s)"), buttons); @@ -1505,16 +1505,16 @@ _("Project check of \"%s\" folder \ else { BlockHash::iterator iter = missingAUFHash.begin(); - while (iter != missingAUFHash.end()) + while (iter != missingAUFHash.end()) { BlockFile *b = iter->second; if(action==0){ //regenerate from data b->Recover(); - nResult |= FSCKstatus_CHANGED; + nResult |= FSCKstatus_CHANGED; }else if (action==1){ // Silence error logging for this block in this session. - b->SilenceLog(); + b->SilenceLog(); } iter++; } @@ -1549,30 +1549,30 @@ _("Project check of \"%s\" folder \ \nmay not show silence."); wxString msg; msg.Printf(msgA, this->projName.c_str(), missingAUHash.size()); - const wxChar *buttons[] = - {_("Close project immediately with no further changes"), - _("Treat missing audio as silence (this session only)"), + const wxChar *buttons[] = + {_("Close project immediately with no further changes"), + _("Treat missing audio as silence (this session only)"), _("Replace missing audio with silence (permanent immediately)"), NULL}; wxLog::FlushActive(); // MultiDialog has "Show Log..." button, so make sure log is current. action = ShowMultiDialog(msg, _("Warning - Missing Audio Data Block File(s)"), buttons); } - + if (action == 0) nResult = FSCKstatus_CLOSE_REQ; else { BlockHash::iterator iter = missingAUHash.begin(); - while (iter != missingAUHash.end()) + while (iter != missingAUHash.end()) { BlockFile *b = iter->second; - if (action == 2) + if (action == 2) { //regenerate with zeroes b->Recover(); - nResult = FSCKstatus_CHANGED; + nResult = FSCKstatus_CHANGED; } - else if (action == 1) + else if (action == 1) b->SilenceLog(); iter++; } @@ -1607,7 +1607,7 @@ other projects. \ wxString msg; msg.Printf(msgA, this->projName.c_str(), (int)orphanFilePathArray.GetCount()); - const wxChar *buttons[] = + const wxChar *buttons[] = {_("Continue without deleting; ignore the extra files this session"), _("Close project immediately with no further changes"), _("Delete orphan files (permanent immediately)"), @@ -1621,12 +1621,12 @@ other projects. \ // Nothing is done if (action == 0). else if (action == 2) { - // FSCKstatus_CHANGED was bogus here. + // FSCKstatus_CHANGED was bogus here. // The files are deleted, so "Undo Project Repair" could not do anything. - // Plus they affect none of the valid tracks, so incorrect to mark them changed, + // Plus they affect none of the valid tracks, so incorrect to mark them changed, // and no need for refresh. // nResult |= FSCKstatus_CHANGED; - for (size_t i = 0; i < orphanFilePathArray.GetCount(); i++) + for (size_t i = 0; i < orphanFilePathArray.GetCount(); i++) wxRemoveFile(orphanFilePathArray[i]); } } @@ -1634,11 +1634,11 @@ other projects. \ if ((nResult != FSCKstatus_CLOSE_REQ) && !ODManager::HasLoadedODFlag()) { // Remove any empty directories. - ProgressDialog* pProgress = - new ProgressDialog(_("Progress"), + ProgressDialog* pProgress = + new ProgressDialog(_("Progress"), _("Cleaning up unused directories in project data")); // nDirCount is for updating pProgress. +1 because we may delete dirPath. - int nDirCount = RecursivelyCountSubdirs(dirPath) + 1; + int nDirCount = RecursivelyCountSubdirs(dirPath) + 1; RecursivelyRemoveEmptyDirs(dirPath, nDirCount, pProgress); delete pProgress; } @@ -1647,7 +1647,7 @@ other projects. \ if (bForceError || !missingAliasedFileAUFHash.empty() || !missingAUFHash.empty() || - !missingAUHash.empty() || + !missingAUHash.empty() || !orphanFilePathArray.IsEmpty()) { wxLogWarning(_("Project check found file inconsistencies inspecting the loaded project data.")); @@ -1656,8 +1656,8 @@ other projects. \ // In auto-recover mode, we didn't do any ShowMultiDialog calls above, so put up an alert. if (bAutoRecoverMode) ::wxMessageBox( - _("Project check found file inconsistencies during automatic recovery.\n\nSelect 'Show Log...' in the Help menu to see details."), - _("Warning: Problems in Automatic Recovery"), + _("Project check found file inconsistencies during automatic recovery.\n\nSelect 'Show Log...' in the Help menu to see details."), + _("Warning: Problems in Automatic Recovery"), wxOK | wxICON_EXCLAMATION); } @@ -1670,31 +1670,31 @@ void DirManager::FindMissingAliasedFiles( BlockHash& missingAliasedFilePathHash) // output: full paths of missing aliased files { BlockHash::iterator iter = mBlockFileHash.begin(); - while (iter != mBlockFileHash.end()) + while (iter != mBlockFileHash.end()) { wxString key = iter->first; // file name and extension BlockFile *b = iter->second; - if (b->IsAlias()) + if (b->IsAlias()) { wxFileName aliasedFileName = ((AliasBlockFile*)b)->GetAliasedFileName(); wxString aliasedFileFullPath = aliasedFileName.GetFullPath(); // wxEmptyString can happen if user already chose to "replace... with silence". - if ((aliasedFileFullPath != wxEmptyString) && + if ((aliasedFileFullPath != wxEmptyString) && !aliasedFileName.FileExists()) { missingAliasedFileAUFHash[key] = b; - if (missingAliasedFilePathHash.find(aliasedFileFullPath) == + if (missingAliasedFilePathHash.find(aliasedFileFullPath) == missingAliasedFilePathHash.end()) // Add it only once. - // Not actually using the block here, just the path, + // Not actually using the block here, just the path, // so set the block to NULL to create the entry. - missingAliasedFilePathHash[aliasedFileFullPath] = NULL; + missingAliasedFilePathHash[aliasedFileFullPath] = NULL; } } iter++; } iter = missingAliasedFilePathHash.begin(); - while (iter != missingAliasedFilePathHash.end()) + while (iter != missingAliasedFilePathHash.end()) { wxLogWarning(_("Missing aliased audio file: '%s'"), iter->first.c_str()); iter++; @@ -1702,24 +1702,24 @@ void DirManager::FindMissingAliasedFiles( } void DirManager::FindMissingAUFs( - BlockHash& missingAUFHash) // output: missing (.auf) AliasBlockFiles + BlockHash& missingAUFHash) // output: missing (.auf) AliasBlockFiles { BlockHash::iterator iter = mBlockFileHash.begin(); - while (iter != mBlockFileHash.end()) + while (iter != mBlockFileHash.end()) { wxString key = iter->first; BlockFile *b = iter->second; - if (b->IsAlias() && b->IsSummaryAvailable()) + if (b->IsAlias() && b->IsSummaryAvailable()) { /* don't look in hash; that might find files the user moved that the Blockfile abstraction can't find itself */ wxFileName fileName = MakeBlockFilePath(key); fileName.SetName(key); fileName.SetExt(wxT("auf")); - if (!fileName.FileExists()) + if (!fileName.FileExists()) { missingAUFHash[key] = b; - wxLogWarning(_("Missing alias (.auf) block file: '%s'"), + wxLogWarning(_("Missing alias (.auf) block file: '%s'"), fileName.GetFullPath().c_str()); } } @@ -1731,11 +1731,11 @@ void DirManager::FindMissingAUs( BlockHash& missingAUHash) // missing data (.au) blockfiles { BlockHash::iterator iter = mBlockFileHash.begin(); - while (iter != mBlockFileHash.end()) + while (iter != mBlockFileHash.end()) { wxString key = iter->first; BlockFile *b = iter->second; - if (!b->IsAlias()) + if (!b->IsAlias()) { wxFileName fileName = MakeBlockFilePath(key); fileName.SetName(key); @@ -1743,7 +1743,7 @@ void DirManager::FindMissingAUs( if (!fileName.FileExists()) { missingAUHash[key] = b; - wxLogWarning(_("Missing data block file: '%s'"), + wxLogWarning(_("Missing data block file: '%s'"), fileName.GetFullPath().c_str()); } } @@ -1752,25 +1752,25 @@ void DirManager::FindMissingAUs( } // Find .au and .auf files that are not in the project. -void DirManager::FindOrphanBlockFiles( +void DirManager::FindOrphanBlockFiles( const wxArrayString& filePathArray, // input: all files in project directory wxArrayString& orphanFilePathArray) // output: orphan files { DirManager *clipboardDM = NULL; - for (size_t i = 0; i < filePathArray.GetCount(); i++) + for (size_t i = 0; i < filePathArray.GetCount(); i++) { wxFileName fullname = filePathArray[i]; wxString basename = fullname.GetName(); if ((mBlockFileHash.find(basename) == mBlockFileHash.end()) && // is orphan - // Consider only Audacity data files. + // Consider only Audacity data files. // Specifically, ignore JPG and OGG ("Save Compressed Copy"). (fullname.GetExt().IsSameAs(wxT("au")) || fullname.GetExt().IsSameAs(wxT("auf")))) { if (!clipboardDM) { TrackList *clipTracks = AudacityProject::GetClipboardTracks(); - + if (clipTracks) { TrackListIterator clipIter(clipTracks); Track *track = clipIter.First(); @@ -1778,13 +1778,13 @@ void DirManager::FindOrphanBlockFiles( clipboardDM = track->GetDirManager(); } } - + // Ignore it if it exists in the clipboard (from a previously closed project) if (!(clipboardDM && clipboardDM->ContainsBlockFile(basename))) orphanFilePathArray.Add(fullname.GetFullPath()); } } - for (size_t i = 0; i < orphanFilePathArray.GetCount(); i++) + for (size_t i = 0; i < orphanFilePathArray.GetCount(); i++) wxLogWarning(_("Orphan block file: '%s'"), orphanFilePathArray[i].c_str()); } @@ -1794,10 +1794,10 @@ void DirManager::RemoveOrphanBlockfiles() wxArrayString filePathArray; // *all* files in the project directory/subdirectories wxString dirPath = (projFull != wxT("") ? projFull : mytemp); RecursivelyEnumerateWithProgress( - dirPath, + dirPath, filePathArray, // output: all files in project directory tree - wxEmptyString, - true, false, + wxEmptyString, + true, false, mBlockFileHash.size(), // rough guess of how many BlockFiles will be found/processed, for progress _("Inspecting project file data")); @@ -1805,15 +1805,15 @@ void DirManager::RemoveOrphanBlockfiles() this->FindOrphanBlockFiles( filePathArray, // input: all files in project directory tree orphanFilePathArray); // output: orphan files - + // Remove all orphan blockfiles. - for (size_t i = 0; i < orphanFilePathArray.GetCount(); i++) + for (size_t i = 0; i < orphanFilePathArray.GetCount(); i++) wxRemoveFile(orphanFilePathArray[i]); } void DirManager::FillBlockfilesCache() { -#ifdef DEPRECATED_AUDIO_CACHE +#ifdef DEPRECATED_AUDIO_CACHE // See http://bugzilla.audacityteam.org/show_bug.cgi?id=545. bool cacheBlockFiles = false; gPrefs->Read(wxT("/Directories/CacheBlockFiles"), &cacheBlockFiles); @@ -1838,7 +1838,7 @@ void DirManager::FillBlockfilesCache() numNeed++; iter++; } - + if (numNeed == 0) return; @@ -1875,7 +1875,7 @@ void DirManager::WriteCacheToDisk() numNeed++; iter++; } - + if (numNeed == 0) return; diff --git a/src/DirManager.h b/src/DirManager.h index f9b53e79e..cb8a64384 100644 --- a/src/DirManager.h +++ b/src/DirManager.h @@ -60,13 +60,13 @@ class DirManager: public XMLTagHandler { sampleCount sampleLen, sampleFormat format, bool allowDeferredWrite = false); - + BlockFile *NewAliasBlockFile( wxString aliasedFile, sampleCount aliasStart, sampleCount aliasLen, int aliasChannel); - + BlockFile *NewODAliasBlockFile( wxString aliasedFile, sampleCount aliasStart, sampleCount aliasLen, int aliasChannel); - + BlockFile *NewODDecodeBlockFile( wxString aliasedFile, sampleCount aliasStart, sampleCount aliasLen, int aliasChannel, int decodeType); @@ -114,21 +114,21 @@ class DirManager: public XMLTagHandler { static void CleanTempDir(); // Check the project for errors and possibly prompt user - // bForceError: Always show log error alert even if no errors are found here. + // bForceError: Always show log error alert even if no errors are found here. // Important when you know that there are already errors in the log. - // bAutoRecoverMode: Do not show any option dialogs for how to deal with errors found here. + // bAutoRecoverMode: Do not show any option dialogs for how to deal with errors found here. // Too complicated during auto-recover. Just correct problems the "safest" way. int ProjectFSCK(const bool bForceError, const bool bAutoRecoverMode); - + void FindMissingAliasedFiles( BlockHash& missingAliasedFileAUFHash, // output: (.auf) AliasBlockFiles whose aliased files are missing BlockHash& missingAliasedFilePathHash); // output: full paths of missing aliased files void FindMissingAUFs( - BlockHash& missingAUFHash); // output: missing (.auf) AliasBlockFiles + BlockHash& missingAUFHash); // output: missing (.auf) AliasBlockFiles void FindMissingAUs( BlockHash& missingAUHash); // missing data (.au) blockfiles // Find .au and .auf files that are not in the project. - void FindOrphanBlockFiles( + void FindOrphanBlockFiles( const wxArrayString& filePathArray, // input: all files in project directory wxArrayString& orphanFilePathArray); // output: orphan files @@ -142,14 +142,14 @@ class DirManager: public XMLTagHandler { // not interested in this information, but it is important for the // auto-save functionality wxString GetDataFilesDir() const; - + // This should only be used by the auto save functionality void SetLocalTempDir(wxString path); - + // Do not delete any temporary files on exit. This is only called if // auto recovery is cancelled and should be retried later static void SetDontDeleteTempFiles() { dontDeleteTempFiles = true; } - + // Write all write-cached block files to disc, if any void WriteCacheToDisk(); diff --git a/src/Dither.cpp b/src/Dither.cpp index a4a413027..94e7b25ff 100644 --- a/src/Dither.cpp +++ b/src/Dither.cpp @@ -70,7 +70,7 @@ const float Dither::SHAPED_BS[] = { 2.033f, -2.165f, 1.959f, -1.590f, 0.6149f }; // be quite fast. #if 0 -// To assist in understanding what the macros are doing, here's an example of what +// To assist in understanding what the macros are doing, here's an example of what // the result would be for Shaped dither: // // DITHER(ShapedDither, dest, destFormat, destStride, source, sourceFormat, sourceStride, len); diff --git a/src/Dither.h b/src/Dither.h index e4bdc4c02..3069e3140 100644 --- a/src/Dither.h +++ b/src/Dither.h @@ -18,7 +18,7 @@ class Dither public: /// Default constructor Dither(); - + /// These ditherers are currently available: enum DitherType { none = 0, rectangle = 1, triangle = 2, shaped = 3}; @@ -47,7 +47,7 @@ private: static const int BUF_SIZE; /* = 8 */ static const int BUF_MASK; /* = 7 */ static const float SHAPED_BS[]; - + // Dither state int mPhase; float mTriangleState; diff --git a/src/Envelope.cpp b/src/Envelope.cpp index 379d0d38f..12e99a946 100644 --- a/src/Envelope.cpp +++ b/src/Envelope.cpp @@ -21,7 +21,7 @@ *//****************************************************************//** \class EnvPoint -\brief EnvPoint, derived from XMLTagHandler, provides Envelope with +\brief EnvPoint, derived from XMLTagHandler, provides Envelope with a draggable point type. *//*******************************************************************/ @@ -60,7 +60,7 @@ Envelope::Envelope() mDirty = false; mIsDeleting = false; mMirror = true; - + mMinValue = 1.0e-7; mMaxValue = 2.0; @@ -103,7 +103,7 @@ void Envelope::Rescale(double minValue, double maxValue) } -/// Flatten removes all points from the envelope to +/// Flatten removes all points from the envelope to /// make it horizontal at a chosen y-value. /// @value - the y-value for the flat envelope. void Envelope::Flatten(double value) @@ -147,7 +147,7 @@ void Envelope::CopyFrom(const Envelope *e, double t0, double t1) i++; // Create the point at 0 if it needs interpolated representation - if (i>0) + if (i>0) AddPointAtEnd( 0, e->GetValue(mOffset) ); // Copy points from inside the copied region @@ -291,8 +291,8 @@ bool Envelope::HandleXMLTag(const wxChar *tag, const wxChar **attrs) if (!value) break; const wxString strValue = value; - if( !wxStrcmp(attr, wxT("numpoints")) && - XMLValueChecker::IsGoodInt(strValue) && strValue.ToLong(&nValue)) + if( !wxStrcmp(attr, wxT("numpoints")) && + XMLValueChecker::IsGoodInt(strValue) && strValue.ToLong(&nValue)) numPoints = nValue; } if (numPoints < 0) @@ -305,7 +305,7 @@ bool Envelope::HandleXMLTag(const wxChar *tag, const wxChar **attrs) XMLTagHandler *Envelope::HandleXMLChild(const wxChar *tag) { - if (wxStrcmp(tag, wxT("controlpoint"))) + if (wxStrcmp(tag, wxT("controlpoint"))) return NULL; return AddPointAtEnd(0,0); @@ -366,7 +366,7 @@ float Envelope::ValueOfPixel( int y, int height, bool upper, bool dB, /// HandleMouseButtonDown either finds an existing control point or adds a new one /// which is then recorded as the point to drag. -/// This is slightly complicated by there possibly being four control points for +/// This is slightly complicated by there possibly being four control points for /// a given time value: /// We have an upper and lower envelope line. /// Also we may be showing an inner envelope (at 0.5 the range). @@ -401,7 +401,7 @@ bool Envelope::HandleMouseButtonDown(wxMouseEvent & event, wxRect & r, // TODO: also fix it so that we can drag the last point on an envelope. for (int i = 0; i < len; i++) { //search for control point nearest click if (mEnv[i]->GetT() >= tleft && mEnv[i]->GetT() <= tright) { - + int x = int ((mEnv[i]->GetT() + mOffset - h) * pps) + r.x; int y[4]; int numControlPoints; @@ -415,7 +415,7 @@ bool Envelope::HandleMouseButtonDown(wxMouseEvent & event, wxRect & r, // Inner control points(contour) y[2] = GetWaveYPos( mEnv[i]->GetVal(), zoomMin, zoomMax, r.height, dB, false, dBr, false); - y[3] = GetWaveYPos( -mEnv[i]->GetVal()-.00000001, zoomMin, zoomMax, + y[3] = GetWaveYPos( -mEnv[i]->GetVal()-.00000001, zoomMin, zoomMax, r.height, dB, false, dBr, false); numControlPoints = 4; @@ -425,9 +425,9 @@ bool Envelope::HandleMouseButtonDown(wxMouseEvent & event, wxRect & r, if (!mMirror) numControlPoints = 1; - + for(int j=0; j= mTrackLen) // return false; - + double v = GetValueAtX( event.m_x, r, h, pps ); - - int ct = GetWaveYPos( v, zoomMin, zoomMax, r.height, dB, + + int ct = GetWaveYPos( v, zoomMin, zoomMax, r.height, dB, false, dBr, false) ; - int cb = GetWaveYPos( -v-.000000001, zoomMin, zoomMax, r.height, dB, + int cb = GetWaveYPos( -v-.000000001, zoomMin, zoomMax, r.height, dB, false, dBr, false) ; if( ct <= cb || !mMirror ){ - int t = GetWaveYPos( v, zoomMin, zoomMax, r.height, dB, + int t = GetWaveYPos( v, zoomMin, zoomMax, r.height, dB, true, dBr, false) ; - int b = GetWaveYPos( -v, zoomMin, zoomMax, r.height, dB, + int b = GetWaveYPos( -v, zoomMin, zoomMax, r.height, dB, true, dBr, false) ; ct = (t + ct) / 2; @@ -498,14 +498,14 @@ void Envelope::MarkDragPointForDeletion() // We're going to be deleting the point; On // screen we show this by having the envelope move to // the position it will have after deletion of the point. - // Without delting the point we move it left or right + // Without delting the point we move it left or right // to the same position as the previous or next point. - if( mEnv.Count()<=1) + if( mEnv.Count()<=1) { // There is only one point - just move it // off screen and at default height. - // temporary state when dragging only! + // temporary state when dragging only! mEnv[mDragPoint]->SetT(-1000000.0); mEnv[mDragPoint]->SetVal(mDefaultValue); return; @@ -525,13 +525,13 @@ void Envelope::MoveDraggedPoint( wxMouseEvent & event, wxRect & r, if(clip_y < 0) clip_y = 0; if(clip_y > r.height) clip_y = r.height; double newVal = ValueOfPixel(clip_y, r.height, mUpper, dB, - zoomMin, zoomMax); + zoomMin, zoomMax); wxASSERT( pps > 0 ); // We no longer tolerate multiple envelope points at the same t. // epsilon is less than the time offset of a single sample // TODO: However because mTrackEpsilon assumes 200KHz this use - // of epsilon is a tad bogus. What we need to do instead is delete + // of epsilon is a tad bogus. What we need to do instead is delete // a duplicated point on a mouse up. double newWhen = mInitialWhen + (event.m_x - mInitialX) / pps; @@ -555,7 +555,7 @@ void Envelope::MoveDraggedPoint( wxMouseEvent & event, wxRect & r, bool Envelope::HandleDragging( wxMouseEvent & event, wxRect & r, double h, double pps, bool dB, - float zoomMin, float zoomMax, + float zoomMin, float zoomMax, float WXUNUSED(eMin), float WXUNUSED(eMax)) { mDirty = true; @@ -571,7 +571,7 @@ bool Envelope::HandleDragging( wxMouseEvent & event, wxRect & r, MoveDraggedPoint( event, r,h,pps,dB, zoomMin, zoomMax); return true; } - + if(mIsDeleting ) // IF we already know we're deleting THEN no envelope point to update. return false; @@ -582,9 +582,9 @@ bool Envelope::HandleDragging( wxMouseEvent & event, wxRect & r, // Exit dragging mode and deletes dragged point if neccessary. bool Envelope::HandleMouseButtonUp( wxMouseEvent & WXUNUSED(event), wxRect & WXUNUSED(r), - double WXUNUSED(h), + double WXUNUSED(h), double WXUNUSED(pps), bool WXUNUSED(dB), - float WXUNUSED(zoomMin), + float WXUNUSED(zoomMin), float WXUNUSED(zoomMax) ) { if (mIsDeleting) { @@ -610,7 +610,7 @@ bool Envelope::MouseEvent(wxMouseEvent & event, wxRect & r, if (event.ButtonDown() && mButton == wxMOUSE_BTN_NONE) return HandleMouseButtonDown( event, r, h, pps,dB, zoomMin, zoomMax); - if (event.Dragging() && mDragPoint >= 0) + if (event.Dragging() && mDragPoint >= 0) return HandleDragging( event, r, h, pps,dB, zoomMin, zoomMax); if (event.ButtonUp() && event.GetButton() == mButton) @@ -647,7 +647,7 @@ void Envelope::CollapseRegion(double t0, double t1) for (i = 0; i < len; i++) if (mEnv[i]->GetT() >= t1) mEnv[i]->SetT(mEnv[i]->GetT() - (t1 - t0)); - + mTrackLen -= (t1-t0); } @@ -682,7 +682,7 @@ void Envelope::Paste(double t0, Envelope *e) e->Insert(e->mTrackLen, rightval); pointsAdded = true; // we need to delete them later so's not to corrupt 'e' for later use } - + t0 = wxMin(t0 - mOffset, mTrackLen); // t0 now has origin of zero double deltat = e->mTrackLen; @@ -696,7 +696,7 @@ void Envelope::Paste(double t0, Envelope *e) bool onPoint = false; unsigned int len = mEnv.Count(); - // get values to perform framing of the insertion + // get values to perform framing of the insertion double splitval = GetValue(t0 + mOffset); if(len != 0) { // Not case 10: there are point/s in the envelope @@ -727,8 +727,8 @@ Old analysis of cases: // In pasting in a clip we choose to preserve the envelope so that the loudness of the // parts is unchanged. // -// 1) This may introduce a discontnuity in the envelope at a boundary between the -// old and new clips. In that case we must ensure there are envelope points +// 1) This may introduce a discontnuity in the envelope at a boundary between the +// old and new clips. In that case we must ensure there are envelope points // at sample positions immediately before and immediately after the boundary. // 2) If the points have the same value we only need one of them. // 3) If the points have the same value AND it is the same as the value interpolated @@ -736,8 +736,8 @@ Old analysis of cases: // // We do the same for the left and right edge of the new clip. // -// Even simpler: we could always add two points at a boundary and then call -// RemoveUnneededPoints() (provided that function behaves correctly). +// Even simpler: we could always add two points at a boundary and then call +// RemoveUnneededPoints() (provided that function behaves correctly). // See if existing points need shifting to the right, and what Case we are in for (i = 0; i < len; i++) { @@ -775,7 +775,7 @@ Old analysis of cases: } else { if(atEnd) { // insertion at the end - if(onPoint) { // last env point is at RH end, Case 2: + if(onPoint) { // last env point is at RH end, Case 2: mEnv[0]->SetT(mEnv[0]->GetT() - mTrackEpsilon); // move it L slightly to avoid duplicate point //wxLogDebug(wxT("Case 2")); } @@ -875,7 +875,7 @@ void Envelope::RemoveUnneededPoints(double time, double tolerence) if( fabs(val -val1) > tolerence ) { Insert(when,val); // put it back, we needed it - + //Insert may have modified instead of inserting, if two points were at the same time. // in which case len needs to shrink i and len, because the array size decreased. bExcludePoint = (mEnv.Count() < len); @@ -960,7 +960,7 @@ void Envelope::GetPoints(double *bufferWhen, * If you call Envelope::Insert() from WaveClip, or anywhere else outside the * Envelope class that is using project timing, subtract the envelope's mOffset * from the time. - * If you call Envelope::Insert() from within Envelope, don't subtract mOffset + * If you call Envelope::Insert() from within Envelope, don't subtract mOffset * because you are working in relative time inside the envelope * @param when the time in seconds when the envelope point should be created. * @param value the envelope value to use at the given point. @@ -997,7 +997,7 @@ int Envelope::Insert(double when, double value) when = mTrackLen; int i = 0; - + while (i < len && when > mEnv[i]->GetT()) i++; @@ -1078,7 +1078,7 @@ void Envelope::BinarySearchForTime( int &Lo, int &Hi, double t ) const /// GetInterpolationStartValueAtPoint() is used to select either the /// envelope value or its log depending on whether we are doing linear -/// or log interpolation. +/// or log interpolation. /// @param iPoint index in env array to look at. /// @return value there, or its (safe) log10. double Envelope::GetInterpolationStartValueAtPoint( int iPoint ) const @@ -1139,7 +1139,7 @@ void Envelope::GetValues(double *buffer, int bufferLen, vprev = GetInterpolationStartValueAtPoint( lo ); vnext = GetInterpolationStartValueAtPoint( hi ); - + // Interpolate, either linear or log depending on mDB. double dt = (tnext - tprev); double to = t - tprev; @@ -1317,11 +1317,11 @@ double Envelope::Integral( double t0, double t1 ) { return -Integral(t1, t0); // this makes more sense than returning the default value } - + unsigned int count = mEnv.Count(); if(count == 0) // 'empty' envelope return (t1 - t0) * mDefaultValue; - + double total = 0.0, lastT, lastVal; unsigned int i; // this is the next point to check if(t0 < mEnv[0]->GetT()) // t0 preceding the first point @@ -1346,7 +1346,7 @@ double Envelope::Integral( double t0, double t1 ) lastT = t0; i = hi; // the point immediately after t0. } - + // loop through the rest of the envelope points until we get to t1 while (1) { @@ -1377,11 +1377,11 @@ double Envelope::IntegralOfInverse( double t0, double t1 ) { return -IntegralOfInverse(t1, t0); // this makes more sense than returning the default value } - + unsigned int count = mEnv.Count(); if(count == 0) // 'empty' envelope return (t1 - t0) / mDefaultValue; - + double total = 0.0, lastT, lastVal; unsigned int i; // this is the next point to check if(t0 < mEnv[0]->GetT()) // t0 preceding the first point @@ -1406,7 +1406,7 @@ double Envelope::IntegralOfInverse( double t0, double t1 ) lastT = t0; i = hi; // the point immediately after t0. } - + // loop through the rest of the envelope points until we get to t1 while (1) { @@ -1438,11 +1438,11 @@ double Envelope::SolveIntegralOfInverse( double t0, double area ) fprintf( stderr, "SolveIntegralOfInverse called with negative area, this is not supported!\n" ); return t0; } - + unsigned int count = mEnv.Count(); if(count == 0) // 'empty' envelope return t0 + area * mDefaultValue; - + double lastT, lastVal; unsigned int i; // this is the next point to check if(t0 < mEnv[0]->GetT()) // t0 preceding the first point @@ -1468,7 +1468,7 @@ double Envelope::SolveIntegralOfInverse( double t0, double area ) lastT = t0; i = hi; // the point immediately after t0. } - + // loop through the rest of the envelope points until we get to t1 while (1) { diff --git a/src/Envelope.h b/src/Envelope.h index 1265cdda6..691985199 100644 --- a/src/Envelope.h +++ b/src/Envelope.h @@ -40,7 +40,7 @@ public: mT = t; mVal = ClampValue(val); } - + double ClampValue(double val); // this calls mEnvelope->ClampValue(), implementation is below the Envelope class double GetT() { return mT; } @@ -74,12 +74,12 @@ private: Envelope *mEnvelope; double mT; double mVal; - + }; // TODO: Become an array of EnvPoint rather than of pointers to. -// Really? wxWidgets help says: -// "wxArray is suitable for storing integer types and pointers which it does not +// Really? wxWidgets help says: +// "wxArray is suitable for storing integer types and pointers which it does not // treat as objects in any way..." // And why is this a TODO in any case, if it works correctly? WX_DEFINE_ARRAY(EnvPoint *, EnvArray); @@ -98,11 +98,11 @@ class Envelope : public XMLTagHandler { void Flatten(double value); int GetDragPoint(void) {return mDragPoint;} - + double GetMinValue() { return mMinValue; } double GetMaxValue() { return mMaxValue; } void SetRange(double minValue, double maxValue); - + double ClampValue(double value) { return std::max(mMinValue, std::min(mMaxValue, value)); } #if LEGACY_PROJECT_FILE_SUPPORT @@ -147,7 +147,7 @@ class Envelope : public XMLTagHandler { // Control void SetOffset(double newOffset); void SetTrackLen(double trackLen); - + // Accessors /** \brief Get envelope value at time t */ double GetValue(double t) const; @@ -241,7 +241,7 @@ private: int mButton; bool mDB; bool mDirty; - + double mMinValue, mMaxValue; // These are memoizing variables for Integral() diff --git a/src/Experimental.h b/src/Experimental.h index 083cb92b6..950b13c7a 100644 --- a/src/Experimental.h +++ b/src/Experimental.h @@ -9,7 +9,7 @@ Used for #includes and #defines for experimental features. - When the features become mainstream the #include files will + When the features become mainstream the #include files will move out of here and into the files which need them. The #defines will then be retired. @@ -21,8 +21,8 @@ - Modular architecture. Add #defines in here for the new features, and make your code conditional on those #defines. - - All the #defines are positive, i.e., when defined, + + All the #defines are positive, i.e., when defined, they enable the feature. **********************************************************************/ @@ -50,7 +50,7 @@ // experimental theming // Work in progress, June-2008. -// This mostly sets up a weird color scheme currently. +// This mostly sets up a weird color scheme currently. //#define EXPERIMENTAL_THEMING //August 2009 - Theming not locked down enough for a stable release. @@ -58,7 +58,7 @@ //#define EXPERIMENTAL_THEME_PREFS //Next line enables Mic monitoring at times when it was previously off. -//More work is needed as after recording or playing it results in an +//More work is needed as after recording or playing it results in an //unwanted record-cursor on the wave track. //#define EXPERIMENTAL_EXTRA_MONITORING @@ -75,9 +75,9 @@ // preferrably disabled until other work is done. Martyn 22/12/2008. //#define EFFECT_CATEGORIES -// Andreas Micheler, 20.Nov 2007: +// Andreas Micheler, 20.Nov 2007: // A spectrumLogF-like view mode with notes quantization. -// Just select the "Find Notes" checkbox in the spectrum prefs +// Just select the "Find Notes" checkbox in the spectrum prefs // to activate it instead of the Spectrum log(f) mode. //#define EXPERIMENTAL_FIND_NOTES @@ -85,7 +85,7 @@ // Skip Points support in the spectrum view mode. //#define EXPERIMENTAL_FFT_SKIP_POINTS -// AM, 22.Nov 2007: +// AM, 22.Nov 2007: // A Frequency Grid for the Spectrum Log(f) & Find Notes modes //#define EXPERIMENTAL_FFT_Y_GRID @@ -125,7 +125,7 @@ // a tabbed divider to the project. //#define EXPERIMENTAL_NOTEBOOK // The notebook in turn can contain: - // 1. The Nyquist Inspector, which is a browser for the objects in + // 1. The Nyquist Inspector, which is a browser for the objects in // Audacity. //#define EXPERIMENTAL_NYQUIST_INSPECTOR // 2. The Vocal Studio, a screen for working with vocal sounds @@ -133,7 +133,7 @@ //#define EXPERIMENTAL_VOCAL_STUDIO // 3. The Audacity Tester is an extended version of the benchmarks // display. The crucial idea is to be able to compare waveforms - // where effects have been applied by audacity but using different + // where effects have been applied by audacity but using different // block-sizes. This should give high confidence that we don't // suffer from end-effects on buffers, e.g. losing one sample on // each buffer. diff --git a/src/FFmpeg.h b/src/FFmpeg.h index 285e82dfa..bcdced555 100644 --- a/src/FFmpeg.h +++ b/src/FFmpeg.h @@ -35,7 +35,7 @@ Describes shared object that is used to access FFmpeg libraries. #if defined(USE_FFMPEG) extern "C" { - // Include errno.h before the ffmpeg includes since they depend on + // Include errno.h before the ffmpeg includes since they depend on // knowing the value of EINVAL...see bottom of avcodec.h. Not doing // so will produce positive error returns when they should be < 0. #include @@ -369,7 +369,7 @@ private: wxString mAVCodecVersion; wxString mAVFormatVersion; wxString mAVUtilVersion; - + ///! wx interfaces for dynamic libraries wxDynamicLibrary *avformat; wxDynamicLibrary *avcodec; @@ -401,7 +401,7 @@ typedef struct _streamContext AVPacket m_pkt; // the last AVPacket we read for this stream int m_pktValid; // is m_pkt valid? uint8_t *m_pktDataPtr; // pointer into m_pkt.data - int m_pktRemainingSiz; + int m_pktRemainingSiz; int64_t m_pts; // the current presentation time of the input stream int64_t m_ptsOffset; // packets associated with stream are relative to this @@ -450,7 +450,7 @@ extern "C" { // make sure that the definitions are the same. If not, it will complain. For this to occur, // the functions MUST be defined in an extern "C" block otherwise the compiler just thinks the // functions are being overloaded. - // + // // The compiler should optimize away the inline function since it just passes control to the real // function and we should wind up with about the same function call we had before, only now it is // safer due to the validation. @@ -525,7 +525,7 @@ extern "C" { } \ } - // + // // libavutil // FFMPEG_FUNCTION_WITH_RETURN( @@ -535,7 +535,7 @@ extern "C" { () ); FFMPEG_FUNCTION_NO_RETURN( - av_log_set_callback, + av_log_set_callback, (void (*cb)(void*, int, const char*, va_list)), (cb) ); diff --git a/src/FileFormats.cpp b/src/FileFormats.cpp index 19918237d..bfdce00f4 100644 --- a/src/FileFormats.cpp +++ b/src/FileFormats.cpp @@ -72,7 +72,7 @@ unsigned int sf_header_index_to_type(int i) int sf_num_encodings() { int count ; - + sf_command (NULL, SFC_GET_FORMAT_SUBTYPE_COUNT, &count, sizeof (int)) ; return count; @@ -108,7 +108,7 @@ unsigned int sf_encoding_index_to_subtype(int i) wxString sf_header_name(int format) { SF_FORMAT_INFO format_info; - + memset(&format_info, 0, sizeof(format_info)); format_info.format = (format & SF_FORMAT_TYPEMASK); sf_command(NULL, SFC_GET_FORMAT_INFO, &format_info, sizeof(format_info)); @@ -122,7 +122,7 @@ wxString sf_header_shortname(int format) char *tmp; int i; wxString s; - + memset(&format_info, 0, sizeof(format_info)); format_info.format = (format & SF_FORMAT_TYPEMASK); sf_command(NULL, SFC_GET_FORMAT_INFO, &format_info, sizeof(format_info)); @@ -147,7 +147,7 @@ wxString sf_header_shortname(int format) wxString sf_header_extension(int format) { SF_FORMAT_INFO format_info; - + memset(&format_info, 0, sizeof(format_info)); format_info.format = (format & SF_FORMAT_TYPEMASK); sf_command(NULL, SFC_GET_FORMAT_INFO, &format_info, sizeof(format_info)); @@ -158,7 +158,7 @@ wxString sf_header_extension(int format) wxString sf_encoding_name(int encoding) { SF_FORMAT_INFO format_info; - + memset(&format_info, 0, sizeof(format_info)); format_info.format = (encoding & SF_FORMAT_SUBMASK); sf_command(NULL, SFC_GET_FORMAT_INFO, &format_info, sizeof(format_info)); @@ -169,7 +169,7 @@ wxString sf_encoding_name(int encoding) int sf_num_simple_formats() { int count ; - + sf_command (NULL, SFC_GET_SIMPLE_FORMAT_COUNT, &count, sizeof (int)) ; return count; @@ -204,7 +204,7 @@ bool sf_subtype_is_integer(unsigned int format) subtype == SF_FORMAT_PCM_24 || subtype == SF_FORMAT_PCM_32); } - + wxArrayString sf_get_all_extensions() { wxArrayString exts; @@ -212,7 +212,7 @@ wxArrayString sf_get_all_extensions() int count, k; memset(&format_info, 0, sizeof(format_info)); - + sf_command(NULL, SFC_GET_FORMAT_MAJOR_COUNT, &count, sizeof(count)); @@ -220,7 +220,7 @@ wxArrayString sf_get_all_extensions() format_info.format = k; sf_command(NULL, SFC_GET_FORMAT_MAJOR, &format_info, sizeof (format_info)) ; - + exts.Add(LAT1CTOWX(format_info.extension)); } diff --git a/src/FileFormats.h b/src/FileFormats.h index 9932cd913..5bab39bad 100644 --- a/src/FileFormats.h +++ b/src/FileFormats.h @@ -20,15 +20,15 @@ // enumerating headers // -/** @brief Get the number of container formats supported by libsndfile +/** @brief Get the number of container formats supported by libsndfile * * Uses SFC_GET_FORMAT_MAJOR_COUNT in sf_command interface */ int sf_num_headers(); -/** @brief Get the name of a container format from libsndfile +/** @brief Get the name of a container format from libsndfile * * Uses SFC_GET_FORMAT_MAJOR in the sf_command() interface. Resulting C string - * from libsndfile is converted to a wxString + * from libsndfile is converted to a wxString * @param format_num The libsndfile format number for the container format * required */ @@ -54,7 +54,7 @@ unsigned int sf_encoding_index_to_subtype(int encoding_num); /** @brief Get the string name of the specified container format * * AND format with SF_FORMAT_TYPEMASK to get only the container format and - * then use SFC_GET_FORMAT_INFO to get the description + * then use SFC_GET_FORMAT_INFO to get the description * @param format the libsndfile format to get the name for (only the container * part is used) */ wxString sf_header_name(int format); @@ -75,7 +75,7 @@ wxString sf_header_extension(int format); /** @brief Get the string name of the specified data encoding * * AND encoding_num with SF_FORMAT_SUBMASK to get only the data encoding and - * then use SFC_GET_FORMAT_INFO to get the description + * then use SFC_GET_FORMAT_INFO to get the description * @param encoding_num the libsndfile encoding to get the name for (only the * data encoding is used) */ wxString sf_encoding_name(int encoding_num); diff --git a/src/FileIO.cpp b/src/FileIO.cpp index f8974829f..9f98cb152 100644 --- a/src/FileIO.cpp +++ b/src/FileIO.cpp @@ -1,9 +1,9 @@ /********************************************************************** Audacity: A Digital Audio Editor - + FileIO.cpp - + Leland Lucius **********************************************************************/ @@ -72,7 +72,7 @@ void FileIO::Close() // MacOS: set the file type/creator so that the OS knows it's an MP3 // file which was created by Audacity - + void FileIO::SetCatalogInfo() { #ifdef __WXMAC__ @@ -124,6 +124,6 @@ wxOutputStream & FileIO::Write(const void *buf, size_t size) if (mOutputStream == NULL) { return *mOutputStream; } - + return mOutputStream->Write(buf, size); } diff --git a/src/FileIO.h b/src/FileIO.h index 77f2971cb..be1290aec 100644 --- a/src/FileIO.h +++ b/src/FileIO.h @@ -1,9 +1,9 @@ /********************************************************************** Audacity: A Digital Audio Editor - + FileIO.h - + Leland Lucius **********************************************************************/ @@ -28,7 +28,7 @@ class FileIO ~FileIO(); bool IsOpened(); - + void Close(); wxInputStream & Read(void *buffer, size_t size); diff --git a/src/FileNames.cpp b/src/FileNames.cpp index 67da50cc4..e89cf3498 100644 --- a/src/FileNames.cpp +++ b/src/FileNames.cpp @@ -11,8 +11,8 @@ \class FileNames \brief Provides Static functions to yield filenames. -This class helps us with setting a base path, and makes it easier -for us to keep track of the different kinds of files we read and write +This class helps us with setting a base path, and makes it easier +for us to keep track of the different kinds of files we read and write from. JKC: In time I plan to add all file names and file extensions @@ -53,7 +53,7 @@ wxString FileNames::MkDir(const wxString &Str) /// Returns the directory used for temp files. /// \todo put a counter in here to see if it gets used a lot. -/// if it does, then maybe we should cache the path name +/// if it does, then maybe we should cache the path name /// each time. wxString FileNames::TempDir() { @@ -103,7 +103,7 @@ wxString FileNames::DataDir() exePath.RemoveLastDir(); #endif wxFileName portablePrefsPath(exePath.GetPath(), wxT("Portable Settings")); - + if (::wxDirExists(portablePrefsPath.GetFullPath())) { // Use "Portable Settings" folder @@ -121,7 +121,7 @@ wxString FileNames::DataDir() gDataDir = FileNames::MkDir(dataDir); } } - + return gDataDir; } @@ -133,16 +133,16 @@ wxString FileNames::HtmlHelpDir() exePath.RemoveLastDir(); exePath.RemoveLastDir(); exePath.RemoveLastDir(); - + return wxFileName( exePath.GetPath()+wxT("/help/manual"), wxEmptyString ).GetFullPath(); #else //linux goes into /*prefix*/share/audacity/ //windows goes into the dir containing the .exe wxString exeDir = wxStandardPaths::Get().GetDataDir(); - + //for mac this puts us within the .app: Audacity.app/Contents/SharedSupport/ return wxFileName( exeDir+wxT("/help/manual"), wxEmptyString ).GetFullPath(); -#endif +#endif } wxString FileNames::HtmlHelpIndexFile(bool quick) @@ -236,7 +236,7 @@ wxString FileNames::PathFromAddr(void *addr) } #elif defined(__WXMSW__) && defined(_UNICODE) // The GetModuleHandlEx() function did not appear until Windows XP and - // GetModuleFileName() did appear until Windows 2000, so we have to + // GetModuleFileName() did appear until Windows 2000, so we have to // check for them at runtime. typedef BOOL (WINAPI *getmodulehandleex)(DWORD dwFlags, LPCWSTR lpModuleName, HMODULE* phModule); typedef DWORD (WINAPI *getmodulefilename)(HMODULE hModule, LPWCH lpFilename, DWORD nSize); diff --git a/src/FileNames.h b/src/FileNames.h index 84b5fc8a3..f5b4bb641 100644 --- a/src/FileNames.h +++ b/src/FileNames.h @@ -60,7 +60,7 @@ public: private: // Private constructors: No one is ever going to instantiate it. - // + // FileNames(){;}; ~FileNames(){;}; }; diff --git a/src/FreqWindow.cpp b/src/FreqWindow.cpp index 8c68444e4..e6c3dd401 100644 --- a/src/FreqWindow.cpp +++ b/src/FreqWindow.cpp @@ -432,7 +432,7 @@ void FreqWindow::GetAudio() } t = iter.Next(); } - + if (selcount == 0) return; @@ -477,7 +477,7 @@ void FreqWindow::DrawPlot() } mBitmap = new wxBitmap(mUpdateRect.width, mUpdateRect.height); - + wxMemoryDC memDC; memDC.SelectObject(*mBitmap); diff --git a/src/HelpText.cpp b/src/HelpText.cpp index d37dd8ffd..8f6d78706 100644 --- a/src/HelpText.cpp +++ b/src/HelpText.cpp @@ -186,12 +186,12 @@ static wxString HelpTextBuiltIn( const wxString & Key ) wxString(wxT("")) + _("

How to Get Help

") + _("Welcome to Audacity ") + AUDACITY_VERSION_STRING + wxT("!

") + - _("These are our support methods:") + wxT("

") + wxT("
  • ") + + _("These are our support methods:") + wxT("

    ") + wxT("
    • ") + _(" [[file:quick_help.html|Quick Help]] (should be installed locally, Internet version if it isn't)") + wxT("
    • ") + _(" [[file:index.html|Manual]] (should be installed locally, Internet version if it isn't)") + wxT("
    • ") + _(" [[http://wiki.audacityteam.org/index.php|Wiki]] (the latest tips, tricks and tutorials, on the Internet)") + wxT("
    • ") + _(" Forum (ask your question directly, on the Internet)") + wxT("

    ") + - _(" For even quicker answers, all the online resources above are searchable.") + wxT("

    ") + _(" For even quicker answers, all the online resources above are searchable.") + wxT("

    ") ); } if(Key==wxT("wma-proprietary")) diff --git a/src/HistoryWindow.cpp b/src/HistoryWindow.cpp index a9684ac9b..56e51b908 100644 --- a/src/HistoryWindow.cpp +++ b/src/HistoryWindow.cpp @@ -10,8 +10,8 @@ *******************************************************************//*! \class HistoryWindow -\brief Works with UndoManager to allow user to see descriptions of -and undo previous commands. Also allows you to selectively clear the +\brief Works with UndoManager to allow user to see descriptions of +and undo previous commands. Also allows you to selectively clear the undo memory so as to free up space. *//*******************************************************************/ @@ -116,10 +116,10 @@ HistoryWindow::HistoryWindow(AudacityProject *parent, UndoManager *manager): S.EndVerticalLay(); // ----------------------- End of main section -------------- - // Vaughan, 2010-07-30: AudacityProject::OnHistory always calls Show() + // Vaughan, 2010-07-30: AudacityProject::OnHistory always calls Show() // then HistoryWindow::UpdateDisplay, so no need to do it here. - // Vaughan, 2010-10-16: Not on Windows, anyway. - // But Steve reported that on Ubuntu, View > History now crashes, + // Vaughan, 2010-10-16: Not on Windows, anyway. + // But Steve reported that on Ubuntu, View > History now crashes, // so restore it for non-Windows. #ifdef __WXGTK__ DoUpdate(); @@ -151,7 +151,7 @@ void HistoryWindow::DoUpdate() mSelected = mManager->GetCurrentState() - 1; for (i = 0; i < (int)mManager->GetNumStates(); i++) { wxString desc, size; - + mManager->GetLongDescription(i + 1, &desc, &size); mList->InsertItem(i, desc, i == mSelected ? 1 : 0); mList->SetItem(i, 1, size); diff --git a/src/ImageManipulation.cpp b/src/ImageManipulation.cpp index 5bdab3157..654186eaf 100644 --- a/src/ImageManipulation.cpp +++ b/src/ImageManipulation.cpp @@ -3,7 +3,7 @@ Audacity: A Digital Audio Editor ImageManipulation.cpp - + Dominic Mazzoni James Crook @@ -16,7 +16,7 @@ Provides Image Manipulation functions. wxWidgets misses some important functions involving cutting and -pasting bitmaps, and (in version 2.6.1) is patchy in support of alpha +pasting bitmaps, and (in version 2.6.1) is patchy in support of alpha channel. This collection of functions fills that gap. *//*********************************************************************/ @@ -27,10 +27,10 @@ channel. This collection of functions fills that gap. #include "ImageManipulation.h" /// This looks at the first pixel in the image, and shifts -/// the entire image by the vector difference between that +/// the entire image by the vector difference between that /// pixel and the dstColour. For better control, use /// ChangeImageColour(wxImage, wxColour*, wxColour*) below -wxImage *ChangeImageColour(wxImage * srcImage, wxColour & dstColour) +wxImage *ChangeImageColour(wxImage * srcImage, wxColour & dstColour) { unsigned char *src = srcImage->GetData(); wxColour c; @@ -39,10 +39,10 @@ wxImage *ChangeImageColour(wxImage * srcImage, wxColour & dstColour) } ///This will explicitly shift the image color from -///srcColour to dstColour. +///srcColour to dstColour. wxImage *ChangeImageColour(wxImage * srcImage, wxColour & srcColour, - wxColour & dstColour) + wxColour & dstColour) { // This function takes a source image, which it assumes to // be grayscale, and smoothly changes the overall color @@ -99,7 +99,7 @@ wxImage *ChangeImageColour(wxImage * srcImage, /// overlaid onto the background using alpha-blending, /// at location (xoff, yoff). wxImage *OverlayImage(wxImage * background, wxImage * foreground, - wxImage * mask, int xoff, int yoff) + wxImage * mask, int xoff, int yoff) { unsigned char *bg = background->GetData(); unsigned char *fg = foreground->GetData(); @@ -115,7 +115,7 @@ wxImage *OverlayImage(wxImage * background, wxImage * foreground, //Now, determine the dimensions of the images to be masked together //on top of the background. This should be equal to the area of the - //smaller of the foreground and the mask, as long as it is + //smaller of the foreground and the mask, as long as it is //within the area of the background, given the offset. //Make sure the foreground size is no bigger than the mask @@ -138,7 +138,7 @@ wxImage *OverlayImage(wxImage * background, wxImage * foreground, // Go through the foreground image bit by bit and mask it on to the // background, at an offset of xoff,yoff. // BUT...Don't go beyond the size of the background image, - // the foreground image, or the mask + // the foreground image, or the mask int x, y; for (y = 0; y < hCutoff; y++) { @@ -151,11 +151,11 @@ wxImage *OverlayImage(wxImage * background, wxImage * foreground, int opp = 255 - value; for (int c = 0; c < 3; c++) - dstp[x * 3 + c] = - ((bkp[x * 3 + c] * opp) + + dstp[x * 3 + c] = + ((bkp[x * 3 + c] * opp) + (fg[3 * (y * fgWidth + x) + c] * value)) / 255; } - } + } return dstImage; } @@ -191,7 +191,7 @@ wxImage *OverlayImage(teBmps eBack, teBmps eForeground, //Now, determine the dimensions of the images to be masked together //on top of the background. This should be equal to the area of the - //smaller of the foreground and the mask, as long as it is + //smaller of the foreground and the mask, as long as it is //within the area of the background, given the offset. //Make sure the foreground size is no bigger than the mask @@ -212,7 +212,7 @@ wxImage *OverlayImage(teBmps eBack, teBmps eForeground, // Go through the foreground image bit by bit and mask it on to the // background, at an offset of xoff,yoff. // BUT...Don't go beyond the size of the background image, - // the foreground image, or the mask + // the foreground image, or the mask int x, y; for (y = 0; y < hCutoff; y++) { @@ -225,11 +225,11 @@ wxImage *OverlayImage(teBmps eBack, teBmps eForeground, int opp = 255 - value; for (int c = 0; c < 3; c++) - dstp[x * 3 + c] = - ((bkp[x * 3 + c] * opp) + + dstp[x * 3 + c] = + ((bkp[x * 3 + c] * opp) + (fg[3 * (y * fgWidth + x) + c] * value)) / 255; } - } + } return dstImage; } @@ -293,8 +293,8 @@ void PasteSubImage( wxImage * background, wxImage * foreground, int xoff, int yo unsigned char *bg = background->GetData(); unsigned char *fg = foreground->GetData(); - unsigned char *bgAlpha = background->HasAlpha() ? background->GetAlpha() : NULL; - unsigned char *fgAlpha = foreground->HasAlpha() ? foreground->GetAlpha() : NULL; + unsigned char *bgAlpha = background->HasAlpha() ? background->GetAlpha() : NULL; + unsigned char *fgAlpha = foreground->HasAlpha() ? foreground->GetAlpha() : NULL; // For testing... Set as if no alpha in foreground.... // fgAlpha = NULL; @@ -340,7 +340,7 @@ void PasteSubImage( wxImage * background, wxImage * foreground, int xoff, int yo memset( bgAlphap, 255, wCutoff ); } } - } + } } /// Gets a rectangle from within another image, INCLUDING the alpha channel diff --git a/src/ImageManipulation.h b/src/ImageManipulation.h index 65959b623..aac5d112f 100644 --- a/src/ImageManipulation.h +++ b/src/ImageManipulation.h @@ -3,10 +3,10 @@ Audacity: A Digital Audio Editor ImageManipulation.h - + Dominic Mazzoni -**********************************************************************/ +**********************************************************************/ #include #include @@ -15,10 +15,10 @@ class wxImage; // This looks at the first pixel in the image, and shifts -// the entire image by the vector difference between that +// the entire image by the vector difference between that // pixel and the dstColour. For better control, use // ChangeImageColour(wxImage, wxColour*, wxColour*) below -wxImage *ChangeImageColour(wxImage * srcImage, wxColour & dstColour); +wxImage *ChangeImageColour(wxImage * srcImage, wxColour & dstColour); // This function takes a source image, which it assumes to // be grayscale, and smoothly changes the overall color @@ -30,7 +30,7 @@ wxImage *ChangeImageColour(wxImage * srcImage, wxColour & dstColour); wxImage *ChangeImageColour(wxImage * srcImage, wxColour & srcColour, wxColour & dstColour); - + // Takes a background image, foreground image, and mask // (i.e. the alpha channel for the foreground), and // returns an new image where the foreground has been diff --git a/src/Internat.cpp b/src/Internat.cpp index 8213a6cd4..41e5d3567 100644 --- a/src/Internat.cpp +++ b/src/Internat.cpp @@ -20,7 +20,7 @@ and on Mac OS X for the filesystem. *//*******************************************************************/ -#include +#include #include #include #include @@ -97,17 +97,17 @@ wxString Internat::ToDisplayString(double numberToConvert, if (digitsAfterDecimalPoint == -1) { result.Printf(wxT("%f"), numberToConvert); - + // Not all libcs respect the decimal separator, so always convert // any dots found to the decimal separator. result.Replace(wxT("."), decSep); - + if (result.Find(decSep) != -1) { - // Strip trailing zeros, but leave one, and decimal separator. + // Strip trailing zeros, but leave one, and decimal separator. int pos = result.Length() - 1; - while ((pos > 1) && - (result.GetChar(pos) == wxT('0')) && + while ((pos > 1) && + (result.GetChar(pos) == wxT('0')) && (result.GetChar(pos - 1) != decSep)) pos--; // (Previous code removed all of them and decimal separator.) @@ -115,13 +115,13 @@ wxString Internat::ToDisplayString(double numberToConvert, // pos--; // strip point before empty fractional part result = result.Left(pos+1); } - } + } else { wxString format; format.Printf(wxT("%%.%if"), digitsAfterDecimalPoint); result.Printf(format, numberToConvert); - + // Not all libcs respect the decimal separator, so always convert // any dots found to the decimal separator result.Replace(wxT("."), decSep); diff --git a/src/Internat.h b/src/Internat.h index a4e7cb58b..1a0306096 100644 --- a/src/Internat.h +++ b/src/Internat.h @@ -64,7 +64,7 @@ public: * remove them */ static wxString SanitiseFilename(const wxString &name, const wxString &sub); - /** \brief Remove accelerator charactors from strings + /** \brief Remove accelerator charactors from strings * * Utility function - takes a translatable string to be used as a menu item, * for example _("&Splash...\tAlt+S"), and strips all of the menu diff --git a/src/LabelDialog.cpp b/src/LabelDialog.cpp index c733c2612..1a251c804 100644 --- a/src/LabelDialog.cpp +++ b/src/LabelDialog.cpp @@ -106,7 +106,7 @@ LabelDialog::LabelDialog(wxWindow *parent, wxBoxSizer *vs = new wxBoxSizer(wxVERTICAL); // A little instruction - wxStaticText *instruct = + wxStaticText *instruct = new wxStaticText(this, wxID_ANY, _("Press F2 or double click to edit cell contents.")); @@ -538,7 +538,7 @@ void LabelDialog::OnImport(wxCommandEvent & WXUNUSED(event)) // into it LabelTrack *lt = new LabelTrack(mDirManager); lt->Import(f); - + // Add the labesls to our collection AddLabels(lt); diff --git a/src/LabelDialog.h b/src/LabelDialog.h index 9d8afe208..7bff60cc0 100644 --- a/src/LabelDialog.h +++ b/src/LabelDialog.h @@ -73,7 +73,7 @@ class LabelDialog:public wxDialog TimeEditor *mTimeEditor; RowDataArray mData; - + DirManager *mDirManager; TrackList *mTracks; ViewInfo *mViewInfo; diff --git a/src/LabelTrack.cpp b/src/LabelTrack.cpp index 45f8c521e..f5eb1867e 100644 --- a/src/LabelTrack.cpp +++ b/src/LabelTrack.cpp @@ -68,7 +68,7 @@ bool LabelTrack::mbGlyphsReady=false; /// We have several variants of the icons (highlighting). /// The icons are draggable, and you can drag one boundary -/// or all boundaries at the same timecode depending on whether you +/// or all boundaries at the same timecode depending on whether you /// click the centre (for all) or the arrow part (for one). /// Currently we have twelve variants but we're only using six. wxBitmap LabelTrack::mBoundaryGlyphs[ NUM_GLYPH_CONFIGS * NUM_GLYPH_HIGHLIGHTS ]; @@ -128,7 +128,7 @@ LabelTrack::LabelTrack(const LabelTrack &orig) : mLabels.Add(l); } mSelIndex = orig.mSelIndex; - + // reset flags ResetFlags(); } @@ -237,11 +237,11 @@ double LabelTrack::AdjustTimeStampOnScale(double t, double b, double e, double c { //t is the time stamp we'll be changing //b and e are the selection start and end - + if (t < b){ return t; }else if (t > e){ - double shift = (e-b)*change - (e-b); + double shift = (e-b)*change - (e-b); return t + shift; }else{ double shift = (t-b)*change - (t-b); @@ -288,7 +288,7 @@ void LabelTrack::ResetFont() } } -/// ComputeTextPosition is 'smart' about where to display +/// ComputeTextPosition is 'smart' about where to display /// the label text. /// /// The text must be displayed between its endpoints x and x1 @@ -298,12 +298,12 @@ void LabelTrack::ResetFont() /// /// This function has a number of tests and adjustments to the /// text start position. The tests later in the function will -/// take priority over the ones earlier, so because centering -/// is the first thing we do, it's the first thing we lose if +/// take priority over the ones earlier, so because centering +/// is the first thing we do, it's the first thing we lose if /// we can't do everything we want to. void LabelTrack::ComputeTextPosition(const wxRect & r, int index) { - // xExtra is extra space + // xExtra is extra space // between the text and the endpoints. const int xExtra=mIconWidth; int x = mLabels[index]->x; // left endpoint @@ -318,10 +318,10 @@ void LabelTrack::ComputeTextPosition(const wxRect & r, int index) bool bSimpleCentering = false; //TODO (possibly): - // Add configurable options as to when to use simple + // Add configurable options as to when to use simple // and when complex centering. // - // Simple centering does its best to keep the text + // Simple centering does its best to keep the text // centered between the label limits. // // Complex centering positions the text proportionally @@ -348,7 +348,7 @@ void LabelTrack::ComputeTextPosition(const wxRect & r, int index) int rx0,rx1,xText0,xText1; // Since we will be using a linear function, - // we should blend smoothly between left and right + // we should blend smoothly between left and right // aligned text as r, the 'viewport' moves. if( bTooWideForScreen ) { @@ -360,9 +360,9 @@ void LabelTrack::ComputeTextPosition(const wxRect & r, int index) else { // when label start + width + extra spacing at viewport end.. - rx0=x-r.width+width+2*xExtra; + rx0=x-r.width+width+2*xExtra; // ..text aligned left. - xText0=x+xExtra; + xText0=x+xExtra; // when viewport start + width + extra spacing at label end.. rx1=x1-(width+2*xExtra); // ..text aligned right. @@ -377,7 +377,7 @@ void LabelTrack::ComputeTextPosition(const wxRect & r, int index) // // xText = xText0 + ((xText1-xText0)*(r.x-rx0))/(rx1-rx0); // - // The problem with the above is that it integer-oveflows at + // The problem with the above is that it integer-oveflows at // high zoom. // Instead use: @@ -396,7 +396,7 @@ void LabelTrack::ComputeTextPosition(const wxRect & r, int index) } } - // Is the text now appearing partly outside r? + // Is the text now appearing partly outside r? bool bOffLeft = xText < r.x+xExtra; bool bOffRight = xText > r.x+r.width-width-xExtra; @@ -405,7 +405,7 @@ void LabelTrack::ComputeTextPosition(const wxRect & r, int index) if( bOffLeft == bOffRight ) { //IF both sides on screen, THEN nothing to do. - //IF both sides off screen THEN don't do + //IF both sides off screen THEN don't do //anything about it. //(because if we did, you'd never get to read //all the text by scrolling). @@ -427,10 +427,10 @@ void LabelTrack::ComputeTextPosition(const wxRect & r, int index) // But if we've taken the text out from its endpoints // we must move it back so that it's between the endpoints. - + // We test the left end point last because the // text might not even fit between the endpoints (at this - // zoom factor), and in that case we'd like to position + // zoom factor), and in that case we'd like to position // the text at the left end point. if( xText > (x1-width-xExtra)) xText=(x1-width-xExtra); @@ -465,7 +465,7 @@ void LabelTrack::ComputeLayout(const wxRect & r, double h, double pps) xUsed[i]=xStart; int nRowsUsed=0; - for (i = 0; i < (int)mLabels.Count(); i++) + for (i = 0; i < (int)mLabels.Count(); i++) { int x = r.x + (int) ((mLabels[i]->t - h) * pps); int x1 = r.x + (int) ((mLabels[i]->t1 - h) * pps); @@ -479,7 +479,7 @@ void LabelTrack::ComputeLayout(const wxRect & r, double h, double pps) // (This is to encourage merging of adjacent label boundaries). while( (iRow= nRowsUsed ) { @@ -533,7 +533,7 @@ void LabelStruct::DrawLines(wxDC & dc, const wxRect & r) const int yIconStart = y - (LabelTrack::mIconHeight /2)+1+(LabelTrack::mTextHeight+3)/2; const int yIconEnd = yIconStart + LabelTrack::mIconHeight-2; - // If y is positive then it is the center line for the + // If y is positive then it is the center line for the // Label. if( y >= 0 ) { @@ -572,21 +572,21 @@ void LabelStruct::DrawGlyphs(wxDC & dc, const wxRect & r, int GlyphLeft, int Gly if((x >= r.x) && (x <= (r.x+r.width))) dc.DrawBitmap(LabelTrack::GetGlyph(GlyphLeft), x-xHalfWidth,yStart, true); - // The extra test commented out here would suppress right hand markers + // The extra test commented out here would suppress right hand markers // when they overlap the left hand marker (e.g. zoomed out) or to the left. if((x1 >= r.x) && (x1 <= (r.x+r.width)) /*&& (x1>x+LabelTrack::mIconWidth)*/) dc.DrawBitmap(LabelTrack::GetGlyph(GlyphRight), x1-xHalfWidth,yStart, true); } /// Draw the text of the label and also draw -/// a long thin rectangle for its full extent -/// from x to x1 and a rectangular frame +/// a long thin rectangle for its full extent +/// from x to x1 and a rectangular frame /// behind the text itself. /// @param dc the device context /// @param r the LabelTrack rectangle. void LabelStruct::DrawText(wxDC & dc, const wxRect & r) { - //If y is positive then it is the center line for the + //If y is positive then it is the center line for the //text we are about to draw. //if it isn't, nothing to draw. @@ -609,9 +609,9 @@ void LabelStruct::DrawText(wxDC & dc, const wxRect & r) } -void LabelStruct::DrawTextBox(wxDC & dc, const wxRect & r) +void LabelStruct::DrawTextBox(wxDC & dc, const wxRect & r) { - //If y is positive then it is the center line for the + //If y is positive then it is the center line for the //text we are about to draw. const int yBarHeight=3; const int yFrameHeight = LabelTrack::mTextHeight+3; @@ -626,8 +626,8 @@ void LabelStruct::DrawTextBox(wxDC & dc, const wxRect & r) if( (xStart < (r.x+r.width)) && (xEnd > r.x) && (xWidth>0)) { - - wxRect bar( xStart,y-yBarHeight/2+yFrameHeight/2, + + wxRect bar( xStart,y-yBarHeight/2+yFrameHeight/2, xWidth,yBarHeight); if( x1 > x+xBarShorten ) dc.DrawRectangle(bar); @@ -635,13 +635,13 @@ void LabelStruct::DrawTextBox(wxDC & dc, const wxRect & r) } // In drawing the bar and the frame, we compute the clipping - // to the viewport ourselves. Under Win98 the GDI does its - // calculations in 16 bit arithmetic, and so gets it completely - // wrong at higher zooms where the bar can easily be + // to the viewport ourselves. Under Win98 the GDI does its + // calculations in 16 bit arithmetic, and so gets it completely + // wrong at higher zooms where the bar can easily be // more than 65536 pixels wide. // Draw bar for label extent... - // We don't quite draw from x to x1 because we allow + // We don't quite draw from x to x1 because we allow // half an icon width at each end. { const int xStart=wxMax(r.x,xText-LabelTrack::mIconWidth/2); @@ -660,10 +660,10 @@ void LabelStruct::DrawTextBox(wxDC & dc, const wxRect & r) /// Draws text-selected region within the label void LabelStruct::DrawHighlight( wxDC & dc, int xPos1, int xPos2, int charHeight) -{ +{ highlighted = true; changeInitialMouseXPos = false; - + wxPen curPen = dc.GetPen(); curPen.SetColour(wxString(wxT("BLUE"))); wxBrush curBrush = dc.GetBrush(); @@ -674,7 +674,7 @@ void LabelStruct::DrawHighlight( wxDC & dc, int xPos1, int xPos2, int charHeight dc.DrawRectangle(xPos2-1, y-charHeight/2, xPos1-xPos2+1, charHeight); } -void LabelStruct::getXPos( wxDC & dc, int * xPos1, int cursorPos) +void LabelStruct::getXPos( wxDC & dc, int * xPos1, int cursorPos) { *xPos1 = xText; if( cursorPos > 0) @@ -730,7 +730,7 @@ void LabelTrack::Draw(wxDC & dc, const wxRect & r, double h, double pps, // Get the text widths. // TODO: Make more efficient by only re-computing when a // text label title changes. - for (i = 0; i < (int)mLabels.Count(); i++) + for (i = 0; i < (int)mLabels.Count(); i++) { dc.GetTextExtent(mLabels[i]->title, &textWidth, &textHeight); mLabels[i]->width = textWidth; @@ -738,12 +738,12 @@ void LabelTrack::Draw(wxDC & dc, const wxRect & r, double h, double pps, // TODO: And this only needs to be done once, but we // do need the dc to do it. - // We need to set mTextHeight to something sensible, + // We need to set mTextHeight to something sensible, // guarding against the case where there are no // labels or all are empty strings, which for example // happens with a new label track. dc.GetTextExtent(wxT("Demo Text x^y"), &textWidth, &textHeight); - mTextHeight = (int)textHeight; + mTextHeight = (int)textHeight; ComputeLayout( r, h , pps ); dc.SetTextForeground(theTheme.Colour( clrLabelTrackText)); dc.SetBackgroundMode(wxTRANSPARENT); @@ -756,13 +756,13 @@ void LabelTrack::Draw(wxDC & dc, const wxRect & r, double h, double pps, // so that the correct things overpaint each other. // Draw vertical lines that show where the end positions are. - for (i = 0; i < nLabels; i++) + for (i = 0; i < nLabels; i++) { mLabels[i]->DrawLines( dc, r ); } // Draw the end glyphs. - for (i = 0; i < nLabels; i++) + for (i = 0; i < nLabels; i++) { GlyphLeft=0; GlyphRight=1; @@ -810,9 +810,9 @@ void LabelTrack::Draw(wxDC & dc, const wxRect & r, double h, double pps, { i = mSelIndex; int xPos = mLabels[i]->xText; - + // if mouse is clicked in text box - if (mMouseXPos != -1) + if (mMouseXPos != -1) { // set current cursor position SetCurrentCursorPosition(dc, (int) mMouseXPos); @@ -831,7 +831,7 @@ void LabelTrack::Draw(wxDC & dc, const wxRect & r, double h, double pps, dc.GetTextExtent((mLabels[i]->title).Left(mCurrentCursorPos), &partWidth, NULL); xPos += partWidth; } - + // Draw the cursor wxPen currentPen = dc.GetPen(); const int CursorWidth=2; @@ -846,9 +846,9 @@ void LabelTrack::Draw(wxDC & dc, const wxRect & r, double h, double pps, } /// Set the cursor position according to x position of mouse -/// uses GetTextExtent to find the character position +/// uses GetTextExtent to find the character position /// corresponding to the x pixel position. -void LabelTrack::SetCurrentCursorPosition(wxDC & dc, int xPos) +void LabelTrack::SetCurrentCursorPosition(wxDC & dc, int xPos) { // A bool indicator to see if set the cursor position or not bool finished = false; @@ -857,42 +857,42 @@ void LabelTrack::SetCurrentCursorPosition(wxDC & dc, int xPos) int oneWidth; double bound; wxString subString; - while (!finished && (charIndex < (int)mLabels[mSelIndex]->title.length() + 1)) + while (!finished && (charIndex < (int)mLabels[mSelIndex]->title.length() + 1)) { subString = (mLabels[mSelIndex]->title).Left(charIndex); // Get the width of substring dc.GetTextExtent(subString, &partWidth, NULL); - if (charIndex > 1) + if (charIndex > 1) { // Get the width of the last character dc.GetTextExtent(subString.Right(1), &oneWidth, NULL); bound = mLabels[mSelIndex]->xText + partWidth - oneWidth * 0.5; } - else + else { bound = mLabels[mSelIndex]->xText + partWidth * 0.5; } - if (xPos <= bound) + if (xPos <= bound) { // Found mCurrentCursorPos = charIndex - 1; finished = true; - } - else + } + else { // Advance charIndex++; } } - if (!finished) + if (!finished) { // Cursor should be in the last position mCurrentCursorPos = mLabels[mSelIndex]->title.length(); } } -void LabelTrack::calculateFontHeight(wxDC & dc) +void LabelTrack::calculateFontHeight(wxDC & dc) { int charDescent; int charLeading; @@ -900,7 +900,7 @@ void LabelTrack::calculateFontHeight(wxDC & dc) // Calculate the width of the substring and add it to Xpos dc.GetTextExtent(wxT("(Test String)|[yp]"), NULL, &mFontHeight, &charDescent, &charLeading); - // The cursor will have height charHeight. We don't include the descender as + // The cursor will have height charHeight. We don't include the descender as // part of the height because for phonetic fonts this leads to cursors which are // too tall. We don't include leading either - it is usually 0. // To make up for ignoring the descender height, we add one pixel above and below @@ -923,7 +923,7 @@ bool LabelTrack::IsTextSelected() /// Cut the selected text in the text box /// @return true if text is selected in text box, false otherwise -bool LabelTrack::CutSelectedText() +bool LabelTrack::CutSelectedText() { if (!IsTextSelected()) return false; @@ -954,7 +954,7 @@ bool LabelTrack::CutSelectedText() // set title to the combination of the two remainders mLabels[mSelIndex]->title = left + right; - + // copy data onto clipboard if (wxTheClipboard->Open()) { #if defined(__WXGTK__) && defined(HAVE_GTK) @@ -963,7 +963,7 @@ bool LabelTrack::CutSelectedText() wxTheClipboard->SetData(new wxTextDataObject(data)); wxTheClipboard->Close(); } - + // set cursor positions mCurrentCursorPos = left.Length(); mInitialCursorPos = mCurrentCursorPos; @@ -972,7 +972,7 @@ bool LabelTrack::CutSelectedText() /// Copy the selected text in the text box /// @return true if text is selected in text box, false otherwise -bool LabelTrack::CopySelectedText() +bool LabelTrack::CopySelectedText() { if (mSelIndex == -1) return false; @@ -986,7 +986,7 @@ bool LabelTrack::CopySelectedText() cur = mInitialCursorPos; init = mCurrentCursorPos; } - + // data for copying wxString data = mLabels[mSelIndex]->title.Mid(init, cur-init); @@ -1013,7 +1013,7 @@ bool LabelTrack::PasteSelectedText(double sel0, double sel1) wxString text; wxString left=wxT(""); wxString right=wxT(""); - + // if text data is available if (IsTextClipSupported()) { if (wxTheClipboard->Open()) { @@ -1051,9 +1051,9 @@ bool LabelTrack::PasteSelectedText(double sel0, double sel1) if (mCurrentCursorPos < (int)(mLabels[mSelIndex]->title).Length()) { right = (mLabels[mSelIndex]->title).Mid(mCurrentCursorPos, (mLabels[mSelIndex]->title).Length()-mCurrentCursorPos); } - mLabels[mSelIndex]->title = left + text + right; + mLabels[mSelIndex]->title = left + text + right; mCurrentCursorPos = left.Length() + text.Length(); - } + } else { // insert the data on the clipboard from the cursor position @@ -1098,7 +1098,7 @@ bool LabelTrack::IsTextClipSupported() double LabelTrack::GetStartTime() { int len = mLabels.Count(); - + if (len == 0) return 0.0; else @@ -1112,7 +1112,7 @@ double LabelTrack::GetEndTime() int len = mLabels.Count(); if (len == 0) return 0.0; - + double end = 0.0; for(int i = 0; i < len; i++) { @@ -1121,10 +1121,10 @@ double LabelTrack::GetEndTime() } return end; } - + /// OverGlyph returns 0 if not over a glyph, -/// 1 if over the left-hand glyph, and +/// 1 if over the left-hand glyph, and /// 2 if over the right-hand glyph on a label. /// 3 if over both right and left. /// @@ -1143,15 +1143,15 @@ int LabelTrack::OverGlyph(int x, int y) int result=0; const int d1=10; //distance in pixels, used for have we hit drag handle. const int d2=5; //distance in pixels, used for have we hit drag handle center. - + //If not over a label, reset it mMouseOverLabelLeft = -1; mMouseOverLabelRight = -1; mbHitCenter = false; - for (int i = 0; i < (int)mLabels.Count(); i++) + for (int i = 0; i < (int)mLabels.Count(); i++) { pLabel = mLabels[i]; - + //over left or right selection bound //Check right bound first, since it is drawn after left bound, //so give it precedence for matching/highlighting. @@ -1173,7 +1173,7 @@ int LabelTrack::OverGlyph(int x, int y) result |= 2; mInBox = false; // to disable the dragging for selecting the text in text box } - // Use else-if here rather than else to avoid detecting left and right + // Use else-if here rather than else to avoid detecting left and right // of the same label. else if( abs(pLabel->y - (y - (LabelTrack::mTextHeight+3)/2)) < d1 && abs(pLabel->x + d2 - x) < d1 ) @@ -1196,9 +1196,9 @@ int LabelTrack::OverGlyph(int x, int y) } // return true if the mouse is over text box, false otherwise -bool LabelTrack::OverTextBox(const LabelStruct *pLabel, int x, int y) +bool LabelTrack::OverTextBox(const LabelStruct *pLabel, int x, int y) { - if( (pLabel->xText-(mIconWidth/2) < x) && + if( (pLabel->xText-(mIconWidth/2) < x) && (xxText+pLabel->width+(mIconWidth/2)) && (abs(pLabel->y-y)y - mFontHeight/2, (int) (mXPos1-mXPos2+0.5), mFontHeight); // reset when left button is down - if (evt.LeftDown()) + if (evt.LeftDown()) mLabels[mSelIndex]->highlighted = false; // reset when right button is down outside text box if (evt.RightDown()) @@ -1501,22 +1501,22 @@ bool LabelTrack::HandleMouse(const wxMouseEvent & evt, mbIsMoving = mbHitCenter; // When we start dragging the label(s) we don't want them to jump. // so we calculate the displacement of the mouse from the drag center - // and use that in subsequent dragging calculations. The mouse stays + // and use that in subsequent dragging calculations. The mouse stays // at the same relative displacement throughout dragging. // However, if two label's edges are being dragged - // then the displacement is relative to the initial average - // position of them, and in that case there can be a jump of at most - // a few pixels to bring the two label boundaries to exactly the same + // then the displacement is relative to the initial average + // position of them, and in that case there can be a jump of at most + // a few pixels to bring the two label boundaries to exactly the same // position when we start dragging. // Dragging of three label edges at the same time is not supported (yet). - if( (mMouseOverLabelRight >=0) && - (mMouseOverLabelLeft >=0) + if( (mMouseOverLabelRight >=0) && + (mMouseOverLabelLeft >=0) ) { t = (mLabels[mMouseOverLabelRight]->t1+mLabels[mMouseOverLabelLeft]->t)/2.0f; - // If we're moving two edges, then it's a move (label size preserved) + // If we're moving two edges, then it's a move (label size preserved) // if both edges are the same label, and it's an adjust (label sizes change) // if we're on a boundary between two different labels. mbIsMoving = (mMouseOverLabelLeft == mMouseOverLabelRight); @@ -1531,7 +1531,7 @@ bool LabelTrack::HandleMouse(const wxMouseEvent & evt, } mxMouseDisplacement = (int)((((t-h) * pps) + r.x )-evt.m_x); return false; - } + } // disable displaying if left button is down if (evt.LeftDown()) @@ -1656,7 +1656,7 @@ bool LabelTrack::OnKeyDown(double & newSel0, double & newSel1, wxKeyEvent & even case WXK_BACK: { int len = mLabels[mSelIndex]->title.Length(); - + //IF the label is not blank THEN get rid of a letter or letters according to cursor position if (len > 0) { @@ -1687,7 +1687,7 @@ bool LabelTrack::OnKeyDown(double & newSel0, double & newSel1, wxKeyEvent & even case WXK_NUMPAD_DELETE: { int len = mLabels[mSelIndex]->title.Length(); - + //If the label is not blank get rid of a letter according to cursor position if (len > 0) { @@ -1796,13 +1796,13 @@ bool LabelTrack::OnKeyDown(double & newSel0, double & newSel1, wxKeyEvent & even } break; - case WXK_RETURN: + case WXK_RETURN: case WXK_NUMPAD_ENTER: - case WXK_ESCAPE: + case WXK_ESCAPE: mSelIndex = -1; break; - + case WXK_TAB: case WXK_NUMPAD_TAB: if (event.ShiftDown()) { @@ -1810,7 +1810,7 @@ bool LabelTrack::OnKeyDown(double & newSel0, double & newSel1, wxKeyEvent & even } else { mSelIndex++; } - + if (mSelIndex >= 0 && mSelIndex < (int)mLabels.Count()) { mCurrentCursorPos = mLabels[mSelIndex]->title.Length(); //Set the selection region to be equal to the selection bounds of the tabbed-to label. @@ -1972,11 +1972,11 @@ bool LabelTrack::OnChar(double & WXUNUSED(newSel0), double & WXUNUSED(newSel1), return updated; } -void LabelTrack::RemoveSelectedText() +void LabelTrack::RemoveSelectedText() { wxString left = wxT(""); wxString right = wxT(""); - + if (mInitialCursorPos > mCurrentCursorPos) { int temp = mCurrentCursorPos; mCurrentCursorPos = mInitialCursorPos; @@ -2026,22 +2026,22 @@ void LabelTrack::Import(wxTextFile & in) wxString s,s1; wxString title; double t,t1; - + lines = in.GetLineCount(); - + mLabels.Clear(); mLabels.Alloc(lines); - + //Currently, we expect a tag file to have two values and a label //on each line. If the second token is not a number, we treat //it as a single-value label. for (index = 0; index < lines; index++) { currentLine = in.GetLine(index); - + len = currentLine.Length(); if (len == 0) return; - + //get the timepoint of the left edge of the label. i = 0; while (i < len && currentLine.GetChar(i) != wxT(' ') @@ -2050,13 +2050,13 @@ void LabelTrack::Import(wxTextFile & in) i++; } s = currentLine.Left(i); - + if (!Internat::CompatibleToDouble(s, &t)) return; - + //Increment one letter. i++; - + //Now, go until we find the start of the get the next token while (i < len && (currentLine.GetChar(i) == wxT(' ') @@ -2066,21 +2066,21 @@ void LabelTrack::Import(wxTextFile & in) } //Keep track of the start of the second token i2=i; - + //Now, go to the end of the second token. while (i < len && currentLine.GetChar(i) != wxT(' ') && currentLine.GetChar(i) != wxT('\t')) { i++; } - - //We are at the end of the second token. + + //We are at the end of the second token. s1 = currentLine.Mid(i2,i-i2+1).Strip(wxString::stripType(0x3)); if (!Internat::CompatibleToDouble(s1, &t1)) { //s1 is not a number. t1 = t; //This is a one-sided label; t1 == t. - + //Because s1 is not a number, the label should be //The rest of the line, starting at i2; title = currentLine.Right(len - i2).Strip(wxString::stripType(0x3)); //0x3 indicates both @@ -2088,12 +2088,12 @@ void LabelTrack::Import(wxTextFile & in) else { //s1 is a number, and it is stored correctly in t1. - //The title should be the remainder of the line, - //After we eat - - //Get rid of spaces at either end + //The title should be the remainder of the line, + //After we eat + + //Get rid of spaces at either end title = currentLine.Right(len - i).Strip(wxString::stripType(0x3)); //0x3 indicates both. - + } LabelStruct *l = new LabelStruct(); l->t = t; @@ -2117,17 +2117,17 @@ bool LabelTrack::HandleXMLTag(const wxChar *tag, const wxChar **attrs) while(*attrs) { const wxChar *attr = *attrs++; const wxChar *value = *attrs++; - + if (!value) break; - + const wxString strValue = value; if (!XMLValueChecker::IsGoodString(strValue)) { delete l; return false; } - + if (!wxStrcmp(attr, wxT("t")) && Internat::CompatibleToDouble(strValue, &dblValue)) l->t = dblValue; else if (!wxStrcmp(attr, wxT("t1")) && Internat::CompatibleToDouble(strValue, &dblValue)) @@ -2154,15 +2154,15 @@ bool LabelTrack::HandleXMLTag(const wxChar *tag, const wxChar **attrs) while (*attrs) { const wxChar *attr = *attrs++; const wxChar *value = *attrs++; - + if (!value) return true; const wxString strValue = value; if (!wxStrcmp(attr, wxT("name")) && XMLValueChecker::IsGoodString(strValue)) mName = strValue; - else if (!wxStrcmp(attr, wxT("numlabels")) && - XMLValueChecker::IsGoodInt(strValue) && strValue.ToLong(&nValue)) + else if (!wxStrcmp(attr, wxT("numlabels")) && + XMLValueChecker::IsGoodInt(strValue) && strValue.ToLong(&nValue)) { if (nValue < 0) { @@ -2172,13 +2172,13 @@ bool LabelTrack::HandleXMLTag(const wxChar *tag, const wxChar **attrs) mLabels.Clear(); mLabels.Alloc(nValue); } - else if (!wxStrcmp(attr, wxT("height")) && + else if (!wxStrcmp(attr, wxT("height")) && XMLValueChecker::IsGoodInt(strValue) && strValue.ToLong(&nValue)) SetHeight(nValue); - else if (!wxStrcmp(attr, wxT("minimized")) && + else if (!wxStrcmp(attr, wxT("minimized")) && XMLValueChecker::IsGoodInt(strValue) && strValue.ToLong(&nValue)) SetMinimized(nValue != 0); - else if (!wxStrcmp(attr, wxT("isSelected")) && + else if (!wxStrcmp(attr, wxT("isSelected")) && XMLValueChecker::IsGoodInt(strValue) && strValue.ToLong(&nValue)) this->SetSelected(nValue != 0); } @@ -2281,7 +2281,7 @@ bool LabelTrack::Cut(double t0, double t1, Track **dest) bool LabelTrack::SplitCut(double t0, double t1, Track ** dest) { // SplitCut() == Copy() + SplitDelete() - + if (!Copy(t0, t1, dest)) return false; if (!SplitDelete(t0, t1)) @@ -2410,7 +2410,7 @@ bool LabelTrack::Repeat(double t0, double t1, int n) // it, and we need to extend it through to the last repeat interval mLabels[i]->t1 += n * tLen; } - + // Other cases have already been handled by ShiftLabelsOnInsert() } @@ -2492,12 +2492,12 @@ int LabelTrack::GetLabelIndex(double t, double t1) int len = mLabels.Count(); int i; - //We'd have liked to have times in terms of samples, + //We'd have liked to have times in terms of samples, //because then we're doing an intrger comparison. //Never mind. Instead we look for near enough. - //This level of (in)accuracy is only a problem if we + //This level of (in)accuracy is only a problem if we //deal with sounds in the MHz range. - const double delta = 1.0e-7; + const double delta = 1.0e-7; for( i=0;i and /// for a left boundary to a label, a right boundary and both. @@ -2622,14 +2622,14 @@ static const char *const GlyphXpmRegionSpec[] = { /// giving 3 x 4 = 12 combinations. /// /// Two of those combinations aren't used, but -/// treating them specially would make other code more +/// treating them specially would make other code more /// complicated. void LabelTrack::CreateCustomGlyphs() { int iConfig; int iHighlight; int index; - const int nSpecRows = + const int nSpecRows = sizeof( GlyphXpmRegionSpec )/sizeof( GlyphXpmRegionSpec[0]); const char *XmpBmp[nSpecRows]; @@ -2701,17 +2701,17 @@ bool LabelTrack::IsGoodLabelEditKey(int keyCode) /// Sorts the labels in order of their starting times. /// This function is called often (whilst dragging a label) -/// We expect them to be very nearly in order, so insertion -/// sort (with a linear search) is a reasonable choice. +/// We expect them to be very nearly in order, so insertion +/// sort (with a linear search) is a reasonable choice. void LabelTrack::SortLabels() { int i,j; LabelStruct * pTemp; - for (i = 1; i < (int)mLabels.Count(); i++) + for (i = 1; i < (int)mLabels.Count(); i++) { j=i-1; while( (j>=0) && (mLabels[j]->t > mLabels[i]->t) ) - { + { j--; } j++; diff --git a/src/LabelTrack.h b/src/LabelTrack.h index 239186a9c..bf34e9d5b 100644 --- a/src/LabelTrack.h +++ b/src/LabelTrack.h @@ -37,7 +37,7 @@ class DirManager; class TimeWarper; -class LabelStruct +class LabelStruct { public: LabelStruct(); @@ -50,7 +50,7 @@ public: double getDuration(){return t1-t;}; void AdjustEdge( int iEdge, double fNewTime); void MoveLabel( int iEdge, double fNewTime); - + /// Relationships between selection region and labels enum TimeRelations { @@ -68,13 +68,13 @@ public: /// it possible to delete capture all labels with a Select All). TimeRelations RegionRelation(double reg_t0, double reg_t1, LabelTrack *parent = NULL); - + public: double t; /// Time for left hand of label. double t1; /// Time for right hand of label. wxString title; /// Text of the label. int width; /// width of the text in pixels. - + // Working storage for on-screen layout. int x; /// Pixel position of left hand glyph int x1; /// Pixel position of right hand glyph @@ -82,7 +82,7 @@ public: int y; /// Pixel position of label. bool highlighted; /// if the text is highlighted - bool changeInitialMouseXPos; /// flag to change initial mouse X pos + bool changeInitialMouseXPos; /// flag to change initial mouse X pos bool updated; /// flag to tell if the label times were updated }; @@ -95,7 +95,7 @@ const int NUM_GLYPH_HIGHLIGHTS = 4; const int MAX_NUM_ROWS =80; -class AUDACITY_DLL_API LabelTrack : public Track +class AUDACITY_DLL_API LabelTrack : public Track { friend class LabelStruct; @@ -118,7 +118,7 @@ class AUDACITY_DLL_API LabelTrack : public Track int getSelectedIndex() const { return mSelIndex; } - virtual int GetKind() const { return Label; } + virtual int GetKind() const { return Label; } virtual double GetStartTime(); virtual double GetEndTime(); @@ -136,8 +136,8 @@ class AUDACITY_DLL_API LabelTrack : public Track virtual bool Cut (double t0, double t1, Track ** dest); // JKC Do not add the const modifier to Copy(), Clear() - // or Paste() because then it - // is no longer recognised as a virtual function matching the + // or Paste() because then it + // is no longer recognised as a virtual function matching the // one in Track. virtual bool Copy (double t0, double t1, Track ** dest);// const; virtual bool Clear(double t0, double t1); @@ -156,14 +156,14 @@ class AUDACITY_DLL_API LabelTrack : public Track bool CopySelectedText(); bool PasteSelectedText(double sel0, double sel1); static bool IsTextClipSupported(); - + // methods to set flags void SetDragXPos(const int d) { mDragXPos = d; }; void SetInBox(bool inTextBox) { mInBox = inTextBox; }; void SetResetCursorPos(bool resetFlag) { mResetCursorPos = resetFlag; }; void SetWrongDragging(bool rightFlag) { mRightDragging = rightFlag; }; void SetDrawCursor(bool drawCursorFlag) { mDrawCursor = drawCursorFlag; }; - + bool HandleMouse(const wxMouseEvent & evt, wxRect & r, double h, double pps, double *newSel0, double *newSel1); @@ -192,7 +192,7 @@ class AUDACITY_DLL_API LabelTrack : public Track //get current cursor position bool CalcCursorX(wxWindow * parent, int * x); int getCurrentCursorPosition() const { return mCurrentCursorPos; }; - + void MayAdjustLabel( int iLabel, int iEdge, bool bAllowSwapping, double fNewTime); void MayMoveLabel( int iLabel, int iEdge, double fNewTime); @@ -205,7 +205,7 @@ class AUDACITY_DLL_API LabelTrack : public Track void ScaleLabels(double b, double e, double change); double AdjustTimeStampOnScale(double t, double b, double e, double change); void WarpLabels(const TimeWarper &warper); - + // Returns tab-separated text of all labels completely within given region wxString GetTextOfLabels(double t0, double t1); @@ -215,7 +215,7 @@ class AUDACITY_DLL_API LabelTrack : public Track bool mbHitCenter; //The edge variable tells us what state the icon is in. //mOldEdge is useful for telling us when there has been a state change. - int mOldEdge; + int mOldEdge; private: int mSelIndex; /// Keeps track of the currently selected label @@ -234,16 +234,16 @@ class AUDACITY_DLL_API LabelTrack : public Track static int mFontHeight; int mXPos1; /// left X pos of highlighted area - int mXPos2; /// right X pos of highlighted area + int mXPos2; /// right X pos of highlighted area int mCurrentCursorPos; /// current cursor position int mInitialCursorPos; /// initial cursor position double mMouseXPos; /// mouse X pos int mDragXPos; /// end X pos of dragging bool mInBox; /// flag to tell if the mouse is in text box - bool mResetCursorPos; /// flag to reset cursor position(used in the dragging the glygh) + bool mResetCursorPos; /// flag to reset cursor position(used in the dragging the glygh) bool mRightDragging; /// flag to tell if it's a valid dragging bool mDrawCursor; /// flag to tell if drawing the cursor or not - + // Set in copied label tracks double mClipLen; diff --git a/src/LangChoice.cpp b/src/LangChoice.cpp index d305edda2..abf924e2e 100644 --- a/src/LangChoice.cpp +++ b/src/LangChoice.cpp @@ -35,19 +35,19 @@ public: LangChoiceDialog(wxWindow * parent, wxWindowID id, const wxString & title); - + wxString GetLang() { return mLang; } private: void OnOk(wxCommandEvent & event); - + wxChoice *mChoice; wxString mLang; int mNumLangs; wxArrayString mLangCodes; wxArrayString mLangNames; - + DECLARE_EVENT_TABLE() }; @@ -55,7 +55,7 @@ wxString ChooseLanguage(wxWindow *parent) { wxString returnVal; - /* i18n-hint: Title on a dialog indicating that this is the first + /* i18n-hint: Title on a dialog indicating that this is the first * time Audacity has been run. */ LangChoiceDialog dlog(parent, -1, _("Audacity First Run")); dlog.CentreOnParent(); @@ -121,10 +121,10 @@ void LangChoiceDialog::OnOk(wxCommandEvent & WXUNUSED(event)) else { sname = mLangNames[sndx]; } - + if (mLang.Left(2) != slang.Left(2)) { wxString msg; - /* i18n-hint: The %s's are replaced by translated and untranslated + /* i18n-hint: The %s's are replaced by translated and untranslated * versions of language names. */ msg.Printf(_("The language you have chosen, %s (%s), is not the same as the system language, %s (%s)."), mLangNames[ndx].c_str(), diff --git a/src/Languages.cpp b/src/Languages.cpp index 08622ba18..5fd7ca6f0 100644 --- a/src/Languages.cpp +++ b/src/Languages.cpp @@ -44,7 +44,7 @@ WX_DECLARE_STRING_HASH_MAP(wxString, LangHash); static bool TranslationExists(wxArrayString &audacityPathList, wxString code) { - wxArrayString results; + wxArrayString results; wxGetApp().FindFilesInPathList(wxString::Format(wxT("%s/audacity.mo"), code.c_str()), audacityPathList, @@ -60,7 +60,7 @@ static bool TranslationExists(wxArrayString &audacityPathList, wxString code) code.c_str()), audacityPathList, results); - + return (results.GetCount() > 0); } @@ -72,7 +72,7 @@ wxString GetSystemLanguageCode() GetLanguages(langCodes, langNames); int sysLang = wxLocale::GetSystemLanguage(); const wxLanguageInfo *info = wxLocale::GetLanguageInfo(sysLang); - + if (info) { wxString fullCode = info->CanonicalName; if (fullCode.Length() < 2) diff --git a/src/Legacy.cpp b/src/Legacy.cpp index 79581410b..0e359218a 100644 --- a/src/Legacy.cpp +++ b/src/Legacy.cpp @@ -9,7 +9,7 @@ *******************************************************************//*! \file Legacy.cpp -\brief Converts old Audacity file types. Implements +\brief Converts old Audacity file types. Implements AutoRollbackRenamer. These routines convert Audacity project files from the @@ -186,7 +186,7 @@ static bool ConvertLegacyTrack(wxTextFile *f, XMLFileWriter &xmlFile) start = f->GetNextLine(); if (f->GetNextLine() != wxT("Block len")) return false; - len = f->GetNextLine(); + len = f->GetNextLine(); if (f->GetNextLine() != wxT("Block info")) return false; name = f->GetNextLine(); @@ -225,7 +225,7 @@ static bool ConvertLegacyTrack(wxTextFile *f, XMLFileWriter &xmlFile) xmlFile.EndTag(wxT("sequence")); xmlFile.EndTag(wxT("wavetrack")); - + return true; } else if (kind == wxT("LabelTrack")) { @@ -298,7 +298,7 @@ bool ConvertLegacyProjectFile(wxFileName filename) wxT("_bak") + wxString::Format(wxT("%d"), index) + wxT(".") + filename.GetExt(); } while(::wxFileExists(backupName)); - // This will move the original file out of the way, but + // This will move the original file out of the way, but // move it back if we exit from this function early. AutoRollbackRenamer renamer(filename.GetFullPath(), backupName); if (!renamer.RenameSucceeded()) diff --git a/src/LoadModules.cpp b/src/LoadModules.cpp index de7b415d5..3d2679cbd 100644 --- a/src/LoadModules.cpp +++ b/src/LoadModules.cpp @@ -11,7 +11,7 @@ *******************************************************************//*! \file LoadModules.cpp -\brief Based on LoadLadspa, this code loads pluggable Audacity +\brief Based on LoadLadspa, this code loads pluggable Audacity extension modules. It also has the code to (a) invoke a script server and (b) invoke a function returning a replacement window, i.e. an alternative to the usual interface, for Audacity. @@ -49,7 +49,7 @@ typedef int (*tModuleInit)(int); typedef wxChar * (*tVersionFn)(); typedef pwxWindow (*tPanelFn)(int); -// This variable will hold the address of a subroutine in +// This variable will hold the address of a subroutine in // a DLL that can hijack the normal panel. static tPanelFn pPanelHijack=NULL; @@ -57,7 +57,7 @@ static tPanelFn pPanelHijack=NULL; // strange DLL behaviour. Instead of dynamic linking, // link the library which has the replacement panel statically. // Give the address of the routine here. -// This is a great help in identifying missing +// This is a great help in identifying missing // symbols which otherwise cause a dll to unload after loading // without an explanation as to why! //extern wxWindow * MainPanelFunc( int i ); @@ -222,7 +222,7 @@ void ModuleManager::Initialize(CommandHandler &cmdHandler) } #if defined(__WXMSW__) - wxGetApp().FindFilesInPathList(wxT("*.dll"), pathList, files); + wxGetApp().FindFilesInPathList(wxT("*.dll"), pathList, files); #else wxGetApp().FindFilesInPathList(wxT("*.so"), pathList, files); #endif diff --git a/src/Lyrics.cpp b/src/Lyrics.cpp index e858becfc..5370f4107 100644 --- a/src/Lyrics.cpp +++ b/src/Lyrics.cpp @@ -6,7 +6,7 @@ Dominic Mazzoni Vaughan Johnson - + **********************************************************************/ #include @@ -23,19 +23,19 @@ WX_DEFINE_OBJARRAY(SyllableArray); -BEGIN_EVENT_TABLE(HighlightTextCtrl, wxTextCtrl) +BEGIN_EVENT_TABLE(HighlightTextCtrl, wxTextCtrl) EVT_MOUSE_EVENTS(HighlightTextCtrl::OnMouseEvent) END_EVENT_TABLE() -HighlightTextCtrl::HighlightTextCtrl(Lyrics* parent, - wxWindowID id, - const wxString& value /*= ""*/, - const wxPoint& pos /*= wxDefaultPosition*/, +HighlightTextCtrl::HighlightTextCtrl(Lyrics* parent, + wxWindowID id, + const wxString& value /*= ""*/, + const wxPoint& pos /*= wxDefaultPosition*/, const wxSize& size /*= wxDefaultSize*/) -: wxTextCtrl(parent, id, // wxWindow* parent, wxWindowID id, - value, // const wxString& value = "", - pos, // const wxPoint& pos = wxDefaultPosition, - size, // const wxSize& size = wxDefaultSize, +: wxTextCtrl(parent, id, // wxWindow* parent, wxWindowID id, + value, // const wxString& value = "", + pos, // const wxPoint& pos = wxDefaultPosition, + size, // const wxSize& size = wxDefaultSize, wxTE_MULTILINE | wxTE_READONLY | wxTE_RICH | wxTE_RICH2 | wxTE_AUTO_URL | wxTE_NOHIDESEL), //v | wxHSCROLL) mLyrics(parent) { @@ -43,7 +43,7 @@ HighlightTextCtrl::HighlightTextCtrl(Lyrics* parent, void HighlightTextCtrl::OnMouseEvent(wxMouseEvent& event) { - if (event.ButtonUp()) + if (event.ButtonUp()) { long from, to; this->GetSelection(&from, &to); @@ -56,8 +56,8 @@ void HighlightTextCtrl::OnMouseEvent(wxMouseEvent& event) AudacityProject* pProj = GetActiveProject(); pProj->SetSel0(pCurSyl->t); - //v Should probably select to end as in AudacityProject::OnSelectCursorEnd, - // but better to generalize that in AudacityProject methods. + //v Should probably select to end as in AudacityProject::OnSelectCursorEnd, + // but better to generalize that in AudacityProject methods. pProj->mViewInfo.sel1 = pCurSyl->t; } } @@ -68,7 +68,7 @@ void HighlightTextCtrl::OnMouseEvent(wxMouseEvent& event) //v static const kHighlightTextCtrlID = 7654; -BEGIN_EVENT_TABLE(Lyrics, wxPanel) +BEGIN_EVENT_TABLE(Lyrics, wxPanel) EVT_CHAR(Lyrics::OnKeyEvent) EVT_PAINT(Lyrics::OnPaint) EVT_SIZE(Lyrics::OnSize) @@ -77,12 +77,12 @@ BEGIN_EVENT_TABLE(Lyrics, wxPanel) // EVT_COMMAND_LEFT_CLICK(kHighlightTextCtrlID, Lyrics::OnHighlightTextCtrl) END_EVENT_TABLE() -IMPLEMENT_CLASS(Lyrics, wxPanel) +IMPLEMENT_CLASS(Lyrics, wxPanel) Lyrics::Lyrics(wxWindow* parent, wxWindowID id, const wxPoint& pos /*= wxDefaultPosition*/, const wxSize& size /*= wxDefaultSize*/): - wxPanel(parent, id, pos, size), + wxPanel(parent, id, pos, size), mWidth(size.x), mHeight(size.y) { mKaraokeHeight = mHeight; @@ -91,10 +91,10 @@ Lyrics::Lyrics(wxWindow* parent, wxWindowID id, this->SetBackgroundColour(*wxWHITE); - mHighlightTextCtrl = - new HighlightTextCtrl(this, -1, // wxWindow* parent, wxWindowID id, - wxT(""), // const wxString& value = wxT(""), - wxPoint(0, 0), // const wxPoint& pos = wxDefaultPosition, + mHighlightTextCtrl = + new HighlightTextCtrl(this, -1, // wxWindow* parent, wxWindowID id, + wxT(""), // const wxString& value = wxT(""), + wxPoint(0, 0), // const wxPoint& pos = wxDefaultPosition, size); // const wxSize& size = wxDefaultSize this->SetHighlightFont(); mHighlightTextCtrl->Show(mLyricsStyle == kHighlightLyrics); // test, in case we conditionalize the default, above @@ -153,11 +153,11 @@ void Lyrics::Add(double t, wxString syllable) // Put a space between syllables unless the previous one // ended in a hyphen - if (i > 0 && + if (i > 0 && // mSyllables[i-1].text.Length() > 0 && - mSyllables[i-1].text.Right(1) != wxT("-")) + mSyllables[i-1].text.Right(1) != wxT("-")) mSyllables[i].textWithSpace = wxT(" ") + syllable; - else + else mSyllables[i].textWithSpace = syllable; mText += mSyllables[i].textWithSpace; @@ -166,7 +166,7 @@ void Lyrics::Add(double t, wxString syllable) int nTextLen = mSyllables[i].textWithSpace.Length(); if ((nTextLen > 0) && (mSyllables[i].textWithSpace.Right(1) == wxT("_"))) mHighlightTextCtrl->AppendText(mSyllables[i].textWithSpace.Left(nTextLen - 1) + wxT("\n")); - else + else mHighlightTextCtrl->AppendText(mSyllables[i].textWithSpace); } @@ -236,8 +236,8 @@ void Lyrics::SetDrawnFont(wxDC *dc) void Lyrics::SetHighlightFont() // for kHighlightLyrics { wxFont newFont(mKaraokeFontSize, wxSWISS, wxNORMAL, wxNORMAL); - mHighlightTextCtrl->SetDefaultStyle(wxTextAttr(wxNullColour, wxNullColour, newFont)); - mHighlightTextCtrl->SetStyle(0, mHighlightTextCtrl->GetLastPosition(), + mHighlightTextCtrl->SetDefaultStyle(wxTextAttr(wxNullColour, wxNullColour, newFont)); + mHighlightTextCtrl->SetStyle(0, mHighlightTextCtrl->GetLastPosition(), wxTextAttr(wxNullColour, wxNullColour, newFont)); } @@ -247,7 +247,7 @@ void Lyrics::Measure(wxDC *dc) // only for drawn text int width = 0, height = 0; const int kIndent = 4; - int x = 2*kIndent; + int x = 2*kIndent; unsigned int i; for(i=0; iGetStreamTime(), which is -1000000000 if !IsStreamActive(). - // In that case, use the selection start time. + // In that case, use the selection start time. AudacityProject* pProj = GetActiveProject(); mT = pProj->GetSel0(); } @@ -422,16 +422,16 @@ void Lyrics::Update(double t) if (i == mCurrentSyllable) return; - mCurrentSyllable = i; + mCurrentSyllable = i; if (mLyricsStyle == kHighlightLyrics) { mHighlightTextCtrl->SetSelection(mSyllables[i].char0, mSyllables[i].char1); - + //v No trail for now. //// Leave a trail behind the selection, by highlighting. - //if (i == I_FIRST_REAL_SYLLABLE) - // // Reset the trail to zero. + //if (i == I_FIRST_REAL_SYLLABLE) + // // Reset the trail to zero. // mHighlightTextCtrl->SetStyle(0, mHighlightTextCtrl->GetLastPosition(), wxTextAttr(wxNullColour, *wxWHITE)); //// Mark the trail for mSyllables[i]. //mHighlightTextCtrl->SetStyle(mSyllables[i].char0, mSyllables[i].char1, wxTextAttr(wxNullColour, *wxLIGHT_GREY)); @@ -450,7 +450,7 @@ void Lyrics::OnPaint(wxPaintEvent & WXUNUSED(event)) if (!this->GetParent()->IsShown()) return; - if (mLyricsStyle == kBouncingBallLyrics) + if (mLyricsStyle == kBouncingBallLyrics) { wxPaintDC dc(this); @@ -482,9 +482,9 @@ void Lyrics::OnSize(wxSizeEvent & WXUNUSED(event)) mKaraokeHeight = mHeight; - mKaraokeFontSize = + mKaraokeFontSize = (int)((float)(this->GetDefaultFontSize() * mHeight) / (float)LYRICS_DEFAULT_HEIGHT); - // Usually don't get the size window we want, usually less than + // Usually don't get the size window we want, usually less than // LYRICS_DEFAULT_HEIGHT, so bump it a little. mKaraokeFontSize += 2; @@ -518,7 +518,7 @@ void Lyrics::HandlePaint(wxDC &dc) dc.SetBrush(*wxWHITE_BRUSH); dc.DrawRectangle(0, 0, mWidth, mKaraokeHeight); - this->HandlePaint_BouncingBall(dc); + this->HandlePaint_BouncingBall(dc); } void Lyrics::HandlePaint_BouncingBall(wxDC &dc) @@ -527,7 +527,7 @@ void Lyrics::HandlePaint_BouncingBall(wxDC &dc) int x; double y; GetKaraokePosition(mT, &x, &y); - + dc.SetTextForeground(wxColour(238, 0, 102)); bool changedColor = false; diff --git a/src/Lyrics.h b/src/Lyrics.h index a6cab1d55..225123cce 100644 --- a/src/Lyrics.h +++ b/src/Lyrics.h @@ -6,7 +6,7 @@ Dominic Mazzoni Vaughan Johnson - + **********************************************************************/ #ifndef __AUDACITY_LYRICS__ @@ -16,7 +16,7 @@ #include #include -#include +#include #define LYRICS_DEFAULT_WIDTH 608 @@ -41,10 +41,10 @@ class Lyrics; class HighlightTextCtrl : public wxTextCtrl { public: - HighlightTextCtrl(Lyrics* parent, - wxWindowID id, - const wxString& value = wxT(""), - const wxPoint& pos = wxDefaultPosition, + HighlightTextCtrl(Lyrics* parent, + wxWindowID id, + const wxString& value = wxT(""), + const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize); virtual ~HighlightTextCtrl() {}; @@ -56,7 +56,7 @@ private: DECLARE_EVENT_TABLE() }; -class Lyrics : public wxPanel +class Lyrics : public wxPanel { DECLARE_DYNAMIC_CLASS(Lyrics) @@ -95,7 +95,7 @@ class Lyrics : public wxPanel // Doesn't seem to be a way to capture a selection event in a read-only wxTextCtrl. // Thus the HighlightTextCtrl class. - // void OnHighlightTextCtrl(wxCommandEvent & event); + // void OnHighlightTextCtrl(wxCommandEvent & event); void HandlePaint(wxDC &dc); void HandlePaint_BouncingBall(wxDC &dc); @@ -104,7 +104,7 @@ class Lyrics : public wxPanel private: unsigned int GetDefaultFontSize() const; // Depends on mLyricsStyle. Call only after mLyricsStyle is set. - + void SetDrawnFont(wxDC *dc); // for kBouncingBallLyrics void SetHighlightFont(); // for kHighlightLyrics @@ -126,7 +126,7 @@ private: int mCurrentSyllable; SyllableArray mSyllables; - wxString mText; + wxString mText; int mTextHeight; // only for drawn text bool mMeasurementsDone; // only for drawn text diff --git a/src/LyricsWindow.cpp b/src/LyricsWindow.cpp index 02a13f912..e794e5b3a 100644 --- a/src/LyricsWindow.cpp +++ b/src/LyricsWindow.cpp @@ -43,24 +43,24 @@ END_EVENT_TABLE() const wxSize gSize = wxSize(LYRICS_DEFAULT_WIDTH, LYRICS_DEFAULT_HEIGHT); LyricsWindow::LyricsWindow(AudacityProject *parent): - wxFrame(parent, -1, - wxString::Format(_("Audacity Karaoke%s"), - ((parent->GetName() == wxEmptyString) ? + wxFrame(parent, -1, + wxString::Format(_("Audacity Karaoke%s"), + ((parent->GetName() == wxEmptyString) ? wxT("") : wxString::Format( wxT(" - %s"), parent->GetName().c_str()).c_str())), - wxPoint(100, 300), gSize, + wxPoint(100, 300), gSize, //v Bug in wxFRAME_FLOAT_ON_PARENT: - // If both the project frame and LyricsWindow are minimized and you restore LyricsWindow, - // you can't restore project frame until you close LyricsWindow, but then project frame and + // If both the project frame and LyricsWindow are minimized and you restore LyricsWindow, + // you can't restore project frame until you close LyricsWindow, but then project frame and // LyricsWindow are restored but LyricsWindow is unresponsive because it thinks it's not shown. // wxDEFAULT_FRAME_STYLE | wxFRAME_FLOAT_ON_PARENT) wxDEFAULT_FRAME_STYLE) { //vvv Still necessary? It's commented out in ToolManager and Meter, so I did so here. // #ifdef __WXMAC__ - // // WXMAC doesn't support wxFRAME_FLOAT_ON_PARENT, so we do + // // WXMAC doesn't support wxFRAME_FLOAT_ON_PARENT, so we do // SetWindowClass((WindowRef) MacGetWindowRef(), kFloatingWindowClass); // #endif mProject = parent; @@ -79,15 +79,15 @@ LyricsWindow::LyricsWindow(AudacityProject *parent): wxSize panelSize = gSize; //vvv not yet working right in ported version, so choice is disabled. - // It seems when you select highlight style, the TrackPanel timer stops working, but + // It seems when you select highlight style, the TrackPanel timer stops working, but // going back to bouncing ball style starts it up again (!!!), per breakpoints in TrackPanel::OnTimer(). // //wxToolBar* pToolBar = this->CreateToolBar(); //const int kHorizMargin = 8; - //wxRadioButton* pRadioButton_BouncingBall = + //wxRadioButton* pRadioButton_BouncingBall = // new wxRadioButton(pToolBar, kID_RadioButton_BouncingBall, _("Bouncing Ball"), wxPoint(kHorizMargin, 4), // wxDefaultSize, wxRB_GROUP); - //// Reposition to center vertically. + //// Reposition to center vertically. //wxSize tbSize = pToolBar->GetSize(); //wxSize btnSize = pRadioButton_BouncingBall->GetSize(); //int top = (tbSize.GetHeight() - btnSize.GetHeight()) / 2; @@ -95,7 +95,7 @@ LyricsWindow::LyricsWindow(AudacityProject *parent): //pToolBar->AddControl(pRadioButton_BouncingBall); // //int left = kHorizMargin + btnSize.GetWidth() + kHorizMargin; //vvv Doesn't actually work. Probably need sizers. - //wxRadioButton* pRadioButton_Highlight = + //wxRadioButton* pRadioButton_Highlight = // new wxRadioButton(pToolBar, kID_RadioButton_Highlight, _("Highlight"), wxPoint(left, top)); //pToolBar->AddControl(pRadioButton_Highlight); // @@ -113,7 +113,7 @@ LyricsWindow::LyricsWindow(AudacityProject *parent): mLyricsPanel = new Lyrics(this, -1, panelPos, panelSize); //vvv Highlight style is broken in ported version. - //switch (mLyricsPanel->GetLyricsStyle()) + //switch (mLyricsPanel->GetLyricsStyle()) //{ // case Lyrics::kBouncingBallLyrics: // pRadioButton_BouncingBall->SetValue(true); break; diff --git a/src/MacroMagic.h b/src/MacroMagic.h index 7a002111d..5e1edacb4 100644 --- a/src/MacroMagic.h +++ b/src/MacroMagic.h @@ -13,7 +13,7 @@ \file MacroMagic.h -This file allows the same macros to do multiple duty by undefining +This file allows the same macros to do multiple duty by undefining and redefining the macros. For example DEFINE_IMAGE will generate: diff --git a/src/Makefile.in b/src/Makefile.in index 19ff47929..db8c22246 100644 --- a/src/Makefile.in +++ b/src/Makefile.in @@ -266,7 +266,7 @@ libaudacity_la_OBJECTS = $(am_libaudacity_la_OBJECTS) AM_V_lt = $(am__v_lt_@AM_V@) am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@) am__v_lt_0 = --silent -am__v_lt_1 = +am__v_lt_1 = am__installdirs = "$(DESTDIR)$(bindir)" "$(DESTDIR)$(desktopdir)" \ "$(DESTDIR)$(mimedir)" PROGRAMS = $(bin_PROGRAMS) @@ -746,11 +746,11 @@ am__v_P_1 = : AM_V_GEN = $(am__v_GEN_@AM_V@) am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) am__v_GEN_0 = @echo " GEN " $@; -am__v_GEN_1 = +am__v_GEN_1 = AM_V_at = $(am__v_at_@AM_V@) am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) am__v_at_0 = @ -am__v_at_1 = +am__v_at_1 = DEFAULT_INCLUDES = -I.@am__isrc@ depcomp = $(SHELL) $(top_srcdir)/autotools/depcomp am__depfiles_maybe = depfiles @@ -764,7 +764,7 @@ LTCXXCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) \ AM_V_CXX = $(am__v_CXX_@AM_V@) am__v_CXX_ = $(am__v_CXX_@AM_DEFAULT_V@) am__v_CXX_0 = @echo " CXX " $@; -am__v_CXX_1 = +am__v_CXX_1 = CXXLD = $(CXX) CXXLINK = $(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(CXXLD) $(AM_CXXFLAGS) \ @@ -772,7 +772,7 @@ CXXLINK = $(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) \ AM_V_CXXLD = $(am__v_CXXLD_@AM_V@) am__v_CXXLD_ = $(am__v_CXXLD_@AM_DEFAULT_V@) am__v_CXXLD_0 = @echo " CXXLD " $@; -am__v_CXXLD_1 = +am__v_CXXLD_1 = COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ @@ -782,7 +782,7 @@ LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ AM_V_CC = $(am__v_CC_@AM_V@) am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@) am__v_CC_0 = @echo " CC " $@; -am__v_CC_1 = +am__v_CC_1 = CCLD = $(CC) LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ @@ -790,7 +790,7 @@ LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ AM_V_CCLD = $(am__v_CCLD_@AM_V@) am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@) am__v_CCLD_0 = @echo " CCLD " $@; -am__v_CCLD_1 = +am__v_CCLD_1 = SOURCES = $(libaudacity_la_SOURCES) $(audacity_SOURCES) DIST_SOURCES = $(libaudacity_la_SOURCES) $(am__audacity_SOURCES_DIST) am__can_run_installinfo = \ @@ -1365,7 +1365,7 @@ configwin.h: stamp-h1 stamp-h1: $(srcdir)/configtemplate.h $(top_builddir)/config.status @rm -f stamp-h1 cd $(top_builddir) && $(SHELL) ./config.status src/configwin.h -$(srcdir)/configtemplate.h: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) +$(srcdir)/configtemplate.h: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) ($(am__cd) $(top_srcdir) && $(AUTOHEADER)) rm -f stamp-h1 touch $@ @@ -1422,7 +1422,7 @@ xml/$(DEPDIR)/$(am__dirstamp): xml/libaudacity_la-XMLTagHandler.lo: xml/$(am__dirstamp) \ xml/$(DEPDIR)/$(am__dirstamp) -libaudacity.la: $(libaudacity_la_OBJECTS) $(libaudacity_la_DEPENDENCIES) $(EXTRA_libaudacity_la_DEPENDENCIES) +libaudacity.la: $(libaudacity_la_OBJECTS) $(libaudacity_la_DEPENDENCIES) $(EXTRA_libaudacity_la_DEPENDENCIES) $(AM_V_CXXLD)$(CXXLINK) $(libaudacity_la_OBJECTS) $(libaudacity_la_LIBADD) $(LIBS) install-binPROGRAMS: $(bin_PROGRAMS) @$(NORMAL_INSTALL) @@ -1915,7 +1915,7 @@ effects/VST/$(DEPDIR)/$(am__dirstamp): effects/VST/audacity-VSTEffect.$(OBJEXT): effects/VST/$(am__dirstamp) \ effects/VST/$(DEPDIR)/$(am__dirstamp) -audacity$(EXEEXT): $(audacity_OBJECTS) $(audacity_DEPENDENCIES) $(EXTRA_audacity_DEPENDENCIES) +audacity$(EXEEXT): $(audacity_OBJECTS) $(audacity_DEPENDENCIES) $(EXTRA_audacity_DEPENDENCIES) @rm -f audacity$(EXEEXT) $(AM_V_CXXLD)$(audacity_LINK) $(audacity_OBJECTS) $(audacity_LDADD) $(LIBS) diff --git a/src/Matrix.cpp b/src/Matrix.cpp index 8d60e6da5..c014ad9dd 100644 --- a/src/Matrix.cpp +++ b/src/Matrix.cpp @@ -218,7 +218,7 @@ Vector VectorConcatenate(const Vector& left, const Vector& right) Vector v(left.Len() + right.Len()); int i; for(i=0; iAddItem(wxT("Print"), _("&Print..."), FN(OnPrint), AudioIONotBusyFlag | TracksExistFlag, AudioIONotBusyFlag | TracksExistFlag); - + c->AddSeparator(); // On the Mac, the Exit item doesn't actually go here...wxMac will pull it out @@ -335,7 +335,7 @@ void AudacityProject::CreateMenusAndCommands() c->AddItem(wxT("Redo"), _("&Redo"), FN(OnRedo), key, AudioIONotBusyFlag | RedoAvailableFlag, AudioIONotBusyFlag | RedoAvailableFlag); - + ModifyUndoMenuItems(); c->AddSeparator(); @@ -482,7 +482,7 @@ void AudacityProject::CreateMenusAndCommands() c->AddItem(wxT("CursSelStart"), _("to Selection Star&t"), FN(OnCursorSelStart)); c->AddItem(wxT("CursSelEnd"), _("to Selection En&d"), FN(OnCursorSelEnd)); - + c->AddItem(wxT("CursTrackStart"), _("to Track &Start"), FN(OnCursorTrackStart), wxT("J")); c->AddItem(wxT("CursTrackEnd"), _("to Track &End"), FN(OnCursorTrackEnd), wxT("K")); @@ -496,7 +496,7 @@ void AudacityProject::CreateMenusAndCommands() WaveTracksSelectedFlag, WaveTracksSelectedFlag); c->AddItem(wxT("SelRestore"), _("Regio&n Restore"), FN(OnSelectionRestore), - TracksExistFlag, + TracksExistFlag, TracksExistFlag); c->AddSeparator(); @@ -568,26 +568,26 @@ void AudacityProject::CreateMenusAndCommands() c->AddSeparator(); - // History window should be available either for UndoAvailableFlag or RedoAvailableFlag, - // but we can't make the AddItem flags and mask have both, because they'd both have to be true for the - // command to be enabled. + // History window should be available either for UndoAvailableFlag or RedoAvailableFlag, + // but we can't make the AddItem flags and mask have both, because they'd both have to be true for the + // command to be enabled. // If user has Undone the entire stack, RedoAvailableFlag is on but UndoAvailableFlag is off. // If user has done things but not Undone anything, RedoAvailableFlag is off but UndoAvailableFlag is on. - // So in either of those cases, (AudioIONotBusyFlag | UndoAvailableFlag | RedoAvailableFlag) mask - // would fail. + // So in either of those cases, (AudioIONotBusyFlag | UndoAvailableFlag | RedoAvailableFlag) mask + // would fail. // The only way to fix this in the current architecture is to hack in special cases for RedoAvailableFlag - // in AudacityProject::UpdateMenus() (ugly) and CommandManager::HandleCommandEntry() (*really* ugly -- + // in AudacityProject::UpdateMenus() (ugly) and CommandManager::HandleCommandEntry() (*really* ugly -- // shouldn't know about particular command names and flags). // Here's the hack that would be necessary in AudacityProject::UpdateMenus(), if somebody decides to do it: - // // Because EnableUsingFlags requires all the flag bits match the corresponding mask bits, - // // "UndoHistory" specifies only AudioIONotBusyFlag | UndoAvailableFlag, because that + // // Because EnableUsingFlags requires all the flag bits match the corresponding mask bits, + // // "UndoHistory" specifies only AudioIONotBusyFlag | UndoAvailableFlag, because that // // covers the majority of cases where it should be enabled. - // // If history is not empty but we've Undone the whole stack, we also want to enable, + // // If history is not empty but we've Undone the whole stack, we also want to enable, // // to show the Redo's on stack. // // "UndoHistory" might already be enabled, but add this check for RedoAvailableFlag. // if (flags & RedoAvailableFlag) // mCommandManager.Enable(wxT("UndoHistory"), true); - // So for now, enable the command regardless of stack. It will just show empty sometimes. + // So for now, enable the command regardless of stack. It will just show empty sometimes. // FOR REDESIGN, clearly there are some limitations with the flags/mask bitmaps. /* i18n-hint: Clicking this menu item shows the various editing steps that have been taken.*/ @@ -595,7 +595,7 @@ void AudacityProject::CreateMenusAndCommands() AudioIONotBusyFlag, AudioIONotBusyFlag); - c->AddItem(wxT("Karaoke"), _("&Karaoke..."), FN(OnKaraoke), LabelTracksExistFlag, LabelTracksExistFlag); + c->AddItem(wxT("Karaoke"), _("&Karaoke..."), FN(OnKaraoke), LabelTracksExistFlag, LabelTracksExistFlag); c->AddItem(wxT("MixerBoard"), _("&Mixer Board..."), FN(OnMixerBoard), WaveTracksExistFlag, WaveTracksExistFlag); c->AddSeparator(); @@ -631,9 +631,9 @@ void AudacityProject::CreateMenusAndCommands() ///////////////////////////////////////////////////////////////////////////// /* i18n-hint: Usually keep the ! at the start. It means this option is hidden. - * Simplified View toggles the showing and hiding of 'hidden' menu items that start - * with !. If your translation file is for a special use, that is if it is for a - * simplified view with hidden menu items, then leave the ! out here, so that the + * Simplified View toggles the showing and hiding of 'hidden' menu items that start + * with !. If your translation file is for a special use, that is if it is for a + * simplified view with hidden menu items, then leave the ! out here, so that the * user can show/hide some of the menu items. */ c->AddCheck(wxT("SimplifiedView"), _("!Simplified View"), FN(OnSimplifiedView), mCommandManager.mbHideFlaggedItems ? 1 : 0, AlwaysEnabledFlag, AlwaysEnabledFlag); @@ -696,7 +696,7 @@ void AudacityProject::CreateMenusAndCommands() c->BeginMenu(_("&Tracks")); c->SetDefaultFlags(AudioIONotBusyFlag, AudioIONotBusyFlag); - + ////////////////////////////////////////////////////////////////////////// c->BeginSubMenu(_("Add &New")); @@ -741,7 +741,7 @@ void AudacityProject::CreateMenusAndCommands() wxArrayString alignLabelsNoSync; alignLabelsNoSync.Add(_("&Align End to End")); alignLabelsNoSync.Add(_("Align &Together")); - + wxArrayString alignLabels; alignLabels.Add(_("Start to &Zero")); alignLabels.Add(_("Start to &Cursor/Selection Start")); @@ -750,8 +750,8 @@ void AudacityProject::CreateMenusAndCommands() alignLabels.Add(_("End to Selection En&d")); mAlignLabelsCount = alignLabels.GetCount(); - // Calling c->SetCommandFlags() after AddItemList for "Align" and "AlignMove" - // does not correctly set flags for submenus, so do it this way. + // Calling c->SetCommandFlags() after AddItemList for "Align" and "AlignMove" + // does not correctly set flags for submenus, so do it this way. c->SetDefaultFlags(AudioIONotBusyFlag | TracksSelectedFlag, AudioIONotBusyFlag | TracksSelectedFlag); @@ -796,17 +796,17 @@ void AudacityProject::CreateMenusAndCommands() c->AddItem(wxT("AddLabel"), _("Add Label At &Selection"), FN(OnAddLabel), wxT("Ctrl+B"), AlwaysEnabledFlag, AlwaysEnabledFlag); - c->AddItem(wxT("AddLabelPlaying"), _("Add Label At &Playback Position"), - FN(OnAddLabelPlaying), -#ifdef __WXMAC__ - wxT("Ctrl+."), + c->AddItem(wxT("AddLabelPlaying"), _("Add Label At &Playback Position"), + FN(OnAddLabelPlaying), +#ifdef __WXMAC__ + wxT("Ctrl+."), #else - wxT("Ctrl+M"), + wxT("Ctrl+M"), #endif 0, AudioIONotBusyFlag); c->AddItem(wxT("EditLabels"), _("&Edit Labels..."), FN(OnEditLabels)); - c->AddSeparator(); + c->AddSeparator(); ////////////////////////////////////////////////////////////////////////// @@ -843,7 +843,7 @@ void AudacityProject::CreateMenusAndCommands() c->AddItemList(wxT("Generate"), names, FN(OnGenerateEffect)); } delete effects; - + effects = em.GetEffects(INSERT_EFFECT | PLUGIN_EFFECT); if (effects->GetCount()) { c->AddSeparator(); @@ -860,17 +860,17 @@ void AudacityProject::CreateMenusAndCommands() int flags; flags = INSERT_EFFECT | BUILTIN_EFFECT | PLUGIN_EFFECT; - EffectCategory* ac = + EffectCategory* ac = em.LookupCategory(wxT("http://lv2plug.in/ns/lv2core#GeneratorPlugin")); CategorySet roots = ac->GetSubCategories(); EffectSet generators = ac->GetEffects(); EffectSet topLevel = CreateEffectSubmenus(c, roots, flags, 0); - std::copy(generators.begin(), generators.end(), + std::copy(generators.begin(), generators.end(), std::insert_iterator(topLevel, topLevel.begin())); AddEffectsToMenu(c, topLevel); - + // Add all uncategorised effects in a special submenu - EffectSet unsorted = + EffectSet unsorted = em.GetUnsortedEffects(flags); if (unsorted.size() > 0) { c->AddSeparator(); @@ -882,7 +882,7 @@ void AudacityProject::CreateMenusAndCommands() names.Add((*iter)->GetEffectName()); indices.Add((*iter)->GetID()); } - c->AddItemList(wxT("Generate"), names, + c->AddItemList(wxT("Generate"), names, FNI(OnProcessAny, indices), true); c->EndSubMenu(); } @@ -903,7 +903,7 @@ void AudacityProject::CreateMenusAndCommands() if (mLastEffectType != 0) { buildMenuLabel.Printf(_("Repeat %s"), mLastEffect->GetEffectName().c_str()); } - else + else buildMenuLabel.Printf(_("Repeat Last Effect")); c->AddItem(wxT("RepeatLastEffect"), buildMenuLabel, FN(OnRepeatLastEffect), wxT("Ctrl+R"), @@ -949,9 +949,9 @@ void AudacityProject::CreateMenusAndCommands() CategorySet roots = em.GetRootCategories(); EffectSet topLevel = CreateEffectSubmenus(c, roots, flags, 0); AddEffectsToMenu(c, topLevel); - + // Add all uncategorised effects in a special submenu - EffectSet unsorted = + EffectSet unsorted = em.GetUnsortedEffects(flags); if (unsorted.size() > 0) { c->AddSeparator(); @@ -967,7 +967,7 @@ void AudacityProject::CreateMenusAndCommands() c->EndSubMenu(); } c->EndMenu(); - + #endif ////////////////////////////////////////////////////////////////////////// @@ -982,7 +982,7 @@ void AudacityProject::CreateMenusAndCommands() c->AddItem(wxT("PlotSpectrum"), _("Plot Spectrum..."), FN(OnPlotSpectrum), AudioIONotBusyFlag | WaveTracksSelectedFlag | TimeSelectedFlag, AudioIONotBusyFlag | WaveTracksSelectedFlag | TimeSelectedFlag); - + #ifndef EFFECT_CATEGORIES effects = em.GetEffects(ANALYZE_EFFECT | BUILTIN_EFFECT); @@ -994,7 +994,7 @@ void AudacityProject::CreateMenusAndCommands() c->AddItemList(wxT("Analyze"), names, FN(OnAnalyzeEffect)); } delete effects; - + effects = em.GetEffects(ANALYZE_EFFECT | PLUGIN_EFFECT); if (effects->GetCount()) { c->AddSeparator(); @@ -1007,19 +1007,19 @@ void AudacityProject::CreateMenusAndCommands() delete effects; #else - + flags = ANALYZE_EFFECT | BUILTIN_EFFECT | PLUGIN_EFFECT; - EffectCategory* ac = + EffectCategory* ac = em.LookupCategory(wxT("http://lv2plug.in/ns/lv2core#AnalyserPlugin")); CategorySet roots = ac->GetSubCategories(); EffectSet analyzers = ac->GetEffects(); EffectSet topLevel = CreateEffectSubmenus(c, roots, flags, 0); - std::copy(analyzers.begin(), analyzers.end(), + std::copy(analyzers.begin(), analyzers.end(), std::insert_iterator(topLevel, topLevel.begin())); AddEffectsToMenu(c, topLevel); - + // Add all uncategorised effects in a special submenu - EffectSet unsorted = + EffectSet unsorted = em.GetUnsortedEffects(flags); if (unsorted.size() > 0) { c->AddSeparator(); @@ -1031,7 +1031,7 @@ void AudacityProject::CreateMenusAndCommands() names.Add((*iter)->GetEffectName()); indices.Add((*iter)->GetID()); } - c->AddItemList(wxT("Analyze"), names, + c->AddItemList(wxT("Analyze"), names, FNI(OnProcessAny, indices), true); c->EndSubMenu(); } @@ -1056,19 +1056,19 @@ void AudacityProject::CreateMenusAndCommands() c->AddItem(wxT("QuickHelp"), _("&Quick Help (in web browser)"), FN(OnQuickHelp)); c->AddItem(wxT("Manual"), _("&Manual (in web browser)"), FN(OnManual)); - c->AddSeparator(); + c->AddSeparator(); c->AddItem(wxT("Screenshot"), _("&Screenshot Tools..."), FN(OnScreenshot)); #if IS_ALPHA - // TODO: What should we do here? Make benchmark a plug-in? + // TODO: What should we do here? Make benchmark a plug-in? // Easy enough to do. We'd call it mod-self-test. - c->AddSeparator(); + c->AddSeparator(); c->AddItem(wxT("Benchmark"), _("&Run Benchmark..."), FN(OnBenchmark)); #endif - c->AddSeparator(); + c->AddSeparator(); c->AddItem(wxT("DeviceInfo"), _("Au&dio Device Info..."), FN(OnAudioDeviceInfo)); c->AddItem(wxT("Log"), _("Show &Log..."), FN(OnShowLog)); @@ -1166,8 +1166,8 @@ void AudacityProject::CreateMenusAndCommands() c->AddCommand(wxT("SnapToNearest"), _("Snap To Nearest"), FN(OnSnapToNearest)); c->AddCommand(wxT("SnapToPrior"), _("Snap To Prior"), FN(OnSnapToPrior)); - c->AddCommand(wxT("FullScreenOnOff"), _("Full screen on/off"), FN(OnFullScreen), -#ifdef __WXMAC__ + c->AddCommand(wxT("FullScreenOnOff"), _("Full screen on/off"), FN(OnFullScreen), +#ifdef __WXMAC__ wxT("Ctrl+/")); #else wxT("F11")); @@ -1210,43 +1210,43 @@ void AudacityProject::CreateMenusAndCommands() #ifdef EFFECT_CATEGORIES -EffectSet AudacityProject::CreateEffectSubmenus(CommandManager* c, - const CategorySet& categories, +EffectSet AudacityProject::CreateEffectSubmenus(CommandManager* c, + const CategorySet& categories, int flags, unsigned submenuThreshold) { EffectSet topLevel; - + CategorySet::const_iterator iter; for (iter = categories.begin(); iter != categories.end(); ++iter) { - + EffectSet effects = (*iter)->GetAllEffects(flags); - + // If the subgraph for this category only contains a single effect, // add it directly in this menu if (effects.size() <= submenuThreshold) topLevel.insert(effects.begin(), effects.end()); - + // If there are more than one effect, add a submenu for the category else if (effects.size() > 0) { EffectSet directEffects = (*iter)->GetEffects(flags); CategorySet subCategories = (*iter)->GetSubCategories(); CategorySet nonEmptySubCategories; - + CategorySet::const_iterator sci; for (sci = subCategories.begin(); sci != subCategories.end(); ++sci) { if ((*sci)->GetAllEffects(flags).size() > 0) nonEmptySubCategories.insert(*sci); } - + // If there are no direct effects and only one subcategory, // add the contents of that subcategory directly in this menu. if (directEffects.size() == 0 && nonEmptySubCategories.size() == 1) { - EffectSet a = CreateEffectSubmenus(c, nonEmptySubCategories, + EffectSet a = CreateEffectSubmenus(c, nonEmptySubCategories, flags); topLevel.insert(a.begin(), a.end()); } - + // Else, add submenus for the subcategories else { c->BeginSubMenu((*iter)->GetName()); @@ -1257,11 +1257,11 @@ EffectSet AudacityProject::CreateEffectSubmenus(CommandManager* c, } } } - + return topLevel; } -void AudacityProject::AddEffectsToMenu(CommandManager* c, +void AudacityProject::AddEffectsToMenu(CommandManager* c, const EffectSet& effects) { wxArrayString names; wxArrayInt indices; @@ -1278,7 +1278,7 @@ void AudacityProject::AddEffectsToMenu(CommandManager* c, void AudacityProject::CreateRecentFilesMenu(CommandManager *c) { // Recent Files and Recent Projects menus - + #ifdef __WXMAC__ /* i18n-hint: This is the name of the menu item on Mac OS X only */ mRecentFilesMenu = c->BeginSubMenu(_("Open Recent")); @@ -1327,7 +1327,7 @@ void AudacityProject::ModifyUndoMenuItems() mCommandManager.Enable(wxT("Undo"), true); } else { - mCommandManager.Modify(wxT("Undo"), + mCommandManager.Modify(wxT("Undo"), wxString::Format(_("&Undo"))); // LL: See above mCommandManager.Enable(wxT("Undo"), true); @@ -1609,7 +1609,7 @@ void AudacityProject::UpdateMenus() flags2 |= TracksSelectedFlag; if ((flags & WaveTracksExistFlag) != 0 ) { - flags2 |= TimeSelectedFlag + flags2 |= TimeSelectedFlag | WaveTracksSelectedFlag | CutCopyAvailableFlag; } @@ -1730,7 +1730,7 @@ void AudacityProject::OnPrevTool() // TODO: Should all these functions which involve // the toolbar actually move into ControlToolBar? -/// MakeReadyToPlay stops whatever is currently playing +/// MakeReadyToPlay stops whatever is currently playing /// and pops the play button up. Then, if nothing is now /// playing, it pushes the play button down and enables /// the stop button. @@ -1771,11 +1771,11 @@ void AudacityProject::OnPlayOneSecond() /// The idea for this function (and first implementation) -/// was from Juhana Sadeharju. The function plays the -/// sound between the current mouse position and the -/// nearest selection boundary. This gives four possible -/// play regions depending on where the current mouse -/// position is relative to the left and right boundaries +/// was from Juhana Sadeharju. The function plays the +/// sound between the current mouse position and the +/// nearest selection boundary. This gives four possible +/// play regions depending on where the current mouse +/// position is relative to the left and right boundaries /// of the selection region. void AudacityProject::OnPlayToSelection() { @@ -1791,14 +1791,14 @@ void AudacityProject::OnPlayToSelection() } else { t0 = t1 = mViewInfo.sel1; } - if( pos < t1) + if( pos < t1) t0=pos; else t1=pos; // JKC: oneSecondPlay mode disables auto scrolling // On balance I think we should always do this in this function - // since you are typically interested in the sound EXACTLY + // since you are typically interested in the sound EXACTLY // where the cursor is. // TODO: have 'playing attributes' such as 'with_autoscroll' // rather than modes, since that's how we're now using the modes. @@ -1825,11 +1825,11 @@ void AudacityProject::OnPlayCutPreview() { if ( !MakeReadyToPlay() ) return; - + // Play with cut preview GetControlToolBar()->PlayCurrentRegion(false, true); } - + void AudacityProject::OnPlayStop() { ControlToolBar *toolbar = GetControlToolBar(); @@ -1851,7 +1851,7 @@ void AudacityProject::OnPlayStop() break; } } - + //stop playing the other project if(otherProject) { ControlToolBar *otherToolbar = otherProject->GetControlToolBar(); @@ -1859,11 +1859,11 @@ void AudacityProject::OnPlayStop() otherToolbar->SetStop(true); //Pushes stop down otherToolbar->StopPlaying(); } - + //play the front project if (!gAudioIO->IsBusy()) { //update the playing area - TP_DisplaySelection(); + TP_DisplaySelection(); //Otherwise, start playing (assuming audio I/O isn't busy) toolbar->SetPlay(true); toolbar->SetStop(false); @@ -2052,7 +2052,7 @@ void AudacityProject::SortTracks(int flags) double time1,time2,tempTime; Track* tempTrack; int candidatesLookedAt; - + candidatesLookedAt = 0; tempTrack = track; time1=time2=std::numeric_limits::max(); //TODO: find max time value. (I don't think we have one yet) @@ -2064,7 +2064,7 @@ void AudacityProject::SortTracks(int flags) else tempTrack = NULL; } - + //get candidate's (from sorted array) time tempTrack = (Track *) arr[ndx]; while(tempTrack){ @@ -2078,15 +2078,15 @@ void AudacityProject::SortTracks(int flags) tempTrack = NULL; } - if (time1 < time2) + if (time1 < time2) break; - + ndx+=candidatesLookedAt; } } } arr.Insert(track, ndx); - + lastTrackLinked = track->GetLinked(); track = iter.RemoveCurrent(); } @@ -2108,7 +2108,7 @@ void AudacityProject::OnSortTime() void AudacityProject::OnSortName() { SortTracks(kAudacitySortByName); - + PushState(_("Tracks sorted by name"), _("Sort by Name")); mTrackPanel->Refresh(false); @@ -2269,7 +2269,7 @@ void AudacityProject::OnSetLeftSelection() { //Get the value from the dialog mViewInfo.sel0 = dlg.GetTimeValue(); - + //Make sure it is 'legal' if (mViewInfo.sel0 < 0.0) mViewInfo.sel0 = 0.0; @@ -2277,14 +2277,14 @@ void AudacityProject::OnSetLeftSelection() bSelChanged = true; } } - - if (mViewInfo.sel1 < mViewInfo.sel0) + + if (mViewInfo.sel1 < mViewInfo.sel0) { mViewInfo.sel1 = mViewInfo.sel0; bSelChanged = true; } - if (bSelChanged) + if (bSelChanged) { ModifyState(false); mTrackPanel->Refresh(false); @@ -2311,7 +2311,7 @@ void AudacityProject::OnSetRightSelection() { //Get the value from the dialog mViewInfo.sel1 = dlg.GetTimeValue(); - + //Make sure it is 'legal' if(mViewInfo.sel1 < 0) mViewInfo.sel1 = 0; @@ -2326,7 +2326,7 @@ void AudacityProject::OnSetRightSelection() bSelChanged = true; } - if (bSelChanged) + if (bSelChanged) { ModifyState(false); mTrackPanel->Refresh(false); @@ -2678,11 +2678,11 @@ void AudacityProject::OnEffect(int type, int index) /// OnEffect() takes an Effect and executes it. /// -/// At the moment flags are used only to indicate +/// At the moment flags are used only to indicate /// whether to prompt for parameters or whether to /// use the most recently stored values. /// -/// At some point we should change to specifying a +/// At some point we should change to specifying a /// parameter source - one of: /// + Prompt /// + Use previous values @@ -2726,7 +2726,7 @@ bool AudacityProject::OnEffect(int type, return false; } } - + if (f->DoEffect(this, type, mRate, mTracks, mTrackFactory, &mViewInfo.sel0, &mViewInfo.sel1, params)) { if (saveState) @@ -2765,7 +2765,7 @@ bool AudacityProject::OnEffect(int type, focus->SetFocus(); } mTrackPanel->EnsureVisible(mTrackPanel->GetFirstSelectedTrack()); - + mTrackPanel->Refresh(false); } else { if (newTrack) { @@ -2955,7 +2955,7 @@ void AudacityProject::OnExportMIDI(){ int numNoteTracksSelected = 0; NoteTrack *nt = NULL; - // Iterate through once to make sure that there is + // Iterate through once to make sure that there is // exactly one NoteTrack selected. while (t) { if (t->GetSelected()) { @@ -2974,7 +2974,7 @@ void AudacityProject::OnExportMIDI(){ } wxASSERT(nt); - if (!nt) + if (!nt) return; while(true){ @@ -3052,7 +3052,7 @@ void AudacityProject::OnExportSelection() void AudacityProject::OnExportMultiple() { ExportMultiple em(this); - + wxGetApp().SetMissingAliasedFileWarningShouldShow(true); em.ShowModal(); } @@ -3124,7 +3124,7 @@ void AudacityProject::OnUndo() if (mHistoryWindow) mHistoryWindow->UpdateDisplay(); - ModifyUndoMenuItems(); + ModifyUndoMenuItems(); } void AudacityProject::OnRedo() @@ -3226,9 +3226,9 @@ void AudacityProject::OnCut() msClipProject = this; PushState(_("Cut to the clipboard"), _("Cut")); - + RedrawProject(); - + mViewInfo.sel1 = mViewInfo.sel0; } @@ -3274,7 +3274,7 @@ void AudacityProject::OnSplitCut() void AudacityProject::OnCopy() { - + TrackListIterator iter(mTracks); Track *n = iter.First(); @@ -3341,7 +3341,7 @@ void AudacityProject::OnPaste() Track *tmpSrc = NULL; Track *tmpC = NULL; Track *prev = NULL; - + bool bAdvanceClipboard = true; bool bPastedSomething = false; bool bTrackTypeMismatch = false; @@ -3358,14 +3358,14 @@ void AudacityProject::OnPaste() bTrackTypeMismatch = true; bAdvanceClipboard = false; c = tmpSrc; - + // If the types still don't match... while (c && c->GetKind() != n->GetKind()){ prev = c; c = clipIter.Next(); } } - + // Handle case where the first track in clipboard // is of different type than the first selected track if (!c){ @@ -3378,11 +3378,11 @@ void AudacityProject::OnPaste() } n = iter.Next(); } - if (!n) c = NULL; + if (!n) c = NULL; } - - // The last possible case for cross-type pastes: triggered when we try to - // paste 1+ tracks from one type into 1+ tracks of another type. If + + // The last possible case for cross-type pastes: triggered when we try to + // paste 1+ tracks from one type into 1+ tracks of another type. If // there's a mix of types, this shouldn't run. if (!c){ wxMessageBox( @@ -3391,10 +3391,10 @@ void AudacityProject::OnPaste() c = n;//so we don't trigger any !c conditions on our way out break; } - + // When trying to copy from stereo to mono track, show error and exit // TODO: Automatically offer user to mix down to mono (unfortunately - // this is not easy to implement + // this is not easy to implement if (c->GetLinked() && !n->GetLinked()) { wxMessageBox( @@ -3411,7 +3411,7 @@ void AudacityProject::OnPaste() if (c->GetKind() == Track::Wave && n && n->GetKind() == Track::Wave) { - bPastedSomething |= + bPastedSomething |= ((WaveTrack*)n)->ClearAndPaste(t0, t1, (WaveTrack*)c, true, true); } else if (c->GetKind() == Track::Label && @@ -3430,13 +3430,13 @@ void AudacityProject::OnPaste() { bPastedSomething |= n->Paste(t0, c); } - + // When copying from mono to stereo track, paste the wave form // to both channels if (n->GetLinked() && !c->GetLinked()) { n = iter.Next(); - + if (n->GetKind() == Track::Wave) { //printf("Checking to see if we need to pre-clear the track\n"); if (!((WaveTrack *) n)->IsEmpty(t0, t1)) { @@ -3444,13 +3444,13 @@ void AudacityProject::OnPaste() } bPastedSomething |= ((WaveTrack *)n)->Paste(t0, c); } - else + else { n->Clear(t0, t1); bPastedSomething |= n->Paste(t0, c); } } - + if (msClipProject != this && c->GetKind() == Track::Wave) ((WaveTrack *) c)->Unlock(); @@ -3466,20 +3466,20 @@ void AudacityProject::OnPaste() n = iter.Next(); } - + // This block handles the cases where our clipboard is smaller - // than the amount of selected destination tracks. We take the + // than the amount of selected destination tracks. We take the // last wave track, and paste that one into the remaining // selected tracks. if ( n && !c ) { TrackListOfKindIterator clipWaveIter(Track::Wave, msClipboard); c = clipWaveIter.Last(); - + while (n){ if (n->GetSelected() && n->GetKind()==Track::Wave){ if (c && c->GetKind() == Track::Wave){ - bPastedSomething |= + bPastedSomething |= ((WaveTrack *)n)->ClearAndPaste(t0, t1, (WaveTrack *)c, true, true); }else{ WaveTrack *tmp; @@ -3488,7 +3488,7 @@ void AudacityProject::OnPaste() wxASSERT(bResult); // TO DO: Actually handle this. tmp->Flush(); - bPastedSomething |= + bPastedSomething |= ((WaveTrack *)n)->ClearAndPaste(t0, t1, tmp, true, true); delete tmp; @@ -3510,7 +3510,7 @@ void AudacityProject::OnPaste() n = iter.Next(); } } - + // TODO: What if we clicked past the end of the track? if (bPastedSomething) @@ -3532,13 +3532,13 @@ bool AudacityProject::HandlePasteText() { TrackListOfKindIterator iterLabelTrack(Track::Label, mTracks); LabelTrack* pLabelTrack = (LabelTrack*)(iterLabelTrack.First()); - while (pLabelTrack) + while (pLabelTrack) { // Does this track have an active label? if (pLabelTrack->IsSelected()) { // Yes, so try pasting into it - if (pLabelTrack->PasteSelectedText(mViewInfo.sel0, mViewInfo.sel1)) + if (pLabelTrack->PasteSelectedText(mViewInfo.sel0, mViewInfo.sel1)) { PushState(_("Pasted text from the clipboard"), _("Paste")); @@ -3561,14 +3561,14 @@ bool AudacityProject::HandlePasteText() // Return true if nothing selected, regardless of paste result. // If nothing was selected, create and paste into new tracks. // (This was formerly the second part of overly-long OnPaste.) -bool AudacityProject::HandlePasteNothingSelected() +bool AudacityProject::HandlePasteNothingSelected() { - // First check whether anything's selected. + // First check whether anything's selected. bool bAnySelected = false; TrackListIterator iterTrack(mTracks); Track* pTrack = iterTrack.First(); while (pTrack) { - if (pTrack->GetSelected()) + if (pTrack->GetSelected()) { bAnySelected = true; break; @@ -3578,25 +3578,25 @@ bool AudacityProject::HandlePasteNothingSelected() if (bAnySelected) return false; - else + else { TrackListIterator iterClip(msClipboard); Track* pClip = iterClip.First(); - if (!pClip) + if (!pClip) return true; // nothing to paste - + Track* pNewTrack; Track* pFirstNewTrack = NULL; while (pClip) { if ((msClipProject != this) && (pClip->GetKind() == Track::Wave)) ((WaveTrack*)pClip)->Lock(); - + switch (pClip->GetKind()) { - case Track::Wave: + case Track::Wave: { WaveTrack *w = (WaveTrack *)pClip; pNewTrack = mTrackFactory->NewWaveTrack(w->GetSampleFormat(), w->GetRate()); - } + } break; #ifdef USE_MIDI case Track::Note: @@ -3622,11 +3622,11 @@ bool AudacityProject::HandlePasteNothingSelected() bool bResult = pNewTrack->Paste(0.0, pClip); wxASSERT(bResult); // TO DO: Actually handle this. mTracks->Add(pNewTrack); - pNewTrack->SetSelected(true); - + pNewTrack->SetSelected(true); + if (msClipProject != this && pClip->GetKind() == Track::Wave) ((WaveTrack *) pClip)->Unlock(); - + if (!pFirstNewTrack) pFirstNewTrack = pNewTrack; @@ -3644,7 +3644,7 @@ bool AudacityProject::HandlePasteNothingSelected() mViewInfo.sel1 = quantT1 - quantT0; PushState(_("Pasted from the clipboard"), _("Paste")); - + RedrawProject(); if (pFirstNewTrack) @@ -3911,15 +3911,15 @@ void AudacityProject::OnCutLabels() EditByLabel( &WaveTrack::ClearAndAddCutLine, true ); else EditByLabel( &WaveTrack::Clear, true ); - + msClipProject = this; mViewInfo.sel1 = mViewInfo.sel0; - - PushState( - /* i18n-hint: (verb) past tense. Audacity has just cut the labeled audio regions.*/ - _( "Cut labeled audio regions to clipboard" ), - /* i18n-hint: (verb)*/ + + PushState( + /* i18n-hint: (verb) past tense. Audacity has just cut the labeled audio regions.*/ + _( "Cut labeled audio regions to clipboard" ), + /* i18n-hint: (verb)*/ _( "Cut Labeled Audio" ) ); RedrawProject(); @@ -3931,12 +3931,12 @@ void AudacityProject::OnSplitCutLabels() return; EditClipboardByLabel( &WaveTrack::SplitCut ); - + msClipProject = this; - PushState( - /* i18n-hint: (verb) Audacity has just split cut the labeled audio regions*/ - _( "Split Cut labeled audio regions to clipboard" ), + PushState( + /* i18n-hint: (verb) Audacity has just split cut the labeled audio regions*/ + _( "Split Cut labeled audio regions to clipboard" ), /* i18n-hint: (verb) Do a special kind of cut on the labels*/ _( "Split Cut Labeled Audio" ) ); @@ -3949,11 +3949,11 @@ void AudacityProject::OnCopyLabels() return; EditClipboardByLabel( &WaveTrack::Copy ); - + msClipProject = this; - + PushState( _( "Copied labeled audio regions to clipboard" ), - /* i18n-hint: (verb)*/ + /* i18n-hint: (verb)*/ _( "Copy Labeled Audio" ) ); mTrackPanel->Refresh( false ); @@ -3963,15 +3963,15 @@ void AudacityProject::OnDeleteLabels() { if( mViewInfo.sel0 >= mViewInfo.sel1 ) return; - + EditByLabel( &WaveTrack::Clear, true ); mViewInfo.sel1 = mViewInfo.sel0; - - PushState( - /* i18n-hint: (verb) Audacity has just deleted the labeled audio regions*/ - _( "Deleted labeled audio regions" ), - /* i18n-hint: (verb)*/ + + PushState( + /* i18n-hint: (verb) Audacity has just deleted the labeled audio regions*/ + _( "Deleted labeled audio regions" ), + /* i18n-hint: (verb)*/ _( "Delete Labeled Audio" ) ); RedrawProject(); @@ -3981,12 +3981,12 @@ void AudacityProject::OnSplitDeleteLabels() { if( mViewInfo.sel0 >= mViewInfo.sel1 ) return; - + EditByLabel( &WaveTrack::SplitDelete, false ); - - PushState( + + PushState( /* i18n-hint: (verb) Audacity has just done a special kind of delete on the labeled audio regions */ - _( "Split Deleted labeled audio regions" ), + _( "Split Deleted labeled audio regions" ), /* i18n-hint: (verb) Do a special kind of delete on labeled audio regions*/ _( "Split Delete Labeled Audio" ) ); @@ -3997,13 +3997,13 @@ void AudacityProject::OnSilenceLabels() { if( mViewInfo.sel0 >= mViewInfo.sel1 ) return; - + EditByLabel( &WaveTrack::Silence, false ); - + PushState( - /* i18n-hint: (verb)*/ + /* i18n-hint: (verb)*/ _( "Silenced labeled audio regions" ), - /* i18n-hint: (verb)*/ + /* i18n-hint: (verb)*/ _( "Silence Labeled Audio" ) ); mTrackPanel->Refresh( false ); @@ -4012,10 +4012,10 @@ void AudacityProject::OnSilenceLabels() void AudacityProject::OnSplitLabels() { EditByLabel( &WaveTrack::Split, false ); - - PushState( - /* i18n-hint: (verb) past tense. Audacity has just split the labeled audio (a point or a region)*/ - _( "Split labeled audio (points or regions)" ), + + PushState( + /* i18n-hint: (verb) past tense. Audacity has just split the labeled audio (a point or a region)*/ + _( "Split labeled audio (points or regions)" ), /* i18n-hint: (verb)*/ _( "Split Labeled Audio" ) ); @@ -4026,13 +4026,13 @@ void AudacityProject::OnJoinLabels() { if( mViewInfo.sel0 >= mViewInfo.sel1 ) return; - + EditByLabel( &WaveTrack::Join, false ); - - PushState( - /* i18n-hint: (verb) Audacity has just joined the labeled audio (points or regions)*/ - _( "Joined labeled audio (points or regions)" ), - /* i18n-hint: (verb)*/ + + PushState( + /* i18n-hint: (verb) Audacity has just joined the labeled audio (points or regions)*/ + _( "Joined labeled audio (points or regions)" ), + /* i18n-hint: (verb)*/ _( "Join Labeled Audio" ) ); RedrawProject(); @@ -4042,15 +4042,15 @@ void AudacityProject::OnDisjoinLabels() { if( mViewInfo.sel0 >= mViewInfo.sel1 ) return; - + EditByLabel( &WaveTrack::Disjoin, false ); - - PushState( + + PushState( /* i18n-hint: (verb) Audacity has just detached the labeled audio regions. - This message appears in history and tells you about something + This message appears in history and tells you about something Audacity has done.*/ _( "Detached labeled audio regions" ), - /* i18n-hint: (verb)*/ + /* i18n-hint: (verb)*/ _( "Detach Labeled Audio" ) ); RedrawProject(); @@ -4180,7 +4180,7 @@ void AudacityProject::OnSelectAll() mViewInfo.sel1 = mTracks->GetEndTime(); ModifyState(false); - + mTrackPanel->Refresh(false); if (mMixerBoard) mMixerBoard->Refresh(false); @@ -4212,7 +4212,7 @@ void AudacityProject::OnSelectCursorEnd() mViewInfo.sel1 = maxEndOffset; ModifyState(false); - + mTrackPanel->Refresh(false); } @@ -4235,7 +4235,7 @@ void AudacityProject::OnSelectStartCursor() mViewInfo.sel0 = minOffset; ModifyState(false); - + mTrackPanel->Refresh(false); } @@ -4303,7 +4303,7 @@ void AudacityProject::ZoomInByFactor( double ZoomFactor ) bool selectionFillsScreen = (mViewInfo.sel0 < mViewInfo.h) && (mViewInfo.sel1 > mViewInfo.h + mViewInfo.screen); - + if (selectionIsOnscreen && !selectionFillsScreen) { // Start with the center of the selection double selCenter = (mViewInfo.sel0 + mViewInfo.sel1) / 2; @@ -4315,7 +4315,7 @@ void AudacityProject::ZoomInByFactor( double ZoomFactor ) if (selCenter > mViewInfo.h + mViewInfo.screen) selCenter = mViewInfo.h + mViewInfo.screen - (mViewInfo.h + mViewInfo.screen - mViewInfo.sel0) / 2; - + // Zoom in Zoom(mViewInfo.zoom *= ZoomFactor); @@ -4328,9 +4328,9 @@ void AudacityProject::ZoomInByFactor( double ZoomFactor ) double origLeft = mViewInfo.h; double origWidth = mViewInfo.screen; Zoom(mViewInfo.zoom *= ZoomFactor); - + double newh = origLeft + (origWidth - mViewInfo.screen) / 2; - + // MM: Commented this out because it was confusing users /* // make sure that the *right-hand* end of the selection is @@ -4348,7 +4348,7 @@ void AudacityProject::ZoomInByFactor( double ZoomFactor ) } void AudacityProject::OnZoomOut() -{ +{ ZoomOutByFactor( 1 /2.0 ); } @@ -4621,7 +4621,7 @@ void AudacityProject::OnImport() // An import trigger for the alias missing dialog might not be intuitive, but // this serves to track the file if the users zooms in and such. wxGetApp().SetMissingAliasedFileWarningShouldShow(true); - + wxArrayString selectedFiles = ShowOpenDialog(wxT("")); if (selectedFiles.GetCount() == 0) { gPrefs->Write(wxT("/LastOpenType"),wxT("")); @@ -4635,13 +4635,13 @@ void AudacityProject::OnImport() //first sort selectedFiles. selectedFiles.Sort(CompareNoCaseFileName); ODManager::Pause(); - + for (size_t ff = 0; ff < selectedFiles.GetCount(); ff++) { wxString fileName = selectedFiles[ff]; wxString path = ::wxPathOnly(fileName); gPrefs->Write(wxT("/DefaultOpenPath"), path); - + Import(fileName); } @@ -4826,7 +4826,7 @@ void AudacityProject::HandleMixAndRender(bool toNewTrack) if (selectedCount==1) { wxString msg; msg.Printf(_("Rendered all audio in track '%s'"), firstName.c_str()); - /* i18n-hint: Convert the audio into a more usable form, so apply + /* i18n-hint: Convert the audio into a more usable form, so apply * panning and amplification and write to some external file.*/ PushState(msg, _("Render")); } @@ -4873,7 +4873,7 @@ void AudacityProject::OnSelectionRestore() mViewInfo.sel1 = mSel1save; ModifyState(false); - + mTrackPanel->Refresh(false); } @@ -5037,7 +5037,7 @@ void AudacityProject::HandleAlign(int index, bool moveSel) shortAction = _("Together"); } - if ((unsigned)index >= mAlignLabelsCount) { // This is an alignLabelsNoSync command. + if ((unsigned)index >= mAlignLabelsCount) { // This is an alignLabelsNoSync command. TrackListIterator iter(mTracks); Track *t = iter.First(); double leftChannelStart = 0.0; @@ -5097,7 +5097,7 @@ void AudacityProject::HandleAlign(int index, bool moveSel) if (delta != 0.0) { TrackListIterator iter(mTracks); Track *t = iter.First(); - + while (t) { // For a fixed-distance shift move sync-lock selected tracks also. if (t->GetSelected() || t->IsSyncLockSelected()) { @@ -5139,7 +5139,7 @@ void AudacityProject::OnAlignMoveSel(int index) } #ifdef EXPERIMENTAL_SCOREALIGN -// rough relative amount of time to compute one +// rough relative amount of time to compute one // frame of audio or midi, or one cell of matrix, or one iteration // of smoothing, measured on a 1.9GHz Core 2 Duo in 32-bit mode // (see COLLECT_TIMING_DATA below) @@ -5150,7 +5150,7 @@ void AudacityProject::OnAlignMoveSel(int index) // Write timing data to a file; useful for calibrating AUDIO_WORK_UNIT, // MIDI_WORK_UNIT, MATRIX_WORK_UNIT, and SMOOTHING_WORK_UNIT coefficients -// Data is written to timing-data.txt; look in +// Data is written to timing-data.txt; look in // audacity-src/win/Release/modules/ #define COLLECT_TIMING_DATA @@ -5170,15 +5170,15 @@ class ASAProgress : public SAProgress { #endif public: - ASAProgress() { + ASAProgress() { smoothing = false; - mProgress = NULL; + mProgress = NULL; #ifdef COLLECT_TIMING_DATA mTimeFile = fopen("timing-data.txt", "w"); #endif } - ~ASAProgress() { - delete mProgress; + ~ASAProgress() { + delete mProgress; #ifdef COLLECT_TIMING_DATA fclose(mTimeFile); #endif @@ -5190,7 +5190,7 @@ class ASAProgress : public SAProgress { #ifdef COLLECT_TIMING_DATA long ms = 0; wxDateTime now = wxDateTime::UNow(); - fprintf(mTimeFile, "Phase %d begins at %s\n", + fprintf(mTimeFile, "Phase %d begins at %s\n", i, now.FormatTime().c_str()); if (i != 0) ms = now.Subtract(mStartTime).GetMilliseconds().ToLong(); @@ -5213,15 +5213,15 @@ class ASAProgress : public SAProgress { // arbitarily assume 60 iterations to fit smooth segments and // per frame per iteration is SMOOTHING_WORK_UNIT if (smoothing) { - work3 = + work3 = wxMax(mFrames[0], mFrames[1]) * SMOOTHING_WORK_UNIT * 40; mTotalWork += work3; } #ifdef COLLECT_TIMING_DATA fprintf(mTimeFile, " mTotalWork (an estimate) = %g\n", mTotalWork); - fprintf(mTimeFile, " work0 = %g, frames %g, is_audio %d\n", + fprintf(mTimeFile, " work0 = %g, frames %g, is_audio %d\n", work[0], mFrames[0], is_audio[0]); - fprintf(mTimeFile, " work1 = %g, frames %g, is_audio %d\n", + fprintf(mTimeFile, " work1 = %g, frames %g, is_audio %d\n", work[1], mFrames[1], is_audio[1]); fprintf(mTimeFile, "work2 = %g, work3 = %g\n", work2, work3); #endif @@ -5229,15 +5229,15 @@ class ASAProgress : public SAProgress { _("Synchronizing MIDI and Audio Tracks")); } else if (i < 3) { fprintf(mTimeFile, - "Phase %d took %d ms for %g frames, coefficient = %g s/frame\n", + "Phase %d took %d ms for %g frames, coefficient = %g s/frame\n", i - 1, ms, mFrames[i - 1], (ms * 0.001) / mFrames[i - 1]); } else if (i == 3) { fprintf(mTimeFile, - "Phase 2 took %d ms for %d cells, coefficient = %g s/cell\n", + "Phase 2 took %d ms for %d cells, coefficient = %g s/cell\n", ms, mCellCount, (ms * 0.001) / mCellCount); } else if (i == 4) { - fprintf(mTimeFile, "Phase 3 took %d ms for %d iterations on %g frames, coefficient = %g s per frame per iteration\n", - ms, iterations, wxMax(mFrames[0], mFrames[1]), + fprintf(mTimeFile, "Phase 3 took %d ms for %d iterations on %g frames, coefficient = %g s per frame per iteration\n", + ms, iterations, wxMax(mFrames[0], mFrames[1]), (ms * 0.001) / (wxMax(mFrames[0], mFrames[1]) * iterations)); } } @@ -5248,25 +5248,25 @@ class ASAProgress : public SAProgress { work = (is_audio[0] ? AUDIO_WORK_UNIT : MIDI_WORK_UNIT) * f; } else if (phase == 1) { float f = s / frame_period; - work = (is_audio[0] ? AUDIO_WORK_UNIT : MIDI_WORK_UNIT) * mFrames[0] + + work = (is_audio[0] ? AUDIO_WORK_UNIT : MIDI_WORK_UNIT) * mFrames[0] + (is_audio[1] ? AUDIO_WORK_UNIT : MIDI_WORK_UNIT) * f; } int updateResult = mProgress->Update(int(work), int(mTotalWork)); return (updateResult == eProgressSuccess); - } + } virtual bool set_matrix_progress(int cells) { mCellCount += cells; - float work = - (is_audio[0] ? AUDIO_WORK_UNIT : MIDI_WORK_UNIT) * mFrames[0] + + float work = + (is_audio[0] ? AUDIO_WORK_UNIT : MIDI_WORK_UNIT) * mFrames[0] + (is_audio[1] ? AUDIO_WORK_UNIT : MIDI_WORK_UNIT) * mFrames[1]; work += mCellCount * MATRIX_WORK_UNIT; int updateResult = mProgress->Update(int(work), int(mTotalWork)); return (updateResult == eProgressSuccess); - } + } virtual bool set_smoothing_progress(int i) { iterations = i; - float work = - (is_audio[0] ? AUDIO_WORK_UNIT : MIDI_WORK_UNIT) * mFrames[0] + + float work = + (is_audio[0] ? AUDIO_WORK_UNIT : MIDI_WORK_UNIT) * mFrames[0] + (is_audio[1] ? AUDIO_WORK_UNIT : MIDI_WORK_UNIT) * mFrames[1] + MATRIX_WORK_UNIT * mFrames[0] * mFrames[1]; work += i * wxMax(mFrames[0], mFrames[1]) * SMOOTHING_WORK_UNIT; @@ -5327,7 +5327,7 @@ void AudacityProject::OnScoreAlign() if (params.mStatus != wxID_OK) return; - // We're going to do it. + // We're going to do it. //pushing the state before the change is wrong (I think) //PushState(_("Sync MIDI with Audio"), _("Sync MIDI with Audio")); // Make a copy of the note track in case alignment is canceled or fails @@ -5352,7 +5352,7 @@ void AudacityProject::OnScoreAlign() alignedNoteTrack->SetOffset(0); WaveTrack **waveTracks; - mTracks->GetWaveTracks(true /* selectionOnly */, + mTracks->GetWaveTracks(true /* selectionOnly */, &numWaveTracksSelected, &waveTracks); Mixer *mix = new Mixer(numWaveTracksSelected, // int numInputTracks @@ -5373,7 +5373,7 @@ void AudacityProject::OnScoreAlign() // There's a lot of adjusting made to incorporate the note track offset into // the note track while preserving the position of notes within beats and - // measures. For debugging, you can see just the pre-scorealign note track + // measures. For debugging, you can see just the pre-scorealign note track // manipulation by setting SKIP_ACTUAL_SCORE_ALIGNMENT. You could then, for // example, save the modified note track in ".gro" form to read the details. //#define SKIP_ACTUAL_SCORE_ALIGNMENT 1 @@ -5392,15 +5392,15 @@ void AudacityProject::OnScoreAlign() mTracks->Replace(nt, alignedNoteTrack, true); RedrawProject(); wxMessageBox(wxString::Format( - _("Alignment completed: MIDI from %.2f to %.2f secs, Audio from %.2f to %.2f secs."), - params.mMidiStart, params.mMidiEnd, + _("Alignment completed: MIDI from %.2f to %.2f secs, Audio from %.2f to %.2f secs."), + params.mMidiStart, params.mMidiEnd, params.mAudioStart, params.mAudioEnd)); PushState(_("Sync MIDI with Audio"), _("Sync MIDI with Audio")); } else if (result == SA_TOOSHORT) { delete alignedNoteTrack; wxMessageBox(wxString::Format( - _("Alignment error: input too short: MIDI from %.2f to %.2f secs, Audio from %.2f to %.2f secs."), - params.mMidiStart, params.mMidiEnd, + _("Alignment error: input too short: MIDI from %.2f to %.2f secs, Audio from %.2f to %.2f secs."), + params.mMidiStart, params.mMidiEnd, params.mAudioStart, params.mAudioEnd)); } else if (result == SA_CANCEL) { // wrong way to recover... @@ -5435,19 +5435,19 @@ void AudacityProject::OnNewStereoTrack() WaveTrack *t = mTrackFactory->NewWaveTrack(mDefaultFormat, mRate); t->SetChannel(Track::LeftChannel); SelectNone(); - + mTracks->Add(t); t->SetSelected(true); t->SetLinked (true); - + t = mTrackFactory->NewWaveTrack(mDefaultFormat, mRate); t->SetChannel(Track::RightChannel); - + mTracks->Add(t); t->SetSelected(true); - + PushState(_("Created new stereo audio track"), _("New Track")); - + RedrawProject(); mTrackPanel->EnsureVisible(t); } @@ -5480,7 +5480,7 @@ void AudacityProject::OnNewTimeTrack() mTracks->AddToHead(t); t->SetSelected(true); - + PushState(_("Created new time track"), _("New Track")); RedrawProject(); @@ -5643,7 +5643,7 @@ wxString AudacityProject::BuildCleanFileName(wxString fileName, wxString extensi int hour = now.GetHour(); int minute = now.GetMinute(); int second = now.GetSecond(); - justName = wxString::Format(wxT("%d-%s-%02d-%02d-%02d-%02d"), + justName = wxString::Format(wxT("%d-%s-%02d-%02d-%02d-%02d"), year, monthName.c_str(), dom, hour, minute, second); // SetName(cleanedFileName); @@ -5738,16 +5738,16 @@ void AudacityProject::OnHelpWelcome() void AudacityProject::OnQuickHelp() { - ShowHelpDialog( - this, + ShowHelpDialog( + this, FileNames::HtmlHelpIndexFile(true), wxT("http://manual.audacityteam.org/o/quick_help.html" )); } void AudacityProject::OnManual() { - ShowHelpDialog( - this, + ShowHelpDialog( + this, FileNames::HtmlHelpIndexFile(false), wxT("http://manual.audacityteam.org/o/" )); } @@ -5773,10 +5773,10 @@ void AudacityProject::OnScreenshot() void AudacityProject::OnAudioDeviceInfo() { wxString info = gAudioIO->GetDeviceInfo(); - ShowInfoDialog( this, + ShowInfoDialog( this, _("Audio Device Info"), wxT(""), - info, + info, 350,450); } @@ -5928,7 +5928,7 @@ void AudacityProject::OnResample() for (Track *t = iter.First(); t; t = iter.Next()) { wxString msg; - + msg.Printf(_("Resampling track %d"), ++ndx); ProgressDialog progress(_("Resample"), msg); @@ -5937,10 +5937,10 @@ void AudacityProject::OnResample() if (!((WaveTrack*)t)->Resample(newRate, &progress)) break; } - + PushState(_("Resampled audio track(s)"), _("Resample Track")); RedrawProject(); - + // Need to reset FinishAutoScroll(); } diff --git a/src/Menus.h b/src/Menus.h index b99a1c537..0f43514df 100644 --- a/src/Menus.h +++ b/src/Menus.h @@ -14,11 +14,11 @@ // These are all member functions of class AudacityProject. -// Vaughan, 2010-08-05: +// Vaughan, 2010-08-05: // Note that this file is included in a "public" section of Project.h. -// Most of these methods do not need to be public, and because +// Most of these methods do not need to be public, and because // we do not subclass AudacityProject, they should be "private." -// Because the ones that need to be public are intermixed, +// Because the ones that need to be public are intermixed, // I've added "private" in just a few cases. private: @@ -29,7 +29,7 @@ void CreateMenusAndCommands(); /** Generate submenus for the categories that contain more than one effect and return the effects from the categories that do not contain more than submenuThreshold effects so the caller can add them to the current menu. */ -EffectSet CreateEffectSubmenus(CommandManager* c, +EffectSet CreateEffectSubmenus(CommandManager* c, const CategorySet& categories, int flags, unsigned submenuThreshold = 1); diff --git a/src/Mix.cpp b/src/Mix.cpp index 10291c824..a1cdc5853 100644 --- a/src/Mix.cpp +++ b/src/Mix.cpp @@ -61,7 +61,7 @@ bool MixAndRender(TrackList *tracks, TrackFactory *trackFactory, TrackListIterator iter(tracks); SelectedTrackListOfKindIterator usefulIter(Track::Wave, tracks); // this only iterates tracks which are relevant to this function, i.e. - // selected WaveTracks. The tracklist is (confusingly) the list of all + // selected WaveTracks. The tracklist is (confusingly) the list of all // tracks in the project t = iter.First(); @@ -168,7 +168,7 @@ bool MixAndRender(TrackList *tracks, TrackFactory *trackFactory, ::wxSafeYield(); ProgressDialog *progress = new ProgressDialog(_("Mix and Render"), _("Mixing and rendering tracks")); - + int updateResult = eProgressSuccess; while(updateResult == eProgressSuccess) { sampleCount blockLen = mixer->Process(maxBlockLen); @@ -194,16 +194,16 @@ bool MixAndRender(TrackList *tracks, TrackFactory *trackFactory, delete progress; mixLeft->Flush(); - if (!mono) + if (!mono) mixRight->Flush(); if (updateResult == eProgressCancelled || updateResult == eProgressFailed) { delete mixLeft; - if (!mono) + if (!mono) delete mixRight; } else { *newLeft = mixLeft; - if (!mono) + if (!mono) *newRight = mixRight; #if 0 @@ -268,7 +268,7 @@ Mixer::Mixer(int numInputTracks, WaveTrack **inputTracks, mNumBuffers = mNumChannels; mInterleavedBufferSize = mBufferSize; } - + mBuffer = new samplePtr[mNumBuffers]; mTemp = new samplePtr[mNumBuffers]; for (int c = 0; c < mNumBuffers; c++) { @@ -350,10 +350,10 @@ void MixBuffers(int numChannels, int *channelFlags, float *gains, for (int c = 0; c < numChannels; c++) { if (!channelFlags[c]) continue; - + samplePtr destPtr; int skip; - + if (interleaved) { destPtr = dests[0] + c*SAMPLE_SIZE(floatSample); skip = numChannels; @@ -371,7 +371,7 @@ void MixBuffers(int numChannels, int *channelFlags, float *gains, } } } - + sampleCount Mixer::MixVariableRates(int *channelFlags, WaveTrack *track, sampleCount *pos, float *queue, int *queueStart, int *queueLen, @@ -446,7 +446,7 @@ sampleCount Mixer::MixVariableRates(int *channelFlags, WaveTrack *track, } double factor = initialWarp; - if (mTimeTrack) + if (mTimeTrack) { //TODO-MB: The end time is wrong when the resampler doesn't use all input samples, // as a result of this the warp factor may be slightly wrong, so AudioIO will stop too soon @@ -511,7 +511,7 @@ sampleCount Mixer::MixSameRate(int *channelFlags, WaveTrack *track, //don't process if we're at the end of the selection or track. if (t>=tEnd) return 0; - //if we're about to approach the end of the track or selection, figure out how much we need to grab + //if we're about to approach the end of the track or selection, figure out how much we need to grab if (t + slen/track->GetRate() > tEnd) slen = (int)((tEnd - t) * track->GetRate() + 0.5); @@ -522,7 +522,7 @@ sampleCount Mixer::MixSameRate(int *channelFlags, WaveTrack *track, track->GetEnvelopeValues(mEnvValues, slen, t, 1.0 / mRate); for(int i=0; iGetChannelGain(c); @@ -590,11 +590,11 @@ sampleCount Mixer::Process(sampleCount maxToProcess) if (out > maxOut) maxOut = out; - + double t = (double)mSamplePos[i] / (double)track->GetRate(); if(t > mTime) mTime = std::min(t, mT1); - + } if(mInterleaved) { for(int c=0; c mMaxNumChannels ) mNumChannels = mMaxNumChannels; - + Alloc(); for( int i = 0; i < mNumTracks; i++ ) @@ -728,7 +728,7 @@ bool MixerSpec::SetNumChannels( int newNumChannels ) if( newNumChannels > mMaxNumChannels ) return false; - + for( int i = 0; i < mNumTracks; i++ ) { for( int j = newNumChannels; j < mNumChannels; j++ ) @@ -745,7 +745,7 @@ bool MixerSpec::SetNumChannels( int newNumChannels ) MixerSpec& MixerSpec::operator=( const MixerSpec &mixerSpec ) { Free(); - + mNumTracks = mixerSpec.mNumTracks; mNumChannels = mixerSpec.mNumChannels; mMaxNumChannels = mixerSpec.mMaxNumChannels; diff --git a/src/Mix.h b/src/Mix.h index ad8aa3ec2..90f859d67 100644 --- a/src/Mix.h +++ b/src/Mix.h @@ -27,9 +27,9 @@ class DirManager; * Takes one or more tracks as input; of all the WaveTrack s that are selected, * it mixes them together, applying any envelopes, amplitude gain, panning, and * real-time effects in the process. The resulting pair of tracks (stereo) are - * "rendered" and have no effects, gain, panning, or envelopes. Other sorts of + * "rendered" and have no effects, gain, panning, or envelopes. Other sorts of * tracks are ignored. - * If the start and end times passed are the same this is taken as meaning + * If the start and end times passed are the same this is taken as meaning * no explicit time range to process, and the whole occupied length of the * input tracks is processed. */ @@ -45,13 +45,13 @@ void MixBuffers(int numChannels, int *channelFlags, float *gains, class AUDACITY_DLL_API MixerSpec { int mNumTracks, mNumChannels, mMaxNumChannels; - + void Alloc(); void Free(); public: bool **mMap; - + MixerSpec( int numTracks, int maxNumChannels ); MixerSpec( const MixerSpec &mixerSpec ); virtual ~MixerSpec(); @@ -67,7 +67,7 @@ class AUDACITY_DLL_API MixerSpec class AUDACITY_DLL_API Mixer { public: - // + // // Constructor / Destructor // @@ -135,7 +135,7 @@ class AUDACITY_DLL_API Mixer { float *mGains; double *mEnvValues; double mT0; // Start time - double mT1; // Stop time (none if mT0==mT1) + double mT1; // Stop time (none if mT0==mT1) double mTime; // Current time (renamed from mT to mTime for consistency with AudioIO - mT represented warped time there) Resample **mResample; float **mSampleQueue; diff --git a/src/MixerBoard.cpp b/src/MixerBoard.cpp index b586ff483..d62835257 100644 --- a/src/MixerBoard.cpp +++ b/src/MixerBoard.cpp @@ -50,12 +50,12 @@ END_EVENT_TABLE() MixerTrackSlider::MixerTrackSlider(wxWindow * parent, wxWindowID id, wxString name, - const wxPoint & pos, + const wxPoint & pos, const wxSize & size, int style /*= FRAC_SLIDER*/, bool popup /*= true*/, bool canUseShift /*= true*/, - float stepValue /*= STEP_CONTINUOUS*/, + float stepValue /*= STEP_CONTINUOUS*/, int orientation /*= wxHORIZONTAL*/) : ASlider(parent, id, name, pos, size, style, popup, canUseShift, stepValue, orientation) @@ -129,10 +129,10 @@ void MixerTrackSlider::OnCaptureKey(wxCommandEvent &event) #define kMixerTrackClusterWidth kLeftSideStackWidth + kRightSideStackWidth + kQuadrupleInset // kDoubleInset margin on both sides enum { - ID_BITMAPBUTTON_MUSICAL_INSTRUMENT = 13000, + ID_BITMAPBUTTON_MUSICAL_INSTRUMENT = 13000, ID_SLIDER_PAN, ID_SLIDER_GAIN, - ID_TOGGLEBUTTON_MUTE, + ID_TOGGLEBUTTON_MUTE, ID_TOGGLEBUTTON_SOLO, }; @@ -141,7 +141,7 @@ BEGIN_EVENT_TABLE(MixerTrackCluster, wxPanel) EVT_MOUSE_EVENTS(MixerTrackCluster::OnMouseEvent) EVT_PAINT(MixerTrackCluster::OnPaint) - EVT_BUTTON(ID_BITMAPBUTTON_MUSICAL_INSTRUMENT, MixerTrackCluster::OnButton_MusicalInstrument) + EVT_BUTTON(ID_BITMAPBUTTON_MUSICAL_INSTRUMENT, MixerTrackCluster::OnButton_MusicalInstrument) EVT_SLIDER(ID_SLIDER_PAN, MixerTrackCluster::OnSlider_Pan) EVT_SLIDER(ID_SLIDER_GAIN, MixerTrackCluster::OnSlider_Gain) //v EVT_COMMAND_SCROLL(ID_SLIDER_GAIN, MixerTrackCluster::OnSliderScroll_Gain) @@ -149,11 +149,11 @@ BEGIN_EVENT_TABLE(MixerTrackCluster, wxPanel) EVT_COMMAND(ID_TOGGLEBUTTON_SOLO, wxEVT_COMMAND_BUTTON_CLICKED, MixerTrackCluster::OnButton_Solo) END_EVENT_TABLE() -MixerTrackCluster::MixerTrackCluster(wxWindow* parent, - MixerBoard* grandParent, AudacityProject* project, - WaveTrack* pLeftTrack, WaveTrack* pRightTrack /*= NULL*/, - const wxPoint& pos /*= wxDefaultPosition*/, - const wxSize& size /*= wxDefaultSize*/) +MixerTrackCluster::MixerTrackCluster(wxWindow* parent, + MixerBoard* grandParent, AudacityProject* project, + WaveTrack* pLeftTrack, WaveTrack* pRightTrack /*= NULL*/, + const wxPoint& pos /*= wxDefaultPosition*/, + const wxSize& size /*= wxDefaultSize*/) : wxPanel(parent, -1, pos, size) { mMixerBoard = grandParent; @@ -176,51 +176,51 @@ MixerTrackCluster::MixerTrackCluster(wxWindow* parent, SetName(mLeftTrack->GetName()); - this->SetBackgroundColour(wxSystemSettings::GetColour(wxSYS_COLOUR_3DFACE)); + this->SetBackgroundColour(wxSystemSettings::GetColour(wxSYS_COLOUR_3DFACE)); - // Not sure why, but sizers weren't getting offset vertically, - // probably because not using wxDefaultPosition, + // Not sure why, but sizers weren't getting offset vertically, + // probably because not using wxDefaultPosition, // so positions are calculated explicitly below, and sizers code was removed. // (Still available in Audacity_UmixIt branch off 1.2.6.) // track name wxPoint ctrlPos(kDoubleInset, kDoubleInset); wxSize ctrlSize(size.GetWidth() - kQuadrupleInset, TRACK_NAME_HEIGHT); - mStaticText_TrackName = + mStaticText_TrackName = #ifdef EXPERIMENTAL_MIDI_OUT - new wxStaticText(this, -1, mTrack->GetName(), ctrlPos, ctrlSize, + new wxStaticText(this, -1, mTrack->GetName(), ctrlPos, ctrlSize, wxALIGN_CENTRE | wxST_NO_AUTORESIZE | wxSUNKEN_BORDER); #else new wxStaticText(this, -1, mLeftTrack->GetName(), ctrlPos, ctrlSize, wxALIGN_CENTRE | 0x0001 | wxBORDER_SUNKEN); #endif - //v Useful when different tracks are different colors, but not now. + //v Useful when different tracks are different colors, but not now. // mStaticText_TrackName->SetBackgroundColour(this->GetTrackColor()); - + // gain slider at left ctrlPos.x = kDoubleInset; ctrlPos.y += TRACK_NAME_HEIGHT + kDoubleInset; - const int nGainSliderHeight = + const int nGainSliderHeight = size.GetHeight() - ctrlPos.y - kQuadrupleInset; ctrlSize.Set(kLeftSideStackWidth - kQuadrupleInset, nGainSliderHeight); #ifdef EXPERIMENTAL_MIDI_OUT if (mNoteTrack) { - mSlider_Gain = + mSlider_Gain = new MixerTrackSlider( this, ID_SLIDER_GAIN, /* i18n-hint: title of the MIDI Velocity slider */ - _("Velocity"), - ctrlPos, ctrlSize, VEL_SLIDER, true, + _("Velocity"), + ctrlPos, ctrlSize, VEL_SLIDER, true, true, 0.0, wxVERTICAL); } else #endif - mSlider_Gain = + mSlider_Gain = new MixerTrackSlider( - this, ID_SLIDER_GAIN, + this, ID_SLIDER_GAIN, /* i18n-hint: title of the Gain slider, used to adjust the volume */ - _("Gain"), - ctrlPos, ctrlSize, DB_SLIDER, true, + _("Gain"), + ctrlPos, ctrlSize, DB_SLIDER, true, true, 0.0, wxVERTICAL); mSlider_Gain->SetName(_("Gain")); @@ -238,10 +238,10 @@ MixerTrackCluster::MixerTrackCluster(wxWindow* parent, wxBitmap* bitmap = mMixerBoard->GetMusicalInstrumentBitmap(mLeftTrack); #endif wxASSERT(bitmap); - mBitmapButton_MusicalInstrument = - new wxBitmapButton(this, ID_BITMAPBUTTON_MUSICAL_INSTRUMENT, *bitmap, - ctrlPos, ctrlSize, - wxBU_AUTODRAW, wxDefaultValidator, + mBitmapButton_MusicalInstrument = + new wxBitmapButton(this, ID_BITMAPBUTTON_MUSICAL_INSTRUMENT, *bitmap, + ctrlPos, ctrlSize, + wxBU_AUTODRAW, wxDefaultValidator, _("Musical Instrument")); mBitmapButton_MusicalInstrument->SetName(_("Musical Instrument")); @@ -255,12 +255,12 @@ MixerTrackCluster::MixerTrackCluster(wxWindow* parent, if (!(ctrlSize.x & 1)) ctrlSize.x--; - mSlider_Pan = + mSlider_Pan = new MixerTrackSlider( - this, ID_SLIDER_PAN, + this, ID_SLIDER_PAN, /* i18n-hint: Title of the Pan slider, used to move the sound left or right */ - _("Pan"), - ctrlPos, ctrlSize, PAN_SLIDER, true); + _("Pan"), + ctrlPos, ctrlSize, PAN_SLIDER, true); mSlider_Pan->SetName(_("Pan")); this->UpdatePan(); @@ -268,47 +268,47 @@ MixerTrackCluster::MixerTrackCluster(wxWindow* parent, // mute/solo buttons stacked below Pan slider ctrlPos.y += PAN_HEIGHT + kDoubleInset; ctrlSize.Set(mMixerBoard->mMuteSoloWidth, MUTE_SOLO_HEIGHT); - mToggleButton_Mute = - new AButton(this, ID_TOGGLEBUTTON_MUTE, - ctrlPos, ctrlSize, - *(mMixerBoard->mImageMuteUp), *(mMixerBoard->mImageMuteOver), - *(mMixerBoard->mImageMuteDown), *(mMixerBoard->mImageMuteDisabled), + mToggleButton_Mute = + new AButton(this, ID_TOGGLEBUTTON_MUTE, + ctrlPos, ctrlSize, + *(mMixerBoard->mImageMuteUp), *(mMixerBoard->mImageMuteOver), + *(mMixerBoard->mImageMuteDown), *(mMixerBoard->mImageMuteDisabled), true); // toggle button mToggleButton_Mute->SetName(_("Mute")); mToggleButton_Mute->SetAlternateImages( - *(mMixerBoard->mImageMuteUp), *(mMixerBoard->mImageMuteOver), + *(mMixerBoard->mImageMuteUp), *(mMixerBoard->mImageMuteOver), *(mMixerBoard->mImageMuteDown), *(mMixerBoard->mImageMuteDisabled)); this->UpdateMute(); ctrlPos.y += MUTE_SOLO_HEIGHT; - mToggleButton_Solo = - new AButton(this, ID_TOGGLEBUTTON_SOLO, - ctrlPos, ctrlSize, - *(mMixerBoard->mImageSoloUp), *(mMixerBoard->mImageSoloOver), - *(mMixerBoard->mImageSoloDown), *(mMixerBoard->mImageSoloDisabled), + mToggleButton_Solo = + new AButton(this, ID_TOGGLEBUTTON_SOLO, + ctrlPos, ctrlSize, + *(mMixerBoard->mImageSoloUp), *(mMixerBoard->mImageSoloOver), + *(mMixerBoard->mImageSoloDown), *(mMixerBoard->mImageSoloDisabled), true); // toggle button mToggleButton_Solo->SetName(_("Solo")); this->UpdateSolo(); bool bSoloNone = mProject->IsSoloNone(); mToggleButton_Solo->Show(!bSoloNone); - + // meter ctrlPos.y += (bSoloNone ? 0 : MUTE_SOLO_HEIGHT) + kDoubleInset; - const int nMeterHeight = - nGainSliderHeight - + const int nMeterHeight = + nGainSliderHeight - (MUSICAL_INSTRUMENT_HEIGHT_AND_WIDTH + kDoubleInset) - - (PAN_HEIGHT + kDoubleInset) - + (PAN_HEIGHT + kDoubleInset) - (MUTE_SOLO_HEIGHT + (bSoloNone ? 0 : MUTE_SOLO_HEIGHT) + kDoubleInset); ctrlSize.Set(kRightSideStackWidth, nMeterHeight); #ifdef EXPERIMENTAL_MIDI_OUT if (mLeftTrack) { #endif - mMeter = - new Meter(this, -1, // wxWindow* parent, wxWindowID id, + mMeter = + new Meter(this, -1, // wxWindow* parent, wxWindowID id, false, // bool isInput ctrlPos, ctrlSize, // const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, - Meter::MixerTrackCluster); // Style style = HorizontalStereo, + Meter::MixerTrackCluster); // Style style = HorizontalStereo, mMeter->SetName(_("Signal Level Meter")); #ifdef EXPERIMENTAL_MIDI_OUT } else { @@ -339,34 +339,34 @@ MixerTrackCluster::MixerTrackCluster(wxWindow* parent, void MixerTrackCluster::HandleResize() // For wxSizeEvents, update gain slider and meter. { - wxSize scrolledWindowClientSize = this->GetParent()->GetClientSize(); - const int newClusterHeight = + wxSize scrolledWindowClientSize = this->GetParent()->GetClientSize(); + const int newClusterHeight = scrolledWindowClientSize.GetHeight() - kDoubleInset - // nClusterHeight from MixerBoard::UpdateTrackClusters wxSystemSettings::GetMetric(wxSYS_HSCROLL_Y) + // wxScrolledWindow::GetClientSize doesn't account for its scrollbar size. kDoubleInset; - - this->SetSize(-1, newClusterHeight); - // Change only the heights of mSlider_Gain and mMeter. + this->SetSize(-1, newClusterHeight); + + // Change only the heights of mSlider_Gain and mMeter. // But update shown status of mToggleButton_Solo, which affects top of mMeter. - const int nGainSliderHeight = - newClusterHeight - + const int nGainSliderHeight = + newClusterHeight - (kInset + // margin above mStaticText_TrackName TRACK_NAME_HEIGHT + kDoubleInset) - // mStaticText_TrackName + margin kQuadrupleInset; // margin below gain slider - mSlider_Gain->SetSize(-1, nGainSliderHeight); + mSlider_Gain->SetSize(-1, nGainSliderHeight); bool bSoloNone = mProject->IsSoloNone(); mToggleButton_Solo->Show(!bSoloNone); - const int nRequiredHeightAboveMeter = - MUSICAL_INSTRUMENT_HEIGHT_AND_WIDTH + kDoubleInset + - PAN_HEIGHT + kDoubleInset + + const int nRequiredHeightAboveMeter = + MUSICAL_INSTRUMENT_HEIGHT_AND_WIDTH + kDoubleInset + + PAN_HEIGHT + kDoubleInset + MUTE_SOLO_HEIGHT + (bSoloNone ? 0 : MUTE_SOLO_HEIGHT) + kDoubleInset; - const int nMeterY = + const int nMeterY = kDoubleInset + // margin at top - TRACK_NAME_HEIGHT + kDoubleInset + + TRACK_NAME_HEIGHT + kDoubleInset + nRequiredHeightAboveMeter; const int nMeterHeight = nGainSliderHeight - nRequiredHeightAboveMeter; #ifdef EXPERIMENTAL_MIDI_OUT @@ -387,7 +387,7 @@ void MixerTrackCluster::HandleSliderGain(const bool bWantPushState /*= false*/) if (mRightTrack) mRightTrack->SetGain(fValue); - // Update the TrackPanel correspondingly. + // Update the TrackPanel correspondingly. #ifdef EXPERIMENTAL_MIDI_OUT mProject->RefreshTPTrack(mTrack); #else @@ -405,7 +405,7 @@ void MixerTrackCluster::HandleSliderPan(const bool bWantPushState /*= false*/) if (mRightTrack) mRightTrack->SetPan(fValue); - // Update the TrackPanel correspondingly. + // Update the TrackPanel correspondingly. #ifdef EXPERIMENTAL_MIDI_OUT mProject->RefreshTPTrack(mTrack); #else @@ -419,7 +419,7 @@ void MixerTrackCluster::HandleSliderPan(const bool bWantPushState /*= false*/) void MixerTrackCluster::ResetMeter(const bool bResetClipping) { #ifdef EXPERIMENTAL_MIDI_OUT - if (mMeter) + if (mMeter) #endif mMeter->Reset(mLeftTrack->GetRate(), bResetClipping); } @@ -428,7 +428,7 @@ void MixerTrackCluster::ResetMeter(const bool bResetClipping) // These are used by TrackPanel for synchronizing control states, etc. // Update the controls that can be affected by state change. -void MixerTrackCluster::UpdateForStateChange() +void MixerTrackCluster::UpdateForStateChange() { this->UpdateName(); this->UpdatePan(); @@ -443,7 +443,7 @@ void MixerTrackCluster::UpdateName() const wxString newName = mLeftTrack->GetName(); #endif SetName(newName); - mStaticText_TrackName->SetLabel(newName); + mStaticText_TrackName->SetLabel(newName); #if wxUSE_TOOLTIPS mStaticText_TrackName->SetToolTip(newName); #endif @@ -464,9 +464,9 @@ void MixerTrackCluster::UpdateMute() mToggleButton_Mute->SetAlternate(mLeftTrack->GetSolo()); if (mLeftTrack->GetMute()) #endif - mToggleButton_Mute->PushDown(); - else - mToggleButton_Mute->PopUp(); + mToggleButton_Mute->PushDown(); + else + mToggleButton_Mute->PopUp(); } void MixerTrackCluster::UpdateSolo() @@ -477,9 +477,9 @@ void MixerTrackCluster::UpdateSolo() bool bIsSolo = mLeftTrack->GetSolo(); #endif if (bIsSolo) - mToggleButton_Solo->PushDown(); - else - mToggleButton_Solo->PopUp(); + mToggleButton_Solo->PushDown(); + else + mToggleButton_Solo->PopUp(); mToggleButton_Mute->SetAlternate(bIsSolo); } @@ -504,7 +504,7 @@ void MixerTrackCluster::UpdateGain() } mSlider_Gain->SetStyle(DB_SLIDER); #endif - mSlider_Gain->Set(mLeftTrack->GetGain()); + mSlider_Gain->Set(mLeftTrack->GetGain()); } void MixerTrackCluster::UpdateMeter(const double t0, const double t1) @@ -512,22 +512,22 @@ void MixerTrackCluster::UpdateMeter(const double t0, const double t1) #ifdef EXPERIMENTAL_MIDI_OUT // NoteTracks do not (currently) register on meters. It would probably be // a good idea to display 16 channel "active" lights rather than a meter - if (!mLeftTrack) + if (!mLeftTrack) return; #else wxASSERT(mLeftTrack && (mLeftTrack->GetKind() == Track::Wave)); #endif - //vvv Vaughan, 2010-11-27: - // NOTE TO ROGER DANNENBERG: + //vvv Vaughan, 2010-11-27: + // NOTE TO ROGER DANNENBERG: // I undid the mTrack hack in this conditional, as the rest of the method still assumed it's a wavetrack - // so dereferencing mLeftTrack would have gotten a NULL pointer fault. + // so dereferencing mLeftTrack would have gotten a NULL pointer fault. // I really think MixerTrackCluster should be factored for NoteTracks. // REPLY: I think bSuccess prevents dereferencing mLeftTrack, but I will // check. We should talk about whether it's better to factor // MixerTrackCluster or more fully hide track types from MixerTrackCluster. // For now, out change plan produced the following: - // Vaughan, 2011=10-15: There's no bSuccess here, so I don't know what you mean. + // Vaughan, 2011=10-15: There's no bSuccess here, so I don't know what you mean. // But this change is consistent with the others for EXPERIMENTAL_MIDI_OUT, so I accept it. if ((t0 < 0.0) || (t1 < 0.0) || (t0 >= t1) || // bad time value or nothing to show #ifdef EXPERIMENTAL_MIDI_OUT @@ -536,26 +536,26 @@ void MixerTrackCluster::UpdateMeter(const double t0, const double t1) ((mMixerBoard->HasSolo() || mLeftTrack->GetMute()) && !mLeftTrack->GetSolo())) #endif { - //v Vaughan, 2011-02-25: Moved the update back to TrackPanel::OnTimer() as it helps with + //v Vaughan, 2011-02-25: Moved the update back to TrackPanel::OnTimer() as it helps with // playback issues reported by Bill and noted on Bug 258, so no assert. - // Vaughan, 2011-02-04: Now that we're updating all meters from audacityAudioCallback, - // this causes an assert if you click Mute while playing, because ResetMeter() resets - // the timer, and wxTimerbase says that can only be done from main thread -- + // Vaughan, 2011-02-04: Now that we're updating all meters from audacityAudioCallback, + // this causes an assert if you click Mute while playing, because ResetMeter() resets + // the timer, and wxTimerbase says that can only be done from main thread -- // but it seems to work fine. this->ResetMeter(false); return; } - // Vaughan, 2010-11-27: + // Vaughan, 2010-11-27: // This commented out code is flawed. Mistaken understanding of "frame" vs "window". // Caused me to override Meter::UpdateDisplay(). - // But I think it's got a good idea, of calling WaveTracks' GetMinMax and GetRMS + // But I think it's got a good idea, of calling WaveTracks' GetMinMax and GetRMS // instead of passing in all the data and asking the meter to derive peak and rms. - // May be worth revisiting as I think it should perform better, because it uses the min/max/rms - // stored in blockfiles, rather than calculating them, but for now, changing it to use the + // May be worth revisiting as I think it should perform better, because it uses the min/max/rms + // stored in blockfiles, rather than calculating them, but for now, changing it to use the // original Meter::UpdateDisplay(). New code is below the previous (now commented out). - // - //const int kFramesPerBuffer = 4; + // + //const int kFramesPerBuffer = 4; //float min; // dummy, since it's not shown in meters //float* maxLeft = new float[kFramesPerBuffer]; //float* rmsLeft = new float[kFramesPerBuffer]; @@ -574,16 +574,16 @@ void MixerTrackCluster::UpdateMeter(const double t0, const double t1) //int i = 0; //while (bSuccess && (i < kFramesPerBuffer)) //{ - // bSuccess &= - // mLeftTrack->GetMinMax(&min, &(maxLeft[i]), dFrameT0, dFrameT1) && + // bSuccess &= + // mLeftTrack->GetMinMax(&min, &(maxLeft[i]), dFrameT0, dFrameT1) && // mLeftTrack->GetRMS(&(rmsLeft[i]), dFrameT0, dFrameT1); // if (bSuccess && mRightTrack) // bSuccess &= - // mRightTrack->GetMinMax(&min, &(maxRight[i]), dFrameT0, dFrameT1) && + // mRightTrack->GetMinMax(&min, &(maxRight[i]), dFrameT0, dFrameT1) && // mRightTrack->GetRMS(&(rmsRight[i]), dFrameT0, dFrameT1); // else // { - // // Mono: Start with raw values same as left. + // // Mono: Start with raw values same as left. // // To be modified by bWantPostFadeValues and channel pan/gain. // maxRight[i] = maxLeft[i]; // rmsRight[i] = rmsLeft[i]; @@ -609,9 +609,9 @@ void MixerTrackCluster::UpdateMeter(const double t0, const double t1) // } // mMeter->UpdateDisplay( // 2, // If mono, show left track values in both meters, as in MeterToolBar, rather than kNumChannels. - // kFramesPerBuffer, - // maxLeft, rmsLeft, - // maxRight, rmsRight, + // kFramesPerBuffer, + // maxLeft, rmsLeft, + // maxRight, rmsRight, // mLeftTrack->TimeToLongSamples(t1 - t0)); //} // @@ -627,7 +627,7 @@ void MixerTrackCluster::UpdateMeter(const double t0, const double t1) bool bSuccess = mLeftTrack->Get((samplePtr)tempFloatsArray, floatSample, startSample, nFrames); if (bSuccess) { - // We always pass a stereo sample array to the meter, as it shows 2 channels. + // We always pass a stereo sample array to the meter, as it shows 2 channels. // Mono shows same in both meters. // Since we're not mixing, need to duplicate same signal for "right" channel in mono case. meterFloatsArray = new float[2 * nFrames]; @@ -636,7 +636,7 @@ void MixerTrackCluster::UpdateMeter(const double t0, const double t1) for (int index = 0; index < nFrames; index++) meterFloatsArray[2 * index] = tempFloatsArray[index]; - if (mRightTrack) + if (mRightTrack) bSuccess = mRightTrack->Get((samplePtr)tempFloatsArray, floatSample, startSample, nFrames); if (bSuccess) @@ -648,7 +648,7 @@ void MixerTrackCluster::UpdateMeter(const double t0, const double t1) //const bool bWantPostFadeValues = true; //v Turn this into a checkbox on MixerBoard? For now, always true. //if (bSuccess && bWantPostFadeValues) if (bSuccess) - { + { //vvv Need to apply envelope, too? See Mixer::MixSameRate. float gain = mLeftTrack->GetChannelGain(0); if (gain < 1.0) @@ -693,7 +693,7 @@ wxColour MixerTrackCluster::GetTrackColor() void MixerTrackCluster::HandleSelect(const bool bShiftDown) { - if (bShiftDown) + if (bShiftDown) { // ShiftDown => Just toggle selection on this track. #ifdef EXPERIMENTAL_MIDI_OUT @@ -707,7 +707,7 @@ void MixerTrackCluster::HandleSelect(const bool bShiftDown) mRightTrack->SetSelected(bSelect); // Refresh only this MixerTrackCluster and WaveTrack in TrackPanel. - this->Refresh(true); + this->Refresh(true); #ifdef EXPERIMENTAL_MIDI_OUT mProject->RefreshTPTrack(mTrack); #else @@ -728,7 +728,7 @@ void MixerTrackCluster::HandleSelect(const bool bShiftDown) if (mProject->GetSel0() >= mProject->GetSel1()) { - // No range previously selected, so use the range of this track. + // No range previously selected, so use the range of this track. #ifdef EXPERIMENTAL_MIDI_OUT mProject->mViewInfo.sel0 = mTrack->GetOffset(); mProject->mViewInfo.sel1 = mTrack->GetEndTime(); @@ -739,8 +739,8 @@ void MixerTrackCluster::HandleSelect(const bool bShiftDown) } // Exclusive select, so refresh all MixerTrackClusters. - // This could just be a call to wxWindow::Refresh, but this is - // more efficient and when ProjectLogo is shown as background, + // This could just be a call to wxWindow::Refresh, but this is + // more efficient and when ProjectLogo is shown as background, // it's necessary to prevent blinking. mMixerBoard->RefreshTrackClusters(false); } @@ -753,7 +753,7 @@ void MixerTrackCluster::OnKeyEvent(wxKeyEvent & event) void MixerTrackCluster::OnMouseEvent(wxMouseEvent& event) { - if (event.ButtonUp()) + if (event.ButtonUp()) this->HandleSelect(event.ShiftDown()); else event.Skip(); @@ -804,12 +804,12 @@ void MixerTrackCluster::OnSlider_Gain(wxCommandEvent& WXUNUSED(event)) //{ //int sliderValue = (int)(mSlider_Gain->Get()); //v mSlider_Gain->GetValue(); //#ifdef __WXMSW__ - // // Negate because wxSlider on Windows has min at top, max at bottom. - // // mSlider_Gain->GetValue() is in [-6,36]. wxSlider has min at top, so this is [-36dB,6dB]. + // // Negate because wxSlider on Windows has min at top, max at bottom. + // // mSlider_Gain->GetValue() is in [-6,36]. wxSlider has min at top, so this is [-36dB,6dB]. // sliderValue = -sliderValue; //#endif //wxString str = _("Gain: "); - //if (sliderValue > 0) + //if (sliderValue > 0) // str += "+"; //str += wxString::Format("%d dB", sliderValue); //mSlider_Gain->SetToolTip(str); @@ -830,7 +830,7 @@ void MixerTrackCluster::OnButton_Mute(wxCommandEvent& WXUNUSED(event)) mToggleButton_Mute->SetAlternate(mLeftTrack->GetSolo()); #endif - // Update the TrackPanel correspondingly. + // Update the TrackPanel correspondingly. if (mProject->IsSoloSimple()) { // Have to refresh all tracks. @@ -838,7 +838,7 @@ void MixerTrackCluster::OnButton_Mute(wxCommandEvent& WXUNUSED(event)) mProject->RedrawProject(); } else - // Update only the changed track. + // Update only the changed track. #ifdef EXPERIMENTAL_MIDI_OUT mProject->RefreshTPTrack(mTrack); #else @@ -857,7 +857,7 @@ void MixerTrackCluster::OnButton_Solo(wxCommandEvent& WXUNUSED(event)) #endif mToggleButton_Mute->SetAlternate(bIsSolo); - // Update the TrackPanel correspondingly. + // Update the TrackPanel correspondingly. if (mProject->IsSoloSimple()) { // Have to refresh all tracks. @@ -866,7 +866,7 @@ void MixerTrackCluster::OnButton_Solo(wxCommandEvent& WXUNUSED(event)) mProject->RedrawProject(); } else - // Update only the changed track. + // Update only the changed track. #ifdef EXPERIMENTAL_MIDI_OUT mProject->RefreshTPTrack(mTrack); #else @@ -885,14 +885,14 @@ MusicalInstrument::MusicalInstrument(wxBitmap* pBitmap, const wxString strXPMfil wxString strFilename = strXPMfilename; strFilename.MakeLower(); // Make sure, so we don't have to do case insensitive comparison. wxString strKeyword; - while ((nUnderscoreIndex = strFilename.Find(wxT('_'))) != -1) + while ((nUnderscoreIndex = strFilename.Find(wxT('_'))) != -1) { strKeyword = strFilename.Left(nUnderscoreIndex); mKeywords.Add(strKeyword); strFilename = strFilename.Mid(nUnderscoreIndex + 1); } if (!strFilename.IsEmpty()) // Skip trailing underscores. - mKeywords.Add(strFilename); // Add the last one. + mKeywords.Add(strFilename); // Add the last one. } MusicalInstrument::~MusicalInstrument() @@ -904,9 +904,9 @@ MusicalInstrument::~MusicalInstrument() WX_DEFINE_OBJARRAY(MusicalInstrumentArray); -// class MixerBoardScrolledWindow +// class MixerBoardScrolledWindow -// wxScrolledWindow ignores mouse clicks in client area, +// wxScrolledWindow ignores mouse clicks in client area, // but they don't get passed to Mixerboard. // We need to catch them to deselect all track clusters. @@ -914,10 +914,10 @@ BEGIN_EVENT_TABLE(MixerBoardScrolledWindow, wxScrolledWindow) EVT_MOUSE_EVENTS(MixerBoardScrolledWindow::OnMouseEvent) END_EVENT_TABLE() -MixerBoardScrolledWindow::MixerBoardScrolledWindow(AudacityProject* project, - MixerBoard* parent, wxWindowID id /*= -1*/, - const wxPoint& pos /*= wxDefaultPosition*/, - const wxSize& size /*= wxDefaultSize*/, +MixerBoardScrolledWindow::MixerBoardScrolledWindow(AudacityProject* project, + MixerBoard* parent, wxWindowID id /*= -1*/, + const wxPoint& pos /*= wxDefaultPosition*/, + const wxSize& size /*= wxDefaultSize*/, long style /*= wxHSCROLL | wxVSCROLL*/) : wxScrolledWindow(parent, id, pos, size, style) { @@ -931,9 +931,9 @@ MixerBoardScrolledWindow::~MixerBoardScrolledWindow() void MixerBoardScrolledWindow::OnMouseEvent(wxMouseEvent& event) { - if (event.ButtonUp()) + if (event.ButtonUp()) { - //v Even when I implement MixerBoard::OnMouseEvent and call event.Skip() + //v Even when I implement MixerBoard::OnMouseEvent and call event.Skip() // here, MixerBoard::OnMouseEvent never gets called. // So, added mProject to MixerBoardScrolledWindow and just directly do what's needed here. mProject->SelectNone(); @@ -948,16 +948,16 @@ void MixerBoardScrolledWindow::OnMouseEvent(wxMouseEvent& event) #define MIXER_BOARD_MIN_HEIGHT 460 // Min width is one cluster wide, plus margins. -#define MIXER_BOARD_MIN_WIDTH kTripleInset + kMixerTrackClusterWidth + kTripleInset +#define MIXER_BOARD_MIN_WIDTH kTripleInset + kMixerTrackClusterWidth + kTripleInset BEGIN_EVENT_TABLE(MixerBoard, wxWindow) EVT_SIZE(MixerBoard::OnSize) END_EVENT_TABLE() -MixerBoard::MixerBoard(AudacityProject* pProject, - wxFrame* parent, - const wxPoint& pos /*= wxDefaultPosition*/, +MixerBoard::MixerBoard(AudacityProject* pProject, + wxFrame* parent, + const wxPoint& pos /*= wxDefaultPosition*/, const wxSize& size /*= wxDefaultSize*/) : wxWindow(parent, -1, pos, size) { @@ -980,22 +980,22 @@ MixerBoard::MixerBoard(AudacityProject* pProject, // private data members this->LoadMusicalInstruments(); // Set up mMusicalInstruments. mProject = pProject; - - mScrolledWindow = + + mScrolledWindow = new MixerBoardScrolledWindow( pProject, // AudacityProject* project, - this, -1, // wxWindow* parent, wxWindowID id = -1, - this->GetClientAreaOrigin(), // const wxPoint& pos = wxDefaultPosition, - size, // const wxSize& size = wxDefaultSize, + this, -1, // wxWindow* parent, wxWindowID id = -1, + this->GetClientAreaOrigin(), // const wxPoint& pos = wxDefaultPosition, + size, // const wxSize& size = wxDefaultSize, wxHSCROLL); // long style = wxHSCROLL | wxVSCROLL, const wxString& name = "scrolledWindow") // Set background color to same as TrackPanel background. #ifdef EXPERIMENTAL_THEMING mScrolledWindow->SetBackgroundColour(this->GetParent()->GetBackgroundColour()); #else - mScrolledWindow->SetBackgroundColour(wxSystemSettings::GetColour(wxSYS_COLOUR_3DSHADOW)); + mScrolledWindow->SetBackgroundColour(wxSystemSettings::GetColour(wxSYS_COLOUR_3DSHADOW)); #endif - + mScrolledWindow->SetScrollRate(10, 0); // no vertical scroll mScrolledWindow->SetVirtualSize(size); @@ -1030,15 +1030,15 @@ MixerBoard::~MixerBoard() } // Reassign mixer input strips (MixerTrackClusters) to Track Clusters -// both have the same order. +// both have the same order. // If EXPERIMENTAL_MIDI_OUT, then Note Tracks appear in the -// mixer, and we must be able to convert and reuse a MixerTrackCluster +// mixer, and we must be able to convert and reuse a MixerTrackCluster // from audio to midi or midi to audio. This task is handled by // UpdateForStateChange(). // -void MixerBoard::UpdateTrackClusters() +void MixerBoard::UpdateTrackClusters() { - if (!mImageMuteUp) + if (!mImageMuteUp) this->CreateMuteSoloImages(); const int nClusterHeight = mScrolledWindow->GetClientSize().GetHeight() - kDoubleInset; @@ -1053,17 +1053,17 @@ void MixerBoard::UpdateTrackClusters() while (pLeftTrack) { pRightTrack = pLeftTrack->GetLinked() ? iterTracks.Next() : NULL; - if (pLeftTrack->GetKind() == Track::Wave + if (pLeftTrack->GetKind() == Track::Wave #ifdef EXPERIMENTAL_MIDI_OUT || pLeftTrack->GetKind() == Track::Note #endif - ) + ) { if (nClusterIndex < nClusterCount) { - // Already showing it. + // Already showing it. // Track clusters are maintained in the same order as the WaveTracks. - // Track pointers can change for the "same" track for different states + // Track pointers can change for the "same" track for different states // on the undo stack, so update the pointers and display name. #ifdef EXPERIMENTAL_MIDI_OUT if (pLeftTrack->GetKind() == Track::Note) { @@ -1084,14 +1084,14 @@ void MixerBoard::UpdateTrackClusters() // Not already showing it. Add a new MixerTrackCluster. wxPoint clusterPos( (kInset + // extra inset to left for first one, so it's double - (nClusterIndex * + (nClusterIndex * (kInset + kMixerTrackClusterWidth)) + // left margin and width for each to its left kInset), // plus left margin for new cluster - kInset); + kInset); wxSize clusterSize(kMixerTrackClusterWidth, nClusterHeight); - pMixerTrackCluster = - new MixerTrackCluster(mScrolledWindow, this, mProject, - (WaveTrack*)pLeftTrack, (WaveTrack*)pRightTrack, + pMixerTrackCluster = + new MixerTrackCluster(mScrolledWindow, this, mProject, + (WaveTrack*)pLeftTrack, (WaveTrack*)pRightTrack, clusterPos, clusterSize); if (pMixerTrackCluster) mMixerTrackClusters.Add(pMixerTrackCluster); @@ -1109,9 +1109,9 @@ void MixerBoard::UpdateTrackClusters() } else if (nClusterIndex < nClusterCount) { - // We've got too many clusters. + // We've got too many clusters. // This can happen only on things like Undo New Audio Track or Undo Import - // that don't call RemoveTrackCluster explicitly. + // that don't call RemoveTrackCluster explicitly. // We've already updated the track pointers for the clusters to the left, so just remove all the rest. // Keep nClusterIndex constant and successively delete from left to right. for (unsigned int nCounter = nClusterIndex; nCounter < nClusterCount; nCounter++) @@ -1125,7 +1125,7 @@ void MixerBoard::UpdateTrackClusters() int MixerBoard::GetTrackClustersWidth() { - return + return kInset + // extra margin at left for first one (mMixerTrackClusters.GetCount() * // number of tracks times (kInset + kMixerTrackClusterWidth)) + // left margin and width for each @@ -1133,16 +1133,16 @@ int MixerBoard::GetTrackClustersWidth() } #ifdef EXPERIMENTAL_MIDI_OUT -void MixerBoard::MoveTrackCluster(const Track* pTrack, +void MixerBoard::MoveTrackCluster(const Track* pTrack, bool bUp) // Up in TrackPanel is left in MixerBoard. #else -void MixerBoard::MoveTrackCluster(const WaveTrack* pTrack, +void MixerBoard::MoveTrackCluster(const WaveTrack* pTrack, bool bUp) // Up in TrackPanel is left in MixerBoard. #endif { MixerTrackCluster* pMixerTrackCluster; int nIndex = FindMixerTrackCluster(pTrack, &pMixerTrackCluster); - if (pMixerTrackCluster == NULL) + if (pMixerTrackCluster == NULL) return; // Couldn't find it. wxPoint pos; @@ -1160,7 +1160,7 @@ void MixerBoard::MoveTrackCluster(const WaveTrack* pTrack, } else { // Move it down (right). - if (((unsigned int)nIndex + 1) >= mMixerTrackClusters.GetCount()) + if (((unsigned int)nIndex + 1) >= mMixerTrackClusters.GetCount()) return; // It's already last. pos = pMixerTrackCluster->GetPosition(); @@ -1181,7 +1181,7 @@ void MixerBoard::RemoveTrackCluster(const WaveTrack* pTrack) // Find and destroy. MixerTrackCluster* pMixerTrackCluster; int nIndex = this->FindMixerTrackCluster(pTrack, &pMixerTrackCluster); - if (pMixerTrackCluster == NULL) + if (pMixerTrackCluster == NULL) return; // Couldn't find it. mMixerTrackClusters.RemoveAt(nIndex); @@ -1193,7 +1193,7 @@ void MixerBoard::RemoveTrackCluster(const WaveTrack* pTrack) for (unsigned int i = nIndex; i < mMixerTrackClusters.GetCount(); i++) { pos = mMixerTrackClusters[i]->GetPosition(); - targetX = + targetX = kInset + // extra inset to left for first one, so it's double (i * (kInset + kMixerTrackClusterWidth)) + // left margin and width for each kInset; // plus left margin for this cluster @@ -1221,8 +1221,8 @@ wxBitmap* MixerBoard::GetMusicalInstrumentBitmap(const WaveTrack* pLeftTrack) if (mMusicalInstruments.IsEmpty()) return NULL; - // random choice: return mMusicalInstruments[(int)pLeftTrack % mMusicalInstruments.GetCount()].mBitmap; - + // random choice: return mMusicalInstruments[(int)pLeftTrack % mMusicalInstruments.GetCount()].mBitmap; + #ifdef EXPERIMENTAL_MIDI_OUT const wxString strTrackName(name.MakeLower()); #else @@ -1246,16 +1246,16 @@ wxBitmap* MixerBoard::GetMusicalInstrumentBitmap(const WaveTrack* pLeftTrack) for (nKeywordIndex = 0; nKeywordIndex < nNumKeywords; nKeywordIndex++) if (strTrackName.Contains(mMusicalInstruments[nInstrIndex].mKeywords[nKeywordIndex])) { - nScore += - nPointsPerMatch + + nScore += + nPointsPerMatch + // Longer keywords get more points. (2 * mMusicalInstruments[nInstrIndex].mKeywords[nKeywordIndex].Length()); } } - // Choose later one if just matching nBestScore, for better variety, + // Choose later one if just matching nBestScore, for better variety, // and so default works as last element. - if (nScore >= nBestScore) + if (nScore >= nBestScore) { nBestScore = nScore; nBestItemIndex = nInstrIndex; @@ -1264,12 +1264,12 @@ wxBitmap* MixerBoard::GetMusicalInstrumentBitmap(const WaveTrack* pLeftTrack) return mMusicalInstruments[nBestItemIndex].mBitmap; } -bool MixerBoard::HasSolo() -{ +bool MixerBoard::HasSolo() +{ TrackListIterator iterTracks(mTracks); Track* pTrack; - for (pTrack = iterTracks.First(); pTrack; pTrack = iterTracks.Next()) - if (pTrack->GetSolo()) + for (pTrack = iterTracks.First(); pTrack; pTrack = iterTracks.Next()) + if (pTrack->GetSolo()) return true; return false; } @@ -1282,7 +1282,7 @@ void MixerBoard::RefreshTrackCluster(const WaveTrack* pTrack, bool bEraseBackgro { MixerTrackCluster* pMixerTrackCluster; this->FindMixerTrackCluster(pTrack, &pMixerTrackCluster); - if (pMixerTrackCluster) + if (pMixerTrackCluster) pMixerTrackCluster->Refresh(bEraseBackground); } @@ -1317,7 +1317,7 @@ void MixerBoard::UpdateName(const WaveTrack* pTrack) { MixerTrackCluster* pMixerTrackCluster; this->FindMixerTrackCluster(pTrack, &pMixerTrackCluster); - if (pMixerTrackCluster) + if (pMixerTrackCluster) pMixerTrackCluster->UpdateName(); } @@ -1327,16 +1327,16 @@ void MixerBoard::UpdateMute(const Track* pTrack /*= NULL*/) // NULL means update void MixerBoard::UpdateMute(const WaveTrack* pTrack /*= NULL*/) // NULL means update for all tracks. #endif { - if (pTrack == NULL) + if (pTrack == NULL) { for (unsigned int i = 0; i < mMixerTrackClusters.GetCount(); i++) mMixerTrackClusters[i]->UpdateMute(); } - else + else { MixerTrackCluster* pMixerTrackCluster; FindMixerTrackCluster(pTrack, &pMixerTrackCluster); - if (pMixerTrackCluster) + if (pMixerTrackCluster) pMixerTrackCluster->UpdateMute(); } } @@ -1347,16 +1347,16 @@ void MixerBoard::UpdateSolo(const Track* pTrack /*= NULL*/) // NULL means update void MixerBoard::UpdateSolo(const WaveTrack* pTrack /*= NULL*/) // NULL means update for all tracks. #endif { - if (pTrack == NULL) + if (pTrack == NULL) { for (unsigned int i = 0; i < mMixerTrackClusters.GetCount(); i++) mMixerTrackClusters[i]->UpdateSolo(); } - else + else { MixerTrackCluster* pMixerTrackCluster; FindMixerTrackCluster(pTrack, &pMixerTrackCluster); - if (pMixerTrackCluster) + if (pMixerTrackCluster) pMixerTrackCluster->UpdateSolo(); } } @@ -1369,7 +1369,7 @@ void MixerBoard::UpdatePan(const WaveTrack* pTrack) { MixerTrackCluster* pMixerTrackCluster; FindMixerTrackCluster(pTrack, &pMixerTrackCluster); - if (pMixerTrackCluster) + if (pMixerTrackCluster) pMixerTrackCluster->UpdatePan(); } @@ -1381,7 +1381,7 @@ void MixerBoard::UpdateGain(const WaveTrack* pTrack) { MixerTrackCluster* pMixerTrackCluster; FindMixerTrackCluster(pTrack, &pMixerTrackCluster); - if (pMixerTrackCluster) + if (pMixerTrackCluster) pMixerTrackCluster->UpdateGain(); } @@ -1396,8 +1396,8 @@ void MixerBoard::UpdateMeters(const double t1, const bool bLoopedPlay) return; } - // In loopedPlay mode, at the end of the loop, mPrevT1 is set to - // selection end, so the next t1 will be less, but we do want to + // In loopedPlay mode, at the end of the loop, mPrevT1 is set to + // selection end, so the next t1 will be less, but we do want to // keep updating the meters. if (t1 <= mPrevT1) { @@ -1415,7 +1415,7 @@ void MixerBoard::UpdateMeters(const double t1, const bool bLoopedPlay) void MixerBoard::UpdateWidth() { - int newWidth = this->GetTrackClustersWidth(); + int newWidth = this->GetTrackClustersWidth(); // Min width is one cluster wide, plus margins. if (newWidth < MIXER_BOARD_MIN_WIDTH) @@ -1433,7 +1433,7 @@ void MixerBoard::CreateMuteSoloImages() { // Much of this is taken from TrackLabel::DrawMuteSolo. wxMemoryDC dc; - wxString str = _("Mute"); + wxString str = _("Mute"); int textWidth, textHeight; int fontSize = 10; @@ -1504,7 +1504,7 @@ void MixerBoard::CreateMuteSoloImages() } #ifdef EXPERIMENTAL_MIDI_OUT -int MixerBoard::FindMixerTrackCluster(const Track* pTrack, +int MixerBoard::FindMixerTrackCluster(const Track* pTrack, MixerTrackCluster** hMixerTrackCluster) const #else int MixerBoard::FindMixerTrackCluster(const WaveTrack* pLeftTrack, @@ -1540,7 +1540,7 @@ void MixerBoard::LoadMusicalInstruments() AColor::Bevel(dc, false, bev); pMusicalInstrument = new MusicalInstrument(bitmap, wxT("acoustic_guitar_gtr")); mMusicalInstruments.Add(pMusicalInstrument); - + bitmap = new wxBitmap((const char**)acoustic_piano_pno_xpm); dc.SelectObject(*bitmap); AColor::Bevel(dc, false, bev); @@ -1565,7 +1565,7 @@ void MixerBoard::LoadMusicalInstruments() AColor::Bevel(dc, false, bev); pMusicalInstrument = new MusicalInstrument(bitmap, wxT("drums_dr")); mMusicalInstruments.Add(pMusicalInstrument); - + bitmap = new wxBitmap((const char**)electric_bass_guitar_bs_gtr_xpm); dc.SelectObject(*bitmap); AColor::Bevel(dc, false, bev); @@ -1668,7 +1668,7 @@ void MixerBoard::LoadMusicalInstruments() // This one must be last, so it wins when best score is 0. - bitmap = new wxBitmap((const char**)_default_instrument_xpm); + bitmap = new wxBitmap((const char**)_default_instrument_xpm); dc.SelectObject(*bitmap); AColor::Bevel(dc, false, bev); pMusicalInstrument = new MusicalInstrument(bitmap, wxEmptyString); @@ -1681,7 +1681,7 @@ void MixerBoard::OnSize(wxSizeEvent &evt) { // this->FitInside() doesn't work, and it doesn't happen automatically. Is wxScrolledWindow wrong? mScrolledWindow->SetSize(evt.GetSize()); - + this->ResizeTrackClusters(); this->RefreshTrackClusters(true); } @@ -1696,27 +1696,27 @@ BEGIN_EVENT_TABLE(MixerBoardFrame, wxFrame) END_EVENT_TABLE() // Default to fitting one track. -const wxSize kDefaultSize = - wxSize(MIXER_BOARD_MIN_WIDTH, MIXER_BOARD_MIN_HEIGHT); +const wxSize kDefaultSize = + wxSize(MIXER_BOARD_MIN_WIDTH, MIXER_BOARD_MIN_HEIGHT); MixerBoardFrame::MixerBoardFrame(AudacityProject* parent) : wxFrame(parent, -1, - wxString::Format(_("Audacity Mixer Board%s"), - ((parent->GetName() == wxEmptyString) ? - wxT("") : + wxString::Format(_("Audacity Mixer Board%s"), + ((parent->GetName() == wxEmptyString) ? + wxT("") : wxString::Format(wxT(" - %s"), - parent->GetName().c_str()).c_str())), - wxDefaultPosition, kDefaultSize, + parent->GetName().c_str()).c_str())), + wxDefaultPosition, kDefaultSize, //vvv Bug in wxFRAME_FLOAT_ON_PARENT: - // If both the project frame and MixerBoardFrame are minimized and you restore MixerBoardFrame, - // you can't restore project frame until you close MixerBoardFrame, but then project frame and + // If both the project frame and MixerBoardFrame are minimized and you restore MixerBoardFrame, + // you can't restore project frame until you close MixerBoardFrame, but then project frame and // MixerBoardFrame are restored but MixerBoardFrame is unresponsive because it thinks it's not shown. // wxDEFAULT_FRAME_STYLE | wxFRAME_FLOAT_ON_PARENT) wxDEFAULT_FRAME_STYLE) { mMixerBoard = new MixerBoard(parent, this, wxDefaultPosition, kDefaultSize); - - this->SetSizeHints(MIXER_BOARD_MIN_WIDTH, MIXER_BOARD_MIN_HEIGHT); + + this->SetSizeHints(MIXER_BOARD_MIN_WIDTH, MIXER_BOARD_MIN_HEIGHT); mMixerBoard->UpdateTrackClusters(); diff --git a/src/MixerBoard.h b/src/MixerBoard.h index c6d8025b4..eb36692ef 100644 --- a/src/MixerBoard.h +++ b/src/MixerBoard.h @@ -26,11 +26,11 @@ #include "widgets/ASlider.h" #include "widgets/Meter.h" -// containment hierarchy: +// containment hierarchy: // MixerBoardFrame -> MixerBoard -> MixerBoardScrolledWindow -> MixerTrackCluster(s) -// MixerTrackSlider is a subclass just to override OnMouseEvent, +// MixerTrackSlider is a subclass just to override OnMouseEvent, // so we can know when adjustment ends, so we can PushState only then. class MixerTrackSlider : public ASlider { @@ -38,12 +38,12 @@ public: MixerTrackSlider(wxWindow * parent, wxWindowID id, wxString name, - const wxPoint & pos, + const wxPoint & pos, const wxSize & size, int style = FRAC_SLIDER, bool popup = true, bool canUseShift = true, - float stepValue = STEP_CONTINUOUS, + float stepValue = STEP_CONTINUOUS, int orientation = wxHORIZONTAL); virtual ~MixerTrackSlider() {}; @@ -68,13 +68,13 @@ class NoteTrack; #endif class WaveTrack; -class MixerTrackCluster : public wxPanel -{ +class MixerTrackCluster : public wxPanel +{ public: - MixerTrackCluster(wxWindow* parent, - MixerBoard* grandParent, AudacityProject* project, - WaveTrack* pLeftTrack, WaveTrack* pRightTrack = NULL, - const wxPoint& pos = wxDefaultPosition, + MixerTrackCluster(wxWindow* parent, + MixerBoard* grandParent, AudacityProject* project, + WaveTrack* pLeftTrack, WaveTrack* pRightTrack = NULL, + const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize); virtual ~MixerTrackCluster() {}; @@ -114,18 +114,18 @@ private: public: #ifdef EXPERIMENTAL_MIDI_OUT - // mTrack is redundant, but simplifies code that operates on either + // mTrack is redundant, but simplifies code that operates on either // mLeftTrack or mNoteTrack. Track* mTrack; // either mLeftTrack or mNoteTrack, whichever is not NULL #endif WaveTrack* mLeftTrack; // NULL if Note Track WaveTrack* mRightTrack; // NULL if mono - //vvv Vaughan, 2010-11-05: - // I suggest that when this is no longer experimental, rather than all these #ifdef's, - // this be done by factoring, i.e., add two subclasses to MixerTrackCluster, - // MixerNoteTrackCluster and MixerWaveTrackCluster, such that all the common - // code is in the parent, and these #ifdef's are only around + //vvv Vaughan, 2010-11-05: + // I suggest that when this is no longer experimental, rather than all these #ifdef's, + // this be done by factoring, i.e., add two subclasses to MixerTrackCluster, + // MixerNoteTrackCluster and MixerWaveTrackCluster, such that all the common + // code is in the parent, and these #ifdef's are only around // MixerNoteTrackCluster rather than sprinkled throughout MixerTrackCluster. #ifdef EXPERIMENTAL_MIDI_OUT NoteTrack* mNoteTrack; // NULL if Wave Track @@ -151,7 +151,7 @@ public: WX_DEFINE_ARRAY(MixerTrackCluster*, MixerTrackClusterArray); -class MusicalInstrument +class MusicalInstrument { public: MusicalInstrument(wxBitmap* pBitmap, const wxString strXPMfilename); @@ -164,23 +164,23 @@ WX_DECLARE_OBJARRAY(MusicalInstrument, MusicalInstrumentArray); -// wxScrolledWindow ignores mouse clicks in client area, +// wxScrolledWindow ignores mouse clicks in client area, // but they don't get passed to Mixerboard. // We need to catch them to deselect all track clusters. -class MixerBoardScrolledWindow : public wxScrolledWindow +class MixerBoardScrolledWindow : public wxScrolledWindow { -public: - MixerBoardScrolledWindow(AudacityProject* project, - MixerBoard* parent, wxWindowID id = -1, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, +public: + MixerBoardScrolledWindow(AudacityProject* project, + MixerBoard* parent, wxWindowID id = -1, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, long style = wxHSCROLL | wxVSCROLL); virtual ~MixerBoardScrolledWindow(); private: void OnMouseEvent(wxMouseEvent& event); -private: +private: MixerBoard* mMixerBoard; AudacityProject* mProject; @@ -192,20 +192,20 @@ public: class MixerBoardFrame; class TrackList; -class MixerBoard : public wxWindow -{ +class MixerBoard : public wxWindow +{ friend class MixerBoardFrame; public: - MixerBoard(AudacityProject* pProject, - wxFrame* parent, - const wxPoint& pos = wxDefaultPosition, + MixerBoard(AudacityProject* pProject, + wxFrame* parent, + const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize); virtual ~MixerBoard(); // Add clusters for any tracks we're not yet showing. - // Update pointers for tracks we're aleady showing. - void UpdateTrackClusters(); + // Update pointers for tracks we're aleady showing. + void UpdateTrackClusters(); int GetTrackClustersWidth(); #ifdef EXPERIMENTAL_MIDI_OUT @@ -247,7 +247,7 @@ public: void UpdatePan(const WaveTrack* pTrack); void UpdateGain(const WaveTrack* pTrack); #endif - + void UpdateMeters(const double t1, const bool bLoopedPlay); void UpdateWidth(); @@ -255,10 +255,10 @@ public: private: void CreateMuteSoloImages(); #ifdef EXPERIMENTAL_MIDI_OUT - int FindMixerTrackCluster(const Track* pTrack, + int FindMixerTrackCluster(const Track* pTrack, MixerTrackCluster** hMixerTrackCluster) const; #else - int FindMixerTrackCluster(const WaveTrack* pLeftTrack, + int FindMixerTrackCluster(const WaveTrack* pLeftTrack, MixerTrackCluster** hMixerTrackCluster) const; #endif void LoadMusicalInstruments(); @@ -283,9 +283,9 @@ public: private: // Track clusters are maintained in the same order as the WaveTracks. - MixerTrackClusterArray mMixerTrackClusters; + MixerTrackClusterArray mMixerTrackClusters; - MusicalInstrumentArray mMusicalInstruments; + MusicalInstrumentArray mMusicalInstruments; AudacityProject* mProject; MixerBoardScrolledWindow* mScrolledWindow; // Holds the MixerTrackClusters and handles scrolling. double mPrevT1; @@ -296,8 +296,8 @@ public: }; -class MixerBoardFrame : public wxFrame -{ +class MixerBoardFrame : public wxFrame +{ public: MixerBoardFrame(AudacityProject* parent); virtual ~MixerBoardFrame(); diff --git a/src/NoteTrack.cpp b/src/NoteTrack.cpp index 736521ec8..0be71aaab 100644 --- a/src/NoteTrack.cpp +++ b/src/NoteTrack.cpp @@ -52,7 +52,7 @@ bool sonificationStarted = false; void SonifyBeginSonification() { - PmError err = Pm_OpenOutput(&sonMidiStream, Pm_GetDefaultOutputDeviceID(), + PmError err = Pm_OpenOutput(&sonMidiStream, Pm_GetDefaultOutputDeviceID(), NULL, 0, NULL, NULL, 0); if (err) sonMidiStream = NULL; if (sonMidiStream) @@ -76,7 +76,7 @@ void SonifyNoteOnOff(int p, int v) SonifyBeginSonification(); if (sonMidiStream) Pm_WriteShort(sonMidiStream, 0, Pm_Message(0x90, p, v)); -} +} #define SONFNS(name) \ void SonifyBegin ## name() { SonifyNoteOnOff(SON_ ## name, SON_VEL); } \ @@ -146,7 +146,7 @@ Track *NoteTrack::Duplicate() SonifyBeginSerialize(); assert(!mSerializationBuffer); // serialize from this to duplicate's mSerializationBuffer - mSeq->serialize((void**)&duplicate->mSerializationBuffer, + mSeq->serialize((void**)&duplicate->mSerializationBuffer, &duplicate->mSerializationLength); SonifyEndSerialize(); } else if (mSerializationBuffer) { @@ -183,8 +183,8 @@ double NoteTrack::GetEndTime() } -void NoteTrack::WarpAndTransposeNotes(double t0, double t1, - const TimeWarper &warper, +void NoteTrack::WarpAndTransposeNotes(double t0, double t1, + const TimeWarper &warper, double semitones) { // Since this is a duplicate and duplicates convert mSeq to @@ -215,7 +215,7 @@ void NoteTrack::WarpAndTransposeNotes(double t0, double t1, iter.begin(); Alg_event_ptr event; while ((event = iter.next()) && event->time < t1) { - if (event->is_note() && event->time >= t0 && + if (event->is_note() && event->time >= t0 && // Allegro data structure does not restrict channels to 16. // Since there is not way to select more than 16 channels, // map all channel numbers mod 16. This will have no effect @@ -271,7 +271,7 @@ int NoteTrack::DrawLabelControls(wxDC & dc, wxRect & r) dc.DrawRectangle(box); // two choices: channel is enabled (to see and play) when button is in // "up" position (original Audacity style) or in "down" position -// +// #define CHANNEL_ON_IS_DOWN 1 #if CHANNEL_ON_IS_DOWN AColor::DarkMIDIChannel(&dc, chanName); @@ -323,7 +323,7 @@ int NoteTrack::DrawLabelControls(wxDC & dc, wxRect & r) t.Printf(wxT("%d"), chanName); dc.GetTextExtent(t, &w, &h); - + dc.DrawText(t, box.x + (box.width - w) / 2, box.y + (box.height - h) / 2); } } @@ -371,7 +371,7 @@ void NoteTrack::SetSequence(Alg_seq_ptr seq) mSeq = seq; } -Alg_seq* NoteTrack::GetSequence() +Alg_seq* NoteTrack::GetSequence() { return mSeq; } @@ -422,7 +422,7 @@ void NoteTrack::PrintSequence() } else {} } - + i++; } } @@ -527,7 +527,7 @@ bool NoteTrack::Paste(double t, Track *src) //Check that src is a non-NULL NoteTrack if (src == NULL || src->GetKind() != Track::Note) return false; - + NoteTrack* other = (NoteTrack*)src; if (other->mSeq == NULL) return false; @@ -555,7 +555,7 @@ bool NoteTrack::Shift(double t) // t is always seconds // get initial tempo double tempo = mSeq->get_tempo(0.0); double beats_per_measure = mSeq->get_bar_len(0.0); - int m = ROUND(t * tempo / beats_per_measure); + int m = ROUND(t * tempo / beats_per_measure); // need at least 1 measure, so if we rounded down to zero, fix it if (m == 0) m = 1; // compute new tempo so that m measures at new tempo take t seconds @@ -633,7 +633,7 @@ Alg_seq_ptr NoteTrack::MakeExportableSeq() Alg_beat_ptr bp = &(map->beats[0]); if (bp->time < ALG_EPS) { // tempo change at time 0 if (map->beats.len > 1) { // compute slope to get tempo - bps = (map->beats[1].beat - map->beats[0].beat) / + bps = (map->beats[1].beat - map->beats[0].beat) / (map->beats[1].time - map->beats[0].time); } else if (seq->get_time_map()->last_tempo_flag) { bps = seq->get_time_map()->last_tempo; @@ -648,7 +648,7 @@ Alg_seq_ptr NoteTrack::MakeExportableSeq() measure_time = offset / n; bps = beats_per_measure / measure_time; // insert integer multiple of measures at beginning - seq->convert_to_beats(); + seq->convert_to_beats(); seq->insert_silence(0, beats_per_measure * n); // make sure time signature at 0 is correct if (tsp) { @@ -667,7 +667,7 @@ Alg_seq_ptr NoteTrack::MakeExportableSeq() double beat = mSeq->get_time_map()->time_to_beat(start); // Find the time signature in mSeq in effect at start (beat): int i = mSeq->time_sig.find_beat(beat); - // i is where you would insert a new time sig at beat, + // i is where you would insert a new time sig at beat, // Case 1: beat coincides with a time sig at i. Time signature // at beat means that there is a barline at beat, so when beat // is shifted to 0, the relative barline positions are preserved @@ -676,10 +676,10 @@ Alg_seq_ptr NoteTrack::MakeExportableSeq() // beat coincides with time signature change, so offset must // be a multiple of beats /* do nothing */ ; - // Case 2: there is no time signature before beat. + // Case 2: there is no time signature before beat. } else if (i == 0 && (mSeq->time_sig.length() == 0 || mSeq->time_sig[i].beat > beat)) { - // If beat does not fall on an implied barline, we need to + // If beat does not fall on an implied barline, we need to // insert a time signature. double measures = beat / 4.0; double imeasures = ROUND(measures); @@ -688,12 +688,12 @@ Alg_seq_ptr NoteTrack::MakeExportableSeq() seq->set_time_sig(bar_offset, 4, 4); } // This case should never be true because if i == 0, either there - // are no time signatures before beat (Case 2), + // are no time signatures before beat (Case 2), // or there is one time signature at beat (Case 1) } else if (i == 0) { /* do nothing (might be good to assert(false)) */ ; // Case 3: i-1 must be the effective time sig position - } else { + } else { i -= 1; // index the time signature in effect at beat Alg_time_sig_ptr tsp = &(mSeq->time_sig[i]); double beats_per_measure = (tsp->num * 4) / tsp->den; @@ -709,14 +709,14 @@ Alg_seq_ptr NoteTrack::MakeExportableSeq() // It will have the same time signature, but the position will // force a barline to match the barlines in mSeq seq->set_time_sig(bar_offset, tsp->num, tsp->den); - } + } // else beat coincides with a barline, so no need for an extra // time signature to force barline alignment } } return seq; } - + bool NoteTrack::ExportMIDI(wxString f) { @@ -753,29 +753,29 @@ bool NoteTrack::HandleXMLTag(const wxChar *tag, const wxChar **attrs) double dblValue; if (!wxStrcmp(attr, wxT("name")) && XMLValueChecker::IsGoodString(strValue)) mName = strValue; - else if (!wxStrcmp(attr, wxT("offset")) && - XMLValueChecker::IsGoodString(strValue) && + else if (!wxStrcmp(attr, wxT("offset")) && + XMLValueChecker::IsGoodString(strValue) && Internat::CompatibleToDouble(strValue, &dblValue)) SetOffset(dblValue); else if (!wxStrcmp(attr, wxT("visiblechannels"))) { - if (!XMLValueChecker::IsGoodInt(strValue) || + if (!XMLValueChecker::IsGoodInt(strValue) || !strValue.ToLong(&nValue) || !XMLValueChecker::IsValidVisibleChannels(nValue)) return false; mVisibleChannels = nValue; } - else if (!wxStrcmp(attr, wxT("height")) && + else if (!wxStrcmp(attr, wxT("height")) && XMLValueChecker::IsGoodInt(strValue) && strValue.ToLong(&nValue)) mHeight = nValue; - else if (!wxStrcmp(attr, wxT("minimized")) && + else if (!wxStrcmp(attr, wxT("minimized")) && XMLValueChecker::IsGoodInt(strValue) && strValue.ToLong(&nValue)) mMinimized = (nValue != 0); - else if (!wxStrcmp(attr, wxT("isSelected")) && + else if (!wxStrcmp(attr, wxT("isSelected")) && XMLValueChecker::IsGoodInt(strValue) && strValue.ToLong(&nValue)) this->SetSelected(nValue != 0); #ifdef EXPERIMENTAL_MIDI_OUT - else if (!wxStrcmp(attr, wxT("velocity")) && - XMLValueChecker::IsGoodString(strValue) && + else if (!wxStrcmp(attr, wxT("velocity")) && + XMLValueChecker::IsGoodString(strValue) && Internat::CompatibleToDouble(strValue, &dblValue)) mGain = (float) dblValue; #endif @@ -808,10 +808,10 @@ void NoteTrack::WriteXML(XMLWriter &xmlFile) // we combine the Duplicate with serialization or unserialization. // Serialization and Unserialization happen on alternate calls to // Duplicate and (usually) produce the right results at the right - // time. - // It turns out that this optimized Duplicate is a little too + // time. + // It turns out that this optimized Duplicate is a little too // clever. There is at least one case where a track can be duplicated - // and then AutoSave'd. (E.g. do an "Insert Silence" effect on a + // and then AutoSave'd. (E.g. do an "Insert Silence" effect on a // NoteTrack.) In this case, mSeq will be NULL. To avoid a crash // and perform WriteXML, we may need to restore NoteTracks from binary // blobs to regular data structures (with an Alg_seq member). @@ -852,7 +852,7 @@ void NoteTrack::VScroll(int start, int end) SetBottomNote(mStartBottomNote + delta); } -// Zoom the note track, centering the pitch at centerY, +// Zoom the note track, centering the pitch at centerY, // amount is 1 for zoom in, and -1 for zoom out void NoteTrack::Zoom(int centerY, int amount) { diff --git a/src/NoteTrack.h b/src/NoteTrack.h index ad5734f30..0ea4337ab 100644 --- a/src/NoteTrack.h +++ b/src/NoteTrack.h @@ -58,8 +58,8 @@ class AUDACITY_DLL_API NoteTrack:public Track { virtual ~NoteTrack(); virtual Track *Duplicate(); - - virtual int GetKind() const { return Note; } + + virtual int GetKind() const { return Note; } virtual double GetStartTime(); virtual double GetEndTime(); @@ -117,7 +117,7 @@ class AUDACITY_DLL_API NoteTrack:public Track { // is located at r.y + r.height - (GetNoteMargin() + 1 + mPitchHeight) void PrepareIPitchToY(const wxRect &r) { mBottom = r.y + r.height - GetNoteMargin() - 1 - mPitchHeight + - (mBottomNote / 12) * GetOctaveHeight() + + (mBottomNote / 12) * GetOctaveHeight() + GetNotePos(mBottomNote % 12); } // IPitchToY returns Y coordinate of top of pitch p @@ -137,7 +137,7 @@ class AUDACITY_DLL_API NoteTrack:public Track { int YToIPitch(int y); // map pitch class number (0-11) to pixel offset from bottom of octave // (the bottom of the black line between B and C) to the top of the - // note. Note extra pixel separates B(11)/C(0) and E(4)/F(5). + // note. Note extra pixel separates B(11)/C(0) and E(4)/F(5). int GetNotePos(int p) const { return 1 + mPitchHeight * (p + 1) + (p > 4); } // get pixel offset to top of ith black key note int GetBlackPos(int i) const { return GetNotePos(i * 2 + 1 + (i > 1)); } @@ -145,16 +145,16 @@ class AUDACITY_DLL_API NoteTrack:public Track { // GetOctaveBottom. GetWhitePos(0) returns 1, which matches the location // of the line separating B and C int GetWhitePos(int i) const { return 1 + (i * GetOctaveHeight()) / 7; } - void SetBottomNote(int note) - { + void SetBottomNote(int note) + { if (note < 0) note = 0; else if (note > 96) note = 96; - mBottomNote = note; + mBottomNote = note; } - // Vertical scrolling is performed by dragging the keyboard at + // Vertical scrolling is performed by dragging the keyboard at // left of track. Protocol is call StartVScroll, then update by // calling VScroll with original and final mouse position. // These functions are not used -- instead, zooming/dragging works like diff --git a/src/PitchName.cpp b/src/PitchName.cpp index a05ae2f3e..29c42f334 100644 --- a/src/PitchName.cpp +++ b/src/PitchName.cpp @@ -5,13 +5,13 @@ License: GPL v2. See License.txt. PitchName.cpp - Vaughan Johnson and Dominic Mazzoni. + Vaughan Johnson and Dominic Mazzoni. ******************************************************************//** \file PitchName.cpp -\brief Utilities for converting from frequency to pitch - and from pitch to absolute (e.g., C4 for middle C) +\brief Utilities for converting from frequency to pitch + and from pitch to absolute (e.g., C4 for middle C) or nominal (A through G#) pitch name. *//*******************************************************************/ @@ -25,7 +25,7 @@ double FreqToMIDInote(const double freq) { - // Make the calculation relative to A440 (A4), note number 69. + // Make the calculation relative to A440 (A4), note number 69. return (69.0 + (12.0 * (log(freq / 440.0) / log(2.0)))); } @@ -40,7 +40,7 @@ unsigned int PitchIndex(const double dMIDInote) double dRound = (dMIDInote < 0.0) ? -0.5 : 0.5; int nPitchIndex = ((int)(dMIDInote + dRound) % 12); - // Because of the modulo, we know we're within 12 of positive, if dMIDInote is negative. + // Because of the modulo, we know we're within 12 of positive, if dMIDInote is negative. if (nPitchIndex < 0) nPitchIndex += 12; diff --git a/src/PitchName.h b/src/PitchName.h index 2740e5669..e81490172 100644 --- a/src/PitchName.h +++ b/src/PitchName.h @@ -9,7 +9,7 @@ ******************************************************************//** - utilities for converting among frequency, MIDI note number, + utilities for converting among frequency, MIDI note number, pitch index, pitch name *//*******************************************************************/ @@ -20,34 +20,34 @@ #include -// FreqToMIDInote takes a frequency in Hz (exponential scale relative to -// alphabetic pitch names) and returns a pitch ID number (linear +// FreqToMIDInote takes a frequency in Hz (exponential scale relative to +// alphabetic pitch names) and returns a pitch ID number (linear // scale), such that A440 (A4) is 69, middle C (C4) is 60, etc. -// Each register starts with C (e.g., for middle C and A440, +// Each register starts with C (e.g., for middle C and A440, // it's register 4). // MIDI note number 0 is C-1 in Scientific pitch notation. double FreqToMIDInote(const double freq); double MIDInoteToFreq(const double dMIDInote); -// PitchIndex returns the [0,11] index for a double MIDI note number, -// per result from FreqToMIDInote, corresponding to modulo 12 +// PitchIndex returns the [0,11] index for a double MIDI note number, +// per result from FreqToMIDInote, corresponding to modulo 12 // of the integer part of (dMIDInote + 0.5), so 0=C, 1=C#, etc. unsigned int PitchIndex(const double dMIDInote); -// PitchOctave returns the octave index for a double dMIDInote note number, +// PitchOctave returns the octave index for a double dMIDInote note number, // per result from FreqToMIDInote. // MIDI note number 0 is C-1 in Scientific pitch notation. int PitchOctave(const double dMIDInote); -// PitchName takes dMIDInote (per result from -// FreqToMIDInote) and returns a standard pitch/note name [C, C#, etc.). +// PitchName takes dMIDInote (per result from +// FreqToMIDInote) and returns a standard pitch/note name [C, C#, etc.). // Sharps are the default, unless, bWantFlats is true. wxChar * PitchName(const double dMIDInote, const bool bWantFlats = false); -// PitchName_Absolute does the same thing as PitchName, but appends -// the octave number, e.g., instead of "C" it will return "C4" -// if the dMIDInote corresonds to middle C, i.e., is 60. +// PitchName_Absolute does the same thing as PitchName, but appends +// the octave number, e.g., instead of "C" it will return "C4" +// if the dMIDInote corresonds to middle C, i.e., is 60. wxChar * PitchName_Absolute(const double dMIDInote, const bool bWantFlats = false); double PitchToMIDInote(const unsigned int nPitchIndex, const int nPitchOctave); diff --git a/src/PlatformCompatibility.h b/src/PlatformCompatibility.h index 2e541207c..f7ac90778 100644 --- a/src/PlatformCompatibility.h +++ b/src/PlatformCompatibility.h @@ -32,22 +32,22 @@ public: // just returns the exact string it is given. // static wxString GetLongFileName(const wxString& shortFileName); - + // // Get filename and path of executable (e.g. "/usr/bin/audacity" on // Linux or "C:\Program Files\Audacity\Audacity.exe" on Windows) // static wxString GetExecutablePath(); - + // // Audacity treats the / as a file seperator always for Mac OS, // however /'s are allowed in the filename. In order for /'s to // work they muse be treated as :'s. To facilitate this, this - // function should be called when opening or saving a file on + // function should be called when opening or saving a file on // the Mac. It's important to note that if a / is used in a filename // and folder exists in the same folder with the same name as the part // of the file (before the first /) then the file will be saved inside - // of that directory. This function also exists in the FileDialogPrivate + // of that directory. This function also exists in the FileDialogPrivate // object // static wxString ConvertSlashInFileName(const wxString& filePath); diff --git a/src/PluginManager.cpp b/src/PluginManager.cpp index b038908ae..9b4519d24 100644 --- a/src/PluginManager.cpp +++ b/src/PluginManager.cpp @@ -90,15 +90,15 @@ void PluginManager::Close() // I guess we can live with that for now. // This function will still close the config and // delete it, without updating the file. - if( IsDirty()) + if( IsDirty()) { wxFile file(FileNames::PluginsCache(), wxFile::write); - if (!file.IsOpened()) + if (!file.IsOpened()) { // Might fail to open... wxLogDebug(wxT("Couldn't open plugins cache for write")); } - else + else { wxFileOutputStream stream(file); // Save() might return false. @@ -127,7 +127,7 @@ wxString PluginManager::Read(const wxString & key, const wxString & def) if (mConfig) { return mConfig->Read(key, def); } - + return def; } @@ -136,7 +136,7 @@ long PluginManager::Read(const wxString & key, long def) if (mConfig) { return mConfig->Read(key, def); } - + return def; } @@ -158,7 +158,7 @@ void PluginManager::Write(const wxString & key, long val) SetDirty(); } - + return; } diff --git a/src/Prefs.cpp b/src/Prefs.cpp index ab809be92..5702ca86b 100644 --- a/src/Prefs.cpp +++ b/src/Prefs.cpp @@ -41,7 +41,7 @@ SpectrumHighColor - much easier to parse. /Locale Language - two-letter language code for translations - + (*): wxGTK (+): wxWin ($): wxMac @@ -115,7 +115,7 @@ static void CopyEntriesRecursive(wxString path, wxConfigBase *src, wxConfigBase wxString entryName; long entryIndex; bool entryKeepGoing; - + entryKeepGoing = src->GetFirstEntry(entryName, entryIndex); while (entryKeepGoing) { CopyEntry(path, src, dst, entryName); @@ -125,7 +125,7 @@ static void CopyEntriesRecursive(wxString path, wxConfigBase *src, wxConfigBase wxString groupName; long groupIndex; bool groupKeepGoing; - + groupKeepGoing = src->GetFirstGroup(groupName, groupIndex); while (groupKeepGoing) { wxString subPath = path+groupName+wxT("/"); @@ -145,7 +145,7 @@ void InitPreferences() gPrefs = new wxFileConfig(appName, wxEmptyString, configFileName.GetFullPath(), wxEmptyString, wxCONFIG_USE_LOCAL_FILE); - + wxConfigBase::Set(gPrefs); static wxString resourcesDir; @@ -182,7 +182,7 @@ void InitPreferences() delete legacyConfig; gPrefs->Write(wxT("/NewPrefsInitialized"), true); } - + gPrefs->Write(wxT("/Version"), wxString(AUDACITY_VERSION_STRING)); // BG: Make sure the users prefs are up to date @@ -199,7 +199,7 @@ void InitPreferences() gPrefs->DeleteGroup(wxT("/Locale")); gPrefs->Write(wxT("/PrefsVersion"), wxString(wxT(AUDACITY_PREFS_VERSION_STRING))); } - + // Check if some prefs updates need to happen based on audacity version. // Unfortunately we can't use the PrefsVersion prefs key because that resets things. // In the future we may want to integrate that better. @@ -208,19 +208,19 @@ void InitPreferences() int vMajor = gPrefs->Read(wxT("/Version/Major"), (long) 0); int vMinor = gPrefs->Read(wxT("/Version/Minor"), (long) 0); int vMicro = gPrefs->Read(wxT("/Version/Micro"), (long) 0); - + // These integer version keys were introduced april 4 2011 for 1.3.13 // The device toolbar needs to be enabled due to removal of source selection features in // the mixer toolbar. - if ((vMajor < 1) || + if ((vMajor < 1) || (vMajor == 1 && vMinor < 3) || (vMajor == 1 && vMinor == 3 && vMicro < 13)) { - - + + // Do a full reset of the Device Toolbar to get it on the screen. if (gPrefs->Exists(wxT("/GUI/ToolBars/Device"))) gPrefs->DeleteGroup(wxT("/GUI/ToolBars/Device")); - + // We keep the mixer toolbar prefs (shown/not shown) // the width of the mixer toolbar may have shrunk, the prefs will keep the larger value // if the user had a device that had more than one source. @@ -229,11 +229,11 @@ void InitPreferences() gPrefs->Write(wxT("/GUI/ToolBars/Mixer/W"), -1); } } - + gPrefs->Write(wxT("/Version/Major"), AUDACITY_VERSION); - gPrefs->Write(wxT("/Version/Minor"), AUDACITY_RELEASE); + gPrefs->Write(wxT("/Version/Minor"), AUDACITY_RELEASE); gPrefs->Write(wxT("/Version/Micro"), AUDACITY_REVISION); - + gPrefs->Flush(); } diff --git a/src/Profiler.cpp b/src/Profiler.cpp index 98796c6a0..c90ffe89d 100644 --- a/src/Profiler.cpp +++ b/src/Profiler.cpp @@ -3,7 +3,7 @@ Audacity: A Digital Audio Editor Profiler.cpp - + Created by Michael Chinen (mchinen) on 8/12/08 Audacity(R) is copyright (c) 1999-2008 Audacity Team. License: GPL v2. See License.txt. @@ -11,7 +11,7 @@ ******************************************************************//** \class Profiler -\brief A simple profiler to measure the average time lengths that a +\brief A simple profiler to measure the average time lengths that a particular task/function takes. Currently not thread-safe and not thread-smart, but it will probably work fine if you use it on a high level. @@ -30,7 +30,7 @@ Profiler::~Profiler() //print everything out. append to a log. FILE* log = fopen("AudacityProfilerLog.txt", "a"); time_t now; - + time(&now); fprintf(log,"Audacity Profiler Run, Ended at "); fprintf(log,"%s",ctime(&now)); @@ -44,15 +44,15 @@ Profiler::~Profiler() fprintf(log,"Number of times run: %d\n",mTasks[i]->mNumHits); fprintf(log,"Total run time (seconds): %f\n", (double)mTasks[i]->mCumTime/CLOCKS_PER_SEC); fprintf(log,"Average run time (seconds): %f\n",mTasks[i]->ComputeAverageRunTime()); - + if(i < ((int)mTasks.size()) -1) fprintf(log,"----------------------------\n"); } } fprintf(log,"\n****************************************\n\n\n"); - + fclose(log); - + //delete everything. for(int i=0;i<(int)mTasks.size();i++) delete mTasks[i]; @@ -66,7 +66,7 @@ void Profiler::Begin(char* fileName, int lineNum, char* taskDescription) GetOrCreateTaskProfile(fileName,lineNum)->Begin(fileName,lineNum,taskDescription); mTasksMutex.Unlock(); } - + ///end the task timer. void Profiler::End(char* fileName, int lineNum, char* taskDescription) { @@ -77,16 +77,16 @@ void Profiler::End(char* fileName, int lineNum, char* taskDescription) tp->End(fileName,lineNum,taskDescription); mTasksMutex.Unlock(); } - + ///Gets the singleton instance Profiler* Profiler::Instance() { static Profiler* pro=NULL; //this isn't 100% threadsafe but I think Okay for this purpose. - + if(!pro) pro = new Profiler(); - + return pro; } @@ -99,7 +99,7 @@ TaskProfile* Profiler::GetOrCreateTaskProfile(char* fileName, int lineNum) if(strcmp(fileName,mTasks[i]->mFileName)==0 && lineNum == mTasks[i]->mLine) return mTasks[i]; } - + TaskProfile* tp = new TaskProfile(); mTasks.push_back(tp); return tp; @@ -112,7 +112,7 @@ TaskProfile* Profiler::GetTaskProfileByDescription(char* description) if(strcmp(description,mTasks[i]->mDescription)==0) return mTasks[i]; } - + return NULL; } @@ -148,7 +148,7 @@ void TaskProfile::Begin(char* fileName, int lineNum, char* taskDescription) } mLastTime = clock(); - + } ///end the task timer. @@ -157,7 +157,7 @@ void TaskProfile::End(char* WXUNUSED(fileName), int WXUNUSED(lineNum), char* WXU mCumTime += clock() - mLastTime; mNumHits++; } - + double TaskProfile::ComputeAverageRunTime() { if(mNumHits) @@ -165,4 +165,3 @@ double TaskProfile::ComputeAverageRunTime() else return 0.0; } - \ No newline at end of file diff --git a/src/Profiler.h b/src/Profiler.h index f715600c0..70638bc68 100644 --- a/src/Profiler.h +++ b/src/Profiler.h @@ -3,7 +3,7 @@ Audacity: A Digital Audio Editor Profiler.h - + Created by Michael Chinen (mchinen) on 8/12/08 Audacity(R) is copyright (c) 1999-2008 Audacity Team. License: GPL v2. See License.txt. @@ -11,7 +11,7 @@ ******************************************************************//** \class Profiler -\brief A simple profiler to measure the average time lengths that a +\brief A simple profiler to measure the average time lengths that a particular task/function takes. Currently not thread-safe and not thread-smart, but it will probably work fine if you use it on a high level. @@ -46,16 +46,16 @@ class Profiler void Begin(char* fileName, int lineNum, char* taskDescription); ///end the task timer. void End(char* fileName, int lineNum, char* taskDescription); - + ///Gets the singleton instance static Profiler* Instance(); - + protected: ///private constructor - Singleton. Profiler(){}; - + ///find a taskProfile for the given task, otherwise create - TaskProfile* GetOrCreateTaskProfile(char* fileName, int lineNum); + TaskProfile* GetOrCreateTaskProfile(char* fileName, int lineNum); TaskProfile* GetTaskProfileByDescription(char* description); //List of current Task to do. @@ -75,9 +75,9 @@ class Profiler void Begin(char* fileName, int lineNum, char* taskDescription); ///end the task timer. void End(char* fileName, int lineNum, char* taskDescription); - + double ComputeAverageRunTime(); - + char* mFileName; int mLine; char* mDescription; diff --git a/src/Project.cpp b/src/Project.cpp index df093f7eb..c7974bcdf 100644 --- a/src/Project.cpp +++ b/src/Project.cpp @@ -16,7 +16,7 @@ Includes Menus.cpp. *//****************************************************************//** \class AudacityProject -\brief AudacityProject provides the main window, with tools and +\brief AudacityProject provides the main window, with tools and tracks contained within it. In Audacity, the main window you work in is called a project. @@ -26,7 +26,7 @@ tracks contained within it. This window is the one that contains the menu bar (except on the Mac). -\attention The menu functions for AudacityProject, those for creating +\attention The menu functions for AudacityProject, those for creating the menu bars and acting on clicks, are found in file Menus.cpp *//****************************************************************//** @@ -199,7 +199,7 @@ public: mValExit = val_exit; *var = val_entry; } - + ~VarSetter() { *mVar = mValExit; @@ -331,7 +331,7 @@ public: GetFlavorDataSize((DragReference)m_currentDrag, theItem, theType, &dataSize); Ptr theData = new char[dataSize]; - GetFlavorData((DragReference)m_currentDrag, theItem, theType, (void*) theData, &dataSize, 0L); + GetFlavorData((DragReference)m_currentDrag, theItem, theType, (void*) theData, &dataSize, 0L); wxString name; if (theType == kDragPromisedFlavorFindFile) { @@ -396,18 +396,18 @@ public: { //sort by OD non OD. load Non OD first so user can start editing asap. wxArrayString sortednames(filenames); - + ODManager::Pause(); - + sortednames.Sort(CompareNoCaseFileName); for (unsigned int i = 0; i < sortednames.GetCount(); i++) { - + mProject->Import(sortednames[i]); } mProject->HandleResize(); // Adjust scrollers for new track sizes. - + ODManager::Resume(); - + return true; } @@ -418,19 +418,19 @@ private: #endif -bool ImportXMLTagHandler::HandleXMLTag(const wxChar *tag, const wxChar **attrs) +bool ImportXMLTagHandler::HandleXMLTag(const wxChar *tag, const wxChar **attrs) { if (wxStrcmp(tag, wxT("import")) || attrs==NULL || (*attrs)==NULL || wxStrcmp(*attrs++, wxT("filename"))) return false; wxString strAttr = *attrs; - if (!XMLValueChecker::IsGoodPathName(strAttr)) + if (!XMLValueChecker::IsGoodPathName(strAttr)) { // Maybe strAttr is just a fileName, not the full path. Try the project data directory. wxFileName fileName(mProject->GetDirManager()->GetProjectDataDir(), strAttr); - if (XMLValueChecker::IsGoodFileName(strAttr, fileName.GetPath(wxPATH_GET_VOLUME))) + if (XMLValueChecker::IsGoodFileName(strAttr, fileName.GetPath(wxPATH_GET_VOLUME))) strAttr = fileName.GetFullPath(); - else - { + else + { wxLogWarning(wxT("Could not import file: %s"), strAttr.c_str()); return false; } @@ -441,19 +441,19 @@ bool ImportXMLTagHandler::HandleXMLTag(const wxChar *tag, const wxChar **attrs) if (trackArray.IsEmpty()) return false; - // Handle other attributes, now that we have the tracks. - attrs++; + // Handle other attributes, now that we have the tracks. + attrs++; const wxChar** pAttr; bool bSuccess = true; for (size_t i = 0; i < trackArray.GetCount(); i++) { - // Most of the "import" tag attributes are the same as for "wavetrack" tags, + // Most of the "import" tag attributes are the same as for "wavetrack" tags, // so apply them via WaveTrack::HandleXMLTag(). bSuccess = trackArray[i]->HandleXMLTag(wxT("wavetrack"), attrs); - // "offset" tag is ignored in WaveTrack::HandleXMLTag except for legacy projects, - // so handle it here. + // "offset" tag is ignored in WaveTrack::HandleXMLTag except for legacy projects, + // so handle it here. double dblValue; pAttr = attrs; while (*pAttr) @@ -461,13 +461,13 @@ bool ImportXMLTagHandler::HandleXMLTag(const wxChar *tag, const wxChar **attrs) const wxChar *attr = *pAttr++; const wxChar *value = *pAttr++; const wxString strValue = value; - if (!wxStrcmp(attr, wxT("offset")) && - XMLValueChecker::IsGoodString(strValue) && + if (!wxStrcmp(attr, wxT("offset")) && + XMLValueChecker::IsGoodString(strValue) && Internat::CompatibleToDouble(strValue, &dblValue)) trackArray[i]->SetOffset(dblValue); } } - return bSuccess; + return bSuccess; }; AudacityProject *CreateNewAudacityProject() @@ -483,7 +483,7 @@ AudacityProject *CreateNewAudacityProject() wxSize(wndRect.width, wndRect.height)); gAudacityProjects.Add(p); - + if(bMaximized) { p->Maximize(true); } @@ -498,8 +498,8 @@ AudacityProject *CreateNewAudacityProject() //Set the new project as active: SetActiveProject(p); - // Okay, GetActiveProject() is ready. Now we can get its CommandManager, - // and add the shortcut keys to the tooltips. + // Okay, GetActiveProject() is ready. Now we can get its CommandManager, + // and add the shortcut keys to the tooltips. p->GetControlToolBar()->RegenerateToolsTooltips(); ModuleManager::Dispatch(ProjectInitialized); @@ -631,7 +631,7 @@ void GetNextWindowPlacement(wxRect *nextRect, bool *pMaximized, bool *pIconized) *pMaximized = validProject->IsMaximized(); *pIconized = validProject->IsIconized(); } - else + else { nextRect->SetX(gPrefs->Read(wxT("/Window/Normal_X"), defaultWindowRect.GetX())); nextRect->SetY(gPrefs->Read(wxT("/Window/Normal_Y"), defaultWindowRect.GetY())); @@ -744,7 +744,7 @@ AudacityProject::AudacityProject(wxWindow * parent, wxWindowID id, mFreqWindow(NULL), mAliasMissingWarningDialog(NULL), mToolManager(NULL), - mbBusyImporting(false), + mbBusyImporting(false), mAudioIOToken(-1), mIsDeleting(false), mTracksFitVerticallyZoomed(false), //lda @@ -755,7 +755,7 @@ AudacityProject::AudacityProject(wxWindow * parent, wxWindowID id, mAutoSaving(false), mIsRecovered(false), mRecordingRecoveryHandler(NULL), - mImportedDependencies(false), + mImportedDependencies(false), mWantSaveCompressed(false), mLastEffect(NULL), mLastEffectType(0), @@ -809,16 +809,16 @@ AudacityProject::AudacityProject(wxWindow * parent, wxWindowID id, mViewInfo.sbarScale = 1.0; UpdatePrefs(); - + // Some extra information mViewInfo.bIsPlaying = false; mViewInfo.bRedrawWaveform = false; mLockPlayRegion = false; - // Make sure valgrind sees mIsSyncLocked is initialized, even + // Make sure valgrind sees mIsSyncLocked is initialized, even // though we're about to set it from prefs. - mIsSyncLocked = false; + mIsSyncLocked = false; gPrefs->Read(wxT("/GUI/SyncLockTracks"), &mIsSyncLocked, false); CreateMenusAndCommands(); @@ -847,7 +847,7 @@ AudacityProject::AudacityProject(wxWindow * parent, wxWindowID id, MixerToolBar *mtb = GetMixerToolBar(); if (mtb) mtb->RecreateTipWindows(); -#endif +#endif // // Create the horizontal ruler @@ -867,7 +867,7 @@ AudacityProject::AudacityProject(wxWindow * parent, wxWindowID id, // We are using a notebook (tabbed panel), so we create the notebook and add pages. GuiFactory Factory; wxNotebook * pNotebook; - mMainPanel = Factory.AddPanel( + mMainPanel = Factory.AddPanel( this, wxPoint( left, top ), wxSize( width, height ) ); pNotebook = Factory.AddNotebook( mMainPanel ); /* i18n-hint: This is an experimental feature where the main panel in @@ -875,11 +875,11 @@ AudacityProject::AudacityProject(wxWindow * parent, wxWindowID id, Other tabs in that notebook may have instruments, patch panels etc.*/ pPage = Factory.AddPage( pNotebook, _("Main Mix")); #else - // Not using a notebook, so we place the track panel inside another panel, + // Not using a notebook, so we place the track panel inside another panel, // this keeps the notebook code and normal code consistant and also // paves the way for adding additional windows inside the track panel. - mMainPanel = new wxPanel(this, -1, - wxDefaultPosition, + mMainPanel = new wxPanel(this, -1, + wxDefaultPosition, wxDefaultSize, wxNO_BORDER); mMainPanel->SetSizer( new wxBoxSizer(wxVERTICAL) ); @@ -915,7 +915,7 @@ AudacityProject::AudacityProject(wxWindow * parent, wxWindowID id, // LLL: When Audacity starts or becomes active after returning from // another application, the first window that can accept focus // will be given the focus even if we try to SetFocus(). By - // creating the scrollbars after the TrackPanel, we resolve + // creating the scrollbars after the TrackPanel, we resolve // several focus problems. mHsbar = new ScrollBar(pPage, HSBarID, wxSB_HORIZONTAL); mVsbar = new ScrollBar(pPage, VSBarID, wxSB_VERTICAL); @@ -961,7 +961,7 @@ AudacityProject::AudacityProject(wxWindow * parent, wxWindowID id, #ifdef EXPERIMENTAL_NOTEBOOK AddPages(this, Factory, pNotebook); -#endif +#endif mMainPanel->Layout(); @@ -1061,7 +1061,7 @@ void AudacityProject::SetMissingAliasFileDialog(wxDialog *dialog) { mAliasMissingWarningDialog = dialog; } - + wxDialog *AudacityProject::GetMissingAliasFileDialog() { return mAliasMissingWarningDialog; @@ -1074,13 +1074,13 @@ void AudacityProject::RedrawProject(const bool bForceWaveTracks /*= false*/) { TrackListIterator iter(mTracks); Track* pTrack = iter.First(); - while (pTrack) + while (pTrack) { if (pTrack->GetKind() == Track::Wave) { WaveTrack* pWaveTrack = (WaveTrack*)pTrack; WaveClipList::compatibility_iterator node = pWaveTrack->GetClipIterator(); - while (node) + while (node) { WaveClip *clip = node->GetData(); clip->MarkChanged(); @@ -1101,14 +1101,14 @@ void AudacityProject::RefreshCursor() void AudacityProject::SetSel0(double newSel0) { //Bound checking should go on here - + mViewInfo.sel0 = newSel0; } void AudacityProject::SetSel1(double newSel1) { //Bound checking should go on here - + mViewInfo.sel1 = newSel1; } @@ -1163,7 +1163,7 @@ void AudacityProject::SetProjectTitle() { name = wxT("Audacity"); } - + if (mIsRecovered) { name += wxT(" "); @@ -1367,7 +1367,7 @@ void AudacityProject::TP_ScrollUpDown(int delta) pos = max; else if (pos < 0) pos = 0; - + if (pos != oldPos) { mVsbar->SetThumbPosition(pos); @@ -1395,7 +1395,7 @@ void AudacityProject::FixScrollbars() double LastTime = wxMax( mTracks->GetEndTime(), mViewInfo.sel1 ); mViewInfo.total = LastTime + mViewInfo.screen / 4; - // Don't remove time from total that's still on the screen + // Don't remove time from total that's still on the screen if (mViewInfo.h > mViewInfo.total - mViewInfo.screen) { mViewInfo.total = mViewInfo.h + mViewInfo.screen; } @@ -1454,7 +1454,7 @@ void AudacityProject::FixScrollbars() // we scale the scrollbar coordinates on demand. We only do this if we // would exceed the int range, so we can always use the maximum resolution // available. - + // Don't use the full 2^31 max int range but a bit less, so rounding // errors in calculations do not overflow max int wxInt64 maxScrollbarRange = (wxInt64)(2147483647 * 0.999); @@ -1462,15 +1462,15 @@ void AudacityProject::FixScrollbars() mViewInfo.sbarScale = ((double)maxScrollbarRange) / mViewInfo.sbarTotal; else mViewInfo.sbarScale = 1.0; // use maximum resolution - + int scaledSbarH = (int)(mViewInfo.sbarH * mViewInfo.sbarScale); int scaledSbarScreen = (int)(mViewInfo.sbarScreen * mViewInfo.sbarScale); int scaledSbarTotal = (int)(mViewInfo.sbarTotal * mViewInfo.sbarScale); - + mHsbar->SetScrollbar(scaledSbarH, scaledSbarScreen, scaledSbarTotal, scaledSbarScreen, TRUE); mHsbar->Refresh(); - + // Vertical scrollbar mVsbar->SetScrollbar(mViewInfo.vpos / mViewInfo.scrollStep, panelHeight / mViewInfo.scrollStep, @@ -1537,7 +1537,7 @@ void AudacityProject::UpdateFirstVisible() void AudacityProject::UpdateLayout() { - if (!mTrackPanel) + if (!mTrackPanel) return; mToolManager->LayoutToolBars(); @@ -1560,7 +1560,7 @@ void AudacityProject::UpdateLayout() void AudacityProject::HandleResize() { - if (!mTrackPanel) + if (!mTrackPanel) return; FixScrollbars(); @@ -1575,7 +1575,7 @@ void AudacityProject::OnIconize(wxIconizeEvent &event) //JKC: On Iconizing we get called twice. Don't know // why but it does no harm. - // Should we be returning true/false rather than + // Should we be returning true/false rather than // void return? I don't know. mIconized = event.Iconized(); @@ -1642,7 +1642,7 @@ void AudacityProject::OnODTaskUpdate(wxCommandEvent & WXUNUSED(event)) //todo: add track data to the event - check to see if the project contains it before redrawing. if(mTrackPanel) mTrackPanel->Refresh(false); - + } //redraws the task and does other book keeping after the task is complete. @@ -1697,11 +1697,11 @@ bool AudacityProject::HandleKeyDown(wxKeyEvent & event) if (event.GetKeyCode() == WXK_CONTROL) mTrackPanel->HandleControlKey(true); - // Allow PageUp and PageDown keys to + // Allow PageUp and PageDown keys to //scroll the Track Panel left and right if (event.GetKeyCode() == WXK_PAGEUP) mTrackPanel->HandlePageUpKey(); - + if (event.GetKeyCode() == WXK_PAGEDOWN) mTrackPanel->HandlePageDownKey(); @@ -1713,7 +1713,7 @@ bool AudacityProject::HandleKeyDown(wxKeyEvent & event) if (w) { wxCommandEvent e(EVT_CAPTURE_KEY); e.SetEventObject(&event); - + if (w->ProcessEvent(e)) { return false; } @@ -1758,12 +1758,12 @@ void AudacityProject::OnMenuEvent(wxMenuEvent & event) bool AudacityProject::TryToMakeActionAllowed( wxUint32 & flags, wxUint32 flagsRqd, wxUint32 mask ) { bool bAllowed; - + bAllowed = ((flags & mask) == (flagsRqd & mask)); if( bAllowed ) return true; - - // Action is not allowed + + // Action is not allowed // IF not set up to select all audio in that case, THEN return with failure. if( !mSelectAllOnNone ) return false; @@ -1815,7 +1815,7 @@ void AudacityProject::OnActivate(wxActivateEvent & event) mTrackPanel->SetFocus(); #endif - // Under Windows, focus can be "lost" when returning to + // Under Windows, focus can be "lost" when returning to // Audacity from a different application. // // This was observed by minimizing all windows using WINDOWS+M and @@ -1867,7 +1867,7 @@ void AudacityProject::OnMouseEvent(wxMouseEvent & event) // and/or attempts to delete objects twice. void AudacityProject::OnCloseWindow(wxCloseEvent & event) { - if (event.CanVeto() && (::wxIsBusy() || mbBusyImporting)) + if (event.CanVeto() && (::wxIsBusy() || mbBusyImporting)) { event.Veto(); return; @@ -1883,7 +1883,7 @@ void AudacityProject::OnCloseWindow(wxCloseEvent & event) // The main point of this is to properly push the state // and flush the tracks once we've completely finished // recording new state. - // This code is derived from similar code in + // This code is derived from similar code in // AudacityProject::~AudacityProject() and TrackPanel::OnTimer(). if (GetAudioIOToken()>0 && gAudioIO->IsStreamActive(GetAudioIOToken())) { @@ -1893,11 +1893,11 @@ void AudacityProject::OnCloseWindow(wxCloseEvent & event) while(gAudioIO->IsBusy()) { wxMilliSleep(100); } - + // We were playing or recording audio, but we've stopped the stream. wxCommandEvent dummyEvent; GetControlToolBar()->OnStop(dummyEvent); - + if (gAudioIO->GetNumCaptureChannels() > 0) { // Tracks are buffered during recording. This flushes // them so that there's nothing left in the append @@ -1929,14 +1929,14 @@ void AudacityProject::OnCloseWindow(wxCloseEvent & event) TrackListIterator iter2(mTracks); bool bHasTracks = (iter2.First() != NULL); - // We may not bother to prompt the user to save, if the + // We may not bother to prompt the user to save, if the // project is now empty. if (event.CanVeto() && (mEmptyCanBeDirty || bHasTracks)) { if (mUndoManager.UnsavedChanges()) { wxString Message = _("Save changes before closing?"); if( !bHasTracks ) - { + { Message += _("\nIf saved, the project will have no tracks.\n\nTo save any previously open tracks:\nCancel, Edit > Undo until all tracks\nare open, then File > Save Project."); } int result = wxMessageBox( Message, @@ -1950,7 +1950,7 @@ void AudacityProject::OnCloseWindow(wxCloseEvent & event) } } } - + ModuleManager::Dispatch(ProjectClosing); // Stop the timer since there's no need to update anything anymore @@ -2020,7 +2020,7 @@ void AudacityProject::OnCloseWindow(wxCloseEvent & event) // Destroy the TrackPanel early so it's not around once we start // deleting things like tracks and such out from underneath it. - // Check validity of mTrackPanel per bug 584 Comment 1. + // Check validity of mTrackPanel per bug 584 Comment 1. // Deeper fix is in the Import code, but this failsafes against crash. if (mTrackPanel) { @@ -2082,12 +2082,12 @@ void AudacityProject::OnCloseWindow(wxCloseEvent & event) } } - // Since we're going to be destroyed, make sure we're not to + // Since we're going to be destroyed, make sure we're not to // receive audio notifications anymore. if (gAudioIO->GetListener() == this) { gAudioIO->SetListener(gActiveProject); } - + if (gAudacityProjects.IsEmpty() && !gIsQuitting) { #if !defined(__WXMAC__) @@ -2179,7 +2179,7 @@ wxArrayString AudacityProject::ShowOpenDialog(wxString extraformat, wxString ext wxString mask = _("All files|*|All supported files|") + all + wxT("|"); // "all" and "all supported" entries if (extraformat != wxEmptyString) - { // append caller-defined format if supplied + { // append caller-defined format if supplied mask += extraformat + wxT("|") + extrafilter + wxT("|"); } mask += filter; // put the names and extensions of all the importer formats @@ -2219,7 +2219,7 @@ wxArrayString AudacityProject::ShowOpenDialog(wxString extraformat, wxString ext dlog.SetFilterIndex(index); int dialogResult = dlog.ShowModal(); - + // Convert the filter index to type and save index = dlog.GetFilterIndex(); for (int i = 0; i < index; i++) { @@ -2241,11 +2241,11 @@ bool AudacityProject::IsAlreadyOpen(const wxString projPathName) { wxFileName newProjPathName(projPathName); size_t numProjects = gAudacityProjects.Count(); - for (size_t i = 0; i < numProjects; i++) + for (size_t i = 0; i < numProjects; i++) { - if (newProjPathName.SameAs(gAudacityProjects[i]->mFileName)) + if (newProjPathName.SameAs(gAudacityProjects[i]->mFileName)) { - wxString errMsg = + wxString errMsg = wxString::Format(_("%s is already open in another window."), newProjPathName.GetName().c_str()); wxLogError(errMsg); @@ -2259,9 +2259,9 @@ bool AudacityProject::IsAlreadyOpen(const wxString projPathName) // static method, can be called outside of a project void AudacityProject::OpenFiles(AudacityProject *proj) { - /* i18n-hint: This string is a label in the file type filter in the open + /* i18n-hint: This string is a label in the file type filter in the open * and save dialogues, for the option that only shows project files created - * with Audacity. Do not include pipe symbols or .aup (this extension will + * with Audacity. Do not include pipe symbols or .aup (this extension will * now be added automatically for the Save Projects dialogues).*/ wxArrayString selectedFiles = ShowOpenDialog(_("Audacity projects"), wxT("*.aup")); if (selectedFiles.GetCount() == 0) { @@ -2269,8 +2269,8 @@ void AudacityProject::OpenFiles(AudacityProject *proj) gPrefs->Flush(); return; } - - //sort selected files by OD status. + + //sort selected files by OD status. //For the open menu we load OD first so user can edit asap. //first sort selectedFiles. selectedFiles.Sort(CompareNoCaseFileName); @@ -2285,7 +2285,7 @@ void AudacityProject::OpenFiles(AudacityProject *proj) gPrefs->Write(wxT("/DefaultOpenPath"), wxPathOnly(fileName)); gPrefs->Flush(); - + // DMM: If the project is dirty, that means it's been touched at // all, and it's not safe to open a new project directly in its // place. Only if the project is brand-new clean and the user @@ -2305,7 +2305,7 @@ void AudacityProject::OpenFiles(AudacityProject *proj) // and it's okay to open a new project inside this window. proj->OpenFile(fileName); } - + gPrefs->Write(wxT("/LastOpenType"),wxT("")); gPrefs->Flush(); @@ -2313,9 +2313,9 @@ void AudacityProject::OpenFiles(AudacityProject *proj) } -// Most of this string was duplicated 3 places. Made the warning consistent in this global. +// Most of this string was duplicated 3 places. Made the warning consistent in this global. // The %s is to be filled with the version string. -static wxString gsLegacyFileWarning = +static wxString gsLegacyFileWarning = _("This file was saved by Audacity version %s. The format has changed. \ \n\nAudacity can try to open and save this file, but saving it in this \ \nversion will then prevent any 1.2 or earlier version opening it. \ @@ -2329,7 +2329,7 @@ bool AudacityProject::WarnOfLegacyFile( ) msg.Printf(gsLegacyFileWarning, _("1.0 or earlier")); // Stop icon, and choose 'NO' by default. - int action = + int action = wxMessageBox(msg, _("Warning - Opening Old Project File"), wxYES_NO | wxICON_STOP | wxNO_DEFAULT | wxCENTRE, @@ -2338,7 +2338,7 @@ bool AudacityProject::WarnOfLegacyFile( ) } -// FIXME? This should return a result that is checked. +// FIXME? This should return a result that is checked. // See comment in AudacityApp::MRUOpen(). void AudacityProject::OpenFile(wxString fileName, bool addtohistory) { @@ -2349,11 +2349,11 @@ void AudacityProject::OpenFile(wxString fileName, bool addtohistory) PlatformCompatibility::GetLongFileName(fileName)); // Make sure it isn't already open. - // Vaughan, 2011-03-25: This was done previously in AudacityProject::OpenFiles() - // and AudacityApp::MRUOpen(), but if you open an aup file by double-clicking it - // from, e.g., Win Explorer, it would bypass those, get to here with no check, - // then open a new project from the same data with no warning. - // This was reported in http://bugzilla.audacityteam.org/show_bug.cgi?id=137#c17, + // Vaughan, 2011-03-25: This was done previously in AudacityProject::OpenFiles() + // and AudacityApp::MRUOpen(), but if you open an aup file by double-clicking it + // from, e.g., Win Explorer, it would bypass those, get to here with no check, + // then open a new project from the same data with no warning. + // This was reported in http://bugzilla.audacityteam.org/show_bug.cgi?id=137#c17, // but is not really part of that bug. Anyway, prevent it! if (AudacityProject::IsAlreadyOpen(fileName)) return; @@ -2394,7 +2394,7 @@ void AudacityProject::OpenFile(wxString fileName, bool addtohistory) char buf[16]; int numRead = ff->Read(buf, 15); if (numRead != 15) { - wxMessageBox(wxString::Format(_("File may be invalid or corrupted: \n%s"), + wxMessageBox(wxString::Format(_("File may be invalid or corrupted: \n%s"), (const wxChar*)fileName), _("Error Opening File or Project"), wxOK | wxCENTRE, this); ff->Close(); @@ -2424,7 +2424,7 @@ void AudacityProject::OpenFile(wxString fileName, bool addtohistory) temp = wxT(" tag, because log data can // be added anytime. So before opening an .autosave file, add the necessary @@ -2474,7 +2474,7 @@ void AudacityProject::OpenFile(wxString fileName, bool addtohistory) f.Write(buf, strlen(buf)); } } - + f.Close(); } } @@ -2488,7 +2488,7 @@ void AudacityProject::OpenFile(wxString fileName, bool addtohistory) // that their reference counts will never reach zero and thus // the version saved on disk will be preserved until the // user selects Save(). - + bool err = false; Track *t; TrackListIterator iter(mTracks); @@ -2499,7 +2499,7 @@ void AudacityProject::OpenFile(wxString fileName, bool addtohistory) if (t->GetErrorOpening()) { wxLogWarning( - wxT("Track %s had error reading clip values from project file."), + wxT("Track %s had error reading clip values from project file."), t->GetName().c_str()); err = true; } @@ -2516,12 +2516,12 @@ void AudacityProject::OpenFile(wxString fileName, bool addtohistory) if (l->GetLinked()) { wxLogWarning( - wxT("Left track %s had linked right track %s with extra right track link.\n Removing extra link from right track."), + wxT("Left track %s had linked right track %s with extra right track link.\n Removing extra link from right track."), t->GetName().c_str(), l->GetName().c_str()); err = true; l->SetLinked(false); } - + // Channels should be left and right if ( !( (t->GetChannel() == Track::LeftChannel && l->GetChannel() == Track::RightChannel) || @@ -2529,7 +2529,7 @@ void AudacityProject::OpenFile(wxString fileName, bool addtohistory) l->GetChannel() == Track::LeftChannel) ) ) { wxLogWarning( - wxT("Track %s and %s had left/right track links out of order. Setting tracks to not be linked."), + wxT("Track %s and %s had left/right track links out of order. Setting tracks to not be linked."), t->GetName().c_str(), l->GetName().c_str()); err = true; t->SetLinked(false); @@ -2538,7 +2538,7 @@ void AudacityProject::OpenFile(wxString fileName, bool addtohistory) else { wxLogWarning( - wxT("Track %s had link to NULL track. Setting it to not be linked."), + wxT("Track %s had link to NULL track. Setting it to not be linked."), t->GetName().c_str()); err = true; t->SetLinked(false); @@ -2569,27 +2569,27 @@ void AudacityProject::OpenFile(wxString fileName, bool addtohistory) // recovered file mFileName is faked to point to the original file // which has been recovered, not the one in the auto-save folder. GetDirManager()->ProjectFSCK(err, true); // Correct problems in auto-recover mode. - - // PushState calls AutoSave(), so no longer need to do so here. + + // PushState calls AutoSave(), so no longer need to do so here. this->PushState(_("Project was recovered"), _("Recover")); - + if (!wxRemoveFile(fileName)) wxMessageBox(_("Could not remove old auto save file"), _("Error"), wxICON_STOP, this); - } + } else { // This is a regular project, check it and ask user int status = GetDirManager()->ProjectFSCK(err, false); - if (status & FSCKstatus_CLOSE_REQ) + if (status & FSCKstatus_CLOSE_REQ) { - // Vaughan, 2010-08-23: Note this did not do a real close. - // It could cause problems if you get this, say on missing alias files, - // then try to open a project with, e.g., missing blockfiles. - // It then failed in SetProject, saying it cannot find the files, - // then never go through ProjectFSCK to give more info. + // Vaughan, 2010-08-23: Note this did not do a real close. + // It could cause problems if you get this, say on missing alias files, + // then try to open a project with, e.g., missing blockfiles. + // It then failed in SetProject, saying it cannot find the files, + // then never go through ProjectFSCK to give more info. // Going through OnClose() may be overkill, but it's safe. - /* + /* // There was an error in the load/check and the user // explictly opted to close the project. mTracks->Clear(true); @@ -2607,8 +2607,8 @@ void AudacityProject::OpenFile(wxString fileName, bool addtohistory) if (t->GetKind() == Track::Wave) { // Only wave tracks have a notion of "changed". - for (WaveClipList::compatibility_iterator clipIter = ((WaveTrack*)t)->GetClipIterator(); - clipIter; + for (WaveClipList::compatibility_iterator clipIter = ((WaveTrack*)t)->GetClipIterator(); + clipIter; clipIter=clipIter->GetNext()) clipIter->GetData()->MarkChanged(); } @@ -2616,18 +2616,18 @@ void AudacityProject::OpenFile(wxString fileName, bool addtohistory) } mTrackPanel->Refresh(true); - // Vaughan, 2010-08-20: This was bogus, as all the actions in DirManager::ProjectFSCK + // Vaughan, 2010-08-20: This was bogus, as all the actions in DirManager::ProjectFSCK // that return FSCKstatus_CHANGED cannot be undone. // this->PushState(_("Project checker repaired file"), _("Project Repair")); - if (status & FSCKstatus_SAVE_AUP) + if (status & FSCKstatus_SAVE_AUP) this->Save(); } } } else { - // Vaughan, 2011-10-30: + // Vaughan, 2011-10-30: // See first topic at http://bugzilla.audacityteam.org/show_bug.cgi?id=451#c16. - // Calling mTracks->Clear() with deleteTracks true results in data loss. + // Calling mTracks->Clear() with deleteTracks true results in data loss. mTracks->Clear(); //mTracks->Clear(true); mFileName = wxT(""); @@ -2638,7 +2638,7 @@ void AudacityProject::OpenFile(wxString fileName, bool addtohistory) _("Error Opening Project"), wxOK | wxCENTRE, this); } - + // Clean up now unused recording recovery handler if any if (mRecordingRecoveryHandler) { @@ -2657,26 +2657,26 @@ void AudacityProject::OpenFile(wxString fileName, bool addtohistory) if(ODManager::HasLoadedODFlag()) { Track *tr; - TrackListIterator triter(mTracks); + TrackListIterator triter(mTracks); tr = triter.First(); - + std::vector newTasks; ODTask* newTask; //std::vector decodeTasks; unsigned int createdODTasks=0; while (tr) { if (tr->GetKind() == Track::Wave) { - //check the track for blocks that need decoding. - //There may be more than one type e.g. FLAC/FFMPEG/lame + //check the track for blocks that need decoding. + //There may be more than one type e.g. FLAC/FFMPEG/lame unsigned int odFlags; odFlags=((WaveTrack*)tr)->GetODFlags(); - + //add the track to the already created tasks that correspond to the od flags in the wavetrack. for(unsigned int i=0;iGetODType() & odFlags) newTasks[i]->AddWaveTrack((WaveTrack*)tr); } - + //create whatever new tasks we need to. //we want at most one instance of each class for the project while((odFlags|createdODTasks) != createdODTasks) @@ -2687,7 +2687,7 @@ void AudacityProject::OpenFile(wxString fileName, bool addtohistory) newTask= new ODDecodeFlacTask; createdODTasks= createdODTasks | ODTask::eODFLAC; } - else + else #endif if(!(createdODTasks&ODTask::eODPCMSummary) && odFlags & ODTask::eODPCMSummary) { newTask=new ODComputeSummaryTask; @@ -2703,13 +2703,13 @@ void AudacityProject::OpenFile(wxString fileName, bool addtohistory) newTask->AddWaveTrack((WaveTrack*)tr); newTasks.push_back(newTask); } - } + } } tr = triter.Next(); } - for(unsigned int i=0;iAddNewTask(newTasks[i]); - + //release the flag. ODManager::UnmarkLoadedODFlag(); } @@ -2762,10 +2762,10 @@ bool AudacityProject::HandleXMLTag(const wxChar *tag, const wxChar **attrs) if (!wxStrcmp(attr, wxT("projname"))) { wxString projName; wxString projPath; - + if (mIsRecovered) { // Fake the filename as if we had opened the original file - // (which was lost by the crash) rather than the one in the + // (which was lost by the crash) rather than the one in the // auto save folder wxFileName realFileDir; realFileDir.AssignDir(mRecoveryAutoSaveDataDir); @@ -2777,7 +2777,7 @@ bool AudacityProject::HandleXMLTag(const wxChar *tag, const wxChar **attrs) { realFileName = realFileName.Left(realFileName.Length() - 5); } - + if (realFileName.IsEmpty()) { // A previously unsaved project has been recovered, so fake @@ -2802,7 +2802,7 @@ bool AudacityProject::HandleXMLTag(const wxChar *tag, const wxChar **attrs) } if (!projName.IsEmpty()) - { + { // First try to load the data files based on the _data dir given in the .aup file // If this fails then try to use the filename of the .aup as the base directory // This is because unzipped projects e.g. those that get transfered between mac-pc @@ -2857,14 +2857,14 @@ bool AudacityProject::HandleXMLTag(const wxChar *tag, const wxChar **attrs) } // while // Specifically detect newer versions of Audacity - // WARNING: This will need review/revision if we ever have a version string + // WARNING: This will need review/revision if we ever have a version string // such as 1.5.10, i.e. with 2 digit numbers. - // We're able to do a shortcut and use string comparison because we know + // We're able to do a shortcut and use string comparison because we know // that does not happen. - if (!bFileVersionFound || + if (!bFileVersionFound || (fileVersion.Length() != 5) || // expecting '1.1.0', for example - !XMLValueChecker::IsGoodInt(fileVersion) || + !XMLValueChecker::IsGoodInt(fileVersion) || (fileVersion > wxT(AUDACITY_FILE_FORMAT_VERSION))) { wxString msg; @@ -2879,18 +2879,18 @@ bool AudacityProject::HandleXMLTag(const wxChar *tag, const wxChar **attrs) } // NOTE: It looks as if there was some confusion about fileversion and audacityversion. - // fileversion NOT being increased when file formats changed, so unfortunately we're + // fileversion NOT being increased when file formats changed, so unfortunately we're // using audacityversion to rescue the situation. - // KLUDGE: guess the true 'fileversion' by stripping away any '-beta-Rc' stuff on + // KLUDGE: guess the true 'fileversion' by stripping away any '-beta-Rc' stuff on // audacityVersion. - // It's fairly safe to do this as it has already been established that the + // It's fairly safe to do this as it has already been established that the // puported file version was five chars long. fileVersion = audacityVersion.Mid(0,5); bool bIsOld = fileVersion < wxT(AUDACITY_FILE_FORMAT_VERSION); bool bIsVeryOld = fileVersion < wxT("1.1.9" ); - // Very old file versions could even have the file version starting + // Very old file versions could even have the file version starting // with text: 'AudacityProject Version 0.95' // Atoi return zero in this case. bIsVeryOld |= wxAtoi( fileVersion )==0; @@ -2958,7 +2958,7 @@ XMLTagHandler *AudacityProject::HandleXMLChild(const wxChar *tag) mTracks->Add(newTrack); return newTrack; } - + if (!wxStrcmp(tag, wxT("recordingrecovery"))) { if (!mRecordingRecoveryHandler) mRecordingRecoveryHandler = new RecordingRecoveryHandler(this); @@ -2966,7 +2966,7 @@ XMLTagHandler *AudacityProject::HandleXMLChild(const wxChar *tag) } if (!wxStrcmp(tag, wxT("import"))) { - if (mImportXMLTagHandler == NULL) + if (mImportXMLTagHandler == NULL) mImportXMLTagHandler = new ImportXMLTagHandler(this); return mImportXMLTagHandler; } @@ -3045,17 +3045,17 @@ void AudacityProject::WriteXML(XMLWriter &xmlFile) xmlFile.StartTag(wxT("import")); xmlFile.WriteAttr(wxT("filename"), mStrOtherNamesArray[ndx]); // Assumes mTracks order hasn't changed! - // Don't store "channel" and "linked" tags because the importer can figure that out, - // e.g., from stereo Ogg files. + // Don't store "channel" and "linked" tags because the importer can figure that out, + // e.g., from stereo Ogg files. // xmlFile.WriteAttr(wxT("channel"), t->GetChannel()); // xmlFile.WriteAttr(wxT("linked"), t->GetLinked()); - + xmlFile.WriteAttr(wxT("offset"), t->GetOffset(), 8); xmlFile.WriteAttr(wxT("mute"), t->GetMute()); xmlFile.WriteAttr(wxT("solo"), t->GetSolo()); xmlFile.WriteAttr(wxT("height"), t->GetActualHeight()); xmlFile.WriteAttr(wxT("minimized"), t->GetMinimized()); - + pWaveTrack = (WaveTrack*)t; // Don't store "rate" tag because the importer can figure that out. // xmlFile.WriteAttr(wxT("rate"), pWaveTrack->GetRate()); @@ -3107,10 +3107,10 @@ void AudacityProject::UnlockAllBlocks() } bool AudacityProject::Save(bool overwrite /* = true */ , - bool fromSaveAs /* = false */, - bool bWantSaveCompressed /*= false*/) + bool fromSaveAs /* = false */, + bool bWantSaveCompressed /*= false*/) { - if (bWantSaveCompressed) + if (bWantSaveCompressed) wxASSERT(fromSaveAs); else { @@ -3163,7 +3163,7 @@ bool AudacityProject::Save(bool overwrite /* = true */ , } if (fromSaveAs || mDirManager->GetProjectName() == wxT("")) { - // Write the tracks. + // Write the tracks. // This block of code is duplicated in WriteXML, for now... wxString project = mFileName; @@ -3171,7 +3171,7 @@ bool AudacityProject::Save(bool overwrite /* = true */ , project = project.Mid(0, project.Len() - 4); wxString projName = wxFileNameFromPath(project) + wxT("_data"); wxString projPath = wxPathOnly(project); - + mWantSaveCompressed = bWantSaveCompressed; bool success = false; @@ -3189,7 +3189,7 @@ bool AudacityProject::Save(bool overwrite /* = true */ , if (bWantSaveCompressed) { //v Move this condition into SaveCompressedWaveTracks() if want to support other formats. - #ifdef USE_LIBVORBIS + #ifdef USE_LIBVORBIS success = this->SaveCompressedWaveTracks(project); #endif } @@ -3197,22 +3197,22 @@ bool AudacityProject::Save(bool overwrite /* = true */ , { // We are about to move files from the current directory to // the new directory. We need to make sure files that belonged - // to the last saved project don't get erased, so we "lock" them, so that + // to the last saved project don't get erased, so we "lock" them, so that // SetProject() copies instead of moves the files. // (Otherwise the new project would be fine, but the old one would // be empty of all of its files.) - - if (mLastSavedTracks && !overwrite) + + if (mLastSavedTracks && !overwrite) LockAllBlocks(); // This renames the project directory, and moves or copies // all of our block files over. success = mDirManager->SetProject(projPath, projName, !overwrite); - + if (mLastSavedTracks && !overwrite) UnlockAllBlocks(); } - + if (!success) { if (safetyFileName != wxT("")) wxRename(safetyFileName, mFileName); @@ -3224,7 +3224,7 @@ bool AudacityProject::Save(bool overwrite /* = true */ , } } - // Write the AUP file. + // Write the AUP file. XMLFileWriter saveFile; try @@ -3253,17 +3253,17 @@ bool AudacityProject::Save(bool overwrite /* = true */ , wxRemove(mFileName); wxRename(safetyFileName, mFileName); } - + return false; } - + #ifdef __WXMAC__ wxFileName fn(mFileName); fn.MacSetTypeAndCreator(AUDACITY_PROJECT_TYPE, AUDACITY_CREATOR); #endif if (bWantSaveCompressed) - mWantSaveCompressed = false; // Don't want this mode for AudacityProject::WriteXML() any more. + mWantSaveCompressed = false; // Don't want this mode for AudacityProject::WriteXML() any more. else { // Now that we have saved the file, we can delete the auto-saved version @@ -3275,7 +3275,7 @@ bool AudacityProject::Save(bool overwrite /* = true */ , // old, crashed .aup file. There may still be orphaned blockfiles in // this directory left over from the crash, so we delete them now mDirManager->RemoveOrphanBlockfiles(); - + // Before we saved this, this was a recovered project, but now it is // a regular project, so remember this. mIsRecovered = false; @@ -3301,15 +3301,15 @@ bool AudacityProject::Save(bool overwrite /* = true */ , while (t) { dupT = t->Duplicate(); mLastSavedTracks->Add(dupT); - + //only after the xml has been saved we can mark it saved. //thus is because the OD blockfiles change on background thread while this is going on. // if(dupT->GetKind() == Track::Wave) - // ((WaveTrack*)dupT)->MarkSaved(); - + // ((WaveTrack*)dupT)->MarkSaved(); + t = iter.Next(); } - + mUndoManager.StateSaved(); } @@ -3321,17 +3321,17 @@ bool AudacityProject::Save(bool overwrite /* = true */ , mStatusBar->SetStatusText(wxString::Format(_("Saved %s"), mFileName.c_str())); - + return true; } #ifdef USE_LIBVORBIS bool AudacityProject::SaveCompressedWaveTracks(const wxString strProjectPathName) // full path for aup except extension { - // Some of this is similar to code in ExportMultiple::ExportMultipleByTrack + // Some of this is similar to code in ExportMultiple::ExportMultipleByTrack // but that code is really tied into the dialogs. - // Copy the tracks because we're going to do some state changes before exporting. + // Copy the tracks because we're going to do some state changes before exporting. Track* pSavedTrack; Track* pTrack; WaveTrack* pWaveTrack; @@ -3340,15 +3340,15 @@ bool AudacityProject::Save(bool overwrite /* = true */ , TrackList* pSavedTrackList = new TrackList(); for (pTrack = iter.First(); pTrack != NULL; pTrack = iter.Next()) { - numWaveTracks++; + numWaveTracks++; pWaveTrack = (WaveTrack*)pTrack; pSavedTrack = mTrackFactory->DuplicateWaveTrack(*pWaveTrack); pSavedTrackList->Add(pSavedTrack); } - if (numWaveTracks == 0) + if (numWaveTracks == 0) { - // Nothing to save compressed => success. Delete the copies and go. + // Nothing to save compressed => success. Delete the copies and go. delete pSavedTrackList; return true; } @@ -3361,17 +3361,17 @@ bool AudacityProject::Save(bool overwrite /* = true */ , pWaveTrack->SetMute(false); pWaveTrack->SetSolo(false); - pWaveTrack->SetGain(1.0); - pWaveTrack->SetPan(0.0); + pWaveTrack->SetGain(1.0); + pWaveTrack->SetPan(0.0); } wxString strDataDirPathName = strProjectPathName + wxT("_data"); - if (!wxFileName::DirExists(strDataDirPathName) && + if (!wxFileName::DirExists(strDataDirPathName) && !wxFileName::Mkdir(strDataDirPathName, 0777, wxPATH_MKDIR_FULL)) return false; strDataDirPathName += wxFileName::GetPathSeparator(); - // Export all WaveTracks to OGG. + // Export all WaveTracks to OGG. bool bSuccess = true; Exporter theExporter; Track* pRightTrack; @@ -3386,14 +3386,14 @@ bool AudacityProject::Save(bool overwrite /* = true */ , pRightTrack = iter.Next(); pRightTrack->SetSelected(true); } - else + else pRightTrack = NULL; uniqueTrackFileName = wxFileName(strDataDirPathName, pTrack->GetName(), wxT("ogg")); FileNames::MakeNameUnique(mStrOtherNamesArray, uniqueTrackFileName); - bSuccess = - theExporter.Process(this, pRightTrack ? 2 : 1, - wxT("OGG"), uniqueTrackFileName.GetFullPath(), true, + bSuccess = + theExporter.Process(this, pRightTrack ? 2 : 1, + wxT("OGG"), uniqueTrackFileName.GetFullPath(), true, pTrack->GetStartTime(), pTrack->GetEndTime()); pTrack->SetSelected(false); @@ -3402,10 +3402,10 @@ bool AudacityProject::Save(bool overwrite /* = true */ , } } - // Restore the saved track states and clean up. + // Restore the saved track states and clean up. TrackListIterator savedTrackIter(pSavedTrackList); - for (pTrack = iter.First(), pSavedTrack = savedTrackIter.First(); - ((pTrack != NULL) && (pSavedTrack != NULL)); + for (pTrack = iter.First(), pSavedTrack = savedTrackIter.First(); + ((pTrack != NULL) && (pSavedTrack != NULL)); pTrack = iter.Next(), pSavedTrack = savedTrackIter.Next()) { pWaveTrack = (WaveTrack*)pTrack; @@ -3449,7 +3449,7 @@ void AudacityProject::AddImportedTracks(wxString fileName, else { newTracks[i]->SetName(trackNameBase); } - + // Check if new track contains aliased blockfiles and if yes, // remember this to show a warning later if (newTracks[i]->GetKind() == WaveTrack::Wave) @@ -3510,10 +3510,10 @@ bool AudacityProject::Import(wxString fileName, WaveTrackArray* pTrackArray /*= if (!errorMessage.IsEmpty()) { // Version that goes to internet... // ShowErrorDialog(this, _("Error Importing"), -// errorMessage, wxT("http://audacity.sourceforge.net/help/faq?s=files&i=wma-proprietary")); +// errorMessage, wxT("http://audacity.sourceforge.net/help/faq?s=files&i=wma-proprietary")); // Version that looks locally for the text. ShowErrorDialog(this, _("Error Importing"), - errorMessage, wxT("innerlink:wma-proprietary")); + errorMessage, wxT("innerlink:wma-proprietary")); } if (numTracks <= 0) return false; @@ -3526,7 +3526,7 @@ bool AudacityProject::Import(wxString fileName, WaveTrackArray* pTrackArray /*= return false; } - // Have to set up newTrackList before calling AddImportedTracks, + // Have to set up newTrackList before calling AddImportedTracks, // because AddImportedTracks deletes newTracks. if (pTrackArray) { for (int i = 0; i < numTracks; i++) { @@ -3555,19 +3555,19 @@ bool AudacityProject::SaveAs(const wxString newFileName, bool bWantSaveCompresse { wxString oldFileName = mFileName; - //check to see if the new project file already exists. + //check to see if the new project file already exists. //We should only overwrite it if this project already has the same name, where the user //simply chose to use the save as command although the save command would have the effect. if(mFileName!=newFileName && wxFileExists(newFileName)) { wxMessageDialog m( - NULL, - _("The project was not saved because the file name provided would overwrite another project.\nPlease try again and select an original name."), - _("Error Saving Project"), + NULL, + _("The project was not saved because the file name provided would overwrite another project.\nPlease try again and select an original name."), + _("Error Saving Project"), wxOK|wxICON_ERROR); m.ShowModal(); return false; } - + mFileName = newFileName; SetProjectTitle(); @@ -3575,8 +3575,8 @@ bool AudacityProject::SaveAs(const wxString newFileName, bool bWantSaveCompresse if (success && addToHistory) { wxGetApp().AddFileToHistory(mFileName); - } - if (!success || bWantSaveCompressed) // bWantSaveCompressed doesn't actually change current project. + } + if (!success || bWantSaveCompressed) // bWantSaveCompressed doesn't actually change current project. { // Reset file name on error mFileName = oldFileName; @@ -3610,7 +3610,7 @@ Compressed project files are a good way to transmit your project online, \n\ but they have some loss of fidelity.\n\n\ \ To open a compressed project takes longer than usual, as it imports \n\ -each compressed track.\n"), +each compressed track.\n"), true) != wxID_OK) return false; sDialogTitle.Printf(_("Save Compressed Project \"%s\" As..."), sProjName.c_str()); @@ -3620,7 +3620,7 @@ each compressed track.\n"), if (ShowWarningDialog(this, wxT("FirstProjectSave"), _("\ 'Save Project' is for an Audacity project, not an audio file.\n\ -For an audio file that will open in other apps, use 'Export'.\n"), +For an audio file that will open in other apps, use 'Export'.\n"), true) != wxID_OK) return false; sDialogTitle.Printf(_("Save Project \"%s\" As..."), sProjName.c_str()); @@ -3630,7 +3630,7 @@ For an audio file that will open in other apps, use 'Export'.\n"), sDialogTitle, path, fName, wxT(""), _("Audacity projects") + static_cast(wxT(" (*.aup)|*.aup")), - // JKC: I removed 'wxFD_OVERWRITE_PROMPT' because we are checking + // JKC: I removed 'wxFD_OVERWRITE_PROMPT' because we are checking // for overwrite ourselves later, and we disallow it. // We disallow overwrite because we would have to delete the many // smaller files too, or prompt to move them. @@ -3645,19 +3645,19 @@ For an audio file that will open in other apps, use 'Export'.\n"), wxString oldFileName = mFileName; - //check to see if the new project file already exists. + //check to see if the new project file already exists. //We should only overwrite it if this project already has the same name, where the user //simply chose to use the save as command although the save command would have the effect. if(mFileName!=fName+ext && wxFileExists(fName+ext)) { wxMessageDialog m( - NULL, - _("The project was not saved because the file name provided would overwrite another project.\nPlease try again and select an original name."), - _("Error Saving Project"), + NULL, + _("The project was not saved because the file name provided would overwrite another project.\nPlease try again and select an original name."), + _("Error Saving Project"), wxOK|wxICON_ERROR); m.ShowModal(); return false; } - + mFileName = fName + ext; SetProjectTitle(); @@ -3665,8 +3665,8 @@ For an audio file that will open in other apps, use 'Export'.\n"), if (success) { wxGetApp().AddFileToHistory(mFileName); - } - if (!success || bWantSaveCompressed) // bWantSaveCompressed doesn't actually change current project. + } + if (!success || bWantSaveCompressed) // bWantSaveCompressed doesn't actually change current project. { // Reset file name on error mFileName = oldFileName; @@ -3690,7 +3690,7 @@ void AudacityProject::InitialState() delete mImportXMLTagHandler; mImportXMLTagHandler = NULL; } - + mUndoManager.ClearStates(); mUndoManager.PushState(mTracks, mViewInfo.sel0, mViewInfo.sel1, @@ -3723,13 +3723,13 @@ void AudacityProject::PushState(wxString desc, ModifyUndoMenuItems(); UpdateMenus(); - - // Some state pushes, like changing a track gain control (& probably others), - // should not repopulate Lyrics Window and MixerBoard. - // Others, such as deleting a label or adding a wave track, obviously do. + + // Some state pushes, like changing a track gain control (& probably others), + // should not repopulate Lyrics Window and MixerBoard. + // Others, such as deleting a label or adding a wave track, obviously do. // Could categorize these state changes, but for now... - // It's crucial to not do that repopulating during playback. - if (!gAudioIO->IsStreamActive(GetAudioIOToken())) + // It's crucial to not do that repopulating during playback. + if (!gAudioIO->IsStreamActive(GetAudioIOToken())) { this->UpdateLyrics(); this->UpdateMixerBoard(); @@ -3749,7 +3749,7 @@ void AudacityProject::ModifyState(bool bWantsAutoSave) } // LL: Is there a memory leak here as "l" and "t" are not deleted??? -// Vaughan, 2010-08-29: No, as "l" is a TrackList* of an Undo stack state. +// Vaughan, 2010-08-29: No, as "l" is a TrackList* of an Undo stack state. // Need to keep it and its tracks "t" available for Undo/Redo/SetStateTo. void AudacityProject::PopState(TrackList * l) { @@ -3760,11 +3760,11 @@ void AudacityProject::PopState(TrackList * l) ODComputeSummaryTask* computeTask = NULL; Track* copyTrack; - while (t) + while (t) { copyTrack=t->Duplicate(); mTracks->Add(copyTrack); - + //add the track to OD if the manager exists. later we might do a more rigorous check... if (copyTrack->GetKind() == Track::Wave) { @@ -3772,8 +3772,8 @@ void AudacityProject::PopState(TrackList * l) //is a "Redo" operation. //TODO: update this to look like the update loop in OpenFile that handles general purpose ODTasks. //BUT, it is too slow to go thru every blockfile and check the odtype, so maybe put a flag in wavetrack - //that gets unset on OD Completion, (and we could also update the drawing there too.) The hard part is that - //we would need to watch every possible way a OD Blockfile could get inserted into a wavetrack and change the + //that gets unset on OD Completion, (and we could also update the drawing there too.) The hard part is that + //we would need to watch every possible way a OD Blockfile could get inserted into a wavetrack and change the //flag there. if(ODManager::IsInstanceCreated()) { @@ -3817,9 +3817,9 @@ void AudacityProject::SetStateTo(unsigned int n) void AudacityProject::UpdateLyrics() { - // JKC: Previously we created a lyrics window, + // JKC: Previously we created a lyrics window, // if it did not exist. But we don't need to. - if (!mLyricsWindow) + if (!mLyricsWindow) return; TrackListOfKindIterator iter(Track::Label, mTracks); @@ -3836,7 +3836,7 @@ void AudacityProject::UpdateLyrics() Lyrics* pLyricsPanel = mLyricsWindow->GetLyricsPanel(); pLyricsPanel->Clear(); - for (int i = 0; i < pLabelTrack->GetNumLabels(); i++) + for (int i = 0; i < pLabelTrack->GetNumLabels(); i++) pLyricsPanel->Add(pLabelTrack->GetLabel(i)->t, pLabelTrack->GetLabel(i)->title); pLyricsPanel->Finish(pLabelTrack->GetEndTime()); @@ -3849,9 +3849,9 @@ void AudacityProject::UpdateMixerBoard() return; mMixerBoard->UpdateTrackClusters(); - // Vaughan, 2011-01-28: AudacityProject::UpdateMixerBoard() is called on state changes, + // Vaughan, 2011-01-28: AudacityProject::UpdateMixerBoard() is called on state changes, // so don't really need to call UpdateMeters(). - //mMixerBoard->UpdateMeters(gAudioIO->GetStreamTime(), (mLastPlayMode == loopedPlay)); + //mMixerBoard->UpdateMeters(gAudioIO->GetStreamTime(), (mLastPlayMode == loopedPlay)); } // @@ -3946,11 +3946,11 @@ void AudacityProject::Zoom(double level) /////////////////////////////////////////////////////////////////// // This method 'rewinds' the track, by setting the cursor to 0 and -// scrolling the window to fit 0 on the left side of it -// (maintaining current zoom). -// If shift is held down, it will extend the left edge of the +// scrolling the window to fit 0 on the left side of it +// (maintaining current zoom). +// If shift is held down, it will extend the left edge of the // selection to 0 (holding right edge constant), otherwise it will -// move both left and right edge of selection to 0 +// move both left and right edge of selection to 0 /////////////////////////////////////////////////////////////////// void AudacityProject::Rewind(bool shift) { @@ -3965,10 +3965,10 @@ void AudacityProject::Rewind(bool shift) /////////////////////////////////////////////////////////////////// // This method 'fast-forwards' the track, by setting the cursor to // the end of the samples on the selected track and scrolling the -// window to fit the end on its right side (maintaining current zoom). -// If shift is held down, it will extend the right edge of the +// window to fit the end on its right side (maintaining current zoom). +// If shift is held down, it will extend the right edge of the // selection to the end (holding left edge constant), otherwise it will -// move both left and right edge of selection to the end +// move both left and right edge of selection to the end /////////////////////////////////////////////////////////////////// void AudacityProject::SkipEnd(bool shift) { @@ -3998,8 +3998,8 @@ ControlToolBar *AudacityProject::GetControlToolBar() //JKC: same as above *except* this a virtual function that //can be called from the track panel callback. -//It seems a little crazy doing this but TrackArtist -//needs to get information about the tool bar state and +//It seems a little crazy doing this but TrackArtist +//needs to get information about the tool bar state and //I don't currently see a cleaner way. ControlToolBar * AudacityProject::TP_GetControlToolBar() { @@ -4058,7 +4058,7 @@ ToolsToolBar *AudacityProject::GetToolsToolBar() mToolManager->GetToolBar(ToolsBarID) : NULL); } - + TranscriptionToolBar *AudacityProject::GetTranscriptionToolBar() { return (TranscriptionToolBar *) @@ -4081,7 +4081,7 @@ void AudacityProject::OnTimer(wxTimerEvent& WXUNUSED(event)) if (::wxGetUTCTime() - mLastStatusUpdateTime < 3) return; - // gAudioIO->GetNumCaptureChannels() should only be positive + // gAudioIO->GetNumCaptureChannels() should only be positive // when we are recording. if (gAudioIO->GetNumCaptureChannels() > 0) { wxLongLong freeSpace = mDirManager->GetFreeDiskSpace(); @@ -4131,18 +4131,18 @@ void AudacityProject::OnTimer(wxTimerEvent& WXUNUSED(event)) //signal the od task queue loop to wake up so it can remove the tasks from the queue and the queue if it is empty. ODManager::Instance()->SignalTaskQueueLoop(); - + msg.Printf(_("On-demand import and waveform calculation complete.")); mStatusBar->SetStatusText(msg); } else if(numTasks>1) msg.Printf(_("Import(s) complete. Running %d on-demand waveform calculations. Overall %2.0f%% complete."), - numTasks,ratioComplete*100.0); + numTasks,ratioComplete*100.0); else msg.Printf(_("Import complete. Running an on-demand waveform calculation. %2.0f%% complete."), - ratioComplete*100.0); - + ratioComplete*100.0); + mStatusBar->SetStatusText(msg); } @@ -4156,13 +4156,13 @@ void AudacityProject::GetRegionsByLabel( Regions ®ions ) { TrackListIterator iter( mTracks ); Track *n; - + //determine labelled regions for( n = iter.First(); n; n = iter.Next() ) if( n->GetKind() == Track::Label && n->GetSelected() ) { LabelTrack *lt = ( LabelTrack* )n; - for( int i = 0; i < lt->GetNumLabels(); i++ ) + for( int i = 0; i < lt->GetNumLabels(); i++ ) { const LabelStruct *ls = lt->GetLabel( i ); if( ls->t >= mViewInfo.sel0 && ls->t1 <= mViewInfo.sel1 ) @@ -4178,7 +4178,7 @@ void AudacityProject::GetRegionsByLabel( Regions ®ions ) //anything to do ? if( regions.GetCount() == 0 ) return; - + //sort and remove unnecessary regions regions.Sort( Region::cmp ); unsigned int selected = 1; @@ -4201,14 +4201,14 @@ void AudacityProject::GetRegionsByLabel( Regions ®ions ) //Executes the edit function on all selected wave tracks with //regions specified by selected labels //If No tracks selected, function is applied on all tracks -//If the function replaces the selection with audio of a different length, +//If the function replaces the selection with audio of a different length, // bSyncLockedTracks should be set true to perform the same action on sync-lock selected // tracks. void AudacityProject::EditByLabel( WaveTrack::EditFunction action, bool bSyncLockedTracks ) -{ +{ Regions regions; - + GetRegionsByLabel( regions ); if( regions.GetCount() == 0 ) return; @@ -4225,14 +4225,14 @@ void AudacityProject::EditByLabel( WaveTrack::EditFunction action, allTracks = false; break; } - + //Apply action on wavetracks starting from //labeled regions in the end. This is to correctly perform //actions like 'Delete' which collapse the track area. n = iter.First(); while (n) { - if ((n->GetKind() == Track::Wave) && + if ((n->GetKind() == Track::Wave) && (allTracks || n->GetSelected() || (bSyncLockedTracks && n->IsSyncLockSelected()))) { WaveTrack *wt = ( WaveTrack* )n; @@ -4254,9 +4254,9 @@ void AudacityProject::EditByLabel( WaveTrack::EditFunction action, //This probably should not be called if *action() changes the timeline, because // the copy needs to happen by track, and the timeline change by group. void AudacityProject::EditClipboardByLabel( WaveTrack::EditDestFunction action ) -{ +{ Regions regions; - + GetRegionsByLabel( regions ); if( regions.GetCount() == 0 ) return; @@ -4273,8 +4273,8 @@ void AudacityProject::EditClipboardByLabel( WaveTrack::EditDestFunction action ) allTracks = false; break; } - - ClearClipboard(); + + ClearClipboard(); //Apply action on wavetracks starting from //labeled regions in the end. This is to correctly perform //actions like 'Cut' which collapse the track area. @@ -4287,7 +4287,7 @@ void AudacityProject::EditClipboardByLabel( WaveTrack::EditDestFunction action ) for( int i = ( int )regions.GetCount() - 1; i >= 0; i-- ) { Track *dest = NULL; - ( wt->*action )( regions.Item( i )->start, regions.Item( i )->end, + ( wt->*action )( regions.Item( i )->start, regions.Item( i )->end, &dest ); if( dest ) { @@ -4482,10 +4482,10 @@ void AudacityProject::AutoSave() projName = _("New Project"); else projName = wxFileName(mFileName).GetName(); - + wxString fn = wxFileName(FileNames::AutoSaveDir(), projName + wxString(wxT(" - ")) + CreateUniqueName()).GetFullPath(); - + XMLFileWriter saveFile; try @@ -4518,20 +4518,20 @@ void AudacityProject::AutoSave() // Now that we have a new auto-save file, delete the old one DeleteCurrentAutoSaveFile(); - + if (!mAutoSaveFileName.IsEmpty()) return; // could not remove auto-save file - + if (!wxRenameFile(fn + wxT(".tmp"), fn + wxT(".autosave"))) { wxMessageBox(_("Could not create autosave file: ") + fn + wxT(".autosave"), _("Error"), wxICON_STOP, this); return; } - + mAutoSaveFileName += fn + wxT(".autosave"); // no-op cruft that's not #ifdefed for NoteTrack - // See above for further comments. + // See above for further comments. // SonifyEndAutoSave(); } @@ -4548,7 +4548,7 @@ void AudacityProject::DeleteCurrentAutoSaveFile() return; } } - + mAutoSaveFileName = wxT(""); } } @@ -4598,7 +4598,7 @@ void AudacityProject::OnAudioIOStopRecording() { // Write all cached files to disk, if any mDirManager->WriteCacheToDisk(); - + // Now we auto-save again to get the project to a "normal" state again. AutoSave(); } @@ -4618,9 +4618,9 @@ void AudacityProject::OnAudioIONewBlockFiles(const wxString& blockFileLog) } bool AudacityProject::GetCacheBlockFiles() -{ +{ bool cacheBlockFiles = false; -#ifdef DEPRECATED_AUDIO_CACHE +#ifdef DEPRECATED_AUDIO_CACHE // See http://bugzilla.audacityteam.org/show_bug.cgi?id=545. gPrefs->Read(wxT("/Directories/CacheBlockFiles"), &cacheBlockFiles); #endif @@ -4661,7 +4661,7 @@ void AudacityProject::SetSyncLock(bool flag) void AudacityProject::HandleTrackMute(Track *t, const bool exclusive) { // "exclusive" mute means mute the chosen track and unmute all others. - if (exclusive) + if (exclusive) { TrackListIterator iter(mTracks); Track *i = iter.First(); @@ -4680,7 +4680,7 @@ void AudacityProject::HandleTrackMute(Track *t, const bool exclusive) i = iter.Next(); } } - else + else { // Normal click toggles this track. t->SetMute(!t->GetMute()); @@ -4733,9 +4733,9 @@ void AudacityProject::HandleTrackSolo(Track *t, const bool alternate) // Standard and Simple solo have opposite defaults: // Standard - Behaves as individual buttons, shift=radio buttons // Simple - Behaves as radio buttons, shift=individual - // In addition, Simple solo will mute/unmute tracks + // In addition, Simple solo will mute/unmute tracks // when in standard radio button mode. - if ( bSoloMultiple ) + if ( bSoloMultiple ) { t->SetSolo( !t->GetSolo() ); if(t->GetLinked()) @@ -4750,7 +4750,7 @@ void AudacityProject::HandleTrackSolo(Track *t, const bool alternate) i->SetSolo(soloed); // and solo it as well } } - else + else { // Normal click solo this track only, mute everything else. // OR unmute and unsolo everything. diff --git a/src/Project.h b/src/Project.h index 1b36b78a9..c859c97b7 100644 --- a/src/Project.h +++ b/src/Project.h @@ -100,19 +100,19 @@ enum PlayMode { }; // XML handler for tag -class ImportXMLTagHandler : public XMLTagHandler +class ImportXMLTagHandler : public XMLTagHandler { public: ImportXMLTagHandler(AudacityProject* pProject) { mProject = pProject; }; virtual bool HandleXMLTag(const wxChar *tag, const wxChar **attrs); virtual XMLTagHandler *HandleXMLChild(const wxChar * WXUNUSED(tag)) { return NULL; }; - - // Don't want a WriteXML method because ImportXMLTagHandler is not a WaveTrack. - // tags are instead written by AudacityProject::WriteXML. - // virtual void WriteXML(XMLWriter &xmlFile) { wxASSERT(false); } - private: + // Don't want a WriteXML method because ImportXMLTagHandler is not a WaveTrack. + // tags are instead written by AudacityProject::WriteXML. + // virtual void WriteXML(XMLWriter &xmlFile) { wxASSERT(false); } + + private: AudacityProject* mProject; }; @@ -142,9 +142,9 @@ class AUDACITY_DLL_API AudacityProject: public wxFrame, void GetPlayRegion(double* playRegionStart, double *playRegionEnd); bool IsPlayRegionLocked() { return mLockPlayRegion; } - - void SetSel0(double); //Added by STM - void SetSel1(double); //Added by STM + + void SetSel0(double); //Added by STM + void SetSel1(double); //Added by STM bool Clipboard() { return (msClipT1 - msClipT0) > 0.0; } @@ -180,7 +180,7 @@ class AUDACITY_DLL_API AudacityProject: public wxFrame, * enough to fit in the file dialogue filter drop-down. It should be * translated. * @param extrafilter Specify the file extension(s) for the additional format - * specified by extraformat. The patterns must include the wildcard (e.g. + * specified by extraformat. The patterns must include the wildcard (e.g. * "*.aup" not "aup" or ".aup"), separate multiple patters with a semicolon, * e.g. "*.aup;*.AUP" because patterns are case-sensitive. Do not add a * trailing semicolon to the string. This string should not be translated @@ -195,7 +195,7 @@ class AUDACITY_DLL_API AudacityProject: public wxFrame, bool WarnOfLegacyFile( ); // If pNewTrackList is passed in non-NULL, it gets filled with the pointers to new tracks. - bool Import(wxString fileName, WaveTrackArray *pTrackArray = NULL); + bool Import(wxString fileName, WaveTrackArray *pTrackArray = NULL); void AddImportedTracks(wxString fileName, Track **newTracks, int numTracks); @@ -226,11 +226,11 @@ class AUDACITY_DLL_API AudacityProject: public wxFrame, bool GetNormalizeOnLoad() { return mNormalizeOnLoad; } //lda void SetNormalizeOnLoad(bool flag) { mNormalizeOnLoad = flag; } //lda - /** \brief Sets the wxDialog that is being displayed + /** \brief Sets the wxDialog that is being displayed * Used by the custom dialog warning constructor and destructor */ void SetMissingAliasFileDialog(wxDialog *dialog); - + /** \brief returns a pointer to the wxDialog if it is displayed, NULL otherwise. */ wxDialog *GetMissingAliasFileDialog(); @@ -290,13 +290,13 @@ class AUDACITY_DLL_API AudacityProject: public wxFrame, void Rewind(bool shift); void SkipEnd(bool shift); void SetStop(bool bStopped); - void EditByLabel( WaveTrack::EditFunction action, bool bSyncLockedTracks ); + void EditByLabel( WaveTrack::EditFunction action, bool bSyncLockedTracks ); void EditClipboardByLabel( WaveTrack::EditDestFunction action ); bool IsSyncLocked(); void SetSyncLock(bool flag); // "exclusive" mute means mute the chosen track and unmute all others. - void HandleTrackMute(Track *t, const bool exclusive); + void HandleTrackMute(Track *t, const bool exclusive); // Type of solo (standard or simple) follows the set preference, unless // alternate == true, which causes the opposite behavior. @@ -328,7 +328,7 @@ class AUDACITY_DLL_API AudacityProject: public wxFrame, // TrackPanel access virtual wxSize GetTPTracksUsableArea(); virtual void RefreshTPTrack(Track* pTrk, bool refreshbacking = true); - + // TrackPanel callback methods, overrides of TrackPanelListener virtual void TP_DisplaySelection(); virtual void TP_DisplayStatusMessage(wxString msg); @@ -352,7 +352,7 @@ class AUDACITY_DLL_API AudacityProject: public wxFrame, // ToolBar // In the GUI, ControlToolBar appears as the "Transport Toolbar". "Control Toolbar" is historic. - ControlToolBar *GetControlToolBar(); + ControlToolBar *GetControlToolBar(); DeviceToolBar *GetDeviceToolBar(); EditToolBar *GetEditToolBar(); @@ -391,7 +391,7 @@ class AUDACITY_DLL_API AudacityProject: public wxFrame, wxWindow *HasKeyboardCapture(); void CaptureKeyboard(wxWindow *h); void ReleaseKeyboard(wxWindow *h); - + // Audio IO callback methods virtual void OnAudioIORate(int rate); virtual void OnAudioIOStartRecording(); @@ -401,10 +401,10 @@ class AUDACITY_DLL_API AudacityProject: public wxFrame, // Command Handling bool TryToMakeActionAllowed( wxUint32 & flags, wxUint32 flagsRqd, wxUint32 mask ); - ///Prevents delete from external thread - for e.g. use of GetActiveProject + ///Prevents delete from external thread - for e.g. use of GetActiveProject static void AllProjectsDeleteLock(); static void AllProjectsDeleteUnlock(); - + void PushState(wxString desc, wxString shortDesc, int flags = PUSH_AUTOSAVE | PUSH_CALC_SPACE); @@ -415,15 +415,15 @@ class AUDACITY_DLL_API AudacityProject: public wxFrame, void ModifyState(bool bWantsAutoSave); // if true, writes auto-save file. Should set only if you really want the state change restored after // a crash, as it can take many seconds for large (eg. 10 track-hours) projects void PopState(TrackList * l); - + void UpdateLyrics(); void UpdateMixerBoard(); - + void GetRegionsByLabel( Regions ®ions ); - + void AutoSave(); void DeleteCurrentAutoSaveFile(); - + static bool GetCacheBlockFiles(); public: @@ -527,7 +527,7 @@ class AUDACITY_DLL_API AudacityProject: public wxFrame, bool mShowId3Dialog; //lda bool mEmptyCanBeDirty; bool mSelectAllOnNone; - + bool mIsSyncLocked; bool mLockPlayRegion; @@ -541,16 +541,16 @@ class AUDACITY_DLL_API AudacityProject: public wxFrame, // Last auto-save file name and path (empty if none) wxString mAutoSaveFileName; - + // Are we currently auto-saving or not? bool mAutoSaving; // Has this project been recovered from an auto-saved version bool mIsRecovered; - + // The auto-save data dir the project has been recovered from wxString mRecoveryAutoSaveDataDir; - + // The handler that handles recovery of tags RecordingRecoveryHandler* mRecordingRecoveryHandler; @@ -559,7 +559,7 @@ class AUDACITY_DLL_API AudacityProject: public wxFrame, bool mWantSaveCompressed; wxArrayString mStrOtherNamesArray; // used to make sure compressed file names are unique - + // Last effect applied to this project Effect *mLastEffect; int mLastEffectType; @@ -568,7 +568,7 @@ class AUDACITY_DLL_API AudacityProject: public wxFrame, friend class ScreenshotCommand; wxRect mNormalizedWindowState; - + //flag for cancellation of timer record. bool mTimerRecordCanceled; diff --git a/src/RealFFTf.cpp b/src/RealFFTf.cpp index cb8438bea..80583bbd8 100644 --- a/src/RealFFTf.cpp +++ b/src/RealFFTf.cpp @@ -92,7 +92,7 @@ HFFT InitializeFFT(int fftlen) temp=(temp >> 1) + (i&mask ? h->Points : 0); h->BitReversed[i]=temp; - } + } for(i=0;iPoints;i++) { diff --git a/src/RealFFTf48x.cpp b/src/RealFFTf48x.cpp index 51e9649fe..f41ef336e 100644 --- a/src/RealFFTf48x.cpp +++ b/src/RealFFTf48x.cpp @@ -67,7 +67,7 @@ #pragma warning(disable:4305) #else -#endif +#endif #include "SseMathFuncs.h" #include @@ -89,7 +89,7 @@ void TableUsage(int iMask) useSinCosTable=((iMask&2)!=0); } -// note !!! number of bits must be between 9-16 +// note !!! number of bits must be between 9-16 int SmallReverseBits(int bits, int numberBits) { return (smallReverseBitsTable[*((unsigned char *)&bits)]<<(numberBits-8))+(smallReverseBitsTable[*(((unsigned char *)&bits)+1)]>>(16-numberBits)); @@ -111,7 +111,7 @@ HFFT InitializeFFT1x(int WXUNUSED( fftlen ) ) // this needs to move out but ehh... Andrew Hallendorff for(i=0;i<256;i++) { smallReverseBitsTable[i]=0; - for(int maskLow=1, maskHigh=128;maskLow<256;maskLow<<=1,maskHigh>>=1) + for(int maskLow=1, maskHigh=128;maskLow<256;maskLow<<=1,maskHigh>>=1) if(i&maskLow) smallReverseBitsTable[i]|=maskHigh; } @@ -419,7 +419,7 @@ void RealFFTf4x(fft_type *buffer,HFFT h) int br1Value, br2Value; __m128 HRplus,HRminus,HIplus,HIminus; __m128 v1,v2,sin,cos; - fft_type iToRad=2*M_PI/(2*h->Points); + fft_type iToRad=2*M_PI/(2*h->Points); int ButterfliesPerGroup=h->Points/2; @@ -472,7 +472,7 @@ void RealFFTf4x(fft_type *buffer,HFFT h) v1 = _mm_add_ps( _mm_mul_ps(*B, cos), _mm_mul_ps(*(B+1), sin)); v2 = _mm_sub_ps( _mm_mul_ps(*B, sin), _mm_mul_ps(*(B+1), cos)); *B=_mm_add_ps( *A, v1); - __m128 temp128 = _mm_set1_ps( 2.0); + __m128 temp128 = _mm_set1_ps( 2.0); *(A++)=_mm_sub_ps(*(B++), _mm_mul_ps(temp128, v1)); *B=_mm_sub_ps(*A,v2); *(A++)=_mm_add_ps(*(B++), _mm_mul_ps(temp128, v2)); @@ -538,7 +538,7 @@ void RealFFTf4x(fft_type *buffer,HFFT h) br2Index--; } /* Handle the center bin (just need a conjugate) */ - if(useBitReverseTable) + if(useBitReverseTable) A=&localBuffer[h->BitReversed[br1Index]+1]; else A=&localBuffer[SmallReverseBits(br1Index,h->pow2Bits)+1]; @@ -722,7 +722,7 @@ void ReorderToFreq4x(HFFT hFFT, fft_type *buffer, fft_type *RealOut, fft_type *I // Copy the data into the real and imaginary outputs for(int i=1;iPoints;i++) { int brValue; - if(useBitReverseTable) + if(useBitReverseTable) brValue=hFFT->BitReversed[i]; else brValue=SmallReverseBits(i,hFFT->pow2Bits); @@ -742,7 +742,7 @@ void ReorderToTime4x(HFFT hFFT, fft_type *buffer, fft_type *TimeOut) // Copy the data into the real outputs for(int i=0;iPoints;i++) { int brValue; - if(useBitReverseTable) + if(useBitReverseTable) brValue=hFFT->BitReversed[i]; else brValue=SmallReverseBits(i,hFFT->pow2Bits); diff --git a/src/Resample.cpp b/src/Resample.cpp index 65a2ee311..96f389118 100644 --- a/src/Resample.cpp +++ b/src/Resample.cpp @@ -88,7 +88,7 @@ (int)lastFlag, inBufferUsed, outBuffer, outBufferLen); } -#elif USE_LIBSAMPLERATE +#elif USE_LIBSAMPLERATE #include @@ -184,7 +184,7 @@ wxFprintf(stderr, _("Libsamplerate error: %d\n"), err); return 0; } - + if(lastFlag) { mShouldReset = true; mSamplesLeft = inBufferLen - (int)data.input_frames_used; @@ -202,12 +202,12 @@ { this->SetMethod(useBestMethod); soxr_quality_spec_t q_spec; - if (dMinFactor == dMaxFactor) + if (dMinFactor == dMaxFactor) { mbWantConstRateResampling = true; // constant rate resampling q_spec = soxr_quality_spec("\0\1\4\6"[mMethod], 0); } - else + else { mbWantConstRateResampling = false; // variable rate resampling q_spec = soxr_quality_spec(SOXR_HQ, SOXR_VR); diff --git a/src/Resample.h b/src/Resample.h index abf45fbcf..54b2be6be 100644 --- a/src/Resample.h +++ b/src/Resample.h @@ -24,14 +24,14 @@ class Resample { public: /// Resamplers may have more than one method, offering a - /// tradeoff between speed and quality. + /// tradeoff between speed and quality. /// Audacity identifies two methods out of all of the choices: /// a Fast method intended for real-time audio I/O, and a Best - /// method intended for mixing and exporting. + /// method intended for mixing and exporting. // /// The first parameter lets you select either the best method or - /// the fast method. - // dMinFactor and dMaxFactor specify the range of factors for variable-rate resampling. + /// the fast method. + // dMinFactor and dMaxFactor specify the range of factors for variable-rate resampling. // For constant-rate, pass the same value for both. Resample(const bool useBestMethod, const double dMinFactor, const double dMaxFactor); virtual ~Resample(); @@ -44,14 +44,14 @@ class Resample static int GetFastMethodDefault(); static int GetBestMethodDefault(); - /** @brief Main processing function. Resamples from the input buffer to the + /** @brief Main processing function. Resamples from the input buffer to the * output buffer. * * Reads samples from the input buffer, and writes samples to the output * buffer. Stops when either is exhaughsted, or we reach a convenient block * end, unless lastFlag is set to force emptying the input buffer. * The number of input samples used is returned in inBufferUsed, and the - * number of output samples generated is the return value of the function. + * number of output samples generated is the return value of the function. * This function may do nothing if you don't pass a large enough output * buffer (i.e. there is no where to put a full block of output data) @param factor The scaling factor to resample by. @@ -59,7 +59,7 @@ class Resample @param inBufferLen Length of the input buffer, in samples. @param lastFlag Flag to indicate this is the last lot of input samples and the buffer needs to be emptied out into the rate converter. - @param inBufferUsed Number of samples from inBuffer that have been used + @param inBufferUsed Number of samples from inBuffer that have been used (unless lastFlag is true, we don't garuntee to process all the samples in the input this time, we may leave some for next time) @param outBuffer Buffer to write output (converted) samples to. @@ -86,11 +86,11 @@ class Resample protected: int mMethod; // resampler-specific enum for resampling method void* mHandle; // constant-rate or variable-rate resampler (XOR per instance) -#if USE_LIBSAMPLERATE +#if USE_LIBSAMPLERATE bool mShouldReset; // whether the resampler should be reset because lastFlag has been set previously int mSamplesLeft; // number of samples left before a reset is needed #elif USE_LIBSOXR - bool mbWantConstRateResampling; + bool mbWantConstRateResampling; #endif }; diff --git a/src/RingBuffer.cpp b/src/RingBuffer.cpp index 1ef7d4092..b2c5ea740 100644 --- a/src/RingBuffer.cpp +++ b/src/RingBuffer.cpp @@ -72,7 +72,7 @@ int RingBuffer::Put(samplePtr buffer, sampleFormat format, block = samplesToCopy; if (block > mBufferSize - pos) block = mBufferSize - pos; - + CopySamples(src, format, mBuffer + pos * SAMPLE_SIZE(mFormat), mFormat, block); diff --git a/src/RingBuffer.h b/src/RingBuffer.h index a1bfc0033..6712129be 100644 --- a/src/RingBuffer.h +++ b/src/RingBuffer.h @@ -35,7 +35,7 @@ class RingBuffer { private: int Len(); - + sampleFormat mFormat; int mStart; int mEnd; diff --git a/src/SampleFormat.cpp b/src/SampleFormat.cpp index fbeb78b32..7ea934079 100644 --- a/src/SampleFormat.cpp +++ b/src/SampleFormat.cpp @@ -20,7 +20,7 @@ Integer formats use the full signed range of their data type, for example 16-bit samples use the range -32768...32767. This means that reading in a wav file and writing it out again - ('round tripping'), via floats, is lossless; -32768 equates to -1.0f + ('round tripping'), via floats, is lossless; -32768 equates to -1.0f and 32767 equates to +1.0f - (a little bit). It also means (unfortunatly) that writing out +1.0f leads to clipping by 1 LSB. This creates some distortion, but I (MJS) have diff --git a/src/SampleFormat.h b/src/SampleFormat.h index 3a9027da8..2cbdea830 100644 --- a/src/SampleFormat.h +++ b/src/SampleFormat.h @@ -62,7 +62,7 @@ void CopySamplesNoDither(samplePtr src, sampleFormat srcFormat, unsigned int len, unsigned int srcStride=1, unsigned int dstStride=1); - + void ClearSamples(samplePtr buffer, sampleFormat format, int start, int len); diff --git a/src/Screenshot.cpp b/src/Screenshot.cpp index b587d7e95..d794bd376 100644 --- a/src/Screenshot.cpp +++ b/src/Screenshot.cpp @@ -3,7 +3,7 @@ Audacity: A Digital Audio Editor Screenshot.cpp - + Dominic Mazzoni *******************************************************************/ @@ -444,7 +444,7 @@ void ScreenFrame::PopulateOrExchange(ShuttleGui & S) Move(displayWidth - width - 16, top + 16); } else { - CentreOnParent(); + CentreOnParent(); } SetIcon(mContext.proj->GetIcon()); @@ -508,7 +508,7 @@ void ScreenFrame::OnDirChoose(wxCommandEvent & WXUNUSED(event)) { wxString current = mDirectoryTextBox->GetValue(); - wxDirDialog dlog(this, + wxDirDialog dlog(this, _("Choose a location to save screenshot images"), current); diff --git a/src/Screenshot.h b/src/Screenshot.h index 2511477f1..3d19f7ca7 100644 --- a/src/Screenshot.h +++ b/src/Screenshot.h @@ -3,7 +3,7 @@ Audacity: A Digital Audio Editor Screenshot.h - + Dominic Mazzoni *******************************************************************//** diff --git a/src/Sequence.cpp b/src/Sequence.cpp index eef27a26c..02883db67 100644 --- a/src/Sequence.cpp +++ b/src/Sequence.cpp @@ -13,17 +13,17 @@ *//****************************************************************//** \class Sequence -\brief A WaveTrack contains WaveClip(s). - A WaveClip contains a Sequence. A Sequence is primarily an - interface to an array of SeqBlock instances, corresponding to +\brief A WaveTrack contains WaveClip(s). + A WaveClip contains a Sequence. A Sequence is primarily an + interface to an array of SeqBlock instances, corresponding to the audio BlockFiles on disk. Contrast with RingBuffer. *//****************************************************************//** \class SeqBlock -\brief Data structure containing pointer to a BlockFile and - a start time. Element of a BlockArray. +\brief Data structure containing pointer to a BlockFile and + a start time. Element of a BlockArray. *//*******************************************************************/ @@ -154,7 +154,7 @@ bool Sequence::ConvertToSampleFormat(sampleFormat format, bool* pbChanged) if (format == mSampleFormat) return true; - if (mBlock->GetCount() == 0) + if (mBlock->GetCount() == 0) { mSampleFormat = format; *pbChanged = true; @@ -174,15 +174,15 @@ bool Sequence::ConvertToSampleFormat(sampleFormat format, bool* pbChanged) pNewBlockArray->Alloc(mBlock->GetCount() * ((float)oldMaxSamples / (float)mMaxSamples)); bool bSuccess = true; - for (size_t i = 0; (i < mBlock->GetCount() && bSuccess); i++) + for (size_t i = 0; (i < mBlock->GetCount() && bSuccess); i++) { SeqBlock* pOldSeqBlock = mBlock->Item(i); BlockFile* pOldBlockFile = pOldSeqBlock->f; - + sampleCount len = pOldSeqBlock->f->GetLength(); samplePtr bufferOld = NewSamples(len, oldFormat); samplePtr bufferNew = NewSamples(len, mSampleFormat); - + bSuccess = (pOldBlockFile->ReadData(bufferOld, oldFormat, 0, len) > 0); if (!bSuccess) { @@ -190,18 +190,18 @@ bool Sequence::ConvertToSampleFormat(sampleFormat format, bool* pbChanged) DeleteSamples(bufferOld); break; } - + CopySamples(bufferOld, oldFormat, bufferNew, mSampleFormat, len); - - // Note this fix for http://bugzilla.audacityteam.org/show_bug.cgi?id=451, + + // Note this fix for http://bugzilla.audacityteam.org/show_bug.cgi?id=451, // using Blockify, allows (len < mMinSamples). // This will happen consistently when going from more bytes per sample to fewer... - // This will create a block that's smaller than mMinSamples, which + // This will create a block that's smaller than mMinSamples, which // shouldn't be allowed, but we agreed it's okay for now. //vvv ANSWER-ME: Does this cause any bugs, or failures on write, elsewhere? - // If so, need to special-case (len < mMinSamples) and start combining data + // If so, need to special-case (len < mMinSamples) and start combining data // from the old blocks... Oh no! - + // Using Blockify will handle the cases where len > the new mMaxSamples. Previous code did not. BlockArray* pSplitBlockArray = Blockify(bufferNew, len); bSuccess = (pSplitBlockArray->GetCount() > 0); @@ -215,7 +215,7 @@ bool Sequence::ConvertToSampleFormat(sampleFormat format, bool* pbChanged) *pbChanged = true; } delete pSplitBlockArray; - + DeleteSamples(bufferNew); DeleteSamples(bufferOld); } @@ -224,7 +224,7 @@ bool Sequence::ConvertToSampleFormat(sampleFormat format, bool* pbChanged) { // Invalidate all the old, non-aliased block files. // Aliased files will be converted at save, per comment above. - for (size_t i = 0; (i < mBlock->GetCount() && bSuccess); i++) + for (size_t i = 0; (i < mBlock->GetCount() && bSuccess); i++) { SeqBlock* pOldSeqBlock = mBlock->Item(i); mDirManager->Deref(pOldSeqBlock->f); @@ -237,8 +237,8 @@ bool Sequence::ConvertToSampleFormat(sampleFormat format, bool* pbChanged) } else { - /* vvvvv We *should do the following, but TrackPanel::OnFormatChange() doesn't actually check the conversion results, - it just assumes the conversion was successful. + /* vvvvv We *should do the following, but TrackPanel::OnFormatChange() doesn't actually check the conversion results, + it just assumes the conversion was successful. TODO: Uncomment this section when TrackPanel::OnFormatChange() is upgraded to check the results. // Conversion failed. Revert these member vars. @@ -246,12 +246,12 @@ bool Sequence::ConvertToSampleFormat(sampleFormat format, bool* pbChanged) mMaxSamples = oldMaxSamples; */ - delete pNewBlockArray; // Failed. Throw out the scratch array. + delete pNewBlockArray; // Failed. Throw out the scratch array. *pbChanged = false; // Revert overall change flag, in case we had some partial success in the loop. } bSuccess &= ConsistencyCheck(wxT("Sequence::ConvertToSampleFormat()")); - + return bSuccess; } @@ -445,9 +445,9 @@ bool Sequence::Copy(sampleCount s0, sampleCount s1, Sequence **dest) Get(buffer, mSampleFormat, mBlock->Item(b1)->start, blocklen); (*dest)->Append(buffer, mSampleFormat, blocklen); } - + DeleteSamples(buffer); - + return true; } @@ -456,8 +456,8 @@ bool Sequence::Paste(sampleCount s, const Sequence *src) if ((s < 0) || (s > mNumSamples)) { wxLogError( - wxT("Sequence::Paste: sampleCount s %s is < 0 or > mNumSamples %s)."), - Internat::ToString(((wxLongLong)s).ToDouble(), 0).c_str(), + wxT("Sequence::Paste: sampleCount s %s is < 0 or > mNumSamples %s)."), + Internat::ToString(((wxLongLong)s).ToDouble(), 0).c_str(), Internat::ToString(((wxLongLong)mNumSamples).ToDouble(), 0).c_str()); wxASSERT(false); return false; @@ -467,8 +467,8 @@ bool Sequence::Paste(sampleCount s, const Sequence *src) if (((double)mNumSamples) + ((double)src->mNumSamples) > wxLL(9223372036854775807)) { wxLogError( - wxT("Sequence::Paste: mNumSamples %s + src->mNumSamples %s would overflow."), - Internat::ToString(((wxLongLong)mNumSamples).ToDouble(), 0).c_str(), + wxT("Sequence::Paste: mNumSamples %s + src->mNumSamples %s would overflow."), + Internat::ToString(((wxLongLong)mNumSamples).ToDouble(), 0).c_str(), Internat::ToString(((wxLongLong)src->mNumSamples).ToDouble(), 0).c_str()); wxASSERT(false); return false; @@ -477,7 +477,7 @@ bool Sequence::Paste(sampleCount s, const Sequence *src) if (src->mSampleFormat != mSampleFormat) { wxLogError( - wxT("Sequence::Paste: Sample format to be pasted, %s, does not match destination format, %s."), + wxT("Sequence::Paste: Sample format to be pasted, %s, does not match destination format, %s."), GetSampleFormatStr(src->mSampleFormat), GetSampleFormatStr(src->mSampleFormat)); wxASSERT(false); return false; @@ -524,11 +524,11 @@ bool Sequence::Paste(sampleCount s, const Sequence *src) SeqBlock *largerBlock = new SeqBlock(); largerBlock->start = mBlock->Item(b)->start; sampleCount largerBlockLen = mBlock->Item(b)->f->GetLength() + addedLen; - if (largerBlockLen > mMaxSamples) + if (largerBlockLen > mMaxSamples) { wxLogError( - wxT("Sequence::Paste: (largerBlockLen %s > mMaxSamples %s). largerBlockLen truncated to mMaxSamples."), - Internat::ToString(((wxLongLong)largerBlockLen).ToDouble(), 0).c_str(), + wxT("Sequence::Paste: (largerBlockLen %s > mMaxSamples %s). largerBlockLen truncated to mMaxSamples."), + Internat::ToString(((wxLongLong)largerBlockLen).ToDouble(), 0).c_str(), Internat::ToString(((wxLongLong)mMaxSamples).ToDouble(), 0).c_str()); largerBlockLen = mMaxSamples; // Prevent overruns, per NGS report for UmixIt. } @@ -806,17 +806,17 @@ sampleCount Sequence::GetBestBlockSize(sampleCount start) const // than the value of GetMaxBlockSize(); int b = FindBlock(start); int numBlocks = mBlock->GetCount(); - + sampleCount result = (mBlock->Item(b)->start + mBlock->Item(b)->f->GetLength() - start); - + while(result < mMinSamples && b+1Item(b+1)->f->GetLength()+result) <= mMaxSamples) { b++; result += mBlock->Item(b)->f->GetLength(); } - + wxASSERT(result > 0 && result <= mMaxSamples); - + return result; } @@ -835,10 +835,10 @@ bool Sequence::HandleXMLTag(const wxChar *tag, const wxChar **attrs) while(*attrs) { const wxChar *attr = *attrs++; const wxChar *value = *attrs++; - + if (!value) break; - + // Both these attributes have non-negative integer counts of samples, so // we can test & convert here, making sure that values > 2^31 are OK // because long clips will need them. @@ -848,25 +848,25 @@ bool Sequence::HandleXMLTag(const wxChar *tag, const wxChar **attrs) delete (wb); mErrorOpening = true; wxLogWarning( - wxT(" Sequence has bad %s attribute value, %s, that should be a positive integer."), + wxT(" Sequence has bad %s attribute value, %s, that should be a positive integer."), attr, strValue.c_str()); return false; } - + if (!wxStrcmp(attr, wxT("start"))) wb->start = nValue; - // Vaughan, 2011-10-10: I don't think we ever write a "len" attribute for "waveblock" tag, - // so I think this is actually legacy code, or something intended, but not completed. - // Anyway, might as well leave this code in, especially now that it has the check + // Vaughan, 2011-10-10: I don't think we ever write a "len" attribute for "waveblock" tag, + // so I think this is actually legacy code, or something intended, but not completed. + // Anyway, might as well leave this code in, especially now that it has the check // against mMaxSamples. if (!wxStrcmp(attr, wxT("len"))) { - // mMaxSamples should already have been set by calls to the "sequence" clause below. - // The check intended here was already done in DirManager::HandleXMLTag(), where - // it let the block be built, then checked against mMaxSamples, and deleted the block + // mMaxSamples should already have been set by calls to the "sequence" clause below. + // The check intended here was already done in DirManager::HandleXMLTag(), where + // it let the block be built, then checked against mMaxSamples, and deleted the block // if the size of the block is bigger than mMaxSamples. - if (nValue > mMaxSamples) + if (nValue > mMaxSamples) { delete (wb); mErrorOpening = true; @@ -881,16 +881,16 @@ bool Sequence::HandleXMLTag(const wxChar *tag, const wxChar **attrs) return true; } - + /* handle sequence tag and it's attributes */ if (!wxStrcmp(tag, wxT("sequence"))) { while(*attrs) { const wxChar *attr = *attrs++; const wxChar *value = *attrs++; - + if (!value) break; - + const wxString strValue = value; // promote string, we need this for all if (!wxStrcmp(attr, wxT("maxsamples"))) @@ -935,9 +935,9 @@ bool Sequence::HandleXMLTag(const wxChar *tag, const wxChar **attrs) } } // while - //// Both mMaxSamples and mSampleFormat should have been set. + //// Both mMaxSamples and mSampleFormat should have been set. //// Check that mMaxSamples is right for mSampleFormat, using the calculations from the constructor. - //if ((mMinSamples != sMaxDiskBlockSize / SAMPLE_SIZE(mSampleFormat) / 2) || + //if ((mMinSamples != sMaxDiskBlockSize / SAMPLE_SIZE(mSampleFormat) / 2) || // (mMaxSamples != mMinSamples * 2)) //{ // mErrorOpening = true; @@ -946,7 +946,7 @@ bool Sequence::HandleXMLTag(const wxChar *tag, const wxChar **attrs) return true; } - + return false; } @@ -967,13 +967,13 @@ void Sequence::HandleXMLEndTag(const wxChar *tag) else len = mNumSamples - mBlock->Item(b)->start; - if (len > mMaxSamples) + if (len > mMaxSamples) { // This could be why the blockfile failed, so limit // the silent replacement to mMaxSamples. wxLogWarning( - wxT(" Sequence has missing block file with length %s > mMaxSamples %s.\n Setting length to mMaxSamples. This will likely cause some block files to be considered orphans."), - Internat::ToString(((wxLongLong)len).ToDouble(), 0).c_str(), + wxT(" Sequence has missing block file with length %s > mMaxSamples %s.\n Setting length to mMaxSamples. This will likely cause some block files to be considered orphans."), + Internat::ToString(((wxLongLong)len).ToDouble(), 0).c_str(), Internat::ToString(((wxLongLong)mMaxSamples).ToDouble(), 0).c_str()); len = mMaxSamples; } @@ -991,22 +991,22 @@ void Sequence::HandleXMLEndTag(const wxChar *tag) wxString sFileAndExtension = mBlock->Item(b)->f->GetFileName().GetFullName(); if (sFileAndExtension.IsEmpty()) sFileAndExtension = wxT("(replaced with silence)"); - else + else sFileAndExtension = wxT("\"") + sFileAndExtension + wxT("\""); wxLogWarning( - wxT("Gap detected in project file.\n Start (%s) for block file %s is more than one sample past end of previous block (%s).\n Moving start back so blocks are contiguous."), - Internat::ToString(((wxLongLong)(mBlock->Item(b)->start)).ToDouble(), 0).c_str(), - sFileAndExtension.c_str(), + wxT("Gap detected in project file.\n Start (%s) for block file %s is more than one sample past end of previous block (%s).\n Moving start back so blocks are contiguous."), + Internat::ToString(((wxLongLong)(mBlock->Item(b)->start)).ToDouble(), 0).c_str(), + sFileAndExtension.c_str(), Internat::ToString(((wxLongLong)(numSamples)).ToDouble(), 0).c_str()); mBlock->Item(b)->start = numSamples; - mErrorOpening = true; + mErrorOpening = true; } numSamples += mBlock->Item(b)->f->GetLength(); } if (mNumSamples != numSamples) { wxLogWarning( - wxT("Gap detected in project file. Correcting sequence sample count from %s to %s."), - Internat::ToString(((wxLongLong)mNumSamples).ToDouble(), 0).c_str(), + wxT("Gap detected in project file. Correcting sequence sample count from %s to %s."), + Internat::ToString(((wxLongLong)mNumSamples).ToDouble(), 0).c_str(), Internat::ToString(((wxLongLong)numSamples).ToDouble(), 0).c_str()); mNumSamples = numSamples; mErrorOpening = true; @@ -1026,7 +1026,7 @@ XMLTagHandler *Sequence::HandleXMLChild(const wxChar *tag) void Sequence::WriteXML(XMLWriter &xmlFile) { unsigned int b; - + xmlFile.StartTag(wxT("sequence")); xmlFile.WriteAttr(wxT("maxsamples"), mMaxSamples); @@ -1037,15 +1037,15 @@ void Sequence::WriteXML(XMLWriter &xmlFile) SeqBlock *bb = mBlock->Item(b); // See http://bugzilla.audacityteam.org/show_bug.cgi?id=451. - // Also, don't check against mMaxSamples for AliasBlockFiles, because if you convert sample format, - // mMaxSample gets changed to match the format, but the number of samples in the aliased file + // Also, don't check against mMaxSamples for AliasBlockFiles, because if you convert sample format, + // mMaxSample gets changed to match the format, but the number of samples in the aliased file // has not changed (because sample format conversion was not actually done in the aliased file. if (!bb->f->IsAlias() && (bb->f->GetLength() > mMaxSamples)) { - wxString sMsg = + wxString sMsg = wxString::Format( - _("Sequence has block file with length %s > mMaxSamples %s.\nTruncating to mMaxSamples."), - Internat::ToString(((wxLongLong)(bb->f->GetLength())).ToDouble(), 0).c_str(), + _("Sequence has block file with length %s > mMaxSamples %s.\nTruncating to mMaxSamples."), + Internat::ToString(((wxLongLong)(bb->f->GetLength())).ToDouble(), 0).c_str(), Internat::ToString(((wxLongLong)mMaxSamples).ToDouble(), 0).c_str()); ::wxMessageBox(sMsg, _("Warning - Length in Writing Sequence"), wxICON_EXCLAMATION | wxOK); ::wxLogWarning(sMsg); @@ -1114,7 +1114,7 @@ bool Sequence::Read(samplePtr buffer, sampleFormat format, int result = f->ReadData(buffer, format, start, len); - if (result != len) + if (result != len) { wxLogWarning(wxT("Expected to read %d samples, got %d samples."), len, result); if (result < 0) @@ -1270,7 +1270,7 @@ bool Sequence::GetWaveDisplay(float *min, float *max, float *rms,int* bl, s1 = mNumSamples; sampleCount srcX = s0; - + unsigned int block0 = FindBlock(s0); float *temp = new float[mMaxSamples]; @@ -1293,13 +1293,13 @@ bool Sequence::GetWaveDisplay(float *min, float *max, float *rms,int* bl, if (num > (s1 - srcX + divisor - 1) / divisor) num = (s1 - srcX + divisor - 1) / divisor; - + switch (divisor) { default: case 1: Read((samplePtr)temp, floatSample, mBlock->Item(b), srcX - mBlock->Item(b)->start, num); - + blockStatus=b; break; case 256: @@ -1330,7 +1330,7 @@ bool Sequence::GetWaveDisplay(float *min, float *max, float *rms,int* bl, } break; } - + // Get min/max/rms of samples for each pixel we can int x = 0; @@ -1346,9 +1346,9 @@ bool Sequence::GetWaveDisplay(float *min, float *max, float *rms,int* bl, sumsq = float(0.0); jcount = 0; } - + while (x < num) { - + while (pixel < len && where[pixel] / divisor == srcX / divisor + x) { if (pixel > 0) { @@ -1368,13 +1368,13 @@ bool Sequence::GetWaveDisplay(float *min, float *max, float *rms,int* bl, jcount = 0; } } - + sampleCount stop = (where[pixel] - srcX) / divisor; if (stop == x) stop++; if (stop > num) stop = num; - + switch (divisor) { default: case 1: @@ -1399,7 +1399,7 @@ bool Sequence::GetWaveDisplay(float *min, float *max, float *rms,int* bl, x++; jcount++; } - + break; } } @@ -1414,7 +1414,7 @@ bool Sequence::GetWaveDisplay(float *min, float *max, float *rms,int* bl, srcX = mBlock->Item(b)->start; } - + // Make sure that min[pixel - 1] doesn't segfault if (pixel <= 0) pixel = 1; @@ -1493,7 +1493,7 @@ bool Sequence::Append(samplePtr buffer, sampleFormat format, blockFileLog != NULL); if (blockFileLog) ((SimpleBlockFile*)newLastBlock->f)->SaveXML(*blockFileLog); - + DeleteSamples(buffer2); mDirManager->Deref(lastBlock->f); @@ -1513,7 +1513,7 @@ bool Sequence::Append(samplePtr buffer, sampleFormat format, /* i18n-hint: Error message shown when Audacity was trying to allocate memory to hold audio, and didn't have enough. 'New Samples' is the name of the C++ function that failed, for use by a developer, - and should not be translated - though you could say + and should not be translated - though you could say 'in function "NewSamples()"' to be clearer.*/ if (!temp) { wxMessageBox(_("Memory allocation failed -- NewSamples")); @@ -1549,7 +1549,7 @@ bool Sequence::Append(samplePtr buffer, sampleFormat format, DeleteSamples(temp); // JKC: During generate we use Append again and again. -// If generating a long sequence this test would give O(n^2) +// If generating a long sequence this test would give O(n^2) // performance - not good! #ifdef VERY_SLOW_CHECKING ConsistencyCheck(wxT("Append")); @@ -1591,9 +1591,9 @@ bool Sequence::Delete(sampleCount start, sampleCount len) return true; if (len < 0 || start < 0 || start >= mNumSamples) return false; - + //TODO: add a ref-deref mechanism to SeqBlock/BlockArray so we don't have to make this a critical section. - //On-demand threads iterate over the mBlocks and the GUI thread deletes them, so for now put a mutex here over + //On-demand threads iterate over the mBlocks and the GUI thread deletes them, so for now put a mutex here over //both functions, LockDeleteUpdateMutex(); @@ -1636,7 +1636,7 @@ bool Sequence::Delete(sampleCount start, sampleCount len) mNumSamples -= len; UnlockDeleteUpdateMutex(); - + return ConsistencyCheck(wxT("Delete - branch one")); } @@ -1798,7 +1798,7 @@ bool Sequence::Delete(sampleCount start, sampleCount len) // Update total number of samples and do a consistency check. mNumSamples -= len; - + UnlockDeleteUpdateMutex(); return ConsistencyCheck(wxT("Delete - branch two")); } @@ -1823,13 +1823,13 @@ bool Sequence::ConsistencyCheck(const wxChar *whereStr) if (pos != mNumSamples) bError = true; - if (bError) + if (bError) { wxLogError(wxT("*** Consistency check failed after %s. ***"), whereStr); wxString str; DebugPrintf(&str); wxLogError(wxT("%s"), str.c_str()); - wxLogError(wxT("*** Please report this error to feedback@audacityteam.org. ***\n\nRecommended course of action:\nUndo the failed operation(s), then export or save your work and quit.")); + wxLogError(wxT("*** Please report this error to feedback@audacityteam.org. ***\n\nRecommended course of action:\nUndo the failed operation(s), then export or save your work and quit.")); } return !bError; diff --git a/src/Sequence.h b/src/Sequence.h index f81e217c1..663de68d3 100644 --- a/src/Sequence.h +++ b/src/Sequence.h @@ -91,10 +91,10 @@ class Sequence: public XMLTagHandler { bool AppendCoded(wxString fName, sampleCount start, sampleCount len, int channel, int decodeType); - + ///gets an int with OD flags so that we can determine which ODTasks should be run on this track after save/open, etc. - unsigned int GetODFlags(); - + unsigned int GetODFlags(); + // Append a blockfile. The blockfile pointer is then "owned" by the // sequence. This function is used by the recording log crash recovery // code, but may be useful for other purposes. The blockfile must already @@ -124,7 +124,7 @@ class Sequence: public XMLTagHandler { // from being moved. Call this if you want to copy a // track to a different DirManager. See BlockFile.h // for details. - // + // bool Lock(); bool CloseLock();//similar to Lock but should be called upon project close. @@ -161,7 +161,7 @@ class Sequence: public XMLTagHandler { // BlockArray *GetBlockArray() {return mBlock;} - + /// void LockDeleteUpdateMutex(){mDeleteUpdateMutex.Lock();} void UnlockDeleteUpdateMutex(){mDeleteUpdateMutex.Unlock();} @@ -170,7 +170,7 @@ class Sequence: public XMLTagHandler { // // Private static variables - // + // static int sMaxDiskBlockSize; @@ -188,7 +188,7 @@ class Sequence: public XMLTagHandler { sampleCount mMaxSamples; // max samples per block bool mErrorOpening; - + ///To block the Delete() method against the ODCalcSummaryTask::Update() method ODLock mDeleteUpdateMutex; diff --git a/src/Shuttle.cpp b/src/Shuttle.cpp index 8f3a78d92..993a5dd00 100644 --- a/src/Shuttle.cpp +++ b/src/Shuttle.cpp @@ -18,7 +18,7 @@ \brief Moves data from one place to another, converting it as required. Shuttle provides a base class for transfering parameter data into and - out of clasess into some other structure. This is a common + out of clasess into some other structure. This is a common requirement and is needed for: - Prefs data - Command line parameter data @@ -42,8 +42,8 @@ with a binary representation. *//****************************************************************//** \class Enums -\brief Enums is a helper class for Shuttle. It defines enumerations -which are used in effects dialogs, in the effects themselves and in +\brief Enums is a helper class for Shuttle. It defines enumerations +which are used in effects dialogs, in the effects themselves and in preferences. (If it grows big, we will move it out of shuttle.h). @@ -72,14 +72,14 @@ preferences. const int Enums::NumDbChoices = 13; -const wxString Enums::DbChoices[] = - {wxT("-20 dB"), wxT("-25 dB"), wxT("-30 dB"), - wxT("-35 dB"), wxT("-40 dB"), wxT("-45 dB"), +const wxString Enums::DbChoices[] = + {wxT("-20 dB"), wxT("-25 dB"), wxT("-30 dB"), + wxT("-35 dB"), wxT("-40 dB"), wxT("-45 dB"), wxT("-50 dB"), wxT("-55 dB"), wxT("-60 dB"), - wxT("-65 dB"), wxT("-70 dB"), wxT("-75 dB"), + wxT("-65 dB"), wxT("-70 dB"), wxT("-75 dB"), wxT("-80 dB")}; -const double Enums::Db2Signal[] = +const double Enums::Db2Signal[] = // -20dB -25dB -30dB -35dB -40dB -45dB -50dB -55dB -60dB -65dB -70dB -75dB -80dB Off { 0.10000, 0.05620, 0.03160, 0.01780, 0.01000, 0.00562, 0.00316, 0.00178, 0.00100, 0.000562, 0.000316, 0.000178, 0.0001000, 0.0 }; @@ -104,7 +104,7 @@ bool Shuttle::TransferBool( const wxString & Name, bool & bValue, const bool & b if( !mValueString.IsEmpty() ) bValue = mValueString.GetChar(0) == wxT('y'); } - } + } else { mValueString = (bValue==0) ? wxT("no"):wxT("yes"); @@ -123,7 +123,7 @@ bool Shuttle::TransferFloat( const wxString & Name, float & fValue, const float if( !mValueString.IsEmpty() ) fValue = wxAtof( mValueString ); } - } + } else { mValueString = wxString::Format(wxT("%f"),fValue); @@ -142,10 +142,10 @@ bool Shuttle::TransferDouble( const wxString & Name, double & dValue, const doub if( !mValueString.IsEmpty() ) dValue = wxAtof( mValueString ); } - } + } else { - //%f is format string for double + //%f is format string for double mValueString = wxString::Format(wxT("%f"),dValue); return ExchangeWithMaster( Name ); } @@ -161,7 +161,7 @@ bool Shuttle::TransferInt( const wxString & Name, int & iValue, const int & iDef { iValue = wxAtoi( mValueString ); } - } + } else { mValueString = wxString::Format(wxT("%i"),iValue); @@ -185,7 +185,7 @@ bool Shuttle::TransferLongLong( const wxString & Name, wxLongLong_t & iValue, co { iValue = wxAtoi( mValueString ); } - } + } else { /// \todo Fix for long long values. @@ -196,7 +196,7 @@ bool Shuttle::TransferLongLong( const wxString & Name, wxLongLong_t & iValue, co } -bool Shuttle::TransferEnum( const wxString & Name, int & iValue, +bool Shuttle::TransferEnum( const wxString & Name, int & iValue, const int nChoices, const wxString * pFirstStr) { if( mbStoreInClient ) @@ -219,7 +219,7 @@ bool Shuttle::TransferEnum( const wxString & Name, int & iValue, } } } - } + } else { //TIDY-ME: Out of range configuration values are silently discarded... @@ -282,7 +282,7 @@ bool Shuttle::ExchangeWithMaster(const wxString & WXUNUSED(Name)) } // This variant uses values of the form -// param1=value1 param2=value2 +// param1=value1 param2=value2 bool ShuttleCli::ExchangeWithMaster(const wxString & Name) { if( !mbStoreInClient ) diff --git a/src/Shuttle.h b/src/Shuttle.h index cbf21513a..d731f5a54 100644 --- a/src/Shuttle.h +++ b/src/Shuttle.h @@ -29,7 +29,7 @@ class Shuttle { // constructors and destructors Shuttle(); virtual ~Shuttle() {} - + public: bool mbStoreInClient; wxString mValueString; @@ -42,7 +42,7 @@ class Shuttle { virtual bool TransferInt( const wxString & Name, wxLongLong_t & iValue, const wxLongLong_t &iDefault ); virtual bool TransferLongLong( const wxString & Name, wxLongLong_t & iValue, const wxLongLong_t &iDefault ); virtual bool TransferString( const wxString & Name, wxString & strValue, const wxString &strDefault ); - virtual bool TransferEnum( const wxString & Name, int & iValue, + virtual bool TransferEnum( const wxString & Name, int & iValue, const int nChoices, const wxString * pFirstStr); virtual bool TransferWrappedType( const wxString & Name, WrappedType & W ); // We expect the ExchangeWithMaster function to change from one type of diff --git a/src/ShuttleGui.cpp b/src/ShuttleGui.cpp index 3c7e15d28..d9b557493 100644 --- a/src/ShuttleGui.cpp +++ b/src/ShuttleGui.cpp @@ -18,17 +18,17 @@ \class ShuttleGui \brief - Derived from ShuttleGuiBase, an Audacity specific class for shuttling + Derived from ShuttleGuiBase, an Audacity specific class for shuttling data to and from GUI. - - ShuttleGui extends the idea of the data Shuttle class to include creation - of dialog controls. As part of this it provides an interface to sizers - that leads to shorter more readable code. + + ShuttleGui extends the idea of the data Shuttle class to include creation + of dialog controls. As part of this it provides an interface to sizers + that leads to shorter more readable code. It also allows the code that is used to create dialogs to be reused - to shuttle information in and out. + to shuttle information in and out. - Most of the ShuttleGui functions are actually defined in + Most of the ShuttleGui functions are actually defined in ShuttleGuiBase. - wxWidgets widgets are dealt with by ShuttleGuiBase. - Audacity specific widgets are dealt with by ShuttleGui @@ -52,37 +52,37 @@ The code in this file is fairly repetitive. We are dealing with - Creation / Reading / Writing / Exporting / Importing - int, float, string variants (for example of TextCtrl contents). -A technique used to reduce the size of the \p Tie functions is to +A technique used to reduce the size of the \p Tie functions is to have one generic \p Tie function that uses WrappedType for its data type. Type specific \p Tie functions themselves call the generic variant. -A second technique used to reduce the size of \p Tie functions +A second technique used to reduce the size of \p Tie functions only comes into play for two-step \p Tie functions. (A two step -\p Tie function is one that transfers data between the registry -and the GUI via an intermediate temporary variable). In the two -step style, a function ShuttleGuiBase::DoStep() determines which -transfers in the function are to be done, reducing repetitive +\p Tie function is one that transfers data between the registry +and the GUI via an intermediate temporary variable). In the two +step style, a function ShuttleGuiBase::DoStep() determines which +transfers in the function are to be done, reducing repetitive if-then-else's. Although unusual, these two techniques make the code easier to -add to and much easier to check for correctness. The alternative -'more obvious' code that just repeats code as needed is +add to and much easier to check for correctness. The alternative +'more obvious' code that just repeats code as needed is considerably longer. -You would rarely use ShuttleGuiBase directly, instead you'd use -ShuttleGui. +You would rarely use ShuttleGuiBase directly, instead you'd use +ShuttleGui. -There is DOxygen documentation on how to use the ShuttleGui -class in \ref ShuttleSystem . +There is DOxygen documentation on how to use the ShuttleGui +class in \ref ShuttleSystem . *//***************************************************************//** \class InvisiblePanel -\brief An InvisiblePanel is a panel which does not repaint its +\brief An InvisiblePanel is a panel which does not repaint its own background. -It is used (a) To group together widgets which need to be refreshed +It is used (a) To group together widgets which need to be refreshed together. A single refresh of the panel causes all the subwindows to refresh. (b) as a base class for some flicker-free classes for which the backgorund is never repainted. @@ -216,7 +216,7 @@ void ShuttleGuiBase::AddPrompt(const wxString &Prompt) if( mShuttleMode != eIsCreating ) return; miProp=1; - mpWind = new wxStaticText(mpParent, -1, Prompt, wxDefaultPosition, wxDefaultSize, + mpWind = new wxStaticText(mpParent, -1, Prompt, wxDefaultPosition, wxDefaultSize, Style( wxALIGN_RIGHT )); mpWind->SetName(wxStripMenuCodes(Prompt)); // fix for bug 577 (NVDA/Narrator screen readers do not read static text in dialogs) UpdateSizersCore( false, wxALL | wxALIGN_RIGHT | wxALIGN_CENTRE_VERTICAL ); @@ -230,7 +230,7 @@ void ShuttleGuiBase::AddUnits(const wxString &Prompt) if( mShuttleMode != eIsCreating ) return; miProp=1; - mpWind = new wxStaticText(mpParent, -1, Prompt, wxDefaultPosition, wxDefaultSize, + mpWind = new wxStaticText(mpParent, -1, Prompt, wxDefaultPosition, wxDefaultSize, Style( wxALIGN_LEFT )); mpWind->SetName(Prompt); // fix for bug 577 (NVDA/Narrator screen readers do not read static text in dialogs) UpdateSizersCore( false, wxALL | wxALIGN_LEFT | wxALIGN_CENTRE_VERTICAL ); @@ -243,7 +243,7 @@ void ShuttleGuiBase::AddTitle(const wxString &Prompt) return; if( mShuttleMode != eIsCreating ) return; - mpWind = new wxStaticText(mpParent, -1, Prompt, wxDefaultPosition, wxDefaultSize, + mpWind = new wxStaticText(mpParent, -1, Prompt, wxDefaultPosition, wxDefaultSize, Style( wxALIGN_CENTRE )); mpWind->SetName(Prompt); // fix for bug 577 (NVDA/Narrator screen readers do not read static text in dialogs) UpdateSizers(); @@ -315,9 +315,9 @@ wxBitmapButton * ShuttleGuiBase::AddBitmapButton(const wxBitmap &Bitmap, int Pos if( mShuttleMode != eIsCreating ) return wxDynamicCast(wxWindow::FindWindowById( miId, mpDlg), wxBitmapButton); wxBitmapButton * pBtn; - mpWind = pBtn = new wxBitmapButton( mpParent, miId, Bitmap, + mpWind = pBtn = new wxBitmapButton( mpParent, miId, Bitmap, wxDefaultPosition, wxDefaultSize, Style( wxNO_BORDER ) ); - pBtn->SetBackgroundColour( + pBtn->SetBackgroundColour( wxColour( 246,246,243)); // wxSystemSettings::GetColour(wxSYS_COLOUR_BTNFACE)); miProp=0; @@ -337,7 +337,7 @@ wxChoice * ShuttleGuiBase::AddChoice( const wxString &Prompt, const wxString &Se mpWind = pChoice = new wxChoice( mpParent, miId, - wxDefaultPosition, + wxDefaultPosition, wxDefaultSize, *pChoices, Style( 0 ) ); @@ -355,7 +355,7 @@ void ShuttleGuiBase::AddFixedText(const wxString &Str, bool bCenter) UseUpId(); if( mShuttleMode != eIsCreating ) return; - mpWind = new wxStaticText(mpParent, miId, Str, wxDefaultPosition, wxDefaultSize, + mpWind = new wxStaticText(mpParent, miId, Str, wxDefaultPosition, wxDefaultSize, Style( wxALIGN_LEFT )); mpWind->SetName(wxStripMenuCodes(Str)); // fix for bug 577 (NVDA/Narrator screen readers do not read static text in dialogs) if( bCenter ) @@ -374,7 +374,7 @@ wxStaticText * ShuttleGuiBase::AddVariableText(const wxString &Str, bool bCenter return wxDynamicCast(wxWindow::FindWindowById( miId, mpDlg), wxStaticText); wxStaticText *pStatic; - mpWind = pStatic = new wxStaticText(mpParent, miId, Str, wxDefaultPosition, wxDefaultSize, + mpWind = pStatic = new wxStaticText(mpParent, miId, Str, wxDefaultPosition, wxDefaultSize, Style( wxALIGN_LEFT )); mpWind->SetName(wxStripMenuCodes(Str)); // fix for bug 577 (NVDA/Narrator screen readers do not read static text in dialogs) if( bCenter ) @@ -412,7 +412,7 @@ wxComboBox * ShuttleGuiBase::AddCombo( const wxString &Prompt, const wxString &S AddPrompt( Prompt ); - mpWind = pCombo = new wxComboBox(mpParent, miId, Selected, wxDefaultPosition, wxDefaultSize, + mpWind = pCombo = new wxComboBox(mpParent, miId, Selected, wxDefaultPosition, wxDefaultSize, n, Choices, Style( style )); mpWind->SetName(wxStripMenuCodes(Prompt)); @@ -423,7 +423,7 @@ wxComboBox * ShuttleGuiBase::AddCombo( const wxString &Prompt, const wxString &S wxRadioButton * ShuttleGuiBase::AddRadioButton(const wxString &Prompt) { - /// \todo This function and the next one, suitably adapted, could be + /// \todo This function and the next one, suitably adapted, could be /// used by TieRadioButton. UseUpId(); if( mShuttleMode != eIsCreating ) @@ -457,8 +457,8 @@ wxSlider * ShuttleGuiBase::AddSlider(const wxString &Prompt, int pos, int Max, i return wxDynamicCast(wxWindow::FindWindowById( miId, mpDlg), wxSlider); AddPrompt( Prompt ); wxSlider * pSlider; - mpWind = pSlider = new wxSlider( mpParent, miId, - pos, Min, Max, + mpWind = pSlider = new wxSlider( mpParent, miId, + pos, Min, Max, wxDefaultPosition, wxDefaultSize, Style( wxSL_HORIZONTAL | wxSL_LABELS | wxSL_AUTOTICKS ) ); @@ -475,8 +475,8 @@ wxSpinCtrl * ShuttleGuiBase::AddSpinCtrl(const wxString &Prompt, int Value, int return wxDynamicCast(wxWindow::FindWindowById( miId, mpDlg), wxSpinCtrl); AddPrompt( Prompt ); wxSpinCtrl * pSpinCtrl; - mpWind = pSpinCtrl = new wxSpinCtrl( mpParent, miId, - wxEmptyString, + mpWind = pSpinCtrl = new wxSpinCtrl( mpParent, miId, + wxEmptyString, wxDefaultPosition, wxDefaultSize, Style( wxSP_VERTICAL | wxSP_ARROW_KEYS ), Min, Max, Value @@ -615,7 +615,7 @@ wxGrid * ShuttleGuiBase::AddGrid() return wxDynamicCast(wxWindow::FindWindowById( miId, mpDlg), wxGrid); wxGrid * pGrid; SetProportions( 1 ); - mpWind = pGrid = new wxGrid(mpParent, miId, wxDefaultPosition, + mpWind = pGrid = new wxGrid(mpParent, miId, wxDefaultPosition, wxDefaultSize, Style( wxWANTS_CHARS )); pGrid->SetMinSize( wxSize( 120, 150 )); UpdateSizers(); @@ -679,11 +679,11 @@ wxMenuBar * ShuttleGuiBase::AddMenuBar( ) mpMenuBar->SetThemeEnabled( true ); pFrame->SetMenuBar(mpMenuBar); - return mpMenuBar; + return mpMenuBar; } wxMenu * ShuttleGuiBase::AddMenu( const wxString & Title ) -{ +{ mpMenu = new wxMenu; mpMenuBar->Append( mpMenu, Title ); return mpMenu; @@ -693,7 +693,7 @@ wxMenu * ShuttleGuiBase::AddMenu( const wxString & Title ) /// Starts a static box around a number of controls. /// @param Str The text of the title for the box. -/// @param iProp The resizing proportion value. +/// @param iProp The resizing proportion value. /// Use iProp == 0 for a minimum sized static box. /// Use iProp == 1 for a box that grows if there is space to spare. wxStaticBox * ShuttleGuiBase::StartStatic(const wxString &Str, int iProp) @@ -702,11 +702,11 @@ wxStaticBox * ShuttleGuiBase::StartStatic(const wxString &Str, int iProp) mBoxName = Str; if( mShuttleMode != eIsCreating ) return NULL; - wxStaticBox * pBox = new wxStaticBox(mpParent, miId, + wxStaticBox * pBox = new wxStaticBox(mpParent, miId, Str ); pBox->SetLabel( Str ); pBox->SetName(wxStripMenuCodes(Str)); - mpSubSizer = new wxStaticBoxSizer( + mpSubSizer = new wxStaticBoxSizer( pBox, wxVERTICAL ); miSizerProp = iProp; @@ -721,29 +721,29 @@ void ShuttleGuiBase::EndStatic() PopSizer(); } -/// This allows subsequent controls and static boxes to be in +/// This allows subsequent controls and static boxes to be in /// a scrolled panel. Very handy if you are running out of space /// on a dialog. /// /// The iStyle parameter is used in some very hacky code that -/// dynamically repopulates a dialog. It also controls the +/// dynamically repopulates a dialog. It also controls the /// background colour. Look at the code for details. -/// @param istyle deprecated parameter, but has been used for hacking. +/// @param istyle deprecated parameter, but has been used for hacking. wxScrolledWindow * ShuttleGuiBase::StartScroller(int iStyle) { UseUpId(); if( mShuttleMode != eIsCreating ) return wxDynamicCast(wxWindow::FindWindowById( miId, mpDlg), wxScrolledWindow); - + wxScrolledWindow * pScroller; mpWind = pScroller = new wxScrolledWindow( mpParent, miId, wxDefaultPosition, wxDefaultSize, Style( wxSUNKEN_BORDER ) ); pScroller->SetScrollRate( 20,20 ); - mpWind->SetBackgroundColour( - iStyle==0 + mpWind->SetBackgroundColour( + iStyle==0 ? wxColour( 245,244,240) : - wxSystemSettings::GetColour(wxSYS_COLOUR_3DFACE) + wxSystemSettings::GetColour(wxSYS_COLOUR_3DFACE) ); SetProportions( 1 ); if( iStyle==2 ) @@ -779,7 +779,7 @@ void ShuttleGuiBase::EndScroller() mpParent->SetMinSize( wxSize(xMin, yMin) ); PopSizer(); - mpParent = mpParent->GetParent(); + mpParent = mpParent->GetParent(); } wxPanel * ShuttleGuiBase::StartPanel(int iStyle) @@ -793,10 +793,10 @@ wxPanel * ShuttleGuiBase::StartPanel(int iStyle) if( iStyle != 0 ) { - mpWind->SetBackgroundColour( - iStyle==1 + mpWind->SetBackgroundColour( + iStyle==1 ? wxColour( 190,200,230) : - wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOW) + wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOW) ); } SetProportions(0); @@ -816,7 +816,7 @@ void ShuttleGuiBase::EndPanel() if( mShuttleMode != eIsCreating ) return; PopSizer(); - mpParent = mpParent->GetParent(); + mpParent = mpParent->GetParent(); } wxNotebook * ShuttleGuiBase::StartNotebook() @@ -825,7 +825,7 @@ wxNotebook * ShuttleGuiBase::StartNotebook() if( mShuttleMode != eIsCreating ) return wxDynamicCast(wxWindow::FindWindowById( miId, mpDlg), wxNotebook); wxNotebook * pNotebook; - mpWind = pNotebook = new wxNotebook(mpParent, + mpWind = pNotebook = new wxNotebook(mpParent, miId, wxDefaultPosition, wxDefaultSize, Style( 0 )); SetProportions( 1 ); UpdateSizers(); @@ -836,7 +836,7 @@ wxNotebook * ShuttleGuiBase::StartNotebook() void ShuttleGuiBase::EndNotebook() { //PopSizer(); - mpParent = mpParent->GetParent(); + mpParent = mpParent->GetParent(); } @@ -849,8 +849,8 @@ wxNotebookPage * ShuttleGuiBase::StartNotebookPage( const wxString Name ) wxNotebookPage * pPage = new wxPanel(mpParent ); pPage->SetName(Name); - pNotebook->AddPage( - pPage, + pNotebook->AddPage( + pPage, Name); PushSizer(); @@ -869,12 +869,12 @@ void ShuttleGuiBase::StartNotebookPage( const wxString Name, wxNotebookPage * pP return; // return wxDynamicCast(wxWindow::FindWindowById( miId, mpDlg), wx); wxNotebook * pNotebook = (wxNotebook*)mpParent; -// wxNotebookPage * pPage = new wxPanel(mpParent ); +// wxNotebookPage * pPage = new wxPanel(mpParent ); pPage->Create( mpParent, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL, wxT("panel")); pPage->SetName(Name); - pNotebook->AddPage( - pPage, + pNotebook->AddPage( + pPage, Name); PushSizer(); @@ -891,19 +891,19 @@ void ShuttleGuiBase::EndNotebookPage() if( mShuttleMode != eIsCreating ) return; PopSizer(); - mpParent = mpParent->GetParent(); + mpParent = mpParent->GetParent(); } -// Doxygen description is at the start of the file +// Doxygen description is at the start of the file // this is a wxPanel with erase background disabled. class InvisiblePanel : public wxPanel { public: - InvisiblePanel( - wxWindow* parent, - wxWindowID id = -1, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, + InvisiblePanel( + wxWindow* parent, + wxWindowID id = -1, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, long style = wxTAB_TRAVERSAL ) : wxPanel( parent, id, pos, size, style ) { @@ -911,7 +911,7 @@ public: ~InvisiblePanel(){;}; void OnPaint( wxPaintEvent &event ); void OnErase(wxEraseEvent &/*evt*/){;}; - DECLARE_EVENT_TABLE() + DECLARE_EVENT_TABLE() }; @@ -936,8 +936,8 @@ wxPanel * ShuttleGuiBase::StartInvisiblePanel() mpWind = pPanel = new wxPanel( mpParent, miId, wxDefaultPosition, wxDefaultSize, wxNO_BORDER); - mpWind->SetBackgroundColour( - wxSystemSettings::GetColour(wxSYS_COLOUR_BTNFACE) + mpWind->SetBackgroundColour( + wxSystemSettings::GetColour(wxSYS_COLOUR_BTNFACE) ); SetProportions( 1 ); miBorder=0; @@ -962,7 +962,7 @@ void ShuttleGuiBase::EndInvisiblePanel() /// - Use wxEXPAND and 1 to expand horizontally and vertically. /// - Use wxCENTRE and 1 for no expansion. /// @param PositionFlag Typically wxEXPAND or wxALIGN_CENTER. -/// @param iProp Proportionality for resizing. +/// @param iProp Proportionality for resizing. void ShuttleGuiBase::StartHorizontalLay( int PositionFlags, int iProp) { if( mShuttleMode != eIsCreating ) @@ -1021,7 +1021,7 @@ void ShuttleGuiBase::DoDataShuttle( const wxString &Name, WrappedType & WrappedR //-----------------------------------------------------------------------// // We now have a group of tie functions which are generic in the type -// they bind to (i.e. WrappedType). +// they bind to (i.e. WrappedType). // The type specific versions are much shorter and are later // in this file. wxCheckBox * ShuttleGuiBase::TieCheckBox(const wxString &Prompt, WrappedType & WrappedRef) @@ -1266,8 +1266,8 @@ wxSlider * ShuttleGuiBase::TieSlider( const wxString &Prompt, WrappedType & Wrap } -wxChoice * ShuttleGuiBase::TieChoice( - const wxString &Prompt, +wxChoice * ShuttleGuiBase::TieChoice( + const wxString &Prompt, WrappedType &WrappedRef, const wxArrayString * pChoices ) { @@ -1340,7 +1340,7 @@ wxRadioButton * ShuttleGuiBase::TieRadioButton(const wxString &Prompt, WrappedTy case eIsCreating: { mpWind = pRadioButton = new wxRadioButton( mpParent, miId, Prompt, - wxDefaultPosition, wxDefaultSize, + wxDefaultPosition, wxDefaultSize, (mRadioCount==1)?wxRB_GROUP:0); pRadioButton->SetValue(WrappedRef.ValuesMatch( mRadioValue )); pRadioButton->SetName(wxStripMenuCodes(Prompt)); @@ -1365,7 +1365,7 @@ wxRadioButton * ShuttleGuiBase::TieRadioButton(const wxString &Prompt, WrappedTy return pRadioButton; } -/// Call this before any TieRadioButton calls. +/// Call this before any TieRadioButton calls. /// This is the generic version and requires mRadioValue already initialised. /// Versions for specific types must do that initialisation. void ShuttleGuiBase::StartRadioButtonGroup( const wxString & SettingName ) @@ -1400,7 +1400,7 @@ wxCheckBox * ShuttleGuiBase::TieCheckBox(const wxString &Prompt, bool &Var) // See comment in AddCheckBoxOnRight() for why we have this variant. wxCheckBox * ShuttleGuiBase::TieCheckBoxOnRight(const wxString &Prompt, bool &Var) -{ +{ // Only odes anything different if it's creating. WrappedType WrappedRef( Var ); if( mShuttleMode == eIsCreating ) @@ -1415,7 +1415,7 @@ wxSpinCtrl * ShuttleGuiBase::TieSpinCtrl( const wxString &Prompt, int &Value, co } wxTextCtrl * ShuttleGuiBase::TieTextBox( const wxString &Prompt, wxString &Selected, const int nChars) -{ +{ WrappedType WrappedRef(Selected); return TieTextBox( Prompt, WrappedRef, nChars ); } @@ -1433,7 +1433,7 @@ wxTextCtrl * ShuttleGuiBase::TieTextBox( const wxString &Prompt, double &Value, } wxTextCtrl * ShuttleGuiBase::TieNumericTextBox( const wxString &Prompt, wxString &Selected, const int nChars) -{ +{ WrappedType WrappedRef(Selected); return TieNumericTextBox( Prompt, WrappedRef, nChars ); } @@ -1461,7 +1461,7 @@ wxSlider * ShuttleGuiBase::TieSlider( const wxString &Prompt, float &pos, const const float RoundFix=0.0000001f; int iVal=(pos-fMin+RoundFix)*100.0/(fMax-fMin); wxSlider * pWnd = TieSlider( Prompt, iVal, 100 ); - pos = iVal*(fMax-fMin)*0.01+fMin; + pos = iVal*(fMax-fMin)*0.01+fMin; return pWnd; } @@ -1473,22 +1473,22 @@ wxSlider * ShuttleGuiBase::TieVSlider( const wxString &Prompt, float &pos, const // return AddVSlider( Prompt, iVal, 100 ); // } wxSlider * pWnd = TieSlider( Prompt, iVal, 100 ); - pos = iVal*(fMax-fMin)*0.01+fMin; + pos = iVal*(fMax-fMin)*0.01+fMin; return pWnd; } -wxChoice * ShuttleGuiBase::TieChoice( - const wxString &Prompt, - wxString &Selected, +wxChoice * ShuttleGuiBase::TieChoice( + const wxString &Prompt, + wxString &Selected, const wxArrayString * pChoices ) { WrappedType WrappedRef( Selected ); return TieChoice( Prompt, WrappedRef, pChoices ); } -wxChoice * ShuttleGuiBase::TieChoice( - const wxString &Prompt, - int &Selected, +wxChoice * ShuttleGuiBase::TieChoice( + const wxString &Prompt, + int &Selected, const wxArrayString * pChoices ) { WrappedType WrappedRef( Selected ); @@ -1528,7 +1528,7 @@ wxString ShuttleGuiBase::TranslateFromIndex( const int nIn, const wxArrayString /// Int-to-Index (choices can be items like e.g 0x400120 ) int ShuttleGuiBase::TranslateToIndex( const int Value, const wxArrayInt &Choices ) -{ +{ int n = Choices.Index( Value ); if( n== wxNOT_FOUND ) n=miNoMatchSelector; @@ -1563,7 +1563,7 @@ int ShuttleGuiBase::TranslateFromIndex( const int nIn, const wxArrayInt &Choices //----------------------------------------------------------------------// -/** +/** Code-Condenser function. We have functions which need to do: @@ -1588,7 +1588,7 @@ like this: if( DoStep(3) ) DoThirdThing(); \endcode -The repeated choice logic can then be taken out of those +The repeated choice logic can then be taken out of those functions. JKC: This paves the way for doing data validation too, @@ -1616,11 +1616,11 @@ bool ShuttleGuiBase::DoStep( int iStep ) } -/// Variant of the standard TieCheckBox which does the two step exchange +/// Variant of the standard TieCheckBox which does the two step exchange /// between gui and stack variable and stack variable and shuttle. wxCheckBox * ShuttleGuiBase::TieCheckBox( - const wxString &Prompt, - const wxString &SettingName, + const wxString &Prompt, + const wxString &SettingName, const bool bDefault) { wxCheckBox * pCheck=NULL; @@ -1634,11 +1634,11 @@ wxCheckBox * ShuttleGuiBase::TieCheckBox( return pCheck; } -/// Variant of the standard TieCheckBox which does the two step exchange +/// Variant of the standard TieCheckBox which does the two step exchange /// between gui and stack variable and stack variable and shuttle. wxCheckBox * ShuttleGuiBase::TieCheckBoxOnRight( - const wxString &Prompt, - const wxString &SettingName, + const wxString &Prompt, + const wxString &SettingName, const bool bDefault) { wxCheckBox * pCheck=NULL; @@ -1652,11 +1652,11 @@ wxCheckBox * ShuttleGuiBase::TieCheckBoxOnRight( return pCheck; } -/// Variant of the standard TieSlider which does the two step exchange +/// Variant of the standard TieSlider which does the two step exchange /// between gui and stack variable and stack variable and shuttle. wxSlider * ShuttleGuiBase::TieSlider( - const wxString &Prompt, - const wxString &SettingName, + const wxString &Prompt, + const wxString &SettingName, const int iDefault, const int max, const int min) @@ -1672,11 +1672,11 @@ wxSlider * ShuttleGuiBase::TieSlider( return pSlider; } -/// Variant of the standard TieSpinCtrl which does the two step exchange +/// Variant of the standard TieSpinCtrl which does the two step exchange /// between gui and stack variable and stack variable and shuttle. wxSpinCtrl * ShuttleGuiBase::TieSpinCtrl( - const wxString &Prompt, - const wxString &SettingName, + const wxString &Prompt, + const wxString &SettingName, const int Value, const int max, const int min) @@ -1692,11 +1692,11 @@ wxSpinCtrl * ShuttleGuiBase::TieSpinCtrl( return pSpinCtrl; } -/// Variant of the standard TieTextBox which does the two step exchange +/// Variant of the standard TieTextBox which does the two step exchange /// between gui and stack variable and stack variable and shuttle. wxTextCtrl * ShuttleGuiBase::TieTextBox( - const wxString & Prompt, - const wxString & SettingName, + const wxString & Prompt, + const wxString & SettingName, const wxString & Default, const int nChars) { @@ -1710,11 +1710,11 @@ wxTextCtrl * ShuttleGuiBase::TieTextBox( return pText; } -/// Variant of the standard TieTextBox which does the two step exchange +/// Variant of the standard TieTextBox which does the two step exchange /// between gui and stack variable and stack variable and shuttle. wxTextCtrl * ShuttleGuiBase::TieNumericTextBox( - const wxString & Prompt, - const wxString & SettingName, + const wxString & Prompt, + const wxString & SettingName, const wxString & Default, const int nChars) { @@ -1727,12 +1727,12 @@ wxTextCtrl * ShuttleGuiBase::TieNumericTextBox( if( DoStep(3) ) DoDataShuttle( SettingName, WrappedRef ); return pText; } -/// Variant of the standard TieTextBox which does the two step exchange +/// Variant of the standard TieTextBox which does the two step exchange /// between gui and stack variable and stack variable and shuttle. /// This one does it for double values... wxTextCtrl * ShuttleGuiBase::TieTextBox( - const wxString & Prompt, - const wxString & SettingName, + const wxString & Prompt, + const wxString & SettingName, const double & Default, const int nChars) { @@ -1746,12 +1746,12 @@ wxTextCtrl * ShuttleGuiBase::TieTextBox( return pText; } -/// Variant of the standard TieTextBox which does the two step exchange +/// Variant of the standard TieTextBox which does the two step exchange /// between gui and stack variable and stack variable and shuttle. /// This one does it for double values... wxTextCtrl * ShuttleGuiBase::TieNumericTextBox( - const wxString & Prompt, - const wxString & SettingName, + const wxString & Prompt, + const wxString & SettingName, const double & Default, const int nChars) { @@ -1765,22 +1765,22 @@ wxTextCtrl * ShuttleGuiBase::TieNumericTextBox( return pText; } -/// Variant of the standard TieChoice which does the two step exchange +/// Variant of the standard TieChoice which does the two step exchange /// between gui and stack variable and stack variable and shuttle. /// @param Prompt The prompt shown beside the control. /// @param SettingName The setting name as stored in gPrefs /// @param Default The default value for this control (translated) /// @param Choices An array of choices that appear on screen. /// @param TranslatedChoices The corresponding values (as a string array) -wxChoice * ShuttleGuiBase::TieChoice( - const wxString &Prompt, - const wxString &SettingName, - const wxString &Default, +wxChoice * ShuttleGuiBase::TieChoice( + const wxString &Prompt, + const wxString &SettingName, + const wxString &Default, const wxArrayString & Choices, const wxArrayString & TranslatedChoices) { wxChoice * pChoice=(wxChoice*)NULL; - + int TempIndex=0; // int TempIndex = TranslateToIndex( Default, TranslatedChoices ); wxString TempStr = Default; @@ -1795,7 +1795,7 @@ wxChoice * ShuttleGuiBase::TieChoice( return pChoice; } -/// Variant of the standard TieChoice which does the two step exchange +/// Variant of the standard TieChoice which does the two step exchange /// between gui and stack variable and stack variable and shuttle. /// Difference to previous one is that the Translated choices and default /// are integers, not Strings. @@ -1804,15 +1804,15 @@ wxChoice * ShuttleGuiBase::TieChoice( /// @param Default The default value for this control (translated) /// @param Choices An array of choices that appear on screen. /// @param TranslatedChoices The correcponding values (as an integer array) -wxChoice * ShuttleGuiBase::TieChoice( - const wxString &Prompt, - const wxString &SettingName, - const int Default, +wxChoice * ShuttleGuiBase::TieChoice( + const wxString &Prompt, + const wxString &SettingName, + const int Default, const wxArrayString & Choices, const wxArrayInt & TranslatedChoices) { wxChoice * pChoice=(wxChoice*)NULL; - + int TempIndex=0; int TranslatedInt = Default; WrappedType WrappedRef( TranslatedInt ); @@ -1850,8 +1850,8 @@ void ShuttleGuiBase::StartRadioButtonGroup( const wxString & SettingName, const /// This function must be within a StartRadioButtonGroup - EndRadioButtonGroup pair. -wxRadioButton * ShuttleGuiBase::TieRadioButton( - const wxString &Prompt, +wxRadioButton * ShuttleGuiBase::TieRadioButton( + const wxString &Prompt, const int iValue) { int iTemp = iValue; @@ -1860,14 +1860,14 @@ wxRadioButton * ShuttleGuiBase::TieRadioButton( } /// This function must be within a StartRadioButtonGroup - EndRadioButtonGroup pair. -wxRadioButton * ShuttleGuiBase::TieRadioButton( - const wxString &Prompt, +wxRadioButton * ShuttleGuiBase::TieRadioButton( + const wxString &Prompt, const wxString &Value) { // In what follows, WrappedRef is used in read only mode, but we // don't have a 'read-only' version, so we copy to deal with the constness. wxString Temp = Value; - WrappedType WrappedRef( Temp ); + WrappedType WrappedRef( Temp ); return TieRadioButton( Prompt, WrappedRef ); } @@ -1879,7 +1879,7 @@ wxRadioButton * ShuttleGuiBase::TieRadioButton( /// However, the user can force the id manually, for example /// if they need a specific Id for a button, and then let it /// resume normal numbering later. -/// UseUpId() sets miId to the next Id, either using the +/// UseUpId() sets miId to the next Id, either using the /// user specicfied one, or resuming the sequence. void ShuttleGuiBase::UseUpId() { @@ -2067,8 +2067,8 @@ AdornedRulerPanel * ShuttleGui::AddAdornedRuler( ViewInfo *pViewInfo ) AdornedRulerPanel * pAdornedRuler; miProp=0; mpWind = pAdornedRuler = new AdornedRulerPanel( - mpParent, - miId, + mpParent, + miId, wxDefaultPosition, wxDefaultSize, pViewInfo @@ -2089,7 +2089,7 @@ RulerPanel * ShuttleGui::AddRulerVertical(float low, float hi, const wxString & RulerPanel * pRulerPanel; miProp=0; mpWind = pRulerPanel = new RulerPanel( - mpParent, + mpParent, miId, wxDefaultPosition, wxDefaultSize @@ -2101,7 +2101,7 @@ RulerPanel * ShuttleGui::AddRulerVertical(float low, float hi, const wxString & Ruler.SetFormat(Ruler::RealFormat); Ruler.SetUnits(Units); Ruler.SetLabelEdges(true); - + mpWind->SetMinSize(wxSize(38,50)); UpdateSizers(); return pRulerPanel; @@ -2220,7 +2220,7 @@ void ShuttleGui::AddStandardButtons(long buttons, wxButton *extra) return; StartVerticalLay( false ); - + miSizerProp = false; mpSubSizer = CreateStdButtonSizer( mpParent, buttons, extra ); UpdateSizers(); @@ -2245,7 +2245,7 @@ void ShuttleGui::SetSizeHints( wxWindow *window, const wxArrayString & items ) { int x; int y; - + window->GetTextExtent(items[i], &x, &y ); if( x > maxw ) { diff --git a/src/ShuttleGui.h b/src/ShuttleGui.h index e2c6bd73e..d48826ae1 100644 --- a/src/ShuttleGui.h +++ b/src/ShuttleGui.h @@ -19,7 +19,7 @@ #include #include -#include "WrappedType.h" +#include "WrappedType.h" const int nMaxNestedSizers = 20; @@ -173,7 +173,7 @@ public: wxChoice * TieChoice( const wxString &Prompt, WrappedType & WrappedRef, const wxArrayString * pChoices ); wxChoice * TieChoice( const wxString &Prompt, wxString &Selected, const wxArrayString * pChoices ); wxChoice * TieChoice( const wxString &Prompt, int &Selected, const wxArrayString * pChoices ); - + wxSlider * TieSlider( const wxString &Prompt, WrappedType & WrappedRef, const int max, const int min = 0 ); wxSlider * TieSlider( const wxString &Prompt, int &pos, const int max, const int min = 0); wxSlider * TieSlider( const wxString &Prompt, float &pos, const float fMin, const float fMax); @@ -191,55 +191,55 @@ public: // Note that unlike the other Tie functions, ALL the arguments are const. // That's because the data is being exchanged between the dialog and mpShuttle // so it doesn't need an argument that is writeable. - wxCheckBox * TieCheckBox( + wxCheckBox * TieCheckBox( const wxString &Prompt, const wxString &SettingName, const bool bDefault); - wxCheckBox * TieCheckBoxOnRight( + wxCheckBox * TieCheckBoxOnRight( const wxString &Prompt, const wxString &SettingName, const bool bDefault); - wxChoice * TieChoice( - const wxString &Prompt, - const wxString &SettingName, - const wxString &Default, + wxChoice * TieChoice( + const wxString &Prompt, + const wxString &SettingName, + const wxString &Default, const wxArrayString &Choices, const wxArrayString & TranslatedChoices ); - wxChoice * TieChoice( - const wxString &Prompt, - const wxString &SettingName, - const int Default, + wxChoice * TieChoice( + const wxString &Prompt, + const wxString &SettingName, + const int Default, const wxArrayString & Choices, const wxArrayInt & TranslatedChoices); wxTextCtrl * TieTextBox( - const wxString &Prompt, - const wxString &SettingName, + const wxString &Prompt, + const wxString &SettingName, const wxString &Default, const int nChars); wxTextCtrl * TieTextBox( - const wxString & Prompt, - const wxString & SettingName, + const wxString & Prompt, + const wxString & SettingName, const double & Default, const int nChars); wxTextCtrl * TieNumericTextBox( - const wxString &Prompt, - const wxString &SettingName, + const wxString &Prompt, + const wxString &SettingName, const wxString &Default, const int nChars); wxTextCtrl * TieNumericTextBox( - const wxString & Prompt, - const wxString & SettingName, + const wxString & Prompt, + const wxString & SettingName, const double & Default, const int nChars); wxSlider * TieSlider( - const wxString & Prompt, - const wxString & SettingName, + const wxString & Prompt, + const wxString & SettingName, const int iDefault, const int max, const int min = 0); wxSpinCtrl * TieSpinCtrl( - const wxString &Prompt, - const wxString &SettingName, + const wxString &Prompt, + const wxString &SettingName, const int Value, const int max, const int min); @@ -276,7 +276,7 @@ protected: wxSizer * pSizerStack[ nMaxNestedSizers ]; wxString mBoxName; - Shuttle * mpShuttle; /*! Controls source/destination of shuttled data. You can + Shuttle * mpShuttle; /*! Controls source/destination of shuttled data. You can leave this NULL if you are shuttling to variables */ int miNoMatchSelector; //! Used in choices to determine which item to use on no match. diff --git a/src/ShuttlePrefs.cpp b/src/ShuttlePrefs.cpp index acdbf389b..4c125ef77 100644 --- a/src/ShuttlePrefs.cpp +++ b/src/ShuttlePrefs.cpp @@ -21,7 +21,7 @@ \verbatim Gui -- Data -- Prefs \endverbatim - + *//*******************************************************************/ #include "Audacity.h" @@ -40,7 +40,7 @@ bool ShuttlePrefs::TransferBool( const wxString & Name, bool & bValue, const boo { bValue = bDefault; gPrefs->Read( Name, &bValue ); - } + } else { return (gPrefs->Write( Name, bValue ) && gPrefs->Flush()); @@ -54,7 +54,7 @@ bool ShuttlePrefs::TransferDouble( const wxString & Name, double & dValue, const { dValue = dDefault; gPrefs->Read( Name, &dValue ); - } + } else { return (gPrefs->Write( Name, dValue ) && gPrefs->Flush()); @@ -68,7 +68,7 @@ bool ShuttlePrefs::TransferInt( const wxString & Name, int & iValue, const int & { iValue = iDefault; gPrefs->Read( Name, &iValue ); - } + } else { return (gPrefs->Write( Name, iValue ) && gPrefs->Flush()); @@ -82,7 +82,7 @@ bool ShuttlePrefs::TransferString( const wxString & Name, wxString & strValue, c { strValue = strDefault; gPrefs->Read( Name, &strValue ); - } + } else { return (gPrefs->Write( Name, strValue ) && gPrefs->Flush()); diff --git a/src/ShuttlePrefs.h b/src/ShuttlePrefs.h index dd616be49..fe9ad86fb 100644 --- a/src/ShuttlePrefs.h +++ b/src/ShuttlePrefs.h @@ -20,7 +20,7 @@ public: // constructors and destructors ShuttlePrefs(){;}; virtual ~ShuttlePrefs() {;}; - + public: virtual bool TransferBool( const wxString & Name, bool & bValue, const bool & bDefault ); // virtual bool TransferFloat( const wxString & Name, float & fValue, const float &fDefault ); diff --git a/src/Snap.cpp b/src/Snap.cpp index 13d929b3c..30c7b44e5 100644 --- a/src/Snap.cpp +++ b/src/Snap.cpp @@ -1,9 +1,9 @@ /********************************************************************** Audacity: A Digital Audio Editor - + Snap.cpp - + Dominic Mazzoni **********************************************************************/ diff --git a/src/Snap.h b/src/Snap.h index b62553360..e33919c16 100644 --- a/src/Snap.h +++ b/src/Snap.h @@ -1,9 +1,9 @@ /********************************************************************** Audacity: A Digital Audio Editor - + Snap.h - + Dominic Mazzoni Create one of these objects at the beginning of a click/drag. diff --git a/src/SoundActivatedRecord.cpp b/src/SoundActivatedRecord.cpp index 636849851..fd73f9c05 100644 --- a/src/SoundActivatedRecord.cpp +++ b/src/SoundActivatedRecord.cpp @@ -33,7 +33,7 @@ BEGIN_EVENT_TABLE(SoundActivatedRecord, wxDialog) END_EVENT_TABLE() SoundActivatedRecord::SoundActivatedRecord(wxWindow* parent) -: wxDialog(parent, -1, _("Sound Activated Record"), wxDefaultPosition, +: wxDialog(parent, -1, _("Sound Activated Record"), wxDefaultPosition, wxDefaultSize, wxCAPTION ) // wxDefaultSize, wxCAPTION | wxTHICK_FRAME) { diff --git a/src/SplashDialog.cpp b/src/SplashDialog.cpp index 5c63874d5..b92290206 100644 --- a/src/SplashDialog.cpp +++ b/src/SplashDialog.cpp @@ -9,12 +9,12 @@ ********************************************************************//** \class SplashDialog -\brief The SplashDialog shows help information for Audacity when +\brief The SplashDialog shows help information for Audacity when Audacity starts up. -It was written for the benefit of new users who do not want to +It was written for the benefit of new users who do not want to read the manual. The text of the dialog is kept short to increase the -chance of it being read. The content is designed to reduce the +chance of it being read. The content is designed to reduce the most commonly asked questions about Audacity. *//********************************************************************/ @@ -46,7 +46,7 @@ most commonly asked questions about Audacity. SplashDialog * SplashDialog::pSelf=NULL; -enum +enum { DontShowID=1000, }; @@ -94,10 +94,10 @@ void SplashDialog::Populate( ShuttleGui & S ) RescaledImage.Rescale( int(LOGOWITHNAME_WIDTH * fScale), int(LOGOWITHNAME_HEIGHT *fScale) ); wxBitmap RescaledBitmap( RescaledImage ); m_pIcon = - new wxStaticBitmap(S.GetParent(), -1, - //*m_pLogo, //v theTheme.Bitmap(bmpAudacityLogoWithName), + new wxStaticBitmap(S.GetParent(), -1, + //*m_pLogo, //v theTheme.Bitmap(bmpAudacityLogoWithName), RescaledBitmap, - wxDefaultPosition, + wxDefaultPosition, wxSize(int(LOGOWITHNAME_WIDTH*fScale), int(LOGOWITHNAME_HEIGHT*fScale))); S.Prop(0).AddWindow( m_pIcon ); @@ -129,7 +129,7 @@ SplashDialog::~SplashDialog() void SplashDialog::OnDontShow( wxCommandEvent & Evt ) { - bool bShow = !Evt.IsChecked(); + bool bShow = !Evt.IsChecked(); gPrefs->Write(wxT("/GUI/ShowSplashScreen"), bShow ); gPrefs->Flush(); } diff --git a/src/SplashDialog.h b/src/SplashDialog.h index ae0aefb55..36e87427a 100644 --- a/src/SplashDialog.h +++ b/src/SplashDialog.h @@ -30,9 +30,9 @@ public: static void Show2( wxWindow * pParent ); DECLARE_EVENT_TABLE() - + private: - + void Populate( ShuttleGui & S ); void OnDontShow( wxCommandEvent & Evt ); diff --git a/src/SseMathFuncs.cpp b/src/SseMathFuncs.cpp index e177c9c10..7a8bf688c 100644 --- a/src/SseMathFuncs.cpp +++ b/src/SseMathFuncs.cpp @@ -27,9 +27,9 @@ * solo functions), or both in the more useful for us for FFTs sincos * function. * The constants minus_cephes_DP1 to minus_cephes_DP3 are used in the - * angle reduction modulo function. - * 4 sincos are done at a time. - * If we wanted to do just sin or just cos, we could speed things up + * angle reduction modulo function. + * 4 sincos are done at a time. + * If we wanted to do just sin or just cos, we could speed things up * by queuing up the Sines and Cosines into batches of 4 separately.*/ @@ -93,7 +93,7 @@ typedef union xmm_mm_union { #endif // USE_SSE2 -/* natural logarithm computed for 4 simultaneous float +/* natural logarithm computed for 4 simultaneous float return NaN for x <= 0 */ __m128 log_ps(v4sfu *xPtr) { @@ -134,7 +134,7 @@ __m128 log_ps(v4sfu *xPtr) { e = _mm_add_ps(e, one); - /* part2: + /* part2: if( x < SQRTHF ) { e -= 1; x = x + x - 1.0; @@ -229,7 +229,7 @@ __m128 exp_ps(v4sfu *xPtr) { tmp = _mm_cvtepi32_ps(emm0); #endif /* if greater, substract 1 */ - __m128 mask = _mm_cmpgt_ps(tmp, fx); + __m128 mask = _mm_cmpgt_ps(tmp, fx); mask = _mm_and_ps(mask, one); fx = _mm_sub_ps(tmp, mask); @@ -262,10 +262,10 @@ __m128 exp_ps(v4sfu *xPtr) { mm1 = _mm_cvttps_pi32(z); mm0 = _mm_add_pi32(mm0, *(__m64*)_pi32_0x7f); mm1 = _mm_add_pi32(mm1, *(__m64*)_pi32_0x7f); - mm0 = _mm_slli_pi32(mm0, 23); + mm0 = _mm_slli_pi32(mm0, 23); mm1 = _mm_slli_pi32(mm1, 23); - __m128 pow2n; + __m128 pow2n; COPY_MM_TO_XMM(mm0, mm1, pow2n); _mm_empty(); #else @@ -347,7 +347,7 @@ __m128 sin_ps(v4sfu *xPtr) { // any x /* get the swap sign flag */ emm0 = _mm_and_si128(emm2, *(__m128i*)_pi32_4); emm0 = _mm_slli_epi32(emm0, 29); - /* get the polynom selection mask + /* get the polynom selection mask there is one polynom for 0 <= x <= Pi/4 and another one for Pi/4CreateGrid(0, 2); + mGrid->CreateGrid(0, 2); mGrid->SetRowLabelSize(0); mGrid->SetDefaultCellAlignment(wxALIGN_LEFT, wxALIGN_CENTER); mGrid->SetColLabelValue(0, _("Tag")); diff --git a/src/Tags.h b/src/Tags.h index 983bffa4a..873a60470 100644 --- a/src/Tags.h +++ b/src/Tags.h @@ -20,10 +20,10 @@ since we're not supporting any v2 fields, is that ID3v2 tags are inserted at the BEGINNING of an mp3 file, which is far more useful for streaming. - + Use of this functionality requires that libid3tag be compiled in with Audacity. - + **********************************************************************/ #ifndef __AUDACITY_TAGS__ @@ -158,7 +158,7 @@ class TagsEditor: public wxDialog void OnOk(wxCommandEvent & event); void OnCancel(wxCommandEvent & event); - + bool IsWindowRectValid(const wxRect *windowRect) const; private: diff --git a/src/Theme.cpp b/src/Theme.cpp index 6b9c024ba..c74dfceb0 100644 --- a/src/Theme.cpp +++ b/src/Theme.cpp @@ -5,7 +5,7 @@ Theme.cpp James Crook - + Audacity is free software. This file is licensed under the wxWidgets license, see License.txt @@ -27,7 +27,7 @@ \class ThemeBase \brief Theme management - Image loading and saving. - Base for the Theme class. ThemeBase is a generic + Base for the Theme class. ThemeBase is a generic non-Audacity specific class. \see \ref Themability @@ -61,7 +61,7 @@ and use it for toolbar and window layouts too. #include #include -#include "Project.h" +#include "Project.h" #include "toolbars/ToolBar.h" #include "toolbars/ControlToolBar.h" #include "ImageManipulation.h" @@ -71,7 +71,7 @@ and use it for toolbar and window layouts too. #include "FileNames.h" #include "Prefs.h" -#include +#include WX_DEFINE_USER_EXPORTED_OBJARRAY( ArrayOfImages ) WX_DEFINE_USER_EXPORTED_OBJARRAY( ArrayOfBitmaps ) @@ -96,7 +96,7 @@ WX_DEFINE_USER_EXPORTED_OBJARRAY( ArrayOfColours ) #undef USE_AQUA_THEME // This step ensures we treat the cursors as 32x32 even on Mac. -// We're not yet creating the cursors from the theme, so +// We're not yet creating the cursors from the theme, so // all this ensures is that the sizing on PC and Mac stays in step. #define CURSORS_SIZE32 @@ -130,14 +130,14 @@ WX_DEFINE_USER_EXPORTED_OBJARRAY( ArrayOfColours ) #include "../images/Aqua/UpButtonWhite.xpm" #endif -#undef DownButton +#undef DownButton #undef UpButton #undef HiliteButton -#undef Down -#undef Hilite -#undef Up -#undef Slider -#undef SliderThumb +#undef Down +#undef Hilite +#undef Up +#undef Slider +#undef SliderThumb @@ -225,7 +225,7 @@ void Theme::ApplyUpdatedImages() AudacityProject *p = GetActiveProject(); if( p->GetControlToolBar() ) { - p->GetControlToolBar()->ReCreateButtons(); + p->GetControlToolBar()->ReCreateButtons(); } } @@ -275,12 +275,12 @@ void ThemeBase::LoadThemeAtStartUp( bool bLookForExternalFiles ) const bool cbBinaryRead =true; const bool cbOkIfNotFound = true; - // IF not interested in external files, + // IF not interested in external files, // THEN just use the internal default set. if( !bLookForExternalFiles ) { // IF the XPMs have been retired, THEN we'd better use the built-in cache - // at start up. + // at start up. // ELSE do nothing, we already have XPM based images. #ifdef XPMS_RETIRED ReadThemeInternal(); @@ -294,10 +294,10 @@ void ThemeBase::LoadThemeAtStartUp( bool bLookForExternalFiles ) ReadThemeInternal(); // JKC: Now we could go on and load the individual images - // on top of the default images using the commented out + // on top of the default images using the commented out // code that follows... // - // However, I think it is better to get the user to + // However, I think it is better to get the user to // build a new image cache, which they can do easily // from the Theme preferences tab. #if 0 @@ -306,7 +306,7 @@ void ThemeBase::LoadThemeAtStartUp( bool bLookForExternalFiles ) // JKC: I'm usure about doing this next step automatically. // Suppose the disk is write protected? - // Is having the image cache created automatically + // Is having the image cache created automatically // going to confuse users? Do we need version specific names? // and now save the combined image as a cache for later use. // We should load the images a little faster in future as a result. @@ -314,7 +314,7 @@ void ThemeBase::LoadThemeAtStartUp( bool bLookForExternalFiles ) #endif } - // Next line is not required as we haven't yet built the GUI + // Next line is not required as we haven't yet built the GUI // when this function is (or should be) called. // ApplyUpdatedImages(); } @@ -325,7 +325,7 @@ wxImage ThemeBase::MaskedImage( char const ** pXpm, char const ** pMask ) wxBitmap Bmp1( pXpm ); wxBitmap Bmp2( pMask ); -// wxLogDebug( wxT("Image 1: %i Image 2: %i"), +// wxLogDebug( wxT("Image 1: %i Image 2: %i"), // Bmp1.GetDepth(), Bmp2.GetDepth() ); // We want a 24-bit-depth bitmap if all is working, but on some @@ -574,7 +574,7 @@ void ThemeBase::CreateImageCache( bool bBinarySave ) // No href in html. Uses title not alt. wxRect R( mFlow.Rect() ); wxLogDebug( wxT(""), - mBitmapNames[i].c_str(), + mBitmapNames[i].c_str(), R.GetLeft(), R.GetTop(), R.GetRight(), R.GetBottom() ); #endif } @@ -604,7 +604,7 @@ void ThemeBase::CreateImageCache( bool bBinarySave ) // No href in html. Uses title not alt. wxRect R( mFlow.Rect() ); wxLogDebug( wxT(""), - mColourNames[i].c_str(), + mColourNames[i].c_str(), R.GetLeft(), R.GetTop(), R.GetRight(), R.GetBottom() ); #endif } @@ -618,13 +618,13 @@ void ThemeBase::CreateImageCache( bool bBinarySave ) { wxString FileName = FileNames::ThemeCachePng(); - // Perhaps we should prompt the user if they are overwriting + // Perhaps we should prompt the user if they are overwriting // an existing theme cache? #if 0 if( wxFileExist( FileName )) { wxMessageBox( - wxString::Format( + wxString::Format( wxT("Theme cache file:\n %s\nalready exists.\nAre you sure you want to replace it?"), FileName.c_str() )); return; @@ -633,13 +633,13 @@ void ThemeBase::CreateImageCache( bool bBinarySave ) if( !ImageCache.SaveFile( FileName, wxBITMAP_TYPE_PNG )) { wxMessageBox( - wxString::Format( + wxString::Format( _("Audacity could not write file:\n %s."), FileName.c_str() )); return; } wxMessageBox( - wxString::Format( + wxString::Format( wxT("Theme written to:\n %s."), FileName.c_str() )); } @@ -651,7 +651,7 @@ void ThemeBase::CreateImageCache( bool bBinarySave ) if( !OutStream.OpenFile( FileName )) { wxMessageBox( - wxString::Format( + wxString::Format( _("Audacity could not open file:\n %s\nfor writing."), FileName.c_str() )); return; @@ -659,13 +659,13 @@ void ThemeBase::CreateImageCache( bool bBinarySave ) if( !ImageCache.SaveFile(OutStream, wxBITMAP_TYPE_PNG ) ) { wxMessageBox( - wxString::Format( + wxString::Format( _("Audacity could not write images to file:\n %s."), FileName.c_str() )); return; } wxMessageBox( - wxString::Format( + wxString::Format( wxT("Theme as Cee code written to:\n %s."), FileName.c_str() )); } @@ -680,7 +680,7 @@ void ThemeBase::WriteImageMap( ) int i; mFlow.Init( ImageCacheWidth ); - + wxFFile File( FileNames::ThemeCacheHtm(), wxT("wb") );// I'll put in new lines explicitly. if( !File.IsOpened() ) return; @@ -699,9 +699,9 @@ void ThemeBase::WriteImageMap( ) mFlow.GetNextPosition( SrcImage.GetWidth(), SrcImage.GetHeight()); // No href in html. Uses title not alt. wxRect R( mFlow.Rect() ); - File.Write( wxString::Format( + File.Write( wxString::Format( wxT("\r\n"), - mBitmapNames[i].c_str(), + mBitmapNames[i].c_str(), R.GetLeft(), R.GetTop(), R.GetRight(), R.GetBottom()) ); } } @@ -714,7 +714,7 @@ void ThemeBase::WriteImageMap( ) // No href in html. Uses title not alt. wxRect R( mFlow.Rect() ); File.Write( wxString::Format( wxT("\r\n"), - mColourNames[i].c_str(), + mColourNames[i].c_str(), R.GetLeft(), R.GetTop(), R.GetRight(), R.GetBottom()) ); } File.Write( wxT("\r\n") ); @@ -753,9 +753,9 @@ void ThemeBase::WriteImageDefs( ) File.Write( wxString::Format( wxT("\r\n SET_THEME_FLAGS( %s );\r\n"), Temp.c_str() )); } - File.Write( wxString::Format( + File.Write( wxString::Format( wxT(" DEFINE_IMAGE( bmp%s, wxImage( %i, %i ), wxT(\"%s\"));\r\n"), - mBitmapNames[i].c_str(), + mBitmapNames[i].c_str(), SrcImage.GetWidth(), SrcImage.GetHeight(), mBitmapNames[i].c_str() @@ -769,7 +769,7 @@ void ThemeBase::WriteImageDefs( ) /// Reads an image cache including images, cursors and colours. -/// @param bBinaryRead if true means read from an external binary file. +/// @param bBinaryRead if true means read from an external binary file. /// otherwise the data is taken from a compiled in block of memory. /// @param bOkIfNotFound if true means do not report absent file. /// @return true iff we loaded the images. @@ -790,11 +790,11 @@ bool ThemeBase::ReadImageCache( bool bBinaryRead, bool bOkIfNotFound) { wxString FileName = FileNames::ThemeCachePng(); if( !wxFileExists( FileName )) - { + { if( bOkIfNotFound ) return false; // did not load the images, so return false. wxMessageBox( - wxString::Format( + wxString::Format( _("Audacity could not find file:\n %s.\nTheme not loaded."), FileName.c_str() )); return false; @@ -803,7 +803,7 @@ bool ThemeBase::ReadImageCache( bool bBinaryRead, bool bOkIfNotFound) { /* i18n-hint: Do not translate png. It is the name of a file format.*/ wxMessageBox( - wxString::Format( + wxString::Format( _("Audacity could not load file:\n %s.\nBad png format perhaps?"), FileName.c_str() )); return false; @@ -811,14 +811,14 @@ bool ThemeBase::ReadImageCache( bool bBinaryRead, bool bOkIfNotFound) } // ELSE we are reading from internal storage. else - { + { wxMemoryInputStream InternalStream( (char *)ImageCacheAsData, sizeof(ImageCacheAsData)); if( !ImageCache.LoadFile( InternalStream, wxBITMAP_TYPE_PNG )) { // If we get this message, it means that the data in file // was not a valid png image. - // Most likely someone edited it by mistake, + // Most likely someone edited it by mistake, // Or some experiment is being tried with new formats for it. wxMessageBox(_("Audacity could not read its default theme.\nPlease report the problem.")); return false; @@ -856,9 +856,9 @@ bool ThemeBase::ReadImageCache( bool bBinaryRead, bool bOkIfNotFound) // This allows us to add new colours more easily. if( ImageCache.GetAlpha(x,y ) > 128 ) { - TempColour = wxColour( - ImageCache.GetRed( x,y), - ImageCache.GetGreen( x,y), + TempColour = wxColour( + ImageCache.GetRed( x,y), + ImageCache.GetGreen( x,y), ImageCache.GetBlue(x,y)); /// \todo revisit this hack which makes adding new colours easier /// but which prevents a colour of (1,1,1) from being added. @@ -883,7 +883,7 @@ void ThemeBase::LoadComponents( bool bOkIfNotFound ) wxString FileName; for(i=0;i<(int)mImages.GetCount();i++) { - + if( (mBitmapFlags[i] & resFlagInternal)==0) { FileName = FileNames::ThemeComponent( mBitmapNames[i] ); @@ -893,12 +893,12 @@ void ThemeBase::LoadComponents( bool bOkIfNotFound ) { /* i18n-hint: Do not translate png. It is the name of a file format.*/ wxMessageBox( - wxString::Format( + wxString::Format( _("Audacity could not load file:\n %s.\nBad png format perhaps?"), FileName.c_str() )); return; } - /// JKC: \bug (wxWidgets) A png may have been saved with alpha, but when you + /// JKC: \bug (wxWidgets) A png may have been saved with alpha, but when you /// load it, it comes back with a mask instead! (well I guess it is more /// efficient). Anyway, we want alpha and not a mask, so we call InitAlpha, /// and that transfers the mask into the alpha channel, and we're done. @@ -926,7 +926,7 @@ void ThemeBase::SaveComponents() // IF directory doesn't exist THEN create it if( !wxDirExists( FileNames::ThemeComponentsDir() )) { - /// \bug 1 in wxWidgets documentation; wxMkDir returns false if + /// \bug 1 in wxWidgets documentation; wxMkDir returns false if /// directory didn't exist, even if it successfully creates it. /// so we create and then test if it exists instead. /// \bug 2 in wxWidgets documentation; wxMkDir has only one argument @@ -939,7 +939,7 @@ void ThemeBase::SaveComponents() if( !wxDirExists( FileNames::ThemeComponentsDir() )) { wxMessageBox( - wxString::Format( + wxString::Format( _("Could not create directory:\n %s"), FileNames::ThemeComponentsDir().c_str() )); return; @@ -960,7 +960,7 @@ void ThemeBase::SaveComponents() if( !mImages[i].SaveFile( FileName, wxBITMAP_TYPE_PNG )) { wxMessageBox( - wxString::Format( + wxString::Format( _("Audacity could not save file:\n %s"), FileName.c_str() )); return; @@ -972,13 +972,13 @@ void ThemeBase::SaveComponents() if( n==0 ) { wxMessageBox( - wxString::Format( + wxString::Format( _("All required files in:\n %s\nwere already present."), FileNames::ThemeComponentsDir().c_str() )); return; } wxMessageBox( - wxString::Format( + wxString::Format( wxT("Theme written to:\n %s."), FileNames::ThemeComponentsDir().c_str() )); } @@ -1050,7 +1050,7 @@ wxCursor & ThemeBase::Cursor( int iIndex ) EnsureInitialised(); // Purposeful null deref. Function is for future use. // If anyone tries to use it now they will get an error. - return *(wxCursor*)NULL; + return *(wxCursor*)NULL; } wxFont & ThemeBase::Font( int iIndex ) diff --git a/src/Theme.h b/src/Theme.h index f9b15b37c..8956db29f 100644 --- a/src/Theme.h +++ b/src/Theme.h @@ -27,7 +27,7 @@ typedef int teBmps; /// The index of a bitmap resource in Theme Resources. enum teResourceType -{ +{ resTypeColour, resTypeBitmap, resTypeImage = resTypeBitmap, @@ -52,7 +52,7 @@ WX_DECLARE_USER_EXPORTED_OBJARRAY(wxColour, ArrayOfColours, AUDACITY_DLL_API); //WX_DECLARE_OBJARRAY(wxBitmap, ArrayOfBitmaps); //WX_DECLARE_OBJARRAY(wxColour, ArrayOfColours); -class AUDACITY_DLL_API FlowPacker +class AUDACITY_DLL_API FlowPacker { public: FlowPacker(){;}; @@ -70,7 +70,7 @@ public: int myHeight; private: - int iImageGroupSize; + int iImageGroupSize; int iImageGroupIndex; int mOldFlags; int myPosBase; @@ -108,7 +108,7 @@ public: wxColour & Colour( int iIndex ); wxBitmap & Bitmap( int iIndex ); - wxImage & Image( int iIndex ); + wxImage & Image( int iIndex ); wxCursor & Cursor( int iIndex ); wxFont & Font( int iIndex ); wxSize ImageSize( int iIndex ); diff --git a/src/TimeTrack.cpp b/src/TimeTrack.cpp index 347c74668..ee8fb0465 100644 --- a/src/TimeTrack.cpp +++ b/src/TimeTrack.cpp @@ -99,7 +99,7 @@ TimeTrack::~TimeTrack() { delete mEnvelope; mEnvelope = NULL; - + delete mRuler; } @@ -141,17 +141,17 @@ bool TimeTrack::HandleXMLTag(const wxChar *tag, const wxChar **attrs) while(*attrs) { const wxChar *attr = *attrs++; const wxChar *value = *attrs++; - + if (!value) break; - + const wxString strValue = value; if (!wxStrcmp(attr, wxT("name")) && XMLValueChecker::IsGoodString(strValue)) mName = strValue; - else if (!wxStrcmp(attr, wxT("height")) && + else if (!wxStrcmp(attr, wxT("height")) && XMLValueChecker::IsGoodInt(strValue) && strValue.ToLong(&nValue)) mHeight = nValue; - else if (!wxStrcmp(attr, wxT("minimized")) && + else if (!wxStrcmp(attr, wxT("minimized")) && XMLValueChecker::IsGoodInt(strValue) && strValue.ToLong(&nValue)) mMinimized = (nValue != 0); else if (!wxStrcmp(attr, wxT("rangelower"))) @@ -164,19 +164,19 @@ bool TimeTrack::HandleXMLTag(const wxChar *tag, const wxChar **attrs) mRangeUpper = Internat::CompatibleToDouble(value); mRescaleXMLValues = false; } - else if (!wxStrcmp(attr, wxT("displaylog")) && + else if (!wxStrcmp(attr, wxT("displaylog")) && XMLValueChecker::IsGoodInt(strValue) && strValue.ToLong(&nValue)) { SetDisplayLog(nValue != 0); //TODO-MB: This causes a graphical glitch, TrackPanel should probably be Refresh()ed after loading. // I don't know where to do this though. } - else if (!wxStrcmp(attr, wxT("interpolatelog")) && + else if (!wxStrcmp(attr, wxT("interpolatelog")) && XMLValueChecker::IsGoodInt(strValue) && strValue.ToLong(&nValue)) { SetInterpolateLog(nValue != 0); } - + } // while if(mRescaleXMLValues) mEnvelope->SetRange(0.0, 1.0); // this will be restored to the actual range later @@ -285,7 +285,7 @@ void TimeTrack::testMe() GetEnvelope()->Insert( 5.0 - 0.001, 0.2 ); GetEnvelope()->Insert( 5.0 + 0.001, 1.3 ); GetEnvelope()->Insert( 10.0, 1.3 ); - + double value1 = GetEnvelope()->Integral(2.0, 13.0); double expected1 = (5.0 - 2.0) * 0.2 + (13.0 - 5.0) * 1.3; double value2 = GetEnvelope()->IntegralOfInverse(2.0, 13.0); diff --git a/src/TimeTrack.h b/src/TimeTrack.h index 23bfd5dd5..6b4f14a37 100644 --- a/src/TimeTrack.h +++ b/src/TimeTrack.h @@ -39,7 +39,7 @@ class TimeTrack: public Track { virtual ~TimeTrack(); // Identifying the type of track - virtual int GetKind() const { return Time; } + virtual int GetKind() const { return Time; } // TimeTrack parameters @@ -67,7 +67,7 @@ class TimeTrack: public Track { // Access the track's speed envelope Envelope *GetEnvelope() { return mEnvelope; } - + //Note: The meaning of this function has changed (December 2012) //Previously this function did something that was close to the opposite (but not entirely accurate). /** @brief Compute the integral warp factor between two non-warped time points @@ -83,7 +83,7 @@ class TimeTrack: public Track { double ComputeWarpFactor(double t0, double t1); /** @brief Compute the duration (in seconds at playback) of the specified region of the track. * - * Takes a region of the time track (specified by the unwarped time points in the project), and + * Takes a region of the time track (specified by the unwarped time points in the project), and * calculates how long it will actually take to play this region back, taking the time track's * warping effects into account. * @param t0 unwarped time to start calculation from diff --git a/src/TimerRecordDialog.cpp b/src/TimerRecordDialog.cpp index b02678a6a..0e9edb814 100644 --- a/src/TimerRecordDialog.cpp +++ b/src/TimerRecordDialog.cpp @@ -5,7 +5,7 @@ TimerRecordDialog.cpp Copyright 2006-2009 by Vaughan Johnson - + This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or @@ -37,10 +37,10 @@ #define TIMER_ID 7000 enum { // control IDs - ID_DATEPICKER_START = 10000, - ID_TIMETEXT_START, - ID_DATEPICKER_END, - ID_TIMETEXT_END, + ID_DATEPICKER_START = 10000, + ID_TIMETEXT_START, + ID_DATEPICKER_END, + ID_TIMETEXT_END, ID_TIMETEXT_DURATION }; @@ -54,10 +54,10 @@ static double wxDateTime_to_AudacityTime(wxDateTime& dateTime) BEGIN_EVENT_TABLE(TimerRecordDialog, wxDialog) EVT_DATE_CHANGED(ID_DATEPICKER_START, TimerRecordDialog::OnDatePicker_Start) EVT_TEXT(ID_TIMETEXT_START, TimerRecordDialog::OnTimeText_Start) - + EVT_DATE_CHANGED(ID_DATEPICKER_END, TimerRecordDialog::OnDatePicker_End) EVT_TEXT(ID_TIMETEXT_END, TimerRecordDialog::OnTimeText_End) - + EVT_TEXT(ID_TIMETEXT_DURATION, TimerRecordDialog::OnTimeText_Duration) EVT_BUTTON(wxID_OK, TimerRecordDialog::OnOK) @@ -66,13 +66,13 @@ BEGIN_EVENT_TABLE(TimerRecordDialog, wxDialog) END_EVENT_TABLE() TimerRecordDialog::TimerRecordDialog(wxWindow* parent) -: wxDialog(parent, -1, _("Audacity Timer Record"), wxDefaultPosition, +: wxDialog(parent, -1, _("Audacity Timer Record"), wxDefaultPosition, wxDefaultSize, wxCAPTION) { m_DateTime_Start = wxDateTime::UNow(); long seconds; // default duration is 1 hour = 3600 seconds gPrefs->Read(wxT("/TimerRecord/LastDuration"), &seconds, 3600); - m_TimeSpan_Duration = wxTimeSpan::Seconds(seconds); + m_TimeSpan_Duration = wxTimeSpan::Seconds(seconds); m_DateTime_End = m_DateTime_Start + m_TimeSpan_Duration; m_pDatePickerCtrl_Start = NULL; @@ -80,7 +80,7 @@ TimerRecordDialog::TimerRecordDialog(wxWindow* parent) m_pDatePickerCtrl_End = NULL; m_pTimeTextCtrl_End = NULL; - + m_pTimeTextCtrl_Duration = NULL; ShuttleGui S(this, eIsCreating); @@ -91,7 +91,7 @@ TimerRecordDialog::TimerRecordDialog(wxWindow* parent) m_pTimeTextCtrl_Duration->SetFieldFocus(3); m_timer.SetOwner(this, TIMER_ID); - m_timer.Start(kTimerInterval); + m_timer.Start(kTimerInterval); } TimerRecordDialog::~TimerRecordDialog() @@ -120,20 +120,20 @@ void TimerRecordDialog::OnDatePicker_Start(wxDateEvent& WXUNUSED(event)) m_DateTime_Start.SetMinute(min); m_DateTime_Start.SetSecond(sec); - // User might have had the dialog up for a while, or + // User might have had the dialog up for a while, or // had a future day, set hour of day less than now's, then changed day to today. wxTimerEvent dummyTimerEvent; this->OnTimer(dummyTimerEvent); // Always update End for changed Start, keeping Duration constant. - // Note that OnTimer sometimes calls UpdateEnd, so sometimes this is redundant, + // Note that OnTimer sometimes calls UpdateEnd, so sometimes this is redundant, // but OnTimer doesn't need to always call UpdateEnd, but we must here. - this->UpdateEnd(); + this->UpdateEnd(); } void TimerRecordDialog::OnTimeText_Start(wxCommandEvent& WXUNUSED(event)) { - //v TimeTextCtrl doesn't implement upper ranges, i.e., if I tell it "024 h 060 m 060 s", then + //v TimeTextCtrl doesn't implement upper ranges, i.e., if I tell it "024 h 060 m 060 s", then // user increments the hours past 23, it rolls over to 0 (although if you increment below 0, it stays at 0). // So instead, set the max to 99 and just catch hours > 24 and fix the ctrls. double dTime = m_pTimeTextCtrl_Start->GetTimeValue(); @@ -148,7 +148,7 @@ void TimerRecordDialog::OnTimeText_Start(wxCommandEvent& WXUNUSED(event)) wxDateEvent dummyDateEvent; this->OnDatePicker_Start(dummyDateEvent); } - + void TimerRecordDialog::OnDatePicker_End(wxDateEvent& WXUNUSED(event)) { m_DateTime_End = m_pDatePickerCtrl_End->GetValue(); @@ -160,7 +160,7 @@ void TimerRecordDialog::OnDatePicker_End(wxDateEvent& WXUNUSED(event)) m_DateTime_End.SetMinute(min); m_DateTime_End.SetSecond(sec); - // DatePickerCtrls use SetRange to make sure End is never less than Start, but + // DatePickerCtrls use SetRange to make sure End is never less than Start, but // need to implement it for the TimeTextCtrls. if (m_DateTime_End < m_DateTime_Start) { m_DateTime_End = m_DateTime_Start; @@ -173,7 +173,7 @@ void TimerRecordDialog::OnDatePicker_End(wxDateEvent& WXUNUSED(event)) void TimerRecordDialog::OnTimeText_End(wxCommandEvent& WXUNUSED(event)) { - //v TimeTextCtrl doesn't implement upper ranges, i.e., if I tell it "024 h 060 m 060 s", then + //v TimeTextCtrl doesn't implement upper ranges, i.e., if I tell it "024 h 060 m 060 s", then // user increments the hours past 23, it rolls over to 0 (although if you increment below 0, it stays at 0). // So instead, set the max to 99 and just catch hours > 24 and fix the ctrls. double dTime = m_pTimeTextCtrl_End->GetTimeValue(); @@ -205,7 +205,7 @@ void TimerRecordDialog::OnOK(wxCommandEvent& WXUNUSED(event)) this->TransferDataFromWindow(); if (!m_TimeSpan_Duration.IsPositive()) { - wxMessageBox(_("Duration is zero. Nothing will be recorded."), + wxMessageBox(_("Duration is zero. Nothing will be recorded."), _("Error in Duration"), wxICON_EXCLAMATION | wxOK); return; } @@ -223,15 +223,15 @@ void TimerRecordDialog::OnOK(wxCommandEvent& WXUNUSED(event)) bool TimerRecordDialog::RunWaitDialog() { int updateResult = eProgressSuccess; - if (m_DateTime_Start > wxDateTime::UNow()) - updateResult = this->WaitForStart(); + if (m_DateTime_Start > wxDateTime::UNow()) + updateResult = this->WaitForStart(); - if (updateResult != eProgressSuccess) + if (updateResult != eProgressSuccess) { - // Don't proceed, but don't treat it as canceled recording. User just canceled waiting. + // Don't proceed, but don't treat it as canceled recording. User just canceled waiting. return true; } - else + else { // Record for specified time. AudacityProject* pProject = GetActiveProject(); @@ -242,21 +242,21 @@ bool TimerRecordDialog::RunWaitDialog() _("Recording start") + (wxString)wxT(":\t\t") + GetDisplayDate(m_DateTime_Start) + wxT("\n") + _("Recording end") + wxT(":\t\t") + GetDisplayDate(m_DateTime_End) + wxT("\n") - + _("Duration") + wxT(":\t\t") + m_TimeSpan_Duration.Format(); + + _("Duration") + wxT(":\t\t") + m_TimeSpan_Duration.Format(); - TimerProgressDialog - progress(m_TimeSpan_Duration.GetMilliseconds().GetValue(), - _("Audacity Timer Record Progress"), - strMsg, - pdlgHideCancelButton); + TimerProgressDialog + progress(m_TimeSpan_Duration.GetMilliseconds().GetValue(), + _("Audacity Timer Record Progress"), + strMsg, + pdlgHideCancelButton); - // Make sure that start and end time are updated, so we always get the full + // Make sure that start and end time are updated, so we always get the full // duration, even if there's some delay getting here. wxTimerEvent dummyTimerEvent; this->OnTimer(dummyTimerEvent); // Loop for progress display during recording. - while (bIsRecording && (updateResult == eProgressSuccess)) + while (bIsRecording && (updateResult == eProgressSuccess)) { wxMilliSleep(kTimerInterval); updateResult = progress.Update(); @@ -264,7 +264,7 @@ bool TimerRecordDialog::RunWaitDialog() } pProject->OnStop(); } - // Let the caller handle cancellation or failure from recording progress. + // Let the caller handle cancellation or failure from recording progress. if (updateResult == eProgressCancelled || updateResult == eProgressFailed) return false; return true; @@ -292,7 +292,7 @@ wxString TimerRecordDialog::GetDisplayDate( wxDateTime & dt ) st.wYear = (WXWORD)tm.year; st.wMonth = (WXWORD)(tm.mon - wxDateTime::Jan + 1); st.wDay = tm.mday; - st.wDayOfWeek = st.wMinute = st.wSecond = st.wMilliseconds = 0; + st.wDayOfWeek = st.wMinute = st.wSecond = st.wMilliseconds = 0; len = ::GetDateFormat(LOCALE_USER_DEFAULT, DATE_SHORTDATE, @@ -316,7 +316,7 @@ wxString TimerRecordDialog::GetDisplayDate( wxDateTime & dt ) // Use default formatting wxPrintf(wxT("%s\n"), dt.Format().c_str()); - return dt.FormatDate() + wxT(" ") + dt.FormatTime(); + return dt.FormatDate() + wxT(" ") + dt.FormatTime(); } void TimerRecordDialog::PopulateOrExchange(ShuttleGui& S) @@ -333,10 +333,10 @@ void TimerRecordDialog::PopulateOrExchange(ShuttleGui& S) wxString strFormat = _("099 h 060 m 060 s"); S.StartStatic(_("Start Date and Time"), true); { - m_pDatePickerCtrl_Start = - new wxDatePickerCtrl(this, // wxWindow *parent, - ID_DATEPICKER_START, // wxWindowID id, - m_DateTime_Start); // const wxDateTime& dt = wxDefaultDateTime, + m_pDatePickerCtrl_Start = + new wxDatePickerCtrl(this, // wxWindow *parent, + ID_DATEPICKER_START, // wxWindowID id, + m_DateTime_Start); // const wxDateTime& dt = wxDefaultDateTime, // const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = wxDP_DEFAULT | wxDP_SHOWCENTURY, const wxValidator& validator = wxDefaultValidator, const wxString& name = "datectrl") m_pDatePickerCtrl_Start->SetName(_("Start Date")); m_pDatePickerCtrl_Start->SetRange(wxDateTime::Today(), wxInvalidDateTime); // No backdating. @@ -353,10 +353,10 @@ void TimerRecordDialog::PopulateOrExchange(ShuttleGui& S) S.StartStatic(_("End Date and Time"), true); { - m_pDatePickerCtrl_End = - new wxDatePickerCtrl(this, // wxWindow *parent, - ID_DATEPICKER_END, // wxWindowID id, - m_DateTime_End); // const wxDateTime& dt = wxDefaultDateTime, + m_pDatePickerCtrl_End = + new wxDatePickerCtrl(this, // wxWindow *parent, + ID_DATEPICKER_END, // wxWindowID id, + m_DateTime_End); // const wxDateTime& dt = wxDefaultDateTime, // const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = wxDP_DEFAULT | wxDP_SHOWCENTURY, const wxValidator& validator = wxDefaultValidator, const wxString& name = "datectrl") m_pDatePickerCtrl_End->SetRange(m_DateTime_Start, wxInvalidDateTime); // No backdating. m_pDatePickerCtrl_End->SetName(_("End Date")); @@ -392,7 +392,7 @@ void TimerRecordDialog::PopulateOrExchange(ShuttleGui& S) S.EndStatic(); } S.EndVerticalLay(); - + S.AddStandardButtons(); Layout(); @@ -432,7 +432,7 @@ bool TimerRecordDialog::TransferDataFromWindow() } // Update m_TimeSpan_Duration and ctrl based on m_DateTime_Start and m_DateTime_End. -void TimerRecordDialog::UpdateDuration() +void TimerRecordDialog::UpdateDuration() { m_TimeSpan_Duration = m_DateTime_End - m_DateTime_Start; m_pTimeTextCtrl_Duration->SetTimeValue(m_TimeSpan_Duration.GetSeconds().ToDouble()); @@ -454,19 +454,19 @@ int TimerRecordDialog::WaitForStart() wxString strMsg; /* i18n-hint: A time specification like "Sunday 28th October 2007 15:16:17 GMT" * but hopefully translated by wxwidgets will be inserted into this */ - strMsg.Printf(_("Waiting to start recording at %s.\n"), - GetDisplayDate(m_DateTime_Start).c_str()); + strMsg.Printf(_("Waiting to start recording at %s.\n"), + GetDisplayDate(m_DateTime_Start).c_str()); wxDateTime startWait_DateTime = wxDateTime::UNow(); wxTimeSpan waitDuration = m_DateTime_Start - startWait_DateTime; - TimerProgressDialog - progress(waitDuration.GetMilliseconds().GetValue(), + TimerProgressDialog + progress(waitDuration.GetMilliseconds().GetValue(), _("Audacity Timer Record - Waiting for Start"), - strMsg, + strMsg, pdlgHideStopButton); int updateResult = eProgressSuccess; bool bIsRecording = false; - while (updateResult == eProgressSuccess && !bIsRecording) + while (updateResult == eProgressSuccess && !bIsRecording) { wxMilliSleep(10); updateResult = progress.Update(); diff --git a/src/TimerRecordDialog.h b/src/TimerRecordDialog.h index b10242142..9b0dc2a23 100644 --- a/src/TimerRecordDialog.h +++ b/src/TimerRecordDialog.h @@ -5,7 +5,7 @@ TimerRecordDialog.h Copyright 2006 by Vaughan Johnson - + This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or diff --git a/src/Track.cpp b/src/Track.cpp index 9a7d66758..461225b75 100644 --- a/src/Track.cpp +++ b/src/Track.cpp @@ -10,7 +10,7 @@ \class Track \brief Fundamental data object of Audacity, placed in the TrackPanel. -Classes derived form it include the WaveTrack, NoteTrack, LabelTrack +Classes derived form it include the WaveTrack, NoteTrack, LabelTrack and TimeTrack. *//*******************************************************************/ @@ -39,7 +39,7 @@ and TimeTrack. // #define DEBUG_TLI #endif -Track::Track(DirManager * projDirManager) +Track::Track(DirManager * projDirManager) : vrulerSize(36,0), mDirManager(projDirManager) { @@ -381,7 +381,7 @@ Track *TrackListIterator::Last(bool skiplinked) { cur = cur->prev; } - + if (cur) { return cur->t; } @@ -434,7 +434,7 @@ Track *TrackListIterator::RemoveCurrent(bool deletetrack) TrackListNode *next = cur->next; l->Remove(cur->t, deletetrack); - + cur = next; #ifdef DEBUG_TLI // if we are debugging this bit @@ -939,7 +939,7 @@ Track *TrackList::GetNext(Track * t, bool linked) const if (node) { node = node->next; } - + if (node) { return node->t; } @@ -1044,7 +1044,7 @@ void TrackList::Swap(TrackListNode * s1, TrackListNode * s2) if (source[0]->GetLinked()) { target[1] = target[0]->next; source[1] = target[1]->t; - } + } else { target[1] = NULL; source[1] = NULL; @@ -1306,7 +1306,7 @@ double TrackList::GetMinOffset() const len = l; } } - + return len; } @@ -1325,7 +1325,7 @@ double TrackList::GetStartTime() const min = l; } } - + return min; } diff --git a/src/Track.h b/src/Track.h index bad1419e0..e32beded6 100644 --- a/src/Track.h +++ b/src/Track.h @@ -71,7 +71,7 @@ class AUDACITY_DLL_API Track: public XMLTagHandler public: wxSize vrulerSize; - + // This just returns a constant and can be overriden by subclasses // to specify a different height for the case that the track is minimized. virtual int GetMinimizedHeight() const; @@ -141,7 +141,7 @@ class AUDACITY_DLL_API Track: public XMLTagHandler Track(const Track &orig); virtual ~ Track(); - + void Init(const Track &orig); virtual Track *Duplicate() = 0; @@ -231,7 +231,7 @@ class AUDACITY_DLL_API TrackListIterator Track *ReplaceCurrent(Track *t); // returns original Track *RemoveCurrent(bool deletetrack = false); // returns next - + protected: TrackList *l; TrackListNode *cur; @@ -310,7 +310,7 @@ class AUDACITY_DLL_API VisibleTrackIterator: public TrackListCondIterator }; -// SyncLockedTracksIterator returns only tracks belonging to the sync-locked tracks +// SyncLockedTracksIterator returns only tracks belonging to the sync-locked tracks // in which the starting track is a member. class AUDACITY_DLL_API SyncLockedTracksIterator : public TrackListIterator { @@ -356,14 +356,14 @@ class AUDACITY_DLL_API TrackList:public wxEvtHandler friend class Track; friend class TrackListIterator; - /// Add this Track or all children of this TrackList. + /// Add this Track or all children of this TrackList. void Add(Track * t); void AddToHead(Track * t); /// Replace first track with second track void Replace(Track * t, Track * with, bool deletetrack = false); - /// Remove this Track or all children of this TrackList. + /// Remove this Track or all children of this TrackList. void Remove(Track * t, bool deletetrack = false); /// Make the list empty @@ -377,7 +377,7 @@ class AUDACITY_DLL_API TrackList:public wxEvtHandler Track *GetLink(Track * t) const; Track *GetPrev(Track * t, bool linked = false) const; - + /** Return a track in the list that comes after Track t * @param t a track in the list * @param linked if true, skips over linked tracks, if false returns the next track even if it is a linked track @@ -396,7 +396,7 @@ class AUDACITY_DLL_API TrackList:public wxEvtHandler /** \brief Find out how many channels this track list mixes to * - * This is used in exports of the tracks to work out whether to export in + * This is used in exports of the tracks to work out whether to export in * Mono, Stereo etc. @param selectionOnly Whether to consider the entire track * list or only the selected members of it */ @@ -422,7 +422,7 @@ class AUDACITY_DLL_API TrackList:public wxEvtHandler double GetMinOffset() const; int GetHeight() const; -#if LEGACY_PROJECT_FILE_SUPPORT +#if LEGACY_PROJECT_FILE_SUPPORT // File I/O virtual bool Load(wxTextFile * in, DirManager * dirManager); virtual bool Save(wxTextFile * out, bool overwrite); diff --git a/src/TrackArtist.cpp b/src/TrackArtist.cpp index e314ec141..beffd0cee 100644 --- a/src/TrackArtist.cpp +++ b/src/TrackArtist.cpp @@ -26,7 +26,7 @@ is my attempt to understand the complicated graphics strategy. One basic idea is that redrawing waveforms is rather slow, so Audacity saves waveform images in bitmaps to make redrawing faster. In particular, -during audio playback (and recording), the vertical time indicator is +during audio playback (and recording), the vertical time indicator is drawn over the waveform about 20 times per second. To avoid unnecessary computation, the indicator is erased by copying a column of pixels from a bitmap image of the waveform. Notice that this implies a two-stage @@ -35,7 +35,7 @@ process: first, waveforms are drawn to the bitmp; then, the bitmap graphics. The bitmap is for the entire track panel, i.e. multiple tracks, and -includes things like the Gain and Pan slders to the left of the +includes things like the Gain and Pan slders to the left of the waveform images. The screen update uses a mixture of direct drawing and indirect paint @@ -50,11 +50,11 @@ invalidate the bitmap, forcing a bitmap redraw *and* a screen redraw. Other changes merely update the screen using pre-existing bitmaps. In Audacity, the "2-level" invalidation works like this: Anything that invalidates the bitmap calls TrackPanel::Refresh(), which -has an eraseBackground parameter. This flag says to redraw the +has an eraseBackground parameter. This flag says to redraw the bitmap when OnPaint() is called. If eraseBackground is false, the existing bitmap can be used for waveform images. Audacity also draws directly to the screen to update the time indicator during -playback. To move the indicator, one column of pixels is drawn to +playback. To move the indicator, one column of pixels is drawn to the screen to remove the indicator. Then the indicator is drawn at a new time location. @@ -104,7 +104,7 @@ TrackPanel::DoDrawCursor(); TrackPanel::DisplaySelection(); \endcode -To move the indicator, TrackPanel::OnTimer() calls the following, using +To move the indicator, TrackPanel::OnTimer() calls the following, using a drawing context (DC) for the screen. (Refresh is not called to create an OnPaint event. Instead, drawing is direct to the screen.) \code @@ -112,8 +112,8 @@ TrackPanel::DrawIndicator(); TrackPanel::DoDrawIndicator(); \endcode -Notice that TrackPanel::DrawZooming(), TrackPanel::HighlightFocusedTrack(), -and snap guidelines could be drawn directly to the screen rather than to +Notice that TrackPanel::DrawZooming(), TrackPanel::HighlightFocusedTrack(), +and snap guidelines could be drawn directly to the screen rather than to the bitmap, generally eliminating redraw work. One problem is slider udpates. Sliders are in the left area of the track @@ -125,7 +125,7 @@ would require either incrementally updating the bitmap (not currently done), or maintaining the sliders and other track info on the screen and not in the bitmap. -In my opinion, the bitmap should contain only the waveform, note, and +In my opinion, the bitmap should contain only the waveform, note, and label images along with gray selection highlights. The track info (sliders, buttons, title, etc.), track selection highlight, cursor, and indicator should be drawn in the normal way, and clipping regions should @@ -137,7 +137,7 @@ surprising finding is that NoteTrack display is slow compared to WaveTrack display. Each note takes some time to gather attributes and select colors, and while audio draws two amplitudes per horizontal pixels, large MIDI scores can have more notes than horizontal pixels. This can make slider -changes very sluggish, but this can also be a problem with many +changes very sluggish, but this can also be a problem with many audio tracks. *//*******************************************************************/ @@ -200,7 +200,7 @@ const int notePos[12] = { 1, 6, 11, 16, 21, 27, 32, 37, 42, 47, 52, 57 }; // map pitch number to window coordinate of the *top* of the note -// Note the "free" variable bottom, which is assumed to be a local +// Note the "free" variable bottom, which is assumed to be a local // variable set to the offset of pitch 0 relative to the window #define IPITCH_TO_Y(t, p) (bottom - ((p) / 12) * octaveHeight - \ notePos[(p) % 12] - (t)->GetPitchHeight()) @@ -578,7 +578,7 @@ void TrackArtist::DrawVRuler(Track *t, wxDC * dc, wxRect & r) dc->SetPen(*wxBLACK_PEN); for (int white = 0; white < 7; white++) { int pos = track->GetWhitePos(white); - if (obottom - pos > r.y + marg + 1 && + if (obottom - pos > r.y + marg + 1 && // don't draw too close to margin line -- it's annoying obottom - pos < r.y + r.height - marg - 3) AColor::Line(*dc, r.x, obottom - pos, @@ -624,7 +624,7 @@ void TrackArtist::DrawVRuler(Track *t, wxDC * dc, wxRect & r) // you would think the -1 offset here should be -2 to match the // adjustment to r.y (see above), but -1 produces correct output AColor::Line(*dc, r.x, r.y + marg - 1, r.x + r.width, r.y + marg - 1); - // since the margin gives us the bottom of the line, + // since the margin gives us the bottom of the line, // the extra -1 gets us to the top AColor::Line(*dc, r.x, r.y + r.height - marg - 1, r.x + r.width, r.y + r.height - marg - 1); @@ -675,7 +675,7 @@ void TrackArtist::UpdateVRuler(Track *t, wxRect & r) float sign = (min >= 0 ? 1 : -1); if (min != 0.) { min = pow(10., (fabs(min)*mdBrange - mdBrange)/20.0); - if (min < 0.0) + if (min < 0.0) min = 0.0; min *= sign; } @@ -683,7 +683,7 @@ void TrackArtist::UpdateVRuler(Track *t, wxRect & r) if (max != 0.) { max = pow(10., (fabs(max)*mdBrange - mdBrange)/20.0); - if (max < 0.0) + if (max < 0.0) max = 0.0; max *= sign; } @@ -713,7 +713,7 @@ void TrackArtist::UpdateVRuler(Track *t, wxRect & r) float sign = (min >= 0 ? 1 : -1); if (min != 0.) { min = (20.0 * log10(fabs(min)) + mdBrange) / mdBrange; - if (min < 0.0) + if (min < 0.0) min = 0.0; min *= sign; } @@ -721,13 +721,13 @@ void TrackArtist::UpdateVRuler(Track *t, wxRect & r) if (max != 0.) { max = (20.0 * log10(fabs(max)) + mdBrange) / mdBrange; - if (max < 0.0) + if (max < 0.0) max = 0.0; max *= sign; } wt->SetDisplayBounds(min, max); } - + if (max > 0) { int top = 0; float topval = 0; @@ -857,10 +857,10 @@ void TrackArtist::UpdateVRuler(Track *t, wxRect & r) vruler->GetMaxSize(&t->vrulerSize.x, &t->vrulerSize.y); } -/// Takes a value between min and max and returns a value between -/// height and 0 +/// Takes a value between min and max and returns a value between +/// height and 0 /// \todo Should this function move int GuiWaveTrack where it can -/// then use the zoomMin, zoomMax and height values without having +/// then use the zoomMin, zoomMax and height values without having /// to have them passed in to it?? int GetWaveYPos(float value, float min, float max, int height, bool dB, bool outer, @@ -1083,7 +1083,7 @@ void TrackArtist::DrawMinMaxRMS(wxDC &dc, const wxRect &r, const double env[], long pixAnimOffset = (long)fabs((double)(wxDateTime::Now().GetTicks() * -10)) + wxDateTime::Now().GetMillisecond() / 100; //10 pixels a second - + bool drawStripes = true; bool drawWaveform = true; @@ -1097,7 +1097,7 @@ void TrackArtist::DrawMinMaxRMS(wxDC &dc, const wxRect &r, const double env[], #else v = min[x] * env[x]; #endif - if (clipped && mShowClipping && (v <= -MAX_AUDIO)) + if (clipped && mShowClipping && (v <= -MAX_AUDIO)) { if (clipcnt == 0 || clipped[clipcnt - 1] != xx) { clipped[clipcnt++] = xx; @@ -1111,7 +1111,7 @@ void TrackArtist::DrawMinMaxRMS(wxDC &dc, const wxRect &r, const double env[], #else v = max[x] * env[x]; #endif - if (clipped && mShowClipping && (v >= MAX_AUDIO)) + if (clipped && mShowClipping && (v >= MAX_AUDIO)) { if (clipcnt == 0 || clipped[clipcnt - 1] != xx) { clipped[clipcnt++] = xx; @@ -1164,11 +1164,11 @@ void TrackArtist::DrawMinMaxRMS(wxDC &dc, const wxRect &r, const double env[], AColor::Line(dc, xx, r.y + 25 * y + (x /*+pixAnimOffset*/) % 25, - xx, + xx, r.y + 25 * y + (x /*+pixAnimOffset*/) % 25 + 6); //take the min so we don't draw past the edge } } - + // draw a dummy waveform - some kind of sinusoid. We want to animate it so the user knows it's a dummy. Use the second's unit of a get time function. // Lets use a triangle wave for now since it's easier - I don't want to use sin() or make a wavetable just for this. if (drawWaveform) { @@ -1223,8 +1223,8 @@ void TrackArtist::DrawIndividualSamples(wxDC &dc, const wxRect &r, double rate = clip->GetRate(); sampleCount s0 = (sampleCount) (t0 * rate + 0.5); sampleCount slen = (sampleCount) (r.width * rate / pps + 0.5); - sampleCount snSamples = clip->GetNumSamples(); - + sampleCount snSamples = clip->GetNumSamples(); + slen += 4; if (s0 > snSamples) { @@ -1249,26 +1249,26 @@ void TrackArtist::DrawIndividualSamples(wxDC &dc, const wxRect &r, } dc.SetPen(muted ? muteSamplePen : samplePen); - + for (s = 0; s < slen; s++) { double tt = (s / rate); // MB: (s0/rate - t0) is the distance from the left edge of the screen // to the first sample. int xx = (int)rint((tt + s0 / rate - t0) * pps); - + if (xx < -10000) { xx = -10000; } if (xx > 10000) { xx = 10000; } - + xpos[s] = xx; // t0 + clip->GetOffset() is 'h' (the absolute time of the left edge) for 'r'. tt = buffer[s] * clip->GetEnvelope()->GetValueAtX(xx + r.x, r, t0 + clip->GetOffset(), pps); - if (clipped && mShowClipping && ((tt <= -MAX_AUDIO) || (tt >= MAX_AUDIO))) + if (clipped && mShowClipping && ((tt <= -MAX_AUDIO) || (tt >= MAX_AUDIO))) clipped[clipcnt++] = xx; ypos[s] = GetWaveYPos(tt, zoomMin, zoomMax, r.height, dB, true, mdBrange, false); @@ -1312,7 +1312,7 @@ void TrackArtist::DrawIndividualSamples(wxDC &dc, const wxRect &r, AColor::Line(dc, r.x + s, r.y, r.x + s, r.y + r.height); } } - + if (mShowClipping) { delete [] clipped; } @@ -1399,7 +1399,7 @@ void TrackArtist::DrawWaveform(WaveTrack *track, // Update cache for locations, e.g. cutlines and merge points track->UpdateLocationsCache(); - + for (int i = 0; iGetNumCachedLocations(); i++) { WaveTrack::Location loc = track->GetCachedLocation(i); double x = (loc.pos - viewInfo->h) * viewInfo->zoom; @@ -1466,7 +1466,7 @@ void TrackArtist::DrawClipWaveform(WaveTrack *track, bool showPoints = (pps / rate > 3.0); //zoomed in even more // Calculate actual selection bounds so that t0 > 0 and t1 < the - // end of the track + // end of the track double t0 = (tpre >= 0.0 ? tpre : 0.0); double t1 = (tpost < trackLen - sps * .99 ? tpost : trackLen - sps * .99); @@ -1486,7 +1486,7 @@ void TrackArtist::DrawClipWaveform(WaveTrack *track, t0 = t1; } - // Calculate sample-based offset-corrected selection + // Calculate sample-based offset-corrected selection // Use the WaveTrack method to show what is selected and 'should' be copied, pasted etc. sampleCount ssel0 = wxMax(0, track->TimeToLongSamples(sel0 - tOffset)); @@ -1621,7 +1621,7 @@ void TrackArtist::DrawClipWaveform(WaveTrack *track, delete[] rms; delete[] where; delete[] bl; - + // Draw arrows on the left side if the track extends to the left of the // beginning of time. :) if (h == 0.0 && tOffset < 0.0) { @@ -1924,7 +1924,7 @@ void TrackArtist::DrawClipSpectrum(WaveTrack *track, bool usePxCache = false; - if( !updated && clip->mSpecPxCache->valid && (clip->mSpecPxCache->len == mid.height * mid.width) + if( !updated && clip->mSpecPxCache->valid && (clip->mSpecPxCache->len == mid.height * mid.width) #ifdef EXPERIMENTAL_FFT_Y_GRID && mFftYGrid==fftYGridOld #endif //EXPERIMENTAL_FFT_Y_GRID @@ -1956,10 +1956,10 @@ void TrackArtist::DrawClipSpectrum(WaveTrack *track, int x = 0; sampleCount w1 = (sampleCount) ((t0*rate + x *rate *tstep) + .5); - - const float -// e=exp(1.0f), - f=rate/2.0f/half, + + const float +// e=exp(1.0f), + f=rate/2.0f/half, lmin=logf(float(minFreq)), lmax=logf(float(maxFreq)), #ifdef EXPERIMENTAL_FIND_NOTES @@ -1972,7 +1972,7 @@ void TrackArtist::DrawClipSpectrum(WaveTrack *track, lmaxs=lmax, #endif //EXPERIMENTAL_FFT_SKIP_POINTS #endif //EXPERIMENTAL_FIND_NOTES - scale=lmax-lmin /*, + scale=lmax-lmin /*, expo=exp(scale)*/ ; #ifdef EXPERIMENTAL_FFT_Y_GRID @@ -1983,8 +1983,8 @@ void TrackArtist::DrawClipSpectrum(WaveTrack *track, bool *yGrid; yGrid=new bool[mid.height]; for (int y = 0; y < mid.height; y++) { - float n =(float(y )/mid.height*scale2-lmin2)*12; - float n2=(float(y+1)/mid.height*scale2-lmin2)*12; + float n =(float(y )/mid.height*scale2-lmin2)*12; + float n2=(float(y+1)/mid.height*scale2-lmin2)*12; float f =float(minFreq)/(mFftSkipPoints+1)*powf(2.0f, n /12.0f+lmin2); float f2=float(minFreq)/(mFftSkipPoints+1)*powf(2.0f, n2/12.0f+lmin2); n =logf(f /440)/log2*12; @@ -1999,7 +1999,7 @@ void TrackArtist::DrawClipSpectrum(WaveTrack *track, #ifdef EXPERIMENTAL_FIND_NOTES int maxima[128]; float maxima0[128], maxima1[128]; - const float + const float #ifdef EXPERIMENTAL_FFT_SKIP_POINTS f2bin = half/(rate/2.0f/(mFftSkipPoints+1)), #else //!EXPERIMENTAL_FFT_SKIP_POINTS @@ -2014,7 +2014,7 @@ void TrackArtist::DrawClipSpectrum(WaveTrack *track, int *indexes=new int[maxTableSize]; #endif //EXPERIMENTAL_FIND_NOTES - while (x < mid.width) + while (x < mid.width) { sampleCount w0 = w1; w1 = (sampleCount) ((t0*rate + (x+1) *rate *tstep) + .5); @@ -2086,7 +2086,7 @@ void TrackArtist::DrawClipSpectrum(WaveTrack *track, if (!usePxCache && mFftFindNotes) { for (int i = maxTableSize-1; i >= 0; i--) indexes[i]=-1; - + // Build a table of (most) values, put the index in it. for (int i = int(i0); i < int(i1); i++) { float freqi=freq[x0+int(i)]; @@ -2102,7 +2102,7 @@ void TrackArtist::DrawClipSpectrum(WaveTrack *track, int index=indexes[i]; if (index >= 0) { float freqi=freq[x0+index]; - if (freqi < mFindNotesMinA) + if (freqi < mFindNotesMinA) break; bool ok=true; @@ -2435,7 +2435,7 @@ int PitchToY(double p, int bottom) { int octave = (((int) (p + 0.5)) / 12); int n = ((int) (p + 0.5)) % 12; - + return IPITCH_TO_Y((int) (p + 0.5)); // was: bottom - octave * octaveHeight - notePos[n] - 4; } @@ -2449,8 +2449,8 @@ int PitchToY(double p, int bottom) sel is equal to r, and the entire region is drawn with unselected background colors. */ -void TrackArtist::DrawNoteBackground(NoteTrack *track, wxDC &dc, - const wxRect &r, const wxRect &sel, +void TrackArtist::DrawNoteBackground(NoteTrack *track, wxDC &dc, + const wxRect &r, const wxRect &sel, const ViewInfo *viewInfo, const wxBrush &wb, const wxPen &wp, const wxBrush &bb, const wxPen &bp, @@ -2488,7 +2488,7 @@ void TrackArtist::DrawNoteBackground(NoteTrack *track, wxDC &dc, dc.SetPen(bp); // draw a black-key stripe colored line separating E and F if visible if (obottom - eOffset > r.y && obottom - eOffset < r.y + r.height) { - AColor::Line(dc, left, obottom - eOffset, + AColor::Line(dc, left, obottom - eOffset, right, obottom - eOffset); } @@ -2583,8 +2583,8 @@ void TrackArtist::DrawNoteTrack(NoteTrack *track, int numPitches = (r.height) / track->GetPitchHeight(); if (numPitches < 0) numPitches = 0; // cannot be negative - // bottom is the hypothetical location of the bottom of pitch 0 relative to - // the top of the clipping region r: r.height - PITCH_HEIGHT/2 is where the + // bottom is the hypothetical location of the bottom of pitch 0 relative to + // the top of the clipping region r: r.height - PITCH_HEIGHT/2 is where the // bottomNote is displayed, and to that // we add the height of bottomNote from the position of pitch 0 track->PrepareIPitchToY(r); @@ -2603,7 +2603,7 @@ void TrackArtist::DrawNoteTrack(NoteTrack *track, wxPen barLinePen; barLinePen.SetColour(170, 170, 170); - DrawNoteBackground(track, dc, r, r, viewInfo, blankBrush, blankPen, + DrawNoteBackground(track, dc, r, r, viewInfo, blankBrush, blankPen, blackStripeBrush, blackStripePen, barLinePen); dc.SetClippingRegion(r); @@ -2620,7 +2620,7 @@ void TrackArtist::DrawNoteTrack(NoteTrack *track, wxPen selectedWhiteKeyPen; selectedWhiteKeyPen.SetColour(165, 165, 190); dc.SetPen(selectedWhiteKeyPen); - + wxBrush selectedWhiteKeyBrush; selectedWhiteKeyBrush.SetColour(165, 165, 190); // Then, the black keys and octave stripes, as smaller rectangles @@ -2704,7 +2704,7 @@ void TrackArtist::DrawNoteTrack(NoteTrack *track, dc.SetBrush(*wxBLACK_BRUSH); dc.SetPen(*wxBLACK_PEN); dc.DrawRectangle(nr); - } else if (nr.y >= r.y + r.height - marg - 1) { + } else if (nr.y >= r.y + r.height - marg - 1) { // too low for window nr.y = r.y + r.height - marg; nr.height = marg; @@ -2740,8 +2740,8 @@ void TrackArtist::DrawNoteTrack(NoteTrack *track, } } else if (shape) { // draw a shape according to attributes - // add 0.5 to pitch because pitches are plotted with - // height = PITCH_HEIGHT; thus, the center is raised + // add 0.5 to pitch because pitches are plotted with + // height = PITCH_HEIGHT; thus, the center is raised // by PITCH_HEIGHT * 0.5 int y = track->PitchToY(note->pitch); long linecolor = LookupIntAttribute(note, linecolori, -1); @@ -2753,7 +2753,7 @@ void TrackArtist::DrawNoteTrack(NoteTrack *track, AColor::MIDIChannel(&dc, note->chan+1); if (shape != text) { if (linecolor != -1) - dc.SetPen(wxPen(wxColour(RED(linecolor), + dc.SetPen(wxPen(wxColour(RED(linecolor), GREEN(linecolor), BLUE(linecolor)), linethick, wxSOLID)); @@ -2762,7 +2762,7 @@ void TrackArtist::DrawNoteTrack(NoteTrack *track, fillcolor = LookupIntAttribute(note, fillcolori, -1); fillflag = LookupLogicalAttribute(note, filll, false); - if (fillcolor != -1) + if (fillcolor != -1) dc.SetBrush(wxBrush(wxColour(RED(fillcolor), GREEN(fillcolor), BLUE(fillcolor)), @@ -2838,7 +2838,7 @@ void TrackArtist::DrawNoteTrack(NoteTrack *track, dc.DrawEllipse(ix, y, ix1, y1 - y + 1); } else if (shape == text) { if (linecolor != -1) - dc.SetTextForeground(wxColour(RED(linecolor), + dc.SetTextForeground(wxColour(RED(linecolor), GREEN(linecolor), BLUE(linecolor))); // if no color specified, copy color from brush @@ -2846,7 +2846,7 @@ void TrackArtist::DrawNoteTrack(NoteTrack *track, // This seems to have no effect, so I commented it out. -RBD //if (fillcolor != -1) - // dc.SetTextBackground(wxColour(RED(fillcolor), + // dc.SetTextBackground(wxColour(RED(fillcolor), // GREEN(fillcolor), // BLUE(fillcolor))); //// if no color specified, copy color from brush @@ -2857,7 +2857,7 @@ void TrackArtist::DrawNoteTrack(NoteTrack *track, int size = LookupIntAttribute(note, sizei, 8); const char *justify = LookupStringAttribute(note, justifys, "ld"); wxFont wxfont; - wxfont.SetFamily(font == roman ? wxROMAN : + wxfont.SetFamily(font == roman ? wxROMAN : (font == swiss ? wxSWISS : (font == modern ? wxMODERN : wxDEFAULT))); wxfont.SetStyle(wxNORMAL); @@ -2888,7 +2888,7 @@ void TrackArtist::DrawNoteTrack(NoteTrack *track, // It should be possible to do this with background color, // but maybe because of the transfer mode, no background is // drawn. To fix this, just draw a rectangle: - dc.SetPen(wxPen(wxColour(RED(fillcolor), + dc.SetPen(wxPen(wxColour(RED(fillcolor), GREEN(fillcolor), BLUE(fillcolor)), 1, wxSOLID)); @@ -2906,7 +2906,7 @@ void TrackArtist::DrawNoteTrack(NoteTrack *track, // draw black line between top/bottom margins and the track dc.SetPen(*wxBLACK_PEN); AColor::Line(dc, r.x, r.y + marg, r.x + r.width, r.y + marg); - AColor::Line(dc, r.x, r.y + r.height - marg - 1, // subtract 1 to get + AColor::Line(dc, r.x, r.y + r.height - marg - 1, // subtract 1 to get r.x + r.width, r.y + r.height - marg - 1); // top of line if (h == 0.0 && track->GetOffset() < 0.0) { @@ -2926,10 +2926,10 @@ void TrackArtist::DrawLabelTrack(LabelTrack *track, { double sel0 = viewInfo->sel0; double sel1 = viewInfo->sel1; - + if (!track->GetSelected() && !track->IsSyncLockSelected()) sel0 = sel1 = 0.0; - + track->Draw(dc, r, viewInfo->h, viewInfo->zoom, sel0, sel1); } @@ -2948,7 +2948,7 @@ void TrackArtist::DrawTimeTrack(TimeTrack *track, lower = 20.0 * log10(std::max(1.0e-7, lower)) / dBRange + 1.0; upper = 20.0 * log10(std::max(1.0e-7, upper)) / dBRange + 1.0; } - track->GetEnvelope()->DrawPoints(dc, envRect, viewInfo->h, viewInfo->zoom, + track->GetEnvelope()->DrawPoints(dc, envRect, viewInfo->h, viewInfo->zoom, track->GetDisplayLog(), lower, upper); } @@ -3064,7 +3064,7 @@ void TrackArtist::DrawSyncLockTiles(wxDC *dc, wxRect r) // Horizontal position within the grid, modulo its period int blockX = (r.x / gridW) % 5; - + // Amount to offset drawing of first column int xOffset = r.x % gridW; if (xOffset < 0) xOffset += gridW; @@ -3079,7 +3079,7 @@ void TrackArtist::DrawSyncLockTiles(wxDC *dc, wxRect r) } // Make sure blockX is non-negative if (blockX < 0) blockX += 5; - + int x = 0; while (x < r.width) { int width = syncLockBitmap.GetWidth() - xOffset; @@ -3096,7 +3096,7 @@ void TrackArtist::DrawSyncLockTiles(wxDC *dc, wxRect r) // Amount to offset drawing of first row int yOffset = r.y % gridH; if (yOffset < 0) yOffset += gridH; - + // Check if we're missing an extra row on top (this can happen because // the tiles are bigger than the grid spacing) bool extraRow = false; @@ -3123,7 +3123,7 @@ void TrackArtist::DrawSyncLockTiles(wxDC *dc, wxRect r) // Do we need to get a sub-bitmap? if (width != syncLockBitmap.GetWidth() || height != syncLockBitmap.GetHeight()) { - wxBitmap subSyncLockBitmap = + wxBitmap subSyncLockBitmap = syncLockBitmap.GetSubBitmap(wxRect(xOffset, yOffset, width, height)); dc->DrawBitmap(subSyncLockBitmap, r.x + x, r.y + y, true); } diff --git a/src/TrackArtist.h b/src/TrackArtist.h index da2bd9bcb..75800d706 100644 --- a/src/TrackArtist.h +++ b/src/TrackArtist.h @@ -50,11 +50,11 @@ class AUDACITY_DLL_API TrackArtist { void SetColours(); void DrawTracks(TrackList *tracks, Track *start, wxDC & dc, wxRegion & reg, - wxRect & r, wxRect & clip, ViewInfo *viewInfo, + wxRect & r, wxRect & clip, ViewInfo *viewInfo, bool drawEnvelope, bool drawSamples, bool drawSliders); void DrawTrack(const Track *t, - wxDC & dc, const wxRect & r, const ViewInfo *viewInfo, + wxDC & dc, const wxRect & r, const ViewInfo *viewInfo, bool drawEnvelope, bool drawSamples, bool drawSliders, bool hasSolo); @@ -103,10 +103,10 @@ class AUDACITY_DLL_API TrackArtist { // // Lower-level drawing functions - // + // void DrawWaveform(WaveTrack *track, - wxDC & dc, const wxRect & r, const ViewInfo *viewInfo, + wxDC & dc, const wxRect & r, const ViewInfo *viewInfo, bool drawEnvelope, bool drawSamples, bool drawSliders, bool dB, bool muted); @@ -115,7 +115,7 @@ class AUDACITY_DLL_API TrackArtist { bool autocorrelation, bool logF); #ifdef USE_MIDI int GetBottom(NoteTrack *t, const wxRect &r); - void DrawNoteBackground(NoteTrack *track, wxDC &dc, + void DrawNoteBackground(NoteTrack *track, wxDC &dc, const wxRect &r, const wxRect &sel, const ViewInfo *viewInfo, const wxBrush &wb, const wxPen &wp, @@ -200,7 +200,7 @@ class AUDACITY_DLL_API TrackArtist { int mNumberOfMaxima; // "/Spectrum/FindNotesN" bool mFindNotesQuantize; // "/Spectrum/FindNotesQuantize") #endif //EXPERIMENTAL_FIND_NOTES - + int mInsetLeft; int mInsetTop; int mInsetRight; diff --git a/src/TrackPanel.cpp b/src/TrackPanel.cpp index 3ef16c50c..513ab24f9 100644 --- a/src/TrackPanel.cpp +++ b/src/TrackPanel.cpp @@ -9,19 +9,19 @@ Implements TrackPanel and TrackInfo. -********************************************************************//*! +********************************************************************//*! \todo - Refactoring of the TrackPanel, possibly as described + Refactoring of the TrackPanel, possibly as described in \ref TrackPanelRefactor *//*****************************************************************//*! \file TrackPanel.cpp -\brief +\brief Implements TrackPanel and TrackInfo. - TrackPanel.cpp is currently some of the worst code in Audacity. + TrackPanel.cpp is currently some of the worst code in Audacity. It's not really unreadable, there's just way too much stuff in this one file. Rather than apply a quick fix, the long-term plan is to create a GUITrack class that knows how to draw itself @@ -32,9 +32,9 @@ *//********************************************************************/ -// Documentation: Rather than have a lengthy \todo section, having -// a \todo a \file and a \page in EXACTLY that order gets Doxygen to -// put the following lengthy description of refactoring on a new page +// Documentation: Rather than have a lengthy \todo section, having +// a \todo a \file and a \page in EXACTLY that order gets Doxygen to +// put the following lengthy description of refactoring on a new page // and link to it from the docs. /*****************************************************************//** @@ -48,8 +48,8 @@ TrackInfo class to draw the controls area on the left of a track, and the TrackArtist class to draw the actual waveforms. - Note that in some of the older code here, e.g., GetLabelWidth(), - "Label" means the TrackInfo plus the vertical ruler. + Note that in some of the older code here, e.g., GetLabelWidth(), + "Label" means the TrackInfo plus the vertical ruler. Confusing relative to LabelTrack labels. The TrackPanel manages multiple tracks and their TrackInfos. @@ -61,16 +61,16 @@ \class TrackInfo \brief - The TrackInfo is shown to the side of a track + The TrackInfo is shown to the side of a track It has the menus, pan and gain controls displayed in it. So "Info" is somewhat a misnomer. Should possibly be "TrackControls". - TrackPanel and not TrackInfo takes care of the functionality for + TrackPanel and not TrackInfo takes care of the functionality for each of the buttons in that panel. In its current implementation TrackInfo is not derived from a - wxWindow. Following the original coding style, it has - been coded as a 'flyweight' class, which is passed + wxWindow. Following the original coding style, it has + been coded as a 'flyweight' class, which is passed state as needed, except for the array of gains and pans. If we'd instead coded it as a wxWindow, we would have an instance @@ -105,7 +105,7 @@ subset of the TrackPanel methods from all over the place. *//**************************************************************//** \class TrackPanel::AudacityTimer -\brief Timer class dedicated to infomring the TrackPanel that it +\brief Timer class dedicated to infomring the TrackPanel that it is time to refresh some aspect of the screen. *//*****************************************************************//** @@ -144,14 +144,14 @@ is time to refresh some aspect of the screen. +-------- GuiStereoTrack ----------------------------+
- With the whole lot sitting in a TrackPanel which forwards + With the whole lot sitting in a TrackPanel which forwards events to the sub objects. The GuiStereoTrack class will do the special logic for - Stereo channel grouping. + Stereo channel grouping. The precise names of the classes are subject to revision. - Have deliberately not created new files for the new classes + Have deliberately not created new files for the new classes such as AdornedRulerPanel and TrackInfo - yet. *//*****************************************************************/ @@ -496,9 +496,9 @@ TrackPanel::TrackPanel(wxWindow * parent, wxWindowID id, mStretched = false; mStretchStart = 0; mStretchCursor = MakeCursor( wxCURSOR_BULLSEYE, StretchCursorXpm, 16, 16); - mStretchLeftCursor = MakeCursor( wxCURSOR_BULLSEYE, + mStretchLeftCursor = MakeCursor( wxCURSOR_BULLSEYE, StretchLeftCursorXpm, 16, 16); - mStretchRightCursor = MakeCursor( wxCURSOR_BULLSEYE, + mStretchRightCursor = MakeCursor( wxCURSOR_BULLSEYE, StretchRightCursorXpm, 16, 16); #endif @@ -651,7 +651,7 @@ void TrackPanel::BuildMenus(void) mWaveTrackMenu->Append(OnWaveformDBID, _("&Waveform (dB)")); mWaveTrackMenu->Append(OnSpectrumID, _("&Spectrogram")); /* i18n-hint: short form of 'logarithm'*/ - mWaveTrackMenu->Append(OnSpectrumLogID, _("Spectrogram l&og(f)")); + mWaveTrackMenu->Append(OnSpectrumLogID, _("Spectrogram l&og(f)")); mWaveTrackMenu->Append(OnPitchID, _("Pitc&h (EAC)")); mWaveTrackMenu->AppendSeparator(); mWaveTrackMenu->AppendCheckItem(OnChannelMonoID, _("&Mono")); @@ -802,7 +802,7 @@ void TrackPanel::SetStop(bool bStopped) } /// Remembers the track we clicked on and why we captured it. -/// We also use this method to clear the record +/// We also use this method to clear the record /// of the captured track, passing NULL as the track. void TrackPanel::SetCapturedTrack( Track * t, enum MouseCaptureEnum MouseCapture ) { @@ -854,7 +854,7 @@ void TrackPanel::SelectTracksByLabel( LabelTrack *lt ) } // Set selection length to the length of a track -- but if sync-lock is turned -// on, use the largest possible selection in the sync-lock group. +// on, use the largest possible selection in the sync-lock group. // If it's a stereo track, do the same for the stereo channels. void TrackPanel::SelectTrackLength(Track *t) { @@ -864,7 +864,7 @@ void TrackPanel::SelectTrackLength(Track *t) double minOffset = t->GetOffset(); double maxEnd = t->GetEndTime(); - // If we have a sync-lock group and sync-lock linking is on, + // If we have a sync-lock group and sync-lock linking is on, // check the sync-lock group tracks. if (p->IsSyncLocked() && t1 != NULL) { @@ -939,9 +939,9 @@ void TrackPanel::OnTimer() if ((p->GetAudioIOToken() > 0) && gAudioIO->IsStreamActive(p->GetAudioIOToken())) { - // Update lyrics display. + // Update lyrics display. LyricsWindow* pLyricsWindow = p->GetLyricsWindow(); - if (pLyricsWindow) + if (pLyricsWindow) { Lyrics* pLyricsPanel = pLyricsWindow->GetLyricsPanel(); pLyricsPanel->Update(gAudioIO->GetStreamTime()); @@ -949,38 +949,38 @@ void TrackPanel::OnTimer() } //v Vaughan, 2011-02-25: Moved this update back here from audacityAudioCallback. - // See note there. - // Vaughan, 2010-01-30: - // Since all we're doing here is updating the meters, I moved it to + // See note there. + // Vaughan, 2010-01-30: + // Since all we're doing here is updating the meters, I moved it to // audacityAudioCallback where it calls gAudioIO->mOutputMeter->UpdateDisplay(). MixerBoard* pMixerBoard = this->GetMixerBoard(); - if (pMixerBoard && + if (pMixerBoard && (p->GetAudioIOToken() > 0) && gAudioIO->IsStreamActive(p->GetAudioIOToken())) { - pMixerBoard->UpdateMeters(gAudioIO->GetStreamTime(), + pMixerBoard->UpdateMeters(gAudioIO->GetStreamTime(), (p->mLastPlayMode == loopedPlay)); } // Check whether we were playing or recording, but the stream has stopped. if (p->GetAudioIOToken()>0 && - !gAudioIO->IsStreamActive(p->GetAudioIOToken())) - { + !gAudioIO->IsStreamActive(p->GetAudioIOToken())) + { //the stream may have been started up after this one finished (by some other project) //in that case reset the buttons don't stop the stream p->GetControlToolBar()->StopPlaying(!gAudioIO->IsStreamActive()); - // Reset lyrics display. + // Reset lyrics display. LyricsWindow* pLyricsWindow = p->GetLyricsWindow(); - if (pLyricsWindow) + if (pLyricsWindow) { Lyrics* pLyricsPanel = pLyricsWindow->GetLyricsPanel(); pLyricsPanel->Update(p->GetSel0()); } - // Vaughan, 2011-01-28: No longer doing this on timer. + // Vaughan, 2011-01-28: No longer doing this on timer. // Now it's in AudioIO::SetMeters() and AudioIO::StopStream(), as with Meter Toolbar meters. - //if (pMixerBoard) + //if (pMixerBoard) // pMixerBoard->ResetMeters(false); } @@ -990,7 +990,7 @@ void TrackPanel::OnTimer() // and flush the tracks once we've completely finished // recording new state. if (p->GetAudioIOToken()>0 && - !gAudioIO->IsAudioTokenActive(p->GetAudioIOToken())) + !gAudioIO->IsAudioTokenActive(p->GetAudioIOToken())) { if (gAudioIO->GetNumCaptureChannels() > 0) { // Tracks are buffered during recording. This flushes @@ -1159,7 +1159,7 @@ void TrackPanel::DoDrawIndicator(wxDC & dc, bool repairOld /* = false */) // msmeyer: But only if not playing looped or in one-second mode if( mViewInfo->bUpdateTrackIndicator && p->mLastPlayMode != loopedPlay && - p->mLastPlayMode != oneSecondPlay && + p->mLastPlayMode != oneSecondPlay && audioActive && pos >= 0 && !onScreen && @@ -1325,7 +1325,7 @@ void TrackPanel::OnSize(wxSizeEvent & /* event */) Refresh( false ); } -/// OnErase( ) is called during the normal course of +/// OnErase( ) is called during the normal course of /// completing an erase operation. void TrackPanel::OnErase(wxEraseEvent & /* event */) { @@ -1336,7 +1336,7 @@ void TrackPanel::OnErase(wxEraseEvent & /* event */) // we could blit the backing bitmap here. } -/// AS: OnPaint( ) is called during the normal course of +/// AS: OnPaint( ) is called during the normal course of /// completing a repaint operation. void TrackPanel::OnPaint(wxPaintEvent & /* event */) { @@ -1371,7 +1371,7 @@ void TrackPanel::OnPaint(wxPaintEvent & /* event */) { // Copy full, possibly clipped, damage rectange dc->Blit( box.x, box.y, box.width, box.height, &mBackingDC, box.x, box.y ); - } + } // Done with the clipped DC delete dc; @@ -1475,7 +1475,7 @@ bool TrackPanel::IsUnsafe() } -/// Uses a previously noted 'activity' to determine what +/// Uses a previously noted 'activity' to determine what /// cursor to use. /// @var mMouseCapture holds the current activity. bool TrackPanel::SetCursorByActivity( ) @@ -1519,7 +1519,7 @@ void TrackPanel::SetCursorAndTipWhenInLabel( Track * t, if (event.m_x >= GetVRulerOffset() && (t->GetKind() == Track::Wave) && (((WaveTrack *) t)->GetDisplay() <= WaveTrack::SpectrumDisplay || - ((WaveTrack *) t)->GetDisplay() <= WaveTrack::SpectrumLogDisplay)) + ((WaveTrack *) t)->GetDisplay() <= WaveTrack::SpectrumLogDisplay)) { *ppTip = _("Click to vertically zoom in. Shift-click to zoom out. Drag to specify a zoom region."); SetCursor(event.ShiftDown()? *mZoomOutCursor : *mZoomInCursor); @@ -1538,19 +1538,19 @@ void TrackPanel::SetCursorAndTipWhenInLabel( Track * t, } /// When in the resize area we can adjust size or relative size. -void TrackPanel::SetCursorAndTipWhenInVResizeArea( Track * label, +void TrackPanel::SetCursorAndTipWhenInVResizeArea( Track * label, bool bLinked, const wxChar ** ppTip ) { // Check to see whether it is the first channel of a stereo track if (bLinked) { - // If we are in the label we got here 'by mistake' and we're - // not actually in the resize area at all. (The resize area + // If we are in the label we got here 'by mistake' and we're + // not actually in the resize area at all. (The resize area // is shorter when it is between stereo tracks). // IF we are in the label THEN return. - // Subsequently called methods can detect that a tip and + // Subsequently called methods can detect that a tip and // cursor are still needed. - if (label) + if (label) return; *ppTip = _("Click and drag to adjust relative size of stereo tracks."); SetCursor(*mResizeCursor); @@ -1560,9 +1560,9 @@ void TrackPanel::SetCursorAndTipWhenInVResizeArea( Track * label, } } -/// When in a label track, find out if we've hit anything that +/// When in a label track, find out if we've hit anything that /// would cause a cursor change. -void TrackPanel::SetCursorAndTipWhenInLabelTrack( LabelTrack * pLT, +void TrackPanel::SetCursorAndTipWhenInLabelTrack( LabelTrack * pLT, wxMouseEvent & event, const wxChar ** ppTip ) { int edge=pLT->OverGlyph(event.m_x, event.m_y); @@ -1572,9 +1572,9 @@ void TrackPanel::SetCursorAndTipWhenInLabelTrack( LabelTrack * pLT, } //KLUDGE: We refresh the whole Label track when the icon hovered over - //changes colouration. As well as being inefficient we are also + //changes colouration. As well as being inefficient we are also //doing stuff that should be delegated to the label track itself. - edge += pLT->mbHitCenter ? 4:0; + edge += pLT->mbHitCenter ? 4:0; if( edge != pLT->mOldEdge ) { pLT->mOldEdge = edge; @@ -1594,7 +1594,7 @@ void TrackPanel::SetCursorAndTipWhenInLabelTrack( LabelTrack * pLT, // The select tool can have different cursors and prompts depending on what // we hover over, most notably when hovering over the selction boundaries. // Determine and set the cursor and tip accordingly. -void TrackPanel::SetCursorAndTipWhenSelectTool( Track * t, +void TrackPanel::SetCursorAndTipWhenSelectTool( Track * t, wxMouseEvent & event, wxRect &r, bool bMultiToolMode, const wxChar ** ppTip ) { SetCursor(*mSelectCursor); @@ -1611,7 +1611,7 @@ void TrackPanel::SetCursorAndTipWhenSelectTool( Track * t, } //Make sure we are within the selected track - if (!t || !t->GetSelected()) + if (!t || !t->GetSelected()) { if(t) { @@ -1701,7 +1701,7 @@ void TrackPanel::SetCursorAndTipWhenSelectTool( Track * t, /// In this method we know what tool we are using, /// so set the cursor accordingly. -void TrackPanel::SetCursorAndTipByTool( int tool, +void TrackPanel::SetCursorAndTipByTool( int tool, wxMouseEvent & event, const wxChar ** /*ppTip*/ ) { bool unsafe = IsUnsafe(); @@ -1709,7 +1709,7 @@ void TrackPanel::SetCursorAndTipByTool( int tool, // Change the cursor based on the active tool. switch (tool) { case selectTool: - wxFAIL;// should have already been handled + wxFAIL;// should have already been handled break; case envelopeTool: SetCursor(unsafe ? *mDisabledCursor : *mEnvelopeCursor); @@ -1743,8 +1743,8 @@ void TrackPanel::HandleCursor(wxMouseEvent & event) if( SetCursorByActivity() ) return; - // (2) If we are not over a track at all, set the cursor to Arrow and - // clear the StatusBar, + // (2) If we are not over a track at all, set the cursor to Arrow and + // clear the StatusBar, wxRect r; Track *label = FindTrack(event.m_x, event.m_y, true, true, &r); Track *nonlabel = FindTrack(event.m_x, event.m_y, false, false, &r); @@ -1770,37 +1770,37 @@ void TrackPanel::HandleCursor(wxMouseEvent & event) } // Are we within the vertical resize area? - if ((tip == NULL ) && within(event.m_y, r.y + r.height, TRACK_RESIZE_REGION)) + if ((tip == NULL ) && within(event.m_y, r.y + r.height, TRACK_RESIZE_REGION)) { SetCursorAndTipWhenInVResizeArea( label, t->GetLinked(), &tip ); // tip may still be NULL at this point, in which case we go on looking. } - // Otherwise, we must be over a track of some kind + // Otherwise, we must be over a track of some kind // Is it a label track? if ((tip==NULL) && (t->GetKind() == Track::Label)) { // We are over a label track SetCursorAndTipWhenInLabelTrack( (LabelTrack*)t, event, &tip ); - // ..and if we haven't yet determined the cursor, + // ..and if we haven't yet determined the cursor, // we go on to do all the standard track hit tests. - } + } if( tip==NULL ) { ToolsToolBar * ttb = mListener->TP_GetToolsToolBar(); if( ttb == NULL ) return; - // JKC: DetermineToolToUse is called whenever the mouse - // moves. I had some worries about calling it when in + // JKC: DetermineToolToUse is called whenever the mouse + // moves. I had some worries about calling it when in // multimode as it then has to hit-test all 'objects' in - // the track panel, but performance seems fine in + // the track panel, but performance seems fine in // practice (on a P500). int tool = DetermineToolToUse( ttb, event ); tip = ttb->GetMessageForTool( tool ); - // We don't include the select tool in + // We don't include the select tool in // SetCursorAndTipByTool() because it's more complex than // the other tool cases. if( tool != selectTool ) @@ -1831,7 +1831,7 @@ void TrackPanel::HandleSelect(wxMouseEvent & event) // or drag? if (event.LeftDown()) { // AS: Now, did they click in a track somewhere? If so, we want - // to extend the current selection or start a new selection, + // to extend the current selection or start a new selection, // depending on the shift key. If not, cancel all selections. if (t) SelectionHandleClick(event, t, r); @@ -1891,14 +1891,14 @@ void TrackPanel::HandleSelect(wxMouseEvent & event) Refresh(false); SetCapturedTrack( NULL ); MakeParentModifyState(false); - } + } done: SelectionHandleDrag(event, t); // Update lyrics display for new selection. AudacityProject* pProj = GetActiveProject(); LyricsWindow* pLyricsWindow = pProj->GetLyricsWindow(); - if (pLyricsWindow && pLyricsWindow->IsShown()) + if (pLyricsWindow && pLyricsWindow->IsShown()) { Lyrics* pLyricsPanel = pLyricsWindow->GetLyricsPanel(); pLyricsPanel->Update(pProj->GetSel0()); @@ -1981,7 +1981,7 @@ void TrackPanel::SelectionHandleClick(wxMouseEvent & event, // A control-click will set just the indicator to the clicked spot, - // and turn playback on. + // and turn playback on. else if(event.CmdDown() #ifdef USE_MIDI && !stretch @@ -1999,7 +1999,7 @@ void TrackPanel::SelectionHandleClick(wxMouseEvent & event, bool busy = gAudioIO->IsBusy(); if(!busy) { - //If we aren't currently playing back, start playing back at + //If we aren't currently playing back, start playing back at //the clicked point ControlToolBar * ctb = p->GetControlToolBar(); ctb->SetPlay(true); @@ -2020,8 +2020,8 @@ void TrackPanel::SelectionHandleClick(wxMouseEvent & event, } - return; - } + return; + } //Make sure you are within the selected track if (pTrack && pTrack->GetSelected()) { wxInt64 leftSel = TimeToPosition(mViewInfo->sel0, r.x); @@ -2045,8 +2045,8 @@ void TrackPanel::SelectionHandleClick(wxMouseEvent & event, } } - //Determine if user clicked on a label track. - if (pTrack && (pTrack->GetKind() == Track::Label)) + //Determine if user clicked on a label track. + if (pTrack && (pTrack->GetKind() == Track::Label)) { LabelTrack *lt = (LabelTrack *) pTrack; if (lt->HandleMouse(event, r,//mCapturedRect, @@ -2127,12 +2127,12 @@ void TrackPanel::SelectionHandleClick(wxMouseEvent & event, mStretching = true; mStretched = false; - /* i18n-hint: (noun) The track that is used for MIDI notes which can be + /* i18n-hint: (noun) The track that is used for MIDI notes which can be dragged to change their duration.*/ - MakeParentPushState(_("Stretch Note Track"), - /* i18n-hint: In the history list, indicates a MIDI note has - been dragged to change its duration (stretch it). Using either past - or present tense is fine here. If unsure, go for whichever is + MakeParentPushState(_("Stretch Note Track"), + /* i18n-hint: In the history list, indicates a MIDI note has + been dragged to change its duration (stretch it). Using either past + or present tense is fine here. If unsure, go for whichever is shorter.*/ _("Stretch")); @@ -2273,12 +2273,12 @@ void TrackPanel::Stretch(int mouseXCoordinate, int trackLeftEdge, // values, then look them up after the Undo TrackListIterator iter(mTracks); int pTrackIndex = pTrack->GetIndex(); - int capturedTrackIndex = + int capturedTrackIndex = (mCapturedTrack ? mCapturedTrack->GetIndex() : 0); GetProject()->OnUndo(); - // Undo brings us back to the pre-click state, but we want to + // Undo brings us back to the pre-click state, but we want to // quantize selected region to integer beat boundaries. These // were saved in mStretchSel[12] variables: mViewInfo->sel0 = mStretchSel0; @@ -2359,7 +2359,7 @@ void TrackPanel::Stretch(int mouseXCoordinate, int trackLeftEdge, wxASSERT(false); break; } - MakeParentPushState(_("Stretch Note Track"), _("Stretch"), + MakeParentPushState(_("Stretch Note Track"), _("Stretch"), PUSH_CONSOLIDATE | PUSH_AUTOSAVE | PUSH_CALC_SPACE); mStretched = true; Refresh(false); @@ -2388,7 +2388,7 @@ void TrackPanel::SelectionHandleDrag(wxMouseEvent & event, Track *clickedTrack) pTrack = FindTrack(event.m_x, event.m_y, false, false, &r); // Also fuhggeddaboudit if not in a track. - if (!pTrack) + if (!pTrack) return; int x = mAutoScrolling ? mMouseMostRecentX : event.m_x; @@ -2405,7 +2405,7 @@ void TrackPanel::SelectionHandleDrag(wxMouseEvent & event, Track *clickedTrack) if (wxLongLong(SelStart-x).Abs() < minimumSizedSelection #ifdef USE_MIDI // limiting selection size is good, and not starting && !mStretching // stretch unless mouse moves 5 pixels is good, but -#endif // once stretching starts, it's ok to move even 1 pixel +#endif // once stretching starts, it's ok to move even 1 pixel ) return; @@ -2442,7 +2442,7 @@ void TrackPanel::SelectionHandleDrag(wxMouseEvent & event, Track *clickedTrack) ExtendSelection(x, r.x, clickedTrack); } -/// Converts a position (mouse X coordinate) to +/// Converts a position (mouse X coordinate) to /// project time, in seconds. Needs the left edge of /// the track as an additional parameter. double TrackPanel::PositionToTime(wxInt64 mouseXCoordinate, @@ -2501,7 +2501,7 @@ void TrackPanel::HandleEnvelope(wxMouseEvent & event) } } -/// We've established we're a time track. +/// We've established we're a time track. /// send events for its envelope. void TrackPanel::ForwardEventToTimeTrackEnvelope(wxMouseEvent & event) { @@ -2528,7 +2528,7 @@ void TrackPanel::ForwardEventToTimeTrackEnvelope(wxMouseEvent & event) } } -/// We've established we're a wave track. +/// We've established we're a wave track. /// send events for its envelope. void TrackPanel::ForwardEventToWaveTrackEnvelope(wxMouseEvent & event) { @@ -2635,18 +2635,18 @@ void TrackPanel::HandleSlide(wxMouseEvent & event) DoSlide(event); if (event.LeftUp()) { - if (mDidSlideVertically && mCapturedTrack) - // Now that user has dropped the clip into a different track, + if (mDidSlideVertically && mCapturedTrack) + // Now that user has dropped the clip into a different track, // make sure the sample rate matches the destination track (mCapturedTrack). - for (size_t i = 0; i < mCapturedClipArray.GetCount(); i++) + for (size_t i = 0; i < mCapturedClipArray.GetCount(); i++) if (mCapturedTrack->GetKind() == Track::Wave) // Should always be true here, but make sure. { WaveClip* pWaveClip = mCapturedClipArray[i].clip; - // Note that per TrackPanel::AddClipsToCaptured(Track *t, double t0, double t1), - // in the non-WaveTrack case, the code adds a NULL clip to mCapturedClipArray, - // so we have to check for that any time we're going to deref it. + // Note that per TrackPanel::AddClipsToCaptured(Track *t, double t0, double t1), + // in the non-WaveTrack case, the code adds a NULL clip to mCapturedClipArray, + // so we have to check for that any time we're going to deref it. // Previous code did not check it here, and that caused bug 367 crash. - if (pWaveClip) + if (pWaveClip) { pWaveClip->Resample(((WaveTrack*)mCapturedTrack)->GetRate()); pWaveClip->MarkChanged(); @@ -2674,9 +2674,9 @@ void TrackPanel::HandleSlide(wxMouseEvent & event) consolidate = false; } else { - wxString direction = mHSlideAmount>0 ? + wxString direction = mHSlideAmount>0 ? /* i18n-hint: a direction as in left or right.*/ - _("right") : + _("right") : /* i18n-hint: a direction as in left or right.*/ _("left"); /* i18n-hint: %s is a direction like left or right */ @@ -2684,7 +2684,7 @@ void TrackPanel::HandleSlide(wxMouseEvent & event) direction.c_str(), fabs(mHSlideAmount)); consolidate = true; } - MakeParentPushState(msg, _("Time-Shift"), + MakeParentPushState(msg, _("Time-Shift"), consolidate ? (PUSH_CONSOLIDATE) : (PUSH_AUTOSAVE|PUSH_CALC_SPACE)); } } @@ -2698,7 +2698,7 @@ void TrackPanel::StartSlide(wxMouseEvent & event) mDidSlideVertically = false; Track *vt = FindTrack(event.m_x, event.m_y, false, false, &r); - if (!vt) + if (!vt) return; ToolsToolBar * ttb = mListener->TP_GetToolsToolBar(); @@ -2728,7 +2728,7 @@ void TrackPanel::StartSlide(wxMouseEvent & event) mCapturedClipArray.Clear(); - double clickTime = + double clickTime = PositionToTime(event.m_x, GetLeftOffset()); bool clickedInSelection = (vt->GetSelected() && @@ -2897,7 +2897,7 @@ void TrackPanel::AddClipsToCaptured(Track *t, double t0, double t1) #ifdef USE_MIDI // do not add NoteTrack if the data is outside of time bounds if (t->GetKind() == Track::Note) { - if (t->GetEndTime() < t0 || t->GetStartTime() > t1) + if (t->GetEndTime() < t0 || t->GetStartTime() > t1) return; } #endif @@ -2910,7 +2910,7 @@ void TrackPanel::AddClipsToCaptured(Track *t, double t0, double t1) /// (e.g. moving clips between tracks). // GM: DoSlide now implementing snap-to -// samples functionality based on sample rate. +// samples functionality based on sample rate. void TrackPanel::DoSlide(wxMouseEvent & event) { unsigned int i; @@ -2962,12 +2962,12 @@ void TrackPanel::DoSlide(wxMouseEvent & event) #ifdef USE_MIDI if (mouseTrack->GetKind() == Track::Wave) { WaveTrack *mtw = (WaveTrack *) mouseTrack; - desiredSlideAmount = rint(mtw->GetRate() * desiredSlideAmount) / + desiredSlideAmount = rint(mtw->GetRate() * desiredSlideAmount) / mtw->GetRate(); // set it to a sample point } // Adjust desiredSlideAmount using SnapManager if (mSnapManager && mCapturedClipArray.GetCount()) { - double clipLeft; + double clipLeft; double clipRight; if (mCapturedClip) { clipLeft = mCapturedClip->GetStartTime() + desiredSlideAmount; @@ -2978,7 +2978,7 @@ void TrackPanel::DoSlide(wxMouseEvent & event) clipRight = mCapturedTrack->GetEndTime() + desiredSlideAmount; } #else - desiredSlideAmount = rint(mouseTrack->GetRate() * desiredSlideAmount) / + desiredSlideAmount = rint(mouseTrack->GetRate() * desiredSlideAmount) / mouseTrack->GetRate(); // set it to a sample point if (mSnapManager && mCapturedClip) { double clipLeft = mCapturedClip->GetStartTime() + desiredSlideAmount; @@ -3032,7 +3032,7 @@ void TrackPanel::DoSlide(wxMouseEvent & event) { // Make sure we always have the first linked track of a stereo track if (!mouseTrack->GetLinked() && mTracks->GetLink(mouseTrack)) - mouseTrack = + mouseTrack = #ifndef USE_MIDI (WaveTrack *) #endif @@ -3044,7 +3044,7 @@ void TrackPanel::DoSlide(wxMouseEvent & event) if (mCapturedClipArray[i].clip) mCapturedClipArray[i].clip->Offset(desiredSlideAmount); // See if it can be moved - if (MoveClipToTrack(mCapturedClip, + if (MoveClipToTrack(mCapturedClip, (WaveTrack*)mouseTrack)) { mCapturedTrack = mouseTrack; mDidSlideVertically = true; @@ -3155,9 +3155,9 @@ void TrackPanel::DoSlide(wxMouseEvent & event) } -/// This method takes care of our different zoom +/// This method takes care of our different zoom /// possibilities. It is possible for a user to just -/// "zoom in" or "zoom out," but it is also possible +/// "zoom in" or "zoom out," but it is also possible /// for a user to drag and select an area that he /// or she wants to be zoomed in on. We use mZoomStart /// and mZoomEnd to track the beggining and end of such @@ -3321,12 +3321,12 @@ void TrackPanel::HandleVZoomClick( wxMouseEvent & event ) return; // don't do anything if track is not wave or Spectrum/log Spectrum - if (((mCapturedTrack->GetKind() == Track::Wave) && + if (((mCapturedTrack->GetKind() == Track::Wave) && (((WaveTrack*)mCapturedTrack)->GetDisplay() <= WaveTrack::SpectrumLogDisplay)) #ifdef USE_MIDI - || mCapturedTrack->GetKind() == Track::Note + || mCapturedTrack->GetKind() == Track::Note #endif - ) + ) { mMouseCapture = IsVZooming; mZoomStart = event.m_y; @@ -3406,9 +3406,9 @@ void TrackPanel::HandleVZoomButtonUp( wxMouseEvent & event ) float min, max, c, l, binSize = 0.0; bool spectrum, spectrumLog; - int windowSize; + int windowSize; #ifdef EXPERIMENTAL_FFT_SKIP_POINTS - int fftSkipPoints=0; + int fftSkipPoints=0; #endif //EXPERIMENTAL_FFT_SKIP_POINTS double rate = ((WaveTrack *)track)->GetRate(); spectrum = ((WaveTrack *) track)->GetDisplay() == WaveTrack::SpectrumDisplay; @@ -3710,8 +3710,8 @@ void TrackPanel::HandleSampleEditingClick( wxMouseEvent & event ) double t0 = PositionToTime(event.m_x, GetLeftOffset()); double rate = ((WaveTrack *)mDrawingTrack)->GetRate(); - // Default to zero for ALT case, so it doesn't cause a runtime fault on MSVC in - // the mDrawingLastDragSampleValue assignment at the bottom of this method. + // Default to zero for ALT case, so it doesn't cause a runtime fault on MSVC in + // the mDrawingLastDragSampleValue assignment at the bottom of this method. float newLevel = 0.0f; //Declare this for use later //convert t0 to samples @@ -3722,20 +3722,20 @@ void TrackPanel::HandleSampleEditingClick( wxMouseEvent & event ) //Sequence *seq = ((WaveTrack *)mDrawingTrack)->GetSequence(); - //Determine how drawing should occur. If alt is down, + //Determine how drawing should occur. If alt is down, //do a smoothing, instead of redrawing. - if( event.m_altDown ) + if( event.m_altDown ) { //************************************************* //*** ALT-DOWN-CLICK (SAMPLE SMOOTHING) *** //************************************************* // // Smoothing works like this: There is a smoothing kernel radius constant that - // determines how wide the averaging window is. Plus, there is a smoothing brush radius, + // determines how wide the averaging window is. Plus, there is a smoothing brush radius, // which determines how many pixels wide around the selected pixel this smoothing is applied. // - // Samples will be replaced by a mixture of the original points and the smoothed points, - // with a triangular mixing probability whose value at the center point is + // Samples will be replaced by a mixture of the original points and the smoothed points, + // with a triangular mixing probability whose value at the center point is // SMOOTHING_PROPORTION_MAX and at the far bounds is SMOOTHING_PROPORTION_MIN //Get the region of samples around the selected point @@ -3744,7 +3744,7 @@ void TrackPanel::HandleSampleEditingClick( wxMouseEvent & event ) float * newSampleRegion = new float[1 + 2 * SMOOTHING_BRUSH_RADIUS]; //Get a sample from the track to do some tricks on. - ((WaveTrack*)mDrawingTrack)->Get((samplePtr)sampleRegion, floatSample, + ((WaveTrack*)mDrawingTrack)->Get((samplePtr)sampleRegion, floatSample, (int)mDrawingStartSample - SMOOTHING_KERNEL_RADIUS - SMOOTHING_BRUSH_RADIUS, sampleRegionSize); int i, j; @@ -3758,11 +3758,11 @@ void TrackPanel::HandleSampleEditingClick( wxMouseEvent & event ) //The average is a weighted average, scaled by a weighting kernel that is simply triangular // A triangular kernel across N items, with a radius of R ( 2 R + 1 points), if the farthest: // points have a probability of a, the entire triangle has total probability of (R + 1)^2. - // For sample number i and middle brush sample M, (R + 1 - abs(M-i))/ ((R+1)^2) gives a + // For sample number i and middle brush sample M, (R + 1 - abs(M-i))/ ((R+1)^2) gives a // legal distribution whose total probability is 1. // // - // weighting factor value + // weighting factor value sumOfSamples += (SMOOTHING_KERNEL_RADIUS + 1 - abs(i)) * sampleRegion[i + j + SMOOTHING_KERNEL_RADIUS + SMOOTHING_BRUSH_RADIUS]; } @@ -3782,7 +3782,7 @@ void TrackPanel::HandleSampleEditingClick( wxMouseEvent & event ) prob = SMOOTHING_PROPORTION_MAX - (float)abs(j)/SMOOTHING_BRUSH_RADIUS * (SMOOTHING_PROPORTION_MAX - SMOOTHING_PROPORTION_MIN); newSampleRegion[j+SMOOTHING_BRUSH_RADIUS] = - newSampleRegion[j + SMOOTHING_BRUSH_RADIUS] * prob + + newSampleRegion[j + SMOOTHING_BRUSH_RADIUS] * prob + sampleRegion[SMOOTHING_BRUSH_RADIUS + SMOOTHING_KERNEL_RADIUS + j] * (1 - prob); } //Set the sample to the point of the mouse event @@ -3791,8 +3791,8 @@ void TrackPanel::HandleSampleEditingClick( wxMouseEvent & event ) //Clean this up right away to avoid a memory leak delete[] sampleRegion; delete[] newSampleRegion; - } - else + } + else { //************************************************* //*** PLAIN DOWN-CLICK (NORMAL DRAWING) *** @@ -3858,8 +3858,8 @@ void TrackPanel::HandleSampleEditingDrag( wxMouseEvent & event ) // Figure out what time the click was at double t0 = PositionToTime(event.m_x, GetLeftOffset()); float newLevel; - //Find the point that we want to redraw at. If the control button is down, - //adjust only the originally clicked-on sample + //Find the point that we want to redraw at. If the control button is down, + //adjust only the originally clicked-on sample //************************************************* //*** CTRL-DOWN (Hold Initial Sample Constant *** @@ -3867,8 +3867,8 @@ void TrackPanel::HandleSampleEditingDrag( wxMouseEvent & event ) if( event.m_controlDown) { s0 = mDrawingStartSample; - } - else + } + else { //************************************************* //*** Normal CLICK-drag (Normal drawing) *** @@ -3912,20 +3912,20 @@ void TrackPanel::HandleSampleEditingDrag( wxMouseEvent & event ) float tmpvalue; //Handle cases of 0 or 1 special, to improve speed //JKC I don't think this makes any noticeable difference to speed - // whatsoever! The real reason for the special case is probably to + // whatsoever! The real reason for the special case is probably to // avoid division by zero.... #define LLABS(n) ((n) < 0 ? -(n) : (n)) if(LLABS(s0 - mDrawingLastDragSample) <= 1){ ((WaveTrack*)mDrawingTrack)->Set((samplePtr)&newLevel, floatSample, s0, 1); } - else + else { - //Go from the smaller to larger sample. + //Go from the smaller to larger sample. int start = wxMin( s0, mDrawingLastDragSample) +1; int end = wxMax( s0, mDrawingLastDragSample); for(sampleCount i= start; i<= end; i++) { //This interpolates each sample linearly: - tmpvalue=mDrawingLastDragSampleValue + (newLevel - mDrawingLastDragSampleValue) * + tmpvalue=mDrawingLastDragSampleValue + (newLevel - mDrawingLastDragSampleValue) * (float)(i-mDrawingLastDragSample)/(s0-mDrawingLastDragSample ); ((WaveTrack*)mDrawingTrack)->Set((samplePtr)&tmpvalue, floatSample, i, 1); } @@ -3955,14 +3955,14 @@ void TrackPanel::HandleSampleEditingButtonUp( wxMouseEvent & WXUNUSED(event)) /// This handles adjusting individual samples by hand using the draw tool(s) /// /// There are several member data structure for handling drawing: -/// - mDrawingTrack: keeps track of which track you clicked down on, so drawing doesn't +/// - mDrawingTrack: keeps track of which track you clicked down on, so drawing doesn't /// jump to a new track /// - mDrawingTrackTop: The top position of the drawing track--makes drawing easier. /// - mDrawingStartSample: The sample you clicked down on, so that you can hold it steady /// - mDrawingStartSampleValue: The original value of the initial sample /// - mDrawingLastDragSample: When drag-drawing, this keeps track of the last sample you dragged over, /// so it can smoothly redraw samples that got skipped over -/// - mDrawingLastDragSampleValue: The value of the last +/// - mDrawingLastDragSampleValue: The value of the last void TrackPanel::HandleSampleEditing(wxMouseEvent & event) { if (event.LeftDown() ) { @@ -4005,7 +4005,7 @@ void TrackPanel::HandleClosing(wxMouseEvent & event) void TrackPanel::UpdateViewIfNoTracks() { - if (mTracks->IsEmpty()) + if (mTracks->IsEmpty()) { // BG: There are no more tracks on screen //BG: Set zoom to normal @@ -4039,7 +4039,7 @@ void TrackPanel::RemoveTrack(Track * toRemove) if (toRemove->GetKind() == Track::Wave) { // Update mixer board displayed tracks. - MixerBoard* pMixerBoard = this->GetMixerBoard(); + MixerBoard* pMixerBoard = this->GetMixerBoard(); if (pMixerBoard) pMixerBoard->RemoveTrackCluster((WaveTrack*)toRemove); // Will remove partner shown in same cluster. } @@ -4115,14 +4115,14 @@ void TrackPanel::HandleMutingSoloing(wxMouseEvent & event, bool solo) } else if (event.LeftUp() ) { - if (buttonRect.Contains(event.m_x, event.m_y)) + if (buttonRect.Contains(event.m_x, event.m_y)) { // For either, MakeParentPushState to make the track state dirty. if(solo) OnTrackSolo(event.ShiftDown(),t); else OnTrackMute(event.ShiftDown(),t); - } + } SetCapturedTrack( NULL ); // mTrackInfo.DrawMuteSolo(&dc, r, t, false, solo); Refresh(false); @@ -4202,7 +4202,7 @@ void TrackPanel::HandleSliders(wxMouseEvent &event, bool pan) if(panZero) MakeParentRedrawScrollbars(); #endif - if (pMixerBoard) + if (pMixerBoard) pMixerBoard->UpdatePan((WaveTrack*)mCapturedTrack); } else { @@ -4210,7 +4210,7 @@ void TrackPanel::HandleSliders(wxMouseEvent &event, bool pan) if (link) link->SetGain(newValue); - if (pMixerBoard) + if (pMixerBoard) pMixerBoard->UpdateGain((WaveTrack*)mCapturedTrack); } #ifdef EXPERIMENTAL_MIDI_OUT @@ -4321,12 +4321,12 @@ void TrackPanel::HandleLabelClick(wxMouseEvent & event) if (isleft && PopupFunc(t, r, event.m_x, event.m_y)) return; - // VJ: Check sync-lock icon and the blank area to the left of the minimize button. - // Have to do it here, because if track is shrunk such that these areas occlude controls, - // e.g., mute/solo, don't want the "Funcs" below to set up handling. + // VJ: Check sync-lock icon and the blank area to the left of the minimize button. + // Have to do it here, because if track is shrunk such that these areas occlude controls, + // e.g., mute/solo, don't want the "Funcs" below to set up handling. // Only result of doing so is to select the track. Don't care whether isleft. bool bTrackSelClick = this->TrackSelFunc(t, r, event.m_x, event.m_y); - if (!bTrackSelClick) + if (!bTrackSelClick) { // MM: Check minimize buttons on WaveTracks. Must be before // solo/mute buttons, sliders etc. @@ -4365,7 +4365,7 @@ void TrackPanel::HandleLabelClick(wxMouseEvent & event) // looking in the wrong place. We pass it a bogus rectangle created when // the slider was placed to "fake" GainFunc into finding the slider in // its actual location. - if (GainFunc(t, ((NoteTrack *) t)->GetGainPlacementRect(), + if (GainFunc(t, ((NoteTrack *) t)->GetGainPlacementRect(), event, event.m_x, event.m_y)) return; #endif @@ -4394,7 +4394,7 @@ void TrackPanel::HandleLabelClick(wxMouseEvent & event) TrackPanel::CalculateRearrangingThresholds(event); } - // AS: If the shift button is being held down, invert + // AS: If the shift button is being held down, invert // the selection on this track. if (event.ShiftDown()) { mTracks->Select(t, !t->GetSelected()); @@ -4410,7 +4410,7 @@ void TrackPanel::HandleLabelClick(wxMouseEvent & event) SetFocusedTrack(t); SelectTrackLength(t); - this->Refresh(false); + this->Refresh(false); MixerBoard* pMixerBoard = this->GetMixerBoard(); if (pMixerBoard) pMixerBoard->RefreshTrackClusters(); @@ -4500,7 +4500,7 @@ bool TrackPanel::GainFunc(Track * t, wxRect r, wxMouseEvent &event, { wxRect sliderRect; mTrackInfo.GetGainRect(r, sliderRect); - if (!sliderRect.Contains(x, y)) + if (!sliderRect.Contains(x, y)) return false; SetCapturedTrack( t, IsGainSliding); @@ -4525,15 +4525,15 @@ bool TrackPanel::PanFunc(Track * t, wxRect r, wxMouseEvent &event, return true; } -/// Mute or solo the given track (t). If solo is true, we're -/// soloing, otherwise we're muting. Basically, check and see +/// Mute or solo the given track (t). If solo is true, we're +/// soloing, otherwise we're muting. Basically, check and see /// whether x and y fall within the area of the appropriate button. bool TrackPanel::MuteSoloFunc(Track * t, wxRect r, int x, int y, bool solo) { wxRect buttonRect; mTrackInfo.GetMuteSoloRect(r, buttonRect, solo, HasSoloButton()); - if (!buttonRect.Contains(x, y)) + if (!buttonRect.Contains(x, y)) return false; wxClientDC dc(this); @@ -4565,7 +4565,7 @@ bool TrackPanel::MinimizeFunc(Track * t, wxRect r, int x, int y) { wxRect buttonRect; mTrackInfo.GetMinimizeRect(r, buttonRect); - if (!buttonRect.Contains(x, y)) + if (!buttonRect.Contains(x, y)) return false; SetCapturedTrack(t, IsMinimizing); @@ -4597,7 +4597,7 @@ bool TrackPanel::PopupFunc(Track * t, wxRect r, int x, int y) { wxRect titleRect; mTrackInfo.GetTitleBarRect(r, titleRect); - if (!titleRect.Contains(x, y)) + if (!titleRect.Contains(x, y)) return false; wxClientDC dc(this); @@ -4734,7 +4734,7 @@ void TrackPanel::HandleResizeDrag(wxMouseEvent & event) if (link) { link->SetHeight(link->GetHeight()); link->SetMinimized(false); - // Initial values must be reset since they weren't based on the + // Initial values must be reset since they weren't based on the // minimized heights. mInitialUpperTrackHeight = link->GetHeight(); mInitialTrackHeight = mCapturedTrack->GetHeight(); @@ -4748,7 +4748,7 @@ void TrackPanel::HandleResizeDrag(wxMouseEvent & event) #endif } - //STM: We may be dragging one or two (stereo) tracks. + //STM: We may be dragging one or two (stereo) tracks. // If two, resize proportionally if we are dragging the lower track, and // adjust compensatively if we are dragging the upper track. #ifdef EXPERIMENTAL_OUTPUT_DISPLAY @@ -4931,8 +4931,8 @@ void TrackPanel::HandleResize(wxMouseEvent & event) { if (event.LeftDown()) { HandleResizeClick( event ); - } - else if (event.LeftUp()) + } + else if (event.LeftUp()) { HandleResizeButtonUp( event ); } @@ -4964,11 +4964,11 @@ void TrackPanel::HandleWheelRotation(wxMouseEvent & event) AudacityProject *p = GetProject(); if( steps > 0 ) p->ZoomInByFactor( ZoomFactor ); - else + else p->ZoomOutByFactor( ZoomFactor ); #endif // MM: Zoom in/out when used with Control key down - // We're converting pixel positions to times, + // We're converting pixel positions to times, // counting pixels from the left edge of the track. int trackLeftEdge = GetLeftOffset(); @@ -4980,7 +4980,7 @@ void TrackPanel::HandleWheelRotation(wxMouseEvent & event) // When zooming in in empty space, it's easy to 'lose' the waveform. // This prevents it. // IF zooming in - if( steps > 0) + if( steps > 0) { // IF mouse is to right of audio if( center_h > audioEndTime ) @@ -5050,7 +5050,7 @@ void TrackPanel::OnKeyDown(wxKeyEvent & event) // Otherwise, refresh track display if the keystroke was handled if( bkpSel0 != mViewInfo->sel0 || bkpSel1 != mViewInfo->sel1 ) Refresh( false ); - else if (!event.GetSkipped()) + else if (!event.GetSkipped()) RefreshTrack(t); } @@ -5082,7 +5082,7 @@ void TrackPanel::OnChar(wxKeyEvent & event) // Otherwise, refresh track display if the keystroke was handled if( bkpSel0 != mViewInfo->sel0 || bkpSel1 != mViewInfo->sel1 ) Refresh( false ); - else if (!event.GetSkipped()) + else if (!event.GetSkipped()) RefreshTrack(t); #if defined (__WXGTK__) @@ -5118,7 +5118,7 @@ void TrackPanel::OnMouseEvent(wxMouseEvent & event) if (event.LeftDown()) { mCapturedTrack = NULL; - // The activate event is used to make the + // The activate event is used to make the // parent window 'come alive' if it didn't have focus. wxActivateEvent e; GetParent()->ProcessEvent(e); @@ -5143,7 +5143,7 @@ void TrackPanel::OnMouseEvent(wxMouseEvent & event) switch( mMouseCapture ) { - case IsVZooming: + case IsVZooming: HandleVZoom(event); break; case IsClosing: @@ -5158,7 +5158,7 @@ void TrackPanel::OnMouseEvent(wxMouseEvent & event) case IsSoloing: HandleMutingSoloing(event, true); break; - case IsResizing: + case IsResizing: case IsResizingBetweenLinkedTracks: case IsResizingBelowLinkedTracks: HandleResize(event); @@ -5237,7 +5237,7 @@ bool TrackPanel::HandleTrackLocationMouseEvent(WaveTrack * track, wxRect &r, wxM if (track->ExpandCutLine(mCapturedTrackLocation.pos, &cutlineStart, &cutlineEnd)) { WaveTrack* linked = (WaveTrack*)mTracks->GetLink(track); - if (linked && + if (linked && !linked->ExpandCutLine(mCapturedTrackLocation.pos)) return false; @@ -5253,7 +5253,7 @@ bool TrackPanel::HandleTrackLocationMouseEvent(WaveTrack * track, wxRect &r, wxM return false; WaveTrack* linked = (WaveTrack*)mTracks->GetLink(track); - if (linked && + if (linked && !linked->MergeClips(mCapturedTrackLocation.clipidx1, mCapturedTrackLocation.clipidx2)) return false; @@ -5275,7 +5275,7 @@ bool TrackPanel::HandleTrackLocationMouseEvent(WaveTrack * track, wxRect &r, wxM if (handled) { SetCapturedTrack( NULL ); - mMouseCapture = WasOverCutLine; + mMouseCapture = WasOverCutLine; RefreshTrack(track); return true; } @@ -5313,7 +5313,7 @@ bool TrackPanel::HandleTrackLocationMouseEvent(WaveTrack * track, wxRect &r, wxM /// Event has happened on a track and it has been determined to be a label track. bool TrackPanel::HandleLabelTrackMouseEvent(LabelTrack * lTrack, wxRect &r, wxMouseEvent & event) { - /// \todo This method is one of a large number of methods in + /// \todo This method is one of a large number of methods in /// TrackPanel which suitably modified belong in other classes. if(event.LeftDown()) { @@ -5334,7 +5334,7 @@ bool TrackPanel::HandleLabelTrackMouseEvent(LabelTrack * lTrack, wxRect &r, wxMo if(lTrack->OverGlyph(event.m_x, event.m_y)) { SetCapturedTrack(lTrack, IsAdjustingLabel); - mCapturedRect = r; + mCapturedRect = r; mCapturedRect.x += kLeftInset; mCapturedRect.width -= kLeftInset; } @@ -5369,7 +5369,7 @@ bool TrackPanel::HandleLabelTrackMouseEvent(LabelTrack * lTrack, wxRect &r, wxMo return true; } - //If we are adjusting a label on a labeltrack, do not do anything + //If we are adjusting a label on a labeltrack, do not do anything //that follows. Instead, redraw the track. if(mMouseCapture == IsAdjustingLabel) { @@ -5385,11 +5385,11 @@ bool TrackPanel::HandleLabelTrackMouseEvent(LabelTrack * lTrack, wxRect &r, wxMo mLabelTrackStartXPos = event.m_x; mLabelTrackStartYPos = event.m_y; - if ((lTrack->getSelectedIndex() != -1) && + if ((lTrack->getSelectedIndex() != -1) && lTrack->OverTextBox( - lTrack->GetLabel(lTrack->getSelectedIndex()), + lTrack->GetLabel(lTrack->getSelectedIndex()), mLabelTrackStartXPos, - mLabelTrackStartYPos)) + mLabelTrackStartYPos)) { mLabelTrackStartYPos = -1; } @@ -5445,7 +5445,7 @@ void TrackPanel::HandleTrackSpecificMouseEvent(wxMouseEvent & event) FindTrack(event.m_x, event.m_y, true, true, &rLabel); pTrack = FindTrack(event.m_x, event.m_y, false, false, &r); - //call HandleResize if I'm over the border area + //call HandleResize if I'm over the border area if (event.LeftDown() && (within(event.m_y, r.y + r.height, TRACK_RESIZE_REGION) || within(event.m_y, rLabel.y + rLabel.height, @@ -5471,13 +5471,13 @@ void TrackPanel::HandleTrackSpecificMouseEvent(wxMouseEvent & event) //Determine if user clicked on a label track. //If so, use MouseDown handler for the label track. - if (pTrack && (pTrack->GetKind() == Track::Label)) + if (pTrack && (pTrack->GetKind() == Track::Label)) { if(HandleLabelTrackMouseEvent( (LabelTrack *) pTrack, r, event )) return; } - if (pTrack && (pTrack->GetKind() == Track::Wave) && + if (pTrack && (pTrack->GetKind() == Track::Wave) && (mMouseCapture == IsUncaptured || mMouseCapture == IsOverCutLine || mMouseCapture == WasOverCutLine)) { @@ -5514,7 +5514,7 @@ void TrackPanel::HandleTrackSpecificMouseEvent(wxMouseEvent & event) if ((event.Moving() || event.LeftUp()) && (mMouseCapture == IsUncaptured )) -// (mMouseCapture != IsSelecting ) && +// (mMouseCapture != IsSelecting ) && // (mMouseCapture != IsEnveloping) && // (mMouseCapture != IsSliding) ) { @@ -5525,7 +5525,7 @@ void TrackPanel::HandleTrackSpecificMouseEvent(wxMouseEvent & event) } } -/// If we are in multimode, looks at the type of track and where we are on it to +/// If we are in multimode, looks at the type of track and where we are on it to /// determine what object we are hovering over and hence what tool to use. /// @param pTtb - A pointer to the tools tool bar /// @param event - Mouse event, with info about position and what mouse buttons are down. @@ -5568,7 +5568,7 @@ int TrackPanel::DetermineToolToUse( ToolsToolBar * pTtb, wxMouseEvent & event) currentTool = selectTool; // So we are in a wave track. //FIXME: Not necessarily. Haven't checked Track::Note (#if defined(USE_MIDI)). - // From here on the order in which we hit test determines + // From here on the order in which we hit test determines // which tool takes priority in the rare cases where it // could be more than one. } else if (event.CmdDown()){ @@ -5583,7 +5583,7 @@ int TrackPanel::DetermineToolToUse( ToolsToolBar * pTtb, wxMouseEvent & event) currentTool = drawTool; } - //Use the false argument since in multimode we don't + //Use the false argument since in multimode we don't //want the button indicating which tool is in use to be updated. pTtb->SetCurrentTool( currentTool, false ); return currentTool; @@ -5613,7 +5613,7 @@ bool TrackPanel::HitTestStretch(Track *track, wxRect &r, wxMouseEvent & event) #endif -/// method that tells us if the mouse event landed on an +/// method that tells us if the mouse event landed on an /// envelope boundary. bool TrackPanel::HitTestEnvelope(Track *track, wxRect &r, wxMouseEvent & event) { @@ -5627,14 +5627,14 @@ bool TrackPanel::HitTestEnvelope(Track *track, wxRect &r, wxMouseEvent & event) return false; int displayType = wavetrack->GetDisplay(); - // Not an envelope hit, unless we're using a type of wavetrack display + // Not an envelope hit, unless we're using a type of wavetrack display // suitable for envelopes operations, ie one of the Wave displays. - if ( displayType > 1) + if ( displayType > 1) return false; // No envelope, not a hit, so return. // Get envelope point, range 0.0 to 1.0 bool dB = (displayType == 1); - double envValue = envelope->GetValueAtX( + double envValue = envelope->GetValueAtX( event.m_x, r, mViewInfo->h, mViewInfo->zoom ); float zoomMin, zoomMax; @@ -5655,11 +5655,11 @@ bool TrackPanel::HitTestEnvelope(Track *track, wxRect &r, wxMouseEvent & event) // Get y distance of envelope from center line (in pixels) yValue = abs(ctr-yValue); - // JKC: It happens that the envelope is actually drawn offset from its + // JKC: It happens that the envelope is actually drawn offset from its // 'true' position (it is 3 pixels wide). yMisalign is really a fudge - // factor to allow us to hit it exactly, but I wouldn't dream of + // factor to allow us to hit it exactly, but I wouldn't dream of // calling it yFudgeFactor :) - const int yMisalign = 2; + const int yMisalign = 2; // Perhaps yTolerance should be put into preferences? const int yTolerance = 5; // how far from envelope we may be and count as a hit. int distance; @@ -5679,7 +5679,7 @@ bool TrackPanel::HitTestEnvelope(Track *track, wxRect &r, wxMouseEvent & event) return( distance < yTolerance ); } -/// method that tells us if the mouse event landed on an +/// method that tells us if the mouse event landed on an /// editable sample bool TrackPanel::HitTestSamples(Track *track, wxRect &r, wxMouseEvent & event) { @@ -5697,7 +5697,7 @@ bool TrackPanel::HitTestSamples(Track *track, wxRect &r, wxMouseEvent & event) return false; int displayType = wavetrack->GetDisplay(); - if ( displayType > 1) + if ( displayType > 1) return false; // Not a wave, so return. float oneSample; @@ -5719,7 +5719,7 @@ bool TrackPanel::HitTestSamples(Track *track, wxRect &r, wxMouseEvent & event) if (env) envValue = env->GetValue(tt); - int yValue = GetWaveYPos( oneSample * envValue, + int yValue = GetWaveYPos( oneSample * envValue, zoomMin, zoomMax, r.height, dB, true, mdBr, false) + r.y; @@ -5731,7 +5731,7 @@ bool TrackPanel::HitTestSamples(Track *track, wxRect &r, wxMouseEvent & event) return( abs( yValue - yMouse ) < yTolerance ); } -/// method that tells us if the mouse event landed on a +/// method that tells us if the mouse event landed on a /// time-slider that allows us to time shift the sequence. bool TrackPanel::HitTestSlide(Track * WXUNUSED(track), wxRect &r, wxMouseEvent & event) { @@ -5740,7 +5740,7 @@ bool TrackPanel::HitTestSlide(Track * WXUNUSED(track), wxRect &r, wxMouseEvent & // The drag Handle width includes border, width and a little extra margin. const int adjustedDragHandleWidth = 14; - // The hotspot for the cursor isn't at its centre. Adjust for this. + // The hotspot for the cursor isn't at its centre. Adjust for this. const int hotspotOffset = 5; // We are doing an approximate test here - is the mouse in the right or left border? @@ -5792,9 +5792,9 @@ void TrackPanel::RefreshTrack(Track *trk, bool refreshbacking) } -/// This method overrides Refresh() of wxWindow so that the +/// This method overrides Refresh() of wxWindow so that the /// boolean play indictaor can be set to false, so that an old play indicator that is -/// no longer there won't get XORed (to erase it), thus redrawing it on the +/// no longer there won't get XORed (to erase it), thus redrawing it on the /// TrackPanel void TrackPanel::Refresh(bool eraseBackground /* = TRUE */, const wxRect *rect /* = NULL */) @@ -5840,7 +5840,7 @@ void TrackPanel::DrawTracks(wxDC * dc) // The track artist actually draws the stuff inside each track mTrackArtist->DrawTracks(mTracks, GetProject()->GetFirstVisible(), - *dc, region, tracksRect, clip, mViewInfo, + *dc, region, tracksRect, clip, mViewInfo, envelopeFlag, samplesFlag, sliderFlag); DrawEverythingElse(dc, region, panelRect, clip); @@ -5849,7 +5849,7 @@ void TrackPanel::DrawTracks(wxDC * dc) /// Draws 'Everything else'. In particular it draws: /// - Drop shadow for tracks and vertical rulers. /// - Zooming Indicators. -/// - Fills in space below the tracks. +/// - Fills in space below the tracks. void TrackPanel::DrawEverythingElse(wxDC * dc, const wxRegion region, const wxRect WXUNUSED(panelRect), @@ -5857,7 +5857,7 @@ void TrackPanel::DrawEverythingElse(wxDC * dc, { // We draw everything else - wxRect focusRect(-1, -1, 0, 0); + wxRect focusRect(-1, -1, 0, 0); wxRect trackRect = clip; trackRect.height = 0; // for drawing background in no tracks case. @@ -5965,7 +5965,7 @@ void TrackPanel::DrawEverythingElse(wxDC * dc, } // Sometimes highlight is not drawn on backing bitmap. I thought - // it was because FindFocus did not return "this" on Mac, but + // it was because FindFocus did not return "this" on Mac, but // when I removed that test, yielding this condition: // if (GetFocusedTrack() != NULL) { // the highlight was reportedly drawn even when something else @@ -6038,7 +6038,7 @@ void TrackPanel::DrawOutside(Track * t, wxDC * dc, const wxRect rec, #ifdef USE_MIDI bool bIsNote = (t->GetKind() == Track::Note); #endif - // don't enable bHasMuteSolo for Note track because it will draw in the + // don't enable bHasMuteSolo for Note track because it will draw in the // wrong place. mTrackInfo.DrawBackground(dc, r, t->GetSelected(), bIsWave, labelw, vrul); @@ -6062,15 +6062,15 @@ void TrackPanel::DrawOutside(Track * t, wxDC * dc, const wxRect rec, mTrackInfo.DrawMinimize(dc, r, t, (captured && mMouseCapture==IsMinimizing)); // Draw the sync-lock indicator if this track is in a sync-lock selected group. - if (t->IsSyncLockSelected()) + if (t->IsSyncLockSelected()) { wxRect syncLockIconRect; mTrackInfo.GetSyncLockIconRect(r, syncLockIconRect); - wxBitmap syncLockBitmap(theTheme.Image(bmpSyncLockIcon)); + wxBitmap syncLockBitmap(theTheme.Image(bmpSyncLockIcon)); // Icon is 12x12 and syncLockIconRect is 16x16. - dc->DrawBitmap(syncLockBitmap, - syncLockIconRect.x + 3, - syncLockIconRect.y + 2, + dc->DrawBitmap(syncLockBitmap, + syncLockIconRect.x + 3, + syncLockIconRect.y + 2, true); } @@ -6098,8 +6098,8 @@ void TrackPanel::DrawOutside(Track * t, wxDC * dc, const wxRect rec, #ifdef USE_MIDI else if (bIsNote) { - // Note tracks do not have text, e.g. "Mono, 44100Hz, 32-bit float", so - // Mute & Solo button goes higher. To preserve existing AudioTrack code, + // Note tracks do not have text, e.g. "Mono, 44100Hz, 32-bit float", so + // Mute & Solo button goes higher. To preserve existing AudioTrack code, // we move the buttons up by pretending track is higher (at lower y) r.y -= 34; r.height += 34; @@ -6116,13 +6116,13 @@ void TrackPanel::DrawOutside(Track * t, wxDC * dc, const wxRect rec, // Draw some lines for MuteSolo buttons: if (r.height > 84) { - AColor::Line(*dc, r.x+48 , r.y+50, r.x+48, r.y + 66); + AColor::Line(*dc, r.x+48 , r.y+50, r.x+48, r.y + 66); // bevel below mute/solo AColor::Line(*dc, r.x, r.y + 66, mTrackInfo.GetTrackInfoWidth(), r.y + 66); } - mTrackInfo.DrawMuteSolo(dc, r, t, + mTrackInfo.DrawMuteSolo(dc, r, t, (captured && mMouseCapture == IsMuting), false, HasSoloButton()); - mTrackInfo.DrawMuteSolo(dc, r, t, + mTrackInfo.DrawMuteSolo(dc, r, t, (captured && mMouseCapture == IsSoloing), true, HasSoloButton()); // place a volume control below channel buttons (this will @@ -6138,7 +6138,7 @@ void TrackPanel::DrawOutside(Track * t, wxDC * dc, const wxRect rec, r.y = r.y + h - gr.y; // ultimately want slider at r.y + h r.height = r.height - h + gr.y; // save for mouse hit detect: - ((NoteTrack *) t)->SetGainPlacementRect(r); + ((NoteTrack *) t)->SetGainPlacementRect(r); mTrackInfo.DrawVelocitySlider(dc, (NoteTrack *) t, r); #endif } @@ -6236,7 +6236,7 @@ void TrackPanel::UpdateTrackVRuler(Track *t) mTrackArtist->UpdateVRuler(t, r); Track *l = t->GetLink(); - if (l) + if (l) { r.height = l->GetHeight() - (kTopInset + 2); mTrackArtist->UpdateVRuler(l, r); @@ -6272,7 +6272,7 @@ void TrackPanel::UpdateVRulerSize() /// selecting and unselecting depending if you are on the start of a /// block or not. -/// \todo Merge related methods, TrackPanel::OnPrevTrack and +/// \todo Merge related methods, TrackPanel::OnPrevTrack and /// TrackPanel::OnNextTrack. void TrackPanel::OnPrevTrack( bool shift ) { @@ -6798,7 +6798,7 @@ void TrackPanel::OnBoundaryMove(bool left, bool boundaryContract) mViewInfo->sel0 = indicator; if(mViewInfo->sel1 < mViewInfo->sel0) mViewInfo->sel1 = mViewInfo->sel0; - } + } else { mViewInfo->sel1 = indicator; @@ -6808,7 +6808,7 @@ void TrackPanel::OnBoundaryMove(bool left, bool boundaryContract) Refresh(false); } else - { + { // BOUNDARY MOVEMENT // Contract selection from the right to the left if( boundaryContract ) @@ -6822,8 +6822,8 @@ void TrackPanel::OnBoundaryMove(bool left, bool boundaryContract) } // Make sure it's visible ScrollIntoView( mViewInfo->sel0 ); - } - else + } + else { // Reduce and constrain right boundary (counter-intuitive) mViewInfo->sel1 -= multiplier / mViewInfo->zoom; @@ -6837,7 +6837,7 @@ void TrackPanel::OnBoundaryMove(bool left, bool boundaryContract) } // BOUNDARY MOVEMENT // Extend selection toward the left - else + else { if (left) { // Expand and constrain left boundary @@ -6865,7 +6865,7 @@ void TrackPanel::OnBoundaryMove(bool left, bool boundaryContract) } } -// Move the cursor forward or backward, while paused or while playing. +// Move the cursor forward or backward, while paused or while playing. // forward=true: Move cursor forward; forward=false: Move cursor backwards // jump=false: Move cursor determined by zoom; jump=true: Use seek times // longjump=false: Use mSeekShort; longjump=true: Use mSeekLong @@ -6903,8 +6903,8 @@ void TrackPanel::OnCursorMove(bool forward, bool jump, bool longjump ) if( token > 0 && gAudioIO->IsStreamActive( token ) ) { gAudioIO->SeekStream(mSeek); - } - else + } + else { // Already in cursor mode? if( mViewInfo->sel0 == mViewInfo->sel1 ) @@ -7143,14 +7143,14 @@ void TrackPanel::OnTrackMute(bool shiftDown, Track *t) { if (!t) { t = GetFocusedTrack(); - if (!t || (t->GetKind() != Track::Wave)) + if (!t || (t->GetKind() != Track::Wave)) return; } GetProject()->HandleTrackMute(t, shiftDown); // Update mixer board, too. - MixerBoard* pMixerBoard = this->GetMixerBoard(); - if (pMixerBoard) + MixerBoard* pMixerBoard = this->GetMixerBoard(); + if (pMixerBoard) { pMixerBoard->UpdateMute(); // Update for all tracks. pMixerBoard->UpdateSolo(); // Update for all tracks. @@ -7163,17 +7163,17 @@ void TrackPanel::OnTrackMute(bool shiftDown, Track *t) void TrackPanel::OnTrackSolo(bool shiftDown, Track *t) { - if (!t) + if (!t) { t = GetFocusedTrack(); - if (!t || (t->GetKind() != Track::Wave)) + if (!t || (t->GetKind() != Track::Wave)) return; } GetProject()->HandleTrackSolo(t, shiftDown); // Update mixer board, too. - MixerBoard* pMixerBoard = this->GetMixerBoard(); - if (pMixerBoard) + MixerBoard* pMixerBoard = this->GetMixerBoard(); + if (pMixerBoard) { pMixerBoard->UpdateMute(); // Update for all tracks. pMixerBoard->UpdateSolo(); // Update for all tracks. @@ -7345,7 +7345,7 @@ void TrackPanel::DrawShadow(Track * /* t */ , wxDC * dc, const wxRect r) } /// Returns the string to be displayed in the track label -/// indicating whether the track is mono, left, right, or +/// indicating whether the track is mono, left, right, or /// stereo and what sample rate it's using. wxString TrackPanel::TrackSubText(Track * t) { @@ -7414,7 +7414,7 @@ void TrackPanel::OnSwapChannels(wxCommandEvent & WXUNUSED(event)) MakeParentPushState(wxString::Format(_("Swapped Channels in '%s'"), mPopupMenuTarget->GetName().c_str()), _("Swap Channels")); - + } /// Split a stereo track into two tracks... @@ -7696,7 +7696,7 @@ void TrackPanel::OnRateChange(wxCommandEvent & event) int TrackPanel::IdOfRate( int rate ) { for(int i=0;iGetName().c_str(), direction.c_str())); shortDesc = (wxString::Format(wxT("%s %s"), shortDesc.c_str(), direction.c_str())); @@ -7931,16 +7931,16 @@ void TrackPanel::OnChangeOctave(wxCommandEvent & event) void TrackPanel::OnSetName(wxCommandEvent & WXUNUSED(event)) { Track *t = mPopupMenuTarget; - if (t) + if (t) { wxString oldName = t->GetName(); - wxString newName = + wxString newName = wxGetTextFromUser(_("Change track name to:"), _("Track Name"), oldName); if (newName != wxT("")) // wxGetTextFromUser returns empty string on Cancel. { t->SetName(newName); - // if we have a linked channel this name should change as well + // if we have a linked channel this name should change as well // (otherwise sort by name and time will crash). if (t->GetLinked()) t->GetLink()->SetName(newName); @@ -8076,7 +8076,7 @@ void TrackPanel::OnSetFont(wxCommandEvent & WXUNUSED(event)) Refresh(false); } -/// Determines which track is under the mouse +/// Determines which track is under the mouse /// @param mouseX - mouse X position. /// @param mouseY - mouse Y position. /// @param label - true iff the X Y position is relative to side-panel with the labels in it. @@ -8118,7 +8118,7 @@ Track *TrackPanel::FindTrack(int mouseX, int mouseY, bool label, bool link, r.height += t->GetHeight(true); } #endif - //Determine whether the mouse is inside + //Determine whether the mouse is inside //the current rectangle. If so, recalculate //the proper dimensions and return. if (r.Contains(mouseX, mouseY)) { @@ -8194,7 +8194,7 @@ wxRect TrackPanel::FindTrackRect(Track * target, bool label) return r; } -int TrackPanel::GetVRulerWidth() const +int TrackPanel::GetVRulerWidth() const { return vrulerSize.x; } @@ -8348,7 +8348,7 @@ void TrackPanel::OnKillFocus(wxFocusEvent & WXUNUSED(event)) /********************************************************************** TrackInfo code is destined to move out of this file. - Code should become a lot cleaner when we have sizers. + Code should become a lot cleaner when we have sizers. **********************************************************************/ @@ -8389,10 +8389,10 @@ TrackInfo::~TrackInfo() delete mPans[i]; } -static const int kTrackInfoWidth = 100; +static const int kTrackInfoWidth = 100; static const int kTrackInfoBtnSize = 16; // widely used dimension, usually height -int TrackInfo::GetTrackInfoWidth() const +int TrackInfo::GetTrackInfoWidth() const { return kTrackInfoWidth; } @@ -8401,7 +8401,7 @@ void TrackInfo::GetCloseBoxRect(const wxRect r, wxRect & dest) const { dest.x = r.x; dest.y = r.y; - dest.width = kTrackInfoBtnSize; + dest.width = kTrackInfoBtnSize; dest.height = kTrackInfoBtnSize; } @@ -8453,7 +8453,7 @@ void TrackInfo::GetMinimizeRect(const wxRect r, wxRect &dest) const dest.y = r.y + r.height - 19; // Width is kTrackInfoWidth less space on left for track select and on right for sync-lock icon. dest.width = kTrackInfoWidth - (2 * kBlankWidth); - dest.height = kTrackInfoBtnSize; + dest.height = kTrackInfoBtnSize; } void TrackInfo::GetSyncLockIconRect(const wxRect r, wxRect &dest) const @@ -8476,10 +8476,10 @@ void TrackInfo::DrawBordersWithin(wxDC* dc, const wxRect r, bool bHasMuteSolo) AColor::Dark(dc, false); // same color as border of toolbars (ToolBar::OnPaint()) // below close box and title bar - AColor::Line(*dc, r.x, r.y + kTrackInfoBtnSize, kTrackInfoWidth, r.y + kTrackInfoBtnSize); + AColor::Line(*dc, r.x, r.y + kTrackInfoBtnSize, kTrackInfoWidth, r.y + kTrackInfoBtnSize); // between close box and title bar - AColor::Line(*dc, r.x + kTrackInfoBtnSize, r.y, r.x + kTrackInfoBtnSize, r.y + kTrackInfoBtnSize); + AColor::Line(*dc, r.x + kTrackInfoBtnSize, r.y, r.x + kTrackInfoBtnSize, r.y + kTrackInfoBtnSize); if( bHasMuteSolo && (r.height > (66+18) )) { @@ -8491,10 +8491,10 @@ void TrackInfo::DrawBordersWithin(wxDC* dc, const wxRect r, bool bHasMuteSolo) // left of and above minimize button wxRect minimizeRect; this->GetMinimizeRect(r, minimizeRect); - AColor::Line(*dc, minimizeRect.x - 1, minimizeRect.y, - minimizeRect.x - 1, minimizeRect.y + minimizeRect.height); - AColor::Line(*dc, minimizeRect.x, minimizeRect.y - 1, - minimizeRect.x + minimizeRect.width, minimizeRect.y - 1); + AColor::Line(*dc, minimizeRect.x - 1, minimizeRect.y, + minimizeRect.x - 1, minimizeRect.y + minimizeRect.height); + AColor::Line(*dc, minimizeRect.x, minimizeRect.y - 1, + minimizeRect.x + minimizeRect.width, minimizeRect.y - 1); } void TrackInfo::DrawBackground(wxDC * dc, const wxRect r, bool bSelected, @@ -8504,20 +8504,20 @@ void TrackInfo::DrawBackground(wxDC * dc, const wxRect r, bool bSelected, wxRect fill = r; fill.width = labelw-4; AColor::MediumTrackInfo(dc, bSelected); - dc->DrawRectangle(fill); + dc->DrawRectangle(fill); // Vaughan, 2010-09-16: No more bevels around controls area. Now only around buttons. //if( bHasMuteSolo ) //{ - // fill=wxRect( r.x+1, r.y+17, vrul-6, 32); + // fill=wxRect( r.x+1, r.y+17, vrul-6, 32); // AColor::BevelTrackInfo( *dc, true, fill ); // - // fill=wxRect( r.x+1, r.y+67, fill.width, r.height-87); + // fill=wxRect( r.x+1, r.y+67, fill.width, r.height-87); // AColor::BevelTrackInfo( *dc, true, fill ); //} //else //{ - // fill=wxRect( r.x+1, r.y+17, vrul-6, r.height-37); + // fill=wxRect( r.x+1, r.y+17, vrul-6, r.height-37); // AColor::BevelTrackInfo( *dc, true, fill ); //} } @@ -8549,7 +8549,7 @@ void TrackInfo::DrawCloseBox(wxDC * dc, const wxRect r, bool down) dc->SetPen(*wxBLACK_PEN); #endif - // Draw the "X" + // Draw the "X" const int s = 6; int ls = bev.x + ((bev.width - s) / 2); @@ -8647,7 +8647,7 @@ void TrackInfo::DrawMuteSolo(wxDC * dc, const wxRect r, Track * t, long textWidth, textHeight; wxString str = (solo) ? /* i18n-hint: This is on a button that will silence this track.*/ - _("Solo") : + _("Solo") : /* i18n-hint: This is on a button that will silence all the other tracks.*/ _("Mute"); diff --git a/src/TrackPanel.h b/src/TrackPanel.h index 5abc164e7..6edb71b9e 100644 --- a/src/TrackPanel.h +++ b/src/TrackPanel.h @@ -80,7 +80,7 @@ class AUDACITY_DLL_API TrackPanelListener { virtual void TP_HandleResize() = 0; }; -// +// // TrackInfo sliders: we keep a pool of sliders, and attach them to tracks as // they come on screen (this helps deal with very large numbers of tracks, esp. // on MSW). @@ -97,9 +97,9 @@ const unsigned int kSliderPageFlip = 80; // and only a worry when there are DLLs using the structures. // LWSliderArray and TrackClipArray are private in TrackInfo, so we will not // access them directly from the DLL. -// TrackClipArray in TrackPanel needs to be handled with care in the derived +// TrackClipArray in TrackPanel needs to be handled with care in the derived // class, but the C4251 warning is no worry in core Audacity. -// wxWidgets doesn't cater to the exact details we need in +// wxWidgets doesn't cater to the exact details we need in // WX_DECLARE_EXPORTED_OBJARRAY to be able to use that for these two arrays. #ifdef _MSC_VER #pragma warning( push ) @@ -306,7 +306,7 @@ class AUDACITY_DLL_API TrackPanel:public wxPanel { // Stretching can drag the left boundary (the right stays fixed), // the right boundary (the left stays fixed), or the center (splits // the selection into two parts: when left part grows, the right - // part shrinks, keeping the leftmost and rightmost boundaries + // part shrinks, keeping the leftmost and rightmost boundaries // fixed. enum StretchEnum { stretchLeft, @@ -403,15 +403,15 @@ class AUDACITY_DLL_API TrackPanel:public wxPanel { virtual void HandleSliders(wxMouseEvent &event, bool pan); - // These *Func methods are used in TrackPanel::HandleLabelClick to set up - // for actual handling in methods called by TrackPanel::OnMouseEvent, and + // These *Func methods are used in TrackPanel::HandleLabelClick to set up + // for actual handling in methods called by TrackPanel::OnMouseEvent, and // to draw button-down states, etc. virtual bool CloseFunc(Track * t, wxRect r, int x, int y); virtual bool PopupFunc(Track * t, wxRect r, int x, int y); - // TrackSelFunc, unlike the other *Func methods, returns true if the click is not - // set up to be handled, but click is on the sync-lock icon or the blank area to - // the left of the minimize button, and we want to pass it forward to be a track select. + // TrackSelFunc, unlike the other *Func methods, returns true if the click is not + // set up to be handled, but click is on the sync-lock icon or the blank area to + // the left of the minimize button, and we want to pass it forward to be a track select. virtual bool TrackSelFunc(Track * t, wxRect r, int x, int y); virtual bool MuteSoloFunc(Track *t, wxRect r, int x, int f, bool solo); @@ -423,7 +423,7 @@ class AUDACITY_DLL_API TrackPanel:public wxPanel { virtual void MakeParentRedrawScrollbars(); - + // AS: Pushing the state preserves state for Undo operations. virtual void MakeParentPushState(wxString desc, wxString shortDesc, int flags = PUSH_AUTOSAVE | PUSH_CALC_SPACE); @@ -519,7 +519,7 @@ protected: //JKC: These two belong in the label track. int mLabelTrackStartXPos; int mLabelTrackStartYPos; - + virtual wxString TrackSubText(Track *t); virtual bool MoveClipToTrack(WaveClip *clip, WaveTrack* dst); @@ -543,7 +543,7 @@ protected: virtual void Notify() { parent->OnTimer(); } TrackPanel *parent; } mTimer; - + // This stores the parts of the screen that get overwritten by the indicator // and cursor @@ -621,7 +621,7 @@ protected: float mDrawingStartSampleValue; // value of last click-down sampleCount mDrawingLastDragSample; // sample of last drag-over float mDrawingLastDragSampleValue; // value of last drag-over - + double PositionToTime(wxInt64 mouseXCoordinate, wxInt64 trackLeftEdge) const; wxInt64 TimeToPosition(double time, diff --git a/src/TrackPanelAx.cpp b/src/TrackPanelAx.cpp index c271e5ada..b0e29ef97 100644 --- a/src/TrackPanelAx.cpp +++ b/src/TrackPanelAx.cpp @@ -309,7 +309,7 @@ wxAccStatus TrackPanelAx::GetName( int childId, wxString* name ) on this track mute is on.*/ *name->Append( _( " Mute On" ) ); } - + if( t->GetSolo() ) { /* i18n-hint: This is for screen reader software and indicates that @@ -442,7 +442,7 @@ wxAccStatus TrackPanelAx::GetValue( int childId, wxString* strValue ) { strValue->Append( _( " Mute On" ) ); } - + if( t->GetSolo() ) { strValue->Append( _( " Solo On" ) ); diff --git a/src/TrackPanelAx.h b/src/TrackPanelAx.h index 951a4587e..08449fada 100644 --- a/src/TrackPanelAx.h +++ b/src/TrackPanelAx.h @@ -102,7 +102,7 @@ public: #endif private: - + int TrackNum( Track *track ); Track *FindTrack( int num ); diff --git a/src/UndoManager.cpp b/src/UndoManager.cpp index e0a0c67e5..bbd826679 100644 --- a/src/UndoManager.cpp +++ b/src/UndoManager.cpp @@ -14,7 +14,7 @@ *//****************************************************************//** \class UndoStackElem -\brief Holds one item with description and time range for the +\brief Holds one item with description and time range for the UndoManager *//*******************************************************************/ @@ -65,7 +65,7 @@ wxLongLong UndoManager::CalculateSpaceUsage(int index) while (wt) { for (it = wt->GetClipIterator(); it; it = it->GetNext()) { blocks = it->GetData()->GetSequenceBlockArray(); - for (i = 0; i < blocks->GetCount(); i++) + for (i = 0; i < blocks->GetCount(); i++) { BlockFile* pBlockFile = blocks->Item(i)->f; if (pBlockFile->GetFileName().FileExists()) @@ -158,7 +158,7 @@ void UndoManager::RemoveStates(int num) saved -= 1; } } - + void UndoManager::ClearStates() { RemoveStates(stack.Count()); @@ -237,7 +237,7 @@ void UndoManager::PushState(TrackList * l, double sel0, double sel1, while (i < stack.Count()) { RemoveStateAt(i); } - + TrackList *tracksCopy = new TrackList(); TrackListIterator iter(l); Track *t = iter.First(); @@ -269,7 +269,7 @@ void UndoManager::PushState(TrackList * l, double sel0, double sel1, TrackList *UndoManager::SetStateTo(unsigned int n, double *sel0, double *sel1) { n -= 1; - + wxASSERT(n < stack.Count()); current = n; @@ -311,7 +311,7 @@ TrackList *UndoManager::Redo(double *sel0, double *sel1) wxASSERT(RedoAvailable()); current++; - + *sel0 = stack[current]->sel0; *sel1 = stack[current]->sel1; diff --git a/src/UndoManager.h b/src/UndoManager.h index b811292c0..67f213fb1 100644 --- a/src/UndoManager.h +++ b/src/UndoManager.h @@ -5,7 +5,7 @@ UndoManager.h Dominic Mazzoni - + After each operation, call UndoManager's PushState, pass it the entire track hierarchy. The UndoManager makes a duplicate of every single track using its Duplicate method, which should @@ -14,7 +14,7 @@ If a minor change is made, for example changing the visual display of a track or changing the selection, you can call - ModifyState, which replaces the current state with the + ModifyState, which replaces the current state with the one you give it, without deleting everything above it. Each action has a long description and a short description @@ -37,10 +37,10 @@ hierarchy. If another PushState is called, the redo information is lost. - Redo() + Redo() UndoAvailable() - + RedoAvailable() **********************************************************************/ @@ -85,7 +85,7 @@ class AUDACITY_DLL_API UndoManager { void ModifyState(TrackList * l, double sel0, double sel1); void ClearStates(); void RemoveStates(int num); // removes the 'num' oldest states - void RemoveStateAt(int n); // removes the n'th state (1 is oldest) + void RemoveStateAt(int n); // removes the n'th state (1 is oldest) unsigned int GetNumStates(); unsigned int GetCurrentState(); @@ -119,10 +119,10 @@ class AUDACITY_DLL_API UndoManager { wxString lastAction; int consolidationCount; - + bool mODChanges; ODLock mODChangesMutex;//mODChanges is accessed from many threads. - + }; #endif diff --git a/src/ViewInfo.h b/src/ViewInfo.h index 320dcdbf9..074618906 100644 --- a/src/ViewInfo.h +++ b/src/ViewInfo.h @@ -38,7 +38,7 @@ struct ViewInfo { wxInt64 sbarH; wxInt64 sbarScreen; wxInt64 sbarTotal; - + // Internal wxScrollbar positions are only int in range, so multiply // the above values with the following member to get the actual // scroll bar positions as reported by the horizontal wxScrollbar's members diff --git a/src/VoiceKey.cpp b/src/VoiceKey.cpp index 68b11d8bf..f2ce8c5c9 100644 --- a/src/VoiceKey.cpp +++ b/src/VoiceKey.cpp @@ -12,8 +12,8 @@ \class VoiceKey \brief -This implements a voice key, detecting either the next "ON" -or "OFF" point +This implements a voice key, detecting either the next "ON" +or "OFF" point *//*******************************************************************/ @@ -41,19 +41,19 @@ VoiceKey::VoiceKey(){ mWindowSize = 0.01; //size of analysis window in seconds - mEnergyMean = .0006; // reasonable initial levels assuming sampling rate of + mEnergyMean = .0006; // reasonable initial levels assuming sampling rate of mEnergySD = .0002; // 44100 hertz - mSignChangesMean = .08; + mSignChangesMean = .08; mSignChangesSD= .02; mDirectionChangesMean = .25; mDirectionChangesSD = .2; AdjustThreshold(2); - mSilentWindowSize = .05; //Amount of time (in seconds) below threshold to call it silence + mSilentWindowSize = .05; //Amount of time (in seconds) below threshold to call it silence mSignalWindowSize = .05; //Amount of time (in seconds) above threshold to call it signal - + mUseEnergy = true; mUseSignChangesLow = false; mUseSignChangesHigh = false; @@ -74,7 +74,7 @@ VoiceKey::~VoiceKey(){ // This operates in two phases: // First, you take chunks of samples that are WindowSize big. // If you have a run of them where something passes the threshold for SignalWindowSize seconds, -// you return to the last empty block and scan forward one sample at a time until you find the +// you return to the last empty block and scan forward one sample at a time until you find the // starting point of the speech. @@ -85,10 +85,10 @@ sampleCount VoiceKey::OnForward (WaveTrack & t, sampleCount start, sampleCount l if((mWindowSize) >= len+10){ - /* i18n-hint: Voice key is an experimental/incomplete feature that + /* i18n-hint: Voice key is an experimental/incomplete feature that is used to navigate in vocal recordings, to move forwards and backwards by words. So 'key' is being used in the sense of an index. - This error message means that you've selected too short + This error message means that you've selected too short a region of audio to be able to use this feature.*/ wxMessageBox(_("Selection is too small to use voice key.")); return start; @@ -110,7 +110,7 @@ sampleCount VoiceKey::OnForward (WaveTrack & t, sampleCount start, sampleCount l //This loop goes through the selection a block at a time. If a long enough run - //of above-threshold blocks occur, we return to the last sub-threshold block and + //of above-threshold blocks occur, we return to the last sub-threshold block and //go through one sample at a time. //If there are fewer than 10 samples leftover, don't bother. @@ -155,22 +155,22 @@ sampleCount VoiceKey::OnForward (WaveTrack & t, sampleCount start, sampleCount l //Initialize these trend markers atrend and ztrend. They keep track of the - //up/down trends at the start and end of the evaluation window. - int atrend = sgn(buffer[1]-buffer[0]); + //up/down trends at the start and end of the evaluation window. + int atrend = sgn(buffer[1]-buffer[0]); int ztrend = sgn(buffer[WindowSizeInt+1]-buffer[WindowSizeInt]); double erg=0; double sc=0; double dc=0; - + //Get initial test statistic values. if(mUseEnergy) - erg = TestEnergy(t, lastsubthresholdsample, WindowSizeInt); - + erg = TestEnergy(t, lastsubthresholdsample, WindowSizeInt); + if(mUseSignChangesLow || mUseSignChangesHigh) sc = TestSignChanges(t,lastsubthresholdsample, WindowSizeInt); - + if(mUseDirectionChangesLow || mUseDirectionChangesHigh) dc = TestDirectionChanges(t,lastsubthresholdsample,WindowSizeInt); @@ -205,18 +205,18 @@ sampleCount VoiceKey::OnForward (WaveTrack & t, sampleCount start, sampleCount l { TestDirectionChangesUpdate(dc,WindowSizeInt,atrend,buffer[i],buffer[i+1],ztrend,buffer[i+WindowSizeInt],buffer[i+WindowSizeInt+1]); tests += (int)(dc < mThresholdDirectionChangesLower); - testThreshold++; + testThreshold++; } - + if(mUseDirectionChangesHigh) { TestDirectionChangesUpdate(dc,WindowSizeInt,atrend,buffer[i],buffer[i+1],ztrend,buffer[i+WindowSizeInt],buffer[i+WindowSizeInt+1]); tests += (int)(dc > mThresholdDirectionChangesUpper); - testThreshold++; + testThreshold++; } - - - + + + if(tests >= testThreshold) { //Finish off on the first hit break; @@ -260,7 +260,7 @@ sampleCount VoiceKey::OnBackward (WaveTrack & t, sampleCount end, sampleCount le //This loop goes through the selection a block at a time in reverse order. If a long enough run - //of above-threshold blocks occur, we return to the last sub-threshold block and + //of above-threshold blocks occur, we return to the last sub-threshold block and //go through one sample at a time. //If there are fewer than 10 samples leftover, don't bother. for(i = end - WindowSizeInt; samplesleft >=10; i-=(WindowSizeInt-1) , samplesleft -= (WindowSizeInt -1)){ @@ -273,8 +273,8 @@ sampleCount VoiceKey::OnBackward (WaveTrack & t, sampleCount end, sampleCount le blocksize = WindowSizeInt; } - - //Test whether we are above threshold + + //Test whether we are above threshold if(AboveThreshold(t,i,blocksize)) { blockruns++; //Hit @@ -304,8 +304,8 @@ sampleCount VoiceKey::OnBackward (WaveTrack & t, sampleCount end, sampleCount le t.Get((samplePtr)buffer, floatSample, lastsubthresholdsample-samplesleft,samplesleft); //Initialize these trend markers atrend and ztrend. They keep track of the - //up/down trends at the start and end of the evaluation window. - int atrend = sgn(buffer[samplesleft - 2]-buffer[samplesleft - 1]); + //up/down trends at the start and end of the evaluation window. + int atrend = sgn(buffer[samplesleft - 2]-buffer[samplesleft - 1]); int ztrend = sgn(buffer[samplesleft - WindowSizeInt-2]-buffer[samplesleft - WindowSizeInt-2]); double erg=0; @@ -314,7 +314,7 @@ sampleCount VoiceKey::OnBackward (WaveTrack & t, sampleCount end, sampleCount le //Get initial test statistic values. if(mUseEnergy) - erg = TestEnergy(t, lastsubthresholdsample, WindowSizeInt); + erg = TestEnergy(t, lastsubthresholdsample, WindowSizeInt); if(mUseSignChangesLow || mUseSignChangesHigh) sc = TestSignChanges(t,lastsubthresholdsample, WindowSizeInt); if(mUseDirectionChangesLow || mUseDirectionChangesHigh) @@ -347,13 +347,13 @@ sampleCount VoiceKey::OnBackward (WaveTrack & t, sampleCount end, sampleCount le { TestDirectionChangesUpdate(dc,WindowSizeInt,atrend,buffer[i],buffer[i+1],ztrend,buffer[i+WindowSizeInt],buffer[i+WindowSizeInt+1]); tests += (int)(dc < mThresholdDirectionChangesLower); - testThreshold++; + testThreshold++; } if(mUseDirectionChangesHigh) { TestDirectionChangesUpdate(dc,WindowSizeInt,atrend,buffer[i],buffer[i+1],ztrend,buffer[i+WindowSizeInt],buffer[i+WindowSizeInt+1]); tests += (int)(dc > mThresholdDirectionChangesUpper); - testThreshold++; + testThreshold++; } if(tests >= testThreshold) @@ -399,7 +399,7 @@ sampleCount VoiceKey::OffForward (WaveTrack & t, sampleCount start, sampleCount int blocksize; //The final block may be smaller than WindowSizeInt, so use this //This loop goes through the selection a block at a time. If a long enough run - //of above-threshold blocks occur, we return to the last sub-threshold block and + //of above-threshold blocks occur, we return to the last sub-threshold block and //go through one sample at a time. //If there are fewer than 10 samples leftover, don't bother. for(i = start; samplesleft >=10; i+=(WindowSizeInt-1) , samplesleft -= (WindowSizeInt -1)){ @@ -421,13 +421,13 @@ sampleCount VoiceKey::OffForward (WaveTrack & t, sampleCount start, sampleCount blockruns=0; //Above threshold--start over lastsubthresholdsample = i; } - + //If the blockrun is long enough, break out of the loop early: if(blockruns > mSilentWindowSize/mWindowSize) break; - + } - + //Now, if we broke out early (samplesleft > 10), go back to the lastsubthresholdsample and look more carefully if(samplesleft > 10){ @@ -442,18 +442,18 @@ sampleCount VoiceKey::OffForward (WaveTrack & t, sampleCount start, sampleCount t.Get((samplePtr)buffer, floatSample, lastsubthresholdsample,samplesleft); //Initialize these trend markers atrend and ztrend. They keep track of the - //up/down trends at the start and end of the evaluation window. - int atrend = sgn(buffer[1]-buffer[0]); + //up/down trends at the start and end of the evaluation window. + int atrend = sgn(buffer[1]-buffer[0]); int ztrend = sgn(buffer[WindowSizeInt+1]-buffer[WindowSizeInt]); double erg=0; double sc=0; double dc=0; - + //Get initial test statistic values. if(mUseEnergy) - erg = TestEnergy(t, lastsubthresholdsample, WindowSizeInt); + erg = TestEnergy(t, lastsubthresholdsample, WindowSizeInt); if(mUseSignChangesLow || mUseSignChangesHigh) sc = TestSignChanges(t,lastsubthresholdsample, WindowSizeInt); if(mUseDirectionChangesLow || mUseDirectionChangesHigh) @@ -486,13 +486,13 @@ sampleCount VoiceKey::OffForward (WaveTrack & t, sampleCount start, sampleCount { TestDirectionChangesUpdate(dc,WindowSizeInt,atrend,buffer[i],buffer[i+1],ztrend,buffer[i+WindowSizeInt],buffer[i+WindowSizeInt+1]); tests += (int)(dc < mThresholdDirectionChangesLower); - testThreshold++; + testThreshold++; } if(mUseDirectionChangesHigh) { TestDirectionChangesUpdate(dc,WindowSizeInt,atrend,buffer[i],buffer[i+1],ztrend,buffer[i+WindowSizeInt],buffer[i+WindowSizeInt+1]); tests += (int)(dc > mThresholdDirectionChangesUpper); - testThreshold++; + testThreshold++; } if(tests < testThreshold) @@ -538,7 +538,7 @@ sampleCount VoiceKey::OffBackward (WaveTrack & t, sampleCount end, sampleCount l int blocksize; //The final block may be smaller than WindowSizeInt, so use this //This loop goes through the selection a block at a time in reverse order. If a long enough run - //of above-threshold blocks occur, we return to the last sub-threshold block and + //of above-threshold blocks occur, we return to the last sub-threshold block and //go through one sample at a time. //If there are fewer than 10 samples leftover, don't bother. for(i = end - WindowSizeInt; samplesleft >=10; i-=(WindowSizeInt-1) , samplesleft -= (WindowSizeInt -1)){ @@ -550,7 +550,7 @@ sampleCount VoiceKey::OffBackward (WaveTrack & t, sampleCount end, sampleCount l else{ blocksize = WindowSizeInt; } - + if(!AboveThreshold(t,i,blocksize)) { @@ -582,8 +582,8 @@ sampleCount VoiceKey::OffBackward (WaveTrack & t, sampleCount end, sampleCount l t.Get((samplePtr)buffer, floatSample, lastsubthresholdsample-samplesleft,samplesleft); //Initialize these trend markers atrend and ztrend. They keep track of the - //up/down trends at the start and end of the evaluation window. - int atrend = sgn(buffer[samplesleft - 2]-buffer[samplesleft - 1]); + //up/down trends at the start and end of the evaluation window. + int atrend = sgn(buffer[samplesleft - 2]-buffer[samplesleft - 1]); int ztrend = sgn(buffer[samplesleft - WindowSizeInt-2]-buffer[samplesleft - WindowSizeInt-2]); double erg=0; @@ -591,7 +591,7 @@ sampleCount VoiceKey::OffBackward (WaveTrack & t, sampleCount end, sampleCount l double dc=0; //Get initial test statistic values. if(mUseEnergy) - erg = TestEnergy(t, lastsubthresholdsample, WindowSizeInt); + erg = TestEnergy(t, lastsubthresholdsample, WindowSizeInt); if(mUseSignChangesLow || mUseSignChangesHigh) sc = TestSignChanges(t,lastsubthresholdsample, WindowSizeInt); if(mUseDirectionChangesLow || mUseDirectionChangesHigh) @@ -605,7 +605,7 @@ sampleCount VoiceKey::OffBackward (WaveTrack & t, sampleCount end, sampleCount l //Update the test statistics if(mUseEnergy) { - TestEnergyUpdate(erg, WindowSizeInt,buffer[i],buffer[i+WindowSizeInt+1]); + TestEnergyUpdate(erg, WindowSizeInt,buffer[i],buffer[i+WindowSizeInt+1]); tests += (int)(erg>mThresholdEnergy); testThreshold++; } @@ -625,13 +625,13 @@ sampleCount VoiceKey::OffBackward (WaveTrack & t, sampleCount end, sampleCount l { TestDirectionChangesUpdate(dc,WindowSizeInt,atrend,buffer[i],buffer[i+1],ztrend,buffer[i+WindowSizeInt],buffer[i+WindowSizeInt+1]); tests += (int)(dc < mThresholdDirectionChangesLower); - testThreshold++; + testThreshold++; } if(mUseDirectionChangesHigh) { TestDirectionChangesUpdate(dc,WindowSizeInt,atrend,buffer[i],buffer[i+1],ztrend,buffer[i+WindowSizeInt],buffer[i+WindowSizeInt+1]); tests += (int)(dc > mThresholdDirectionChangesUpper); - testThreshold++; + testThreshold++; } @@ -667,7 +667,7 @@ bool VoiceKey::AboveThreshold(WaveTrack & t, sampleCount start, sampleCount len) if(mUseEnergy) { testThreshold++; - erg = TestEnergy(t, start,len); + erg = TestEnergy(t, start,len); tests +=(int)(erg > mThresholdEnergy); #if 0 std::cout << "Energy: " << erg << " " <= testThreshold); @@ -735,9 +735,9 @@ void VoiceKey::AdjustThreshold(double t){ //This 'calibrates' the voicekey to noise void VoiceKey::CalibrateNoise(WaveTrack & t, sampleCount start, sampleCount len){ - //To calibrate the noise, we need to scan the sample block just like in the voicekey and + //To calibrate the noise, we need to scan the sample block just like in the voicekey and //calculate the mean and standard deviation of the test statistics. - //Then, we set the BaselineThreshold to be one + //Then, we set the BaselineThreshold to be one wxBusyCursor busy; @@ -756,18 +756,18 @@ void VoiceKey::CalibrateNoise(WaveTrack & t, sampleCount start, sampleCount len) //Get the first test statistics - //Calibrate all of the statistic, because they might be + //Calibrate all of the statistic, because they might be //changed later. // if(mUseEnergy) - erg = TestEnergy(t, start, WindowSizeInt); - + erg = TestEnergy(t, start, WindowSizeInt); + // if(mUseSignChanges) sc = TestSignChanges(t,start, WindowSizeInt); - + // if(mUseDirectionChanges) dc = TestDirectionChanges(t,start,WindowSizeInt); - + sumerg =0.0; sumerg2 = 0.0; sumsc =0.0; @@ -784,13 +784,13 @@ void VoiceKey::CalibrateNoise(WaveTrack & t, sampleCount start, sampleCount len) for(i = start; samplesleft >=10 ; i += (WindowSizeInt -1), samplesleft -= (WindowSizeInt -1) ) { - //Take samples chunk-by-chunk. - //Normally, this should be in WindowSizeInt chunks, but at the end (if there are more than 10 + //Take samples chunk-by-chunk. + //Normally, this should be in WindowSizeInt chunks, but at the end (if there are more than 10 //samples left) take a chunk that eats the rest of the samples. - + samples++; //Increment the number of samples we have if(samplesleft < (int)WindowSizeInt) - { + { blocksize = samplesleft; } else @@ -798,15 +798,15 @@ void VoiceKey::CalibrateNoise(WaveTrack & t, sampleCount start, sampleCount len) blocksize = WindowSizeInt; } - erg = TestEnergy(t, i, blocksize); + erg = TestEnergy(t, i, blocksize); sumerg +=(double)erg; sumerg2 += pow((double)erg,2); - + sc = TestSignChanges(t,i, blocksize); sumsc += (double)sc; sumsc2 += pow((double)sc,2); - - + + dc = TestDirectionChanges(t,i,blocksize); sumdc += (double)dc; sumdc2 += pow((double)dc,2); @@ -814,10 +814,10 @@ void VoiceKey::CalibrateNoise(WaveTrack & t, sampleCount start, sampleCount len) mEnergyMean = sumerg / samples; mEnergySD = sqrt(sumerg2/samples - mEnergyMean*mEnergyMean); - + mSignChangesMean = sumsc / samples; mSignChangesSD = sqrt(sumsc2 / samples - mSignChangesMean * mSignChangesMean); - + mDirectionChangesMean = sumdc / samples; mDirectionChangesSD =sqrt(sumdc2 / samples - mDirectionChangesMean * mDirectionChangesMean) ; @@ -826,8 +826,8 @@ void VoiceKey::CalibrateNoise(WaveTrack & t, sampleCount start, sampleCount len) text += wxString::Format(_("Energy -- mean: %1.4f sd: (%1.4f)\n"),mEnergyMean,mEnergySD); text+= wxString::Format(_("Sign Changes -- mean: %1.4f sd: (%1.4f)\n"),mSignChangesMean,mSignChangesSD); text+= wxString::Format(_("Direction Changes -- mean: %1.4f sd: (%1.4f)\n"),mDirectionChangesMean,mDirectionChangesSD); - wxMessageDialog * stats = new wxMessageDialog(NULL, text, - wxT("Calibration Complete"), + wxMessageDialog * stats = new wxMessageDialog(NULL, text, + wxT("Calibration Complete"), wxOK | wxICON_INFORMATION, wxPoint(-1,-1)); stats->ShowModal(); @@ -862,23 +862,23 @@ double VoiceKey::TestEnergy (WaveTrack & t, sampleCount start, sampleCount len) blockSize = len; float *buffer = new float[blockSize]; //Get a sampling buffer - while(len > 0) + while(len > 0) { sampleCount block = t.GetBestBlockSize(s); //Figure out how much to grab if(block > len) block = len; //Don't grab too much! - + t.Get((samplePtr)buffer,floatSample, s,block); //grab the block; - + //Now, go through the block and calculate energy for(int i = 0; i< block; i++) { sum += buffer[i]*buffer[i]; } - + len -= block; s += block; } - + delete [] buffer; return sum / originalLen; } @@ -896,7 +896,7 @@ void VoiceKey::TestEnergyUpdate (double & prevErg, int len, const sampleFormat & double VoiceKey::TestSignChanges(WaveTrack & t, sampleCount start, sampleCount len) { - + sampleCount s = start; //Keep track of start sampleCount originalLen = len; //Keep track of the length of block to process (its not the length of t) sampleCount blockSize = t.GetMaxBlockSize(); //Determine size of sampling buffer @@ -915,22 +915,22 @@ double VoiceKey::TestSignChanges(WaveTrack & t, sampleCount start, sampleCount l t.Get((samplePtr)buffer,floatSample, s,block); //grab the block; - if (len == originalLen) + if (len == originalLen) { //The first time through, set stuff up special. currentsign = sgn(buffer[0]); } //Now, go through the block and calculate zero crossings - + for(int i = 0; i< block; i++) { - if( sgn(buffer[i]) != currentsign) + if( sgn(buffer[i]) != currentsign) { currentsign = sgn(buffer[i]); signchanges++; } - + } len -= block; s += block; diff --git a/src/WaveClip.cpp b/src/WaveClip.cpp index 3c839dbbe..289b4c977 100644 --- a/src/WaveClip.cpp +++ b/src/WaveClip.cpp @@ -62,7 +62,7 @@ public: delete[] rms; delete[] bl; delete[] where; - + ClearInvalidRegions(); } @@ -77,17 +77,17 @@ public: float *rms; int *bl; int numODPixels; - + class InvalidRegion { public: InvalidRegion(int s, int e):start(s),end(e){} //start and end pixel count. (not samples) - int start; - int end; + int start; + int end; }; - - + + //Thread safe call to add a new region to invalidate. If it overlaps with other regions, it unions the them. void AddInvalidRegion(sampleCount sampleStart, sampleCount sampleEnd) { @@ -95,31 +95,31 @@ public: if(pps ==0) return; double samplesPerPixel = rate/pps; - //rate is SR, start is first time of the waveform (in second) on cache + //rate is SR, start is first time of the waveform (in second) on cache long invalStart = (sampleStart - start*rate)/samplesPerPixel ; - + long invalEnd = (sampleEnd - start*rate)/samplesPerPixel +1; //we should cover the end.. - + //if they are both off the cache boundary in the same direction, the cache is missed, //so we are safe, and don't need to track this one. if((invalStart<0 && invalEnd <0) || (invalStart>=len && invalEnd >= len)) return; - + //in all other cases, we need to clip the boundries so they make sense with the cache. //for some reason, the cache is set up to access up to array[len], not array[len-1] if(invalStart <0) invalStart =0; else if(invalStart > len) invalStart = len; - + if(invalEnd <0) invalEnd =0; else if(invalEnd > len) invalEnd = len; - - + + mRegionsMutex.Lock(); - + //look thru the region array for a place to insert. We could make this more spiffy than a linear search //but right now it is not needed since there will usually only be one region (which grows) for OD loading. bool added=false; @@ -128,8 +128,8 @@ public: for(size_t i=0;istart <= invalEnd+1 - && mRegions[i]->end >= invalStart-1) + if(mRegions[i]->start <= invalEnd+1 + && mRegions[i]->end >= invalStart-1) { //take the union region if(mRegions[i]->start > invalStart) @@ -139,7 +139,7 @@ public: added=true; break; } - + //this bit doesn't make sense because it assumes we add in order - now we go backwards after the initial OD finishes // //this array is sorted by start/end points and has no overlaps. If we've passed all possible intersections, insert. The array will remain sorted. // if(mRegions[i]->end < invalStart) @@ -150,53 +150,53 @@ public: // } } } - + if(!added) { InvalidRegion* newRegion = new InvalidRegion(invalStart,invalEnd); mRegions.insert(mRegions.begin(),newRegion); } - - + + //now we must go and patch up all the regions that overlap. Overlapping regions will be adjacent. for(size_t i=1;istart <= mRegions[i-1]->end+1 - && mRegions[i]->end >= mRegions[i-1]->start-1) + if(mRegions[i]->start <= mRegions[i-1]->end+1 + && mRegions[i]->end >= mRegions[i-1]->start-1) { //take the union region if(mRegions[i]->start > mRegions[i-1]->start) mRegions[i]->start = mRegions[i-1]->start; if(mRegions[i]->end < mRegions[i-1]->end) mRegions[i]->end = mRegions[i-1]->end; - + //now we must delete the previous region delete mRegions[i-1]; mRegions.erase(mRegions.begin()+i-1); //musn't forget to reset cursor i--; } - + //if we are past the end of the region we added, we are past the area of regions that might be oversecting. if(mRegions[i]->start > invalEnd) { break; } } - - + + mRegionsMutex.Unlock(); } - + //lock before calling these in a section. unlock after finished. int GetNumInvalidRegions(){return mRegions.size();} int GetInvalidRegionStart(int i){return mRegions[i]->start;} int GetInvalidRegionEnd(int i){return mRegions[i]->end;} - + void LockInvalidRegions(){mRegionsMutex.Lock();} void UnlockInvalidRegions(){mRegionsMutex.Unlock();} - + void ClearInvalidRegions() { for(size_t i =0;i mRegions; ODLock mRegionsMutex; - + }; class SpecCache { @@ -336,7 +336,7 @@ WaveClip::WaveClip(WaveClip& orig, DirManager *projDirManager) for (WaveClipList::compatibility_iterator it=orig.mCutLines.GetFirst(); it; it=it->GetNext()) mCutLines.Append(new WaveClip(*it->GetData(), projDirManager)); - + mAppendBuffer = NULL; mAppendBufferLen = 0; mDirty = 0; @@ -346,7 +346,7 @@ WaveClip::WaveClip(WaveClip& orig, DirManager *projDirManager) WaveClip::~WaveClip() { delete mSequence; - + delete mEnvelope; mEnvelope = NULL; @@ -396,11 +396,11 @@ double WaveClip::GetStartTime() const double WaveClip::GetEndTime() const { sampleCount numSamples = mSequence->GetNumSamples(); - + double maxLen = mOffset + double(numSamples+mAppendBufferLen)/mRate; // JS: calculated value is not the length; // it is a maximum value and can be negative; no clipping to 0 - + return maxLen; } @@ -448,7 +448,7 @@ void WaveClip::AddInvalidRegion(long startSample, long endSample) mWaveCacheMutex.Lock(); if(mWaveCache!=NULL) mWaveCache->AddInvalidRegion(startSample,endSample); - mWaveCacheMutex.Unlock(); + mWaveCacheMutex.Unlock(); } // @@ -462,28 +462,28 @@ bool WaveClip::GetWaveDisplay(float *min, float *max, float *rms,int* bl, double pixelsPerSecond, bool &isLoadingOD) { mWaveCacheMutex.Lock(); - - + + if (mWaveCache && mWaveCache->dirty == mDirty && mWaveCache->start == t0 && mWaveCache->len >= numPixels && mWaveCache->pps == pixelsPerSecond) { - + //check for invalid regions, and make the bottom if an else if. - //invalid regions are kept in a sorted array. + //invalid regions are kept in a sorted array. for(int i=0;iGetNumInvalidRegions();i++) - { + { int invStart; invStart = mWaveCache->GetInvalidRegionStart(i); int invEnd; invEnd = mWaveCache->GetInvalidRegionEnd(i); - + int regionODPixels; regionODPixels =0; int regionODPixelsAfter; regionODPixelsAfter =0; - //before check number of ODPixels + //before check number of ODPixels for(int j=invStart;jbl[j]<0) @@ -496,7 +496,7 @@ bool WaveClip::GetWaveDisplay(float *min, float *max, float *rms,int* bl, invEnd-invStart, &mWaveCache->where[invStart], mRate / pixelsPerSecond); - //after check number of ODPixels + //after check number of ODPixels for(int j=invStart;jbl[j]<0) @@ -506,7 +506,7 @@ bool WaveClip::GetWaveDisplay(float *min, float *max, float *rms,int* bl, mWaveCache->numODPixels -= (regionODPixels - regionODPixelsAfter); } mWaveCache->ClearInvalidRegions(); - + memcpy(min, mWaveCache->min, numPixels*sizeof(float)); memcpy(max, mWaveCache->max, numPixels*sizeof(float)); @@ -550,17 +550,17 @@ bool WaveClip::GetWaveDisplay(float *min, float *max, float *rms,int* bl, //now we are assuming the entire range is covered by the old cache and reducing s1/s0 as we find out otherwise. s0 = mWaveCache->where[mWaveCache->len]; //mchinen:s0 is the min sample covered up to by the wave cache. will shrink if old doen't overlap - s1 = mWaveCache->where[0]; //mchinen - same, but the maximum sample covered. + s1 = mWaveCache->where[0]; //mchinen - same, but the maximum sample covered. p0 = mWaveCache->len; p1 = 0; //check for invalid regions, and make the bottom if an else if. - //invalid regions are keep in a sorted array. - //TODO:integrate into below for loop so that we only load inval regions if - //necessary. (usually is the case, so no rush.) + //invalid regions are keep in a sorted array. + //TODO:integrate into below for loop so that we only load inval regions if + //necessary. (usually is the case, so no rush.) //also, we should be updating the NEW cache, but here we are patching the old one up. for(int i=0;iGetNumInvalidRegions();i++) - { + { int invStart; invStart = oldCache->GetInvalidRegionStart(i); int invEnd; @@ -574,16 +574,16 @@ bool WaveClip::GetWaveDisplay(float *min, float *max, float *rms,int* bl, mRate / pixelsPerSecond); } oldCache->ClearInvalidRegions(); - + for (x = 0; x < mWaveCache->len; x++) { - - - - //below is regular cache access. + + + + //below is regular cache access. if (mWaveCache->where[x] >= oldCache->where[0] && mWaveCache->where[x] <= oldCache->where[oldCache->len - 1]) { - + //if we hit an invalid region, load it up. int ox = @@ -620,7 +620,7 @@ bool WaveClip::GetWaveDisplay(float *min, float *max, float *rms,int* bl, if (mWaveCache->where[a+1] > numSamples) break; - //compute the values that are outside the overlap from scratch. + //compute the values that are outside the overlap from scratch. if (a < p1) { int i; @@ -668,7 +668,7 @@ bool WaveClip::GetWaveDisplay(float *min, float *max, float *rms,int* bl, mWaveCache->min[i] = min; mWaveCache->max[i] = max; mWaveCache->rms[i] = (float)sqrt(sumsq / len); - mWaveCache->bl[i] = 1; //for now just fake it. + mWaveCache->bl[i] = 1; //for now just fake it. if (seqFormat != floatSample) delete[] b; @@ -708,7 +708,7 @@ bool WaveClip::GetWaveDisplay(float *min, float *max, float *rms,int* bl, memcpy(rms, mWaveCache->rms, numPixels*sizeof(float)); memcpy(bl, mWaveCache->bl, numPixels*sizeof(int)); memcpy(where, mWaveCache->where, (numPixels+1)*sizeof(sampleCount)); - + //find the number of OD pixels - the only way to do this is by recounting since we've lost some old cache. mWaveCache->numODPixels = 0; for(int j=0;jlen;j++) @@ -1039,7 +1039,7 @@ bool WaveClip::Append(samplePtr buffer, sampleFormat format, XMLWriter* blockFileLog /*=NULL*/) { //wxLogDebug(wxT("Append: len=%i"), len); - + sampleCount maxBlockSize = mSequence->GetMaxBlockSize(); sampleCount blockSize = mSequence->GetIdealAppendLen(); sampleFormat seqFormat = mSequence->GetSampleFormat(); @@ -1140,14 +1140,14 @@ bool WaveClip::HandleXMLTag(const wxChar *tag, const wxChar **attrs) { const wxChar *attr = *attrs++; const wxChar *value = *attrs++; - + if (!value) break; - + const wxString strValue = value; if (!wxStrcmp(attr, wxT("offset"))) { - if (!XMLValueChecker::IsGoodString(strValue) || + if (!XMLValueChecker::IsGoodString(strValue) || !Internat::CompatibleToDouble(strValue, &dblValue)) return false; SetOffset(dblValue); @@ -1256,7 +1256,7 @@ bool WaveClip::Paste(double t0, WaveClip* other) mEnvelope->Paste((double)s0/mRate + mOffset, pastedClip->mEnvelope); mEnvelope->RemoveUnneededPoints(); OffsetCutLines(t0, pastedClip->GetEndTime() - pastedClip->GetStartTime()); - + // Paste cut lines contained in pasted clip for (WaveClipList::compatibility_iterator it = pastedClip->mCutLines.GetFirst(); it; it=it->GetNext()) { @@ -1266,10 +1266,10 @@ bool WaveClip::Paste(double t0, WaveClip* other) newCutLine->Offset(t0 - mOffset); mCutLines.Append(newCutLine); } - + result = true; } - + if (clipNeedsResampling) { // Clip was constructed as a copy, so delete it @@ -1284,7 +1284,7 @@ bool WaveClip::InsertSilence(double t, double len) sampleCount s0; TimeToSamplesClip(t, &s0); sampleCount slen = (sampleCount)floor(len * mRate + 0.5); - + if (!GetSequence()->InsertSilence(s0, slen)) { wxASSERT(false); @@ -1293,7 +1293,7 @@ bool WaveClip::InsertSilence(double t, double len) OffsetCutLines(t, len); GetEnvelope()->InsertSpace(t, len); MarkChanged(); - + return true; } @@ -1360,7 +1360,7 @@ bool WaveClip::ClearAndAddCutLine(double t0, double t1) { if (t0 > GetEndTime() || t1 < GetStartTime()) return true; // time out of bounds - + WaveClip *newClip = new WaveClip(mSequence->GetDirManager(), mSequence->GetSampleFormat(), mRate); @@ -1394,13 +1394,13 @@ bool WaveClip::ClearAndAddCutLine(double t0, double t1) clip->Offset(clip_t0-clip_t1); } } - + // Clear actual audio data sampleCount s0, s1; TimeToSamplesClip(t0, &s0); TimeToSamplesClip(t1, &s1); - + if (GetSequence()->Delete(s0, s1-s0)) { // Collapse envelope @@ -1435,7 +1435,7 @@ bool WaveClip::FindCutLine(double cutLinePosition, return true; } } - + return false; } @@ -1527,7 +1527,7 @@ bool WaveClip::Resample(int rate, ProgressDialog *progress) double factor = (double)rate / (double)mRate; ::Resample* resample = new ::Resample(true, factor, factor); // constant rate resampling - + int bufsize = 65536; float* inBuffer = new float[bufsize]; float* outBuffer = new float[bufsize]; @@ -1538,7 +1538,7 @@ bool WaveClip::Resample(int rate, ProgressDialog *progress) Sequence* newSequence = new Sequence(mSequence->GetDirManager(), mSequence->GetSampleFormat()); - + /** * We want to keep going as long as we have something to feed the resampler * with OR as long as the resampler spews out samples (which could continue @@ -1549,21 +1549,21 @@ bool WaveClip::Resample(int rate, ProgressDialog *progress) int inLen = numSamples - pos; if (inLen > bufsize) inLen = bufsize; - + bool isLast = ((pos + inLen) == numSamples); - + if (!mSequence->Get((samplePtr)inBuffer, floatSample, pos, inLen)) { error = true; break; } - + int inBufferUsed = 0; outGenerated = resample->Process(factor, inBuffer, inLen, isLast, &inBufferUsed, outBuffer, bufsize); - + pos += inBufferUsed; - + if (outGenerated < 0) { error = true; @@ -1587,11 +1587,11 @@ bool WaveClip::Resample(int rate, ProgressDialog *progress) } } } - + delete[] inBuffer; delete[] outBuffer; delete resample; - + if (error) { delete newSequence; diff --git a/src/WaveClip.h b/src/WaveClip.h index 8554363e4..22c2c8383 100644 --- a/src/WaveClip.h +++ b/src/WaveClip.h @@ -61,16 +61,16 @@ class AUDACITY_DLL_API WaveClip : public XMLTagHandler { private: // It is an error to copy a WaveClip without specifying the DirManager. - // We define these break-inducing single-arg methods so that - // if some developer makes the mistake of calling a single-arg copy - // constructor rather than the one below (that requires a DirManager*), - // rather than it going to C++-generated default copy constructor, + // We define these break-inducing single-arg methods so that + // if some developer makes the mistake of calling a single-arg copy + // constructor rather than the one below (that requires a DirManager*), + // rather than it going to C++-generated default copy constructor, // it goes here and the error is made clear to that developer. WaveClip(const WaveClip&) { wxFAIL_MSG(wxT("It is an error to copy a WaveClip without specifying the DirManager.")); }; - WaveClip& operator=(const WaveClip& orig) + WaveClip& operator=(const WaveClip& orig) { WaveClip bogus(orig); return *this; @@ -91,14 +91,14 @@ public: void TimeToSamplesClip(double t0, sampleCount *s0) const; int GetRate() const { return mRate; } - + // Set rate without resampling. This will change the length of the clip void SetRate(int rate); - + // Resample clip. This also will set the rate, but without changing // the length of the clip bool Resample(int rate, ProgressDialog *progress = NULL); - + void SetOffset(double offset); double GetOffset() const { return mOffset; } void Offset(double delta) { SetOffset(GetOffset() + delta); } @@ -119,7 +119,7 @@ public: sampleCount start, sampleCount len) const; bool SetSamples(samplePtr buffer, sampleFormat format, sampleCount start, sampleCount len); - + Envelope* GetEnvelope() { return mEnvelope; } BlockArray* GetSequenceBlockArray() { return mSequence->GetBlockArray(); } @@ -167,7 +167,7 @@ public: bool AppendAlias(wxString fName, sampleCount start, sampleCount len, int channel,bool useOD); - + bool AppendCoded(wxString fName, sampleCount start, sampleCount len, int channel, int decodeType); @@ -187,7 +187,7 @@ public: /// Get access to cut lines list WaveClipList* GetCutLines() { return &mCutLines; } - + /** Find cut line at (approximately) this position. Returns true and fills * in cutLineStart and cutLineEnd (if specified) if a cut line at this * position could be found. Return false otherwise. */ @@ -203,10 +203,10 @@ public: /// Remove cut line, without expanding the audio in it bool RemoveCutLine(double cutLinePosition); void RemoveAllCutLines(); - + /// Offset cutlines right to time 't0' by time amount 'len' void OffsetCutLines(double t0, double len); - + /// Lock all blockfiles void Lock(); void CloseLock(); //similar to Lock but should be called when the project closes. @@ -215,14 +215,14 @@ public: ///Delete the wave cache - force redraw. Thread-safe void DeleteWaveCache(); - + ///Adds an invalid region to the wavecache so it redraws that portion only. void AddInvalidRegion(long startSample, long endSample); // // XMLTagHandler callback methods for loading and saving // - + virtual bool HandleXMLTag(const wxChar *tag, const wxChar **attrs); virtual void HandleXMLEndTag(const wxChar *tag); virtual XMLTagHandler *HandleXMLChild(const wxChar *tag); diff --git a/src/WaveTrack.cpp b/src/WaveTrack.cpp index 7c2ad60fb..bee014fb0 100644 --- a/src/WaveTrack.cpp +++ b/src/WaveTrack.cpp @@ -20,8 +20,8 @@ can accommodate merged regions. *//****************************************************************//** \class TrackFactory -\brief Used to create a WaveTrack, or a LabelTrack.. Implementation -of the functions of this class are dispersed through the different +\brief Used to create a WaveTrack, or a LabelTrack.. Implementation +of the functions of this class are dispersed through the different Track classes. *//*******************************************************************/ @@ -74,11 +74,11 @@ WaveTrack *TrackFactory::NewWaveTrack(sampleFormat format, double rate) WaveTrack::WaveTrack(DirManager *projDirManager, sampleFormat format, double rate): Track(projDirManager) { - if (format == (sampleFormat)0) + if (format == (sampleFormat)0) { format = GetActiveProject()->GetDefaultFormat(); } - if (rate == 0) + if (rate == 0) { rate = GetActiveProject()->GetRate(); } @@ -145,18 +145,18 @@ void WaveTrack::Merge(const Track &orig) } WaveTrack::~WaveTrack() -{ - //Let the ODManager know this WaveTrack is disappearing. - //Deschedules tasks associated with this track. +{ + //Let the ODManager know this WaveTrack is disappearing. + //Deschedules tasks associated with this track. if(ODManager::IsInstanceCreated()) ODManager::Instance()->RemoveWaveTrack(this); - + for (WaveClipList::compatibility_iterator it=GetClipIterator(); it; it=it->GetNext()) delete it->GetData(); mClips.Clear(); if (mDisplayLocations) delete [] mDisplayLocations; - + } double WaveTrack::GetOffset() @@ -243,7 +243,7 @@ bool WaveTrack::SetPan(float newPan) }else{ temp = mHeight; mHeight = temp*mPerY; - mHeightv = temp - mHeight; + mHeightv = temp - mHeight; } ReorderList(); } @@ -304,7 +304,7 @@ void WaveTrack::VirtualStereoInit() if(mChannel == Track::MonoChannel && mPan != 0.0f && mMonoAsVirtualStereo){ temp = mHeight; mHeight = temp*mPerY; - mHeightv = temp - mHeight; + mHeightv = temp - mHeight; ReorderList(false); } } @@ -415,7 +415,7 @@ bool WaveTrack::Trim (double t0, double t1) //Find the first clip greater than the offset. //If we end up clipping the entire track, this is useful. - if(firstGreaterOffset < 0 && + if(firstGreaterOffset < 0 && clip->GetStartTime() >= t0) firstGreaterOffset = clip->GetStartTime(); @@ -448,7 +448,7 @@ bool WaveTrack::Trim (double t0, double t1) if (!SplitDelete(0,t0)) return false; } - + return true; } @@ -467,7 +467,7 @@ bool WaveTrack::Copy(double t0, double t1, Track **dest) newTrack->Init(*this); WaveClipList::compatibility_iterator it; - + for (it=GetClipIterator(); it; it=it->GetNext()) { WaveClip *clip = it->GetData(); @@ -476,7 +476,7 @@ bool WaveTrack::Copy(double t0, double t1, Track **dest) { // Whole clip is in copy region //printf("copy: clip %i is in copy region\n", (int)clip); - + WaveClip *newClip = new WaveClip(*clip, mDirManager); newClip->RemoveAllCutLines(); newClip->Offset(-t0); @@ -486,7 +486,7 @@ bool WaveTrack::Copy(double t0, double t1, Track **dest) { // Clip is affected by command //printf("copy: clip %i is affected by command\n", (int)clip); - + WaveClip *newClip = new WaveClip(*clip, mDirManager); newClip->RemoveAllCutLines(); double clip_t0 = t0; @@ -503,7 +503,7 @@ bool WaveTrack::Copy(double t0, double t1, Track **dest) newClip->SetOffset(0); //printf("copy: clip offset is now %f\n", newClip->GetOffset()); - + if (!newClip->CreateFromCopy(clip_t0, clip_t1, clip)) { //printf("paste: CreateFromCopy(%f, %f, %i) returns false, quitting\n", @@ -520,7 +520,7 @@ bool WaveTrack::Copy(double t0, double t1, Track **dest) } } } - + // AWD, Oct 2009: If the selection ends in whitespace, create a placeholder // clip representing that whitespace if (newTrack->GetEndTime() + 1.0 / newTrack->GetRate() < t1 - t0) @@ -666,7 +666,7 @@ bool WaveTrack::ClearAndPaste(double t0, // Start of time to clear // exceeds the pasted regions end time. for (i = 0; i < clips.GetCount(); i++) { clip = clips[i]; - + // Merge this clip and the previous clip if the end time // falls within it and this isn't the first clip in the track. if (fabs(t1 - clip->GetStartTime()) < WAVETRACK_MERGE_POINT_TOLERANCE) { @@ -775,7 +775,7 @@ bool WaveTrack::HandleClear(double t0, double t1, WaveClipList::compatibility_iterator it; WaveClipList clipsToDelete; WaveClipList clipsToAdd; - + // We only add cut lines when deleting in the middle of a single clip // The cut line code is not really prepared to handle other situations if (addCutLines) @@ -783,7 +783,7 @@ bool WaveTrack::HandleClear(double t0, double t1, for (it=GetClipIterator(); it; it=it->GetNext()) { WaveClip *clip = it->GetData(); - + if (!clip->BeforeClip(t1) && !clip->AfterClip(t0) && (clip->BeforeClip(t0) || clip->AfterClip(t1))) { @@ -791,7 +791,7 @@ bool WaveTrack::HandleClear(double t0, double t1, break; } } - } + } for (it=GetClipIterator(); it; it=it->GetNext()) // main loop through clips { @@ -955,9 +955,9 @@ bool WaveTrack::Paste(double t0, Track *src) if (src->GetKind() != Track::Wave) return false; - + WaveTrack* other = (WaveTrack*)src; - + // // Pasting is a bit complicated, because with the existence of multiclip mode, // we must guess the behaviour the user wants. @@ -983,7 +983,7 @@ bool WaveTrack::Paste(double t0, Track *src) return false; //printf("paste: we have at least one clip\n"); - + bool singleClipMode = (other->GetNumClips() == 1 && other->GetStartTime() == 0.0); @@ -991,7 +991,7 @@ bool WaveTrack::Paste(double t0, Track *src) WaveClipList::compatibility_iterator it; //printf("Check if we need to make room for the pasted data\n"); - + // Make room for the pasted data if (editClipCanMove) { if (!singleClipMode) { @@ -1021,7 +1021,7 @@ bool WaveTrack::Paste(double t0, Track *src) { // Single clip mode // printf("paste: checking for single clip mode!\n"); - + WaveClip *insideClip = NULL; for (it=GetClipIterator(); it; it=it->GetNext()) @@ -1060,7 +1060,7 @@ bool WaveTrack::Paste(double t0, Track *src) for (it=GetClipIterator(); it; it=it->GetNext()) { WaveClip *clip = it->GetData(); - + if (clip->GetStartTime() > insideClip->GetStartTime() && insideClip->GetEndTime() + insertDuration > clip->GetStartTime()) @@ -1072,7 +1072,7 @@ bool WaveTrack::Paste(double t0, Track *src) } } } - + return insideClip->Paste(t0, other->GetClipByIndex(0)); } @@ -1186,9 +1186,9 @@ bool WaveTrack::Disjoin(double t0, double t1) sampleCount maxAtOnce = 1048576; float *buffer = new float[ maxAtOnce ]; Regions regions; - + wxBusyCursor busy; - + for( WaveClipList::compatibility_iterator it = GetClipIterator(); it; it = it->GetNext() ) { WaveClip *clip = it->GetData(); @@ -1203,23 +1203,23 @@ bool WaveTrack::Disjoin(double t0, double t1) startTime = t0; if( t1 < endTime ) endTime = t1; - + //simply look for a sequence of zeroes and if the sequence //is greater than minimum number, split-delete the region - + sampleCount seqStart = -1; sampleCount start, end; clip->TimeToSamplesClip( startTime, &start ); clip->TimeToSamplesClip( endTime, &end ); - + sampleCount len = ( end - start ); for( sampleCount done = 0; done < len; done += maxAtOnce ) { sampleCount numSamples = maxAtOnce; if( done + maxAtOnce > len ) numSamples = len - done; - - clip->GetSamples( ( samplePtr )buffer, floatSample, start + done, + + clip->GetSamples( ( samplePtr )buffer, floatSample, start + done, numSamples ); for( sampleCount i = 0; i < numSamples; i++ ) { @@ -1233,7 +1233,7 @@ bool WaveTrack::Disjoin(double t0, double t1) if( seqStart != -1 ) { sampleCount seqEnd; - + //consider the end case, where selection ends in zeroes if( curSamplePos == end - 1 && buffer[ i ] == 0.0 ) seqEnd = end; @@ -1258,7 +1258,7 @@ bool WaveTrack::Disjoin(double t0, double t1) SplitDelete( regions.Item( i )->start, regions.Item( i )->end ); delete regions.Item( i ); } - + delete[] buffer; return true; } @@ -1273,7 +1273,7 @@ bool WaveTrack::Join(double t0, double t1) for (it=GetClipIterator(); it; it=it->GetNext()) { - WaveClip *clip = it->GetData(); + WaveClip *clip = it->GetData(); if (clip->GetStartTime() < t1-(1.0/mRate) && clip->GetEndTime()-(1.0/mRate) > t0) { @@ -1291,11 +1291,11 @@ bool WaveTrack::Join(double t0, double t1) //if there are no clips to delete, nothing to do if( clipsToDelete.GetCount() == 0 ) return true; - + newClip = CreateClip(); double t = clipsToDelete[0]->GetOffset(); newClip->SetOffset(t); - for(it=clipsToDelete.GetFirst(); it; it=it->GetNext()) + for(it=clipsToDelete.GetFirst(); it; it=it->GetNext()) { WaveClip *clip = it->GetData(); @@ -1313,7 +1313,7 @@ bool WaveTrack::Join(double t0, double t1) //printf("Pasting at %.6f\n", t); bool bResult = newClip->Paste(t, clip); wxASSERT(bResult); // TO DO: Actually handle this. - t = newClip->GetEndTime(); + t = newClip->GetEndTime(); mClips.DeleteObject(clip); delete clip; @@ -1417,22 +1417,22 @@ bool WaveTrack::HandleXMLTag(const wxChar *tag, const wxChar **attrs) while(*attrs) { const wxChar *attr = *attrs++; const wxChar *value = *attrs++; - + if (!value) break; - + const wxString strValue = value; if (!wxStrcmp(attr, wxT("rate"))) { // mRate is an int, but "rate" in the project file is a float. - if (!XMLValueChecker::IsGoodString(strValue) || + if (!XMLValueChecker::IsGoodString(strValue) || !Internat::CompatibleToDouble(strValue, &dblValue) || (dblValue < 1.0) || (dblValue > 1000000.0)) // allow a large range to be read return false; mRate = lrint(dblValue); } - else if (!wxStrcmp(attr, wxT("offset")) && - XMLValueChecker::IsGoodString(strValue) && + else if (!wxStrcmp(attr, wxT("offset")) && + XMLValueChecker::IsGoodString(strValue) && Internat::CompatibleToDouble(strValue, &dblValue)) { // Offset is only relevant for legacy project files. The value @@ -1440,43 +1440,43 @@ bool WaveTrack::HandleXMLTag(const wxChar *tag, const wxChar **attrs) // track is created. mLegacyProjectFileOffset = dblValue; } - else if (!wxStrcmp(attr, wxT("mute")) && + else if (!wxStrcmp(attr, wxT("mute")) && XMLValueChecker::IsGoodInt(strValue) && strValue.ToLong(&nValue)) mMute = (nValue != 0); - else if (!wxStrcmp(attr, wxT("solo")) && + else if (!wxStrcmp(attr, wxT("solo")) && XMLValueChecker::IsGoodInt(strValue) && strValue.ToLong(&nValue)) mSolo = (nValue != 0); - else if (!wxStrcmp(attr, wxT("height")) && + else if (!wxStrcmp(attr, wxT("height")) && XMLValueChecker::IsGoodInt(strValue) && strValue.ToLong(&nValue)) mHeight = nValue; - else if (!wxStrcmp(attr, wxT("minimized")) && + else if (!wxStrcmp(attr, wxT("minimized")) && XMLValueChecker::IsGoodInt(strValue) && strValue.ToLong(&nValue)) mMinimized = (nValue != 0); - else if (!wxStrcmp(attr, wxT("isSelected")) && + else if (!wxStrcmp(attr, wxT("isSelected")) && XMLValueChecker::IsGoodInt(strValue) && strValue.ToLong(&nValue)) this->SetSelected(nValue != 0); - else if (!wxStrcmp(attr, wxT("gain")) && - XMLValueChecker::IsGoodString(strValue) && + else if (!wxStrcmp(attr, wxT("gain")) && + XMLValueChecker::IsGoodString(strValue) && Internat::CompatibleToDouble(strValue, &dblValue)) mGain = dblValue; - else if (!wxStrcmp(attr, wxT("pan")) && - XMLValueChecker::IsGoodString(strValue) && - Internat::CompatibleToDouble(strValue, &dblValue) && + else if (!wxStrcmp(attr, wxT("pan")) && + XMLValueChecker::IsGoodString(strValue) && + Internat::CompatibleToDouble(strValue, &dblValue) && (dblValue >= -1.0) && (dblValue <= 1.0)) mPan = dblValue; else if (!wxStrcmp(attr, wxT("name")) && XMLValueChecker::IsGoodString(strValue)) mName = strValue; else if (!wxStrcmp(attr, wxT("channel"))) { - if (!XMLValueChecker::IsGoodInt(strValue) || !strValue.ToLong(&nValue) || + if (!XMLValueChecker::IsGoodInt(strValue) || !strValue.ToLong(&nValue) || !XMLValueChecker::IsValidChannel(nValue)) return false; mChannel = nValue; } - else if (!wxStrcmp(attr, wxT("linked")) && + else if (!wxStrcmp(attr, wxT("linked")) && XMLValueChecker::IsGoodInt(strValue) && strValue.ToLong(&nValue)) SetLinked(nValue != 0); - + } // while #ifdef EXPERIMENTAL_OUTPUT_DISPLAY VirtualStereoInit(); @@ -1503,14 +1503,14 @@ XMLTagHandler *WaveTrack::HandleXMLChild(const wxChar *tag) { // This is a legacy project, so set the cached offset GetLastOrCreateClip()->SetOffset(mLegacyProjectFileOffset); - + // Legacy project file tracks are imported as one single wave clip if (!wxStrcmp(tag, wxT("sequence"))) return GetLastOrCreateClip()->GetSequence(); else if (!wxStrcmp(tag, wxT("envelope"))) return GetLastOrCreateClip()->GetEnvelope(); } - + // JKC... for 1.1.0, one step better than what we had, but still badly broken. //If we see a waveblock at this level, we'd better generate a sequence. if( !wxStrcmp( tag, wxT("waveblock" ))) @@ -1553,7 +1553,7 @@ void WaveTrack::WriteXML(XMLWriter &xmlFile) xmlFile.WriteAttr(wxT("rate"), mRate); xmlFile.WriteAttr(wxT("gain"), (double)mGain); xmlFile.WriteAttr(wxT("pan"), (double)mPan); - + for (WaveClipList::compatibility_iterator it=GetClipIterator(); it; it=it->GetNext()) { it->GetData()->WriteXML(xmlFile); @@ -1740,7 +1740,7 @@ bool WaveTrack::Get(samplePtr buffer, sampleFormat format, // don't clear anything (because we won't have to). Otherwise, just clear // everything to be on the safe side. WaveClipList::compatibility_iterator it; - + bool doClear = true; for (it=GetClipIterator(); it; it=it->GetNext()) { @@ -1851,8 +1851,8 @@ void WaveTrack::GetEnvelopeValues(double *buffer, int bufferLen, if( bufferLen <= 0 ) return; - // This is useful in debugging, to easily find null envelope settings, but - // should not be necessary in Release build. + // This is useful in debugging, to easily find null envelope settings, but + // should not be necessary in Release build. // If we were going to set it to failsafe values in Release build, better to set each element to 1.0. #ifdef __WXDEBUG__ memset(buffer, 0, sizeof(double)*bufferLen); @@ -1864,7 +1864,7 @@ void WaveTrack::GetEnvelopeValues(double *buffer, int bufferLen, for (WaveClipList::compatibility_iterator it=GetClipIterator(); it; it=it->GetNext()) { WaveClip *clip = it->GetData(); - + // IF clip intersects startTime..endTime THEN... double dClipStartTime = clip->GetStartTime(); double dClipEndTime = clip->GetEndTime(); @@ -1888,13 +1888,13 @@ void WaveTrack::GetEnvelopeValues(double *buffer, int bufferLen, //vvvvv debugging int nEndSample = clip->GetEndSample(); int nClipLen = clip->GetEndSample() - clip->GetStartSample(); - if (nClipLen <= 0) // Testing for bug 641, this problem is consistently '== 0', but doesn't hurt to check <. - return; + if (nClipLen <= 0) // Testing for bug 641, this problem is consistently '== 0', but doesn't hurt to check <. + return; - // This check prevents problem cited in http://bugzilla.audacityteam.org/show_bug.cgi?id=528#c11, + // This check prevents problem cited in http://bugzilla.audacityteam.org/show_bug.cgi?id=528#c11, // Gale's cross_fade_out project, which was already corrupted by bug 528. // This conditional prevents the previous write past the buffer end, in clip->GetEnvelope() call. - if (nClipLen < rlen) // Never increase rlen here. + if (nClipLen < rlen) // Never increase rlen here. rlen = nClipLen; } clip->GetEnvelope()->GetValues(rbuf, rlen, rt0, tstep); @@ -2100,7 +2100,7 @@ bool WaveTrack::SplitAt(double t) double val; t = LongSamplesToTime(TimeToLongSamples(t)); // put t on a sample val = c->GetEnvelope()->GetValue(t); - //make two envelope points to preserve the value. + //make two envelope points to preserve the value. //handle the case where we split on the 1st sample (without this we hit an assert) if(t - 1.0/c->GetRate() >= c->GetOffset()) c->GetEnvelope()->Insert(t - c->GetOffset() - 1.0/c->GetRate(), val); // frame end points @@ -2116,7 +2116,7 @@ bool WaveTrack::SplitAt(double t) delete newClip; return false; } - + //offset the new clip by the splitpoint (noting that it is already offset to c->GetStartTime()) sampleCount here = llrint(floor(((t - c->GetStartTime()) * mRate) + 0.5)); newClip->Offset((double)here/(double)mRate); @@ -2132,16 +2132,16 @@ void WaveTrack::UpdateLocationsCache() { unsigned int i; WaveClipArray clips; - + FillSortedClipArray(clips); - + mDisplayNumLocations = 0; - + // Count number of display locations for (i = 0; i < clips.GetCount(); i++) { WaveClip* clip = clips.Item(i); - + mDisplayNumLocations += clip->GetCutLines()->GetCount(); if (i > 0 && fabs(clips.Item(i - 1)->GetEndTime() - @@ -2165,7 +2165,7 @@ void WaveTrack::UpdateLocationsCache() // Add all display locations to cache int curpos = 0; - + for (i = 0; i < clips.GetCount(); i++) { WaveClip* clip = clips.Item(i); @@ -2180,7 +2180,7 @@ void WaveTrack::UpdateLocationsCache() clip->GetOffset() + it->GetData()->GetOffset(); curpos++; } - + if (i > 0) { WaveClip* previousClip = clips.Item(i - 1); @@ -2197,7 +2197,7 @@ void WaveTrack::UpdateLocationsCache() } } } - + wxASSERT(curpos == mDisplayNumLocations); } @@ -2208,7 +2208,7 @@ bool WaveTrack::ExpandCutLine(double cutLinePosition, double* cutlineStart, bool editClipCanMove = true; gPrefs->Read(wxT("/GUI/EditClipCanMove"), &editClipCanMove); - // Find clip which contains this cut line + // Find clip which contains this cut line for (WaveClipList::compatibility_iterator it=GetClipIterator(); it; it=it->GetNext()) { WaveClip* clip = it->GetData(); @@ -2217,7 +2217,7 @@ bool WaveTrack::ExpandCutLine(double cutLinePosition, double* cutlineStart, if (clip->FindCutLine(cutLinePosition, &start, &end)) { WaveClipList::compatibility_iterator it2; - + if (!editClipCanMove) { // We are not allowed to move the other clips, so see if there @@ -2225,7 +2225,7 @@ bool WaveTrack::ExpandCutLine(double cutLinePosition, double* cutlineStart, for (it2=GetClipIterator(); it2; it2=it2->GetNext()) { WaveClip *clip2 = it2->GetData(); - + if (clip2->GetStartTime() > clip->GetStartTime() && clip->GetEndTime() + end - start > clip2->GetStartTime()) { @@ -2236,7 +2236,7 @@ bool WaveTrack::ExpandCutLine(double cutLinePosition, double* cutlineStart, } } } - + if (!clip->ExpandCutLine(cutLinePosition)) return false; @@ -2252,7 +2252,7 @@ bool WaveTrack::ExpandCutLine(double cutLinePosition, double* cutlineStart, it2=it2->GetNext()) { WaveClip* clip2 = it2->GetData(); - + if (clip2->GetStartTime() > clip->GetStartTime()) clip2->Offset(end - start); } @@ -2281,7 +2281,7 @@ bool WaveTrack::MergeClips(int clipidx1, int clipidx2) if (!clip2) // Could happen if one track of a linked pair had a split and the other didn't. return false; - + // Append data from second clip to first clip if (!clip1->Paste(clip1->GetEndTime(), clip2)) return false; @@ -2289,7 +2289,7 @@ bool WaveTrack::MergeClips(int clipidx1, int clipidx2) // Delete second clip mClips.DeleteObject(clip2); delete clip2; - + return true; } @@ -2303,9 +2303,9 @@ bool WaveTrack::Resample(int rate, ProgressDialog *progress) // clips are resampled and some are not return false; } - + mRate = rate; - + return true; } @@ -2320,10 +2320,10 @@ static int SortClipArrayCmpFunc(WaveClip** clip1, WaveClip** clip2) void WaveTrack::FillSortedClipArray(WaveClipArray& clips) { clips.Empty(); - + for (WaveClipList::compatibility_iterator it=GetClipIterator(); it; it=it->GetNext()) clips.Add(it->GetData()); - + clips.Sort(SortClipArrayCmpFunc); } diff --git a/src/WaveTrack.h b/src/WaveTrack.h index e1930b19d..2335efac6 100644 --- a/src/WaveTrack.h +++ b/src/WaveTrack.h @@ -40,11 +40,11 @@ class TimeWarper; typedef struct REGION { double start, end; - + //used for sorting static int cmp( REGION **a, REGION **b ) - { - return ( ( *a )->start < ( *b )->start ) ? -1 : 1; + { + return ( ( *a )->start < ( *b )->start ) ? -1 : 1; } }Region; WX_DEFINE_ARRAY( Region*, Regions ); @@ -61,7 +61,7 @@ class AUDACITY_DLL_API WaveTrack: public Track { // Private since only factories are allowed to construct WaveTracks // - WaveTrack(DirManager * projDirManager, + WaveTrack(DirManager * projDirManager, sampleFormat format = (sampleFormat)0, double rate = 0); WaveTrack(WaveTrack &orig); @@ -85,15 +85,15 @@ class AUDACITY_DLL_API WaveTrack: public Track { struct Location { // Position of track location double pos; - + // Type of track location LocationType typ; - + // Only for typ==locationMergePoint int clipidx1; // first clip (left one) int clipidx2; // second clip (right one) }; - + virtual ~WaveTrack(); virtual double GetOffset(); virtual void SetOffset (double o); @@ -115,7 +115,7 @@ class AUDACITY_DLL_API WaveTrack: public Track { // Identifying the type of track // - virtual int GetKind() const { return Wave; } + virtual int GetKind() const { return Wave; } #ifdef EXPERIMENTAL_OUTPUT_DISPLAY virtual int GetMinimizedHeight() const; #endif @@ -203,23 +203,23 @@ class AUDACITY_DLL_API WaveTrack: public Track { bool AppendAlias(wxString fName, sampleCount start, sampleCount len, int channel,bool useOD); - + ///for use with On-Demand decoding of compressed files. ///decodeType should be an enum from ODDecodeTask that specifies what ///Type of encoded file this is, such as eODFLAC //vvv Why not use the ODTypeEnum typedef to enforce that for the parameter? bool AppendCoded(wxString fName, sampleCount start, sampleCount len, int channel, int decodeType); - + ///gets an int with OD flags so that we can determine which ODTasks should be run on this track after save/open, etc. unsigned int GetODFlags(); - + ///Deletes all clips' wavecaches. Careful, This may not be threadsafe. void DeleteWaveCaches(); - + ///Adds an invalid region to the wavecache so it redraws that portion only. void AddInvalidRegion(sampleCount startSample, sampleCount endSample); - + /// /// MM: Now that each wave track can contain multiple clips, we don't /// have a continous space of samples anymore, but we simulate it, @@ -250,7 +250,7 @@ class AUDACITY_DLL_API WaveTrack: public Track { Sequence* GetSequenceAtX(int xcoord); Envelope* GetEnvelopeAtX(int xcoord); Envelope* GetActiveEnvelope(void); - + WaveClip* GetClipAtSample(sampleCount sample); // @@ -285,7 +285,7 @@ class AUDACITY_DLL_API WaveTrack: public Track { /** @brief Convert correctly between an (absolute) time in seconds and a number of samples. * - * This method will not give the correct results if used on a relative time (difference of two + * This method will not give the correct results if used on a relative time (difference of two * times). Each absolute time must be converted and the numbers of samples differenced: * sampleCount start = track->TimeToLongSamples(t0); * sampleCount end = track->TimeToLongSamples(t1); @@ -330,7 +330,7 @@ class AUDACITY_DLL_API WaveTrack: public Track { // Get number of clips in this WaveTrack int GetNumClips() const; - + // Add all wave clips to the given array 'clips' and sort the array by // clip start time. The array is emptied prior to adding the clips. void FillSortedClipArray(WaveClipArray& clips); @@ -341,7 +341,7 @@ class AUDACITY_DLL_API WaveTrack: public Track { // in this direction maximally. bool CanOffsetClip(WaveClip* clip, double amount, double *allowedAmount=NULL); - // Before moving a clip into a track (or inserting a clip), use this + // Before moving a clip into a track (or inserting a clip), use this // function to see if the times are valid (i.e. don't overlap with // existing clips). bool CanInsertClip(WaveClip* clip); @@ -351,13 +351,13 @@ class AUDACITY_DLL_API WaveTrack: public Track { // other clip. No fancy additional stuff is done. // unused void MoveClipToTrack(int clipIndex, WaveTrack* dest); void MoveClipToTrack(WaveClip *clip, WaveTrack* dest); - + // Remove the clip from the track and return a pointer to it. WaveClip* RemoveAndReturnClip(WaveClip* clip); - + // Append a clip to the track void AddClip(WaveClip* clip); - + // Merge two clips, that is append data from clip2 to clip1, // then remove clip2 from track. // clipidx1 and clipidx2 are indices into the clip list. @@ -379,7 +379,7 @@ class AUDACITY_DLL_API WaveTrack: public Track { // This track has been merged into a stereo track. Copy shared parameters // from the new partner. virtual void Merge(const Track &orig); - + // Resample track (i.e. all clips in the track) bool Resample(int rate, ProgressDialog *progress = NULL); @@ -387,7 +387,7 @@ class AUDACITY_DLL_API WaveTrack: public Track { // The following code will eventually become part of a GUIWaveTrack // and will be taken out of the WaveTrack class: // - + enum { WaveformDisplay, WaveformDBDisplay, @@ -406,7 +406,7 @@ class AUDACITY_DLL_API WaveTrack: public Track { void GetDisplayBounds(float *min, float *max); void SetDisplayBounds(float min, float max); - + protected: // diff --git a/src/WrappedType.cpp b/src/WrappedType.cpp index be37c85c3..c3d317fc7 100644 --- a/src/WrappedType.cpp +++ b/src/WrappedType.cpp @@ -11,12 +11,12 @@ \class WrappedType \brief - Used in type conversions, this wrapper for ints, strings, doubles and - enums provides conversions between all the types. Functions that - work on wrapped types can quickly be reused to work on any of + Used in type conversions, this wrapper for ints, strings, doubles and + enums provides conversions between all the types. Functions that + work on wrapped types can quickly be reused to work on any of these types. This cuts out a lot of repetitive code. - JKC: This class grows in size with the square of the number of + JKC: This class grows in size with the square of the number of types it supports. It has to do all conversions between all pairs, so try to re-use existing types if you can. diff --git a/src/WrappedType.h b/src/WrappedType.h index e756bec66..e65946a55 100644 --- a/src/WrappedType.h +++ b/src/WrappedType.h @@ -14,7 +14,7 @@ #include "Audacity.h" -enum teWrappedType +enum teWrappedType { eWrappedNotSet, eWrappedString, @@ -56,9 +56,9 @@ public: void WriteToAsBool( const bool InBool); bool ValuesMatch( const WrappedType & W ); - void WriteToAsWrappedType( const WrappedType & W ); + void WriteToAsWrappedType( const WrappedType & W ); -public : +public : void Init(); teWrappedType eWrappedType; diff --git a/src/blockfile/LegacyAliasBlockFile.cpp b/src/blockfile/LegacyAliasBlockFile.cpp index cd4de1e7f..3e967e906 100644 --- a/src/blockfile/LegacyAliasBlockFile.cpp +++ b/src/blockfile/LegacyAliasBlockFile.cpp @@ -64,7 +64,7 @@ BlockFile *LegacyAliasBlockFile::Copy(wxFileName newFileName) void LegacyAliasBlockFile::SaveXML(XMLWriter &xmlFile) { xmlFile.StartTag(wxT("legacyblockfile")); - + xmlFile.WriteAttr(wxT("alias"), 1); xmlFile.WriteAttr(wxT("name"), mFileName.GetFullName()); xmlFile.WriteAttr(wxT("aliaspath"), mAliasedFileName.GetFullPath()); @@ -78,8 +78,8 @@ void LegacyAliasBlockFile::SaveXML(XMLWriter &xmlFile) xmlFile.EndTag(wxT("legacyblockfile")); } -// BuildFromXML methods should always return a BlockFile, not NULL, -// even if the result is flawed (e.g., refers to nonexistent file), +// BuildFromXML methods should always return a BlockFile, not NULL, +// even if the result is flawed (e.g., refers to nonexistent file), // as testing will be done in DirManager::ProjectFSCK(). BlockFile *LegacyAliasBlockFile::BuildFromXML(wxString projDir, const wxChar **attrs) { @@ -99,7 +99,7 @@ BlockFile *LegacyAliasBlockFile::BuildFromXML(wxString projDir, const wxChar **a const wxString strValue = value; if (!wxStricmp(attr, wxT("name")) && XMLValueChecker::IsGoodFileName(strValue, projDir)) - //v Should this be + //v Should this be // dm.AssignFile(summaryFileName, strValue, false); // as in PCMAliasBlockFile::BuildFromXML? Test with an old project. summaryFileName.Assign(projDir, strValue, wxT("")); @@ -111,12 +111,12 @@ BlockFile *LegacyAliasBlockFile::BuildFromXML(wxString projDir, const wxChar **a // Allow fallback of looking for the file name, located in the data directory. aliasFileName.Assign(projDir, strValue); else if (XMLValueChecker::IsGoodPathString(strValue)) - // If the aliased file is missing, we failed XMLValueChecker::IsGoodPathName() - // and XMLValueChecker::IsGoodFileName, because both do existence tests, + // If the aliased file is missing, we failed XMLValueChecker::IsGoodPathName() + // and XMLValueChecker::IsGoodFileName, because both do existence tests, // but we want to keep the reference to the missing file because it's a good path string. aliasFileName.Assign(strValue); } - else if (XMLValueChecker::IsGoodInt(strValue) && strValue.ToLong(&nValue)) + else if (XMLValueChecker::IsGoodInt(strValue) && strValue.ToLong(&nValue)) { // integer parameters if (!wxStricmp(attr, wxT("aliasstart")) && (nValue >= 0)) aliasStart = nValue; diff --git a/src/blockfile/LegacyBlockFile.cpp b/src/blockfile/LegacyBlockFile.cpp index c55c2b115..bd9d57e2d 100644 --- a/src/blockfile/LegacyBlockFile.cpp +++ b/src/blockfile/LegacyBlockFile.cpp @@ -112,7 +112,7 @@ void ComputeLegacySummaryInfo(wxFileName fileName, (*rms) = 0; DeleteSamples(data); - delete[] summary; + delete[] summary; } /// Construct a LegacyBlockFile memory structure that will point to an @@ -166,7 +166,7 @@ bool LegacyBlockFile::ReadSummary(void *data) } int read = summaryFile.Read(data, (size_t)mSummaryInfo.totalSummaryBytes); - + if(silence) delete silence; mSilentLog=FALSE; @@ -205,7 +205,7 @@ int LegacyBlockFile::ReadData(samplePtr data, sampleFormat format, info.channels = 1; info.frames = mLen + (mSummaryInfo.totalSummaryBytes / SAMPLE_SIZE(mFormat)); - + wxFile f; // will be closed when it goes out of scope SNDFILE *sf = NULL; @@ -220,7 +220,7 @@ int LegacyBlockFile::ReadData(samplePtr data, sampleFormat format, if(mSilentLog)silence= new wxLogNull(); if (!sf){ - + memset(data,0,SAMPLE_SIZE(format)*len); if(silence) delete silence; @@ -234,10 +234,10 @@ int LegacyBlockFile::ReadData(samplePtr data, sampleFormat format, sf_count_t seekstart = start + (mSummaryInfo.totalSummaryBytes / SAMPLE_SIZE(mFormat)); sf_seek(sf, seekstart , SEEK_SET); - + samplePtr buffer = NewSamples(len, floatSample); int framesRead = 0; - + // If both the src and dest formats are integer formats, // read integers from the file (otherwise we would be // converting to float and back, which is unneccesary) @@ -247,7 +247,7 @@ int LegacyBlockFile::ReadData(samplePtr data, sampleFormat format, }else if (format == int24Sample && sf_subtype_is_integer(info.format)) { framesRead = sf_readf_int(sf, (int *)data, len); - + // libsndfile gave us the 3 byte sample in the 3 most // significant bytes -- we want it in the 3 least // significant bytes. @@ -262,9 +262,9 @@ int LegacyBlockFile::ReadData(samplePtr data, sampleFormat format, CopySamples(buffer, floatSample, (samplePtr)data, format, framesRead); } - + sf_close(sf); - + DeleteSamples(buffer); return framesRead; @@ -283,8 +283,8 @@ void LegacyBlockFile::SaveXML(XMLWriter &xmlFile) xmlFile.EndTag(wxT("legacyblockfile")); } -// BuildFromXML methods should always return a BlockFile, not NULL, -// even if the result is flawed (e.g., refers to nonexistent file), +// BuildFromXML methods should always return a BlockFile, not NULL, +// even if the result is flawed (e.g., refers to nonexistent file), // as testing will be done in DirManager::ProjectFSCK(). /// static BlockFile *LegacyBlockFile::BuildFromXML(wxString projDir, const wxChar **attrs, @@ -304,11 +304,11 @@ BlockFile *LegacyBlockFile::BuildFromXML(wxString projDir, const wxChar **attrs, const wxString strValue = value; if (!wxStricmp(attr, wxT("name")) && XMLValueChecker::IsGoodFileName(strValue, projDir)) - //v Should this be + //v Should this be // dm.AssignFile(fileName, strValue, false); // as in PCMAliasBlockFile::BuildFromXML? Test with an old project. fileName.Assign(projDir, strValue); - else if (XMLValueChecker::IsGoodInt(strValue) && strValue.ToLong(&nValue)) + else if (XMLValueChecker::IsGoodInt(strValue) && strValue.ToLong(&nValue)) { // integer parameters if (!wxStrcmp(attr, wxT("len")) && (nValue >= 0)) len = nValue; diff --git a/src/blockfile/LegacyBlockFile.h b/src/blockfile/LegacyBlockFile.h index ca59d0dfa..353597bff 100644 --- a/src/blockfile/LegacyBlockFile.h +++ b/src/blockfile/LegacyBlockFile.h @@ -22,7 +22,7 @@ void ComputeLegacySummaryInfo(wxFileName fileName, SummaryInfo *info, bool noRMS,bool Silent, float *min, float *max, float *rms); - + // // This class supports loading BlockFiles in one of the old diff --git a/src/blockfile/ODDecodeBlockFile.cpp b/src/blockfile/ODDecodeBlockFile.cpp index 8eda699da..d6cf17a5a 100644 --- a/src/blockfile/ODDecodeBlockFile.cpp +++ b/src/blockfile/ODDecodeBlockFile.cpp @@ -3,7 +3,7 @@ Audacity: A Digital Audio Editor ODDecodeBlockFile.cpp - + Created by Michael Chinen (mchinen) Audacity(R) is copyright (c) 1999-2008 Audacity Team. License: GPL v2. See License.txt. @@ -47,13 +47,13 @@ ODDecodeBlockFile::ODDecodeBlockFile(wxFileName baseFileName,wxFileName audioFil mAudioFileName = audioFileName; mFormat = int16Sample; } - + /// Create the memory structure to refer to the given block file ODDecodeBlockFile::ODDecodeBlockFile(wxFileName existingFile, wxFileName audioFileName, sampleCount aliasStart, sampleCount aliasLen, int aliasChannel, unsigned int decodeType, float min, float max, float rms, bool dataAvailable): SimpleBlockFile(existingFile,aliasLen,min,max,rms), - + mType(decodeType), mAliasStart(aliasStart), mAliasChannel(aliasChannel) @@ -74,7 +74,7 @@ ODDecodeBlockFile::~ODDecodeBlockFile() //Check to see if we have the file for these calls. wxLongLong ODDecodeBlockFile::GetSpaceUsage() -{ +{ if(IsSummaryAvailable()) { wxFFile summaryFile(mFileName.GetFullPath()); @@ -97,7 +97,7 @@ void ODDecodeBlockFile::GetMinMax(sampleCount start, sampleCount len, } else { - //fake values. These values are used usually for normalization and amplifying, so we want + //fake values. These values are used usually for normalization and amplifying, so we want //the max to be maximal and the min to be minimal *outMin = -1.0; *outMax = 1.0; @@ -114,7 +114,7 @@ void ODDecodeBlockFile::GetMinMax(float *outMin, float *outMax, float *outRMS) } else { - //fake values. These values are used usually for normalization and amplifying, so we want + //fake values. These values are used usually for normalization and amplifying, so we want //the max to be maximal and the min to be minimal *outMin = -1.0; *outMax = 1.0; @@ -158,13 +158,13 @@ bool ODDecodeBlockFile::Read64K(float *buffer, sampleCount start, sampleCount le BlockFile *ODDecodeBlockFile::Copy(wxFileName newFileName) { BlockFile *newBlockFile; - + //mAliasedFile can change so we lock readdatamutex, which is responsible for it. LockRead(); if(IsSummaryAvailable()) { //create a simpleblockfile, because once it has the summary it is a simpleblockfile for all intents an purposes - newBlockFile = SimpleBlockFile::Copy(newFileName) ; + newBlockFile = SimpleBlockFile::Copy(newFileName) ; } else { @@ -176,9 +176,9 @@ BlockFile *ODDecodeBlockFile::Copy(wxFileName newFileName) //The client code will need to schedule this blockfile for OD decoding if it is going to a new track. //It can do this by checking for IsDataAvailable()==false. } - + UnlockRead(); - + return newBlockFile; } @@ -216,8 +216,8 @@ void ODDecodeBlockFile::SaveXML(XMLWriter &xmlFile) /// Constructs a ODPCMAliasBlockFile from the xml output of WriteXML. /// Also schedules the ODPCMAliasBlockFile for OD loading. -// BuildFromXML methods should always return a BlockFile, not NULL, -// even if the result is flawed (e.g., refers to nonexistent file), +// BuildFromXML methods should always return a BlockFile, not NULL, +// even if the result is flawed (e.g., refers to nonexistent file), // as testing will be done in DirManager::ProjectFSCK(). BlockFile *ODDecodeBlockFile::BuildFromXML(DirManager &dm, const wxChar **attrs) { @@ -232,13 +232,13 @@ BlockFile *ODDecodeBlockFile::BuildFromXML(DirManager &dm, const wxChar **attrs) { const wxChar *attr = *attrs++; const wxChar *value = *attrs++; - if (!value) + if (!value) break; const wxString strValue = value; - if (!wxStricmp(attr, wxT("summaryfile")) && + if (!wxStricmp(attr, wxT("summaryfile")) && // Can't use XMLValueChecker::IsGoodFileName here, but do part of its test. - XMLValueChecker::IsGoodFileString(strValue) && + XMLValueChecker::IsGoodFileString(strValue) && (strValue.Length() + 1 + dm.GetProjectDataDir().Length() <= PLATFORM_MAX_PATH)) { if (!dm.AssignFile(summaryFileName, strValue, false)) @@ -253,12 +253,12 @@ BlockFile *ODDecodeBlockFile::BuildFromXML(DirManager &dm, const wxChar **attrs) // Allow fallback of looking for the file name, located in the data directory. audioFileName.Assign(dm.GetProjectDataDir(), strValue); else if (XMLValueChecker::IsGoodPathString(strValue)) - // If the file is missing, we failed XMLValueChecker::IsGoodPathName() - // and XMLValueChecker::IsGoodFileName, because both do existence tests, + // If the file is missing, we failed XMLValueChecker::IsGoodPathName() + // and XMLValueChecker::IsGoodFileName, because both do existence tests, // but we want to keep the reference to the file because it's a good path string. audioFileName.Assign(strValue); } - else if (XMLValueChecker::IsGoodInt(strValue) && strValue.ToLong(&nValue)) + else if (XMLValueChecker::IsGoodInt(strValue) && strValue.ToLong(&nValue)) { // integer parameters if (!wxStricmp(attr, wxT("aliasstart")) && (nValue >= 0)) aliasStart = nValue; @@ -310,19 +310,19 @@ int ODDecodeBlockFile::WriteODDecodeBlockFile() // derived classes) to get the sample data samplePtr sampleData;// = NewSamples(mLen, floatSample); int ret; - //use the decoder here. + //use the decoder here. mDecoderMutex.Lock(); - + if(!mDecoder) { mDecoderMutex.Unlock(); return -1; } - - + + //sampleData and mFormat are set by the decoder. ret = mDecoder->Decode(sampleData, mFormat, mAliasStart, mLen, mAliasChannel); - + mDecoderMutex.Unlock(); if(ret < 0) { printf("ODDecodeBlockFile Decode failure\n"); @@ -332,16 +332,16 @@ int ODDecodeBlockFile::WriteODDecodeBlockFile() //the summary is also calculated here. mFileNameMutex.Lock(); //TODO: we may need to write a version of WriteSimpleBlockFile that uses threadsafe FILE vs wxFile - bool bSuccess = + bool bSuccess = WriteSimpleBlockFile( sampleData, mLen, mFormat, NULL);//summaryData); - wxASSERT(bSuccess); // TODO: Handle failure here by alert to user and undo partial op. + wxASSERT(bSuccess); // TODO: Handle failure here by alert to user and undo partial op. mFileNameMutex.Unlock(); - + DeleteSamples(sampleData); // delete [] (char *) summaryData; @@ -349,7 +349,7 @@ int ODDecodeBlockFile::WriteODDecodeBlockFile() mDataAvailableMutex.Lock(); mDataAvailable=true; mDataAvailableMutex.Unlock(); - + return ret; } @@ -359,7 +359,7 @@ void ODDecodeBlockFile::SetFileName(wxFileName &name) mFileNameMutex.Lock(); mFileName=name; /* mchinen oct 9 2009 don't think we need the char* but leaving it in for now just as a reminder that we might - if wxFileName isn't threadsafe. + if wxFileName isn't threadsafe. delete [] mFileNameChar; mFileNameChar = new char[strlen(mFileName.GetFullPath().mb_str(wxConvUTF8))+1]; strcpy(mFileNameChar,mFileName.GetFullPath().mb_str(wxConvUTF8)); */ @@ -404,7 +404,7 @@ void *ODDecodeBlockFile::CalcSummary(samplePtr buffer, sampleCount len, float *summary256 = (float *)(localFullSummary + mSummaryInfo.offset256); float *fbuffer; - + //mchinen: think we can hack this - don't allocate and copy if we don't need to., if(format==floatSample) { @@ -425,7 +425,7 @@ void *ODDecodeBlockFile::CalcSummary(samplePtr buffer, sampleCount len, // Recalc 256 summaries sumLen = (len + 255) / 256; - + for (i = 0; i < sumLen; i++) { min = fbuffer[i * 256]; max = fbuffer[i * 256]; @@ -448,7 +448,7 @@ void *ODDecodeBlockFile::CalcSummary(samplePtr buffer, sampleCount len, summary256[i * 3 + 1] = max; summary256[i * 3 + 2] = rms; } - + for (i = sumLen; i < mSummaryInfo.frames256; i++) { // filling in the remaining bits with non-harming/contributing values summary256[i * 3] = FLT_MAX; // min @@ -504,7 +504,7 @@ void *ODDecodeBlockFile::CalcSummary(samplePtr buffer, sampleCount len, mMin = min; mMax = max; mRMS = sqrt(sumsq / sumLen); - + //if we've used the float sample.. if(format!=floatSample) @@ -552,7 +552,7 @@ bool ODDecodeBlockFile::ReadSummary(void *data) //I dont think we need to add a mutex here because only the main thread changes filenames and calls ReadSummarz if(IsSummaryAvailable()) return SimpleBlockFile::ReadSummary(data); - + memset(data, 0, (size_t)mSummaryInfo.totalSummaryBytes); return true; } @@ -567,7 +567,7 @@ void ODDecodeBlockFile::SetODFileDecoder(ODFileDecoder* decoder) mDecoder = decoder; mDecoderMutex.Unlock(); } - + /// Prevents a read on other threads. void ODDecodeBlockFile::LockRead() @@ -587,6 +587,6 @@ void ODDecodeBlockFile::ChangeAudioFile(wxFileName newAudioFile) { mAudioFileName = newAudioFile; } - - + + diff --git a/src/blockfile/ODDecodeBlockFile.h b/src/blockfile/ODDecodeBlockFile.h index 169c1ac96..28da169a0 100644 --- a/src/blockfile/ODDecodeBlockFile.h +++ b/src/blockfile/ODDecodeBlockFile.h @@ -3,7 +3,7 @@ Audacity: A Digital Audio Editor ODDecodeBlockFile.h - + Created by Michael Chinen (mchinen) Audacity(R) is copyright (c) 1999-2008 Audacity Team. License: GPL v2. See License.txt. @@ -12,10 +12,10 @@ \class ODDecodeBlockFile \brief ODDecodeBlockFile is a special type of SimpleBlockFile that does not necessarily have summary OR audio data available -The summary and audio is eventually computed and written to a file in a background thread. +The summary and audio is eventually computed and written to a file in a background thread. Load On-Demand implementation of the SimpleBlockFIle for audio files that need to be decoded (mp3,flac,etc..). - + Also, see ODPCMAliasBlockFile for a similar file. *//*******************************************************************/ @@ -34,7 +34,7 @@ Also, see ODPCMAliasBlockFile for a similar file. #include "../ondemand/ODDecodeTask.h" #include -/// An AliasBlockFile that references uncompressed data in an existing file +/// An AliasBlockFile that references uncompressed data in an existing file class ODDecodeBlockFile : public SimpleBlockFile { public: @@ -49,16 +49,16 @@ class ODDecodeBlockFile : public SimpleBlockFile sampleCount aliasLen, int aliasChannel, unsigned int decodeType, float min, float max, float rms, bool dataAvailable); - virtual ~ODDecodeBlockFile(); + virtual ~ODDecodeBlockFile(); //checks to see if summary data has been computed and written to disk yet. Thread safe. Blocks if we are writing summary data. virtual bool IsSummaryAvailable(); - + /// Returns TRUE if this block's complete data is ready to be accessed by Read() virtual bool IsDataAvailable(); - - /// Returns TRUE if the summary has not yet been written, but is actively being computed and written to disk + + /// Returns TRUE if the summary has not yet been written, but is actively being computed and written to disk virtual bool IsSummaryBeingComputed(){return false;} - + //Calls that rely on summary files need to be overidden virtual wxLongLong GetSpaceUsage(); /// Gets extreme values for the specified region @@ -70,15 +70,15 @@ class ODDecodeBlockFile : public SimpleBlockFile virtual bool Read256(float *buffer, sampleCount start, sampleCount len); /// Returns the 64K summary data block virtual bool Read64K(float *buffer, sampleCount start, sampleCount len); - + /// returns true before decoding is complete, because it is linked to the encoded file until then. /// returns false afterwards. - - + + ///Makes new ODPCMAliasBlockFile or PCMAliasBlockFile depending on summary availability virtual BlockFile *Copy(wxFileName fileName); - + ///Saves as xml ODPCMAliasBlockFile or PCMAliasBlockFile depending on summary availability virtual void SaveXML(XMLWriter &xmlFile); @@ -87,104 +87,104 @@ class ODDecodeBlockFile : public SimpleBlockFile ///Writes the summary file if summary data is available virtual void Recover(void); - + ///A public interface to WriteSummary int DoWriteBlockFile(){return WriteODDecodeBlockFile();} - + int WriteODDecodeBlockFile(); - + ///Sets the value that indicates where the first sample in this block corresponds to the global sequence/clip. Only for display use. void SetStart(sampleCount startSample){mStart = startSample;} - + ///Gets the value that indicates where the first sample in this block corresponds to the global sequence/clip. Only for display use. sampleCount GetStart(){return mStart;} - + //returns the number of samples from the beginning of the track that this blockfile starts at sampleCount GetGlobalStart(){return mClipOffset+mStart;} //returns the number of samples from the beginning of the track that this blockfile ends at sampleCount GetGlobalEnd(){return mClipOffset+mStart+GetLength();} - + //Below calls are overrided just so we can take wxlog calls out, which are not threadsafe. - + /// Reads the specified data from the aliased file using libsndfile virtual int ReadData(samplePtr data, sampleFormat format, sampleCount start, sampleCount len); - + /// Read the summary into a buffer virtual bool ReadSummary(void *data); - + ///Returns the type of audiofile this blockfile is loaded from. virtual unsigned int GetDecodeType(){return mType;} virtual void SetDecodeType(unsigned int type){mType=type;} - + ///sets the amount of samples the clip associated with this blockfile is offset in the wavetrack (non effecting) void SetClipOffset(sampleCount numSamples){mClipOffset= numSamples;} - - ///Gets the number of samples the clip associated with this blockfile is offset by. + + ///Gets the number of samples the clip associated with this blockfile is offset by. sampleCount GetClipOffset(){return mClipOffset;} - + //OD TODO:set ISAlias to true while we have no data? - + ///set the decoder, void SetODFileDecoder(ODFileDecoder* decoder); - + wxFileName GetAudioFileName(){return mAudioFileName;} - + ///sets the file name the summary info will be saved in. threadsafe. virtual void SetFileName(wxFileName &name); virtual wxFileName GetFileName(); - + /// Prevents a read on other threads of the encoded audio file. virtual void LockRead(); /// Allows reading of encoded file on other threads. virtual void UnlockRead(); - + ///// Get the name of the file where the audio data for this block is /// stored. wxFileName GetEncodedAudioFilename() { return mAudioFileName; } - + /// Modify this block to point at a different file. This is generally /// looked down on, but it is necessary in one case: see /// DirManager::EnsureSafeFilename(). void ChangeAudioFile(wxFileName newAudioFile); protected: - + // virtual void WriteSimpleBlockFile(); virtual void *CalcSummary(samplePtr buffer, sampleCount len, sampleFormat format); //The on demand type. unsigned int mType; - - ///This lock is for the filename (string) of the blockfile that contains summary/audio data + + ///This lock is for the filename (string) of the blockfile that contains summary/audio data ///after decoding ODLock mFileNameMutex; - + ///The original file the audio came from. wxFileName mAudioFileName; ODLock mDataAvailableMutex; bool mDataAvailable; bool mDataBeingComputed; - + ODFileDecoder* mDecoder; ODLock mDecoderMutex; - + ///For accessing the audio file that will be decoded. Used by dir manager; ODLock mReadDataMutex; - + ///for reporting after task is complete. Only for display use. sampleCount mStart; ///the ODTask needs to know where this blockfile lies in the track, so for convenience, we have this here. sampleCount mClipOffset; - + sampleFormat mFormat; - + sampleCount mAliasStart;//where in the encoded audio file this block corresponds to. int mAliasChannel;//The channel number in the encoded file.. diff --git a/src/blockfile/ODPCMAliasBlockFile.cpp b/src/blockfile/ODPCMAliasBlockFile.cpp index e2e567dcc..1c7a2b274 100644 --- a/src/blockfile/ODPCMAliasBlockFile.cpp +++ b/src/blockfile/ODPCMAliasBlockFile.cpp @@ -3,7 +3,7 @@ Audacity: A Digital Audio Editor ODPCMAliasBlockFile.cpp - + Created by Michael Chinen (mchinen) Audacity(R) is copyright (c) 1999-2008 Audacity Team. License: GPL v2. See License.txt. @@ -44,10 +44,10 @@ char aheaderTag[aheaderTagLen + 1] = "AudacityBlockFile112"; ODPCMAliasBlockFile::ODPCMAliasBlockFile( wxFileName fileName, - wxFileName aliasedFileName, + wxFileName aliasedFileName, sampleCount aliasStart, sampleCount aliasLen, int aliasChannel) -: PCMAliasBlockFile(fileName, aliasedFileName, +: PCMAliasBlockFile(fileName, aliasedFileName, aliasStart, aliasLen, aliasChannel,false) { mSummaryAvailable = mSummaryBeingComputed = mHasBeenSaved = false; @@ -56,16 +56,16 @@ ODPCMAliasBlockFile::ODPCMAliasBlockFile( ///summaryAvailable should be true if the file has been written already. ODPCMAliasBlockFile::ODPCMAliasBlockFile( wxFileName existingSummaryFileName, - wxFileName aliasedFileName, + wxFileName aliasedFileName, sampleCount aliasStart, sampleCount aliasLen, int aliasChannel, float min, float max, float rms, bool summaryAvailable) -: PCMAliasBlockFile(existingSummaryFileName, aliasedFileName, +: PCMAliasBlockFile(existingSummaryFileName, aliasedFileName, aliasStart, aliasLen, aliasChannel, min, max, rms) { mSummaryAvailable=summaryAvailable; - mSummaryBeingComputed=mHasBeenSaved=false; + mSummaryBeingComputed=mHasBeenSaved=false; } ODPCMAliasBlockFile::~ODPCMAliasBlockFile() @@ -103,7 +103,7 @@ bool ODPCMAliasBlockFile::Deref() //Check to see if we have the file for these calls. wxLongLong ODPCMAliasBlockFile::GetSpaceUsage() -{ +{ if(IsSummaryAvailable()) { wxLongLong ret; @@ -120,7 +120,7 @@ wxLongLong ODPCMAliasBlockFile::GetSpaceUsage() } /// Locks the blockfile only if it has a file that exists. This needs to be done -/// so that the unsaved ODPCMAliasBlockfiles are deleted upon exit +/// so that the unsaved ODPCMAliasBlockfiles are deleted upon exit void ODPCMAliasBlockFile::Lock() { if(IsSummaryAvailable()&&mHasBeenSaved) @@ -131,12 +131,12 @@ void ODPCMAliasBlockFile::Lock() void ODPCMAliasBlockFile::CloseLock() { if(mHasBeenSaved) - PCMAliasBlockFile::Lock(); + PCMAliasBlockFile::Lock(); } /// unlocks the blockfile only if it has a file that exists. This needs to be done -/// so that the unsaved ODPCMAliasBlockfiles are deleted upon exit +/// so that the unsaved ODPCMAliasBlockfiles are deleted upon exit void ODPCMAliasBlockFile::Unlock() { if(IsSummaryAvailable() && IsLocked()) @@ -154,7 +154,7 @@ void ODPCMAliasBlockFile::GetMinMax(sampleCount start, sampleCount len, } else { - //fake values. These values are used usually for normalization and amplifying, so we want + //fake values. These values are used usually for normalization and amplifying, so we want //the max to be maximal and the min to be minimal *outMin = -1.0*JUST_BELOW_MAX_AUDIO; *outMax = 1.0*JUST_BELOW_MAX_AUDIO; @@ -171,7 +171,7 @@ void ODPCMAliasBlockFile::GetMinMax(float *outMin, float *outMax, float *outRMS) } else { - //fake values. These values are used usually for normalization and amplifying, so we want + //fake values. These values are used usually for normalization and amplifying, so we want //the max to be maximal and the min to be minimal *outMin = -1.0*JUST_BELOW_MAX_AUDIO; *outMax = 1.0*JUST_BELOW_MAX_AUDIO; @@ -188,7 +188,7 @@ bool ODPCMAliasBlockFile::Read256(float *buffer, sampleCount start, sampleCount } else { - //return nothing. + //return nothing. buffer = NULL; return true; } @@ -216,11 +216,11 @@ bool ODPCMAliasBlockFile::Read64K(float *buffer, sampleCount start, sampleCount BlockFile *ODPCMAliasBlockFile::Copy(wxFileName newFileName) { BlockFile *newBlockFile; - + //mAliasedFile can change so we lock readdatamutex, which is responsible for it. LockRead(); //If the file has been written AND it has been saved, we create a PCM alias blockfile because for - //all intents and purposes, it is the same. + //all intents and purposes, it is the same. //However, if it hasn't been saved yet, we shouldn't create one because the default behavior of the //PCMAliasBlockFile is to lock on exit, and this will cause orphaned blockfiles.. if(IsSummaryAvailable() && mHasBeenSaved) @@ -240,9 +240,9 @@ BlockFile *ODPCMAliasBlockFile::Copy(wxFileName newFileName) mMin, mMax, mRMS,IsSummaryAvailable()); //The client code will need to schedule this blockfile for OD summarizing if it is going to a new track. } - + UnlockRead(); - + return newBlockFile; } @@ -270,7 +270,7 @@ void ODPCMAliasBlockFile::SaveXML(XMLWriter &xmlFile) xmlFile.WriteAttr(wxT("summaryfile"), mFileName.GetFullName()); mFileNameMutex.Unlock(); LockRead(); - + xmlFile.WriteAttr(wxT("aliasfile"), mAliasedFileName.GetFullPath()); xmlFile.WriteAttr(wxT("aliasstart"), mAliasStart); xmlFile.WriteAttr(wxT("aliaslen"), mLen); @@ -278,14 +278,14 @@ void ODPCMAliasBlockFile::SaveXML(XMLWriter &xmlFile) xmlFile.EndTag(wxT("odpcmaliasblockfile")); } - + UnlockRead(); } /// Constructs a ODPCMAliasBlockFile from the xml output of WriteXML. /// Does not schedule the ODPCMAliasBlockFile for OD loading. Client code must do this. -// BuildFromXML methods should always return a BlockFile, not NULL, -// even if the result is flawed (e.g., refers to nonexistent file), +// BuildFromXML methods should always return a BlockFile, not NULL, +// even if the result is flawed (e.g., refers to nonexistent file), // as testing will be done in DirManager::ProjectFSCK(). BlockFile *ODPCMAliasBlockFile::BuildFromXML(DirManager &dm, const wxChar **attrs) { @@ -299,13 +299,13 @@ BlockFile *ODPCMAliasBlockFile::BuildFromXML(DirManager &dm, const wxChar **attr { const wxChar *attr = *attrs++; const wxChar *value = *attrs++; - if (!value) + if (!value) break; const wxString strValue = value; - if (!wxStricmp(attr, wxT("summaryfile")) && + if (!wxStricmp(attr, wxT("summaryfile")) && // Can't use XMLValueChecker::IsGoodFileName here, but do part of its test. - XMLValueChecker::IsGoodFileString(strValue) && + XMLValueChecker::IsGoodFileString(strValue) && (strValue.Length() + 1 + dm.GetProjectDataDir().Length() <= PLATFORM_MAX_PATH)) { if (!dm.AssignFile(summaryFileName, strValue, false)) @@ -320,12 +320,12 @@ BlockFile *ODPCMAliasBlockFile::BuildFromXML(DirManager &dm, const wxChar **attr // Allow fallback of looking for the file name, located in the data directory. aliasFileName.Assign(dm.GetProjectDataDir(), strValue); else if (XMLValueChecker::IsGoodPathString(strValue)) - // If the aliased file is missing, we failed XMLValueChecker::IsGoodPathName() - // and XMLValueChecker::IsGoodFileName, because both do existence tests, + // If the aliased file is missing, we failed XMLValueChecker::IsGoodPathName() + // and XMLValueChecker::IsGoodFileName, because both do existence tests, // but we want to keep the reference to the missing file because it's a good path string. aliasFileName.Assign(strValue); } - else if (XMLValueChecker::IsGoodInt(strValue) && strValue.ToLong(&nValue)) + else if (XMLValueChecker::IsGoodInt(strValue) && strValue.ToLong(&nValue)) { // integer parameters if (!wxStricmp(attr, wxT("aliasstart")) && (nValue >= 0)) aliasStart = nValue; @@ -394,9 +394,9 @@ void ODPCMAliasBlockFile::WriteSummary() //(it moves from /tmp/ to wherever it is saved to. mFileNameMutex.Lock(); - //wxFFile is not thread-safe - if any error occurs in opening the file, + //wxFFile is not thread-safe - if any error occurs in opening the file, // it posts a wxlog message which WILL crash - // Audacity because it goes into the wx GUI. + // Audacity because it goes into the wx GUI. // For this reason I left the wxFFile method commented out. (mchinen) // wxFFile summaryFile(mFileName.GetFullPath(), wxT("wb")); @@ -409,7 +409,7 @@ void ODPCMAliasBlockFile::WriteSummary() mFileNameMutex.Unlock(); if( !summaryFile){//.IsOpened() ){ - + // Never silence the Log w.r.t write errors; they always count //however, this is going to be called from a non-main thread, //and wxLog calls are not thread safe. @@ -426,14 +426,14 @@ void ODPCMAliasBlockFile::WriteSummary() void *summaryData = CalcSummary(sampleData, mLen, floatSample); - + //summaryFile.Write(summaryData, mSummaryInfo.totalSummaryBytes); fwrite(summaryData, 1, mSummaryInfo.totalSummaryBytes, summaryFile); fclose(summaryFile); DeleteSamples(sampleData); delete [] (char *) summaryData; - - + + // printf("write successful. filename: %s\n", fileNameChar); mSummaryAvailableMutex.Lock(); @@ -471,7 +471,7 @@ void *ODPCMAliasBlockFile::CalcSummary(samplePtr buffer, sampleCount len, float *summary256 = (float *)(localFullSummary + mSummaryInfo.offset256); float *fbuffer; - + //mchinen: think we can hack this - don't allocate and copy if we don't need to., if(format==floatSample) { @@ -492,7 +492,7 @@ void *ODPCMAliasBlockFile::CalcSummary(samplePtr buffer, sampleCount len, // Recalc 256 summaries sumLen = (len + 255) / 256; - + for (i = 0; i < sumLen; i++) { min = fbuffer[i * 256]; max = fbuffer[i * 256]; @@ -515,7 +515,7 @@ void *ODPCMAliasBlockFile::CalcSummary(samplePtr buffer, sampleCount len, summary256[i * 3 + 1] = max; summary256[i * 3 + 2] = rms; } - + for (i = sumLen; i < mSummaryInfo.frames256; i++) { // filling in the remaining bits with non-harming/contributing values summary256[i * 3] = FLT_MAX; // min @@ -571,7 +571,7 @@ void *ODPCMAliasBlockFile::CalcSummary(samplePtr buffer, sampleCount len, mMin = min; mMax = max; mRMS = sqrt(sumsq / sumLen); - + //if we've used the float sample.. if(format!=floatSample) @@ -600,7 +600,7 @@ int ODPCMAliasBlockFile::ReadData(samplePtr data, sampleFormat format, SF_INFO info; - if(!mAliasedFileName.IsOk()){ // intentionally silenced + if(!mAliasedFileName.IsOk()){ // intentionally silenced memset(data,0,SAMPLE_SIZE(format)*len); UnlockRead(); @@ -611,7 +611,7 @@ int ODPCMAliasBlockFile::ReadData(samplePtr data, sampleFormat format, wxString aliasPath = mAliasedFileName.GetFullPath(); //there are thread-unsafe crashes here - not sure why. sf_open may be called on the same file - //from different threads, but this seems okay, unless it is implemented strangely.. + //from different threads, but this seems okay, unless it is implemented strangely.. static ODLock sfMutex; wxFile f; // will be closed when it goes out of scope @@ -625,9 +625,9 @@ int ODPCMAliasBlockFile::ReadData(samplePtr data, sampleFormat format, sf = sf_open_fd(f.fd(), SFM_READ, &info, FALSE); ODManager::UnlockLibSndFileMutex(); } - + if (!sf){ - + memset(data,0,SAMPLE_SIZE(format)*len); mSilentAliasLog=TRUE; @@ -681,7 +681,7 @@ int ODPCMAliasBlockFile::ReadData(samplePtr data, sampleFormat format, ODManager::LockLibSndFileMutex(); sf_close(sf); ODManager::UnlockLibSndFileMutex(); - + UnlockRead(); return framesRead; } @@ -693,31 +693,31 @@ int ODPCMAliasBlockFile::ReadData(samplePtr data, sampleFormat format, /// be at least mSummaryInfo.totalSummaryBytes long. bool ODPCMAliasBlockFile::ReadSummary(void *data) { - + mFileNameMutex.Lock(); wxFFile summaryFile(mFileName.GetFullPath(), wxT("rb")); - + if( !summaryFile.IsOpened() ){ // new model; we need to return valid data memset(data,0,(size_t)mSummaryInfo.totalSummaryBytes); - + // we silence the logging for this operation in this object // after first occurrence of error; it's already reported and // spewing at the user will complicate the user's ability to // deal mSilentLog=TRUE; - + mFileNameMutex.Unlock(); return true; - }else mSilentLog=FALSE; // worked properly, any future error is new + }else mSilentLog=FALSE; // worked properly, any future error is new int read = summaryFile.Read(data, (size_t)mSummaryInfo.totalSummaryBytes); FixSummary(data); - + mFileNameMutex.Unlock(); return (read == mSummaryInfo.totalSummaryBytes); } diff --git a/src/blockfile/ODPCMAliasBlockFile.h b/src/blockfile/ODPCMAliasBlockFile.h index 2ed8cef0a..1594c8096 100644 --- a/src/blockfile/ODPCMAliasBlockFile.h +++ b/src/blockfile/ODPCMAliasBlockFile.h @@ -3,7 +3,7 @@ Audacity: A Digital Audio Editor ODPCMAliasBlockFile.cpp - + Created by Michael Chinen (mchinen) Audacity(R) is copyright (c) 1999-2008 Audacity Team. License: GPL v2. See License.txt. @@ -15,12 +15,12 @@ The summary is eventually computed and written to a file in a background thread. Load On-Demand implementation of the AliasBlockFile for PCM files. - + to load large files more quickly, we take skip computing the summary data and put -ODPCMAliasBlockFiles in the sequence as place holders. A background thread loads and +ODPCMAliasBlockFiles in the sequence as place holders. A background thread loads and computes the summary data into these classes. ODPCMAliasBlockFiles are unlike all other BlockFiles are not immutable (for the most part,) because when new -summary data is computed for an existing ODPCMAliasBlockFile we save the buffer then and write the Summary File. +summary data is computed for an existing ODPCMAliasBlockFile we save the buffer then and write the Summary File. All BlockFile methods that treat the summary data as a buffer that exists in its BlockFile are implemented here to behave when the data is not available yet. @@ -42,7 +42,7 @@ Some of these methods have been overridden only because they used the unsafe wxL #include "../DirManager.h" #include -/// An AliasBlockFile that references uncompressed data in an existing file +/// An AliasBlockFile that references uncompressed data in an existing file class ODPCMAliasBlockFile : public PCMAliasBlockFile { public: @@ -55,13 +55,13 @@ class ODPCMAliasBlockFile : public PCMAliasBlockFile sampleCount aliasLen, int aliasChannel, float min, float max, float rms, bool summaryAvailable); virtual ~ODPCMAliasBlockFile(); - + //checks to see if summary data has been computed and written to disk yet. Thread safe. Blocks if we are writing summary data. virtual bool IsSummaryAvailable(); - - /// Returns TRUE if the summary has not yet been written, but is actively being computed and written to disk + + /// Returns TRUE if the summary has not yet been written, but is actively being computed and written to disk virtual bool IsSummaryBeingComputed(){return mSummaryBeingComputed;} - + //Calls that rely on summary files need to be overidden virtual wxLongLong GetSpaceUsage(); /// Gets extreme values for the specified region @@ -76,7 +76,7 @@ class ODPCMAliasBlockFile : public PCMAliasBlockFile ///Makes new ODPCMAliasBlockFile or PCMAliasBlockFile depending on summary availability virtual BlockFile *Copy(wxFileName fileName); - + ///Saves as xml ODPCMAliasBlockFile or PCMAliasBlockFile depending on summary availability virtual void SaveXML(XMLWriter &xmlFile); @@ -85,61 +85,61 @@ class ODPCMAliasBlockFile : public PCMAliasBlockFile ///Writes the summary file if summary data is available virtual void Recover(void); - + ///A public interface to WriteSummary void DoWriteSummary(); - + ///Sets the value that indicates where the first sample in this block corresponds to the global sequence/clip. Only for display use. void SetStart(sampleCount startSample){mStart = startSample;} - + ///Gets the value that indicates where the first sample in this block corresponds to the global sequence/clip. Only for display use. sampleCount GetStart(){return mStart;} - + /// Locks the blockfile only if it has a file that exists. void Lock(); /// Unlocks the blockfile only if it has a file that exists. void Unlock(); - + ///sets the amount of samples the clip associated with this blockfile is offset in the wavetrack (non effecting) void SetClipOffset(sampleCount numSamples){mClipOffset= numSamples;} - - ///Gets the number of samples the clip associated with this blockfile is offset by. + + ///Gets the number of samples the clip associated with this blockfile is offset by. sampleCount GetClipOffset(){return mClipOffset;} - + //returns the number of samples from the beginning of the track that this blockfile starts at sampleCount GetGlobalStart(){return mClipOffset+mStart;} //returns the number of samples from the beginning of the track that this blockfile ends at sampleCount GetGlobalEnd(){return mClipOffset+mStart+GetLength();} - + //Below calls are overrided just so we can take wxlog calls out, which are not threadsafe. - + /// Reads the specified data from the aliased file using libsndfile virtual int ReadData(samplePtr data, sampleFormat format, sampleCount start, sampleCount len); - + /// Read the summary into a buffer virtual bool ReadSummary(void *data); - + ///sets the file name the summary info will be saved in. threadsafe. virtual void SetFileName(wxFileName &name); virtual wxFileName GetFileName(); //when the file closes, it locks the blockfiles, but it calls this so we can check if it has been saved before. virtual void CloseLock(); - + /// Prevents a read on other threads. virtual void LockRead(); /// Allows reading on other threads. virtual void UnlockRead(); - + protected: virtual void WriteSummary(); virtual void *CalcSummary(samplePtr buffer, sampleCount len, sampleFormat format); - + private: //Thread-safe versions virtual void Ref(); @@ -169,7 +169,7 @@ class ODPCMAliasBlockFile : public PCMAliasBlockFile bool mSummaryAvailable; bool mSummaryBeingComputed; bool mHasBeenSaved; - + ///for reporting after task is complete. Only for display use. sampleCount mStart; diff --git a/src/blockfile/PCMAliasBlockFile.cpp b/src/blockfile/PCMAliasBlockFile.cpp index 2d3de8bd0..c4e2c24da 100644 --- a/src/blockfile/PCMAliasBlockFile.cpp +++ b/src/blockfile/PCMAliasBlockFile.cpp @@ -26,10 +26,10 @@ extern AudioIO *gAudioIO; PCMAliasBlockFile::PCMAliasBlockFile( wxFileName fileName, - wxFileName aliasedFileName, + wxFileName aliasedFileName, sampleCount aliasStart, - sampleCount aliasLen, int aliasChannel) -: AliasBlockFile(fileName, aliasedFileName, + sampleCount aliasLen, int aliasChannel) +: AliasBlockFile(fileName, aliasedFileName, aliasStart, aliasLen, aliasChannel) { AliasBlockFile::WriteSummary(); @@ -37,10 +37,10 @@ PCMAliasBlockFile::PCMAliasBlockFile( PCMAliasBlockFile::PCMAliasBlockFile( wxFileName fileName, - wxFileName aliasedFileName, + wxFileName aliasedFileName, sampleCount aliasStart, sampleCount aliasLen, int aliasChannel,bool writeSummary) -: AliasBlockFile(fileName, aliasedFileName, +: AliasBlockFile(fileName, aliasedFileName, aliasStart, aliasLen, aliasChannel) { if(writeSummary) @@ -49,11 +49,11 @@ PCMAliasBlockFile::PCMAliasBlockFile( PCMAliasBlockFile::PCMAliasBlockFile( wxFileName existingSummaryFileName, - wxFileName aliasedFileName, + wxFileName aliasedFileName, sampleCount aliasStart, sampleCount aliasLen, int aliasChannel, float min, float max, float rms) -: AliasBlockFile(existingSummaryFileName, aliasedFileName, +: AliasBlockFile(existingSummaryFileName, aliasedFileName, aliasStart, aliasLen, aliasChannel, min, max, rms) { @@ -75,7 +75,7 @@ int PCMAliasBlockFile::ReadData(samplePtr data, sampleFormat format, { SF_INFO info; - if(!mAliasedFileName.IsOk()){ // intentionally silenced + if(!mAliasedFileName.IsOk()){ // intentionally silenced memset(data,0,SAMPLE_SIZE(format)*len); return len; } @@ -103,7 +103,7 @@ int PCMAliasBlockFile::ReadData(samplePtr data, sampleFormat format, memset(data,0,SAMPLE_SIZE(format)*len); if(silence) delete silence; mSilentAliasLog=TRUE; - + // Set a marker to display an error message for the silence if (!wxGetApp().ShouldShowMissingAliasedFileWarning()) wxGetApp().MarkAliasedFilesMissingWarning(this); @@ -183,8 +183,8 @@ void PCMAliasBlockFile::SaveXML(XMLWriter &xmlFile) xmlFile.EndTag(wxT("pcmaliasblockfile")); } -// BuildFromXML methods should always return a BlockFile, not NULL, -// even if the result is flawed (e.g., refers to nonexistent file), +// BuildFromXML methods should always return a BlockFile, not NULL, +// even if the result is flawed (e.g., refers to nonexistent file), // as testing will be done in DirManager::ProjectFSCK(). BlockFile *PCMAliasBlockFile::BuildFromXML(DirManager &dm, const wxChar **attrs) { @@ -199,13 +199,13 @@ BlockFile *PCMAliasBlockFile::BuildFromXML(DirManager &dm, const wxChar **attrs) { const wxChar *attr = *attrs++; const wxChar *value = *attrs++; - if (!value) + if (!value) break; const wxString strValue = value; - if (!wxStricmp(attr, wxT("summaryfile")) && + if (!wxStricmp(attr, wxT("summaryfile")) && // Can't use XMLValueChecker::IsGoodFileName here, but do part of its test. - XMLValueChecker::IsGoodFileString(strValue) && + XMLValueChecker::IsGoodFileString(strValue) && (strValue.Length() + 1 + dm.GetProjectDataDir().Length() <= PLATFORM_MAX_PATH)) { if (!dm.AssignFile(summaryFileName, strValue, false)) @@ -220,12 +220,12 @@ BlockFile *PCMAliasBlockFile::BuildFromXML(DirManager &dm, const wxChar **attrs) // Allow fallback of looking for the file name, located in the data directory. aliasFileName.Assign(dm.GetProjectDataDir(), strValue); else if (XMLValueChecker::IsGoodPathString(strValue)) - // If the aliased file is missing, we failed XMLValueChecker::IsGoodPathName() - // and XMLValueChecker::IsGoodFileName, because both do existence tests, + // If the aliased file is missing, we failed XMLValueChecker::IsGoodPathName() + // and XMLValueChecker::IsGoodFileName, because both do existence tests, // but we want to keep the reference to the missing file because it's a good path string. aliasFileName.Assign(strValue); } - else if (XMLValueChecker::IsGoodInt(strValue) && strValue.ToLong(&nValue)) + else if (XMLValueChecker::IsGoodInt(strValue) && strValue.ToLong(&nValue)) { // integer parameters if (!wxStricmp(attr, wxT("aliasstart")) && (nValue >= 0)) aliasStart = nValue; diff --git a/src/blockfile/PCMAliasBlockFile.h b/src/blockfile/PCMAliasBlockFile.h index 54bc8ca48..ebba99e7a 100644 --- a/src/blockfile/PCMAliasBlockFile.h +++ b/src/blockfile/PCMAliasBlockFile.h @@ -20,17 +20,17 @@ class PCMAliasBlockFile : public AliasBlockFile public: /// Constructs a PCMAliasBlockFile, writing the summary to disk PCMAliasBlockFile(wxFileName baseFileName, - wxFileName aliasedFileName, + wxFileName aliasedFileName, sampleCount aliasStart, sampleCount aliasLen, int aliasChannel); ///Constructs a PCMAliasBlockFile with the option of not writing to disk PCMAliasBlockFile(wxFileName fileName, - wxFileName aliasedFileName, + wxFileName aliasedFileName, sampleCount aliasStart, - sampleCount aliasLen, int aliasChannel,bool writeSummary); - + sampleCount aliasLen, int aliasChannel,bool writeSummary); + PCMAliasBlockFile(wxFileName existingSummaryFileName, - wxFileName aliasedFileName, + wxFileName aliasedFileName, sampleCount aliasStart, sampleCount aliasLen, int aliasChannel, float min, float max, float rms); @@ -39,7 +39,7 @@ class PCMAliasBlockFile : public AliasBlockFile /// Reads the specified data from the aliased file using libsndfile virtual int ReadData(samplePtr data, sampleFormat format, sampleCount start, sampleCount len); - + virtual void SaveXML(XMLWriter &xmlFile); virtual BlockFile *Copy(wxFileName fileName); virtual void Recover(); diff --git a/src/blockfile/SilentBlockFile.cpp b/src/blockfile/SilentBlockFile.cpp index 79d816b2a..e2ab7b82f 100644 --- a/src/blockfile/SilentBlockFile.cpp +++ b/src/blockfile/SilentBlockFile.cpp @@ -46,8 +46,8 @@ void SilentBlockFile::SaveXML(XMLWriter &xmlFile) xmlFile.EndTag(wxT("silentblockfile")); } -// BuildFromXML methods should always return a BlockFile, not NULL, -// even if the result is flawed (e.g., refers to nonexistent file), +// BuildFromXML methods should always return a BlockFile, not NULL, +// even if the result is flawed (e.g., refers to nonexistent file), // as testing will be done in DirManager::ProjectFSCK(). /// static BlockFile *SilentBlockFile::BuildFromXML(DirManager & WXUNUSED(dm), const wxChar **attrs) @@ -63,10 +63,10 @@ BlockFile *SilentBlockFile::BuildFromXML(DirManager & WXUNUSED(dm), const wxChar break; const wxString strValue = value; - if (!wxStrcmp(attr, wxT("len")) && - XMLValueChecker::IsGoodInt(strValue) && - strValue.ToLong(&nValue) && - nValue > 0) + if (!wxStrcmp(attr, wxT("len")) && + XMLValueChecker::IsGoodInt(strValue) && + strValue.ToLong(&nValue) && + nValue > 0) len = nValue; } diff --git a/src/blockfile/SimpleBlockFile.cpp b/src/blockfile/SimpleBlockFile.cpp index 70530b2a2..c2565882c 100644 --- a/src/blockfile/SimpleBlockFile.cpp +++ b/src/blockfile/SimpleBlockFile.cpp @@ -15,7 +15,7 @@ *//****************************************************************//** \class SimpleBlockFile -\brief A BlockFile that reads and writes uncompressed data using +\brief A BlockFile that reads and writes uncompressed data using libsndfile A block file that writes the audio data to an .au file and reads @@ -42,7 +42,7 @@ default is to disable caching. will be called on all block files and they will be written to disk. During normal editing, no write cache is active, that is, any block files will be written to disk instantly. - + Even with write cache, auto recovery during normal editing will work as expected. However, auto recovery during recording will not work (not even manual auto recovery, because the files are never written physically to @@ -51,8 +51,8 @@ default is to disable caching. *//****************************************************************//** \class auHeader -\brief The auHeader is a structure used by SimpleBlockFile for .au file -format. There probably is an 'official' header file we should include +\brief The auHeader is a structure used by SimpleBlockFile for .au file +format. There probably is an 'official' header file we should include to get its definition, rather than rolling our own. *//*******************************************************************/ @@ -102,15 +102,15 @@ SimpleBlockFile::SimpleBlockFile(wxFileName baseFileName, BlockFile(wxFileName(baseFileName.GetFullPath() + wxT(".au")), sampleLen) { mCache.active = false; - + bool useCache = GetCache() && (!bypassCache); if (!(allowDeferredWrite && useCache) && !bypassCache) { bool bSuccess = WriteSimpleBlockFile(sampleData, sampleLen, format, NULL); - wxASSERT(bSuccess); // TODO: Handle failure here by alert to user and undo partial op. + wxASSERT(bSuccess); // TODO: Handle failure here by alert to user and undo partial op. } - + if (useCache) { //wxLogDebug("SimpleBlockFile::SimpleBlockFile(): Caching block file data."); mCache.active = true; @@ -202,7 +202,7 @@ bool SimpleBlockFile::WriteSimpleBlockFile( // Write the file if (!summaryData) summaryData = /*BlockFile::*/CalcSummary(sampleData, sampleLen, format); //mchinen:allowing virtual override of calc summary for ODDecodeBlockFile. - + size_t nBytesToWrite = sizeof(header); size_t nBytesWritten = file.Write(&header, nBytesToWrite); if (nBytesWritten != nBytesToWrite) @@ -229,7 +229,7 @@ bool SimpleBlockFile::WriteSimpleBlockFile( for( int i = 0; i < sampleLen; i++ ) { nBytesToWrite = 3; - nBytesWritten = + nBytesWritten = #if wxBYTE_ORDER == wxBIG_ENDIAN file.Write((char*)&int24sampleData[i] + 1, nBytesToWrite); #else @@ -254,7 +254,7 @@ bool SimpleBlockFile::WriteSimpleBlockFile( return false; } } - + return true; } @@ -278,9 +278,9 @@ void SimpleBlockFile::FillCache() // Corrupt file return; } - + wxUint32 encoding; - + if (header.magic == 0x2e736e64) encoding = header.encoding; // correct endianness else @@ -299,9 +299,9 @@ void SimpleBlockFile::FillCache() mCache.format = floatSample; break; } - + file.Close(); - + // Read samples into cache mCache.sampleData = new char[mLen * SAMPLE_SIZE(mCache.format)]; if (ReadData(mCache.sampleData, mCache.format, 0, mLen) != mLen) @@ -319,7 +319,7 @@ void SimpleBlockFile::FillCache() // Cache is active but already on disk mCache.active = true; mCache.needWrite = false; - + //wxLogDebug("SimpleBlockFile::FillCache(): Succesfully read simple block file into cache."); } @@ -337,30 +337,30 @@ bool SimpleBlockFile::ReadSummary(void *data) } else { //wxLogDebug("SimpleBlockFile::ReadSummary(): Reading summary from disk."); - + wxFFile file(mFileName.GetFullPath(), wxT("rb")); wxLogNull *silence=0; if(mSilentLog)silence= new wxLogNull(); - + if(!file.IsOpened() ){ - + memset(data,0,(size_t)mSummaryInfo.totalSummaryBytes); if(silence) delete silence; mSilentLog=TRUE; return true; - + } if(silence) delete silence; mSilentLog=FALSE; - + // The offset is just past the au header if( !file.Seek(sizeof(auHeader)) ) return false; - + int read = (int)file.Read(data, (size_t)mSummaryInfo.totalSummaryBytes); FixSummary(data); @@ -382,7 +382,7 @@ int SimpleBlockFile::ReadData(samplePtr data, sampleFormat format, if (mCache.active) { //wxLogDebug("SimpleBlockFile::ReadData(): Data are already in cache."); - + if (len > mLen - start) len = mLen - start; CopySamples( @@ -393,11 +393,11 @@ int SimpleBlockFile::ReadData(samplePtr data, sampleFormat format, } else { //wxLogDebug("SimpleBlockFile::ReadData(): Reading data from disk."); - + SF_INFO info; wxLogNull *silence=0; if(mSilentLog)silence= new wxLogNull(); - + memset(&info, 0, sizeof(info)); wxFile f; // will be closed when it goes out of scope @@ -411,7 +411,7 @@ int SimpleBlockFile::ReadData(samplePtr data, sampleFormat format, } if (!sf) { - + memset(data,0,SAMPLE_SIZE(format)*len); if(silence) delete silence; @@ -421,7 +421,7 @@ int SimpleBlockFile::ReadData(samplePtr data, sampleFormat format, } if(silence) delete silence; mSilentLog=FALSE; - + sf_seek(sf, start, SEEK_SET); samplePtr buffer = NewSamples(len, floatSample); @@ -457,7 +457,7 @@ int SimpleBlockFile::ReadData(samplePtr data, sampleFormat format, } DeleteSamples(buffer); - + sf_close(sf); return framesRead; @@ -477,8 +477,8 @@ void SimpleBlockFile::SaveXML(XMLWriter &xmlFile) xmlFile.EndTag(wxT("simpleblockfile")); } -// BuildFromXML methods should always return a BlockFile, not NULL, -// even if the result is flawed (e.g., refers to nonexistent file), +// BuildFromXML methods should always return a BlockFile, not NULL, +// even if the result is flawed (e.g., refers to nonexistent file), // as testing will be done in DirManager::ProjectFSCK(). /// static BlockFile *SimpleBlockFile::BuildFromXML(DirManager &dm, const wxChar **attrs) @@ -497,18 +497,18 @@ BlockFile *SimpleBlockFile::BuildFromXML(DirManager &dm, const wxChar **attrs) break; const wxString strValue = value; - if (!wxStricmp(attr, wxT("filename")) && + if (!wxStricmp(attr, wxT("filename")) && // Can't use XMLValueChecker::IsGoodFileName here, but do part of its test. - XMLValueChecker::IsGoodFileString(strValue) && + XMLValueChecker::IsGoodFileString(strValue) && (strValue.Length() + 1 + dm.GetProjectDataDir().Length() <= PLATFORM_MAX_PATH)) { if (!dm.AssignFile(fileName, strValue, false)) // Make sure fileName is back to uninitialized state so we can detect problem later. fileName.Clear(); } - else if (!wxStrcmp(attr, wxT("len")) && - XMLValueChecker::IsGoodInt(strValue) && strValue.ToLong(&nValue) && - nValue > 0) + else if (!wxStrcmp(attr, wxT("len")) && + XMLValueChecker::IsGoodInt(strValue) && strValue.ToLong(&nValue) && + nValue > 0) len = nValue; else if (XMLValueChecker::IsGoodString(strValue) && Internat::CompatibleToDouble(strValue, &dblValue)) { // double parameters @@ -580,7 +580,7 @@ void SimpleBlockFile::WriteCacheToDisk() { if (!GetNeedWriteCacheToDisk()) return; - + if (WriteSimpleBlockFile(mCache.sampleData, mLen, mCache.format, mCache.summaryData)) mCache.needWrite = false; @@ -592,12 +592,12 @@ bool SimpleBlockFile::GetNeedWriteCacheToDisk() } bool SimpleBlockFile::GetCache() -{ -#ifdef DEPRECATED_AUDIO_CACHE +{ +#ifdef DEPRECATED_AUDIO_CACHE // See http://bugzilla.audacityteam.org/show_bug.cgi?id=545. bool cacheBlockFiles = false; gPrefs->Read(wxT("/Directories/CacheBlockFiles"), &cacheBlockFiles); - if (!cacheBlockFiles) + if (!cacheBlockFiles) return false; int lowMem = gPrefs->Read(wxT("/Directories/CacheLowMem"), 16l); diff --git a/src/blockfile/SimpleBlockFile.h b/src/blockfile/SimpleBlockFile.h index b410b0834..47491a145 100644 --- a/src/blockfile/SimpleBlockFile.h +++ b/src/blockfile/SimpleBlockFile.h @@ -76,7 +76,7 @@ class SimpleBlockFile : public BlockFile { virtual void Recover(); static BlockFile *BuildFromXML(DirManager &dm, const wxChar **attrs); - + virtual bool GetNeedWriteCacheToDisk(); virtual void WriteCacheToDisk(); @@ -89,7 +89,7 @@ class SimpleBlockFile : public BlockFile { sampleFormat format, void* summaryData); static bool GetCache(); void ReadIntoCache(); - + SimpleBlockFileCache mCache; }; diff --git a/src/commands/CommandBuilder.cpp b/src/commands/CommandBuilder.cpp index f951f81e6..07e82d590 100644 --- a/src/commands/CommandBuilder.cpp +++ b/src/commands/CommandBuilder.cpp @@ -41,19 +41,19 @@ CommandBuilder::CommandBuilder(const wxString &cmdName, const wxString ¶ms) BuildCommand(cmdName, params); } -CommandBuilder::~CommandBuilder() -{ +CommandBuilder::~CommandBuilder() +{ Cleanup(); } -bool CommandBuilder::WasValid() +bool CommandBuilder::WasValid() { - return mValid; + return mValid; } -const wxString &CommandBuilder::GetErrorMessage() +const wxString &CommandBuilder::GetErrorMessage() { - return mError; + return mError; } Command *CommandBuilder::GetCommand() diff --git a/src/commands/CommandBuilder.h b/src/commands/CommandBuilder.h index 2843f187d..06b25bfa8 100644 --- a/src/commands/CommandBuilder.h +++ b/src/commands/CommandBuilder.h @@ -35,7 +35,7 @@ class CommandBuilder void BuildCommand(wxString cmdString); public: CommandBuilder(const wxString &cmdString); - CommandBuilder(const wxString &cmdName, + CommandBuilder(const wxString &cmdName, const wxString &cmdParams); ~CommandBuilder(); bool WasValid(); diff --git a/src/commands/CommandHandler.cpp b/src/commands/CommandHandler.cpp index db9825195..a7d28ef85 100644 --- a/src/commands/CommandHandler.cpp +++ b/src/commands/CommandHandler.cpp @@ -43,8 +43,8 @@ void CommandHandler::OnReceiveCommand(AppCommandEvent &event) Command *cmd = event.GetCommand(); // JKC: In case the user changed the project, let us track that. - // This saves us the embarrassment (crash) of a new project - // being opened, the old one closed and still trying to act + // This saves us the embarrassment (crash) of a new project + // being opened, the old one closed and still trying to act // on the old one. SetProject( GetActiveProject() ); // Then apply it to current application & project. Note that the diff --git a/src/commands/CommandManager.cpp b/src/commands/CommandManager.cpp index 997af4868..c3e4cf92e 100644 --- a/src/commands/CommandManager.cpp +++ b/src/commands/CommandManager.cpp @@ -11,8 +11,8 @@ \class CommandManager \brief CommandManager implements a system for organizing all user-callable - commands. - + commands. + It creates and manages a menu bar with a command associated with each item, and managing other commands callable by keyboard shortcuts. @@ -40,7 +40,7 @@ *//****************************************************************//** \class CommandFunctor -\brief CommandFunctor is a very small class that works with +\brief CommandFunctor is a very small class that works with CommandManager. It holds the callback for one command. *//****************************************************************//** @@ -96,7 +96,7 @@ CommandManager. It holds the callback for one command. // On wxGTK, there may be many many many plugins, but the menus don't automatically // allow for scrolling, so we build sub-menus. If the menu gets longer than // MAX_MENU_LEN, we put things in submenus that have MAX_SUBMENU_LEN items in them. -// +// #ifdef __WXGTK__ #define MAX_MENU_LEN 20 #define MAX_SUBMENU_LEN 15 @@ -142,7 +142,7 @@ void CommandManager::PurgeData() { CommandListEntry *tmpEntry = mCommandList[i]; // JKC: We only want to delete each callbacks once. - // AddItemList() may have inserted the same callback + // AddItemList() may have inserted the same callback // several times over. if( tmpEntry->callback != pCallback ) { @@ -193,7 +193,7 @@ wxMenuBar *CommandManager::AddMenuBar(wxString sMenu) /// -/// Retrieves the menubar based on the name given in AddMenuBar(name) +/// Retrieves the menubar based on the name given in AddMenuBar(name) /// wxMenuBar * CommandManager::GetMenuBar(wxString sMenu) { @@ -227,7 +227,7 @@ wxMenuBar * CommandManager::CurrentMenuBar() /// void CommandManager::BeginMenu(wxString tNameIn) { - + wxString tName = tNameIn; if( ItemShouldBeHidden( tName ) ) { @@ -249,7 +249,7 @@ void CommandManager::BeginMenu(wxString tNameIn) /// to NULL. It is still attached to the CurrentMenuBar() void CommandManager::EndMenu() { - if( mHidingLevel > 0 ) + if( mHidingLevel > 0 ) mHidingLevel--; mCurrentMenu = NULL; @@ -287,7 +287,7 @@ wxMenu* CommandManager::BeginSubMenu(wxString tNameIn) /// after BeginSubMenu() is called but before EndSubMenu() is called. void CommandManager::EndSubMenu() { - if( mHidingLevel > 0 ) + if( mHidingLevel > 0 ) { mHidingLevel--; return; @@ -469,7 +469,7 @@ void CommandManager::AddItem(const wxChar *name, unsigned int mask) { AddItem(name, label, callback, wxT(""), flags, mask); -} +} void CommandManager::AddItem(const wxChar *name, const wxChar *label_in, @@ -557,7 +557,7 @@ void CommandManager::AddItemList(wxString name, wxArrayString labels, plugins = false; // j counts the visible menu items, i counts the actual menu items. - // These numbers are the same unless we are using a simplified interface + // These numbers are the same unless we are using a simplified interface // by hiding effects with a ! before them when translated. int j=0; for(i=0; iname; @@ -678,7 +678,7 @@ int CommandManager::NewIdentifier(wxString name, wxString label, wxMenu *menu, #endif tmpEntry->defaultKey = tmpEntry->key; - // For key bindings for commands with a list, such as effects, + // For key bindings for commands with a list, such as effects, // the name in prefs is the category name plus the effect name. if( multi ) name= wxString::Format( wxT("%s:%s"), name.c_str(), label.c_str() ); @@ -690,7 +690,7 @@ int CommandManager::NewIdentifier(wxString name, wxString label, wxMenu *menu, tmpEntry->menu = menu; tmpEntry->callback = callback; tmpEntry->multi = multi; - tmpEntry->index = index; + tmpEntry->index = index; tmpEntry->count = count; tmpEntry->flags = mDefaultFlags; tmpEntry->mask = mDefaultMask; @@ -703,9 +703,9 @@ int CommandManager::NewIdentifier(wxString name, wxString label, wxMenu *menu, tmpEntry->key = KeyStringNormalize(gPrefs->Read(name, tmpEntry->key)); } gPrefs->SetPath(wxT("/")); - + mCommandList.Add(tmpEntry); - mCommandIDHash[tmpEntry->id] = tmpEntry; + mCommandIDHash[tmpEntry->id] = tmpEntry; #if defined(__WXDEBUG__) CommandListEntry *prev = mCommandNameHash[name]; @@ -771,7 +771,7 @@ void CommandManager::Enable(CommandListEntry *entry, bool enabled) if (entry->multi) { int i; int ID = entry->id; - + for(i=1; icount; i++) { ID = NextIdentifier(ID); @@ -880,7 +880,7 @@ void CommandManager::HandleMenuOpen(wxMenuEvent &evt) if (!m || m->GetParent()) return; - // Windows does not send a CLOSE event if you move from one + // Windows does not send a CLOSE event if you move from one // top-level menu to another, so simulate it. #if !defined(__WXMAC__) if (mOpenMenu) { @@ -904,7 +904,7 @@ void CommandManager::HandleMenuClose(wxMenuEvent &evt) mOpenMenu = evt.GetMenu(); #endif - // This can happen when if the Windows system menu is used + // This can happen when if the Windows system menu is used if (mOpenMenu == NULL) return; @@ -922,7 +922,7 @@ void CommandManager::HandleMenuClose(wxMenuEvent &evt) return; } - + void CommandManager::ToggleAccels(wxMenu *m, bool show) { // Add the top-level menu to the stack; @@ -994,7 +994,7 @@ void CommandManager::TellUserWhyDisallowed( wxUint32 flagsGot, wxUint32 flagsReq else if( missingFlags == TracksExistFlag ) return; - wxMessageBox(reason, _("Disallowed"), wxICON_WARNING | wxOK ); + wxMessageBox(reason, _("Disallowed"), wxICON_WARNING | wxOK ); } /// HandleCommandEntry() takes a CommandListEntry and executes it @@ -1013,14 +1013,14 @@ bool CommandManager::HandleCommandEntry(CommandListEntry * entry, wxUint32 flags proj = GetActiveProject(); wxASSERT( proj ); if( !proj ) - return false; + return false; // NB: The call may have the side effect of changing flags. bool allowed = proj->TryToMakeActionAllowed( flags, entry->flags, combinedMask ); if (!allowed) { - TellUserWhyDisallowed( + TellUserWhyDisallowed( flags & combinedMask, entry->flags & combinedMask); return false; } @@ -1096,7 +1096,7 @@ bool CommandManager::HandleTextualCommand(wxString & Str, wxUint32 flags, wxUint wxString effectName = (*effects)[i]->GetEffectName(); if( Str.IsSameAs( effectName )) { - return proj->OnEffect( effectFlags, (*effects)[i] ); + return proj->OnEffect( effectFlags, (*effects)[i] ); } } return false; @@ -1168,7 +1168,7 @@ void CommandManager::GetAllCommandData( wxArrayString &labels, wxArrayString &categories, #if defined(EXPERIMENTAL_KEY_VIEW) - wxArrayString &prefixes, + wxArrayString &prefixes, #endif bool includeMultis) { @@ -1265,7 +1265,7 @@ bool CommandManager::HandleXMLTag(const wxChar *tag, const wxChar **attrs) while(*attrs) { const wxChar *attr = *attrs++; const wxChar *value = *attrs++; - + if (!value) break; @@ -1311,14 +1311,14 @@ void CommandManager::WriteXML(XMLWriter &xmlFile) for(j=0; jlabel; label = wxMenuItem::GetLabelFromText(label.BeforeFirst(wxT('\t'))); - + xmlFile.StartTag(wxT("command")); xmlFile.WriteAttr(wxT("name"), mCommandList[j]->name); xmlFile.WriteAttr(wxT("label"), label); xmlFile.WriteAttr(wxT("key"), mCommandList[j]->key); xmlFile.EndTag(wxT("command")); } - + xmlFile.EndTag(wxT("audacitykeyboard")); } @@ -1351,7 +1351,7 @@ void CommandManager::SetCommandFlags(const wxChar **names, void CommandManager::SetCommandFlags(wxUint32 flags, wxUint32 mask, ...) { va_list list; - va_start(list, mask); + va_start(list, mask); for(;;) { const wxChar *name = va_arg(list, const wxChar *); if (!name) diff --git a/src/commands/CommandTargets.h b/src/commands/CommandTargets.h index 8bb8c5057..5900eea13 100644 --- a/src/commands/CommandTargets.h +++ b/src/commands/CommandTargets.h @@ -68,7 +68,7 @@ public: virtual void Update(wxString message) = 0; }; -/// +/// class ProgressToMessageTarget : public CommandProgressTarget { private: diff --git a/src/commands/GetProjectInfoCommand.cpp b/src/commands/GetProjectInfoCommand.cpp index 80b10374b..5bc66585b 100644 --- a/src/commands/GetProjectInfoCommand.cpp +++ b/src/commands/GetProjectInfoCommand.cpp @@ -63,7 +63,7 @@ bool GetProjectInfoCommand::Apply(CommandExecutionContext context) { SendNumberOfTracks(context); } - else if (mode.IsSameAs(wxT("SelectedTracks"))) + else if (mode.IsSameAs(wxT("SelectedTracks"))) { SendTracksInfo(projTracks, &GetProjectInfoCommand::testSelected); } @@ -92,7 +92,7 @@ bool GetProjectInfoCommand::Apply(CommandExecutionContext context) int GetProjectInfoCommand::SendNumberOfTracks(CommandExecutionContext context) { int returnVal=0; - + TrackListIterator iter(context.proj->GetTracks()); Track *t = iter.First(); while (t) @@ -112,7 +112,7 @@ int GetProjectInfoCommand::SendFocusedTrackIndex(CommandExecutionContext context int focusTrackIndex=0; TrackPanel *panel = context.proj->GetTrackPanel(); Track* focusedTrack = panel->GetFocusedTrack(); - + TrackListIterator iter(context.proj->GetTracks()); Track *t = iter.First(); while (t) @@ -132,7 +132,7 @@ int GetProjectInfoCommand::SendFocusedTrackIndex(CommandExecutionContext context } -void GetProjectInfoCommand::SendTracksInfo(TrackList *projTracks, +void GetProjectInfoCommand::SendTracksInfo(TrackList *projTracks, Getter functPtrToGetter) { wxString boolValueStr; diff --git a/src/commands/GetTrackInfoCommand.cpp b/src/commands/GetTrackInfoCommand.cpp index de6c6730b..fbed9e21e 100644 --- a/src/commands/GetTrackInfoCommand.cpp +++ b/src/commands/GetTrackInfoCommand.cpp @@ -129,14 +129,14 @@ bool GetTrackInfoCommand::Apply(CommandExecutionContext context) { if (t->GetKind() == Track::Wave) SendBooleanStatus(t->GetSolo()); - else + else SendBooleanStatus(false); } else if (mode.IsSameAs(wxT("Mute"))) { if (t->GetKind() == Track::Wave) SendBooleanStatus(t->GetMute()); - else + else SendBooleanStatus(false); } else diff --git a/src/commands/Keyboard.cpp b/src/commands/Keyboard.cpp index a0cda121b..cfa8f06f1 100644 --- a/src/commands/Keyboard.cpp +++ b/src/commands/Keyboard.cpp @@ -58,7 +58,7 @@ wxString KeyStringDisplay(const wxString & key) wxString KeyEventToKeyString(const wxKeyEvent & event) { wxString newStr = wxT(""); - + long key = event.GetKeyCode(); if (event.ControlDown()) @@ -69,7 +69,7 @@ wxString KeyEventToKeyString(const wxKeyEvent & event) #endif if (event.AltDown()) newStr += wxT("Alt+"); - + if (event.ShiftDown()) newStr += wxT("Shift+"); diff --git a/src/commands/ScriptCommandRelay.cpp b/src/commands/ScriptCommandRelay.cpp index c647b6725..c4dc2bd63 100644 --- a/src/commands/ScriptCommandRelay.cpp +++ b/src/commands/ScriptCommandRelay.cpp @@ -33,12 +33,12 @@ tpRegScriptServerFunc ScriptCommandRelay::sScriptFn; ResponseQueue ScriptCommandRelay::sResponseQueue; void ScriptCommandRelay::SetRegScriptServerFunc(tpRegScriptServerFunc scriptFn) -{ +{ sScriptFn = scriptFn; } void ScriptCommandRelay::SetCommandHandler(CommandHandler &ch) -{ +{ sCmdHandler = &ch; } diff --git a/src/commands/SetProjectInfoCommand.cpp b/src/commands/SetProjectInfoCommand.cpp index ff280938c..85272d8d8 100644 --- a/src/commands/SetProjectInfoCommand.cpp +++ b/src/commands/SetProjectInfoCommand.cpp @@ -57,19 +57,19 @@ bool SetProjectInfoCommand::Apply(CommandExecutionContext context) wxString settingsString = GetString(wxT(kSetOfTracksStr)); if (mode.IsSameAs(wxT("SelectedTracks"))) - SetAllTracksParam( context.proj->GetTracks(), settingsString, + SetAllTracksParam( context.proj->GetTracks(), settingsString, &SetProjectInfoCommand::setSelected); else if (mode.IsSameAs(wxT("SoloTracks"))) SetAllTracksParam( context.proj->GetTracks(), settingsString, &SetProjectInfoCommand::setSolo); - + else if (mode.IsSameAs(wxT("MuteTracks"))) SetAllTracksParam( context.proj->GetTracks(), settingsString, &SetProjectInfoCommand::setMute); else { Error(wxT("Invalid info type!")); return false; - } + } return true; } @@ -83,7 +83,7 @@ void SetProjectInfoCommand::SetAllTracksParam(TrackList *projTracks, wxString bo Track *t = iter.First(); while (t && i*functPtrToSetter)(t, true); if(boolValueStr[i] == '0') (this->*functPtrToSetter)(t, false); @@ -94,7 +94,7 @@ void SetProjectInfoCommand::SetAllTracksParam(TrackList *projTracks, wxString bo void SetProjectInfoCommand::setSelected(Track * trk, bool param) const { - trk->SetSelected(param); + trk->SetSelected(param); } void SetProjectInfoCommand::setSolo(Track * trk, bool param) const diff --git a/src/commands/Validators.h b/src/commands/Validators.h index 65cc0803e..d2bd76894 100644 --- a/src/commands/Validators.h +++ b/src/commands/Validators.h @@ -146,9 +146,9 @@ public: virtual bool Validate(const wxVariant &v) { wxString val; // Validate a string of chars containing only 0, 1 and x. - if (!v.Convert(&val)) + if (!v.Convert(&val)) return false; - SetConverted(val); + SetConverted(val); for(size_t i=0; i != val.Len(); i++) if( val[i] != '0' && val[i] != '1' && val[i] != 'x' && val[i] != 'X') return false; diff --git a/src/effects/Amplify.cpp b/src/effects/Amplify.cpp index 70df00057..3a4d1a5e4 100644 --- a/src/effects/Amplify.cpp +++ b/src/effects/Amplify.cpp @@ -48,11 +48,11 @@ EffectAmplify::EffectAmplify() peak = float(0.0); } -wxString EffectAmplify::GetEffectDescription() { - // Note: This is useful only after ratio has been set. - return wxString::Format(_("Applied effect: %s %.1f dB"), - this->GetEffectName().c_str(), 20*log10(ratio)); -} +wxString EffectAmplify::GetEffectDescription() { + // Note: This is useful only after ratio has been set. + return wxString::Format(_("Applied effect: %s %.1f dB"), + this->GetEffectName().c_str(), 20*log10(ratio)); +} bool EffectAmplify::Init() { @@ -64,7 +64,7 @@ bool EffectAmplify::Init() float min, max; ((WaveTrack *)t)->GetMinMax(&min, &max, mT0, mT1); float newpeak = (fabs(min) > fabs(max) ? fabs(min) : fabs(max)); - + if (newpeak > peak) { peak = newpeak; } @@ -228,7 +228,7 @@ bool AmplifyDialog::TransferDataFromWindow() bool AmplifyDialog::Validate() { TransferDataFromWindow(); - + if (mClip->GetValue() == false) { if (ratio * peak > 1.0) ratio = 1.0 / peak; @@ -265,7 +265,7 @@ void AmplifyDialog::OnAmpText(wxCommandEvent & WXUNUSED(event)) else val = _("-Infinity"); // the case when the waveform is all zero mPeakT->ChangeValue(val); - + CheckClip(); } @@ -276,12 +276,12 @@ void AmplifyDialog::OnPeakText(wxCommandEvent & WXUNUSED(event)) val.ToDouble(&r); ratio = pow(10.0, r/20.0) / peak; - + double dB = TrapDouble(200*log10(ratio), AMP_MIN, AMP_MAX)/10.0; ratio = pow(10.0, dB/20.0); mAmpS->SetValue((int)(10*dB+0.5)); - + val.Printf(wxT("%.1f"), dB); mAmpT->ChangeValue(val); @@ -294,13 +294,13 @@ void AmplifyDialog::OnAmpSlider(wxCommandEvent & WXUNUSED(event)) double dB = mAmpS->GetValue() / 10.0; ratio = pow(10.0,TrapDouble(dB, AMP_MIN, AMP_MAX)/20.0); - + double dB2 = (mAmpS->GetValue()-1) / 10.0; double ratio2 = pow(10.0,TrapDouble(dB2, AMP_MIN, AMP_MAX)/20.0); if (!mClip->GetValue() && ratio * peak > 1.0 && ratio2 * peak < 1.0) ratio = 1.0 / peak; - + str.Printf(wxT("%.1f"), 20*log10(ratio)); mAmpT->ChangeValue(str); diff --git a/src/effects/Amplify.h b/src/effects/Amplify.h index c085a08cf..7f66141e5 100644 --- a/src/effects/Amplify.h +++ b/src/effects/Amplify.h @@ -5,7 +5,7 @@ Amplify.h Dominic Mazzoni - + This rewritten class supports a smart Amplify effect - it calculates the maximum amount of gain that can be applied to all tracks without causing clipping and selects this as the default parameter. @@ -50,15 +50,15 @@ class EffectAmplify:public EffectSimpleMono virtual wxString GetEffectAction() { return wxString(_("Amplifying")); } - - // Useful only after PromptUser values have been set. - virtual wxString GetEffectDescription(); + + // Useful only after PromptUser values have been set. + virtual wxString GetEffectDescription(); virtual bool Init(); virtual bool PromptUser(); virtual bool TransferParameters( Shuttle & shuttle ); - + protected: virtual bool ProcessSimpleMono(float *buffer, sampleCount len); diff --git a/src/effects/AutoDuck.cpp b/src/effects/AutoDuck.cpp index 031c9deb5..dd6079a8a 100644 --- a/src/effects/AutoDuck.cpp +++ b/src/effects/AutoDuck.cpp @@ -60,7 +60,7 @@ struct AutoDuckRegion this->t0 = t0; this->t1 = t1; } - + double t0; double t1; }; @@ -75,7 +75,7 @@ WX_DEFINE_OBJARRAY(AutoDuckRegionArray); EffectAutoDuck::EffectAutoDuck() { SetEffectFlags(BUILTIN_EFFECT | PROCESS_EFFECT | ADVANCED_EFFECT); - + gPrefs->Read(wxT("/Effects/AutoDuck/DuckAmountDb"), &mDuckAmountDb, PARAM_DEFAULT_DUCK_AMOUNT_DB); gPrefs->Read(wxT("/Effects/AutoDuck/InnerFadeDownLen"), @@ -112,13 +112,13 @@ bool EffectAutoDuck::Init() &mMaximumPause, PARAM_DEFAULT_MAXIMUM_PAUSE); mControlTrack = NULL; - + TrackListIterator iter(mTracks); Track *t = iter.First(); - + bool lastWasSelectedWaveTrack = false; WaveTrack *controlTrackCandidate = NULL; - + while(t) { if (lastWasSelectedWaveTrack && !t->GetSelected() && @@ -129,7 +129,7 @@ bool EffectAutoDuck::Init() } lastWasSelectedWaveTrack = false; - + if (t->GetSelected()) { if (t->GetKind() == Track::Wave) @@ -139,8 +139,8 @@ bool EffectAutoDuck::Init() { wxMessageBox( _("You selected a track which does not contain audio. AutoDuck can only process audio tracks."), - /* i18n-hint: Auto duck is the name of an effect that 'ducks' (reduces the volume) - * of the audio automatically when there is sound on another track. Not as + /* i18n-hint: Auto duck is the name of an effect that 'ducks' (reduces the volume) + * of the audio automatically when there is sound on another track. Not as * in 'Donald-Duck'!*/ _("Auto Duck"), wxICON_ERROR, mParent); return false; @@ -149,7 +149,7 @@ bool EffectAutoDuck::Init() t = iter.Next(); } - + if (!controlTrackCandidate) { wxMessageBox( @@ -157,7 +157,7 @@ bool EffectAutoDuck::Init() _("Auto Duck"), wxICON_ERROR, mParent); return false; } - + mControlTrack = controlTrackCandidate; return true; @@ -196,10 +196,10 @@ void EffectAutoDuck::End() bool EffectAutoDuck::PromptUser() { EffectAutoDuckDialog dlog(this, mParent); - + if (dlog.ShowModal() != wxID_OK) return false; // user cancelled dialog - + gPrefs->Write(wxT("/Effects/AutoDuck/DuckAmountDb"), mDuckAmountDb); gPrefs->Write(wxT("/Effects/AutoDuck/OuterFadeDownLen"), mOuterFadeDownLen); gPrefs->Write(wxT("/Effects/AutoDuck/OuterFadeUpLen"), mOuterFadeUpLen); @@ -215,7 +215,7 @@ bool EffectAutoDuck::PromptUser() bool EffectAutoDuck::Process() { sampleCount i; - + if (GetNumWaveTracks() == 0 || !mControlTrack) return false; @@ -225,23 +225,23 @@ bool EffectAutoDuck::Process() mControlTrack->TimeToLongSamples(mT0 + mOuterFadeDownLen); sampleCount end = mControlTrack->TimeToLongSamples(mT1 - mOuterFadeUpLen); - + if (end <= start) return false; // the minimum number of samples we have to wait until the maximum // pause has been exceeded double maxPause = mMaximumPause; - + // We don't fade in until we have time enough to actually fade out again if (maxPause < mOuterFadeDownLen + mOuterFadeUpLen) maxPause = mOuterFadeDownLen + mOuterFadeUpLen; - + sampleCount minSamplesPause = mControlTrack->TimeToLongSamples(maxPause); double threshold = pow(10.0, mThresholdDb/20); - + // adjust the threshold so we can compare it to the rmsSum value threshold = threshold * threshold * RMS_WINDOW_SIZE; @@ -250,28 +250,28 @@ bool EffectAutoDuck::Process() float *rmsWindow = new float[RMS_WINDOW_SIZE]; for (i = 0; i < RMS_WINDOW_SIZE; i++) rmsWindow[i] = 0; - + float *buf = new float[BUF_SIZE]; - + bool inDuckRegion = false; // initialize the following two variables to prevent compiler warning double duckRegionStart = 0; sampleCount curSamplesPause = 0; - + // to make the progress bar appear more natural, we first look for all // duck regions and apply them all at once afterwards AutoDuckRegionArray regions; sampleCount pos = start; - + while (pos < end) { sampleCount len = end - pos; if (len > BUF_SIZE) len = BUF_SIZE; - + mControlTrack->Get((samplePtr)buf, floatSample, pos, (sampleCount)len); - + for (i = pos; i < pos + len; i++) { rmsSum -= rmsWindow[rmsPos]; @@ -280,13 +280,13 @@ bool EffectAutoDuck::Process() rmsPos = (rmsPos + 1) % RMS_WINDOW_SIZE; bool thresholdExceeded = rmsSum > threshold; - + if (thresholdExceeded) { // everytime the threshold is exceeded, reset our count for // the number of pause samples curSamplesPause = 0; - + if (!inDuckRegion) { // the threshold has been exceeded for the first time, so @@ -295,20 +295,20 @@ bool EffectAutoDuck::Process() duckRegionStart = mControlTrack->LongSamplesToTime(i); } } - + if (!thresholdExceeded && inDuckRegion) { // the threshold has not been exceeded and we are in a duck // region, but only fade in if the maximum pause has been // exceeded curSamplesPause += 1; - + if (curSamplesPause >= minSamplesPause) { // do the actual duck fade and reset all values double duckRegionEnd = mControlTrack->LongSamplesToTime(i - curSamplesPause); - + regions.Add(AutoDuckRegion( duckRegionStart - mOuterFadeDownLen, duckRegionEnd + mOuterFadeUpLen)); @@ -317,7 +317,7 @@ bool EffectAutoDuck::Process() } } } - + pos += len; if (TotalProgress( ((double)(pos-start)) / (end-start) / @@ -327,7 +327,7 @@ bool EffectAutoDuck::Process() break; } } - + // apply last duck fade, if any if (inDuckRegion) { @@ -337,7 +337,7 @@ bool EffectAutoDuck::Process() duckRegionStart - mOuterFadeDownLen, duckRegionEnd + mOuterFadeUpLen)); } - + delete[] buf; delete[] rmsWindow; @@ -346,15 +346,15 @@ bool EffectAutoDuck::Process() this->CopyInputTracks(); // Set up mOutputTracks. SelectedTrackListOfKindIterator iter(Track::Wave, mOutputTracks); Track *iterTrack = iter.First(); - + int trackNumber = 0; - + while (iterTrack) { wxASSERT(iterTrack->GetKind() == Track::Wave); - + WaveTrack* t = (WaveTrack*)iterTrack; - + for (i = 0; i < (int)regions.GetCount(); i++) { const AutoDuckRegion& region = regions[i]; @@ -364,7 +364,7 @@ bool EffectAutoDuck::Process() break; } } - + if (cancel) break; @@ -372,8 +372,8 @@ bool EffectAutoDuck::Process() trackNumber++; } } - - this->ReplaceProcessedTracks(!cancel); + + this->ReplaceProcessedTracks(!cancel); return !cancel; } @@ -382,13 +382,13 @@ bool EffectAutoDuck::ApplyDuckFade(int trackNumber, WaveTrack* t, double t0, double t1) { bool cancel = false; - + sampleCount start = t->TimeToLongSamples(t0); sampleCount end = t->TimeToLongSamples(t1); - + float *buf = new float[BUF_SIZE]; sampleCount pos = start; - + int fadeDownSamples = t->TimeToLongSamples( mOuterFadeDownLen + mInnerFadeDownLen); if (fadeDownSamples < 1) @@ -398,7 +398,7 @@ bool EffectAutoDuck::ApplyDuckFade(int trackNumber, WaveTrack* t, mOuterFadeUpLen + mInnerFadeUpLen); if (fadeUpSamples < 1) fadeUpSamples = 1; - + float fadeDownStep = mDuckAmountDb / fadeDownSamples; float fadeUpStep = mDuckAmountDb / fadeUpSamples; @@ -409,12 +409,12 @@ bool EffectAutoDuck::ApplyDuckFade(int trackNumber, WaveTrack* t, len = BUF_SIZE; t->Get((samplePtr)buf, floatSample, pos, len); - + for (sampleCount i = pos; i < pos + len; i++) { float gainDown = fadeDownStep * (i - start); float gainUp = fadeUpStep * (end - i);; - + float gain; if (gainDown > gainUp) gain = gainDown; @@ -425,11 +425,11 @@ bool EffectAutoDuck::ApplyDuckFade(int trackNumber, WaveTrack* t, buf[i - pos] *= pow(10.0, gain / 20.0); } - + t->Set((samplePtr)buf, floatSample, pos, len); pos += len; - + float curTime = t->LongSamplesToTime(pos); float fractionFinished = (curTime - mT0) / (mT1 - mT0); if (TotalProgress( (trackNumber + 1 + fractionFinished) / @@ -447,7 +447,7 @@ bool EffectAutoDuck::ApplyDuckFade(int trackNumber, WaveTrack* t, /* * Effect dialog implementation */ - + #define ID_DUCK_AMOUNT_DB 10001 #define ID_THRESHOLD_DB 10002 #define ID_INNER_FADE_DOWN_LEN 10003 @@ -477,7 +477,7 @@ EffectAutoDuckDialog::EffectAutoDuckDialog(EffectAutoDuck* effect, wxTextValidator vld(wxFILTER_NUMERIC); ShuttleGui S(this, eIsCreating); - + S.SetBorder(5); S.StartVerticalLay(true); { @@ -495,7 +495,7 @@ EffectAutoDuckDialog::EffectAutoDuckDialog(EffectAutoDuck* effect, Internat::ToDisplayString(mEffect->mDuckAmountDb), 10); S.AddUnits(_("dB")); mDuckAmountDbBox->SetValidator(vld); - + mMaximumPauseBox = S.Id(ID_MAXIMUM_PAUSE).AddTextBox( _("Maximum pause:"), Internat::ToDisplayString(mEffect->mMaximumPause), 10); @@ -507,7 +507,7 @@ EffectAutoDuckDialog::EffectAutoDuckDialog(EffectAutoDuck* effect, Internat::ToDisplayString(mEffect->mOuterFadeDownLen), 10); S.AddUnits(_("seconds")); mOuterFadeDownLenBox->SetValidator(vld); - + mOuterFadeUpLenBox = S.Id(ID_OUTER_FADE_UP_LEN).AddTextBox( _("Outer fade up length:"), Internat::ToDisplayString(mEffect->mOuterFadeUpLen), 10); @@ -519,7 +519,7 @@ EffectAutoDuckDialog::EffectAutoDuckDialog(EffectAutoDuck* effect, Internat::ToDisplayString(mEffect->mInnerFadeDownLen), 10); S.AddUnits(_("seconds")); mInnerFadeDownLenBox->SetValidator(vld); - + mInnerFadeUpLenBox = S.Id(ID_INNER_FADE_UP_LEN).AddTextBox( _("Inner fade up length:"), Internat::ToDisplayString(mEffect->mInnerFadeUpLen), 10); @@ -527,7 +527,7 @@ EffectAutoDuckDialog::EffectAutoDuckDialog(EffectAutoDuck* effect, mInnerFadeUpLenBox->SetValidator(vld); } S.EndMultiColumn(); - + S.StartMultiColumn(3, wxCENTER); { mThresholdDbBox = S.Id(ID_THRESHOLD_DB).AddTextBox( @@ -556,7 +556,7 @@ void EffectAutoDuckDialog::OnOk(wxCommandEvent& WXUNUSED(event)) double outerFadeDownLen = 0, outerFadeUpLen = 0; double maximumPause = 0; - bool success = + bool success = mDuckAmountDbBox->GetValue().ToDouble(&duckAmountDb) && duckAmountDb > -100 && duckAmountDb < 0 && @@ -578,14 +578,14 @@ void EffectAutoDuckDialog::OnOk(wxCommandEvent& WXUNUSED(event)) mMaximumPauseBox->GetValue().ToDouble(&maximumPause) && maximumPause >= 0 && maximumPause < 1000; - + if (!success) { wxMessageBox(_("Please enter valid values."), _("Auto Duck"), wxICON_ERROR, this); return; } - + mEffect->mDuckAmountDb = duckAmountDb; mEffect->mThresholdDb = thresholdDb; mEffect->mInnerFadeDownLen = innerFadeDownLen; @@ -654,7 +654,7 @@ EffectAutoDuckPanel::EffectAutoDuckPanel(EffectAutoDuckDialog* parent, mParent = parent; mCurrentControlPoint = none; mBackgroundBitmap = NULL; - + ResetControlPoints(); } @@ -677,7 +677,7 @@ void EffectAutoDuckPanel::OnPaint(wxPaintEvent& WXUNUSED(event)) { int clientWidth, clientHeight; GetSize(&clientWidth, &clientHeight); - + if (!mBackgroundBitmap || mBackgroundBitmap->GetWidth() != clientWidth || mBackgroundBitmap->GetHeight() != clientHeight) { @@ -685,14 +685,14 @@ void EffectAutoDuckPanel::OnPaint(wxPaintEvent& WXUNUSED(event)) delete mBackgroundBitmap; mBackgroundBitmap = new wxBitmap(clientWidth, clientHeight); } - + wxMemoryDC dc; dc.SelectObject(*mBackgroundBitmap); dc.SetBrush(*wxWHITE_BRUSH); dc.SetPen(*wxBLACK_PEN); dc.DrawRectangle(0, 0, clientWidth, clientHeight); - + dc.SetFont(wxFont(10, wxFONTFAMILY_SWISS, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_NORMAL)); dc.SetTextForeground(*wxBLACK); @@ -708,7 +708,7 @@ void EffectAutoDuckPanel::OnPaint(wxPaintEvent& WXUNUSED(event)) mParent->mInnerFadeUpLenBox->GetValue().ToDouble(&innerFadeUpLen); mParent->mOuterFadeDownLenBox->GetValue().ToDouble(&outerFadeDownLen); mParent->mOuterFadeUpLenBox->GetValue().ToDouble(&outerFadeUpLen); - + if (innerFadeDownLen < MIN_FADE || innerFadeDownLen > MAX_FADE || innerFadeUpLen < MIN_FADE || innerFadeUpLen > MAX_FADE || outerFadeDownLen < MIN_FADE || outerFadeDownLen > MAX_FADE || @@ -728,23 +728,23 @@ void EffectAutoDuckPanel::OnPaint(wxPaintEvent& WXUNUSED(event)) // draw preview dc.SetBrush(*wxTRANSPARENT_BRUSH); dc.SetPen(wxPen(theTheme.Colour(clrGraphLines), 3, wxSOLID)); - + wxPoint points[6]; - + points[0].x = 10; points[0].y = DUCK_AMOUNT_START; - + points[1].x = FADE_DOWN_START - (int)(outerFadeDownLen * FADE_SCALE); points[1].y = DUCK_AMOUNT_START; - + points[2].x = FADE_DOWN_START + (int)(innerFadeDownLen * FADE_SCALE); points[2].y = DUCK_AMOUNT_START - (int)(duckAmountDb * DUCK_AMOUNT_SCALE); - + points[3].x = FADE_UP_START - (int)(innerFadeUpLen * FADE_SCALE); points[3].y = DUCK_AMOUNT_START - (int)(duckAmountDb * DUCK_AMOUNT_SCALE); - + points[4].x = FADE_UP_START + (int)(outerFadeUpLen * FADE_SCALE); points[4].y = DUCK_AMOUNT_START; @@ -752,28 +752,28 @@ void EffectAutoDuckPanel::OnPaint(wxPaintEvent& WXUNUSED(event)) points[5].y = DUCK_AMOUNT_START; dc.DrawLines(6, points); - + dc.SetPen(wxPen(*wxBLACK, 1, wxDOT)); - + AColor::Line(dc, FADE_DOWN_START, 10, FADE_DOWN_START, clientHeight - 10); AColor::Line(dc, FADE_UP_START, 10, FADE_UP_START, clientHeight - 10); - + dc.SetPen(AColor::envelopePen); dc.SetBrush(*wxWHITE_BRUSH); - + mControlPoints[outerFadeDown] = points[1]; mControlPoints[innerFadeDown] = points[2]; mControlPoints[innerFadeUp] = points[3]; mControlPoints[outerFadeUp] = points[4]; mControlPoints[duckAmount] = wxPoint( (points[2].x + points[3].x) / 2, points[2].y); - + for (int i = 0; i < AUTO_DUCK_PANEL_NUM_CONTROL_POINTS; i++) { EControlPoint cp = (EControlPoint)i; int digits; float value; - + if (cp == innerFadeDown) { value = innerFadeDownLen; @@ -801,25 +801,25 @@ void EffectAutoDuckPanel::OnPaint(wxPaintEvent& WXUNUSED(event)) wxString valueStr = Internat::ToDisplayString(value, digits); valueStr += wxT(" "); - + if (cp == duckAmount) /* i18n-hint: short form of 'decibels'.*/ - valueStr += _("dB"); + valueStr += _("dB"); else /* i18n-hint: short form of 'seconds'.*/ - valueStr += _("s"); - + valueStr += _("s"); + int textWidth = 0, textHeight = 0; GetTextExtent(valueStr, &textWidth, &textHeight); - + int textPosX = mControlPoints[i].x - textWidth / 2; int textPosY = mControlPoints[i].y; - + if (cp == duckAmount || cp == outerFadeDown || cp == outerFadeUp) textPosY -= TEXT_DISTANCE + textHeight; else textPosY += TEXT_DISTANCE; - + dc.DrawText(valueStr, textPosX, textPosY); dc.DrawEllipse(mControlPoints[i].x - 3, @@ -861,15 +861,15 @@ EffectAutoDuckPanel::EControlPoint { int dist[AUTO_DUCK_PANEL_NUM_CONTROL_POINTS]; int i; - + for (i = 0; i < AUTO_DUCK_PANEL_NUM_CONTROL_POINTS; i++) dist[i] = GetDistance(pt, mControlPoints[i]); - + int curMinimum = 0; for (i = 0; i < AUTO_DUCK_PANEL_NUM_CONTROL_POINTS; i++) if (dist[i] < dist[curMinimum]) curMinimum = i; - + if (dist[curMinimum] <= CONTROL_POINT_REGION) return (EControlPoint)curMinimum; else @@ -879,18 +879,18 @@ EffectAutoDuckPanel::EControlPoint void EffectAutoDuckPanel::OnLeftDown(wxMouseEvent &evt) { EControlPoint nearest = GetNearestControlPoint(evt.GetPosition()); - + if (nearest != none) { // this control point has been clicked mMouseDownPoint = evt.GetPosition(); - + mCurrentControlPoint = nearest; mControlPointMoveActivated = false; - + for (int i = 0; i < AUTO_DUCK_PANEL_NUM_CONTROL_POINTS; i++) mMoveStartControlPoints[i] = mControlPoints[i]; - + CaptureMouse(); } } @@ -921,13 +921,13 @@ void EffectAutoDuckPanel::OnMotion(wxMouseEvent &evt) SetCursor(wxCursor(wxCURSOR_SIZENS)); break; } - + if (mCurrentControlPoint != none) { if (!mControlPointMoveActivated) { int dist; - + if (mCurrentControlPoint == duckAmount) dist = abs(evt.GetY() - mMouseDownPoint.y); else @@ -940,7 +940,7 @@ void EffectAutoDuckPanel::OnMotion(wxMouseEvent &evt) if (mControlPointMoveActivated) { float newValue; - + switch (mCurrentControlPoint) { case outerFadeDown: @@ -992,7 +992,7 @@ void EffectAutoDuckPanel::OnMotion(wxMouseEvent &evt) case none: wxASSERT(false); // should not happen } - + Refresh(false); } } diff --git a/src/effects/AutoDuck.h b/src/effects/AutoDuck.h index 97d3347c5..6b7a521de 100644 --- a/src/effects/AutoDuck.h +++ b/src/effects/AutoDuck.h @@ -31,9 +31,9 @@ private: void OnOk(wxCommandEvent& evt); void OnCancel(wxCommandEvent& evt); void OnValueChanged(wxCommandEvent& evt); - + EffectAutoDuck* mEffect; - + wxTextCtrl* mDuckAmountDbBox; wxTextCtrl* mInnerFadeDownLenBox; wxTextCtrl* mInnerFadeUpLenBox; @@ -42,7 +42,7 @@ private: wxTextCtrl* mThresholdDbBox; wxTextCtrl* mMaximumPauseBox; EffectAutoDuckPanel* mPanel; - + DECLARE_EVENT_TABLE() }; @@ -53,7 +53,7 @@ class EffectAutoDuckPanel: public wxPanel public: EffectAutoDuckPanel(EffectAutoDuckDialog* parent, wxWindowID id); virtual ~EffectAutoDuckPanel(); - + private: enum EControlPoint { @@ -75,10 +75,10 @@ private: void OnLeftDown(wxMouseEvent &evt); void OnLeftUp(wxMouseEvent &evt); void OnMotion(wxMouseEvent &evt); - + void ResetControlPoints(); EControlPoint GetNearestControlPoint(const wxPoint& pt); - + EffectAutoDuckDialog* mParent; wxBitmap* mBackgroundBitmap; EControlPoint mCurrentControlPoint; @@ -86,7 +86,7 @@ private: wxPoint mMoveStartControlPoints[AUTO_DUCK_PANEL_NUM_CONTROL_POINTS]; wxPoint mMouseDownPoint; bool mControlPointMoveActivated; - + DECLARE_EVENT_TABLE() }; @@ -96,12 +96,12 @@ class EffectAutoDuck: public Effect public: EffectAutoDuck(); - + virtual wxString GetEffectName() { return wxString(_("Auto Duck...")); } - + virtual std::set GetEffectCategories() { std::set result; @@ -118,7 +118,7 @@ public: { return wxString(_("Processing Auto Duck...")); } - + virtual bool PromptUser(); virtual bool TransferParameters(Shuttle & shuttle); @@ -126,10 +126,10 @@ public: virtual void End(); virtual bool CheckWhetherSkipEffect(); virtual bool Process(); - + private: bool ApplyDuckFade(int trackNumber, WaveTrack* t, double t0, double t1); - + double mDuckAmountDb; double mInnerFadeDownLen; double mInnerFadeUpLen; diff --git a/src/effects/BassTreble.cpp b/src/effects/BassTreble.cpp index 9ec6e7455..53af99175 100644 --- a/src/effects/BassTreble.cpp +++ b/src/effects/BassTreble.cpp @@ -53,7 +53,7 @@ bool EffectBassTreble::Init() gPrefs->Read(wxT("/Effects/BassTreble/Treble"), &dB_treble, 0.0); gPrefs->Read(wxT("/Effects/BassTreble/Level"), &dB_level, -1.0); gPrefs->Read(wxT("/Effects/BassTreble/Normalize"), &readBool, 1 ); - + // Validate data dB_level = (dB_level > 0)? 0 : dB_level; mbNormalize = (readBool != 0); @@ -61,10 +61,10 @@ bool EffectBassTreble::Init() return true; } -wxString EffectBassTreble::GetEffectDescription() { - // Note: This is useful only after values have been set. +wxString EffectBassTreble::GetEffectDescription() { + // Note: This is useful only after values have been set. wxString strResult = - wxString::Format(_("Applied effect: %s bass = %.1f dB, treble = %.1f dB"), + wxString::Format(_("Applied effect: %s bass = %.1f dB, treble = %.1f dB"), this->GetEffectName().c_str(), dB_bass, dB_treble); (mbNormalize) ? @@ -103,7 +103,7 @@ bool EffectBassTreble::PromptUser() } bool EffectBassTreble::TransferParameters(Shuttle & shuttle) -{ +{ shuttle.TransferDouble(wxT("Bass"),dB_bass,0.0); shuttle.TransferDouble(wxT("Treble"),dB_treble,0.0); shuttle.TransferDouble(wxT("Level"),dB_level,0.0); @@ -157,7 +157,7 @@ bool EffectBassTreble::NewTrackPass1() b0Bass, b1Bass, b2Bass); // Compute coefficents of the high shelf biquand IIR filter - Coefficents(hzTreble, slope, dB_treble, trebleType, + Coefficents(hzTreble, slope, dB_treble, trebleType, a0Treble, a1Treble, a2Treble, b0Treble, b1Treble, b2Treble); @@ -165,7 +165,7 @@ bool EffectBassTreble::NewTrackPass1() } void EffectBassTreble::Coefficents(double hz, float slope, double gain, int type, - float& a0, float& a1, float& a2, + float& a0, float& a1, float& a2, float& b0, float& b1, float& b2) { double w = 2 * M_PI * hz / mCurRate; @@ -186,7 +186,7 @@ void EffectBassTreble::Coefficents(double hz, float slope, double gain, int type b0 = a * ((a + 1) + (a - 1) * cos(w) + b * sin(w)); b1 = -2 * a * ((a - 1) + (a + 1) * cos(w)); b2 = a * ((a + 1) + (a - 1) * cos(w) - b * sin(w)); - a0 = ((a + 1) - (a - 1) * cos(w) + b * sin(w)); + a0 = ((a + 1) - (a - 1) * cos(w) + b * sin(w)); a1 = 2 * ((a - 1) - (a + 1) * cos(w)); a2 = (a + 1) - (a - 1) * cos(w) - b * sin(w); } @@ -262,7 +262,7 @@ float EffectBassTreble::DoFilter(float in) // to allow 1 decimal place resolution #define BASS_MIN -150 // Corresponds to -15 db -#define BASS_MAX 150 // Corresponds to +15 dB +#define BASS_MAX 150 // Corresponds to +15 dB #define TREBLE_MIN -150 // Corresponds to -15 dB #define TREBLE_MAX 150 // Corresponds to +15 dB #define LEVEL_MIN -300 // Corresponds to -30 dN @@ -314,7 +314,7 @@ void BassTrebleDialog::PopulateOrExchange(ShuttleGui & S) mBassS->SetName(_("Bass")); mBassS->SetRange(BASS_MIN, BASS_MAX); mBassS->SetPageSize(30); - + // Treble control mTrebleT = S.Id(ID_TREBLE_TEXT).AddTextBox(_("&Treble (dB):"), wxT(""), 10); mTrebleT->SetValidator(vld); @@ -324,7 +324,7 @@ void BassTrebleDialog::PopulateOrExchange(ShuttleGui & S) mTrebleS->SetName(_("Treble")); mTrebleS->SetRange(TREBLE_MIN, TREBLE_MAX); mTrebleS->SetPageSize(30); - + // Level control mLevelT = S.Id(ID_LEVEL_TEXT).AddTextBox(_("&Level (dB):"), wxT(""), 10); mLevelT->SetValidator(vld); @@ -394,7 +394,7 @@ void BassTrebleDialog::UpdateUI() wxString val2 = mLevelT->GetValue(); val2.ToDouble(&v2); - // Disallow level control if disabled + // Disallow level control if disabled mLevelT->Enable(enable); mLevelS->Enable(enable); diff --git a/src/effects/BassTreble.h b/src/effects/BassTreble.h index 54c6c8a77..696e7a949 100644 --- a/src/effects/BassTreble.h +++ b/src/effects/BassTreble.h @@ -27,7 +27,7 @@ public: virtual wxString GetEffectName() { return wxString(_("Bass and Treble...")); } - + virtual std::set GetEffectCategories() { std::set result; result.insert(wxT("http://lv2plug.in/ns/lv2core#EQPlugin")); @@ -42,8 +42,8 @@ public: return wxString(_("Adjusting Bass and Treble")); } - // Useful only after PromptUser values have been set. - virtual wxString GetEffectDescription(); + // Useful only after PromptUser values have been set. + virtual wxString GetEffectDescription(); protected: virtual bool PromptUser(); @@ -53,7 +53,7 @@ protected: virtual bool ProcessPass1(float *buffer, sampleCount len); virtual bool ProcessPass2(float *buffer, sampleCount len); - void Coefficents(double hz, float slope, double gain, int type, + void Coefficents(double hz, float slope, double gain, int type, float& a0, float& a1, float& a2, float& b0, float& b1, float& b2); private: @@ -61,7 +61,7 @@ private: virtual bool InitPass1(); virtual bool InitPass2(); float DoFilter(float in); - + float xn1Bass, xn2Bass, yn1Bass, yn2Bass, wBass, swBass, cwBass, aBass, bBass, a0Bass, a1Bass, a2Bass, b0Bass, b1Bass, b2Bass; diff --git a/src/effects/ChangePitch.cpp b/src/effects/ChangePitch.cpp index 4d98853cd..a08d44569 100644 --- a/src/effects/ChangePitch.cpp +++ b/src/effects/ChangePitch.cpp @@ -5,12 +5,12 @@ License: GPL v2. See License.txt. ChangePitch.cpp - Vaughan Johnson, Dominic Mazzoni, Steve Daulton + Vaughan Johnson, Dominic Mazzoni, Steve Daulton ******************************************************************//** \file ChangePitch.cpp -\brief Change Pitch effect provides raising or lowering +\brief Change Pitch effect provides raising or lowering the pitch without changing the tempo. *//*******************************************************************/ @@ -48,13 +48,13 @@ EffectChangePitch::EffectChangePitch() m_dPercentChange = 0.0; } -wxString EffectChangePitch::GetEffectDescription() -{ - // This is useful only after m_dSemitonesChange has been set. - return wxString::Format(_("Applied effect: %s %.2f semitones"), - this->GetEffectName().c_str(), - m_dSemitonesChange); -} +wxString EffectChangePitch::GetEffectDescription() +{ + // This is useful only after m_dSemitonesChange has been set. + return wxString::Format(_("Applied effect: %s %.2f semitones"), + this->GetEffectName().c_str(), + m_dSemitonesChange); +} bool EffectChangePitch::Init() { @@ -62,7 +62,7 @@ bool EffectChangePitch::Init() return true; } -// Deduce m_FromFrequency from the samples at the beginning of +// Deduce m_FromFrequency from the samples at the beginning of // the selection. Then set some other params accordingly. void EffectChangePitch::DeduceFrequencies() { @@ -85,12 +85,12 @@ void EffectChangePitch::DeduceFrequencies() // number of windows rounded to nearest integer >= 1. int numWindows = wxRound((double)(rate / (5.0f * windowSize))); numWindows = (numWindows > 0)? numWindows : 1; - + double trackStart = track->GetStartTime(); double t0 = mT0 < trackStart? trackStart: mT0; sampleCount start = track->TimeToLongSamples(t0); - int analyzeSize = windowSize * numWindows; + int analyzeSize = windowSize * numWindows; float * buffer; buffer = new float[analyzeSize]; @@ -145,9 +145,9 @@ bool EffectChangePitch::PromptUser() } bool EffectChangePitch::TransferParameters( Shuttle & shuttle ) -{ - // Vaughan, 2013-06: Long lost to history, I don't see why m_dPercentChange was chosen to be shuttled. - // Only m_dSemitonesChange is used in Process(). +{ + // Vaughan, 2013-06: Long lost to history, I don't see why m_dPercentChange was chosen to be shuttled. + // Only m_dSemitonesChange is used in Process(). shuttle.TransferDouble(wxT("Percentage"),m_dPercentChange,0.0); m_dSemitonesChange = (12.0 * log((100.0 + m_dPercentChange) / 100.0)) / log(2.0); return true; @@ -162,9 +162,9 @@ bool EffectChangePitch::Process() // Note: m_dSemitonesChange is private to ChangePitch because it only // needs to pass it along to mSoundTouch (above). I added mSemitones // to SoundTouchEffect (the super class) to convey this value - // to process Note tracks. This approach minimizes changes to existing + // to process Note tracks. This approach minimizes changes to existing // code, but it would be cleaner to change all m_dSemitonesChange to - // mSemitones, make mSemitones exist with or without USE_MIDI, and + // mSemitones, make mSemitones exist with or without USE_MIDI, and // eliminate the next line: mSemitones = m_dSemitonesChange; #endif @@ -177,7 +177,7 @@ bool EffectChangePitch::Process() // Soundtouch is not reasonable below -99% or above 3000%. // We warp the slider to go up to 400%, but user can enter up to 3000% -#define PERCENTCHANGE_MIN -99.0 +#define PERCENTCHANGE_MIN -99.0 #define PERCENTCHANGE_MAX_SLIDER 100.0 // warped above zero to actually go up to 400% #define PERCENTCHANGE_MAX_TEXT 3000.0 #define PERCENTCHANGE_SLIDER_WARP 1.30105 // warp power takes max from 100 to 400. @@ -213,26 +213,26 @@ BEGIN_EVENT_TABLE(ChangePitchDialog, EffectDialog) EVT_BUTTON(ID_EFFECT_PREVIEW, ChangePitchDialog::OnPreview) END_EVENT_TABLE() -ChangePitchDialog::ChangePitchDialog(EffectChangePitch *effect, wxWindow *parent, +ChangePitchDialog::ChangePitchDialog(EffectChangePitch *effect, wxWindow *parent, double dSemitonesChange, double dStartFrequency) : EffectDialog(parent, _("Change Pitch"), PROCESS_EFFECT), mEffect(effect) { - m_bLoopDetect = false; + m_bLoopDetect = false; - // NULL out these control members because there are some cases where the - // event table handlers get called during this method, and those handlers that + // NULL out these control members because there are some cases where the + // event table handlers get called during this method, and those handlers that // can cause trouble check for NULL. m_pChoice_FromPitch = NULL; m_pSpin_FromOctave = NULL; m_pChoice_ToPitch = NULL; m_pSpin_ToOctave = NULL; - + m_pTextCtrl_SemitonesChange = NULL; m_pTextCtrl_FromFrequency = NULL; m_pTextCtrl_ToFrequency = NULL; - + m_pTextCtrl_PercentChange = NULL; m_pSlider_PercentChange = NULL; @@ -257,9 +257,9 @@ void ChangePitchDialog::PopulateOrExchange(ShuttleGui & S) { wxTextValidator nullvld(wxFILTER_INCLUDE_CHAR_LIST); wxTextValidator numvld(wxFILTER_NUMERIC); - - wxTextValidator nonNegNumValidator(wxFILTER_INCLUDE_CHAR_LIST); // like wxFILTER_NUMERIC, but disallow negative numbers. - wxArrayString aIncludes; + + wxTextValidator nonNegNumValidator(wxFILTER_INCLUDE_CHAR_LIST); // like wxFILTER_NUMERIC, but disallow negative numbers. + wxArrayString aIncludes; aIncludes.Add(wxT("0")); aIncludes.Add(wxT("1")); aIncludes.Add(wxT("2")); @@ -271,7 +271,7 @@ void ChangePitchDialog::PopulateOrExchange(ShuttleGui & S) aIncludes.Add(wxT("8")); aIncludes.Add(wxT("9")); aIncludes.Add(wxT(".")); - nonNegNumValidator.SetIncludes(aIncludes); + nonNegNumValidator.SetIncludes(aIncludes); wxArrayString pitch; pitch.Add(wxT("C")); @@ -293,7 +293,7 @@ void ChangePitchDialog::PopulateOrExchange(ShuttleGui & S) { S.AddTitle(_("Change Pitch without Changing Tempo")); S.AddTitle( - wxString::Format(_("Estimated Start Pitch: %s%d (%.3f Hz)"), + wxString::Format(_("Estimated Start Pitch: %s%d (%.3f Hz)"), pitch[m_nFromPitch].c_str(), m_nFromOctave, m_FromFrequency)); } S.EndVerticalLay(); @@ -307,7 +307,7 @@ void ChangePitchDialog::PopulateOrExchange(ShuttleGui & S) m_pChoice_FromPitch->SetName(_("from")); m_pChoice_FromPitch->SetSizeHints(80, -1); - m_pSpin_FromOctave = S.Id(ID_SPIN_FROMOCTAVE).AddSpinCtrl(wxT(""), m_nFromOctave, INT_MAX, INT_MIN); + m_pSpin_FromOctave = S.Id(ID_SPIN_FROMOCTAVE).AddSpinCtrl(wxT(""), m_nFromOctave, INT_MAX, INT_MIN); m_pSpin_FromOctave->SetName(_("from Octave")); m_pSpin_FromOctave->SetSizeHints(50, -1); @@ -315,16 +315,16 @@ void ChangePitchDialog::PopulateOrExchange(ShuttleGui & S) m_pChoice_ToPitch->SetName(_("to")); m_pChoice_ToPitch->SetSizeHints(80, -1); - m_pSpin_ToOctave = - S.Id(ID_SPIN_TOOCTAVE).AddSpinCtrl(wxT(""), m_nToOctave, INT_MAX, INT_MIN); + m_pSpin_ToOctave = + S.Id(ID_SPIN_TOOCTAVE).AddSpinCtrl(wxT(""), m_nToOctave, INT_MAX, INT_MIN); m_pSpin_ToOctave->SetName(_("to Octave")); m_pSpin_ToOctave->SetSizeHints(50, -1); } S.EndMultiColumn(); - + S.StartHorizontalLay(wxALIGN_CENTER); { - m_pTextCtrl_SemitonesChange = + m_pTextCtrl_SemitonesChange = S.Id(ID_TEXT_SEMITONESCHANGE).AddTextBox(_("Semitones (half-steps):"), wxT(""), 12); m_pTextCtrl_SemitonesChange->SetName(_("Semitones (half-steps)")); m_pTextCtrl_SemitonesChange->SetValidator(numvld); @@ -373,12 +373,12 @@ bool ChangePitchDialog::TransferDataToWindow() m_bLoopDetect = true; // from/to pitch controls - if (m_pChoice_FromPitch) + if (m_pChoice_FromPitch) m_pChoice_FromPitch->SetSelection(m_nFromPitch); if (m_pSpin_FromOctave) - m_pSpin_FromOctave->SetValue(m_nFromOctave); - this->Update_Choice_ToPitch(); - this->Update_Spin_ToOctave(); + m_pSpin_FromOctave->SetValue(m_nFromOctave); + this->Update_Choice_ToPitch(); + this->Update_Spin_ToOctave(); // semitones change control this->Update_Text_SemitonesChange(); @@ -411,12 +411,12 @@ bool ChangePitchDialog::TransferDataFromWindow() // from/to pitch controls - if (m_pChoice_FromPitch) - m_nFromPitch = m_pChoice_FromPitch->GetSelection(); - if (m_pSpin_FromOctave) + if (m_pChoice_FromPitch) + m_nFromPitch = m_pChoice_FromPitch->GetSelection(); + if (m_pSpin_FromOctave) m_nFromOctave = m_pSpin_FromOctave->GetValue(); - if (m_pChoice_ToPitch) + if (m_pChoice_ToPitch) m_nToPitch = m_pChoice_ToPitch->GetSelection(); @@ -449,7 +449,7 @@ bool ChangePitchDialog::TransferDataFromWindow() m_dPercentChange = newDouble; } - // No need to update Slider_PercentChange here because TextCtrl_PercentChange + // No need to update Slider_PercentChange here because TextCtrl_PercentChange // always tracks it & is more precise (decimal points). @@ -459,9 +459,9 @@ bool ChangePitchDialog::TransferDataFromWindow() // calculations -void ChangePitchDialog::Calc_ToPitch() +void ChangePitchDialog::Calc_ToPitch() { - int nSemitonesChange = + int nSemitonesChange = (int)(m_dSemitonesChange + ((m_dSemitonesChange < 0.0) ? -0.5 : 0.5)); m_nToPitch = (m_nFromPitch + nSemitonesChange) % 12; if (m_nToPitch < 0) @@ -475,13 +475,13 @@ void ChangePitchDialog::Calc_ToOctave() void ChangePitchDialog::Calc_SemitonesChange_fromPitches() { - m_dSemitonesChange = + m_dSemitonesChange = PitchToMIDInote(m_nToPitch, m_nToOctave) - PitchToMIDInote(m_nFromPitch, m_nFromOctave); } void ChangePitchDialog::Calc_SemitonesChange_fromPercentChange() { - // Use m_dPercentChange rather than m_FromFrequency & m_ToFrequency, because + // Use m_dPercentChange rather than m_FromFrequency & m_ToFrequency, because // they start out uninitialized, but m_dPercentChange is always valid. m_dSemitonesChange = (12.0 * log((100.0 + m_dPercentChange) / 100.0)) / log(2.0); } @@ -528,10 +528,10 @@ void ChangePitchDialog::OnSpin_FromOctave(wxCommandEvent & WXUNUSED(event)) if (m_bLoopDetect) return; - if (m_pSpin_FromOctave) + if (m_pSpin_FromOctave) { m_nFromOctave = m_pSpin_FromOctave->GetValue(); - //vvv If I change this code to not keep semitones and percent constant, + //vvv If I change this code to not keep semitones and percent constant, // will need validation code as in OnSpin_ToOctave. m_FromFrequency = PitchToFreq(m_nFromPitch, m_nFromOctave); @@ -553,7 +553,7 @@ void ChangePitchDialog::OnChoice_ToPitch(wxCommandEvent & WXUNUSED(event)) if (m_bLoopDetect) return; - if (m_pChoice_ToPitch) + if (m_pChoice_ToPitch) { m_nToPitch = m_pChoice_ToPitch->GetSelection(); @@ -577,11 +577,11 @@ void ChangePitchDialog::OnSpin_ToOctave(wxCommandEvent & WXUNUSED(event)) if (m_bLoopDetect) return; - if (m_pSpin_ToOctave) + if (m_pSpin_ToOctave) { int nNewValue = m_pSpin_ToOctave->GetValue(); - // Validation: Rather than set a range for octave numbers, enforce a range that - // keeps m_dPercentChange above -99%, per Soundtouch constraints. + // Validation: Rather than set a range for octave numbers, enforce a range that + // keeps m_dPercentChange above -99%, per Soundtouch constraints. if ((nNewValue + 3) < m_nFromOctave) { ::wxBell(); @@ -637,8 +637,8 @@ void ChangePitchDialog::OnText_SemitonesChange(wxCommandEvent & WXUNUSED(event)) } m_bLoopDetect = false; - // If m_dSemitonesChange is a big enough negative, we can go to or below 0 freq. - // If m_dSemitonesChange is a big enough positive, we can go to 1.#INF (Windows) or inf (Linux). + // If m_dSemitonesChange is a big enough negative, we can go to or below 0 freq. + // If m_dSemitonesChange is a big enough positive, we can go to 1.#INF (Windows) or inf (Linux). // But practically, these are best limits for Soundtouch. bool bIsGoodValue = (m_dSemitonesChange > -80.0) && (m_dSemitonesChange <= 60.0); this->FindWindow(wxID_OK)->Enable(bIsGoodValue); @@ -656,8 +656,8 @@ void ChangePitchDialog::OnText_FromFrequency(wxCommandEvent & WXUNUSED(event)) double newDouble; str.ToDouble(&newDouble); // Empty string causes unpredictable results with ToDouble() and later calculations. - // Non-positive frequency makes no sense, but user might still be editing, - // so it's not an error, but we do not want to update the values/controls. + // Non-positive frequency makes no sense, but user might still be editing, + // so it's not an error, but we do not want to update the values/controls. if (str.IsEmpty() || (newDouble <= 0.0) || (newDouble > DBL_MAX)) { this->FindWindow(wxID_OK)->Disable(); @@ -683,7 +683,7 @@ void ChangePitchDialog::OnText_FromFrequency(wxCommandEvent & WXUNUSED(event)) } m_bLoopDetect = false; - // Success. Make sure OK and Preview are enabled, in case we disabled above during editing. + // Success. Make sure OK and Preview are enabled, in case we disabled above during editing. this->FindWindow(wxID_OK)->Enable(); this->FindWindow(ID_EFFECT_PREVIEW)->Enable(); } @@ -699,8 +699,8 @@ void ChangePitchDialog::OnText_ToFrequency(wxCommandEvent & WXUNUSED(event)) double newDouble; str.ToDouble(&newDouble); // Empty string causes unpredictable results with ToDouble() and later calculations. - // Non-positive frequency makes no sense, but user might still be editing, - // so it's not an error, but we do not want to update the values/controls. + // Non-positive frequency makes no sense, but user might still be editing, + // so it's not an error, but we do not want to update the values/controls. if (str.IsEmpty() || (newDouble <= 0.0) ) { this->FindWindow(wxID_OK)->Disable(); @@ -709,7 +709,7 @@ void ChangePitchDialog::OnText_ToFrequency(wxCommandEvent & WXUNUSED(event)) } m_ToFrequency = newDouble; - m_dPercentChange = (((double)(m_ToFrequency) * 100.0) / + m_dPercentChange = (((double)(m_ToFrequency) * 100.0) / (double)(m_FromFrequency)) - 100.0; this->Calc_ToOctave(); // Call after Calc_ToFrequency(). @@ -725,10 +725,10 @@ void ChangePitchDialog::OnText_ToFrequency(wxCommandEvent & WXUNUSED(event)) this->Update_Slider_PercentChange(); } m_bLoopDetect = false; - - // Success. Make sure OK and Preview are disabled if percent change is out of bounds. - // Can happen while editing. - // If the value is good, might also need to re-enable because of above clause. + + // Success. Make sure OK and Preview are disabled if percent change is out of bounds. + // Can happen while editing. + // If the value is good, might also need to re-enable because of above clause. bool bIsGoodValue = (m_dPercentChange > PERCENTCHANGE_MIN) && (m_dPercentChange <= PERCENTCHANGE_MAX_TEXT); this->FindWindow(wxID_OK)->Enable(bIsGoodValue); this->FindWindow(ID_EFFECT_PREVIEW)->Enable(bIsGoodValue); @@ -744,8 +744,8 @@ void ChangePitchDialog::OnText_PercentChange(wxCommandEvent & WXUNUSED(event)) wxString str = m_pTextCtrl_PercentChange->GetValue(); double newValue = 0; str.ToDouble(&newValue); - // User might still be editing, so out of bounds is not an error, - // but we do not want to update the values/controls. + // User might still be editing, so out of bounds is not an error, + // but we do not want to update the values/controls. if (str.IsEmpty() || (newValue < PERCENTCHANGE_MIN) || (newValue > PERCENTCHANGE_MAX_TEXT)) { this->FindWindow(wxID_OK)->Disable(); @@ -769,7 +769,7 @@ void ChangePitchDialog::OnText_PercentChange(wxCommandEvent & WXUNUSED(event)) } m_bLoopDetect = false; - // Success. Make sure OK and Preview are enabled, in case we disabled above during editing. + // Success. Make sure OK and Preview are enabled, in case we disabled above during editing. this->FindWindow(wxID_OK)->Enable(); this->FindWindow(ID_EFFECT_PREVIEW)->Enable(); } @@ -781,7 +781,7 @@ void ChangePitchDialog::OnSlider_PercentChange(wxCommandEvent & WXUNUSED(event)) return; if (m_pSlider_PercentChange) { - m_dPercentChange = (double)(m_pSlider_PercentChange->GetValue()); + m_dPercentChange = (double)(m_pSlider_PercentChange->GetValue()); // Warp positive values to actually go up faster & further than negatives. if (m_dPercentChange > 0.0) m_dPercentChange = pow(m_dPercentChange, PERCENTCHANGE_SLIDER_WARP); @@ -821,28 +821,28 @@ void ChangePitchDialog::OnPreview(wxCommandEvent & WXUNUSED(event)) // helper fns for controls -void ChangePitchDialog::Update_Choice_FromPitch() +void ChangePitchDialog::Update_Choice_FromPitch() { - if (m_pChoice_FromPitch) + if (m_pChoice_FromPitch) m_pChoice_FromPitch->SetSelection(m_nFromPitch); } -void ChangePitchDialog::Update_Spin_FromOctave() +void ChangePitchDialog::Update_Spin_FromOctave() { - if (m_pSpin_FromOctave) - m_pSpin_FromOctave->SetValue(m_nFromOctave); + if (m_pSpin_FromOctave) + m_pSpin_FromOctave->SetValue(m_nFromOctave); } -void ChangePitchDialog::Update_Choice_ToPitch() +void ChangePitchDialog::Update_Choice_ToPitch() { - if (m_pChoice_ToPitch) + if (m_pChoice_ToPitch) m_pChoice_ToPitch->SetSelection(m_nToPitch); } -void ChangePitchDialog::Update_Spin_ToOctave() +void ChangePitchDialog::Update_Spin_ToOctave() { - if (m_pSpin_ToOctave) - m_pSpin_ToOctave->SetValue(m_nToOctave); + if (m_pSpin_ToOctave) + m_pSpin_ToOctave->SetValue(m_nToOctave); } void ChangePitchDialog::Update_Text_SemitonesChange() @@ -854,7 +854,7 @@ void ChangePitchDialog::Update_Text_SemitonesChange() } } -void ChangePitchDialog::Update_Text_FromFrequency() +void ChangePitchDialog::Update_Text_FromFrequency() { if (m_pTextCtrl_FromFrequency) { wxString str; @@ -866,7 +866,7 @@ void ChangePitchDialog::Update_Text_FromFrequency() } } -void ChangePitchDialog::Update_Text_ToFrequency() +void ChangePitchDialog::Update_Text_ToFrequency() { if (m_pTextCtrl_ToFrequency) { wxString str; @@ -909,7 +909,7 @@ void ChangePitchDialog::Update_Slider_PercentChange() newSetting = (int)PERCENTCHANGE_MIN; if (newSetting > PERCENTCHANGE_MAX_SLIDER) newSetting = (int)PERCENTCHANGE_MAX_SLIDER; - m_pSlider_PercentChange->SetValue(newSetting); + m_pSlider_PercentChange->SetValue(newSetting); } } diff --git a/src/effects/ChangePitch.h b/src/effects/ChangePitch.h index 58f9d00ca..71d5d09e9 100644 --- a/src/effects/ChangePitch.h +++ b/src/effects/ChangePitch.h @@ -5,12 +5,12 @@ License: GPL v2. See License.txt. ChangePitch.h - Vaughan Johnson, Dominic Mazzoni, Steve Daulton + Vaughan Johnson, Dominic Mazzoni, Steve Daulton ******************************************************************//** \file ChangePitch.h -\brief Change Pitch effect provides raising or lowering +\brief Change Pitch effect provides raising or lowering the pitch without changing the tempo. *//*******************************************************************/ @@ -27,13 +27,13 @@ the pitch without changing the tempo. #include #include -class EffectChangePitch : public EffectSoundTouch +class EffectChangePitch : public EffectSoundTouch { public: EffectChangePitch(); virtual wxString GetEffectName() { return wxString(_("Change Pitch...")); } - + virtual std::set GetEffectCategories() { std::set result; result.insert(wxT("http://lv2plug.in/ns/lv2core#PitchPlugin")); @@ -48,13 +48,13 @@ class EffectChangePitch : public EffectSoundTouch virtual wxString GetEffectAction() { return wxString(_("Changing Pitch")); } - - // Useful only after PromptUser values have been set. - virtual wxString GetEffectDescription(); + + // Useful only after PromptUser values have been set. + virtual wxString GetEffectDescription(); virtual bool Init(); - // Deduce m_FromFrequency from the samples at the beginning of + // Deduce m_FromFrequency from the samples at the beginning of // the selection. Then set some other params accordingly. virtual void DeduceFrequencies(); @@ -81,10 +81,10 @@ class wxRadioButton; class wxString; class wxTextCtrl; -class ChangePitchDialog : public EffectDialog +class ChangePitchDialog : public EffectDialog { public: - ChangePitchDialog(EffectChangePitch * effect, wxWindow * parent, + ChangePitchDialog(EffectChangePitch * effect, wxWindow * parent, double dSemitonesChange, double dStartFrequency); void PopulateOrExchange(ShuttleGui & S); @@ -94,7 +94,7 @@ class ChangePitchDialog : public EffectDialog private: // calculations void Calc_ToPitch(); // Update m_nToPitch from new m_dSemitonesChange. - void Calc_ToOctave(); + void Calc_ToOctave(); void Calc_SemitonesChange_fromPitches(); void Calc_SemitonesChange_fromOctaveChange(); void Calc_SemitonesChange_fromPercentChange(); @@ -133,7 +133,7 @@ class ChangePitchDialog : public EffectDialog private: EffectChangePitch * mEffect; - bool m_bLoopDetect; // Used to avoid loops in initialization and in event handling. + bool m_bLoopDetect; // Used to avoid loops in initialization and in event handling. // controls wxChoice * m_pChoice_FromPitch; diff --git a/src/effects/ChangeSpeed.cpp b/src/effects/ChangeSpeed.cpp index 3977c330b..b1fb85f49 100644 --- a/src/effects/ChangeSpeed.cpp +++ b/src/effects/ChangeSpeed.cpp @@ -5,7 +5,7 @@ ChangeSpeed.cpp Vaughan Johnson, Dominic Mazzoni - + *******************************************************************//** \class EffectChangeSpeed @@ -53,16 +53,16 @@ EffectChangeSpeed::EffectChangeSpeed() { // control values m_PercentChange = 0.0; - mFromVinyl = kVinyl_33AndAThird; - mToVinyl = kVinyl_33AndAThird; + mFromVinyl = kVinyl_33AndAThird; + mToVinyl = kVinyl_33AndAThird; } -wxString EffectChangeSpeed::GetEffectDescription() { - // Note: This is useful only after change amount has been set. - return wxString::Format(_("Applied effect: %s %.1f%%"), - this->GetEffectName().c_str(), - m_PercentChange); -} +wxString EffectChangeSpeed::GetEffectDescription() { + // Note: This is useful only after change amount has been set. + return wxString::Format(_("Applied effect: %s %.1f%%"), + this->GetEffectName().c_str(), + m_PercentChange); +} double EffectChangeSpeed::CalcPreviewInputLength(double previewLength) { @@ -75,9 +75,9 @@ bool EffectChangeSpeed::PromptUser() dlog.m_PercentChange = m_PercentChange; dlog.mFromVinyl = mFromVinyl; dlog.mToVinyl = mToVinyl; - // Don't need to call TransferDataToWindow, although other - // Audacity dialogs (from which I derived this one) do it, because - // ShowModal calls stuff that eventually calls wxWindowBase::OnInitDialog, + // Don't need to call TransferDataToWindow, although other + // Audacity dialogs (from which I derived this one) do it, because + // ShowModal calls stuff that eventually calls wxWindowBase::OnInitDialog, // which calls dlog.TransferDataToWindow(); dlog.CentreOnParent(); dlog.ShowModal(); @@ -93,7 +93,7 @@ bool EffectChangeSpeed::PromptUser() } bool EffectChangeSpeed::TransferParameters(Shuttle& shuttle) -{ +{ shuttle.TransferDouble(wxT("Percentage"), m_PercentChange, 0.0); return true; } @@ -116,7 +116,7 @@ bool EffectChangeSpeed::Process() // Similar to EffectSoundTouch::Process() // Iterate over each track. - // Track::All is needed because this effect needs to introduce + // Track::All is needed because this effect needs to introduce // silence in the sync-lock group tracks to keep sync this->CopyInputTracks(Track::All); // Set up mOutputTracks. bool bGoodResult = true; @@ -200,18 +200,18 @@ bool EffectChangeSpeed::ProcessOne(WaveTrack * track, //Get the length of the selection (as double). len is //used simple to calculate a progress meter, so it is easier - //to make it a double now than it is to do it later + //to make it a double now than it is to do it later double len = (double)(end - start); - // Initiate processing buffers, most likely shorter than + // Initiate processing buffers, most likely shorter than // the length of the selection being processed. sampleCount inBufferSize = track->GetMaxBlockSize(); float * inBuffer = new float[inBufferSize]; - sampleCount outBufferSize = + sampleCount outBufferSize = (sampleCount)((mFactor * inBufferSize) + 10); - float * outBuffer = new float[outBufferSize]; + float * outBuffer = new float[outBufferSize]; // Set up the resampling stuff for this track. Resample resample(true, mFactor, mFactor); // constant rate resampling @@ -246,7 +246,7 @@ bool EffectChangeSpeed::ProcessOne(WaveTrack * track, } if (outgen > 0) - outputTrack->Append((samplePtr)outBuffer, floatSample, + outputTrack->Append((samplePtr)outBuffer, floatSample, outgen); // Increment samplePos @@ -268,15 +268,15 @@ bool EffectChangeSpeed::ProcessOne(WaveTrack * track, // Take the output track and insert it in place of the original // sample data - double newLength = outputTrack->GetEndTime(); - if (bResult) + double newLength = outputTrack->GetEndTime(); + if (bResult) { SetTimeWarper(new LinearTimeWarper(mCurT0, mCurT0, mCurT1, mCurT0 + newLength)); bResult = track->ClearAndPaste(mCurT0, mCurT1, outputTrack, true, false, GetTimeWarper()); } - if (newLength > mMaxNewLength) - mMaxNewLength = newLength; + if (newLength > mMaxNewLength) + mMaxNewLength = newLength; // Delete the outputTrack now that its data is inserted in place delete outputTrack; @@ -315,16 +315,16 @@ BEGIN_EVENT_TABLE(ChangeSpeedDialog, EffectDialog) END_EVENT_TABLE() ChangeSpeedDialog::ChangeSpeedDialog(EffectChangeSpeed *effect, wxWindow *parent) -: EffectDialog(parent, +: EffectDialog(parent, /* i18n-hint: Audacity's change speed effect changes the speed and pitch.*/ - _("Change Speed"), + _("Change Speed"), PROCESS_EFFECT), mEffect(effect) { mbLoopDetect = false; - // NULL out these control members because there are some cases where the - // event table handlers get called during this method, and those handlers that + // NULL out these control members because there are some cases where the + // event table handlers get called during this method, and those handlers that // can cause trouble check for NULL. mpTextCtrl_PercentChange = NULL; mpSlider_PercentChange = NULL; @@ -333,8 +333,8 @@ ChangeSpeedDialog::ChangeSpeedDialog(EffectChangeSpeed *effect, wxWindow *parent // effect parameters m_PercentChange = 0.0; - mFromVinyl = kVinyl_33AndAThird; - mToVinyl = kVinyl_33AndAThird; + mFromVinyl = kVinyl_33AndAThird; + mToVinyl = kVinyl_33AndAThird; Init(); } @@ -349,7 +349,7 @@ void ChangeSpeedDialog::PopulateOrExchange(ShuttleGui & S) // S.StartMultiColumn(2, wxCENTER); { - mpTextCtrl_PercentChange = + mpTextCtrl_PercentChange = S.Id(ID_TEXT_PERCENTCHANGE).AddTextBox(_("Percent Change:"), wxT(""), 12); wxTextValidator validator(wxFILTER_NUMERIC); mpTextCtrl_PercentChange->SetValidator(validator); @@ -360,13 +360,13 @@ void ChangeSpeedDialog::PopulateOrExchange(ShuttleGui & S) S.StartHorizontalLay(wxEXPAND); { S.SetStyle(wxSL_HORIZONTAL); - mpSlider_PercentChange = + mpSlider_PercentChange = S.Id(ID_SLIDER_PERCENTCHANGE).AddSlider(wxT(""), 0, (int)PERCENTCHANGE_MAX, (int)PERCENTCHANGE_MIN); mpSlider_PercentChange->SetName(_("Percent Change")); } S.EndHorizontalLay(); - // + // S.StartMultiColumn(5, wxCENTER); { S.AddUnits(_("Standard Vinyl RPM:")); @@ -378,12 +378,12 @@ void ChangeSpeedDialog::PopulateOrExchange(ShuttleGui & S) /* i18n-hint: n/a is an English abbreviation meaning "not applicable". */ rpmStrings.Add(_("n/a")); - mpChoice_FromVinyl = + mpChoice_FromVinyl = S.Id(ID_CHOICE_FROMVINYL).AddChoice(_("from"), wxT(""), &rpmStrings); mpChoice_FromVinyl->SetName(_("From RPM")); mpChoice_FromVinyl->SetSizeHints(100, -1); - mpChoice_ToVinyl = + mpChoice_ToVinyl = S.Id(ID_CHOICE_TOVINYL).AddChoice(_("to"), wxT(""), &rpmStrings); mpChoice_ToVinyl->SetName(_("To RPM")); mpChoice_ToVinyl->SetSizeHints(100, -1); @@ -400,10 +400,10 @@ bool ChangeSpeedDialog::TransferDataToWindow() this->Update_Slider_PercentChange(); // from/to Vinyl controls - if (mpChoice_FromVinyl) + if (mpChoice_FromVinyl) mpChoice_FromVinyl->SetSelection(mFromVinyl); - if (mpChoice_ToVinyl) + if (mpChoice_ToVinyl) mpChoice_ToVinyl->SetSelection(mToVinyl); mbLoopDetect = false; @@ -413,10 +413,10 @@ bool ChangeSpeedDialog::TransferDataToWindow() bool ChangeSpeedDialog::TransferDataFromWindow() { - // percent change - // Ignore mpSlider_PercentChange because mpTextCtrl_PercentChange + // percent change + // Ignore mpSlider_PercentChange because mpTextCtrl_PercentChange // always tracks it & is more precise (decimal points). - if (mpTextCtrl_PercentChange) + if (mpTextCtrl_PercentChange) { double newValue = 0; wxString str = mpTextCtrl_PercentChange->GetValue(); @@ -425,10 +425,10 @@ bool ChangeSpeedDialog::TransferDataFromWindow() } // from/to Vinyl controls - if (mpChoice_FromVinyl) + if (mpChoice_FromVinyl) mFromVinyl = mpChoice_FromVinyl->GetSelection(); - if (mpChoice_ToVinyl) + if (mpChoice_ToVinyl) mToVinyl = mpChoice_ToVinyl->GetSelection(); return true; @@ -463,7 +463,7 @@ void ChangeSpeedDialog::OnSlider_PercentChange(wxCommandEvent & WXUNUSED(event)) return; if (mpSlider_PercentChange) { - m_PercentChange = (double)(mpSlider_PercentChange->GetValue()); + m_PercentChange = (double)(mpSlider_PercentChange->GetValue()); // Warp positive values to actually go up faster & further than negatives. if (m_PercentChange > 0.0) m_PercentChange = pow(m_PercentChange, PERCENTCHANGE_SLIDER_WARP); @@ -516,7 +516,7 @@ void ChangeSpeedDialog::OnPreview(wxCommandEvent & WXUNUSED(event)) } mEffect->m_PercentChange = m_PercentChange; mEffect->Preview(); - mEffect->m_PercentChange = oldPercentChange; + mEffect->m_PercentChange = oldPercentChange; } // helper fns @@ -540,16 +540,16 @@ void ChangeSpeedDialog::Update_Slider_PercentChange() unwarped = pow(m_PercentChange, (1.0 / PERCENTCHANGE_SLIDER_WARP)); // Add 0.5 to unwarped so trunc -> round. - mpSlider_PercentChange->SetValue((int)(unwarped + 0.5)); + mpSlider_PercentChange->SetValue((int)(unwarped + 0.5)); } } -void ChangeSpeedDialog::Update_Vinyl() +void ChangeSpeedDialog::Update_Vinyl() // Update Vinyl controls for new percent change. { - if (mpChoice_ToVinyl) + if (mpChoice_ToVinyl) { - // Chances are so low that the slider will exactly match a + // Chances are so low that the slider will exactly match a // standard ratio, just turn it "n/a" unless it's 0.0. if ((m_PercentChange == 0.0) && mpChoice_FromVinyl) mpChoice_ToVinyl->SetSelection(mpChoice_FromVinyl->GetSelection()); @@ -558,11 +558,11 @@ void ChangeSpeedDialog::Update_Vinyl() } } -void ChangeSpeedDialog::Update_PercentChange() +void ChangeSpeedDialog::Update_PercentChange() // Update percent change controls for new Vinyl values. { // If mFromVinyl & mToVinyl are set, then there's a new percent change. - if ((mFromVinyl != kVinyl_NA) && (mToVinyl != kVinyl_NA)) + if ((mFromVinyl != kVinyl_NA) && (mToVinyl != kVinyl_NA)) { double fromRPM; double toRPM; diff --git a/src/effects/ChangeSpeed.h b/src/effects/ChangeSpeed.h index c049a1bc4..2e6200be5 100644 --- a/src/effects/ChangeSpeed.h +++ b/src/effects/ChangeSpeed.h @@ -5,7 +5,7 @@ ChangeSpeed.h Vaughan Johnson, Dominic Mazzoni - + Change Speed effect, that affects both pitch & tempo. **********************************************************************/ @@ -23,7 +23,7 @@ #include #include -class EffectChangeSpeed : public Effect +class EffectChangeSpeed : public Effect { public: EffectChangeSpeed(); @@ -45,11 +45,11 @@ class EffectChangeSpeed : public Effect virtual wxString GetEffectAction() { return wxString(_("Changing Speed")); } - - // Useful only after PromptUser values have been set. - virtual wxString GetEffectDescription(); - double CalcPreviewInputLength(double previewLength); + // Useful only after PromptUser values have been set. + virtual wxString GetEffectDescription(); + + double CalcPreviewInputLength(double previewLength); protected: virtual bool PromptUser(); @@ -81,7 +81,7 @@ friend class ChangeSpeedDialog; }; -class ChangeSpeedDialog : public EffectDialog +class ChangeSpeedDialog : public EffectDialog { public: ChangeSpeedDialog(EffectChangeSpeed * effect, diff --git a/src/effects/ChangeTempo.cpp b/src/effects/ChangeTempo.cpp index dfdc55d90..dcd944b74 100644 --- a/src/effects/ChangeTempo.cpp +++ b/src/effects/ChangeTempo.cpp @@ -4,13 +4,13 @@ ChangeTempo.cpp - Vaughan Johnson, + Vaughan Johnson, Dominic Mazzoni *******************************************************************//** \class EffectChangeTempo -\brief An EffectSoundTouch provides speeding up or +\brief An EffectSoundTouch provides speeding up or slowing down tempo without changing pitch. *//****************************************************************//** @@ -56,12 +56,12 @@ double EffectChangeTempo::CalcPreviewInputLength(double previewLength) return previewLength * (100.0 + m_PercentChange) / 100.0; } -wxString EffectChangeTempo::GetEffectDescription() { +wxString EffectChangeTempo::GetEffectDescription() { // Note: This is useful only after change amount has been set. return wxString::Format(_("Applied effect: %s %.1f%%"), this->GetEffectName().c_str(), m_PercentChange); -} +} bool EffectChangeTempo::Init() { @@ -101,7 +101,7 @@ bool EffectChangeTempo::PromptUser() } bool EffectChangeTempo::TransferParameters( Shuttle & shuttle ) -{ +{ shuttle.TransferDouble(wxT("Percentage"),m_PercentChange,0.0); return true; } @@ -200,7 +200,7 @@ void ChangeTempoDialog::PopulateOrExchange(ShuttleGui & S) } S.EndHorizontalLay(); - // + // S.StartMultiColumn(5, wxCENTER); { // @@ -397,7 +397,7 @@ void ChangeTempoDialog::OnText_ToBPM(wxCommandEvent & WXUNUSED(event)) this->Update_Text_ToLength(); } - + m_bLoopDetect = false; } } @@ -421,7 +421,7 @@ void ChangeTempoDialog::OnText_ToLength(wxCommandEvent & WXUNUSED(event)) this->Update_Slider_PercentChange(); this->Update_Text_ToBPM(); - + m_bLoopDetect = false; } } @@ -467,7 +467,7 @@ void ChangeTempoDialog::Update_Slider_PercentChange() } } -void ChangeTempoDialog::Update_Text_ToBPM() +void ChangeTempoDialog::Update_Text_ToBPM() // Use m_FromBPM & m_PercentChange to set new m_ToBPM & control. { // Update ToBPM iff FromBPM has been set. @@ -482,7 +482,7 @@ void ChangeTempoDialog::Update_Text_ToBPM() } } -void ChangeTempoDialog::Update_Text_ToLength() +void ChangeTempoDialog::Update_Text_ToLength() // Use m_FromLength & m_PercentChange to set new m_ToLength & control. { m_ToLength = (m_FromLength * 100.0) / (100.0 + m_PercentChange); diff --git a/src/effects/ChangeTempo.h b/src/effects/ChangeTempo.h index c35d24b7f..c2db0d275 100644 --- a/src/effects/ChangeTempo.h +++ b/src/effects/ChangeTempo.h @@ -5,8 +5,8 @@ ChangeTempo.h Vaughan Johnson, Dominic Mazzoni - - Change Tempo effect provides speeding up or + + Change Tempo effect provides speeding up or slowing down tempo without changing pitch. **********************************************************************/ @@ -48,9 +48,9 @@ class EffectChangeTempo : public EffectSoundTouch { virtual wxString GetEffectAction() { return wxString(_("Changing Tempo")); } - - // Useful only after PromptUser values have been set. - virtual wxString GetEffectDescription(); + + // Useful only after PromptUser values have been set. + virtual wxString GetEffectDescription(); virtual bool Init(); @@ -61,7 +61,7 @@ class EffectChangeTempo : public EffectSoundTouch { virtual bool Process(); double CalcPreviewInputLength(double previewLength); - + private: double m_PercentChange; // percent change to apply to tempo // -100% is meaningless, but sky's the upper limit diff --git a/src/effects/ClickRemoval.cpp b/src/effects/ClickRemoval.cpp index 5609daa8e..dd61fabd3 100644 --- a/src/effects/ClickRemoval.cpp +++ b/src/effects/ClickRemoval.cpp @@ -114,7 +114,7 @@ bool EffectClickRemoval::PromptUser() } bool EffectClickRemoval::TransferParameters( Shuttle & shuttle ) -{ +{ shuttle.TransferInt(wxT("Threshold"),mThresholdLevel,0); shuttle.TransferInt(wxT("Width"),mClickWidth,0); return true; @@ -124,7 +124,7 @@ bool EffectClickRemoval::Process() { this->CopyInputTracks(); // Set up mOutputTracks. bool bGoodResult = true; - mbDidSomething = false; + mbDidSomething = false; SelectedTrackListOfKindIterator iter(Track::Wave, mOutputTracks); WaveTrack *track = (WaveTrack *) iter.First(); @@ -150,13 +150,13 @@ bool EffectClickRemoval::Process() track = (WaveTrack *) iter.Next(); count++; } - if (bGoodResult && !mbDidSomething) // Processing successful, but ineffective. + if (bGoodResult && !mbDidSomething) // Processing successful, but ineffective. wxMessageBox( - wxString::Format(_("Algorithm not effective on this audio. Nothing changed.")), - this->GetEffectName(), + wxString::Format(_("Algorithm not effective on this audio. Nothing changed.")), + this->GetEffectName(), wxOK | wxICON_ERROR); - this->ReplaceProcessedTracks(bGoodResult && mbDidSomething); + this->ReplaceProcessedTracks(bGoodResult && mbDidSomething); return bGoodResult && mbDidSomething; } @@ -165,21 +165,21 @@ bool EffectClickRemoval::ProcessOne(int count, WaveTrack * track, sampleCount st if (len <= windowSize/2) { wxMessageBox( - wxString::Format(_("Selection must be larger than %d samples."), windowSize/2), - this->GetEffectName(), + wxString::Format(_("Selection must be larger than %d samples."), windowSize/2), + this->GetEffectName(), wxOK | wxICON_ERROR); - return false; + return false; } sampleCount idealBlockLen = track->GetMaxBlockSize() * 4; if (idealBlockLen % windowSize != 0) idealBlockLen += (windowSize - (idealBlockLen % windowSize)); - bool bResult = true; + bool bResult = true; sampleCount s = 0; float *buffer = new float[idealBlockLen]; float *datawindow = new float[windowSize]; - while ((s < len) && ((len - s) > windowSize/2)) + while ((s < len) && ((len - s) > windowSize/2)) { sampleCount block = idealBlockLen; if (s + block > len) @@ -187,7 +187,7 @@ bool EffectClickRemoval::ProcessOne(int count, WaveTrack * track, sampleCount st track->Get((samplePtr) buffer, floatSample, start + s, block); - for (int i=0; i < (block-windowSize/2); i += windowSize/2) + for (int i=0; i < (block-windowSize/2); i += windowSize/2) { int wcopy = windowSize; if (i + wcopy > block) @@ -224,7 +224,7 @@ bool EffectClickRemoval::ProcessOne(int count, WaveTrack * track, sampleCount st bool EffectClickRemoval::RemoveClicks(sampleCount len, float *buffer) { - bool bResult = false; // This effect usually does nothing. + bool bResult = false; // This effect usually does nothing. int i; int j; int left = 0; @@ -307,8 +307,8 @@ const static wxChar *numbers[] = wxT("5"), wxT("6"), wxT("7"), wxT("8"), wxT("9") }; -// Declare window functions - +// Declare window functions + #define ID_THRESH_TEXT 10001 #define ID_THRESH_SLIDER 10002 #define ID_WIDTH_TEXT 10003 diff --git a/src/effects/ClickRemoval.h b/src/effects/ClickRemoval.h index 551d88223..44391ee6e 100644 --- a/src/effects/ClickRemoval.h +++ b/src/effects/ClickRemoval.h @@ -62,7 +62,7 @@ public: virtual bool Init(); virtual bool CheckWhetherSkipEffect(); - + virtual bool Process(); private: @@ -73,7 +73,7 @@ private: Envelope *mEnvelope; - bool mbDidSomething; // This effect usually does nothing on real-world data. + bool mbDidSomething; // This effect usually does nothing on real-world data. int windowSize; int mThresholdLevel; int mClickWidth; @@ -115,7 +115,7 @@ class ClickRemovalDialog:public EffectDialog { public: EffectClickRemoval *mEffect; - + int mThresh; int mWidth; diff --git a/src/effects/Compressor.cpp b/src/effects/Compressor.cpp index 6928e9530..560fe509f 100644 --- a/src/effects/Compressor.cpp +++ b/src/effects/Compressor.cpp @@ -479,7 +479,7 @@ void CompressorPanel::OnPaint(wxPaintEvent & WXUNUSED(event)) vRuler.SetFormat(Ruler::LinearDBFormat); vRuler.SetUnits(_("dB")); vRuler.GetMaxSize(&w, NULL); - + Ruler hRuler; hRuler.SetBounds(0, 0, mWidth, mHeight); hRuler.SetOrientation(wxHORIZONTAL); @@ -647,8 +647,8 @@ void CompressorDialog::PopulateOrExchange(ShuttleGui & S) mRatioText = S.AddVariableText(wxT("XXXX:1"), true, wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL); - /* i18n-hint: Particularly in percussion, sounds can be regarded as having - * an 'attack' phase where the sound builds up and a 'decay' where the + /* i18n-hint: Particularly in percussion, sounds can be regarded as having + * an 'attack' phase where the sound builds up and a 'decay' where the * sound dies away. So this means 'onset duration'. */ mAttackLabel = S.AddVariableText(_("Attack Time:"), true, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL); @@ -725,13 +725,13 @@ bool CompressorDialog::TransferDataFromWindow() if (mRatioSlider->GetValue()%2 == 0) { mRatioLabel->SetName(wxString::Format(_("Ratio %.0f to 1"), ratio)); - /* i18n-hint: Unless your language has a different convention for ratios, + /* i18n-hint: Unless your language has a different convention for ratios, * like 8:1, leave as is.*/ mRatioText->SetLabel(wxString::Format(_("%.0f:1"), ratio)); } else { mRatioLabel->SetName(wxString::Format(_("Ratio %.1f to 1"), ratio)); - /* i18n-hint: Unless your language has a different convention for ratios, + /* i18n-hint: Unless your language has a different convention for ratios, * like 8:1, leave as is.*/ mRatioText->SetLabel(wxString::Format(_("%.1f:1"), ratio)); } diff --git a/src/effects/Compressor.h b/src/effects/Compressor.h index a710c05f5..6177dbbeb 100644 --- a/src/effects/Compressor.h +++ b/src/effects/Compressor.h @@ -27,16 +27,16 @@ class wxString; class WaveTrack; class EffectCompressor: public EffectTwoPassSimpleMono { - + public: - + EffectCompressor(); virtual ~EffectCompressor(); - + virtual wxString GetEffectName() { return wxString(_("Compressor...")); } - + virtual std::set GetEffectCategories() { std::set result; result.insert(wxT("http://lv2plug.in/ns/lv2core#CompressorPlugin")); @@ -50,7 +50,7 @@ public: virtual wxString GetEffectAction() { return wxString(_("Applying Dynamic Range Compression...")); } - + virtual bool Init(); virtual bool PromptUser(); virtual bool TransferParameters( Shuttle & shuttle ); @@ -74,14 +74,14 @@ public: void Follow(float *buffer, float *env, int len, float *previous, int previous_len); float DoCompression(float x, double env); - + double mAttackTime; double mThresholdDB; double mNoiseFloorDB; double mRatio; bool mNormalize; //MJS bool mUsePeak; - + double mDecayTime; // The "Release" time. double mAttackFactor; double mAttackInverseFactor; @@ -104,7 +104,7 @@ public: class CompressorPanel: public wxPanel { public: - CompressorPanel( wxWindow *parent, wxWindowID id, + CompressorPanel( wxWindow *parent, wxWindowID id, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize); @@ -178,7 +178,7 @@ private: wxCheckBox *mGainCheckBox; wxCheckBox *mPeakCheckBox; - + private: DECLARE_EVENT_TABLE() }; diff --git a/src/effects/Contrast.cpp b/src/effects/Contrast.cpp index d858bbe6e..24717f4e6 100644 --- a/src/effects/Contrast.cpp +++ b/src/effects/Contrast.cpp @@ -68,7 +68,7 @@ void InitContrastDialog(wxWindow * parent) gContrastDialog->bBGset = false; } - // Zero dialog boxes. Do we need to do this here? + // Zero dialog boxes. Do we need to do this here? if( !gContrastDialog->bFGset ) { gContrastDialog->mForegroundStartT->SetTimeValue(0.0); @@ -123,7 +123,7 @@ float ContrastDialog::GetDB() return 1234.0; } bool mSelected = false; - while(t) { + while(t) { if( ((WaveTrack *)t)->GetSelected() ) { if( mSelected == true ) // already measured one track @@ -234,7 +234,7 @@ ContrastDialog::ContrastDialog(wxWindow * parent, wxWindowID id, mProjectRate = p->GetRate(); ShuttleGui S(this, eIsCreating); - + S.SetBorder(5); S.StartHorizontalLay(wxCENTER, false); { @@ -581,7 +581,7 @@ void ContrastDialog::OnExport(wxCommandEvent & WXUNUSED(event)) int hour = now.GetHour(); int minute = now.GetMinute(); int second = now.GetSecond(); - sNow = wxString::Format(wxT("%d %s %02d %02dh %02dm %02ds"), + sNow = wxString::Format(wxT("%d %s %02d %02dh %02dm %02ds"), dom, monthName.c_str(), year, hour, minute, second); f.AddLine(sNow); diff --git a/src/effects/DtmfGen.cpp b/src/effects/DtmfGen.cpp index f3700b399..5605c534a 100644 --- a/src/effects/DtmfGen.cpp +++ b/src/effects/DtmfGen.cpp @@ -87,7 +87,7 @@ bool EffectDtmf::Init() bool EffectDtmf::PromptUser() { DtmfDialog dlog(this, mParent, - /* i18n-hint: DTMF stands for 'Dial Tone Modulation Format'. Leave as is.*/ + /* i18n-hint: DTMF stands for 'Dial Tone Modulation Format'. Leave as is.*/ _("DTMF Tone Generator")); Init(); @@ -111,7 +111,7 @@ bool EffectDtmf::PromptUser() dtmfDutyCycle = dlog.dDutyCycle; mDuration = dlog.dDuration; dtmfAmplitude = dlog.dAmplitude; - + dtmfNTones = dlog.dNTones; dtmfTone = dlog.dTone; dtmfSilence = dlog.dSilence; @@ -168,24 +168,24 @@ bool EffectDtmf::MakeDtmfTone(float *buffer, sampleCount len, float fs, wxChar t // select low tone: left column switch (tone) { - case '1': case '2': case '3': case 'A': + case '1': case '2': case '3': case 'A': case 'a': case 'b': case 'c': case 'd': case 'e': case 'f': f1=697; break; - case '4': case '5': case '6': case 'B': + case '4': case '5': case '6': case 'B': case 'g': case 'h': case 'i': case 'j': case 'k': case 'l': case 'm': case 'n': case 'o': f1=770; break; - case '7': case '8': case '9': case 'C': + case '7': case '8': case '9': case 'C': case 'p': case 'q': case 'r': case 's': case 't': case 'u': case 'v': case 'w': case 'x': case 'y': case 'z': f1=852; break; - case '*': case '0': case '#': case 'D': + case '*': case '0': case '#': case 'D': f1=941; break; default: @@ -243,7 +243,7 @@ bool EffectDtmf::MakeDtmfTone(float *buffer, sampleCount len, float fs, wxChar t // backup 'A' samples, from 'len' A=(fs/FADEINOUT); sampleCount offset=len-(sampleCount)(fs/FADEINOUT); - // protect against negative offset, which can occur if too a + // protect against negative offset, which can occur if too a // small selection is made if (offset>=0) { for(sampleCount i=0; iSetValidator(vldDtmf); - // The added colon to improve visual consistency was placed outside - // the translatable strings to avoid breaking translations close to 2.0. + // The added colon to improve visual consistency was placed outside + // the translatable strings to avoid breaking translations close to 2.0. // TODO: Make colon part of the translatable string after 2.0. S.TieNumericTextBox(_("Amplitude (0-1)") + wxString(wxT(":")), dAmplitude, 10); diff --git a/src/effects/Echo.cpp b/src/effects/Echo.cpp index 18130cf25..77c7a7c77 100644 --- a/src/effects/Echo.cpp +++ b/src/effects/Echo.cpp @@ -43,11 +43,11 @@ EffectEcho::EffectEcho() decay = float(0.5); } -wxString EffectEcho::GetEffectDescription() { - // Note: This is useful only after values have been set. - return wxString::Format(_("Applied effect: %s delay = %f seconds, decay factor = %f"), - this->GetEffectName().c_str(), delay, decay); -} +wxString EffectEcho::GetEffectDescription() { + // Note: This is useful only after values have been set. + return wxString::Format(_("Applied effect: %s delay = %f seconds, decay factor = %f"), + this->GetEffectName().c_str(), delay, decay); +} bool EffectEcho::PromptUser() { @@ -67,7 +67,7 @@ bool EffectEcho::PromptUser() } bool EffectEcho::TransferParameters( Shuttle & shuttle ) -{ +{ shuttle.TransferFloat(wxT("Delay"),delay,1.0); shuttle.TransferFloat(wxT("Decay"),decay,0.5); return true; @@ -103,7 +103,7 @@ bool EffectEcho::Process() count++; } - this->ReplaceProcessedTracks(bGoodResult); + this->ReplaceProcessedTracks(bGoodResult); return bGoodResult; } @@ -112,7 +112,7 @@ bool EffectEcho::ProcessOne(int count, WaveTrack * track, { sampleCount s = 0; sampleCount blockSize = (sampleCount) (track->GetRate() * delay); - + //do nothing if the delay is less than 1 sample or greater than //the length of the selection if (blockSize < 1 || blockSize > len) @@ -145,7 +145,7 @@ bool EffectEcho::ProcessOne(int count, WaveTrack * track, first = false; s += block; - + if (TrackProgress(count, s / (double) len)) { delete[]buffer0; delete[]buffer1; @@ -185,14 +185,14 @@ EchoDialog::EchoDialog(EffectEcho * effect, wxWindow * parent) // effect parameters delay = float(1.0); decay = float(0.5); - + // Initialize dialog Init(); } void EchoDialog::PopulateOrExchange(ShuttleGui & S) { - S.AddSpace(0, 5); + S.AddSpace(0, 5); S.StartMultiColumn(2, wxALIGN_CENTER); { @@ -258,7 +258,7 @@ void EchoDialog::OnPreview(wxCommandEvent & WXUNUSED(event)) m_pEffect->decay = decay; m_pEffect->Preview(); - + m_pEffect->delay = oldDelay; m_pEffect->decay = oldDecay; } diff --git a/src/effects/Echo.h b/src/effects/Echo.h index 16aabd8f0..d2b418b5b 100644 --- a/src/effects/Echo.h +++ b/src/effects/Echo.h @@ -47,19 +47,19 @@ class EffectEcho:public Effect { virtual wxString GetEffectAction() { return wxString(_("Performing Echo")); } - - // Useful only after PromptUser values have been set. - virtual wxString GetEffectDescription(); + + // Useful only after PromptUser values have been set. + virtual wxString GetEffectDescription(); virtual bool PromptUser(); virtual bool TransferParameters( Shuttle & shuttle ); - + virtual bool Process(); private: bool ProcessOne(int count, WaveTrack * t, sampleCount start, sampleCount len); - + float delay; float decay; diff --git a/src/effects/Effect.cpp b/src/effects/Effect.cpp index 67f4ff51c..5d4a91550 100644 --- a/src/effects/Effect.cpp +++ b/src/effects/Effect.cpp @@ -16,7 +16,7 @@ *//****************************************************************//** \class EffectDialog -\brief New (Jun-2006) base class for effects dialogs. Likely to get +\brief New (Jun-2006) base class for effects dialogs. Likely to get greater use in future. *//*******************************************************************/ @@ -128,7 +128,7 @@ bool Effect::DoEffect(wxWindow *parent, int flags, } } - // Don't prompt user if we are dealing with a + // Don't prompt user if we are dealing with a // effect that is already configured, e.g. repeating // the last effect on a different selection. if( (flags & CONFIGURED_EFFECT) == 0) @@ -141,7 +141,7 @@ bool Effect::DoEffect(wxWindow *parent, int flags, bool skipFlag = CheckWhetherSkipEffect(); if (skipFlag == false) { mProgress = new ProgressDialog(StripAmpersand(GetEffectName()), - GetEffectAction(), + GetEffectAction(), pdlgHideStopButton); returnVal = Process(); delete mProgress; @@ -158,7 +158,7 @@ bool Effect::DoEffect(wxWindow *parent, int flags, *t0 = mT0; *t1 = mT1; } - + return returnVal; } @@ -228,7 +228,7 @@ TimeWarper *Effect::GetTimeWarper() // // private methods // -// Use these two methods to copy the input tracks to mOutputTracks, if +// Use these two methods to copy the input tracks to mOutputTracks, if // doing the processing on them, and replacing the originals only on success (and not cancel). // Copy the group tracks that have tracks selected void Effect::CopyInputTracks(int trackType) @@ -274,7 +274,7 @@ void Effect::ReplaceProcessedTracks(const bool bGoodResult) if (!bGoodResult) { // Processing failed or was cancelled so throw away the processed tracks. mOutputTracks->Clear(true); // true => delete the tracks - + // Reset map mIMap.Clear(); mOMap.Clear(); @@ -345,7 +345,7 @@ void Effect::ReplaceProcessedTracks(const bool bGoodResult) // Make sure we processed everything wxASSERT(iterOut.First() == NULL); - + // The output list is no longer needed delete mOutputTracks; mOutputTracks = NULL; @@ -365,7 +365,7 @@ void Effect::CountWaveTracks() t = iter.Next(); continue; } - + if (t->GetKind() == Track::Wave) { mNumTracks++; if (!t->GetLinked()) @@ -452,10 +452,10 @@ void Effect::Preview(bool dryOnly) // Build new tracklist from rendering tracks mTracks = new TrackList(); - mixLeft->SetSelected(true); + mixLeft->SetSelected(true); mTracks->Add(mixLeft); if (mixRight) { - mixRight->SetSelected(true); + mixRight->SetSelected(true); mTracks->Add(mixRight); } @@ -479,7 +479,7 @@ void Effect::Preview(bool dryOnly) // again, so the state is exactly the way it was before Preview // was called. mProgress = new ProgressDialog(StripAmpersand(GetEffectName()), - _("Preparing preview"), + _("Preparing preview"), pdlgHideCancelButton); // Have only "Stop" button. bSuccess = Process(); delete mProgress; @@ -494,7 +494,7 @@ void Effect::Preview(bool dryOnly) WaveTrackArray playbackTracks; WaveTrackArray recordingTracks; // Probably not the same tracks post-processing, so can't rely on previous values of mixLeft & mixRight. - TrackListOfKindIterator iter(Track::Wave, mTracks); + TrackListOfKindIterator iter(Track::Wave, mTracks); mixLeft = (WaveTrack*)(iter.First()); mixRight = (WaveTrack*)(iter.Next()); playbackTracks.Add(mixLeft); @@ -508,7 +508,7 @@ void Effect::Preview(bool dryOnly) #endif // Start audio playing int token = - gAudioIO->StartStream(playbackTracks, recordingTracks, + gAudioIO->StartStream(playbackTracks, recordingTracks, #ifdef EXPERIMENTAL_MIDI_OUT empty, #endif @@ -565,7 +565,7 @@ EffectDialog::EffectDialog(wxWindow * parent, void EffectDialog::Init() { ShuttleGui S(this, eIsCreating); - + S.SetBorder(5); S.StartVerticalLay(true); { diff --git a/src/effects/Effect.h b/src/effects/Effect.h index 3ac500e6a..e489f279e 100644 --- a/src/effects/Effect.h +++ b/src/effects/Effect.h @@ -15,7 +15,7 @@ #include #include -#include +#include #include class wxDialog; @@ -58,12 +58,12 @@ class TimeWarper; #define SKIP_EFFECT_MILLISECOND 99999 class AUDACITY_DLL_API Effect { - // + // // public methods // // Used by the outside program to determine properties of an effect and // apply the effect to one or more tracks. - // + // public: // Each subclass of Effect should override this method. // This name will go in the menu bar; @@ -81,7 +81,7 @@ class AUDACITY_DLL_API Effect { // Each subclass of Effect should override this method. // This should be human-readable, but should NOT be translated. Use wxT(""), not _(""). virtual wxString GetEffectIdentifier() = 0; - + // Each subclass of Effect should override this method. // This name will go in the progress dialog, but can be used // elsewhere, and it should describe what is being done. @@ -90,20 +90,20 @@ class AUDACITY_DLL_API Effect { // is "Boosting Bass Frequencies". virtual wxString GetEffectAction() = 0; - // Each subclass of Effect should override this method. - // This description will go in the History state. - // Override to include effect parameters, so typically useful only after PromptUser. - virtual wxString GetEffectDescription() { - // Default provides effect name. - return wxString::Format(_("Applied effect: %s"), - this->GetEffectName().c_str()); - } - + // Each subclass of Effect should override this method. + // This description will go in the History state. + // Override to include effect parameters, so typically useful only after PromptUser. + virtual wxString GetEffectDescription() { + // Default provides effect name. + return wxString::Format(_("Applied effect: %s"), + this->GetEffectName().c_str()); + } + // Return flags which tell you what kind of effect this is. // It will be either a built-in or a plug-in effect, and it // will be one of Insert, Process, or Analyze. virtual int GetEffectFlags() { - // Default of BUILTIN_EFFECT | PROCESS_EFFECT | ADVANCED_EFFECT (set in constructor) - + // Default of BUILTIN_EFFECT | PROCESS_EFFECT | ADVANCED_EFFECT (set in constructor) - // covers most built-in effects. return mFlags; } @@ -128,8 +128,8 @@ class AUDACITY_DLL_API Effect { // Only override it if you need to do preprocessing or cleanup. virtual void Preview(bool dryOnly = false); - // Most effects just use the previewLength, but time-stretching/compressing - // effects need to use a different input length, so override this method. + // Most effects just use the previewLength, but time-stretching/compressing + // effects need to use a different input length, so override this method. virtual double CalcPreviewInputLength(double previewLength); // Get an unique ID assigned to each registered effect. @@ -147,8 +147,8 @@ class AUDACITY_DLL_API Effect { wxString GetPreviewName(); //ANSWER-ME: Isn't this pointless? - // None of the built-in functions has an ampersand in the result of - // GetEffectName(), the only strings on which this method is used. + // None of the built-in functions has an ampersand in the result of + // GetEffectName(), the only strings on which this method is used. // In fact, the example 'E&qualizer' does not exist in the code! // Strip ampersand ('&' char) from string. This effectively removes the // shortcut from the string ('E&qualizer' becomes 'Equalizer'). This is @@ -167,7 +167,7 @@ class AUDACITY_DLL_API Effect { Effect(); virtual ~Effect(); - + // Called once each time an effect is called. Perform any initialization; // make sure that the effect can be performed on the selected tracks and // return false otherwise @@ -185,10 +185,10 @@ class AUDACITY_DLL_API Effect { // Check whether effect should be skipped // Typically this is only useful in automation, for example // detecting that zero noise reduction is to be done, - // or that normalisation is being done without Dc bias shift + // or that normalisation is being done without Dc bias shift // or amplitude modification virtual bool CheckWhetherSkipEffect() { return false; } - + // Actually do the effect here. virtual bool Process() = 0; @@ -225,14 +225,14 @@ class AUDACITY_DLL_API Effect { // The Progress methods all return true if the user has cancelled; // you should exit immediately if this happens (cleaning up memory // is okay, but don't try to undo). - + // Pass a fraction between 0.0 and 1.0 bool TotalProgress(double frac); - + // Pass a fraction between 0.0 and 1.0, for the current track // (when doing one track at a time) bool TrackProgress(int whichTrack, double frac, wxString = wxT("")); - + // Pass a fraction between 0.0 and 1.0, for the current track group // (when doing stereo groups at a time) bool TrackGroupProgress(int whichGroup, double frac); @@ -259,16 +259,16 @@ class AUDACITY_DLL_API Effect { // type of the tracks on mOutputTracks int mOutputTracksType; - + // // private methods // - // Use these two methods to copy the input tracks to mOutputTracks, if + // Use these two methods to copy the input tracks to mOutputTracks, if // doing the processing on them, and replacing the originals only on success (and not cancel). void CopyInputTracks(int trackType = Track::Wave); - // If bGoodResult, replace mWaveTracks tracks in mTracks with successfully processed - // mOutputTracks copies, get rid of old mWaveTracks, and set mWaveTracks to mOutputTracks. + // If bGoodResult, replace mWaveTracks tracks in mTracks with successfully processed + // mOutputTracks copies, get rid of old mWaveTracks, and set mWaveTracks to mOutputTracks. // Else clear and delete mOutputTracks copies. void ReplaceProcessedTracks(const bool bGoodResult); @@ -279,7 +279,7 @@ class AUDACITY_DLL_API Effect { // private: void CountWaveTracks(); - + // // private data // @@ -293,7 +293,7 @@ class AUDACITY_DLL_API Effect { int mNumGroups; int mID; - + friend class BatchCommands;// so can call PromptUser. friend class EffectManager;// so it can delete effects and access mID. diff --git a/src/effects/EffectCategory.cpp b/src/effects/EffectCategory.cpp index e61a9798b..0e2277f1b 100644 --- a/src/effects/EffectCategory.cpp +++ b/src/effects/EffectCategory.cpp @@ -21,19 +21,19 @@ EffectCategory::EffectCategory(const wxString& uri, const wxString& name) } - + const wxString& EffectCategory::GetUri() const { return mUri; } - + const wxString& EffectCategory::GetName() const { return mName; } - + const CategorySet& EffectCategory::GetParents() const { return mParents; } - + const CategorySet& EffectCategory::GetSubCategories() const { return mSubCategories; } @@ -48,7 +48,7 @@ EffectSet EffectCategory::GetEffects(int type) const { } return result; } - + // Return all the effects that belong to this immediate category or any // of its subcategories), filtered by effect type. EffectSet EffectCategory::GetAllEffects(int type) const { @@ -73,7 +73,7 @@ bool EffectCategory::AddParent(EffectCategory* parent) { parent->mSubCategories.insert(this); return true; } - + bool EffectCategory::AddEffect(Effect* effect) { mEffects.insert(effect); return true; diff --git a/src/effects/EffectCategory.h b/src/effects/EffectCategory.h index bf9df4aeb..95ce547ce 100644 --- a/src/effects/EffectCategory.h +++ b/src/effects/EffectCategory.h @@ -12,7 +12,7 @@ \class EffectCategory \brief EffectManager contains all the information about an effect category. -That includes links to parent categories and subcategories, name and +That includes links to parent categories and subcategories, name and URI, and of course the effects that belong to this category. *//*******************************************************************/ @@ -29,9 +29,9 @@ URI, and of course the effects that belong to this category. class EffectCategory { - + public: - + /** This is used in the EffectSet typedef. It compares effect pointers, first by their names and then by pointer values. This makes EffectSets automatically sorted by name while allowing for different effects with @@ -42,12 +42,12 @@ class EffectCategory { ((a->GetEffectName() == b->GetEffectName()) && (a < b)); } }; - + typedef std::set EffectSet; - + /** This is used in the CategorySet typedef. It compares category pointers, first by their names and then by pointer values. This makes CategorySets - automatically sorted by name while allowing for different categories + automatically sorted by name while allowing for different categories with the same name. */ struct CompareCategories { bool operator()(const EffectCategory* a, const EffectCategory* b) const { @@ -55,39 +55,39 @@ class EffectCategory { ((a->GetName() == b->GetName()) && (a < b)); } }; - + typedef std::set CategorySet; - + /** Return the URI for this category, which is used as a global, persistent string identifier for the category. */ const wxString& GetUri() const; - + /** Return the (possibly i18n'd) name for the category. */ const wxString& GetName() const; - + /** Return all the parent categories of this category. A category may have 0, 1 or more parents - the structure of all categories forms a DAG, not necessarily a tree, since LV2 allows for categories to have multiple parents (e.g. Reverb is a subcategory of both Simulator and Delay). */ const CategorySet& GetParents() const; - + /** Return all the subcategories of this category. A category may have 0, 1 or more subcategories. */ const CategorySet& GetSubCategories() const; - + /** Return all the effects that belong to this immediate category (not any of its subcategories), filtered by effect type. */ EffectSet GetEffects(int type = ALL_EFFECTS) const; - + /** Return all the effects that belong to this immediate category or any of its subcategories), filtered by effect type. */ EffectSet GetAllEffects(int type = ALL_EFFECTS) const; - + protected: - - /** All constructors and destructors are non-public, allowing only + + /** All constructors and destructors are non-public, allowing only EffectManager (which is our friend) to create new categories. */ EffectCategory(const wxString& uri, const wxString& name); @@ -97,37 +97,37 @@ class EffectCategory { has been called. This is protected so only our friend EffectManager can change the category graph (it needs to keep track of root nodes). */ bool AddParent(EffectCategory* parent); - + /** Add an effect to this category. This is protected so only our friend EffectManager can call it. */ bool AddEffect(Effect* effect); - - /** This function sets a flag that makes AddParent() fail when called for - this category object, preventing anyone from adding new parents to - this category. This is useful if you are mapping a different category - tree onto the already existing one (e.g. LRDF onto LV2) and don't - want to add more internal parent/subcategory relations between already - existing categories, but still want to allow adding of completely + + /** This function sets a flag that makes AddParent() fail when called for + this category object, preventing anyone from adding new parents to + this category. This is useful if you are mapping a different category + tree onto the already existing one (e.g. LRDF onto LV2) and don't + want to add more internal parent/subcategory relations between already + existing categories, but still want to allow adding of completely new, unmapped subcategories. */ void FreezeParents(); - + /** Reset the flag set by FreezeParents(), allowing to add parent categories again. */ void UnfreezeParents(); - - /** Returns true if category is an ancestor of this category, false + + /** Returns true if category is an ancestor of this category, false if not. */ bool IsDescendantOf(EffectCategory* category); - + friend class EffectManager; - + wxString mUri; wxString mName; CategorySet mParents; CategorySet mSubCategories; EffectSet mEffects; bool mParentsFrozen; - + }; diff --git a/src/effects/EffectManager.cpp b/src/effects/EffectManager.cpp index fdc6b000e..995afa329 100644 --- a/src/effects/EffectManager.cpp +++ b/src/effects/EffectManager.cpp @@ -67,7 +67,7 @@ void EffectManager::RegisterEffect(Effect *f, int NewFlags) } if (i==len) mEffects.Add(f); - + #ifdef EFFECT_CATEGORIES // Add the effect in the right categories std::set catUris = f->GetEffectCategories(); @@ -82,7 +82,7 @@ void EffectManager::RegisterEffect(Effect *f, int NewFlags) } if (!oneValid) mUnsorted->insert(f); - + #endif } @@ -90,12 +90,12 @@ void EffectManager::UnregisterEffects() { for(int i=0; iclear(); - + CategoryMap::iterator iter; for (iter = mCategories->begin(); iter != mCategories->end(); ++iter) iter->second->mEffects.clear(); @@ -112,7 +112,7 @@ Effect *EffectManager::GetEffect(int ID) for(int i=0; imID == ID) return mEffects[i]; - + return NULL; } @@ -120,7 +120,7 @@ Effect* EffectManager::GetEffectByIdentifier(const wxString strTarget, const int { if( strTarget == wxT("") ) // set GetEffectIdentifier to wxT("") to not show an effect in Batch mode return NULL; - for (unsigned int i = 0; i < mEffects.GetCount(); i++) + for (unsigned int i = 0; i < mEffects.GetCount(); i++) { int nFlags = mEffects[i]->GetEffectFlags(); if (((nFlags & kFlags) == nFlags) && strTarget.IsSameAs(mEffects[i]->GetEffectIdentifier())) @@ -146,9 +146,9 @@ EffectArray *EffectManager::GetEffects(int flags /* = ALL_EFFECTS */) #ifdef EFFECT_CATEGORIES -EffectCategory* EffectManager::AddCategory(const wxString& URI, +EffectCategory* EffectManager::AddCategory(const wxString& URI, const wxString& name) { - + CategoryMap::const_iterator iter = mCategories->find(URI); if (iter != mCategories->end()) return iter->second; @@ -198,7 +198,7 @@ EffectSet EffectManager::GetUnsortedEffects(int flags) const { if ((flags & g) == g) result.insert(*iter); } - + return result; } diff --git a/src/effects/EffectManager.h b/src/effects/EffectManager.h index 08276d843..7927bb04c 100644 --- a/src/effects/EffectManager.h +++ b/src/effects/EffectManager.h @@ -12,7 +12,7 @@ \class EffectManager \brief EffectManager is the class that handles effects and effect categories. -It maintains a graph of effect categories and subcategories, +It maintains a graph of effect categories and subcategories, registers and unregisters effects and can return filtered lists of effects. @@ -34,13 +34,13 @@ WX_DEFINE_USER_EXPORTED_ARRAY(Effect *, EffectArray, class AUDACITY_DLL_API); class AUDACITY_DLL_API EffectManager { - + public: - + /** Get the singleton instance of the EffectManager. Probably not safe for multi-thread use. */ static EffectManager& Get(); - + // // public methods // @@ -48,7 +48,7 @@ class AUDACITY_DLL_API EffectManager { // them by index number, usually when the user selects one from a menu. // public: - + EffectManager(); /** A destructor is needed so we can delete all categories. */ @@ -56,67 +56,67 @@ class AUDACITY_DLL_API EffectManager { /** Register an effect so it will appear in the menu. */ void RegisterEffect(Effect *f, int AdditionalFlags=0); - + /** Unregister all effects. */ void UnregisterEffects(); - + /** Return an effect by its numerical ID. */ Effect *GetEffect(int ID); - + Effect* GetEffectByIdentifier(const wxString strTarget, const int kFlags = ALL_EFFECTS); /** Return the number of registered effects. */ int GetNumEffects(); - + /** Returns a sorted array of effects, which may be filtered using the flags parameter. The caller should dispose of the array when done. */ EffectArray *GetEffects(int flags = ALL_EFFECTS); -#ifdef EFFECT_CATEGORIES +#ifdef EFFECT_CATEGORIES /** Add a new effect category with the given URI and name and return a pointer to it. If a category with this URI already exists, return that instead. */ - EffectCategory* AddCategory(const wxString& URI, + EffectCategory* AddCategory(const wxString& URI, const wxString& name); - + /** Return a pointer to the effect category with the given URI or 0 if no such category has been added. */ EffectCategory* LookupCategory(const wxString& URI); - + /** Make one category the parent of another category. Both categories must have been returned from AddCategory() or LookupCategory(). If the new parent-child relationship would create any loops in the graph of categories false will be returned and the graph will not be modified, otherwise the function will return true. */ bool AddCategoryParent(EffectCategory* child, EffectCategory* parent); - + /** Freeze the subcategory relations between all categories added so far. */ void FreezeCategories(); - + /** Return the set of all root categories, i.e. the ones without parents. */ const CategorySet& GetRootCategories() const; - + /** Return the set of all uncategorised effects. */ EffectSet GetUnsortedEffects(int flags = ALL_EFFECTS) const; #endif private: - + EffectArray mEffects; int mNumEffects; -#ifdef EFFECT_CATEGORIES +#ifdef EFFECT_CATEGORIES // This maps URIs to EffectCategory pointers for all added categories. // It is needed for fast lookup and easy deletion. typedef std::map CategoryMap; CategoryMap *mCategories; - + // These are the root categories, i.e. the ones without parents. CategorySet *mRootCategories; - + // Special category that all effects with unknown category URIs // are placed in. EffectSet *mUnsorted; diff --git a/src/effects/Equalization.cpp b/src/effects/Equalization.cpp index 3c189fe27..237bda361 100644 --- a/src/effects/Equalization.cpp +++ b/src/effects/Equalization.cpp @@ -261,7 +261,7 @@ EffectEqualization::EffectEqualization() EffectEqualization::~EffectEqualization() { - if(hFFT) + if(hFFT) EndFFT(hFFT); hFFT = NULL; if(mFFTBuffer) @@ -441,7 +441,7 @@ bool EffectEqualization::Process() count++; } - this->ReplaceProcessedTracks(bGoodResult); + this->ReplaceProcessedTracks(bGoodResult); return bGoodResult; } @@ -547,7 +547,7 @@ bool EffectEqualization::ProcessOne(int count, WaveTrack * t, // 'output' starts at zero double startT = t->LongSamplesToTime(start); - //output has one waveclip for the total length, even though + //output has one waveclip for the total length, even though //t might have whitespace seperating multiple clips //we want to maintain the original clip structure, so //only paste the intersections of the new clip. @@ -570,7 +570,7 @@ bool EffectEqualization::ProcessOne(int count, WaveTrack * t, continue; // clip is not within selection //save the actual clip start/end so that we can rejoin them after we paste. - clipRealStartEndTimes.push_back(std::pair(clipStartT,clipEndT)); + clipRealStartEndTimes.push_back(std::pair(clipStartT,clipEndT)); if( clipStartT < startT ) // does selection cover the whole clip? clipStartT = startT; // don't copy all the new clip @@ -586,7 +586,7 @@ bool EffectEqualization::ProcessOne(int count, WaveTrack * t, Track *toClipOutput; //remove the old audio and get the new t->Clear(clipStartEndTimes[i].first,clipStartEndTimes[i].second); - output->Copy(clipStartEndTimes[i].first-startT+offsetT0,clipStartEndTimes[i].second-startT+offsetT0, &toClipOutput); + output->Copy(clipStartEndTimes[i].first-startT+offsetT0,clipStartEndTimes[i].second-startT+offsetT0, &toClipOutput); if(toClipOutput) { //put the processed audio in @@ -594,9 +594,9 @@ bool EffectEqualization::ProcessOne(int count, WaveTrack * t, wxASSERT(bResult); // TO DO: Actually handle this. //if the clip was only partially selected, the Paste will have created a split line. Join is needed to take care of this //This is not true when the selection is fully contained within one clip (second half of conditional) - if( (clipRealStartEndTimes[i].first != clipStartEndTimes[i].first || + if( (clipRealStartEndTimes[i].first != clipStartEndTimes[i].first || clipRealStartEndTimes[i].second != clipStartEndTimes[i].second) && - !(clipRealStartEndTimes[i].first <= startT && + !(clipRealStartEndTimes[i].first <= startT && clipRealStartEndTimes[i].second >= startT+lenT) ) t->Join(clipRealStartEndTimes[i].first,clipRealStartEndTimes[i].second); delete toClipOutput; @@ -1393,7 +1393,7 @@ void EqualizationDialog::MakeEqualizationDialog() // Processing routine selection // ------------------------------------------------------------------- if(m_pEffect->mEffectEqualization48x) { - szrM = new wxBoxSizer( wxHORIZONTAL ); + szrM = new wxBoxSizer( wxHORIZONTAL ); txt = new wxStaticText( this, wxID_ANY, _("&Processing: ") ); szrM->Add( txt, 0, wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL | wxLEFT, 4 ); @@ -1440,12 +1440,12 @@ void EqualizationDialog::MakeEqualizationDialog() int mathPath=EffectEqualization48x::GetMathPath(); if(mathPath&MATH_FUNCTION_SSE) { mMathProcessingType[1]->SetValue(true); - if(mathPath&MATH_FUNCTION_THREADED) + if(mathPath&MATH_FUNCTION_THREADED) mMathProcessingType[2]->SetValue(true); } if(false) { //mathPath&MATH_FUNCTION_AVX) { not implemented mMathProcessingType[3]->SetValue(true); - if(mathPath&MATH_FUNCTION_THREADED) + if(mathPath&MATH_FUNCTION_THREADED) mMathProcessingType[4]->SetValue(true); } btn = new wxButton( this, ID_BENCH, _("&Bench")); @@ -2198,9 +2198,9 @@ void EqualizationDialog::LayoutEQSliders() void EqualizationDialog::GraphicEQ(Envelope *env) { - // JKC: 'value' is for height of curve. - // The 0.0 initial value would only get used if NUM_PTS were 0. - double value = 0.0; + // JKC: 'value' is for height of curve. + // The 0.0 initial value would only get used if NUM_PTS were 0. + double value = 0.0; double dist, span, s; env->Flatten(0.); @@ -3198,7 +3198,7 @@ void EditCurvesDialog::OnRename(wxCommandEvent & WXUNUSED(event)) } // if bad, we cancelled the rename dialog, so nothing to do. - if( bad == true ) + if( bad == true ) ; else if(overwrite){ // Overwrite another curve. @@ -3208,7 +3208,7 @@ void EditCurvesDialog::OnRename(wxCommandEvent & WXUNUSED(event)) mEditCurves[ curve ].points = mEditCurves[ item ].points; // if renaming the unnamed item, then select it, // otherwise get rid of the item we've renamed. - if( item == (numCurves-1) ) + if( item == (numCurves-1) ) mList->SetItem(curve, 0, name); else { @@ -3398,7 +3398,7 @@ void EditCurvesDialog::OnDefaults( wxCommandEvent & WXUNUSED(event)) #ifdef EXPERIMENTAL_EQ_SSE_THREADED -void EqualizationDialog::OnProcessingRadio(wxCommandEvent & event) +void EqualizationDialog::OnProcessingRadio(wxCommandEvent & event) { int testEvent=event.GetId(); switch(testEvent) diff --git a/src/effects/Equalization.h b/src/effects/Equalization.h index 8d8e7e4d8..3fc5c35fc 100644 --- a/src/effects/Equalization.h +++ b/src/effects/Equalization.h @@ -292,11 +292,11 @@ private: drawRadioID, sliderRadioID, #ifdef EXPERIMENTAL_EQ_SSE_THREADED - defaultMathRadioID, - sSERadioID, - sSEThreadedRadioID, - aVXRadioID, - aVXThreadedRadioID, + defaultMathRadioID, + sSERadioID, + sSEThreadedRadioID, + aVXRadioID, + aVXThreadedRadioID, ID_BENCH, #endif ID_INTERP, diff --git a/src/effects/Equalization48x.cpp b/src/effects/Equalization48x.cpp index 40c6ee3fc..ecd1a5196 100644 --- a/src/effects/Equalization48x.cpp +++ b/src/effects/Equalization48x.cpp @@ -81,8 +81,8 @@ int EffectEqualization48x::GetMathPath() { return sMathPath; }; void EffectEqualization48x::AddMathPathOption(int mathPath) { sMathPath|=mathPath; }; void EffectEqualization48x::RemoveMathPathOption(int mathPath) { sMathPath&=~mathPath; }; -MathCaps *EffectEqualization48x::GetMathCaps() -{ +MathCaps *EffectEqualization48x::GetMathCaps() +{ if(!sMathCapsInitialized) { sMathCapsInitialized=true; @@ -133,7 +133,7 @@ MathCaps *EffectEqualization48x::GetMathCaps() if(sMathCaps.SSE) sMathPath=MATH_FUNCTION_SSE|MATH_FUNCTION_THREADED; // we are starting on. } - return &sMathCaps; + return &sMathCaps; }; void * malloc_simd(const size_t size) @@ -153,7 +153,7 @@ void free_simd(void* mem) { #if defined WIN32 // WIN32 _aligned_free(mem); -#else +#else free(mem); #endif } @@ -173,7 +173,7 @@ EffectEqualization48x::~EffectEqualization48x() bool EffectEqualization48x::AllocateBuffersWorkers(bool threaded) { if(mBigBuffer) - FreeBuffersWorkers(); + FreeBuffersWorkers(); mFilterSize=(mEffectEqualization->mM-1)&(~15); // 4000 !!! Filter MUST BE QUAD WORD ALIGNED !!!! mWindowSize=mEffectEqualization->windowSize; mBlockSize=mWindowSize-mFilterSize; // 12,384 @@ -187,8 +187,8 @@ bool EffectEqualization48x::AllocateBuffersWorkers(bool threaded) // this will remove the disparity in data at the intersections of the runs // The nice magic allocation - // megabyte - 3 windows - 4 overlaping buffers - filter - // 2^20 = 1,048,576 - 3 * 2^14 (16,384) - ((4 * 20) - 3) * 12,384 - 4000 + // megabyte - 3 windows - 4 overlaping buffers - filter + // 2^20 = 1,048,576 - 3 * 2^14 (16,384) - ((4 * 20) - 3) * 12,384 - 4000 // 1,048,576 - 49,152 - 953,568 - 4000 = 41,856 (leftover) mScratchBufferSize=mWindowSize*3*(sizeof(__m128)/sizeof(float)); // 3 window size blocks size of __m128 but we allocate in float @@ -239,7 +239,7 @@ bool EffectEqualization48x::FreeBuffersWorkers() delete[] mEQWorkers; // kill the workers ( go directly to jail) mEQWorkers= NULL; mThreadCount=0; - mWorkerDataCount=0; + mWorkerDataCount=0; } delete [] mBufferInfo; mBufferInfo = NULL; @@ -303,7 +303,7 @@ bool EffectEqualization48x::Process(EffectEqualization* effectEqualization) } FreeBuffersWorkers(); - mEffectEqualization->ReplaceProcessedTracks(bGoodResult); + mEffectEqualization->ReplaceProcessedTracks(bGoodResult); return bGoodResult; } @@ -403,7 +403,7 @@ bool EffectEqualization48x::TrackCompare() } delete SecondOutputTracks; FreeBuffersWorkers(); - mEffectEqualization->ReplaceProcessedTracks(bGoodResult); + mEffectEqualization->ReplaceProcessedTracks(bGoodResult); return bGoodResult; } @@ -515,7 +515,7 @@ bool EffectEqualization48x::Benchmark(EffectEqualization* effectEqualization) FreeBuffersWorkers(); mBenching=false; bGoodResult=false; - mEffectEqualization->ReplaceProcessedTracks(bGoodResult); + mEffectEqualization->ReplaceProcessedTracks(bGoodResult); wxTimeSpan tsSSEThreaded(0, 0, 0, times[0]); wxTimeSpan tsSSE(0, 0, 0, times[1]); @@ -525,8 +525,8 @@ bool EffectEqualization48x::Benchmark(EffectEqualization* effectEqualization) wxTimeSpan tsSSE(0, 0, 0, times[1]); wxTimeSpan tsDefault(0, 0, 0, times[2]); wxString outputString; - outputString.Format(_("Benchmark times:\nDefault: %s\nSSE: %s\nSSE Threaded: %s\n"),tsDefault.Format(wxT("%M:%S.%l")),tsSSE.Format(wxT("%M:%S.%l")),tsSSEThreaded.Format(wxT("%M:%S.%l"))); - wxMessageBox(outputString); */ + outputString.Format(_("Benchmark times:\nDefault: %s\nSSE: %s\nSSE Threaded: %s\n"),tsDefault.Format(wxT("%M:%S.%l")),tsSSE.Format(wxT("%M:%S.%l")),tsSSEThreaded.Format(wxT("%M:%S.%l"))); + wxMessageBox(outputString); */ return bGoodResult; @@ -543,9 +543,9 @@ bool EffectEqualization48x::ProcessBuffer(fft_type *sourceBuffer, fft_type *dest float *workBuffer=&sourceBuffer[bufferLength]; // all scratch buffers are at the end - for(int runx=0;runxFilter(mWindowSize, currentBuffer); float *writeEnd=currentBuffer+mBlockSize; - if(runx==blockCount) + if(runx==blockCount) writeEnd=currentBuffer+(lastBlockSize+mFilterSize); if(runx) { - float *lastOverrun=&workBuffer[mWindowSize*((runx+1)&1)+mBlockSize]; + float *lastOverrun=&workBuffer[mWindowSize*((runx+1)&1)+mBlockSize]; for(int j=0;j>1; // this will skip the first filterSize on the first run while(currentBuffermBufferLength%mBlockSize) return false; @@ -587,21 +587,21 @@ bool EffectEqualization48x::ProcessBuffer4x(BufferInfo *bufferInfo) __m128 *swizzledBuffer128=(__m128 *)bufferInfo->mScratchBuffer; __m128 *scratchBuffer=&swizzledBuffer128[mWindowSize*2]; - for(int run4x=0;run4x>2; - // swizzle it back. + // swizzle it back. for(int i=writeToStart,j=writeStart;j>2; // these are 128b pointers, each window is 1/4 blockSize for those - writeBlocks[i]+=mBlockSize>>2; + writeBlocks[i]+=mBlockSize>>2; } } return true; @@ -721,7 +721,7 @@ void *EQWorker::Entry() mEffectEqualization48x->ProcessBuffer4x(&mBufferInfoList[i]); mBufferInfoList[i].mBufferStatus=BufferDone; // we're done break; - } + } if(!bufferAquired) mMutex->Unlock(); } @@ -792,7 +792,7 @@ bool EffectEqualization48x::ProcessOne4xThreaded(int count, WaveTrack * t, bigBlocksRead++; } else mBufferInfo[currentIndex].mBufferStatus=BufferEmpty; // this is completely unecessary currentIndex=(currentIndex+1)%mWorkerDataCount; - } + } mDataMutex.Unlock(); // Get back in line for data } if(singleProcessLength) { @@ -815,7 +815,7 @@ bool EffectEqualization48x::ProcessTail(WaveTrack * t, WaveTrack * output, sampl // 'output' starts at zero double startT = t->LongSamplesToTime(start); - //output has one waveclip for the total length, even though + //output has one waveclip for the total length, even though //t might have whitespace seperating multiple clips //we want to maintain the original clip structure, so //only paste the intersections of the new clip. @@ -838,7 +838,7 @@ bool EffectEqualization48x::ProcessTail(WaveTrack * t, WaveTrack * output, sampl continue; // clip is not within selection //save the actual clip start/end so that we can rejoin them after we paste. - clipRealStartEndTimes.push_back(std::pair(clipStartT,clipEndT)); + clipRealStartEndTimes.push_back(std::pair(clipStartT,clipEndT)); if( clipStartT < startT ) // does selection cover the whole clip? clipStartT = startT; // don't copy all the new clip @@ -854,8 +854,8 @@ bool EffectEqualization48x::ProcessTail(WaveTrack * t, WaveTrack * output, sampl Track *toClipOutput; //remove the old audio and get the new t->Clear(clipStartEndTimes[i].first,clipStartEndTimes[i].second); - // output->Copy(clipStartEndTimes[i].first-startT+offsetT0,clipStartEndTimes[i].second-startT+offsetT0, &toClipOutput); - output->Copy(clipStartEndTimes[i].first-startT,clipStartEndTimes[i].second-startT, &toClipOutput); + // output->Copy(clipStartEndTimes[i].first-startT+offsetT0,clipStartEndTimes[i].second-startT+offsetT0, &toClipOutput); + output->Copy(clipStartEndTimes[i].first-startT,clipStartEndTimes[i].second-startT, &toClipOutput); if(toClipOutput) { //put the processed audio in @@ -863,9 +863,9 @@ bool EffectEqualization48x::ProcessTail(WaveTrack * t, WaveTrack * output, sampl wxASSERT(bResult); // TO DO: Actually handle this. //if the clip was only partially selected, the Paste will have created a split line. Join is needed to take care of this //This is not true when the selection is fully contained within one clip (second half of conditional) - if( (clipRealStartEndTimes[i].first != clipStartEndTimes[i].first || + if( (clipRealStartEndTimes[i].first != clipStartEndTimes[i].first || clipRealStartEndTimes[i].second != clipStartEndTimes[i].second) && - !(clipRealStartEndTimes[i].first <= startT && + !(clipRealStartEndTimes[i].first <= startT && clipRealStartEndTimes[i].second >= startT+lenT) ) t->Join(clipRealStartEndTimes[i].first,clipRealStartEndTimes[i].second); delete toClipOutput; @@ -892,7 +892,7 @@ void EffectEqualization48x::Filter4x(sampleCount len, __m128 filterFuncR, filterFuncI; filterFuncR=_mm_set1_ps(mEffectEqualization->mFilterFuncR[0]); - localFFTBuffer[0]=_mm_mul_ps(localBuffer[0], filterFuncR); + localFFTBuffer[0]=_mm_mul_ps(localBuffer[0], filterFuncR); int halfLength=(len/2); bool useBitReverseTable=sMathPath&1; diff --git a/src/effects/Equalization48x.h b/src/effects/Equalization48x.h index 518d39c2d..1c17d0f6e 100644 --- a/src/effects/Equalization48x.h +++ b/src/effects/Equalization48x.h @@ -14,7 +14,7 @@ Intrinsics (SSE/AVX) and Threaded Equalization #define __AUDACITY_EFFECT_EQUALIZATION48X__ // bitwise function selection -// options are +// options are #define MATH_FUNCTION_ORIGINAL 0 // 0 original path #define MATH_FUNCTION_BITREVERSE_TABLE 1 // 1 SSE BitReverse Table #define MATH_FUNCTION_SIN_COS_TABLE 2 // 2 SSE SinCos Table @@ -71,7 +71,7 @@ static int EQWorkerCounter=0; class EQWorker : public wxThread { public: - EQWorker():wxThread(wxTHREAD_JOINABLE) { + EQWorker():wxThread(wxTHREAD_JOINABLE) { mBufferInfoList=NULL; mBufferInfoCount=0; mMutex=NULL; diff --git a/src/effects/Fade.h b/src/effects/Fade.h index 11c21b743..f6797aff3 100644 --- a/src/effects/Fade.h +++ b/src/effects/Fade.h @@ -23,7 +23,7 @@ class EffectFadeIn: public EffectSimpleMono { virtual wxString GetEffectName() { return wxString(_("Fade In")); } - + virtual std::set GetEffectCategories() { std::set result; result.insert(wxT("http://lv2plug.in/ns/lv2core#UtilityPlugin")); @@ -43,7 +43,7 @@ class EffectFadeIn: public EffectSimpleMono { sampleCount mLen; virtual bool NewTrackSimpleMono(); - + virtual bool ProcessSimpleMono(float *buffer, sampleCount len); }; @@ -53,7 +53,7 @@ class EffectFadeOut:public EffectSimpleMono { virtual wxString GetEffectName() { return wxString(_("Fade Out")); } - + virtual std::set GetEffectCategories() { std::set result; result.insert(wxT("http://lv2plug.in/ns/lv2core#UtilityPlugin")); diff --git a/src/effects/FindClipping.cpp b/src/effects/FindClipping.cpp index c81ac6abe..8bad09c37 100644 --- a/src/effects/FindClipping.cpp +++ b/src/effects/FindClipping.cpp @@ -48,7 +48,7 @@ EffectFindClipping::EffectFindClipping() wxString EffectFindClipping::GetEffectDescription() { return wxString::Format(_("Detect clipping")); -} +} bool EffectFindClipping::PromptUser() { @@ -63,7 +63,7 @@ bool EffectFindClipping::PromptUser() } bool EffectFindClipping::TransferParameters(Shuttle & shuttle) -{ +{ shuttle.TransferInt(wxT("Start"), mStart, 3); shuttle.TransferInt(wxT("Stop"), mStop, 3); @@ -86,7 +86,7 @@ bool EffectFindClipping::Process() break; } } - + if (!l) { l = mFactory->NewLabelTrack(); l->SetName(_("Clipping")); @@ -135,7 +135,7 @@ bool EffectFindClipping::ProcessOne(LabelTrack * l, bool bGoodResult = true; sampleCount s = 0; sampleCount blockSize = (sampleCount) (mStart * 1000); - + if (len < mStart) { return true; } @@ -149,7 +149,7 @@ bool EffectFindClipping::ProcessOne(LabelTrack * l, sampleCount samps = 0; sampleCount block = 0; double startTime = -1.0; - + while (s < len) { if (block == 0) { if (TrackProgress(count, s / (double) len)) { diff --git a/src/effects/FindClipping.h b/src/effects/FindClipping.h index d8e6f974d..19855a731 100644 --- a/src/effects/FindClipping.h +++ b/src/effects/FindClipping.h @@ -54,17 +54,17 @@ class EffectFindClipping:public Effect return wxString(_("Detecting clipping")); } - virtual wxString GetEffectDescription(); + virtual wxString GetEffectDescription(); virtual bool PromptUser(); virtual bool TransferParameters( Shuttle & shuttle ); - + virtual bool Process(); private: bool ProcessOne(LabelTrack *l, int count, WaveTrack * t, sampleCount start, sampleCount len); - + int mStart; ///< Using int rather than sampleCount because values are only ever small numbers int mStop; ///< Using int rather than sampleCount because values are only ever small numbers }; diff --git a/src/effects/Generator.cpp b/src/effects/Generator.cpp index 305f1368b..dce8d50bc 100644 --- a/src/effects/Generator.cpp +++ b/src/effects/Generator.cpp @@ -5,8 +5,8 @@ Generator.h Two Abstract classes, Generator, and BlockGenerator, that effects which - generate audio should derive from. - + generate audio should derive from. + Block Generator breaks the synthesis task up into smaller parts. Dominic Mazzoni @@ -25,7 +25,7 @@ bool Generator::Process() return false; - // Set up mOutputTracks. + // Set up mOutputTracks. // This effect needs Track::All for sync-lock grouping. this->CopyInputTracks(Track::All); @@ -39,7 +39,7 @@ bool Generator::Process() { if (t->GetKind() == Track::Wave && t->GetSelected()) { WaveTrack* track = (WaveTrack*)t; - + bool editClipCanMove; gPrefs->Read(wxT("/GUI/EditClipCanMove"), &editClipCanMove, true); diff --git a/src/effects/Generator.h b/src/effects/Generator.h index 02c96d7b2..ff01c77f1 100644 --- a/src/effects/Generator.h +++ b/src/effects/Generator.h @@ -5,8 +5,8 @@ Generator.h Two Abstract classes, Generator, and BlockGenerator, that effects which - generate audio should derive from. - + generate audio should derive from. + Block Generator breaks the synthesis task up into smaller parts. Dominic Mazzoni diff --git a/src/effects/Invert.h b/src/effects/Invert.h index 0c1897a89..cba1efa1b 100644 --- a/src/effects/Invert.h +++ b/src/effects/Invert.h @@ -5,7 +5,7 @@ Invert.h Mark Phillips - + This class inverts the selected audio. **********************************************************************/ @@ -26,7 +26,7 @@ class EffectInvert:public EffectSimpleMono { virtual wxString GetEffectName() { return wxString(_("Invert")); } - + virtual std::set GetEffectCategories() { std::set result; result.insert(wxT("http://lv2plug.in/ns/lv2core#UtilityPlugin")); @@ -40,7 +40,7 @@ class EffectInvert:public EffectSimpleMono { virtual wxString GetEffectAction() { return wxString(_("Inverting")); } - + protected: virtual bool ProcessSimpleMono(float *buffer, sampleCount len); }; diff --git a/src/effects/Leveller.cpp b/src/effects/Leveller.cpp index ec1af7e96..e942cec1b 100644 --- a/src/effects/Leveller.cpp +++ b/src/effects/Leveller.cpp @@ -62,7 +62,7 @@ bool EffectLeveller::Init() mLevellerDbSilenceThreshold = Enums::Db2Signal[mLevellerDbChoiceIndex]; CalcLevellerFactors(); - + return true; } @@ -107,7 +107,7 @@ void EffectLeveller::CalcLevellerFactors() prevAdjLimit = gAdjLimit[prev]; addOnValue = prevAdjLimit - (adjFactor * prevLimit); upperAdjLimit = (adjFactor * limit) + addOnValue; - + gAddOnValue[f] = addOnValue; gAdjLimit[f] = (adjFactor * limit) + addOnValue; } @@ -141,7 +141,7 @@ bool EffectLeveller::PromptUser() } bool EffectLeveller::TransferParameters( Shuttle & shuttle ) -{ +{ shuttle.TransferEnum(wxT("dB"),mLevellerDbChoiceIndex,Enums::NumDbChoices,Enums::GetDbChoices()); shuttle.TransferInt(wxT("Passes"),mLevellerNumPasses,1); return true; @@ -195,7 +195,7 @@ LevellerDialog::LevellerDialog(EffectLeveller *effect, wxWindow *parent) : EffectDialog(parent, _("Leveler"), PROCESS_EFFECT), // Lynn called it "Leveller", but preferred spelling is "Leveler". mEffect(effect) { - mLevellerNumPassesChoiceIndex = 0;// + mLevellerNumPassesChoiceIndex = 0;// mLevellerDbChoiceIndex = 0; Init(); } @@ -240,7 +240,7 @@ void LevellerDialog::OnPreview(wxCommandEvent & WXUNUSED(event)) mEffect->mLevellerNumPasses = mLevellerNumPassesChoiceIndex+1; mEffect->Preview(); - + mEffect->mLevellerDbChoiceIndex = oldLevellerDbChoiceIndex; mEffect->mLevellerNumPasses = oldLevellerNumPasses; } diff --git a/src/effects/LoadEffects.cpp b/src/effects/LoadEffects.cpp index 6ce301484..3e2871f2e 100644 --- a/src/effects/LoadEffects.cpp +++ b/src/effects/LoadEffects.cpp @@ -40,7 +40,7 @@ #include "Silence.h" #include "ScienFilter.h" #include "StereoToMono.h" -#ifdef USE_SBSMS +#ifdef USE_SBSMS #include "TimeScale.h" #endif #include "ToneGen.h" @@ -85,12 +85,12 @@ void LoadEffects() EffectManager& em = EffectManager::Get(); #ifdef EFFECT_CATEGORIES - + // Create effect category graph. These categories and relationships - // are taken from revision 2 of lv2.ttl, loaders for other plugin systems - // (such as LADSPA/LRDF) should map their categories to these ones when - // applicable. Individual LADSPA/LRDF and LV2 plugins can add new - // categories and make them subcategories of the existing ones, but not + // are taken from revision 2 of lv2.ttl, loaders for other plugin systems + // (such as LADSPA/LRDF) should map their categories to these ones when + // applicable. Individual LADSPA/LRDF and LV2 plugins can add new + // categories and make them subcategories of the existing ones, but not // add subcategory relationships between these categories. // // We need some persistent, global identifiers for categories - LRDF @@ -99,9 +99,9 @@ void LoadEffects() // must be mapped to URIs by their loaders. #define LV2PREFIX "http://lv2plug.in/ns/lv2core#" - + typedef EffectCategory* CatPtr; - + CatPtr gen = em.AddCategory(wxT(LV2PREFIX) wxT("GeneratorPlugin"), _("Generator")); CatPtr inst = em.AddCategory(wxT(LV2PREFIX) wxT("InstrumentPlugin"), @@ -169,7 +169,7 @@ void LoadEffects() _("Limiter")); CatPtr gate = em.AddCategory(wxT(LV2PREFIX) wxT("GatePlugin"), _("Gate")); - + em.AddCategoryParent(inst, gen); em.AddCategoryParent(osc, gen); em.AddCategoryParent(conv, util); @@ -194,12 +194,12 @@ void LoadEffects() em.AddCategoryParent(exp, dyn); em.AddCategoryParent(lim, dyn); em.AddCategoryParent(gate, dyn); - + // We also add a couple of categories for internal use. These are not // in lv2.ttl. #define ATEAM "http://audacityteam.org/namespace#" - + CatPtr nrm = em.AddCategory(wxT(ATEAM) wxT("NoiseRemoval"), _("Noise Removal")); CatPtr pnt = em.AddCategory(wxT(ATEAM) wxT("PitchAndTempo"), @@ -214,14 +214,14 @@ void LoadEffects() em.AddCategoryParent(tim, util); em.AddCategoryParent(aTim, anal); em.AddCategoryParent(onst, aTim); - + // We freeze the internal subcategory relations between the categories // added so far so LADSPA/LRDF or other category systems don't ruin // our hierarchy. em.FreezeCategories(); - + #endif - + // Generate menu em.RegisterEffect(new EffectNoise()); em.RegisterEffect(new EffectSilence()); @@ -231,7 +231,7 @@ void LoadEffects() em.RegisterEffect(&((new EffectToneGen())->EnableForChirps())); // Effect menu - + em.RegisterEffect(new EffectAmplify()); //Commented out now that the Compressor effect works better @@ -240,7 +240,7 @@ void LoadEffects() const int SIMPLE_EFFECT = BUILTIN_EFFECT | PROCESS_EFFECT; // In this list, designating an effect as 'SIMPLE_EFFECT' just means // that it should be included in even the most basic of menus. - + em.RegisterEffect(new EffectAutoDuck()); em.RegisterEffect(new EffectBassTreble()); em.RegisterEffect(new EffectChangeSpeed()); @@ -269,7 +269,7 @@ void LoadEffects() #endif em.RegisterEffect(new EffectStereoToMono(), HIDDEN_EFFECT);// NOT in normal effects list. em.RegisterEffect(new EffectTruncSilence(), SIMPLE_EFFECT); -#ifdef USE_SBSMS +#ifdef USE_SBSMS em.RegisterEffect(new EffectTimeScale()); #endif em.RegisterEffect(new EffectWahwah()); @@ -312,7 +312,7 @@ void LoadEffects() LoadVampPlugins(); } #endif - + } void UnloadEffects() diff --git a/src/effects/Noise.cpp b/src/effects/Noise.cpp index 4a353b932..aa4d0751a 100644 --- a/src/effects/Noise.cpp +++ b/src/effects/Noise.cpp @@ -51,8 +51,8 @@ bool EffectNoise::PromptUser() // dialog will be passed values from effect // Effect retrieves values from saved config // Dialog will take care of using them to initialize controls - // If there is a selection, use that duration, otherwise use - // value from saved config: this is useful is user wants to + // If there is a selection, use that duration, otherwise use + // value from saved config: this is useful is user wants to // replace selection with noise // if (mT1 > mT0) { @@ -121,9 +121,9 @@ bool EffectNoise::MakeNoise(float *buffer, sampleCount len, float fs, float ampl buf3=0.86650f * buf3 + 0.3104856f * white; buf4=0.55000f * buf4 + 0.5329522f * white; buf5=-0.7616f * buf5 - 0.0168980f * white; - buffer[i] = amplitude * + buffer[i] = amplitude * (buf0 + buf1 + buf2 + buf3 + buf4 + buf5 + buf6 + white * 0.5362); - buf6 = white * 0.115926; + buf6 = white * 0.115926; } break; @@ -176,7 +176,7 @@ BEGIN_EVENT_TABLE(NoiseDialog, EffectDialog) END_EVENT_TABLE() NoiseDialog::NoiseDialog(EffectNoise * effect, wxWindow * parent, const wxString & title) -: EffectDialog(parent, title, INSERT_EFFECT), +: EffectDialog(parent, title, INSERT_EFFECT), mEffect(effect) { mNoiseDurationT = NULL; diff --git a/src/effects/NoiseRemoval.cpp b/src/effects/NoiseRemoval.cpp index de0bbc625..f9e56bae9 100644 --- a/src/effects/NoiseRemoval.cpp +++ b/src/effects/NoiseRemoval.cpp @@ -139,7 +139,7 @@ bool EffectNoiseRemoval::PromptUser() // We may want to twiddle the levels if we are setting // from an automation dialog, the only case in which we can // get here without any wavetracks. - bool bAllowTwiddleSettings = (GetNumWaveTracks() == 0); + bool bAllowTwiddleSettings = (GetNumWaveTracks() == 0); if (mHasProfile || bAllowTwiddleSettings) { dlog.m_pButton_Preview->Enable(GetNumWaveTracks() != 0); @@ -153,7 +153,7 @@ bool EffectNoiseRemoval::PromptUser() dlog.mKeepNoise->SetValue(dlog.mbLeaveNoise); dlog.CentreOnParent(); dlog.ShowModal(); - + if (dlog.GetReturnCode() == 0) { return false; } @@ -173,9 +173,9 @@ bool EffectNoiseRemoval::PromptUser() mDoProfile = (dlog.GetReturnCode() == 1); return gPrefs->Flush(); } - + bool EffectNoiseRemoval::TransferParameters( Shuttle & WXUNUSED(shuttle) ) -{ +{ //shuttle.TransferDouble(wxT("Gain"), mNoiseGain, 0.0); //shuttle.TransferDouble(wxT("Freq"), mFreqSmoothingHz, 0.0); //shuttle.TransferDouble(wxT("Time"), mAttackDecayTime, 0.0); @@ -222,7 +222,7 @@ bool EffectNoiseRemoval::Process() if (bGoodResult) Cleanup(); - this->ReplaceProcessedTracks(bGoodResult); + this->ReplaceProcessedTracks(bGoodResult); return bGoodResult; } @@ -630,7 +630,7 @@ enum { ID_TIME_TEXT, }; -#define SENSITIVITY_MIN 0 // Corresponds to -20 dB +#define SENSITIVITY_MIN 0 // Corresponds to -20 dB #define SENSITIVITY_MAX 4000 // Corresponds to 20 dB #define GAIN_MIN 0 @@ -660,12 +660,12 @@ BEGIN_EVENT_TABLE(NoiseRemovalDialog,wxDialog) EVT_TEXT(ID_TIME_TEXT, NoiseRemovalDialog::OnTimeText) END_EVENT_TABLE() -NoiseRemovalDialog::NoiseRemovalDialog(EffectNoiseRemoval * effect, +NoiseRemovalDialog::NoiseRemovalDialog(EffectNoiseRemoval * effect, wxWindow *parent) : EffectDialog( parent, _("Noise Removal"), PROCESS_EFFECT) { m_pEffect = effect; - + // NULL out the control members until the controls are created. m_pButton_GetProfile = NULL; m_pButton_Preview = NULL; @@ -707,9 +707,9 @@ void NoiseRemovalDialog::OnPreview(wxCommandEvent & WXUNUSED(event)) m_pEffect->mNoiseGain = -mGain; m_pEffect->mFreqSmoothingHz = mFreq; m_pEffect->mAttackDecayTime = mTime; - + m_pEffect->Preview(); - + m_pEffect->mSensitivity = oldSensitivity; m_pEffect->mNoiseGain = oldGain; m_pEffect->mFreqSmoothingHz = oldFreq; diff --git a/src/effects/NoiseRemoval.h b/src/effects/NoiseRemoval.h index a69bafe6d..4a363026b 100644 --- a/src/effects/NoiseRemoval.h +++ b/src/effects/NoiseRemoval.h @@ -27,16 +27,16 @@ class WaveTrack; #include "../RealFFTf.h" class EffectNoiseRemoval: public Effect { - + public: - + EffectNoiseRemoval(); virtual ~EffectNoiseRemoval(); virtual wxString GetEffectName() { return wxString(_("Noise Removal...")); } - + virtual std::set GetEffectCategories() { std::set result; result.insert(wxT("http://audacityteam.org/namespace#NoiseRemoval")); @@ -53,14 +53,14 @@ public: else return wxString(_("Removing Noise")); } - + virtual bool PromptUser(); virtual bool TransferParameters( Shuttle & shuttle ); - + virtual bool Init(); virtual bool CheckWhetherSkipEffect(); virtual bool Process(); - + private: bool mDoProfile; @@ -148,7 +148,7 @@ public: void PopulateOrExchange(ShuttleGui & S); bool TransferDataToWindow(); bool TransferDataFromWindow(); - + private: // handlers void OnGetProfile( wxCommandEvent &event ); @@ -156,7 +156,7 @@ private: void OnPreview(wxCommandEvent &event); void OnRemoveNoise( wxCommandEvent &event ); void OnCancel( wxCommandEvent &event ); - + void OnSensitivityText(wxCommandEvent & event); void OnGainText(wxCommandEvent & event); void OnFreqText(wxCommandEvent & event); diff --git a/src/effects/Normalize.cpp b/src/effects/Normalize.cpp index 5606ff111..bcac23374 100644 --- a/src/effects/Normalize.cpp +++ b/src/effects/Normalize.cpp @@ -66,23 +66,23 @@ bool EffectNormalize::Init() } wxString EffectNormalize::GetEffectDescription() // useful only after parameter values have been set -{ - // Note: This is useful only after ratio has been set. +{ + // Note: This is useful only after ratio has been set. wxString strResult = /* i18n-hint: First %s is the effect name, 2nd and 3rd are either true or * false (translated below) if those options were selected */ - wxString::Format(_("Applied effect: %s remove dc offset = %s, normalize amplitude = %s, stereo independent %s"), - this->GetEffectName().c_str(), + wxString::Format(_("Applied effect: %s remove dc offset = %s, normalize amplitude = %s, stereo independent %s"), + this->GetEffectName().c_str(), /* i18n-hint: true here means that the option was * selected. Opposite false if not selected */ - mDC ? _("true") : _("false"), + mDC ? _("true") : _("false"), mGain ? _("true") : _("false"), mStereoInd ? _("true") : _("false")); if (mGain) - strResult += wxString::Format(_(", maximum amplitude = %.1f dB"), mLevel); + strResult += wxString::Format(_(", maximum amplitude = %.1f dB"), mLevel); return strResult; -} +} bool EffectNormalize::TransferParameters( Shuttle & shuttle ) { @@ -126,7 +126,7 @@ bool EffectNormalize::PromptUser() dlog.CentreOnParent(); dlog.ShowModal(); - + if (dlog.GetReturnCode() == wxID_CANCEL) return false; @@ -251,14 +251,14 @@ bool EffectNormalize::Process() } } } - + //Iterate to the next track prevTrack = track; track = (WaveTrack *) iter.Next(); mCurTrackNum++; } - this->ReplaceProcessedTracks(bGoodResult); + this->ReplaceProcessedTracks(bGoodResult); return bGoodResult; } @@ -303,10 +303,10 @@ bool EffectNormalize::AnalyseDC(WaveTrack * track, wxString msg) //Transform the marker timepoints to samples sampleCount start = track->TimeToLongSamples(mCurT0); sampleCount end = track->TimeToLongSamples(mCurT1); - + //Get the length of the buffer (as double). len is //used simply to calculate a progress meter, so it is easier - //to make it a double now than it is to do it later + //to make it a double now than it is to do it later double len = (double)(end - start); //Initiate a processing buffer. This buffer will (most likely) @@ -322,20 +322,20 @@ bool EffectNormalize::AnalyseDC(WaveTrack * track, wxString msg) while (s < end) { //Get a block of samples (smaller than the size of the buffer) sampleCount block = track->GetBestBlockSize(s); - + //Adjust the block size if it is the final block in the track if (s + block > end) block = end - s; - + //Get the samples from the track and put them in the buffer track->Get((samplePtr) buffer, floatSample, s, block); - + //Process the buffer. AnalyzeData(buffer, block); - + //Increment s one blockfull of samples s += block; - + //Update the Progress meter if (TrackProgress(mCurTrackNum, ((double)(s - start) / len)/2.0, msg)) { @@ -364,10 +364,10 @@ bool EffectNormalize::ProcessOne(WaveTrack * track, wxString msg) //Transform the marker timepoints to samples sampleCount start = track->TimeToLongSamples(mCurT0); sampleCount end = track->TimeToLongSamples(mCurT1); - + //Get the length of the buffer (as double). len is //used simply to calculate a progress meter, so it is easier - //to make it a double now than it is to do it later + //to make it a double now than it is to do it later double len = (double)(end - start); //Initiate a processing buffer. This buffer will (most likely) @@ -380,23 +380,23 @@ bool EffectNormalize::ProcessOne(WaveTrack * track, wxString msg) while (s < end) { //Get a block of samples (smaller than the size of the buffer) sampleCount block = track->GetBestBlockSize(s); - + //Adjust the block size if it is the final block in the track if (s + block > end) block = end - s; - + //Get the samples from the track and put them in the buffer track->Get((samplePtr) buffer, floatSample, s, block); - + //Process the buffer. ProcessData(buffer, block); - + //Copy the newly-changed samples back onto the track. track->Set((samplePtr) buffer, floatSample, s, block); - + //Increment s one blockfull of samples s += block; - + //Update the Progress meter if (TrackProgress(mCurTrackNum, 0.5+((double)(s - start) / len)/2.0, msg)) { @@ -467,18 +467,18 @@ void NormalizeDialog::PopulateOrExchange(ShuttleGui & S) { S.StartVerticalLay(false); { - mDCCheckBox = + mDCCheckBox = S.Id(ID_DC_REMOVE). AddCheckBox(_("Remove DC offset (center on 0.0 vertically)"), mDC ? wxT("true") : wxT("false")); - + S.StartHorizontalLay(wxALIGN_CENTER, false); { - mGainCheckBox = + mGainCheckBox = S.Id(ID_NORMALIZE_AMPLITUDE). - AddCheckBox(_("Normalize maximum amplitude to"), + AddCheckBox(_("Normalize maximum amplitude to"), mGain ? wxT("true") : wxT("false")); - + mLevelTextCtrl = S.Id(ID_LEVEL_TEXT).AddTextBox(wxT(""), wxT(""), 10); mLevelTextCtrl->SetValidator(vld); mLevelTextCtrl->SetName(_("Maximum amplitude dB")); @@ -502,7 +502,7 @@ bool NormalizeDialog::TransferDataToWindow() mDCCheckBox->SetValue(mDC); mLevelTextCtrl->SetValue(Internat::ToDisplayString(mLevel, 1)); mStereoIndCheckBox->SetValue(mStereoInd); - + UpdateUI(); TransferDataFromWindow(); @@ -578,7 +578,7 @@ void NormalizeDialog::OnPreview(wxCommandEvent & WXUNUSED(event)) mEffect->mStereoInd = mStereoInd; mEffect->Preview(); - + mEffect->mGain = oldGain; mEffect->mDC = oldDC; mEffect->mLevel = oldLevel; diff --git a/src/effects/Normalize.h b/src/effects/Normalize.h index 83e89298e..59c8b0e59 100644 --- a/src/effects/Normalize.h +++ b/src/effects/Normalize.h @@ -28,7 +28,7 @@ class EffectNormalize: public Effect public: EffectNormalize(); - + virtual wxString GetEffectName() { return wxString(_("Normalize...")); } @@ -44,11 +44,11 @@ class EffectNormalize: public Effect virtual wxString GetEffectIdentifier() { return wxT("Normalize"); } - + virtual wxString GetEffectAction() { return wxString(_("Normalizing...")); } - + virtual wxString GetEffectDescription(); // useful only after parameter values have been set virtual bool PromptUser(); @@ -58,7 +58,7 @@ class EffectNormalize: public Effect virtual void End(); virtual bool CheckWhetherSkipEffect(); virtual bool Process(); - + private: bool ProcessOne(WaveTrack * t, wxString msg); virtual void AnalyseTrack(WaveTrack * track, wxString msg); @@ -115,7 +115,7 @@ class NormalizeDialog: public EffectDialog DECLARE_EVENT_TABLE() - public: + public: bool mGain; bool mDC; double mLevel; diff --git a/src/effects/Paulstretch.cpp b/src/effects/Paulstretch.cpp index be3f8b39b..29ff1c4aa 100644 --- a/src/effects/Paulstretch.cpp +++ b/src/effects/Paulstretch.cpp @@ -12,7 +12,7 @@ Some GUI code was taken from the Echo effect /** \class EffectPaulstretch - \brief An Extreme Time Stretch and Time Smear effect + \brief An Extreme Time Stretch and Time Smear effect *//****************************************************************/ @@ -51,9 +51,9 @@ EffectPaulstretch::EffectPaulstretch(){ }; wxString EffectPaulstretch::GetEffectDescription(){ - // Note: This is useful only after values have been set. - return wxString::Format(_("Applied effect: %s stretch factor = %f times, time resolution = %f seconds"), - this->GetEffectName().c_str(), amount,time_resolution); + // Note: This is useful only after values have been set. + return wxString::Format(_("Applied effect: %s stretch factor = %f times, time resolution = %f seconds"), + this->GetEffectName().c_str(), amount,time_resolution); }; @@ -82,7 +82,7 @@ bool EffectPaulstretch::TransferParameters(Shuttle &shuttle){ bool EffectPaulstretch::Process(){ - CopyInputTracks(); + CopyInputTracks(); SelectedTrackListOfKindIterator iter(Track::Wave, mOutputTracks); WaveTrack *track = (WaveTrack *) iter.First(); m_t1=mT1; @@ -229,7 +229,7 @@ bool EffectPaulstretch::ProcessOne(WaveTrack *track,double t0,double t1,int coun }; }; - delete [] fade_track_smps; + delete [] fade_track_smps; outputTrack->Flush(); @@ -314,7 +314,7 @@ void PaulStretch::process(float *smps,int nsmps){ for (int i=0;iGetEffectName().c_str(), - stages, - float(drywet*100/255), - freq, - (startphase * 180 / M_PI), - depth, - fb); -} +wxString EffectPhaser::GetEffectDescription() { + // Note: This is useful only after values have been set. + return wxString::Format(_("Applied effect: %s %d stages, %.0f%% wet, frequency = %.1f Hz, start phase = %.0f deg, depth = %d, feedback = %.0f%%"), + this->GetEffectName().c_str(), + stages, + float(drywet*100/255), + freq, + (startphase * 180 / M_PI), + depth, + fb); +} bool EffectPhaser::PromptUser() { @@ -102,7 +102,7 @@ bool EffectPhaser::PromptUser() } bool EffectPhaser::TransferParameters( Shuttle & shuttle ) -{ +{ shuttle.TransferInt(wxT("Stages"),stages,2); shuttle.TransferInt(wxT("Wet"),drywet,128); shuttle.TransferFloat(wxT("Freq"),freq,0.4f); @@ -114,7 +114,7 @@ bool EffectPhaser::TransferParameters( Shuttle & shuttle ) bool EffectPhaser::NewTrackSimpleMono() { for (int j = 0; j < stages; j++) - old[j] = 0; + old[j] = 0; skipcount = 0; gain = 0; @@ -132,19 +132,19 @@ bool EffectPhaser::ProcessSimpleMono(float *buffer, sampleCount len) { float m, tmp, in, out; int i, j; - + for (i = 0; i < len; i++) { in = buffer[i]; - + m = in + fbout * fb / 100; if (((skipcount++) % lfoskipsamples) == 0) { //compute sine between 0 and 1 gain = (1 + cos(skipcount * lfoskip + phase)) / 2; - + // change lfo shape gain = (exp(gain * phaserlfoshape) - 1) / (exp(phaserlfoshape)-1); - + gain = 1 - gain / 255 * depth; // attenuate the lfo } // phasing routine @@ -155,17 +155,17 @@ bool EffectPhaser::ProcessSimpleMono(float *buffer, sampleCount len) } fbout = m; out = (m * drywet + in * (255 - drywet)) / 255; - + // Prevents clipping // Commented out, per http://bugzilla.audacityteam.org/show_bug.cgi?id=690. //if (out < -1.0) // out = float(-1.0); //else if (out > 1.0) // out = float(1.0); - + buffer[i] = out; } - + return true; } diff --git a/src/effects/Phaser.h b/src/effects/Phaser.h index 1cced5905..1a9d80bac 100644 --- a/src/effects/Phaser.h +++ b/src/effects/Phaser.h @@ -44,7 +44,7 @@ class EffectPhaser:public EffectSimpleMono { virtual wxString GetEffectName() { return wxString(_("Phaser...")); } - + virtual std::set GetEffectCategories() { std::set result; result.insert(wxT("http://lv2plug.in/ns/lv2core#PhaserPlugin")); @@ -58,9 +58,9 @@ class EffectPhaser:public EffectSimpleMono { virtual wxString GetEffectAction() { return wxString(_("Applying Phaser")); } - - // Useful only after PromptUser values have been set. - virtual wxString GetEffectDescription(); + + // Useful only after PromptUser values have been set. + virtual wxString GetEffectDescription(); virtual bool PromptUser(); virtual bool TransferParameters( Shuttle & shuttle ); @@ -69,9 +69,9 @@ class EffectPhaser:public EffectSimpleMono { virtual bool NewTrackSimpleMono(); virtual bool ProcessSimpleMono(float *buffer, sampleCount len); - + /* - Phaser Parameters + Phaser Parameters freq - Phaser's LFO frequency startphase - Phaser's LFO startphase (radians), needed for stereo Phasers @@ -83,7 +83,7 @@ class EffectPhaser:public EffectSimpleMono { */ private: - + // parameters float freq; float startphase; diff --git a/src/effects/Repair.cpp b/src/effects/Repair.cpp index 0f42f69da..0d5493ea1 100644 --- a/src/effects/Repair.cpp +++ b/src/effects/Repair.cpp @@ -46,7 +46,7 @@ bool EffectRepair::PromptUser() } bool EffectRepair::TransferParameters( Shuttle & WXUNUSED(shuttle) ) -{ +{ //TODO: pop-click values. // shuttle.TransferInt("",,0); return true; @@ -80,7 +80,7 @@ bool EffectRepair::Process() double t0 = repair_t0 - spacing; double t1 = repair_t1 + spacing; - + t0 = t0 < trackStart? trackStart: t0; t1 = t1 > trackEnd? trackEnd: t1; @@ -101,14 +101,14 @@ bool EffectRepair::Process() bGoodResult = false; break; } - + if (s0 == repair0 && s1 == repair1) { ::wxMessageBox(_("Repair works by using audio data outside the selection region.\n\nPlease select a region that has audio touching at least one side of it.\n\nThe more surrounding audio, the better it performs.")); /// The Repair effect needs some data to go on.\n\nPlease select an area to repair with some audio on at least one side (the more the better).")); bGoodResult = false; break; } - + if (!ProcessOne(count, track, s0, len, repairStart, repairLen)) { bGoodResult = false; @@ -120,7 +120,7 @@ bool EffectRepair::Process() count++; } - this->ReplaceProcessedTracks(bGoodResult); + this->ReplaceProcessedTracks(bGoodResult); return bGoodResult; } diff --git a/src/effects/Repair.h b/src/effects/Repair.h index 7ea41a58f..1d7768de0 100644 --- a/src/effects/Repair.h +++ b/src/effects/Repair.h @@ -19,9 +19,9 @@ class WaveTrack; class EffectRepair: public Effect { - + public: - + EffectRepair(); virtual ~EffectRepair(); @@ -42,12 +42,12 @@ public: virtual wxString GetEffectAction() { return wxString(_("Repairing damaged audio")); } - + virtual bool PromptUser(); virtual bool TransferParameters( Shuttle & shuttle ); - + virtual bool Process(); - + private: bool ProcessOne(int count, WaveTrack * track, sampleCount start, diff --git a/src/effects/Repeat.cpp b/src/effects/Repeat.cpp index 163e7e013..ea0c4455c 100644 --- a/src/effects/Repeat.cpp +++ b/src/effects/Repeat.cpp @@ -47,10 +47,10 @@ EffectRepeat::EffectRepeat() repeatCount = 10; } -wxString EffectRepeat::GetEffectDescription() { - // Note: This is useful only after values have been set. +wxString EffectRepeat::GetEffectDescription() { + // Note: This is useful only after values have been set. return wxString::Format(_("Repeated %d times"), repeatCount); -} +} bool EffectRepeat::PromptUser() { @@ -62,15 +62,15 @@ bool EffectRepeat::PromptUser() TrackListOfKindIterator iter(Track::Wave, mTracks); WaveTrack *track = (WaveTrack *) iter.First(); while (track) { - sampleCount trackLen = - (sampleCount)((track->GetEndTime() - track->GetStartTime()) * + sampleCount trackLen = + (sampleCount)((track->GetEndTime() - track->GetStartTime()) * track->GetRate()); sampleCount selectionLen = (sampleCount)((mT1 - mT0) * track->GetRate()); if (selectionLen == 0) { wxMessageBox(_("Selection is too short to repeat."), _("Repeat"), wxOK | wxCENTRE, mParent); return false; - } + } int availSamples = 2147483647 - trackLen; int count = availSamples / selectionLen; if (maxCount == -1 || count < maxCount) @@ -78,7 +78,7 @@ bool EffectRepeat::PromptUser() track = (WaveTrack *) iter.Next(); } - + if (maxCount <= 1) { // TO DO: Not really true now that SampleCount is 64-bit int, but while bug 416 // is open, do we want to encourage repeating hugely long tracks? @@ -110,21 +110,21 @@ bool EffectRepeat::PromptUser() } bool EffectRepeat::TransferParameters( Shuttle & shuttle ) -{ +{ shuttle.TransferInt(wxT("Count"),repeatCount,1); return true; } bool EffectRepeat::Process() { - // Set up mOutputTracks. + // Set up mOutputTracks. // This effect needs Track::All for sync-lock grouping. this->CopyInputTracks(Track::All); int nTrack = 0; bool bGoodResult = true; double maxDestLen = 0.0; // used to change selection to generated bit - + TrackListIterator iter(mOutputTracks); for (Track *t = iter.First(); t && bGoodResult; t = iter.Next()) { @@ -158,7 +158,7 @@ bool EffectRepeat::Process() track->Copy(mT0, mT1, &dest); for(int j=0; jPaste(tc, dest) || + if (!track->Paste(tc, dest) || TrackProgress(nTrack, j / repeatCount)) // TrackProgress returns true on Cancel. { bGoodResult = false; diff --git a/src/effects/Repeat.h b/src/effects/Repeat.h index 7be88e3bb..8b677a82a 100644 --- a/src/effects/Repeat.h +++ b/src/effects/Repeat.h @@ -46,13 +46,13 @@ class EffectRepeat:public Effect virtual wxString GetEffectAction() { return wxString(_("Performing Repeat")); } - - // Useful only after PromptUser values have been set. - virtual wxString GetEffectDescription(); + + // Useful only after PromptUser values have been set. + virtual wxString GetEffectDescription(); virtual bool PromptUser(); virtual bool TransferParameters( Shuttle & shuttle ); - + virtual bool Process(); private: diff --git a/src/effects/Reverb.cpp b/src/effects/Reverb.cpp index a7b11b9db..504693933 100644 --- a/src/effects/Reverb.cpp +++ b/src/effects/Reverb.cpp @@ -129,7 +129,7 @@ bool EffectReverb::Process() else success = ProcessOneTrack(n, track, 0, msg); } } - ReplaceProcessedTracks(success); + ReplaceProcessedTracks(success); return success; } @@ -168,7 +168,7 @@ void EffectReverb::SaveSettings(int settingsNumber, EffectReverb::Params const * wxString sSettingsPath(SettingsPath(settingsNumber)); if (name) gPrefs->Write(sSettingsPath + wxT("name"), *name); - if (params) + if (params) { gPrefs->Write(sSettingsPath + wxT("RoomSize"), params->mRoomSize); gPrefs->Write(sSettingsPath + wxT("Delay"), params->mDelay); @@ -189,9 +189,9 @@ EffectReverb::EffectReverb() LoadSettings(-1, mParams); } -wxString EffectReverb::GetEffectDescription() +wxString EffectReverb::GetEffectDescription() { - wxString strResult = + wxString strResult = wxString::Format(_("Applied effect: %s"), GetEffectName().c_str()); strResult += wxString::Format(_(", Room Size = %.0f"), mParams.mRoomSize); strResult += wxString::Format(_(", Delay = %.0fms"), mParams.mDelay); @@ -204,7 +204,7 @@ wxString EffectReverb::GetEffectDescription() strResult += wxString::Format(_(", Stereo Width = %.0f%%"), mParams.mStereoWidth); strResult += wxString::Format(_(", Wet Only = %s"), mParams.mWetOnly ? _("true") : _("false")); return strResult; -} +} bool EffectReverb::PromptUser() { @@ -271,25 +271,25 @@ BEGIN_EVENT_TABLE(ReverbDialogue, EffectDialog) EVT_SLIDER(ID_Delay_WIDGET, ReverbDialogue::OnDelayWidget) EVT_TEXT(ID_Delay_TEXT, ReverbDialogue::OnDelayText) - + EVT_SLIDER(ID_Reverberance_WIDGET, ReverbDialogue::OnReverberanceWidget) EVT_TEXT(ID_Reverberance_TEXT, ReverbDialogue::OnReverberanceText) - + EVT_SLIDER(ID_HfDamping_WIDGET, ReverbDialogue::OnHfDampingWidget) EVT_TEXT(ID_HfDamping_TEXT, ReverbDialogue::OnHfDampingText) - + EVT_SLIDER(ID_ToneLow_WIDGET, ReverbDialogue::OnToneLowWidget) EVT_TEXT(ID_ToneLow_TEXT, ReverbDialogue::OnToneLowText) - + EVT_SLIDER(ID_ToneHigh_WIDGET, ReverbDialogue::OnToneHighWidget) EVT_TEXT(ID_ToneHigh_TEXT, ReverbDialogue::OnToneHighText) - + EVT_SLIDER(ID_WetGain_WIDGET, ReverbDialogue::OnWetGainWidget) EVT_TEXT(ID_WetGain_TEXT, ReverbDialogue::OnWetGainText) - + EVT_SLIDER(ID_DryGain_WIDGET, ReverbDialogue::OnDryGainWidget) EVT_TEXT(ID_DryGain_TEXT, ReverbDialogue::OnDryGainText) - + EVT_SLIDER(ID_StereoWidth_WIDGET, ReverbDialogue::OnStereoWidthWidget) EVT_TEXT(ID_StereoWidth_TEXT, ReverbDialogue::OnStereoWidthText) @@ -312,17 +312,17 @@ void ReverbDialogue::PopulateOrExchange(ShuttleGui & s) { s.AddSpace(0, 5); - s.StartMultiColumn(3, wxEXPAND); + s.StartMultiColumn(3, wxEXPAND); { s.SetStretchyCol(2); - mRoomSizeText = s.Id(ID_RoomSize_TEXT).AddSpinCtrl(_("&Room Size (%):"), 0, 100, 0); + mRoomSizeText = s.Id(ID_RoomSize_TEXT).AddSpinCtrl(_("&Room Size (%):"), 0, 100, 0); s.SetStyle(wxSL_HORIZONTAL); mRoomSizeWidget = s.Id(ID_RoomSize_WIDGET).AddSlider(wxT(""), 0, 100, 0); - // Rob's original code referred to this param as "Delay". - // Then, May 11, 2013, in a thread on [Audacity-quality], subject "Reverb effect", - // Steve suggested and Gale seconded renaming it "Pre-delay". + // Rob's original code referred to this param as "Delay". + // Then, May 11, 2013, in a thread on [Audacity-quality], subject "Reverb effect", + // Steve suggested and Gale seconded renaming it "Pre-delay". // I've changed it only here, in the GUI, and left the rest of the code as *Delay*. mDelayText = s.Id(ID_Delay_TEXT).AddSpinCtrl(_("&Pre-delay (ms):"), 0, 200, 0); s.SetStyle(wxSL_HORIZONTAL); @@ -355,13 +355,13 @@ void ReverbDialogue::PopulateOrExchange(ShuttleGui & s) mStereoWidthText = s.Id(ID_StereoWidth_TEXT).AddSpinCtrl(_("Stereo Wid&th (%):"), 0, 100, 0); s.SetStyle(wxSL_HORIZONTAL); mStereoWidthWidget = s.Id(ID_StereoWidth_WIDGET).AddSlider(wxT(""), 0, 100, 0); - } + } s.EndMultiColumn(); - s.StartHorizontalLay(wxCENTER, false); + s.StartHorizontalLay(wxCENTER, false); { mWetOnlyWidget = s.Id(ID_WetOnly_WIDGET).AddCheckBox(_("Wet O&nly"), wxT("false")); - } + } s.EndHorizontalLay(); s.StartHorizontalLay(wxCENTER); { @@ -428,47 +428,47 @@ bool ReverbDialogue::TransferDataFromWindow() return true; } -void ReverbDialogue::OnRoomSizeText(wxCommandEvent & WXUNUSED(event)) +void ReverbDialogue::OnRoomSizeText(wxCommandEvent & WXUNUSED(event)) { int val = mRoomSizeText->GetValue(); mRoomSizeWidget->SetValue(TrapLong(val, 0, 100)); } void ReverbDialogue::OnRoomSizeWidget(wxCommandEvent & WXUNUSED(event)) { mRoomSizeText->SetValue(wxString::Format(wxT("%d"), mRoomSizeWidget->GetValue())); } -void ReverbDialogue::OnDelayText(wxCommandEvent & WXUNUSED(event)) +void ReverbDialogue::OnDelayText(wxCommandEvent & WXUNUSED(event)) { int val = mDelayText->GetValue(); mDelayWidget->SetValue(TrapLong(val, 0, 200)); } void ReverbDialogue::OnDelayWidget(wxCommandEvent & WXUNUSED(event)) { mDelayText->SetValue(wxString::Format(wxT("%d"), mDelayWidget->GetValue())); } -void ReverbDialogue::OnReverberanceText(wxCommandEvent & WXUNUSED(event)) +void ReverbDialogue::OnReverberanceText(wxCommandEvent & WXUNUSED(event)) { int val = mReverberanceText->GetValue(); mReverberanceWidget->SetValue(TrapLong(val, 0, 100)); } void ReverbDialogue::OnReverberanceWidget(wxCommandEvent & WXUNUSED(event)) { mReverberanceText->SetValue(wxString::Format(wxT("%d"), mReverberanceWidget->GetValue())); } -void ReverbDialogue::OnHfDampingText(wxCommandEvent & WXUNUSED(event)) +void ReverbDialogue::OnHfDampingText(wxCommandEvent & WXUNUSED(event)) { int val = mHfDampingText->GetValue(); mHfDampingWidget->SetValue(TrapLong(val, 0, 100)); } void ReverbDialogue::OnHfDampingWidget(wxCommandEvent & WXUNUSED(event)) { mHfDampingText->SetValue(wxString::Format(wxT("%d"), mHfDampingWidget->GetValue())); } -void ReverbDialogue::OnToneLowText(wxCommandEvent & WXUNUSED(event)) +void ReverbDialogue::OnToneLowText(wxCommandEvent & WXUNUSED(event)) { int val = mToneLowText->GetValue(); mToneLowWidget->SetValue(TrapLong(val, 0, 100)); } void ReverbDialogue::OnToneLowWidget(wxCommandEvent & WXUNUSED(event)) { mToneLowText->SetValue(wxString::Format(wxT("%d"), mToneLowWidget->GetValue())); } -void ReverbDialogue::OnToneHighText(wxCommandEvent & WXUNUSED(event)) +void ReverbDialogue::OnToneHighText(wxCommandEvent & WXUNUSED(event)) { int val = mToneHighText->GetValue(); mToneHighWidget->SetValue(TrapLong(val, 0, 100)); } void ReverbDialogue::OnToneHighWidget(wxCommandEvent & WXUNUSED(event)) { mToneHighText->SetValue(wxString::Format(wxT("%d"), mToneHighWidget->GetValue())); } -void ReverbDialogue::OnWetGainText(wxCommandEvent & WXUNUSED(event)) +void ReverbDialogue::OnWetGainText(wxCommandEvent & WXUNUSED(event)) { int val = mWetGainText->GetValue(); mWetGainWidget->SetValue(TrapLong(val, -20, 10)); } void ReverbDialogue::OnWetGainWidget(wxCommandEvent & WXUNUSED(event)) { mWetGainText->SetValue(wxString::Format(wxT("%d"), mWetGainWidget->GetValue())); } -void ReverbDialogue::OnDryGainText(wxCommandEvent & WXUNUSED(event)) +void ReverbDialogue::OnDryGainText(wxCommandEvent & WXUNUSED(event)) { int val = mDryGainText->GetValue(); mDryGainWidget->SetValue(TrapLong(val, -20, 10)); } void ReverbDialogue::OnDryGainWidget(wxCommandEvent & WXUNUSED(event)) { mDryGainText->SetValue(wxString::Format(wxT("%d"), mDryGainWidget->GetValue())); } -void ReverbDialogue::OnStereoWidthText(wxCommandEvent & WXUNUSED(event)) +void ReverbDialogue::OnStereoWidthText(wxCommandEvent & WXUNUSED(event)) { int val = mStereoWidthText->GetValue(); mStereoWidthWidget->SetValue(TrapLong(val, 0, 100)); } void ReverbDialogue::OnStereoWidthWidget(wxCommandEvent & WXUNUSED(event)) { mStereoWidthText->SetValue(wxString::Format(wxT("%d"), mStereoWidthWidget->GetValue())); } @@ -501,14 +501,14 @@ void ReverbDialogue::LoadPreset(wxCommandEvent & WXUNUSED(event)) choices.Add(_("Cathedral")); int i(wxGetChoiceFromUser(this, message, caption, choices)); switch (i) { - case 0: p.mRoomSize=70; p.mHfDamping=99; p.mDelay=20; p.mReverberance=40; p.mToneLow=100; p.mToneHigh=50 ; p.mWetGain=-12; p.mDryGain=0 ; p.mStereoWidth=70 ; break; - case 1: p.mRoomSize=50; p.mHfDamping=99; p.mDelay=0 ; p.mReverberance=50; p.mToneLow=50 ; p.mToneHigh=100; p.mWetGain=-1 ; p.mDryGain=-1 ; p.mStereoWidth=70 ; break; - case 2: p.mRoomSize=16; p.mHfDamping=0 ; p.mDelay=8 ; p.mReverberance=80; p.mToneLow=0 ; p.mToneHigh=100; p.mWetGain=-6 ; p.mDryGain=0 ; p.mStereoWidth=100; break; - case 3: p.mRoomSize=30; p.mHfDamping=50; p.mDelay=10; p.mReverberance=50; p.mToneLow=50 ; p.mToneHigh=100; p.mWetGain=-1 ; p.mDryGain=-1 ; p.mStereoWidth=100; break; - case 4: p.mRoomSize=30; p.mHfDamping=50; p.mDelay=10; p.mReverberance=50; p.mToneLow=100; p.mToneHigh=0 ; p.mWetGain=-1 ; p.mDryGain=-1 ; p.mStereoWidth=100; break; - case 5: p.mRoomSize=75; p.mHfDamping=50; p.mDelay=10; p.mReverberance=40; p.mToneLow=100; p.mToneHigh=70 ; p.mWetGain=-1 ; p.mDryGain=-1 ; p.mStereoWidth=70 ; break; - case 6: p.mRoomSize=85; p.mHfDamping=50; p.mDelay=10; p.mReverberance=40; p.mToneLow=100; p.mToneHigh=80 ; p.mWetGain=0 ; p.mDryGain=-6 ; p.mStereoWidth=90 ; break; - case 7: p.mRoomSize=90; p.mHfDamping=50; p.mDelay=32; p.mReverberance=60; p.mToneLow=100; p.mToneHigh=50 ; p.mWetGain=0 ; p.mDryGain=-12; p.mStereoWidth=100; break; + case 0: p.mRoomSize=70; p.mHfDamping=99; p.mDelay=20; p.mReverberance=40; p.mToneLow=100; p.mToneHigh=50 ; p.mWetGain=-12; p.mDryGain=0 ; p.mStereoWidth=70 ; break; + case 1: p.mRoomSize=50; p.mHfDamping=99; p.mDelay=0 ; p.mReverberance=50; p.mToneLow=50 ; p.mToneHigh=100; p.mWetGain=-1 ; p.mDryGain=-1 ; p.mStereoWidth=70 ; break; + case 2: p.mRoomSize=16; p.mHfDamping=0 ; p.mDelay=8 ; p.mReverberance=80; p.mToneLow=0 ; p.mToneHigh=100; p.mWetGain=-6 ; p.mDryGain=0 ; p.mStereoWidth=100; break; + case 3: p.mRoomSize=30; p.mHfDamping=50; p.mDelay=10; p.mReverberance=50; p.mToneLow=50 ; p.mToneHigh=100; p.mWetGain=-1 ; p.mDryGain=-1 ; p.mStereoWidth=100; break; + case 4: p.mRoomSize=30; p.mHfDamping=50; p.mDelay=10; p.mReverberance=50; p.mToneLow=100; p.mToneHigh=0 ; p.mWetGain=-1 ; p.mDryGain=-1 ; p.mStereoWidth=100; break; + case 5: p.mRoomSize=75; p.mHfDamping=50; p.mDelay=10; p.mReverberance=40; p.mToneLow=100; p.mToneHigh=70 ; p.mWetGain=-1 ; p.mDryGain=-1 ; p.mStereoWidth=70 ; break; + case 6: p.mRoomSize=85; p.mHfDamping=50; p.mDelay=10; p.mReverberance=40; p.mToneLow=100; p.mToneHigh=80 ; p.mWetGain=0 ; p.mDryGain=-6 ; p.mStereoWidth=90 ; break; + case 7: p.mRoomSize=90; p.mHfDamping=50; p.mDelay=32; p.mReverberance=60; p.mToneLow=100; p.mToneHigh=50 ; p.mWetGain=0 ; p.mDryGain=-12; p.mStereoWidth=100; break; case 8: p.mRoomSize=90; p.mHfDamping=50; p.mDelay=16; p.mReverberance=90; p.mToneLow=100; p.mToneHigh=0 ; p.mWetGain=0 ; p.mDryGain=-20; p.mStereoWidth=100; break; default: return; } @@ -537,7 +537,7 @@ void ReverbDialogue::SaveSettings(wxCommandEvent & WXUNUSED(event)) } } -void ReverbDialogue::SetTitle(wxString const & name) +void ReverbDialogue::SetTitle(wxString const & name) { wxString title(_("Reverb")); if (name != wxT("")) diff --git a/src/effects/Reverb.h b/src/effects/Reverb.h index dbeaab94f..5e781641c 100644 --- a/src/effects/Reverb.h +++ b/src/effects/Reverb.h @@ -34,7 +34,7 @@ public: virtual wxString GetEffectName() {return _("Reverb...");} virtual wxString GetEffectAction() {return _("Applying Reverb");} virtual wxString GetEffectIdentifier() {return wxT("Reverb");} - virtual wxString GetEffectDescription(); // Useful only after PromptUser values have been set. + virtual wxString GetEffectDescription(); // Useful only after PromptUser values have been set. virtual bool TransferParameters(Shuttle & shuttle); protected: @@ -97,53 +97,53 @@ private: // event handlers and member vars void OnRoomSizeWidget(wxCommandEvent & event); - void OnRoomSizeText(wxCommandEvent & event); + void OnRoomSizeText(wxCommandEvent & event); wxSlider * mRoomSizeWidget; wxSpinCtrl * mRoomSizeText; void OnDelayWidget(wxCommandEvent & event); - void OnDelayText(wxCommandEvent & event); + void OnDelayText(wxCommandEvent & event); wxSlider * mDelayWidget; wxSpinCtrl * mDelayText; void OnReverberanceWidget(wxCommandEvent & event); - void OnReverberanceText(wxCommandEvent & event); + void OnReverberanceText(wxCommandEvent & event); wxSlider * mReverberanceWidget; wxSpinCtrl * mReverberanceText; void OnHfDampingWidget(wxCommandEvent & event); - void OnHfDampingText(wxCommandEvent & event); + void OnHfDampingText(wxCommandEvent & event); wxSlider * mHfDampingWidget; wxSpinCtrl * mHfDampingText; void OnToneLowWidget(wxCommandEvent & event); - void OnToneLowText(wxCommandEvent & event); + void OnToneLowText(wxCommandEvent & event); wxSlider * mToneLowWidget; wxSpinCtrl * mToneLowText; void OnToneHighWidget(wxCommandEvent & event); - void OnToneHighText(wxCommandEvent & event); + void OnToneHighText(wxCommandEvent & event); wxSlider * mToneHighWidget; wxSpinCtrl * mToneHighText; void OnWetGainWidget(wxCommandEvent & event); - void OnWetGainText(wxCommandEvent & event); + void OnWetGainText(wxCommandEvent & event); wxSlider * mWetGainWidget; wxSpinCtrl * mWetGainText; void OnDryGainWidget(wxCommandEvent & event); - void OnDryGainText(wxCommandEvent & event); + void OnDryGainText(wxCommandEvent & event); wxSlider * mDryGainWidget; wxSpinCtrl * mDryGainText; void OnStereoWidthWidget(wxCommandEvent & event); - void OnStereoWidthText(wxCommandEvent & event); + void OnStereoWidthText(wxCommandEvent & event); wxSlider * mStereoWidthWidget; wxSpinCtrl * mStereoWidthText; wxCheckBox * mWetOnlyWidget; - + EffectReverb & mEffect; EffectReverb::Params & mParams; diff --git a/src/effects/Reverb_libSoX.h b/src/effects/Reverb_libSoX.h index 3b856456e..57942b0a5 100644 --- a/src/effects/Reverb_libSoX.h +++ b/src/effects/Reverb_libSoX.h @@ -3,9 +3,9 @@ Audacity: A Digital Audio Editor Reverb_libSoX.h - Stereo reverberation effect from libSoX, + Stereo reverberation effect from libSoX, adapted for Audacity (audacity.sourceforge.net) - + Copyright (c) 2007-2013 robs@users.sourceforge.net Licence: LGPL v2.1 Filter configuration based on freeverb by Jezar Wakefield. diff --git a/src/effects/Reverse.cpp b/src/effects/Reverse.cpp index 909896175..d84345a8d 100644 --- a/src/effects/Reverse.cpp +++ b/src/effects/Reverse.cpp @@ -68,7 +68,7 @@ bool EffectReverse::Process() count++; } - this->ReplaceProcessedTracks(bGoodResult); + this->ReplaceProcessedTracks(bGoodResult); return bGoodResult; } @@ -108,28 +108,28 @@ bool EffectReverse::ProcessOneWave(int count, WaveTrack * track, sampleCount sta // and apply the appropriate offset after detaching them from the track bool checkedFirstClip = false; - + // used in calculating the offset of clips to rearrange // holds the new end position of the current clip sampleCount currentEnd = (sampleCount)end; - + WaveClipList revClips; // holds the reversed clips WaveClipList otherClips; // holds the clips that appear after the reverse selection region WaveClipArray clipArray; track->FillSortedClipArray(clipArray); size_t i; for (i=0; i < clipArray.Count(); i++) { - + WaveClip *clip = clipArray.Item(i); sampleCount clipStart = clip->GetStartSample(); sampleCount clipEnd = clip->GetEndSample(); - + if (clipStart >= start && clipEnd <= end) { // if the clip is inside the selected region - + // this is used to check if the selected region begins with a whitespace. // if yes then clipStart (of the first clip) and start are not the same. // adjust currentEnd accordingly and set endMerge to false - if(checkedFirstClip == false && clipStart > start) { + if(checkedFirstClip == false && clipStart > start) { checkedFirstClip = true; if(i > 0) { if (clipArray.Item(i-1)->GetEndSample() <= start) { @@ -140,7 +140,7 @@ bool EffectReverse::ProcessOneWave(int count, WaveTrack * track, sampleCount sta currentEnd -= (clipStart - start); } } - + sampleCount revStart = (clipStart >= start)? clipStart: start; sampleCount revEnd = (clipEnd >= end)? end: clipEnd; sampleCount revLen = (sampleCount)revEnd-revStart; @@ -162,7 +162,7 @@ bool EffectReverse::ProcessOneWave(int count, WaveTrack * track, sampleCount sta clip = track->RemoveAndReturnClip(clip); // detach the clip from track clip->SetOffset(track->LongSamplesToTime(track->TimeToLongSamples(offsetStartTime))); // align time to a sample and set offset revClips.Append(clip); - + } } else if (clipStart >= end) { // clip is after the selection region @@ -170,7 +170,7 @@ bool EffectReverse::ProcessOneWave(int count, WaveTrack * track, sampleCount sta otherClips.Append(clip); } } - + // STEP 3: Append the clips from // revClips and otherClips back to the track size_t revClipsCount = revClips.GetCount(); @@ -201,7 +201,7 @@ bool EffectReverse::ProcessOneClip(int count, WaveTrack *track, float tmp; float *buffer1 = new float[blockSize]; float *buffer2 = new float[blockSize]; - + sampleCount originalLen = (sampleCount)originalEnd-originalStart; while (len > 1) { @@ -222,7 +222,7 @@ bool EffectReverse::ProcessOneClip(int count, WaveTrack *track, len -= 2 * block; first += block; - + if( TrackProgress(count, 2*(first-originalStart) / (double) originalLen) ) { rc = false; break; diff --git a/src/effects/Reverse.h b/src/effects/Reverse.h index 0318e54d3..75edf4411 100644 --- a/src/effects/Reverse.h +++ b/src/effects/Reverse.h @@ -5,7 +5,7 @@ Reverse.h Mark Phillips - + This class reverses the selected audio. **********************************************************************/ @@ -43,7 +43,7 @@ class EffectReverse:public Effect { virtual wxString GetEffectAction() { return wxString(_("Reversing")); } - + virtual bool Process(); private: diff --git a/src/effects/SBSMSEffect.cpp b/src/effects/SBSMSEffect.cpp index 47e2b5145..8767a16e5 100644 --- a/src/effects/SBSMSEffect.cpp +++ b/src/effects/SBSMSEffect.cpp @@ -88,14 +88,14 @@ public: Slide *rateSlide, Slide *pitchSlide, bool bReferenceInput, long samples, long preSamples, - SBSMSQuality *quality) + SBSMSQuality *quality) : SBSMSInterfaceSliding(rateSlide,pitchSlide,bReferenceInput,samples,preSamples,quality) { this->resampler = resampler; } virtual ~SBSMSEffectInterface() {} - long samples(audio *buf, long n) { + long samples(audio *buf, long n) { return resampler->read(buf, n); } @@ -103,26 +103,26 @@ protected: Resampler *resampler; }; -long resampleCB(void *cb_data, SBSMSFrame *data) +long resampleCB(void *cb_data, SBSMSFrame *data) { ResampleBuf *r = (ResampleBuf*) cb_data; - + long blockSize = r->leftTrack->GetBestBlockSize(r->offset); - + //Adjust the block size if it is the final block in the track if (r->offset + blockSize > r->end) blockSize = r->end - r->offset; - + // Get the samples from the tracks and put them in the buffers. r->leftTrack->Get((samplePtr)(r->leftBuffer), floatSample, r->offset, blockSize); r->rightTrack->Get((samplePtr)(r->rightBuffer), floatSample, r->offset, blockSize); - + // convert to sbsms audio format for(int i=0; ibuf[i][0] = r->leftBuffer[i]; r->buf[i][1] = r->rightBuffer[i]; } - + data->buf = r->buf; data->size = blockSize; if(r->bPitch) { @@ -165,7 +165,7 @@ void EffectSBSMS :: setParameters(double rateStart, double rateEnd, double pitch this->bPitchReferenceInput = bPitchReferenceInput; } -TimeWarper *createTimeWarper(double t0, double t1, double duration, +TimeWarper *createTimeWarper(double t0, double t1, double duration, double rateStart, double rateEnd, SlideType rateSlideType) { TimeWarper *warper = NULL; @@ -181,7 +181,7 @@ TimeWarper *createTimeWarper(double t0, double t1, double duration, warper = new LinearOutputStretchTimeWarper(t0, t1, rateStart, rateEnd); } else if(rateSlideType == SlideGeometricInput) { warper = new GeometricInputTimeWarper(t0, t1, rateStart, rateEnd); - } else if(rateSlideType == SlideGeometricOutput) { + } else if(rateSlideType == SlideGeometricOutput) { warper = new GeometricOutputTimeWarper(t0, t1, rateStart, rateEnd); } return warper; @@ -202,7 +202,7 @@ bool EffectSBSMS::ProcessLabelTrack(Track *t) bool EffectSBSMS::Process() { bool bGoodResult = true; - + //Iterate over each track //Track::All is needed because this effect needs to introduce silence in the group tracks to keep sync this->CopyInputTracks(Track::All); // Set up mOutputTracks. @@ -220,7 +220,7 @@ bool EffectSBSMS::Process() t = iter.First(); while (t != NULL) { - if (t->GetKind() == Track::Label && + if (t->GetKind() == Track::Label && (t->GetSelected() || (mustSync && t->IsSyncLockSelected())) ) { if (!ProcessLabelTrack(t)) { @@ -235,24 +235,24 @@ bool EffectSBSMS::Process() //Get start and end times from track mCurT0 = leftTrack->GetStartTime(); mCurT1 = leftTrack->GetEndTime(); - + //Set the current bounds to whichever left marker is //greater and whichever right marker is less mCurT0 = wxMax(mT0, mCurT0); mCurT1 = wxMin(mT1, mCurT1); - + // Process only if the right marker is to the right of the left marker if (mCurT1 > mCurT0) { sampleCount start; sampleCount end; start = leftTrack->TimeToLongSamples(mCurT0); end = leftTrack->TimeToLongSamples(mCurT1); - + WaveTrack* rightTrack = NULL; if (leftTrack->GetLinked()) { double t; rightTrack = (WaveTrack*)(iter.Next()); - + //Adjust bounds by the right tracks markers t = rightTrack->GetStartTime(); t = wxMax(mT0, t); @@ -260,12 +260,12 @@ bool EffectSBSMS::Process() t = rightTrack->GetEndTime(); t = wxMin(mT1, t); mCurT1 = wxMax(mCurT1, t); - + //Transform the marker timepoints to samples start = leftTrack->TimeToLongSamples(mCurT0); end = leftTrack->TimeToLongSamples(mCurT1); - - mCurTrackNum++; // Increment for rightTrack, too. + + mCurTrackNum++; // Increment for rightTrack, too. } sampleCount trackStart = leftTrack->TimeToLongSamples(leftTrack->GetStartTime()); sampleCount trackEnd = leftTrack->TimeToLongSamples(leftTrack->GetEndTime()); @@ -283,10 +283,10 @@ bool EffectSBSMS::Process() rb.rightTrack = rightTrack?rightTrack:leftTrack; rb.leftBuffer = (float*)calloc(maxBlockSize,sizeof(float)); rb.rightBuffer = (float*)calloc(maxBlockSize,sizeof(float)); - + // Samples in selection sampleCount samplesIn = end-start; - + // Samples for SBSMS to process after resampling sampleCount samplesToProcess = (sampleCount) ((float)samplesIn*(srProcess/srTrack)); @@ -305,7 +305,7 @@ bool EffectSBSMS::Process() rb.iface = new SBSMSInterfaceSliding(&rateSlide,&pitchSlide, bPitchReferenceInput, samplesToProcess,0, - NULL); + NULL); } else { rb.bPitch = false; outSlideType = (srProcess==srTrack?SlideIdentity:SlideConstant); @@ -327,15 +327,15 @@ bool EffectSBSMS::Process() &rateSlide,&pitchSlide, bPitchReferenceInput, samplesToProcess,processPresamples, - rb.quality); + rb.quality); } Resampler resampler(outResampleCB,&rb,outSlideType); - + audio outBuf[SBSMSOutBlockSize]; float outBufLeft[2*SBSMSOutBlockSize]; float outBufRight[2*SBSMSOutBlockSize]; - + // Samples in output after SBSMS sampleCount samplesToOutput = rb.iface->getSamplesToOutput(); @@ -377,17 +377,17 @@ bool EffectSBSMS::Process() rb.outputLeftTrack->Append((samplePtr)outBufLeft, floatSample, outputCount); if(rightTrack) rb.outputRightTrack->Append((samplePtr)outBufRight, floatSample, outputCount); - + double frac = (double)pos/(double)samplesOut; int nWhichTrack = mCurTrackNum; if(rightTrack) { nWhichTrack = 2*(mCurTrackNum/2); if (frac < 0.5) - frac *= 2.0; // Show twice as far for each track, because we're doing 2 at once. + frac *= 2.0; // Show twice as far for each track, because we're doing 2 at once. else { nWhichTrack++; frac -= 0.5; - frac *= 2.0; // Show twice as far for each track, because we're doing 2 at once. + frac *= 2.0; // Show twice as far for each track, because we're doing 2 at once. } } if (TrackProgress(nWhichTrack, frac)) @@ -397,14 +397,14 @@ bool EffectSBSMS::Process() if(rightTrack) rb.outputRightTrack->Flush(); - bool bResult = + bool bResult = leftTrack->ClearAndPaste(mCurT0, mCurT1, rb.outputLeftTrack, true, false, GetTimeWarper()); wxASSERT(bResult); // TO DO: Actually handle this. - if(rightTrack) + if(rightTrack) { - bResult = + bResult = rightTrack->ClearAndPaste(mCurT0, mCurT1, rb.outputRightTrack, true, false, GetTimeWarper()); wxASSERT(bResult); // TO DO: Actually handle this. @@ -419,14 +419,14 @@ bool EffectSBSMS::Process() //Iterate to the next track t = iter.Next(); } - + if (bGoodResult) - ReplaceProcessedTracks(bGoodResult); + ReplaceProcessedTracks(bGoodResult); // Update selection mT0 = mCurT0; mT1 = mCurT0 + maxDuration; - + return bGoodResult; } diff --git a/src/effects/ScoreAlignDialog.cpp b/src/effects/ScoreAlignDialog.cpp index 8a0b142b5..88cd8f23a 100644 --- a/src/effects/ScoreAlignDialog.cpp +++ b/src/effects/ScoreAlignDialog.cpp @@ -68,25 +68,25 @@ ScoreAlignDialog::ScoreAlignDialog(wxWindow *parent, ScoreAlignParams ¶ms) float(SA_DFT_FRAME_PERIOD)); gPrefs->Read(wxT("/Tracks/Synchronize/WindowSize"), &p.mWindowSize, float(SA_DFT_WINDOW_SIZE)); - gPrefs->Read(wxT("/Tracks/Synchronize/SilenceThreshold"), + gPrefs->Read(wxT("/Tracks/Synchronize/SilenceThreshold"), &p.mSilenceThreshold, float(SA_DFT_SILENCE_THRESHOLD)); gPrefs->Read(wxT("/Tracks/Synchronize/ForceFinalAlignment"), &p.mForceFinalAlignment, float(SA_DFT_FORCE_FINAL_ALIGNMENT)); - gPrefs->Read(wxT("/Tracks/Synchronize/IgnoreSilence"), + gPrefs->Read(wxT("/Tracks/Synchronize/IgnoreSilence"), &p.mIgnoreSilence, float(SA_DFT_IGNORE_SILENCE)); - gPrefs->Read(wxT("/Tracks/Synchronize/PresmoothTime"), &p.mPresmoothTime, + gPrefs->Read(wxT("/Tracks/Synchronize/PresmoothTime"), &p.mPresmoothTime, float(SA_DFT_PRESMOOTH_TIME)); - gPrefs->Read(wxT("/Tracks/Synchronize/LineTime"), &p.mLineTime, + gPrefs->Read(wxT("/Tracks/Synchronize/LineTime"), &p.mLineTime, float(SA_DFT_LINE_TIME)); - gPrefs->Read(wxT("/Tracks/Synchronize/SmoothTime"), &p.mSmoothTime, + gPrefs->Read(wxT("/Tracks/Synchronize/SmoothTime"), &p.mSmoothTime, float(SA_DFT_SMOOTH_TIME)); //wxButton *ok = new wxButton(this, wxID_OK, _("OK")); //wxButton *cancel = new wxButton(this, wxID_CANCEL, _("Cancel")); //wxSlider *sl = new wxSlider(this, ID_SLIDER, 0, 0, 100, - // wxDefaultPosition, wxSize(20, 124), + // wxDefaultPosition, wxSize(20, 124), // wxSL_HORIZONTAL); - + ShuttleGui S(this, eIsCreating); //ok->SetDefault(); @@ -99,7 +99,7 @@ ScoreAlignDialog::ScoreAlignDialog(wxWindow *parent, ScoreAlignParams ¶ms) mFramePeriodLabel = S.AddVariableText(_("Frame Period")+wxString(wxT(":")), true, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL); S.SetStyle(wxSL_HORIZONTAL); - mFramePeriodSlider = S.Id(ID_FRAMEPERIOD).AddSlider(wxT(""), + mFramePeriodSlider = S.Id(ID_FRAMEPERIOD).AddSlider(wxT(""), /*pos*/ (int) (p.mFramePeriod * 100 + 0.5), /*max*/ 50, /*min*/ 5); S.SetSizeHints(300, -1); mFramePeriodSlider->SetName(_("Frame Period")); @@ -109,67 +109,67 @@ ScoreAlignDialog::ScoreAlignDialog(wxWindow *parent, ScoreAlignParams ¶ms) mWindowSizeLabel = S.AddVariableText(_("Window Size")+wxString(wxT(":")), true, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL); S.SetStyle(wxSL_HORIZONTAL); - mWindowSizeSlider = S.Id(ID_WINDOWSIZE).AddSlider(wxT(""), + mWindowSizeSlider = S.Id(ID_WINDOWSIZE).AddSlider(wxT(""), /*pos*/ (int) (p.mWindowSize * 100 + 0.5), /*max*/ 100, /*min*/ 5); mWindowSizeSlider->SetName(_("Window Size")); mWindowSizeText = S.AddVariableText(SA_DFT_WINDOW_SIZE_TEXT, true, wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL); mForceFinalAlignmentCheckBox = S.Id(ID_FORCEFINALALIGNMENT).AddCheckBox( - wxT("Force Final Alignment"), + wxT("Force Final Alignment"), (p.mForceFinalAlignment ? wxT("true") : wxT("false"))); mForceFinalAlignmentCheckBox->SetName(_("Force Final Alignment")); mIgnoreSilenceCheckBox = S.Id(ID_IGNORESILENCE).AddCheckBox( - wxT("Ignore Silence at Beginnings and Endings"), + wxT("Ignore Silence at Beginnings and Endings"), (p.mIgnoreSilence ? wxT("true") : wxT("false"))); mIgnoreSilenceCheckBox->SetName( _("Ignore Silence at Beginnings and Endings")); // need a third column after checkboxes: S.AddVariableText(wxT(""), true, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL); - mSilenceThresholdLabel = S.AddVariableText(_("Silence Threshold:"), + mSilenceThresholdLabel = S.AddVariableText(_("Silence Threshold:"), true, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL); S.SetStyle(wxSL_HORIZONTAL); - mSilenceThresholdSlider = S.Id(ID_SILENCETHRESHOLD).AddSlider(wxT(""), + mSilenceThresholdSlider = S.Id(ID_SILENCETHRESHOLD).AddSlider(wxT(""), /*pos*/ (int) (p.mSilenceThreshold * 1000 + 0.5), /*max*/ 500); mSilenceThresholdSlider->SetName(_("Silence Threshold")); - mSilenceThresholdText = S.AddVariableText(SA_DFT_SILENCE_THRESHOLD_TEXT, + mSilenceThresholdText = S.AddVariableText(SA_DFT_SILENCE_THRESHOLD_TEXT, true, wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL); /* i18n-hint: The English would be clearer if it had 'Duration' rather than 'Time' - This is a new experimental effect, and until we have it documented in the user + This is a new experimental effect, and until we have it documented in the user manual we don't have a clear description of what this parameter does. It is OK to leave it in English. */ mPresmoothLabel = S.AddVariableText(_("Presmooth Time")+wxString(wxT(":")), true, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL); S.SetStyle(wxSL_HORIZONTAL); - mPresmoothSlider = S.Id(ID_PRESMOOTH).AddSlider(wxT(""), + mPresmoothSlider = S.Id(ID_PRESMOOTH).AddSlider(wxT(""), /*pos*/ (int) (p.mPresmoothTime * 100 + 0.5), /*max*/ 500); mPresmoothSlider->SetName(_("Presmooth Time")); mPresmoothText = S.AddVariableText(SA_DFT_PRESMOOTH_TIME_TEXT, true, wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL); /* i18n-hint: The English would be clearer if it had 'Duration' rather than 'Time' - This is a new experimental effect, and until we have it documented in the user + This is a new experimental effect, and until we have it documented in the user manual we don't have a clear description of what this parameter does. It is OK to leave it in English. */ mLineTimeLabel = S.AddVariableText(_("Line Time")+wxString(wxT(":")), true, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL); S.SetStyle(wxSL_HORIZONTAL); - mLineTimeSlider = S.Id(ID_LINETIME).AddSlider(wxT(""), + mLineTimeSlider = S.Id(ID_LINETIME).AddSlider(wxT(""), /*pos*/ (int) (p.mLineTime * 100 + 0.5), /*max*/ 500); mLineTimeSlider->SetName(_("Line Time")); mLineTimeText = S.AddVariableText(SA_DFT_LINE_TIME_TEXT, true, wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL); /* i18n-hint: The English would be clearer if it had 'Duration' rather than 'Time' - This is a new experimental effect, and until we have it documented in the user + This is a new experimental effect, and until we have it documented in the user manual we don't have a clear description of what this parameter does. It is OK to leave it in English. */ mSmoothTimeLabel = S.AddVariableText(_("Smooth Time")+wxString(wxT(":")), true, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL); S.SetStyle(wxSL_HORIZONTAL); - mSmoothTimeSlider = S.Id(ID_SMOOTHTIME).AddSlider(wxT(""), + mSmoothTimeSlider = S.Id(ID_SMOOTHTIME).AddSlider(wxT(""), /*pos*/ (int) (p.mSmoothTime * 100 + 0.5), /*max*/ 500); mSmoothTimeSlider->SetName(_("Smooth Time")); mSmoothTimeText = S.AddVariableText(SA_DFT_SMOOTH_TIME_TEXT, true, @@ -195,13 +195,13 @@ ScoreAlignDialog::ScoreAlignDialog(wxWindow *parent, ScoreAlignParams ¶ms) // Retain the settings gPrefs->Write(wxT("/Tracks/Synchronize/FramePeriod"), p.mFramePeriod); gPrefs->Write(wxT("/Tracks/Synchronize/WindowSize"), p.mWindowSize); - gPrefs->Write(wxT("/Tracks/Synchronize/SilenceThreshold"), + gPrefs->Write(wxT("/Tracks/Synchronize/SilenceThreshold"), p.mSilenceThreshold); - gPrefs->Write(wxT("/Tracks/Synchronize/ForceFinalAlignment"), + gPrefs->Write(wxT("/Tracks/Synchronize/ForceFinalAlignment"), p.mForceFinalAlignment); gPrefs->Write(wxT("/Tracks/Synchronize/IgnoreSilence"), p.mIgnoreSilence); - gPrefs->Write(wxT("/Tracks/Synchronize/PresmoothTime"), + gPrefs->Write(wxT("/Tracks/Synchronize/PresmoothTime"), p.mPresmoothTime); gPrefs->Write(wxT("/Tracks/Synchronize/LineTime"), p.mLineTime); gPrefs->Write(wxT("/Tracks/Synchronize/SmoothTime"), p.mSmoothTime); @@ -259,13 +259,13 @@ bool ScoreAlignDialog::TransferDataFromWindow() p.mLineTime = (double) mLineTimeSlider->GetValue() / 100.0; p.mSmoothTime = (double) mSmoothTimeSlider->GetValue() / 100.0; - mFramePeriodText->SetLabel(wxString::Format(_("%.2f secs"), + mFramePeriodText->SetLabel(wxString::Format(_("%.2f secs"), p.mFramePeriod)); mWindowSizeText->SetLabel(wxString::Format(_("%.2f secs"), p.mWindowSize)); mSilenceThresholdText->SetLabel(wxString::Format(_("%.3f"), p.mSilenceThreshold)); - mPresmoothText->SetLabel(p.mPresmoothTime > 0 ? - wxString::Format(_("%.2f secs"), + mPresmoothText->SetLabel(p.mPresmoothTime > 0 ? + wxString::Format(_("%.2f secs"), p.mPresmoothTime) : wxT("(off)")); mLineTimeText->SetLabel(p.mLineTime > 0 ? wxString::Format(_("%.2f secs"), p.mLineTime) : diff --git a/src/effects/Silence.cpp b/src/effects/Silence.cpp index 09f2eb873..1ce811d72 100644 --- a/src/effects/Silence.cpp +++ b/src/effects/Silence.cpp @@ -16,12 +16,12 @@ #include "../Audacity.h" -#include +#include -#include -#include -#include -#include +#include +#include +#include +#include #include "Silence.h" #include "../WaveTrack.h" diff --git a/src/effects/Silence.h b/src/effects/Silence.h index 6ccde9a18..cbeb1a133 100644 --- a/src/effects/Silence.h +++ b/src/effects/Silence.h @@ -5,7 +5,7 @@ Silence.h Dominic Mazzoni - + An effect for the "Generator" menu to add silence. **********************************************************************/ @@ -48,10 +48,10 @@ class EffectSilence : public Generator { return wxString(_("Generating Silence")); } - // Useful only after PromptUser values have been set. - virtual wxString GetEffectDescription() { - return wxString::Format(_("Applied effect: Generate Silence, %.6lf seconds"), mDuration); - } + // Useful only after PromptUser values have been set. + virtual wxString GetEffectDescription() { + return wxString::Format(_("Applied effect: Generate Silence, %.6lf seconds"), mDuration); + } virtual bool PromptUser(); protected: diff --git a/src/effects/SimpleMono.cpp b/src/effects/SimpleMono.cpp index f0c886c2c..72f8d33a1 100644 --- a/src/effects/SimpleMono.cpp +++ b/src/effects/SimpleMono.cpp @@ -11,8 +11,8 @@ \brief An abstract Effect class that simplifies the implementation of a basic monaural effect. Inherit from it if your effect just modifies a single track in place and doesn't care how many samples - it gets at a time. - + it gets at a time. + Your derived class only needs to implement GetEffectName, GetEffectAction, and ProcessSimpleMono. @@ -52,7 +52,7 @@ bool EffectSimpleMono::Process() //Transform the marker timepoints to samples sampleCount start = pOutWaveTrack->TimeToLongSamples(mCurT0); sampleCount end = pOutWaveTrack->TimeToLongSamples(mCurT1); - + //Get the track rate and samples mCurRate = pOutWaveTrack->GetRate(); mCurChannel = pOutWaveTrack->GetChannel(); @@ -65,13 +65,13 @@ bool EffectSimpleMono::Process() break; } } - + //Iterate to the next track pOutWaveTrack = (WaveTrack*)(iter.Next()); mCurTrackNum++; } - this->ReplaceProcessedTracks(bGoodResult); + this->ReplaceProcessedTracks(bGoodResult); return bGoodResult; } @@ -84,7 +84,7 @@ bool EffectSimpleMono::ProcessOne(WaveTrack * track, sampleCount s; //Get the length of the buffer (as double). len is //used simple to calculate a progress meter, so it is easier - //to make it a double now than it is to do it later + //to make it a double now than it is to do it later double len = (double)(end - start); //Initiate a processing buffer. This buffer will (most likely) @@ -113,7 +113,7 @@ bool EffectSimpleMono::ProcessOne(WaveTrack * track, return false; } - //Processing succeeded. copy the newly-changed samples back + //Processing succeeded. copy the newly-changed samples back //onto the track. track->Set((samplePtr) buffer, floatSample, s, block); diff --git a/src/effects/SimpleMono.h b/src/effects/SimpleMono.h index 8fdfa2f02..a308bdf3e 100644 --- a/src/effects/SimpleMono.h +++ b/src/effects/SimpleMono.h @@ -29,7 +29,7 @@ class EffectSimpleMono:public Effect { private: bool ProcessOne(WaveTrack * t, sampleCount start, sampleCount end); - protected: + protected: // Override this method if you need to do things // before every track (including the first one) diff --git a/src/effects/SoundTouchEffect.cpp b/src/effects/SoundTouchEffect.cpp index d03596ab8..5c6489836 100644 --- a/src/effects/SoundTouchEffect.cpp +++ b/src/effects/SoundTouchEffect.cpp @@ -57,7 +57,7 @@ bool EffectSoundTouch::Process() if (mT1 == GetTimeWarper()->Warp(mT1)) { mustSync = false; } - + //Iterate over each track // Needs Track::All for sync-lock grouping. this->CopyInputTracks(Track::All); @@ -70,7 +70,7 @@ bool EffectSoundTouch::Process() t = iter.First(); while (t != NULL) { - if (t->GetKind() == Track::Label && + if (t->GetKind() == Track::Label && (t->GetSelected() || (mustSync && t->IsSyncLockSelected())) ) { if (!ProcessLabelTrack(t)) @@ -80,7 +80,7 @@ bool EffectSoundTouch::Process() } } #ifdef USE_MIDI - else if (t->GetKind() == Track::Note && + else if (t->GetKind() == Track::Note && (t->GetSelected() || (mustSync && t->IsSyncLockSelected()))) { if (!ProcessNoteTrack(t)) @@ -96,16 +96,16 @@ bool EffectSoundTouch::Process() //Get start and end times from track mCurT0 = leftTrack->GetStartTime(); mCurT1 = leftTrack->GetEndTime(); - + //Set the current bounds to whichever left marker is //greater and whichever right marker is less mCurT0 = wxMax(mT0, mCurT0); mCurT1 = wxMin(mT1, mCurT1); - + // Process only if the right marker is to the right of the left marker if (mCurT1 > mCurT0) { sampleCount start, end; - + if (leftTrack->GetLinked()) { double t; WaveTrack* rightTrack = (WaveTrack*)(iter.Next()); @@ -159,11 +159,11 @@ bool EffectSoundTouch::Process() } if (bGoodResult) - ReplaceProcessedTracks(bGoodResult); + ReplaceProcessedTracks(bGoodResult); delete mSoundTouch; mSoundTouch = NULL; - + // mT0 = mCurT0; // mT1 = mCurT0 + m_maxNewLength; // Update selection. @@ -177,37 +177,37 @@ bool EffectSoundTouch::ProcessOne(WaveTrack *track, { WaveTrack *outputTrack; sampleCount s; - + mSoundTouch->setSampleRate((unsigned int)(track->GetRate()+0.5)); - + outputTrack = mFactory->NewWaveTrack(track->GetSampleFormat(), track->GetRate()); - + //Get the length of the buffer (as double). len is //used simple to calculate a progress meter, so it is easier - //to make it a double now than it is to do it later + //to make it a double now than it is to do it later double len = (double)(end - start); - + //Initiate a processing buffer. This buffer will (most likely) //be shorter than the length of the track being processed. float *buffer = new float[track->GetMaxBlockSize()]; - + //Go through the track one buffer at a time. s counts which //sample the current buffer starts at. s = start; while (s < end) { //Get a block of samples (smaller than the size of the buffer) sampleCount block = track->GetBestBlockSize(s); - + //Adjust the block size if it is the final block in the track if (s + block > end) block = end - s; - + //Get the samples from the track and put them in the buffer track->Get((samplePtr) buffer, floatSample, s, block); - + //Add samples to SoundTouch mSoundTouch->putSamples(buffer, block); - + //Get back samples from SoundTouch unsigned int outputCount = mSoundTouch->numSamples(); if (outputCount > 0) { @@ -216,18 +216,18 @@ bool EffectSoundTouch::ProcessOne(WaveTrack *track, outputTrack->Append((samplePtr)buffer2, floatSample, outputCount); delete[] buffer2; } - + //Increment s one blockfull of samples s += block; - + //Update the Progress meter if (TrackProgress(mCurTrackNum, (s - start) / len)) return false; } - + // Tell SoundTouch to finish processing any remaining samples mSoundTouch->flush(); // this should only be used for changeTempo - it dumps data otherwise with pRateTransposer->clear(); - + unsigned int outputCount = mSoundTouch->numSamples(); if (outputCount > 0) { float *buffer2 = new float[outputCount]; @@ -235,117 +235,117 @@ bool EffectSoundTouch::ProcessOne(WaveTrack *track, outputTrack->Append((samplePtr)buffer2, floatSample, outputCount); delete[] buffer2; } - + // Flush the output WaveTrack (since it's buffered, too) outputTrack->Flush(); - + // Clean up the buffer delete[]buffer; - + // Take the output track and insert it in place of the original // sample data track->ClearAndPaste(mCurT0, mCurT1, outputTrack, true, false, GetTimeWarper()); - - double newLength = outputTrack->GetEndTime(); + + double newLength = outputTrack->GetEndTime(); m_maxNewLength = wxMax(m_maxNewLength, newLength); - + // Delete the outputTrack now that its data is inserted in place delete outputTrack; - + //Return true because the effect processing succeeded. return true; } -bool EffectSoundTouch::ProcessStereo(WaveTrack* leftTrack, WaveTrack* rightTrack, +bool EffectSoundTouch::ProcessStereo(WaveTrack* leftTrack, WaveTrack* rightTrack, sampleCount start, sampleCount end) { mSoundTouch->setSampleRate((unsigned int)(leftTrack->GetRate()+0.5)); - + WaveTrack* outputLeftTrack = mFactory->NewWaveTrack(leftTrack->GetSampleFormat(), leftTrack->GetRate()); WaveTrack* outputRightTrack = mFactory->NewWaveTrack(rightTrack->GetSampleFormat(), rightTrack->GetRate()); - + //Get the length of the buffer (as double). len is //used simple to calculate a progress meter, so it is easier - //to make it a double now than it is to do it later + //to make it a double now than it is to do it later double len = (double)(end - start); - + //Initiate a processing buffer. This buffer will (most likely) //be shorter than the length of the track being processed. - // Make soundTouchBuffer twice as big as MaxBlockSize for each channel, - // because Soundtouch wants them interleaved, i.e., each - // Soundtouch sample is left-right pair. + // Make soundTouchBuffer twice as big as MaxBlockSize for each channel, + // because Soundtouch wants them interleaved, i.e., each + // Soundtouch sample is left-right pair. sampleCount maxBlockSize = leftTrack->GetMaxBlockSize(); float* leftBuffer = new float[maxBlockSize]; float* rightBuffer = new float[maxBlockSize]; float* soundTouchBuffer = new float[maxBlockSize * 2]; - - // Go through the track one stereo buffer at a time. - // sourceSampleCount counts the sample at which the current buffer starts, + + // Go through the track one stereo buffer at a time. + // sourceSampleCount counts the sample at which the current buffer starts, // per channel. sampleCount sourceSampleCount = start; while (sourceSampleCount < end) { //Get a block of samples (smaller than the size of the buffer) sampleCount blockSize = leftTrack->GetBestBlockSize(sourceSampleCount); - + //Adjust the block size if it is the final block in the track if (sourceSampleCount + blockSize > end) blockSize = end - sourceSampleCount; - + // Get the samples from the tracks and put them in the buffers. leftTrack->Get((samplePtr)(leftBuffer), floatSample, sourceSampleCount, blockSize); rightTrack->Get((samplePtr)(rightBuffer), floatSample, sourceSampleCount, blockSize); - + // Interleave into soundTouchBuffer. for (int index = 0; index < blockSize; index++) { soundTouchBuffer[index*2] = leftBuffer[index]; soundTouchBuffer[(index*2)+1] = rightBuffer[index]; } - + //Add samples to SoundTouch mSoundTouch->putSamples(soundTouchBuffer, blockSize); - + //Get back samples from SoundTouch unsigned int outputCount = mSoundTouch->numSamples(); - if (outputCount > 0) + if (outputCount > 0) this->ProcessStereoResults(outputCount, outputLeftTrack, outputRightTrack); - + //Increment sourceSampleCount one blockfull of samples sourceSampleCount += blockSize; - + //Update the Progress meter - // mCurTrackNum is left track. Include right track. + // mCurTrackNum is left track. Include right track. int nWhichTrack = mCurTrackNum; double frac = (sourceSampleCount - start) / len; if (frac < 0.5) - frac *= 2.0; // Show twice as far for each track, because we're doing 2 at once. - else + frac *= 2.0; // Show twice as far for each track, because we're doing 2 at once. + else { nWhichTrack++; frac -= 0.5; - frac *= 2.0; // Show twice as far for each track, because we're doing 2 at once. + frac *= 2.0; // Show twice as far for each track, because we're doing 2 at once. } if (TrackProgress(nWhichTrack, frac)) return false; } - + // Tell SoundTouch to finish processing any remaining samples mSoundTouch->flush(); - + unsigned int outputCount = mSoundTouch->numSamples(); - if (outputCount > 0) + if (outputCount > 0) this->ProcessStereoResults(outputCount, outputLeftTrack, outputRightTrack); - + // Flush the output WaveTracks (since they're buffered, too) outputLeftTrack->Flush(); outputRightTrack->Flush(); - + // Clean up the buffers. delete [] leftBuffer; delete [] rightBuffer; delete [] soundTouchBuffer; - + // Take the output tracks and insert in place of the original // sample data. leftTrack->ClearAndPaste(mCurT0, mCurT1, outputLeftTrack, true, false, GetTimeWarper()); @@ -356,22 +356,22 @@ bool EffectSoundTouch::ProcessStereo(WaveTrack* leftTrack, WaveTrack* rightTrack m_maxNewLength = wxMax(m_maxNewLength, newLength); newLength = outputRightTrack->GetEndTime(); m_maxNewLength = wxMax(m_maxNewLength, newLength); - + // Delete the outputTracks now that their data are inserted in place. delete outputLeftTrack; delete outputRightTrack; - + //Return true because the effect processing succeeded. return true; } -bool EffectSoundTouch::ProcessStereoResults(const unsigned int outputCount, - WaveTrack* outputLeftTrack, +bool EffectSoundTouch::ProcessStereoResults(const unsigned int outputCount, + WaveTrack* outputLeftTrack, WaveTrack* outputRightTrack) { float* outputSoundTouchBuffer = new float[outputCount*2]; mSoundTouch->receiveSamples(outputSoundTouchBuffer, outputCount); - + // Dis-interleave outputSoundTouchBuffer into separate track buffers. float* outputLeftBuffer = new float[outputCount]; float* outputRightBuffer = new float[outputCount]; @@ -380,14 +380,14 @@ bool EffectSoundTouch::ProcessStereoResults(const unsigned int outputCount, outputLeftBuffer[index] = outputSoundTouchBuffer[index*2]; outputRightBuffer[index] = outputSoundTouchBuffer[(index*2)+1]; } - + outputLeftTrack->Append((samplePtr)outputLeftBuffer, floatSample, outputCount); outputRightTrack->Append((samplePtr)outputRightBuffer, floatSample, outputCount); - + delete[] outputSoundTouchBuffer; delete[] outputLeftBuffer; delete[] outputRightBuffer; - + return true; } diff --git a/src/effects/SoundTouchEffect.h b/src/effects/SoundTouchEffect.h index 195981ad3..efbd5c44b 100644 --- a/src/effects/SoundTouchEffect.h +++ b/src/effects/SoundTouchEffect.h @@ -19,7 +19,7 @@ #include "Effect.h" -// Soundtouch defines these as well, so get rid of them before including +// Soundtouch defines these as well, so get rid of them before including #undef PACKAGE_NAME #undef PACKAGE_STRING #undef PACKAGE_TARNAME @@ -52,10 +52,10 @@ class EffectSoundTouch:public Effect { bool ProcessNoteTrack(Track *track); #endif bool ProcessOne(WaveTrack * t, sampleCount start, sampleCount end); - bool ProcessStereo(WaveTrack* leftTrack, WaveTrack* rightTrack, + bool ProcessStereo(WaveTrack* leftTrack, WaveTrack* rightTrack, sampleCount start, sampleCount end); - bool ProcessStereoResults(const unsigned int outputCount, - WaveTrack* outputLeftTrack, + bool ProcessStereoResults(const unsigned int outputCount, + WaveTrack* outputLeftTrack, WaveTrack* outputRightTrack); int mCurTrackNum; diff --git a/src/effects/StereoToMono.cpp b/src/effects/StereoToMono.cpp index c99786f1d..c0d3cdc4e 100644 --- a/src/effects/StereoToMono.cpp +++ b/src/effects/StereoToMono.cpp @@ -154,7 +154,7 @@ bool EffectStereoToMono::Process() refreshIter = true; } } - + if (refreshIter) { mLeftTrack = (WaveTrack *)iter.First(); refreshIter = false; @@ -167,6 +167,6 @@ bool EffectStereoToMono::Process() if(mOutTrack) delete mOutTrack; - this->ReplaceProcessedTracks(bGoodResult); + this->ReplaceProcessedTracks(bGoodResult); return bGoodResult; } diff --git a/src/effects/TimeScale.cpp b/src/effects/TimeScale.cpp index 2763bcf27..98be6767e 100644 --- a/src/effects/TimeScale.cpp +++ b/src/effects/TimeScale.cpp @@ -7,7 +7,7 @@ Clayton Otey *******************************************************************//** - + \class EffectTimeScale \brief An EffectTimeScale does high quality sliding time scaling/pitch shifting @@ -50,10 +50,10 @@ EffectTimeScale::EffectTimeScale() m_PreAnalyze = false; } -wxString EffectTimeScale::GetEffectDescription() { - // Note: This is useful only after change amount has been set. - return wxString::Format(_("Applied effect: %s"), this->GetEffectName().c_str()); -} +wxString EffectTimeScale::GetEffectDescription() { + // Note: This is useful only after change amount has been set. + return wxString::Format(_("Applied effect: %s"), this->GetEffectName().c_str()); +} bool EffectTimeScale::Init() { @@ -71,16 +71,16 @@ bool EffectTimeScale::PromptUser() dlog.m_PitchPercentChangeEnd = m_PitchPercentChangeEnd; dlog.m_PreAnalyze = m_PreAnalyze; - // Don't need to call TransferDataToWindow, although other - // Audacity dialogs (from which I derived this one) do it, because - // ShowModal calls stuff that eventually calls wxWindowBase::OnInitDialog, + // Don't need to call TransferDataToWindow, although other + // Audacity dialogs (from which I derived this one) do it, because + // ShowModal calls stuff that eventually calls wxWindowBase::OnInitDialog, // which calls dlog.TransferDataToWindow(); dlog.CentreOnParent(); dlog.ShowModal(); if (dlog.GetReturnCode() == wxID_CANCEL) return false; - + m_RatePercentChangeStart = dlog.m_RatePercentChangeStart; m_RatePercentChangeEnd = dlog.m_RatePercentChangeEnd; m_PitchHalfStepsStart = dlog.m_PitchHalfStepsStart; @@ -88,7 +88,7 @@ bool EffectTimeScale::PromptUser() m_PitchPercentChangeStart = dlog.m_PitchPercentChangeStart; m_PitchPercentChangeEnd = dlog.m_PitchPercentChangeEnd; m_PreAnalyze = dlog.m_PreAnalyze; - + return true; } @@ -173,17 +173,17 @@ TimeScaleDialog::TimeScaleDialog(EffectTimeScale *effect, wxWindow *parent) mEffect(effect) { m_bLoopDetect = false; - - // NULL out these control members because there are some cases where the - // event table handlers get called during this method, and those handlers that + + // NULL out these control members because there are some cases where the + // event table handlers get called during this method, and those handlers that // can cause trouble check for NULL. - + m_pTextCtrl_RatePercentChangeStart = NULL; m_pTextCtrl_RatePercentChangeEnd = NULL; m_pSlider_RatePercentChangeStart = NULL; m_pSlider_RatePercentChangeEnd = NULL; m_pTextCtrl_PitchPercentChangeStart = NULL; - m_pTextCtrl_PitchPercentChangeEnd = NULL; + m_pTextCtrl_PitchPercentChangeEnd = NULL; m_pTextCtrl_PitchHalfStepsStart = NULL; m_pTextCtrl_PitchHalfStepsEnd = NULL; m_pCheckBox_PreAnalyze = NULL; @@ -240,7 +240,7 @@ void TimeScaleDialog::PopulateOrExchange(ShuttleGui & S) } S.EndMultiColumn(); S.StartHorizontalLay(wxEXPAND,0); - { + { S.SetStyle(wxSL_HORIZONTAL); m_pSlider_RatePercentChangeEnd = S.Id(ID_SLIDER_RATE_PERCENTCHANGE_END) .AddSlider(wxT(""), (int)RATE_PERCENTCHANGE_DEFAULT, (int)RATE_PERCENTCHANGE_MAX_SLIDER, (int)RATE_PERCENTCHANGE_MIN_SLIDER); @@ -257,7 +257,7 @@ void TimeScaleDialog::PopulateOrExchange(ShuttleGui & S) m_pTextCtrl_PitchHalfStepsStart = S.Id(ID_TEXT_PITCH_HALFSTEPS_START) .AddTextBox(_("(semitones) [-12 to 12]:"), wxT(""), 12); m_pTextCtrl_PitchHalfStepsStart->SetValidator(numvld); - + m_pTextCtrl_PitchPercentChangeStart = S.Id(ID_TEXT_PITCH_PERCENTCHANGE_START) .AddTextBox(_("(%) [-50 to 100]:"), wxT(""), 12); m_pTextCtrl_PitchPercentChangeStart->SetValidator(numvld); @@ -274,7 +274,7 @@ void TimeScaleDialog::PopulateOrExchange(ShuttleGui & S) m_pTextCtrl_PitchHalfStepsEnd = S.Id(ID_TEXT_PITCH_HALFSTEPS_END) .AddTextBox(_("(semitones) [-12 to 12]:"), wxT(""), 12); m_pTextCtrl_PitchHalfStepsEnd->SetValidator(numvld); - + m_pTextCtrl_PitchPercentChangeEnd = S.Id(ID_TEXT_PITCH_PERCENTCHANGE_END) .AddTextBox(_("(%) [-50 to 100]:"), wxT(""), 12); m_pTextCtrl_PitchPercentChangeEnd->SetValidator(numvld); @@ -302,7 +302,7 @@ bool TimeScaleDialog::TransferDataToWindow() this->Update_CheckBox_PreAnalyze(); m_bLoopDetect = false; - + return true; } @@ -361,12 +361,12 @@ bool TimeScaleDialog::TransferDataFromWindow() bool TimeScaleDialog::CheckParameters() { - return - (m_RatePercentChangeStart >= RATE_PERCENTCHANGE_MIN_TEXT && - m_RatePercentChangeStart <= RATE_PERCENTCHANGE_MAX_TEXT) + return + (m_RatePercentChangeStart >= RATE_PERCENTCHANGE_MIN_TEXT && + m_RatePercentChangeStart <= RATE_PERCENTCHANGE_MAX_TEXT) && - (m_RatePercentChangeEnd >= RATE_PERCENTCHANGE_MIN_TEXT && - m_RatePercentChangeEnd <= RATE_PERCENTCHANGE_MAX_TEXT) + (m_RatePercentChangeEnd >= RATE_PERCENTCHANGE_MIN_TEXT && + m_RatePercentChangeEnd <= RATE_PERCENTCHANGE_MAX_TEXT) && (m_PitchHalfStepsStart >= PITCH_HALFSTEPS_MIN_TEXT && m_PitchHalfStepsStart <= PITCH_HALFSTEPS_MAX_TEXT) @@ -416,7 +416,7 @@ void TimeScaleDialog::OnText_RatePercentChangeEnd(wxCommandEvent & WXUNUSED(even m_bLoopDetect = true; this->Update_Slider_RatePercentChangeEnd(); m_bLoopDetect = false; - + FindWindow(wxID_OK)->Enable(CheckParameters()); } } @@ -427,8 +427,8 @@ void TimeScaleDialog::OnSlider_RatePercentChangeStart(wxCommandEvent & WXUNUSED( return; if (m_pSlider_RatePercentChangeStart) { - m_RatePercentChangeStart = (double)(m_pSlider_RatePercentChangeStart->GetValue()); - + m_RatePercentChangeStart = (double)(m_pSlider_RatePercentChangeStart->GetValue()); + m_bLoopDetect = true; this->Update_Text_RatePercentChangeStart(); m_bLoopDetect = false; @@ -441,8 +441,8 @@ void TimeScaleDialog::OnSlider_RatePercentChangeEnd(wxCommandEvent & WXUNUSED(ev return; if (m_pSlider_RatePercentChangeEnd) { - m_RatePercentChangeEnd = (double)(m_pSlider_RatePercentChangeEnd->GetValue()); - + m_RatePercentChangeEnd = (double)(m_pSlider_RatePercentChangeEnd->GetValue()); + m_bLoopDetect = true; this->Update_Text_RatePercentChangeEnd(); m_bLoopDetect = false; @@ -460,11 +460,11 @@ void TimeScaleDialog::OnText_PitchHalfStepsStart(wxCommandEvent & WXUNUSED(event str.ToDouble(&newValue); m_PitchHalfStepsStart = newValue; m_PitchPercentChangeStart = HalfStepsToPercentChange(newValue); - + m_bLoopDetect = true; this->Update_Text_PitchPercentChangeStart(); m_bLoopDetect = false; - + FindWindow(wxID_OK)->Enable(CheckParameters()); } } @@ -500,11 +500,11 @@ void TimeScaleDialog::OnText_PitchPercentChangeStart(wxCommandEvent & WXUNUSED(e str.ToDouble(&newValue); m_PitchPercentChangeStart = newValue; m_PitchHalfStepsStart = PercentChangeToHalfSteps(newValue); - + m_bLoopDetect = true; this->Update_Text_PitchHalfStepsStart(); m_bLoopDetect = false; - + FindWindow(wxID_OK)->Enable(CheckParameters()); } } @@ -557,14 +557,14 @@ void TimeScaleDialog::Update_Text_RatePercentChangeEnd() void TimeScaleDialog::Update_Slider_RatePercentChangeStart() { if (m_pSlider_RatePercentChangeStart) { - m_pSlider_RatePercentChangeStart->SetValue((int)(m_RatePercentChangeStart + 0.5)); + m_pSlider_RatePercentChangeStart->SetValue((int)(m_RatePercentChangeStart + 0.5)); } } void TimeScaleDialog::Update_Slider_RatePercentChangeEnd() { if (m_pSlider_RatePercentChangeEnd) { - m_pSlider_RatePercentChangeEnd->SetValue((int)(m_RatePercentChangeEnd + 0.5)); + m_pSlider_RatePercentChangeEnd->SetValue((int)(m_RatePercentChangeEnd + 0.5)); } } diff --git a/src/effects/TimeScale.h b/src/effects/TimeScale.h index 97b4dba49..5bce205ee 100644 --- a/src/effects/TimeScale.h +++ b/src/effects/TimeScale.h @@ -46,16 +46,16 @@ class EffectTimeScale : public EffectSBSMS { virtual wxString GetEffectAction() { return wxString(_("Changing Tempo/Pitch")); } - - // Useful only after PromptUser values have been set. - virtual wxString GetEffectDescription(); + + // Useful only after PromptUser values have been set. + virtual wxString GetEffectDescription(); virtual bool Init(); virtual bool PromptUser(); virtual bool TransferParameters( Shuttle & shuttle ); virtual bool Process(); - + private: double m_RatePercentChangeStart; double m_RatePercentChangeEnd; diff --git a/src/effects/TimeWarper.cpp b/src/effects/TimeWarper.cpp index 3f4cef424..095b9e8fc 100644 --- a/src/effects/TimeWarper.cpp +++ b/src/effects/TimeWarper.cpp @@ -10,7 +10,7 @@ \file TimeWarper.cpp \brief Contains definitions for IdentityTimeWarper, ShiftTimeWarper, -LinearTimeWarper, LogarithmicTimeWarper, QuadraticTimeWarper, +LinearTimeWarper, LogarithmicTimeWarper, QuadraticTimeWarper, Geometric TimeWarper classes *//*******************************************************************/ @@ -57,8 +57,8 @@ double LinearOutputRateTimeWarper::Warp(double originalTime) const LinearOutputRateTimeWarper::LinearOutputRateTimeWarper(double tStart, double tEnd, double rStart, double rEnd) -: mTimeWarper(tStart, 0.0, tEnd, 1.0), - mRStart(rStart), mTStart(tStart), +: mTimeWarper(tStart, 0.0, tEnd, 1.0), + mRStart(rStart), mTStart(tStart), mScale(2.0*(tEnd-tStart)/(rEnd*rEnd-rStart*rStart)), mC1(rStart*rStart), mC2(rEnd*rEnd-rStart*rStart) { @@ -76,7 +76,7 @@ double LinearInputStretchTimeWarper::Warp(double originalTime) const LinearInputStretchTimeWarper::LinearInputStretchTimeWarper(double tStart, double tEnd, double rStart, double rEnd) -: mTimeWarper(tStart, 0.0, tEnd, 1.0), mTStart(tStart), +: mTimeWarper(tStart, 0.0, tEnd, 1.0), mTStart(tStart), mC1((tEnd-tStart)/rStart), mC2(0.5*(rStart/rEnd - 1.0)) { wxASSERT(rStart > 0.0); @@ -92,7 +92,7 @@ double LinearOutputStretchTimeWarper::Warp(double originalTime) const LinearOutputStretchTimeWarper::LinearOutputStretchTimeWarper(double tStart, double tEnd, double rStart, double rEnd) -: mTimeWarper(tStart, 0.0, tEnd, 1.0), mTStart(tStart), +: mTimeWarper(tStart, 0.0, tEnd, 1.0), mTStart(tStart), mC1((tEnd-tStart)/(rStart*log(rStart/rEnd))), mC2(rStart/rEnd) { wxASSERT(rStart != rEnd); diff --git a/src/effects/TimeWarper.h b/src/effects/TimeWarper.h index fddba702e..a056468cf 100644 --- a/src/effects/TimeWarper.h +++ b/src/effects/TimeWarper.h @@ -114,7 +114,7 @@ class LinearOutputRateTimeWarper : public TimeWarper private: LinearTimeWarper mTimeWarper; double mRStart; - double mTStart; + double mTStart; double mScale; double mC1; double mC2; diff --git a/src/effects/ToneGen.cpp b/src/effects/ToneGen.cpp index 4072b778f..9e02059b3 100644 --- a/src/effects/ToneGen.cpp +++ b/src/effects/ToneGen.cpp @@ -54,14 +54,14 @@ EffectToneGen::EffectToneGen() interpolation = 0; } -wxString EffectToneGen::GetEffectDescription() { - // Note: This is useful only after values have been set. +wxString EffectToneGen::GetEffectDescription() { + // Note: This is useful only after values have been set. /// \todo update to include *all* chirp parameters?? const wxChar* waveformNames[] = {wxT("sine"), wxT("square"), wxT("sawtooth"), wxT("square, no alias")}; //const wxChar* interpolationNames[] = {wxT("linear"), wxT("logarithmic")}; - return wxString::Format(_("Applied effect: Generate %s wave %s, frequency = %.2f Hz, amplitude = %.2f, %.6lf seconds"), + return wxString::Format(_("Applied effect: Generate %s wave %s, frequency = %.2f Hz, amplitude = %.2f, %.6lf seconds"), waveformNames[waveform], mbChirp ? wxT("chirp") : wxT("tone"), frequency[0], amplitude[0], mDuration); -} +} bool EffectToneGen::PromptUser() { @@ -124,7 +124,7 @@ bool EffectToneGen::PromptUser() when user explicitly set up a value */ if (mT1 == mT0) // ANSWER ME: Only if end time equals start time? { - return (gPrefs->Write(wxT("/Effects/ToneGen/Duration"), mDuration) && + return (gPrefs->Write(wxT("/Effects/ToneGen/Duration"), mDuration) && gPrefs->Flush()); } return true; @@ -264,15 +264,15 @@ void ToneGenDialog::PopulateOrExchangeStandard( ShuttleGui & S ) S.TieChoice(_("Waveform") + wxString(wxT(":")), waveform, waveforms); S.SetSizeHints(-1, -1); - // The added colon to improve visual consistency was placed outside - // the translatable strings to avoid breaking translations close to 2.0. + // The added colon to improve visual consistency was placed outside + // the translatable strings to avoid breaking translations close to 2.0. // TODO: Make colon part of the translatable string after 2.0. S.TieNumericTextBox(_("Frequency (Hz)") + wxString(wxT(":")), frequency[0], 5); S.TieNumericTextBox(_("Amplitude (0-1)") + wxString(wxT(":")), amplitude[0], 5); S.AddPrompt(_("Duration") + wxString(wxT(":"))); if (mToneDurationT == NULL) { - mToneDurationT = + mToneDurationT = new TimeTextCtrl(this, wxID_ANY, isSelection ? _("hh:mm:ss + samples") : _("hh:mm:ss + milliseconds"), @@ -304,8 +304,8 @@ void ToneGenDialog::PopulateOrExchangeExtended( ShuttleGui & S ) S.AddTitle(_("Start")); S.AddTitle(_("End")); - // The added colon to improve visual consistency was placed outside - // the translatable strings to avoid breaking translations close to 2.0. + // The added colon to improve visual consistency was placed outside + // the translatable strings to avoid breaking translations close to 2.0. // TODO: Make colon part of the translatable string after 2.0. S.TieNumericTextBox(_("Frequency (Hz)") + wxString(wxT(":")), frequency[0], 10)->SetName(_("Frequency Hertz Start")); S.TieNumericTextBox(wxT(""), frequency[1], 10)->SetName(_("Frequency Hertz End")); diff --git a/src/effects/ToneGen.h b/src/effects/ToneGen.h index c1cb327d5..5257be0c5 100644 --- a/src/effects/ToneGen.h +++ b/src/effects/ToneGen.h @@ -55,7 +55,7 @@ class EffectToneGen : public BlockGenerator { } // Useful only after PromptUser values have been set. - virtual wxString GetEffectDescription(); + virtual wxString GetEffectDescription(); virtual bool PromptUser(); virtual bool TransferParameters( Shuttle & shuttle ); @@ -74,7 +74,7 @@ class EffectToneGen : public BlockGenerator { double mPositionInCycles; - // If we made these static variables, + // If we made these static variables, // Tone and Chirp would share the same parameters. int waveform; float frequency[2]; diff --git a/src/effects/TruncSilence.cpp b/src/effects/TruncSilence.cpp index 450861e2d..b6cf9539a 100644 --- a/src/effects/TruncSilence.cpp +++ b/src/effects/TruncSilence.cpp @@ -10,7 +10,7 @@ *******************************************************************//** \class EffectTruncSilence -\brief Truncate Silence automatically reduces the length of passages +\brief Truncate Silence automatically reduces the length of passages where the volume is below a set threshold level. \todo mBlendFrameCount only retrieved from prefs ... not using dialog @@ -56,7 +56,7 @@ bool EffectTruncSilence::Init() if ((mProcessIndex < 0) || (mProcessIndex > 1)) { // corrupted Prefs? mProcessIndex = 0L; gPrefs->Write(wxT("/Effects/TruncateSilence/ProcessChoice"), 0L); - } + } gPrefs->Read(wxT("/Effects/TruncateSilence/InitialAllowedSilence"), &mInitialAllowedSilence, 0.5); if ((mInitialAllowedSilence < 0.001) || (mInitialAllowedSilence > 10000.0)) { // corrupted Prefs? mInitialAllowedSilence = 0.5; @@ -106,7 +106,7 @@ bool EffectTruncSilence::PromptUser() } bool EffectTruncSilence::TransferParameters( Shuttle & shuttle ) -{ +{ shuttle.TransferEnum(wxT("Db"), mTruncDbChoiceIndex, Enums::NumDbChoices, Enums::GetDbChoices()); shuttle.TransferInt(wxT("Action"), mProcessIndex, 0); shuttle.TransferDouble(wxT("Minimum"), mInitialAllowedSilence, 0.5); @@ -147,7 +147,7 @@ bool EffectTruncSilence::Process() WaveTrack *wt = (WaveTrack *)t; // Smallest silent region to detect in frames - sampleCount minSilenceFrames = + sampleCount minSilenceFrames = sampleCount(wxMax( mInitialAllowedSilence, minTruncMs) * wt->GetRate()); @@ -173,7 +173,7 @@ bool EffectTruncSilence::Process() while (index < end) { // Show progress dialog, test for cancellation cancelled = TotalProgress( - detectFrac * (whichTrack + index / (double)end) / + detectFrac * (whichTrack + index / (double)end) / (double)GetNumWaveTracks()); if (cancelled) break; @@ -243,7 +243,7 @@ bool EffectTruncSilence::Process() delete [] buffer; // Buffer has been freed, so we're OK to return if cancelled - if (cancelled) + if (cancelled) { ReplaceProcessedTracks(false); return false; @@ -389,7 +389,7 @@ void EffectTruncSilence::Intersect(RegionList &dest, const RegionList &src) bool lastRun = false; // must run the loop one extra time RegionList::const_iterator srcIter = src.begin(); - + // This logic, causing the loop to run once after end of src, must occur // each time srcIter is updated if (srcIter == src.end()) { @@ -436,7 +436,7 @@ void EffectTruncSilence::Intersect(RegionList &dest, const RegionList &src) // Insert second region after first RegionList::iterator nextIt(destIter); ++nextIt; - + // This should just read: destIter = dest.insert(nextIt, r); but we // work around two two wxList::insert() bugs. First, in some // versions it returns the wrong value. Second, in some versions, @@ -555,7 +555,7 @@ void TruncSilenceDialog::PopulateOrExchange(ShuttleGui & S) } S.EndHorizontalLay(); - + S.StartStatic(_("Detect Silence")); { S.StartMultiColumn(3, wxALIGN_CENTER_HORIZONTAL); diff --git a/src/effects/TwoPassSimpleMono.cpp b/src/effects/TwoPassSimpleMono.cpp index 87fa7cffe..57fe0bfb8 100644 --- a/src/effects/TwoPassSimpleMono.cpp +++ b/src/effects/TwoPassSimpleMono.cpp @@ -8,7 +8,7 @@ *******************************************************************//** \class EffectTwoPassSimpleMono -\brief An Effect base class that implements a two pass process by using +\brief An Effect base class that implements a two pass process by using EffectSimpleMono. Inherit from it if your effect needs to pass twice over the data. @@ -26,19 +26,19 @@ bool EffectTwoPassSimpleMono::Process() { mPass = 0; mSecondPassDisabled = false; - + InitPass1(); this->CopyInputTracks(); // Set up mOutputTracks. bool bGoodResult = ProcessPass(); - + if (bGoodResult && !mSecondPassDisabled) { mPass = 1; if (InitPass2()) bGoodResult = ProcessPass(); } - - this->ReplaceProcessedTracks(bGoodResult); + + this->ReplaceProcessedTracks(bGoodResult); return bGoodResult; } @@ -64,7 +64,7 @@ bool EffectTwoPassSimpleMono::ProcessPass() //Transform the marker timepoints to samples sampleCount start = track->TimeToLongSamples(mCurT0); sampleCount end = track->TimeToLongSamples(mCurT1); - + //Get the track rate and samples mCurRate = track->GetRate(); mCurChannel = track->GetChannel(); @@ -82,7 +82,7 @@ bool EffectTwoPassSimpleMono::ProcessPass() if (!ProcessOne(track, start, end)) return false; } - + //Iterate to the next track track = (WaveTrack *) iter.Next(); mCurTrackNum++; diff --git a/src/effects/TwoPassSimpleMono.h b/src/effects/TwoPassSimpleMono.h index dd75ab287..fbbbec7da 100644 --- a/src/effects/TwoPassSimpleMono.h +++ b/src/effects/TwoPassSimpleMono.h @@ -27,14 +27,14 @@ class EffectTwoPassSimpleMono:public Effect { sampleCount start, sampleCount end); bool ProcessPass(); - protected: + protected: // Override these methods if you need to initialize something // before each pass. Return None if processing should stop. // These should not depend on mOutputTracks having been set up via CopyInputTracks(). virtual bool InitPass1(); virtual bool InitPass2(); - + // Override these methods if you need to do things // before every track (including the first one) virtual bool NewTrackPass1(); @@ -43,7 +43,7 @@ class EffectTwoPassSimpleMono:public Effect { // Override this method to actually process audio virtual bool ProcessPass1(float * WXUNUSED(buffer), sampleCount WXUNUSED(len)) { return false; } virtual bool ProcessPass2(float * WXUNUSED(buffer), sampleCount WXUNUSED(len)) { return false; } - + // Override this method to actually process audio with access to 2 sequential buffers at a time // Either buffer1 or buffer2 may be modified as needed // This allows implementation of processing with delays diff --git a/src/effects/VST/VSTEffect.cpp b/src/effects/VST/VSTEffect.cpp index d799f1ccf..5f9d52ae2 100644 --- a/src/effects/VST/VSTEffect.cpp +++ b/src/effects/VST/VSTEffect.cpp @@ -5,7 +5,7 @@ VSTEffect.cpp Dominic Mazzoni - + This class implements a VST Plug-in effect. The plug-in must be loaded in a platform-specific way and passed into the constructor, but from here this class handles the interfacing. VST plug-ins @@ -114,7 +114,7 @@ void RegisterVSTEffects() #endif em.RegisterEffect(new VSTEffect(path)); } - + path = pm.GetNextPlugin(VSTPLUGINTYPE); } @@ -529,7 +529,7 @@ void PluginRegistrationDialog::PopulateOrExchange(ShuttleGui &S) S.StartVerticalLay(true); { - /*i18n-hint: The dialog shows a list of plugins with check-boxes + /*i18n-hint: The dialog shows a list of plugins with check-boxes beside each one.*/ S.StartStatic(_("&Select Plug-ins to Install or press ENTER to Install All"), true); { @@ -595,14 +595,14 @@ void PluginRegistrationDialog::PopulateOrExchange(ShuttleGui &S) mPlugins->InsertItem( i, name, SHOW_CHECKED ); mPlugins->SetItem( i, COL_PATH, path ); - // Only need to get the icon width once + // Only need to get the icon width once if (i == 0) { #if defined(__WXMAC__) // wxMac doesn't return the ICON rectangle. It returns the // rectangle for the first column and that even comes back // with negative numbers sometimes. - // + // // So, just guess. wxIcon i1(unchecked_xpm); wxIcon i2(checked_xpm); @@ -803,14 +803,14 @@ void VSTEffectSettingsDialog::PopulateOrExchange(ShuttleGui & S) { wxIntegerValidator vld(&mBufferSize); vld.SetRange(8, 1048576 * 1); - + S.AddVariableText(wxString() + _("The buffer size controls the number of samples sent to the effect ") + _("on each iteration. Smaller values will cause slower processing and ") + _("some effects require 8192 samples or less to work properly. However ") + _("most effects can accept large buffers and using them will greatly ") + _("reduce processing time."))->Wrap(650); - + S.StartHorizontalLay(wxALIGN_LEFT); { wxTextCtrl *t; @@ -823,7 +823,7 @@ void VSTEffectSettingsDialog::PopulateOrExchange(ShuttleGui & S) S.EndHorizontalLay(); } S.EndStatic(); - + S.StartStatic(_("Buffer Delay Compensation")); { S.AddVariableText(wxString() + @@ -832,7 +832,7 @@ void VSTEffectSettingsDialog::PopulateOrExchange(ShuttleGui & S) _("notice that small silences have been inserted into the audio. ") + _("Enabling this setting will provide that compensation, but it may ") + _("not work for all VST effects."))->Wrap(650); - + S.StartHorizontalLay(wxALIGN_LEFT); { S.TieCheckBox(_("Enable &compensation"), wxT("/VST/UseBufferDelay"), true); @@ -840,7 +840,7 @@ void VSTEffectSettingsDialog::PopulateOrExchange(ShuttleGui & S) S.EndHorizontalLay(); } S.EndStatic(); - + S.StartStatic(_("Presentation Method")); { S.AddVariableText(wxString() + @@ -850,7 +850,7 @@ void VSTEffectSettingsDialog::PopulateOrExchange(ShuttleGui & S) S.TieCheckBox(_("Enable &graphical interface"), wxT("/VST/GUI"), true); } S.EndStatic(); - + S.StartStatic(_("Effect Refresh")); { S.AddVariableText(wxString() + @@ -922,7 +922,7 @@ class VSTEffectDialog:public wxDialog, XMLTagHandler void OnSizeWindow(wxCommandEvent & evt); void OnUpdateDisplay(wxCommandEvent & evt); -private: +private: void BuildPlain(); void BuildFancy(); @@ -1227,11 +1227,11 @@ OSStatus VSTEffectDialog::OnWindowEvent(EventHandlerCallRef handler, EventRef ev if (mOverlayRef == mPreviousRef) { mOverlayRef = mWindowRef; } - + if (mOverlayRef != mWindowRef) { // Try again - + // Install the handler mOverlayEventHandlerUPP = NewEventHandlerUPP(OverlayEventHandler); InstallWindowEventHandler(mOverlayRef, @@ -1373,9 +1373,9 @@ VSTEffectDialog::VSTEffectDialog(wxWindow *parent, VSTEffectDialog::~VSTEffectDialog() { RemoveHandler(); - + if (mNames) { - delete [] mNames; + delete [] mNames; } if (mSliders) { @@ -1538,7 +1538,7 @@ void VSTEffectDialog::BuildPlain() // Try to give the window a sensible default/minimum size wxSize sz = GetParent()->GetSize(); sw->SetMinSize(wxSize(wxMax(600, sz.GetWidth() * 2 / 3), sz.GetHeight() / 2)); - + sw->SetScrollRate(0, 20); vSizer->Add(sw, 1, wxEXPAND | wxALL, 5); @@ -1789,7 +1789,7 @@ void VSTEffectDialog::OnProgramText(wxCommandEvent & WXUNUSED(event)) if (ip >= 0) { mProgram->SetInsertionPoint(ip); } - + RefreshParameters(); } @@ -1838,7 +1838,7 @@ void VSTEffectDialog::OnLoad(wxCommandEvent & WXUNUSED(event)) if (!error) error = (buffer[0] != CCONST('C', 'c', 'n', 'K')); ///< 'CcnK' //VstInt32 byteSize; ///< size of this chunk, excl. magic + byteSize - if (!error) { + if (!error) { if (mAEffect->flags & effFlagsProgramChunks) error = (buffer[2] != CCONST('F', 'P', 'C', 'h')); ///< 'FxCk' (regular) or 'FPCh' (opaque chunk) else @@ -1959,7 +1959,7 @@ void VSTEffectDialog::OnSave(wxCommandEvent & WXUNUSED(event)) this); return; } - + buffer[0] = CCONST('C', 'c', 'n', 'K'); // VstInt32 chunkMagic; ///< 'CcnK' buffer[1] = 48; // VstInt32 byteSize; ///< size of this chunk, excl. magic + byteSize if (mAEffect->flags & effFlagsProgramChunks) { ///< 'FxCk' (regular) or 'FPCh' (opaque chunk) @@ -1975,7 +1975,7 @@ void VSTEffectDialog::OnSave(wxCommandEvent & WXUNUSED(event)) buffer[3] = 1; ///< format version (currently 1) buffer[4] = mAEffect->uniqueID; ///< fx unique ID buffer[5] = mEffect->callDispatcher(effGetVendorVersion, 0, 0, NULL, 0.0); ///< fx version - buffer[6] = mAEffect->numParams; + buffer[6] = mAEffect->numParams; // VST always uses Big Endian, convert first for (i = 0; i < 7; i++) @@ -1985,7 +1985,7 @@ void VSTEffectDialog::OnSave(wxCommandEvent & WXUNUSED(event)) memset(buffer, 0, 28); wxConvLocal.FromWChar((char*)buffer, 27, mProgram->GetValue()); if (!error) error = (fwrite(buffer, 1, 28, fxpFile.fp()) < 28); ///< program name (null-terminated ASCII string) - + if (mAEffect->flags & effFlagsProgramChunks) { buffer[0] = wxINT32_SWAP_ON_LE(chunkSize); if (!error) error = !fwrite(buffer, 4, 1, fxpFile.fp()); @@ -2115,7 +2115,7 @@ bool VSTEffectDialog::HandleXMLTag(const wxChar *tag, const wxChar **attrs) while (*attrs) { const wxChar *attr = *attrs++; const wxChar *value = *attrs++; - + if (!value) { break; } @@ -2140,7 +2140,7 @@ bool VSTEffectDialog::HandleXMLTag(const wxChar *tag, const wxChar **attrs) while (*attrs) { const wxChar *attr = *attrs++; const wxChar *value = *attrs++; - + if (!value) { break; } @@ -2174,12 +2174,12 @@ bool VSTEffectDialog::HandleXMLTag(const wxChar *tag, const wxChar **attrs) return true; } - + if (wxStrcmp(tag, wxT("program")) == 0) { while (*attrs) { const wxChar *attr = *attrs++; const wxChar *value = *attrs++; - + if (!value) { break; } @@ -2342,7 +2342,7 @@ wxString VSTEffectDialog::b64encode(const void *in, int len) { unsigned char *p = (unsigned char *) in; wxString out; - + unsigned long temp; for (int i = 0; i < len / 3; i++) { temp = (*p++) << 16; //Convert to big endian @@ -2535,7 +2535,7 @@ static intptr_t audioMaster(AEffect * effect, case audioMasterIdle: wxYieldIfNeeded(); return 1; - + case audioMasterGetCurrentProcessLevel: if (vst) { return vst->GetProcessLevel(); @@ -2746,13 +2746,13 @@ bool VSTEffect::Init() sampleCount llen; GetSamples(left, &lstart, &llen); - + if (left->GetLinked()) { WaveTrack *right = (WaveTrack *) iter.Next(); sampleCount rstart; sampleCount rlen; - GetSamples(right, &rstart, &rlen); + GetSamples(right, &rstart, &rlen); if (left->GetRate() != right->GetRate()) { wxMessageBox(_("Both channels of a stereo track must be the same sample rate.")); @@ -2764,7 +2764,7 @@ bool VSTEffect::Init() return false; } } - + left = (WaveTrack *) iter.Next(); } @@ -2853,7 +2853,7 @@ bool VSTEffect::Process() right = NULL; rstart = 0; if (left->GetLinked() && mInputs > 1) { - right = (WaveTrack *) iter.Next(); + right = (WaveTrack *) iter.Next(); GetSamples(right, &rstart, &len); clear = false; mChannels = 2; @@ -2923,7 +2923,7 @@ bool VSTEffect::Process() mInBuffer = NULL; } - ReplaceProcessedTracks(bGoodResult); + ReplaceProcessedTracks(bGoodResult); return bGoodResult; } @@ -2960,14 +2960,14 @@ bool VSTEffect::ProcessStereo(int count, // samples to the output track which was Michael's speed up mentioned above. // // The buffer delay compensation adds even more complexitity... - // + // // Upon return from the effect, the output samples are "moved to the left" by // the number of samples in the current delay setting, effectively removing the // delay introduced by the effect. // // At the same time the total number of delayed samples are gathered and when the // there is no further input data to process, the loop continues to call the - // effect with an empty input buffer until the effect has had a chance to + // effect with an empty input buffer until the effect has had a chance to // return all of the remaining delayed samples. // // Please note, that this process has next to no documetation on how it should @@ -3095,7 +3095,7 @@ bool VSTEffect::ProcessStereo(int count, rs += block; mTimeInfo.samplePos += ((double) block / mTimeInfo.sampleRate); - if (mInputs > 1) { + if (mInputs > 1) { if (TrackGroupProgress(count, (ls - lstart) / (double)originalLen)) { rc = false; break; @@ -3281,7 +3281,7 @@ bool VSTEffect::Load() mName = GetString(effGetEffectName); mInputs = mAEffect->numInputs; mOutputs = mAEffect->numOutputs; - + // We could even go so far as to run a small test here. success = true; @@ -3330,7 +3330,7 @@ void VSTEffect::ScanOnePlugin( const wxString & file ) argv[1] = VSTCMDKEY; argv[2] = file.c_str(); argv[3] = NULL; - // ToDo: do we need a try--catch around this in case a bad plug-in + // ToDo: do we need a try--catch around this in case a bad plug-in // fails? (JKC Nov09) wxExecute((wxChar **) argv, wxEXEC_SYNC | wxEXEC_NODISABLE, NULL); } @@ -3361,7 +3361,7 @@ void VSTEffect::ShowProgressDialog( const wxString & longest, const wxArrayStrin ScanOnePlugin( file ); } - delete progress; + delete progress; } /* static */ @@ -3407,7 +3407,7 @@ int VSTEffect::Scan() files.RemoveAt(i--); } } - + #elif defined(__WXMSW__) TCHAR dpath[MAX_PATH]; @@ -3471,7 +3471,7 @@ int VSTEffect::Scan() size_t cnt = files.GetCount(); wxString longest; - // JKC: Let's not show the progress dialog if there are no + // JKC: Let's not show the progress dialog if there are no // files to test. if( cnt <= 0 ) return wxID_OK; diff --git a/src/effects/VST/VSTEffect.h b/src/effects/VST/VSTEffect.h index 4f130719a..97b5ed2e3 100644 --- a/src/effects/VST/VSTEffect.h +++ b/src/effects/VST/VSTEffect.h @@ -56,9 +56,9 @@ class VSTEffect:public Effect virtual bool Init(); virtual bool PromptUser(); - + virtual bool Process(); - + virtual void End(); // Plugin loading and unloading diff --git a/src/effects/VST/aeffectx.h b/src/effects/VST/aeffectx.h index c9fbbda3c..3cd578ca3 100644 --- a/src/effects/VST/aeffectx.h +++ b/src/effects/VST/aeffectx.h @@ -2,7 +2,7 @@ * aeffectx.h - simple header to allow VeSTige compilation and eventually work * * Copyright (c) 2006 Javier Serrano Polo - * + * * This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net * * This program is free software; you can redistribute it and/or diff --git a/src/effects/Wahwah.cpp b/src/effects/Wahwah.cpp index b91f00013..a46092fc6 100644 --- a/src/effects/Wahwah.cpp +++ b/src/effects/Wahwah.cpp @@ -57,16 +57,16 @@ EffectWahwah::EffectWahwah() res = float(2.5); } -wxString EffectWahwah::GetEffectDescription() { - // Note: This is useful only after values have been set. +wxString EffectWahwah::GetEffectDescription() { + // Note: This is useful only after values have been set. return wxString::Format(_("Applied effect: %s frequency = %.1f Hz, start phase = %.0f deg, depth = %.0f%%, resonance = %.1f, frequency offset = %.0f%%"), - this->GetEffectName().c_str(), - freq, - (startphase * 180 / M_PI), - (depth * 100), - res, - (freqofs * 100)); -} + this->GetEffectName().c_str(), + freq, + (startphase * 180 / M_PI), + (depth * 100), + res, + (freqofs * 100)); +} bool EffectWahwah::PromptUser() { @@ -95,7 +95,7 @@ bool EffectWahwah::PromptUser() } bool EffectWahwah::TransferParameters( Shuttle & shuttle ) -{ +{ shuttle.TransferFloat(wxT("Freq"),freq,1.5f); shuttle.TransferFloat(wxT("Phase"),startphase,0.0f); shuttle.TransferFloat(wxT("Depth"),depth,0.7f); @@ -133,7 +133,7 @@ bool EffectWahwah::ProcessSimpleMono(float *buffer, sampleCount len) for (int i = 0; i < len; i++) { in = buffer[i]; - + if ((skipcount++) % lfoskipsamples == 0) { frequency = (1 + cos(skipcount * lfoskip + phase)) / 2; frequency = frequency * depth * (1 - freqofs) + freqofs; @@ -154,14 +154,14 @@ bool EffectWahwah::ProcessSimpleMono(float *buffer, sampleCount len) xn1 = in; yn2 = yn1; yn1 = out; - + // Prevents clipping // Commented out, per http://bugzilla.audacityteam.org/show_bug.cgi?id=689. //if (out < -1.0) // out = float(-1.0); //else if (out > 1.0) // out = float(1.0); - + buffer[i] = (float) out; } @@ -501,7 +501,7 @@ void WahwahDialog::OnPreview(wxCommandEvent & WXUNUSED(event)) float old_startphase = mEffect->startphase; float old_res = mEffect->res; float old_depth = mEffect->depth; - + mEffect->freq = freq; mEffect->freqofs = freqoff / 100; mEffect->startphase = startphase * M_PI / 180; diff --git a/src/effects/Wahwah.h b/src/effects/Wahwah.h index c658612f3..f0aeb9b92 100644 --- a/src/effects/Wahwah.h +++ b/src/effects/Wahwah.h @@ -40,7 +40,7 @@ class EffectWahwah:public EffectSimpleMono { virtual wxString GetEffectName() { return wxString(_("Wahwah...")); } - + virtual std::set GetEffectCategories() { std::set result; result.insert(wxT("http://lv2plug.in/ns/lv2core#ModulatorPlugin")); @@ -54,13 +54,13 @@ class EffectWahwah:public EffectSimpleMono { virtual wxString GetEffectAction() { return wxString(_("Applying Wahwah")); } - - // Useful only after PromptUser values have been set. - virtual wxString GetEffectDescription(); + + // Useful only after PromptUser values have been set. + virtual wxString GetEffectDescription(); virtual bool PromptUser(); virtual bool TransferParameters( Shuttle & shuttle ); - + protected: virtual bool NewTrackSimpleMono(); @@ -73,7 +73,7 @@ class EffectWahwah:public EffectSimpleMono { float b0, b1, b2, a0, a1, a2; /* Parameters: - freq - LFO frequency + freq - LFO frequency startphase - LFO startphase in RADIANS - usefull for stereo WahWah depth - Wah depth freqofs - Wah frequency offset diff --git a/src/effects/audiounits/AudioUnitEffect.cpp b/src/effects/audiounits/AudioUnitEffect.cpp index 1ac47e363..84289a737 100644 --- a/src/effects/audiounits/AudioUnitEffect.cpp +++ b/src/effects/audiounits/AudioUnitEffect.cpp @@ -138,7 +138,7 @@ wxString AudioUnitEffect::GetEffectIdentifier() wxString AudioUnitEffect::GetEffectAction() { - return wxString::Format(_("Performing Effect: %s"), + return wxString::Format(_("Performing Effect: %s"), mName.c_str()); } @@ -159,7 +159,7 @@ bool AudioUnitEffect::Init() mSupportsMono = SetRateAndChannels(mUnit, 1, 44100.0); mSupportsStereo = SetRateAndChannels(mUnit, 2, 44100.0); - + if (!mSupportsMono && !mSupportsStereo) { printf("Audio Unit doesn't support mono or stereo.\n"); return false; @@ -190,14 +190,14 @@ bool AudioUnitEffect::PromptUser() dlog.ShowModal(); CloseComponent(carbonView); - + return (dlog.GetReturnCode() == wxID_OK); } - + bool AudioUnitEffect::Process() { bool bGoodResult = true; - + CopyInputTracks(); TrackListIterator iter(mOutputTracks); @@ -209,10 +209,10 @@ bool AudioUnitEffect::Process() sampleCount lstart, rstart; sampleCount len; GetSamples((WaveTrack *)left, &lstart, &len); - + right = NULL; if (left->GetLinked() && mSupportsStereo) { - right = iter.Next(); + right = iter.Next(); GetSamples((WaveTrack *)right, &rstart, &len); } @@ -234,16 +234,16 @@ bool AudioUnitEffect::Process() bGoodResult = false; break; } - + left = iter.Next(); count++; } - ReplaceProcessedTracks(bGoodResult); + ReplaceProcessedTracks(bGoodResult); return bGoodResult; } - + void AudioUnitEffect::End() { } @@ -272,7 +272,7 @@ bool AudioUnitEffect::SetRateAndChannels(AudioUnit unit, streamFormat.mFramesPerPacket = 1; streamFormat.mBytesPerFrame = 4; streamFormat.mBytesPerPacket = 4; - + auResult = AudioUnitSetProperty(unit, kAudioUnitProperty_StreamFormat, kAudioUnitScope_Input, 0, &streamFormat, @@ -333,7 +333,7 @@ bool AudioUnitEffect::CopyParameters(AudioUnit srcUnit, AudioUnit dstUnit) printf("Couldn't get parameter list\n"); delete[] parameters; return false; - } + } // Copy the parameters from the main unit to the unit specific to // this track @@ -409,7 +409,7 @@ bool AudioUnitEffect::ProcessStereo(int count, } auResult = AudioUnitInitialize(trackUnit); - if (auResult != 0) { + if (auResult != 0) { printf("Couldn't initialize audio unit\n"); return false; } @@ -457,7 +457,7 @@ bool AudioUnitEffect::ProcessStereo(int count, bufferList = (AudioBufferList *)malloc(sizeof(UInt32) + numChannels * sizeof(AudioBuffer)); - if (!bufferList) + if (!bufferList) { printf("Setting input render callback failed.\n"); AudioUnitUninitialize(trackUnit); @@ -520,7 +520,7 @@ bool AudioUnitEffect::ProcessStereo(int count, } } } - + if (bufferList) { free(bufferList); } @@ -590,11 +590,11 @@ bool AudioUnitEffect::DoRender(AudioUnit unit, // static OSStatus AudioUnitEffect::SimpleAudioRenderCallback - (void *inRefCon, + (void *inRefCon, AudioUnitRenderActionFlags *inActionFlags, - const AudioTimeStamp *inTimeStamp, + const AudioTimeStamp *inTimeStamp, UInt32 inBusNumber, - UInt32 inNumFrames, + UInt32 inNumFrames, AudioBufferList *ioData) { AudioUnitEffect *This = (AudioUnitEffect *)inRefCon; @@ -656,14 +656,14 @@ bool AudioUnitGUIControl::Create(wxWindow *parent, wxWindowID id, ControlRef controlRef) { m_macIsUserPane = FALSE ; - + if ( !wxControl::Create(parent, id, pos, size, 0, wxDefaultValidator, wxString(wxT("AudioUnitControl"))) ) return false; - + m_peer = new wxMacControl(this, controlRef); - + Rect outBounds; GetControlBounds(controlRef, &outBounds); @@ -671,9 +671,9 @@ bool AudioUnitGUIControl::Create(wxWindow *parent, wxWindowID id, pos.y = outBounds.top; size.x = outBounds.right - outBounds.left; size.y = outBounds.bottom - outBounds.top; - + MacPostControlCreate(pos, size); - + return true; } @@ -683,16 +683,16 @@ short AudioUnitGUIControl::GetModifiers(wxMouseEvent &event) if ( !event.m_leftDown && !event.m_rightDown ) modifiers |= btnState ; - + if ( event.m_shiftDown ) modifiers |= shiftKey ; - + if ( event.m_controlDown ) modifiers |= controlKey ; - + if ( event.m_altDown ) modifiers |= optionKey ; - + if ( event.m_metaDown ) modifiers |= cmdKey ; @@ -703,17 +703,17 @@ void AudioUnitGUIControl::OnMouse(wxMouseEvent &event) { int x = event.m_x ; int y = event.m_y ; - + MacClientToRootWindow( &x , &y ) ; - + Point localwhere ; ControlHandle control; - + localwhere.h = x ; localwhere.v = y ; - + short modifiers = GetModifiers(event); - + if (event.GetEventType() == wxEVT_LEFT_DOWN || event.GetEventType() == wxEVT_LEFT_DCLICK ) { #if ((wxMAJOR_VERSION == 2) && (wxMINOR_VERSION <= 4)) @@ -723,15 +723,15 @@ void AudioUnitGUIControl::OnMouse(wxMouseEvent &event) #endif ControlPartCode code; - + code = FindControl(localwhere, rootWindow, &control); - + if (code) { Rect outBounds; GetControlBounds((ControlRef)control, &outBounds); - + code = ::HandleControlClick(control, localwhere, modifiers, (ControlActionUPP)-1) ; @@ -765,9 +765,9 @@ static pascal OSStatus EventHandler(EventHandlerCallRef handler, EventRef event, } -void EventListener(void *inUserData, AudioUnitCarbonView inView, +void EventListener(void *inUserData, AudioUnitCarbonView inView, const AudioUnitParameter *inParameter, - AudioUnitCarbonViewEventID inEvent, + AudioUnitCarbonViewEventID inEvent, const void *inEventParam) { // We're not actually using this yet... @@ -794,7 +794,7 @@ AudioUnitDialog::AudioUnitDialog(wxWindow *parent, wxWindowID id, mHandlerRef(NULL) { long style = wxDEFAULT_DIALOG_STYLE; - + #if ((wxMAJOR_VERSION == 2) && (wxMINOR_VERSION <= 4)) wxDialog::Create(parent, id, title, @@ -823,7 +823,7 @@ AudioUnitDialog::AudioUnitDialog(wxWindow *parent, wxWindowID id, // way to disable compositing, so bypass it until a way // is found. #if !wxCHECK_VERSION(2, 7, 0) - m_macUsesCompositing = false; + m_macUsesCompositing = false; #endif // Rest of wxTopLevelWindow::Create @@ -831,7 +831,7 @@ AudioUnitDialog::AudioUnitDialog(wxWindow *parent, wxWindowID id, m_windowId = id == -1 ? NewControlId() : id; MacCreateRealWindow(title, wxDefaultPosition, wxSize(500, 400), MacRemoveBordersFromStyle(style) , title) ; - SetBackgroundColour(wxSystemSettings::GetColour(wxSYS_COLOUR_3DFACE)); + SetBackgroundColour(wxSystemSettings::GetColour(wxSYS_COLOUR_3DFACE)); wxTopLevelWindows.Append(this); if ( parent ) parent->AddChild(this); @@ -870,7 +870,7 @@ AudioUnitDialog::AudioUnitDialog(wxWindow *parent, wxWindowID id, wxPoint(0, 0), wxSize(width, height), audioUnitControl); - + // Eventually, to handle resizing controls, call: // AudioUnitCarbonViewSetEventListener with the event: // kEventControlBoundsChanged @@ -883,7 +883,7 @@ AudioUnitDialog::AudioUnitDialog(wxWindow *parent, wxWindowID id, mGUIControl = NULL; wxBoxSizer *hSizer = new wxBoxSizer(wxHORIZONTAL); - + wxButton *preview = new wxButton(this, PreviewID, _("Pre&view")); hSizer->Add(preview, 0, wxALL, 10); diff --git a/src/effects/audiounits/AudioUnitEffect.h b/src/effects/audiounits/AudioUnitEffect.h index 1791d7523..0cc9ce34f 100644 --- a/src/effects/audiounits/AudioUnitEffect.h +++ b/src/effects/audiounits/AudioUnitEffect.h @@ -27,19 +27,19 @@ class AudioUnitEffect:public Effect { virtual ~AudioUnitEffect(); virtual wxString GetEffectName(); - + virtual std::set GetEffectCategories(); - + virtual wxString GetEffectIdentifier(); - + virtual wxString GetEffectAction(); virtual bool Init(); virtual bool PromptUser(); - + virtual bool Process(); - + virtual void End(); private: @@ -59,15 +59,15 @@ class AudioUnitEffect:public Effect { bool CopyParameters(AudioUnit srcUnit, AudioUnit dstUnit); static OSStatus - SimpleAudioRenderCallback(void *inRefCon, + SimpleAudioRenderCallback(void *inRefCon, AudioUnitRenderActionFlags *inActionFlags, - const AudioTimeStamp *inTimeStamp, + const AudioTimeStamp *inTimeStamp, UInt32 inBusNumber, - UInt32 inNumFrames, + UInt32 inNumFrames, AudioBufferList *ioData); Component GetCarbonViewComponent(OSType subtype); - + wxString mName; Component mComponent; AudioUnit mUnit; diff --git a/src/effects/audiounits/LoadAudioUnits.cpp b/src/effects/audiounits/LoadAudioUnits.cpp index d90c96401..3a71ccf50 100644 --- a/src/effects/audiounits/LoadAudioUnits.cpp +++ b/src/effects/audiounits/LoadAudioUnits.cpp @@ -18,13 +18,13 @@ void LoadAudioUnitsOfType(OSType inAUType) { ComponentDescription desc; Component component; - + desc.componentType = inAUType; desc.componentSubType = 0; desc.componentManufacturer = 0; desc.componentFlags = 0; desc.componentFlagsMask = 0; - + component = FindNextComponent(NULL, &desc); while (component != NULL) { ComponentDescription found; diff --git a/src/effects/ladspa/LadspaEffect.cpp b/src/effects/ladspa/LadspaEffect.cpp index 526e7a40d..150713335 100644 --- a/src/effects/ladspa/LadspaEffect.cpp +++ b/src/effects/ladspa/LadspaEffect.cpp @@ -5,13 +5,13 @@ LadspaEffect.cpp Dominic Mazzoni - + This class implements a Ladspa Plug-in effect. *******************************************************************//** \class LadspaEffect -\brief An Effect that calls up a LADSPA plug in, i.e. many possible +\brief An Effect that calls up a LADSPA plug in, i.e. many possible effects from this one class. *//****************************************************************//** @@ -46,7 +46,7 @@ effects from this one class. LadspaEffect::LadspaEffect(const LADSPA_Descriptor *data, const std::set& categories) : mCategories(categories) { - + mData = data; pluginName = LAT1CTOWX(mData->Name); @@ -132,7 +132,7 @@ LadspaEffect::LadspaEffect(const LADSPA_Descriptor *data, else if (outputs == 0) flags |= ANALYZE_EFFECT; else - flags |= PROCESS_EFFECT; + flags |= PROCESS_EFFECT; SetEffectFlags(flags); } @@ -175,7 +175,7 @@ wxString LadspaEffect::GetEffectIdentifier() wxString LadspaEffect::GetEffectAction() { - return wxString::Format(_("Performing Effect: %s"), + return wxString::Format(_("Performing Effect: %s"), pluginName.c_str()); } @@ -189,17 +189,17 @@ bool LadspaEffect::Init() while(left) { if (mainRate == 0) mainRate = (int)(((WaveTrack *)left)->GetRate() + 0.5); - + if (left->GetLinked()) { Track *right = iter.Next(); - + if (((WaveTrack *)left)->GetRate() != ((WaveTrack *)right)->GetRate()) { wxMessageBox(_("Sorry, Plug-in Effects cannot be performed on stereo tracks where the individual channels of the track do not match.")); return false; } } - + left = iter.Next(); } @@ -217,7 +217,7 @@ bool LadspaEffect::PromptUser() LadspaEffectDialog dlog(this, mParent, mData, inputControls, mainRate, length); dlog.CentreOnParent(); dlog.ShowModal(); - + if (!dlog.GetReturnCode()) return false; @@ -239,10 +239,10 @@ bool LadspaEffect::Process() sampleCount lstart = 0, rstart = 0; sampleCount len; GetSamples((WaveTrack *)left, &lstart, &len); - + right = NULL; if (left->GetLinked() && inputs>1) { - right = iter.Next(); + right = iter.Next(); GetSamples((WaveTrack *)right, &rstart, &len); } @@ -250,7 +250,7 @@ bool LadspaEffect::Process() // If the effect is mono, apply to each channel separately bGoodResult = ProcessStereo(count, (WaveTrack *)left, NULL, - lstart, 0, len) && + lstart, 0, len) && ProcessStereo(count, (WaveTrack *)right, NULL, rstart, 0, len); } @@ -259,17 +259,17 @@ bool LadspaEffect::Process() lstart, rstart, len); if (!bGoodResult) break; - + left = iter.Next(); count++; } - this->ReplaceProcessedTracks(bGoodResult); + this->ReplaceProcessedTracks(bGoodResult); return bGoodResult; } bool LadspaEffect::ProcessStereo(int count, WaveTrack *left, WaveTrack *right, - sampleCount lstart, + sampleCount lstart, sampleCount rstart, sampleCount len) { @@ -309,7 +309,7 @@ bool LadspaEffect::ProcessStereo(int count, WaveTrack *left, WaveTrack *right, mData->connect_port(handle, p, &outputControls[p]); } } - + if (mData->activate) mData->activate(handle); @@ -334,16 +334,16 @@ bool LadspaEffect::ProcessStereo(int count, WaveTrack *left, WaveTrack *right, if (left && outputs > 0) { left->Set((samplePtr)fOutBuffer[0], floatSample, ls, block); - } - + } + if (right && outputs > 1) { right->Set((samplePtr)fOutBuffer[1], floatSample, rs, block); - } + } len -= block; ls += block; rs += block; - + if (inputs > 1) { if (TrackGroupProgress(count, (ls-lstart)/(double)originalLen)) return false; @@ -551,17 +551,17 @@ LadspaEffectDialog::LadspaEffectDialog(LadspaEffect *eff, wxBoxSizer *vSizer = new wxBoxSizer(wxVERTICAL); if (mData->Maker && - mData->Maker[0] && - LAT1CTOWX(mData->Maker) != wxString(_("None"))) { + mData->Maker[0] && + LAT1CTOWX(mData->Maker) != wxString(_("None"))) { item = new wxStaticText(this, 0, wxString(_("Author: "))+LAT1CTOWX(mData->Maker)); vSizer->Add(item, 0, wxALL, 5); } - + if (mData->Copyright && - mData->Copyright[0] && + mData->Copyright[0] && LAT1CTOWX(mData->Copyright) != wxString(_("None"))) { - + item = new wxStaticText(this, 0, LAT1CTOWX(mData->Copyright)); vSizer->Add(item, 0, wxALL, 5); @@ -577,7 +577,7 @@ LadspaEffectDialog::LadspaEffectDialog(LadspaEffect *eff, w->SetMinSize(wxSize( wxMax(600, parent->GetSize().GetWidth() * 2/3), parent->GetSize().GetHeight() / 2)); - + w->SetScrollRate(0, 20); vSizer->Add(w, 1, wxEXPAND|wxALL, 5); @@ -697,7 +697,7 @@ LadspaEffectDialog::LadspaEffectDialog(LadspaEffect *eff, // text fields inSlider = false; // Now we're ready for HandleText to actually do something. HandleText(); - + paramSizer->Add(gridSizer, 1, wxEXPAND | wxALL, 5); w->SetSizer(paramSizer); @@ -801,11 +801,11 @@ void LadspaEffectDialog::HandleText() if (LADSPA_IS_HINT_BOUNDED_BELOW(hint.HintDescriptor)) lower = hint.LowerBound; if (LADSPA_IS_HINT_BOUNDED_ABOVE(hint.HintDescriptor)) - upper = hint.UpperBound; + upper = hint.UpperBound; if (LADSPA_IS_HINT_SAMPLE_RATE(hint.HintDescriptor)) { lower *= sampleRate; upper *= sampleRate; - } + } range = upper - lower; if (val < lower) @@ -815,7 +815,7 @@ void LadspaEffectDialog::HandleText() inputControls[ports[p]] = val; - sliders[p]->SetValue((int)(((val-lower)/range) * 1000.0 + 0.5)); + sliders[p]->SetValue((int)(((val-lower)/range) * 1000.0 + 0.5)); } inText = false; diff --git a/src/effects/ladspa/LadspaEffect.h b/src/effects/ladspa/LadspaEffect.h index 0009618be..7c4cb1b34 100644 --- a/src/effects/ladspa/LadspaEffect.h +++ b/src/effects/ladspa/LadspaEffect.h @@ -24,24 +24,24 @@ class LadspaEffect:public Effect { public: - LadspaEffect(const LADSPA_Descriptor *data, + LadspaEffect(const LADSPA_Descriptor *data, const std::set& categories = std::set()); virtual ~LadspaEffect(); virtual wxString GetEffectName(); - + virtual std::set GetEffectCategories(); virtual wxString GetEffectIdentifier(); - + virtual wxString GetEffectAction(); virtual bool Init(); virtual bool PromptUser(); - + virtual bool Process(); - + virtual void End(); private: diff --git a/src/effects/ladspa/LoadLadspa.cpp b/src/effects/ladspa/LoadLadspa.cpp index 5019cd273..5758b1f07 100644 --- a/src/effects/ladspa/LoadLadspa.cpp +++ b/src/effects/ladspa/LoadLadspa.cpp @@ -163,10 +163,10 @@ static void LoadLadspaEffect(wxSortedArrayString &uniq, wxString fname, LadspaEffect *effect = new LadspaEffect(data, categories); EffectManager::Get().RegisterEffect(effect); } - + // Get next plugin index++; - data = mainFn(index); + data = mainFn(index); } } @@ -183,7 +183,7 @@ void LoadLadspaPlugins() unsigned int i; #if defined(USE_LIBLRDF) && defined(EFFECT_CATEGORIES) - + EffectManager& em = EffectManager::Get(); wxArrayString rdfPathList; wxString rdfPathVar; @@ -197,24 +197,24 @@ void LoadLadspaPlugins() wxGetApp().AddMultiPathsToPathList(rdfPathVar, rdfPathList); #ifdef __WXGTK__ - wxGetApp().AddUniquePathToPathList(wxT("/usr/share/ladspa/rdf"), + wxGetApp().AddUniquePathToPathList(wxT("/usr/share/ladspa/rdf"), rdfPathList); - wxGetApp().AddUniquePathToPathList(wxT("/usr/local/share/ladspa/rdf"), + wxGetApp().AddUniquePathToPathList(wxT("/usr/local/share/ladspa/rdf"), rdfPathList); #endif #ifdef __WXMAC__ - wxGetApp().AddUniquePathToPathList(wxT("/usr/share/ladspa/rdf"), + wxGetApp().AddUniquePathToPathList(wxT("/usr/share/ladspa/rdf"), rdfPathList); // XXX Maybe other Mac paths here? #endif #ifdef __WXMSW__ - //wxGetApp().AddUniquePathToPathList(wxT("WINDOWS LRDF PATH"), + //wxGetApp().AddUniquePathToPathList(wxT("WINDOWS LRDF PATH"), // rdfPathList); // XXX Other Windows paths here. #endif - + // Add the Audacity paths so we get ladspa.rdfs if we are using a local // liblrdf for(i=0; icount; ++i) { char* label = lrdf_get_label(cats->items[i]); @@ -255,10 +255,10 @@ void LoadLadspaPlugins() lrdf_free_uris(plugs); } } - + // And their relationships for (size_t i = 0; i < cats->count; ++i) { - EffectCategory* p = + EffectCategory* p = em.LookupCategory(MapCategoryUri(wxString::FromAscii(cats-> items[i]))); if (!p) @@ -266,7 +266,7 @@ void LoadLadspaPlugins() lrdf_uris* subs = lrdf_get_subclasses(cats->items[i]); if (subs) { for (size_t j = 0; j < subs->count; ++j) { - EffectCategory* c = + EffectCategory* c = em.LookupCategory(MapCategoryUri(wxString::FromAscii(subs->items[j]))); if (c) em.AddCategoryParent(c, p); @@ -274,11 +274,11 @@ void LoadLadspaPlugins() lrdf_free_uris(subs); } } - + lrdf_free_uris(cats); - + } - + #endif pathVar = wxGetenv(wxT("LADSPA_PATH")); @@ -308,7 +308,7 @@ void LoadLadspaPlugins() } #ifdef __WXMSW__ - wxGetApp().FindFilesInPathList(wxT("*.dll"), pathList, files); + wxGetApp().FindFilesInPathList(wxT("*.dll"), pathList, files); #else wxGetApp().FindFilesInPathList(wxT("*.so"), pathList, files); #endif @@ -320,7 +320,7 @@ void LoadLadspaPlugins() void UnloadLadspaPlugins() { int count=ladspa_dls.GetCount(); - for (int i=0; i 0) { mValid = false; } - - // Determine whether the plugin is a generator, effect or analyser + + // Determine whether the plugin is a generator, effect or analyser // depending on the number of ports of each type (not completely accurate, // but works most of the time) int flags = PLUGIN_EFFECT; @@ -326,7 +326,7 @@ wxString LV2Effect::GetEffectIdentifier() wxString LV2Effect::GetEffectAction() { - return wxString::Format(_("Performing Effect: %s"), + return wxString::Format(_("Performing Effect: %s"), pluginName.c_str()); } @@ -343,11 +343,11 @@ bool LV2Effect::Init() { mainRate = (int)(((WaveTrack *)left)->GetRate() + 0.5); } - + if (left->GetLinked()) { Track *right = iter.Next(); - + if (((WaveTrack *)left)->GetRate() != ((WaveTrack *)right)->GetRate()) { @@ -355,7 +355,7 @@ bool LV2Effect::Init() return false; } } - + left = iter.Next(); } @@ -380,7 +380,7 @@ bool LV2Effect::PromptUser() noteLength, noteVelocity, noteKey); dlog.CentreOnParent(); dlog.ShowModal(); - + if (!dlog.GetReturnCode()) { return false; @@ -409,11 +409,11 @@ bool LV2Effect::Process() sampleCount lstart = 0, rstart = 0; sampleCount len; GetSamples((WaveTrack *)left, &lstart, &len); - + right = NULL; if (left->GetLinked() && mAudioInputs.GetCount() > 1) { - right = iter.Next(); + right = iter.Next(); GetSamples((WaveTrack *)right, &rstart, &len); } @@ -422,7 +422,7 @@ bool LV2Effect::Process() // If the effect is mono, apply to each channel separately bGoodResult = ProcessStereo(count, (WaveTrack *)left, NULL, - lstart, 0, len) && + lstart, 0, len) && ProcessStereo(count, (WaveTrack *)right, NULL, rstart, 0, len); } @@ -437,7 +437,7 @@ bool LV2Effect::Process() { break; } - + left = iter.Next(); count++; } @@ -450,7 +450,7 @@ bool LV2Effect::Process() bool LV2Effect::ProcessStereo(int count, WaveTrack *left, WaveTrack *right, - sampleCount lstart, + sampleCount lstart, sampleCount rstart, sampleCount len) { @@ -474,7 +474,7 @@ bool LV2Effect::ProcessStereo(int count, /* Instantiate the plugin */ LilvInstance *handle = lilv_plugin_instantiate(mData, - left->GetRate(), + left->GetRate(), gLV2Features); if (!handle) { @@ -518,7 +518,7 @@ bool LV2Effect::ProcessStereo(int count, for (size_t p = 0; p < mControlOutputs.GetCount(); p++) { - lilv_instance_connect_port(handle, mControlOutputs[p].mIndex, + lilv_instance_connect_port(handle, mControlOutputs[p].mIndex, &mControlOutputs[p].mControlBuffer); } @@ -553,12 +553,12 @@ bool LV2Effect::ProcessStereo(int count, { block = len; } - + if (left && mAudioInputs.GetCount() > 0) { left->Get((samplePtr)fInBuffer[0], floatSample, ls, block); } - + if (right && mAudioInputs.GetCount() > 1) { right->Get((samplePtr)fInBuffer[1], floatSample, rs, block); @@ -606,7 +606,7 @@ bool LV2Effect::ProcessStereo(int count, { left->Set((samplePtr)(fOutBuffer[0] + delay), floatSample, ols, oblock); } - + if (right && mAudioOutputs.GetCount() > 1) { right->Set((samplePtr)(fOutBuffer[1] + delay), floatSample, ors, oblock); @@ -621,7 +621,7 @@ bool LV2Effect::ProcessStereo(int count, { left->Set((samplePtr)fOutBuffer[0], floatSample, ols, block); } - + if (right && mAudioOutputs.GetCount() > 1) { right->Set((samplePtr)fOutBuffer[1], floatSample, ors, block); @@ -638,10 +638,10 @@ bool LV2Effect::ProcessStereo(int count, // Clear the event buffer and add the note off event if needed if (mMidiInput) { - lv2_event_buffer_reset(midiBuffer, 1, - (uint8_t *)midiBuffer + + lv2_event_buffer_reset(midiBuffer, 1, + (uint8_t *)midiBuffer + sizeof(LV2_Event_Buffer)); - + if (!noteOver && noteOffTime < len && noteOffTime < block) { LV2_Event_Iterator iter; @@ -650,7 +650,7 @@ bool LV2Effect::ProcessStereo(int count, lv2_event_write(&iter, noteOffTime, 0, 1, 3, noteOff); noteOver = true; } - } + } } else if (delayed) { @@ -658,7 +658,7 @@ bool LV2Effect::ProcessStereo(int count, } ls += block; rs += block; - + if (mAudioInputs.GetCount() > 1) { if (TrackGroupProgress(count, (ls-lstart)/(double)originalLen)) @@ -673,12 +673,12 @@ bool LV2Effect::ProcessStereo(int count, return false; } } - + } - + lilv_instance_deactivate(handle); lilv_instance_free(handle); - + return true; } @@ -720,7 +720,7 @@ bool LV2Effect::IsValid() } -LV2PortArray & LV2Effect::GetControls() +LV2PortArray & LV2Effect::GetControls() { return mControlInputs; } @@ -732,7 +732,7 @@ bool LV2Effect::IsSynth() } -bool LV2Effect::SetNote(sampleCount len, +bool LV2Effect::SetNote(sampleCount len, unsigned char velocity, unsigned char key) { if (velocity == 0 || velocity > 127 || key > 127) @@ -768,7 +768,7 @@ wxString LV2Effect::GetString(LilvNode *node, bool free) return str; } -// This should be moved to its own source file, it's in LadspaEffect.cpp +// This should be moved to its own source file, it's in LadspaEffect.cpp // as well class LV2Slider:public wxSlider { @@ -902,7 +902,7 @@ LV2EffectDialog::LV2EffectDialog(LV2Effect *effect, double WXUNUSED(noteLength), unsigned char WXUNUSED(noteVelocity), unsigned char WXUNUSED(noteKey)) -: wxDialog(parent, wxID_ANY, +: wxDialog(parent, wxID_ANY, mEffect->GetString(lilv_plugin_get_name(data)), wxDefaultPosition, wxSize(500, -1), wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER), @@ -925,7 +925,7 @@ LV2EffectDialog::LV2EffectDialog(LV2Effect *effect, #endif inText = false; inText = true; - + // Allocate memory for the user parameter controls int ctrlcnt = (int) mControls.GetCount(); mToggles = new wxCheckBox*[ctrlcnt]; @@ -933,11 +933,11 @@ LV2EffectDialog::LV2EffectDialog(LV2Effect *effect, mFields = new wxTextCtrl*[ctrlcnt]; mLabels = new wxStaticText*[ctrlcnt]; mEnums = new wxChoice*[ctrlcnt]; - + wxControl *item; wxBoxSizer *vSizer = new wxBoxSizer(wxVERTICAL); - + // Add information about the plugin LilvNode *tmpValue = lilv_plugin_get_author_name(data); if (tmpValue) @@ -947,7 +947,7 @@ LV2EffectDialog::LV2EffectDialog(LV2Effect *effect, vSizer->Add(item, 0, wxALL, 5); lilv_node_free(tmpValue); } - + wxScrolledWindow *w = new wxScrolledWindow(this, wxID_ANY, wxDefaultPosition, @@ -958,7 +958,7 @@ LV2EffectDialog::LV2EffectDialog(LV2Effect *effect, w->SetMinSize(wxSize( wxMax(600, parent->GetSize().GetWidth() * 2/3), parent->GetSize().GetHeight() / 2)); - + w->SetScrollRate(0, 20); vSizer->Add(w, 1, wxEXPAND|wxALL, 5); @@ -973,7 +973,7 @@ LV2EffectDialog::LV2EffectDialog(LV2Effect *effect, wxFlexGridSizer *gridSizer = new wxFlexGridSizer(5, 0, 0); gridSizer->AddGrowableCol(3); - + // Now add the length control if (mEffect->GetEffectFlags() & INSERT_EFFECT) { @@ -987,7 +987,7 @@ LV2EffectDialog::LV2EffectDialog(LV2Effect *effect, gridSizer->Add(1, 1, 0); ConnectFocus(mSeconds); } - + // The note controls if the plugin is a synth if (mEffect->IsSynth()) { @@ -1001,7 +1001,7 @@ LV2EffectDialog::LV2EffectDialog(LV2Effect *effect, gridSizer->Add(1, 1, 0); gridSizer->Add(1, 1, 0); ConnectFocus(mNoteSeconds); - + // Note velocity control item = new wxStaticText(w, wxID_ANY, _("Note velocity")); gridSizer->Add(item, 0, wxALIGN_CENTER_VERTICAL | wxALIGN_RIGHT | wxALL, 5); @@ -1030,7 +1030,7 @@ LV2EffectDialog::LV2EffectDialog(LV2Effect *effect, // Create user parameter controls std::queue groups; groups.push(&mEffect->GetRootGroup()); - + while (!groups.empty()) { const LV2PortGroup* pg = groups.front(); @@ -1055,7 +1055,7 @@ LV2EffectDialog::LV2EffectDialog(LV2Effect *effect, groups.push(*si); } } - + const wxArrayInt & params = pg->GetParameters(); for (size_t pi = 0; pi < params.GetCount(); pi++) { @@ -1069,7 +1069,7 @@ LV2EffectDialog::LV2EffectDialog(LV2Effect *effect, wxString labelText = port.mName; item = new wxStaticText(w, 0, labelText + wxT(":")); gridSizer->Add(item, 0, wxALIGN_CENTER_VERTICAL | wxALIGN_RIGHT | wxALL, 5); - + wxString fieldText; if (port.mToggle) @@ -1079,7 +1079,7 @@ LV2EffectDialog::LV2EffectDialog(LV2Effect *effect, mToggles[p]->SetValue(port.mControlBuffer > 0); gridSizer->Add(mToggles[p], 0, wxALL, 5); ConnectFocus(mToggles[p]); - + gridSizer->Add(1, 1, 0); gridSizer->Add(1, 1, 0); gridSizer->Add(1, 1, 0); @@ -1104,7 +1104,7 @@ LV2EffectDialog::LV2EffectDialog(LV2Effect *effect, mEnums[p]->SetSelection(s); gridSizer->Add(mEnums[p], 0, wxALL | wxEXPAND, 5); ConnectFocus(mEnums[p]); - + gridSizer->Add(1, 1, 0); gridSizer->Add(1, 1, 0); gridSizer->Add(1, 1, 0); @@ -1119,7 +1119,7 @@ LV2EffectDialog::LV2EffectDialog(LV2Effect *effect, { fieldText = Internat::ToDisplayString(port.mControlBuffer); } - + mFields[p] = new wxTextCtrl(w, p, fieldText); mFields[p]->SetName(labelText); gridSizer->Add(mFields[p], 0, wxALIGN_CENTER_VERTICAL | wxALL, 5); @@ -1134,9 +1134,9 @@ LV2EffectDialog::LV2EffectDialog(LV2Effect *effect, wxString loLabel; wxString hiLabel; #if 0 - ScalePointMap::const_iterator iter = + ScalePointMap::const_iterator iter = scalePoints.find(port.mIndex); - + if (!wxNaN(port.mMin)) { lower = port.mMin; @@ -1151,7 +1151,7 @@ LV2EffectDialog::LV2EffectDialog(LV2Effect *effect, } } } - + if (!isnan(port.mMax)) { upper = port.mMax; @@ -1173,7 +1173,7 @@ LV2EffectDialog::LV2EffectDialog(LV2Effect *effect, upper *= mSampleRate; forceint = true; } - + wxString str; if (haslo) { @@ -1205,7 +1205,7 @@ LV2EffectDialog::LV2EffectDialog(LV2Effect *effect, mSliders[p]->SetName(labelText); gridSizer->Add(mSliders[p], 0, wxALIGN_CENTER_VERTICAL | wxEXPAND | wxALL, 5); ConnectFocus(mSliders[p]); - + if (hashi) { str = hiLabel; @@ -1230,12 +1230,12 @@ LV2EffectDialog::LV2EffectDialog(LV2Effect *effect, } } } - + // Set all of the mSliders based on the value in the // text mFields inSlider = false; // Now we're ready for HandleText to actually do something. HandleText(); - + w->SetSizer(paramSizer); Layout(); @@ -1274,7 +1274,7 @@ void LV2EffectDialog::OnSlider(wxCommandEvent &event) float upper = float(10.0); float range; bool forceint = false; - + if (isfinite(mControls[p].mMin)) { lower = mControls[p].mMin; @@ -1291,7 +1291,7 @@ void LV2EffectDialog::OnSlider(wxCommandEvent &event) upper *= mSampleRate; forceint = true; } - + range = upper - lower; val = (mSliders[p]->GetValue() / 1000.0) * range + lower; @@ -1318,7 +1318,7 @@ void LV2EffectDialog::OnChoiceCtrl(wxCommandEvent & WXUNUSED(event)) { // HandleText(); } - + void LV2EffectDialog::OnTextCtrl(wxCommandEvent & WXUNUSED(event)) { HandleText(); @@ -1336,7 +1336,7 @@ void LV2EffectDialog::HandleText() return; } inText = true; - + for (uint32_t p = 0; p < mControls.GetCount(); p++) { double dval; @@ -1357,7 +1357,7 @@ void LV2EffectDialog::HandleText() dval = Internat::CompatibleToDouble(mFields[p]->GetValue()); val = dval; - + if (!isnan(mControls[p].mMin)) { lower = mControls[p].mMin; @@ -1372,7 +1372,7 @@ void LV2EffectDialog::HandleText() { lower *= mSampleRate; upper *= mSampleRate; - } + } range = upper - lower; if (val < lower) @@ -1387,7 +1387,7 @@ void LV2EffectDialog::HandleText() mControls[p].mControlBuffer = val; - mSliders[p]->SetValue((int)(((val-lower)/range) * 1000.0 + 0.5)); + mSliders[p]->SetValue((int)(((val-lower)/range) * 1000.0 + 0.5)); } inText = false; @@ -1478,7 +1478,7 @@ unsigned char LV2EffectDialog::GetNoteVelocity() { if (mEffect->IsSynth()) { - double velocity = + double velocity = Internat::CompatibleToDouble(mNoteVelocity->GetValue()); if (velocity < 1) @@ -1500,7 +1500,7 @@ unsigned char LV2EffectDialog::GetNoteKey() { if (mEffect->IsSynth()) { - double key = + double key = Internat::CompatibleToDouble(mNoteKey->GetValue()); if (key < 1) diff --git a/src/effects/lv2/LV2Effect.h b/src/effects/lv2/LV2Effect.h index 3d6869e84..82e7bad2a 100644 --- a/src/effects/lv2/LV2Effect.h +++ b/src/effects/lv2/LV2Effect.h @@ -35,7 +35,7 @@ struct LV2Port mEnumeration(false) { } - + uint32_t mIndex; wxString mName; float mMin; @@ -55,12 +55,12 @@ struct LV2Port WX_DECLARE_OBJARRAY(LV2Port, LV2PortArray); -/** The main LV2 plugin class. It handles loading and applying a +/** The main LV2 plugin class. It handles loading and applying a single plugin. */ class LV2Effect:public Effect { public: - + /** Create an LV2Effect from an LV2 data handle and a category set. */ LV2Effect(const LilvPlugin *plug, const std::set & categories = std::set()); @@ -68,35 +68,35 @@ public: /** Get the name of the effect. */ virtual wxString GetEffectName(); - + /** Get the categories of the effect. */ virtual std::set GetEffectCategories(); /** Get the effect identifier (for internal use). */ virtual wxString GetEffectIdentifier(); - + /** Get the action string. */ virtual wxString GetEffectAction(); - + virtual bool Init(); virtual bool PromptUser(); - + virtual bool Process(); - + virtual void End(); - + bool IsValid(); /** Return a list of LV2Ports for the input parameters. */ LV2PortArray & GetControls(); - + /** Return true if the plugin is a synth (MIDI input), false if not. */ bool IsSynth(); /** Modify the note settings for the plugin (only for synths). */ bool SetNote(sampleCount len, unsigned char velocity, unsigned char key); - + /** Get the port group tree for the plugin. */ const LV2PortGroup & GetRootGroup(); @@ -118,18 +118,18 @@ private: int mainRate; std::set mCategories; - + LV2PortArray mControlInputs; LV2PortArray mControlOutputs; LV2PortArray mAudioInputs; LV2PortArray mAudioOutputs; LV2Port *mMidiInput; int mLatencyPortIndex; - + sampleCount mNoteLength; unsigned char mNoteVelocity; unsigned char mNoteKey; - + LV2PortGroup mRootGroup; std::map mPortGroups; }; diff --git a/src/effects/lv2/LV2PortGroup.cpp b/src/effects/lv2/LV2PortGroup.cpp index aa89e1f6d..3ee74b932 100644 --- a/src/effects/lv2/LV2PortGroup.cpp +++ b/src/effects/lv2/LV2PortGroup.cpp @@ -47,7 +47,7 @@ void LV2PortGroup::AddParameter(int parameter) { mParameters.Add(parameter); } - + const wxArrayInt & LV2PortGroup::GetParameters() const { return mParameters; diff --git a/src/effects/lv2/LV2PortGroup.h b/src/effects/lv2/LV2PortGroup.h index cd1218d62..fa9b68184 100644 --- a/src/effects/lv2/LV2PortGroup.h +++ b/src/effects/lv2/LV2PortGroup.h @@ -26,23 +26,23 @@ class LV2PortGroup { public: LV2PortGroup(const wxString & name = wxEmptyString); - + /** Add a subgroup of this group. */ void AddSubGroup(const LV2PortGroup & subgroup); - + /** Return a list of all subgroups. */ const LV2PortGroupArray & GetSubGroups() const; - + /** Add a parameter number (not port number). */ void AddParameter(int parameter); - + /** Return a list of all parameters in this group. */ const wxArrayInt & GetParameters() const; - + const wxString & GetName() const; private: - + wxString mName; LV2PortGroupArray mSubGroups; wxArrayInt mParameters; diff --git a/src/effects/lv2/LoadLV2.cpp b/src/effects/lv2/LoadLV2.cpp index 5561e9510..a1c971e59 100644 --- a/src/effects/lv2/LoadLV2.cpp +++ b/src/effects/lv2/LoadLV2.cpp @@ -67,7 +67,7 @@ static LV2_Feature gURIMapFeature = { "http://lv2plug.in/ns/ext/uri-map", &gURIMap }; // This is the event refcounter object. We don't actually implement it -// since we only ever send flat MIDI events to the plugins, but it is +// since we only ever send flat MIDI events to the plugins, but it is // still required. uint32_t event_ref(LV2_Event_Callback_Data WXUNUSED(callback_data), LV2_Event *WXUNUSED(event)) @@ -98,16 +98,16 @@ LilvNode *gSubGroupOf; void LoadLV2Plugins() { - + EffectManager& em = EffectManager::Get(); - + // If gWorld isn't 0 we have already initialised Lilv - unload all plugins // and initialise again. if (gWorld) { UnloadLV2Plugins(); } - + // Try to initialise Lilv, or return. gWorld = lilv_world_new(); if (!gWorld) @@ -115,7 +115,7 @@ void LoadLV2Plugins() wxLogMessage(wxT("Could not initialise lilv!")); return; } - + gAudioPortClass = lilv_new_uri(gWorld, LV2_CORE__AudioPort); gControlPortClass = lilv_new_uri(gWorld, LV2_CORE__ControlPort); gMidiPortClass = lilv_new_uri(gWorld, LV2_EVENT__EventPort); @@ -132,14 +132,14 @@ void LoadLV2Plugins() gSubGroupOf = lilv_new_uri(gWorld, LV2_PORT_GROUPS__subGroupOf); lilv_world_load_all(gWorld); - + #ifdef EFFECT_CATEGORIES - + // Add all LV2 categories and their relationships LilvPluginClasses classes = Lilv_world_get_plugin_classes(gWorld); for (unsigned index = 0; index < Lilv_plugin_classes_size(classes);++index){ LilvPluginClass c = Lilv_plugin_classes_get_at(classes, index); - em.AddCategory(wxString::FromUTF8(lilv_node_as_uri(Lilv_plugin_class_get_uri(c))), + em.AddCategory(wxString::FromUTF8(lilv_node_as_uri(Lilv_plugin_class_get_uri(c))), wxString::FromUTF8(lilv_node_as_string(Lilv_plugin_class_get_label(c)))); } for (unsigned index = 0; index < Lilv_plugin_classes_size(classes);++index){ @@ -155,7 +155,7 @@ void LoadLV2Plugins() } #endif - + // Retrieve data about all plugins const LilvPlugins *plugs = lilv_world_get_all_plugins(gWorld); @@ -172,7 +172,7 @@ void LoadLV2Plugins() delete effect; //std::cerr<<"Loaded LV2 \""< * Copyright (C) 2008 Dave Robillard - * + * * This header is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as published * by the Free Software Foundation; either version 2 of the License, or @@ -20,7 +20,7 @@ #ifndef LV2_EVENT_H #define LV2_EVENT_H - + #define LV2_EVENT_URI "http://lv2plug.in/ns/ext/event" #define LV2_EVENT_AUDIO_STAMP 0 @@ -30,7 +30,7 @@ * This header defines the code portion of the LV2 events extension with * URI . * - * Below, the URI prefix 'lv2ev' is assumed to expand to + * Below, the URI prefix 'lv2ev' is assumed to expand to * . * * This extension is a generic transport mechanism for time stamped events diff --git a/src/effects/lv2/lv2_event_helpers.h b/src/effects/lv2/lv2_event_helpers.h index 2fe1c9d21..c1984f7ee 100644 --- a/src/effects/lv2/lv2_event_helpers.h +++ b/src/effects/lv2/lv2_event_helpers.h @@ -118,8 +118,8 @@ lv2_event_increment(LV2_Event_Iterator* iter) LV2_Event* const ev = (LV2_Event*)( (uint8_t*)iter->buf->data + iter->offset); - iter->offset += lv2_event_pad_size(sizeof(LV2_Event) + ev->size); - + iter->offset += lv2_event_pad_size(sizeof(LV2_Event) + ev->size); + return true; } @@ -157,10 +157,10 @@ lv2_event_get_nonpod_type(LV2_Event_Iterator* iter) LV2_Event* const ev = (LV2_Event*)( (uint8_t*)iter->buf->data + iter->offset); - + if (ev->type != 0 || ev->size < 2) return 0; - + return *(uint16_t*)((uint8_t*)ev + sizeof(LV2_Event)); } @@ -183,18 +183,18 @@ lv2_event_write(LV2_Event_Iterator* iter, LV2_Event* const ev = (LV2_Event*)( (uint8_t*)iter->buf->data + iter->offset); - + ev->frames = frames; ev->subframes = subframes; ev->type = type; ev->size = size; memcpy((uint8_t*)ev + sizeof(LV2_Event), data, size); ++iter->buf->event_count; - + size = lv2_event_pad_size(sizeof(LV2_Event) + size); iter->buf->size += size; iter->offset += size; - + return true; } @@ -207,25 +207,25 @@ lv2_event_reserve(LV2_Event_Iterator* iter, uint32_t frames, uint32_t subframes, uint16_t type, - uint16_t size) + uint16_t size) { size = lv2_event_pad_size(size); if (iter->buf->capacity - iter->buf->size < sizeof(LV2_Event) + size) return NULL; - LV2_Event* const ev = (LV2_Event*)((uint8_t*)iter->buf->data + + LV2_Event* const ev = (LV2_Event*)((uint8_t*)iter->buf->data + iter->offset); - + ev->frames = frames; ev->subframes = subframes; ev->type = type; ev->size = size; ++iter->buf->event_count; - + size = lv2_event_pad_size(sizeof(LV2_Event) + size); iter->buf->size += size; iter->offset += size; - + return (uint8_t*)ev + sizeof(LV2_Event); } @@ -245,15 +245,15 @@ lv2_event_write_event(LV2_Event_Iterator* iter, LV2_Event* const write_ev = (LV2_Event*)( (uint8_t*)iter->buf->data + iter->offset); - + *write_ev = *ev; memcpy((uint8_t*)write_ev + sizeof(LV2_Event), data, ev->size); ++iter->buf->event_count; - + const uint16_t size = lv2_event_pad_size(sizeof(LV2_Event) + ev->size); iter->buf->size += size; iter->offset += size; - + return true; } diff --git a/src/effects/lv2/lv2_uri_map.h b/src/effects/lv2/lv2_uri_map.h index 96d3d5add..8c281f3cb 100644 --- a/src/effects/lv2/lv2_uri_map.h +++ b/src/effects/lv2/lv2_uri_map.h @@ -1,7 +1,7 @@ /* lv2_uri_map.h - C header file for the LV2 URI Map extension. - * + * * Copyright (C) 2008 Dave Robillard - * + * * This header is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as published * by the Free Software Foundation; either version 2 of the License, or @@ -36,7 +36,7 @@ * comparison. This allows the extensibility of RDF with the performance of * integers (or centrally defined enumerations). */ - + /** Opaque pointer to host data. */ typedef void* LV2_URI_Map_Callback_Data; diff --git a/src/effects/nyquist/Nyquist.cpp b/src/effects/nyquist/Nyquist.cpp index 3a311f7c1..1e57b37df 100644 --- a/src/effects/nyquist/Nyquist.cpp +++ b/src/effects/nyquist/Nyquist.cpp @@ -9,7 +9,7 @@ ******************************************************************//** \class EffectNyquist -\brief An Effect that calls up a Nyquist (XLISP) plug in, i.e. many possible +\brief An Effect that calls up a Nyquist (XLISP) plug in, i.e. many possible effects from this one class. *//****************************************************************//** @@ -146,7 +146,7 @@ wxString EffectNyquist::UnQuote(wxString s) { wxString out; int len = s.Length(); - + if (len >= 2 && s[0] == wxT('\"') && s[len - 1] == wxT('\"')) { return s.Mid(1, len - 2); } @@ -194,7 +194,7 @@ void EffectNyquist::Parse(wxString line) else { tok += c; } - + sl = false; } } @@ -239,7 +239,7 @@ void EffectNyquist::Parse(wxString line) if (len >= 2 && tokens[0] == wxT("debugflags")) { for (int i = 1; i < len; i++) { // Note: "trace" and "notrace" are overridden by "Debug" and "OK" - // buttons if the plug-in generates a dialog box by using controls + // buttons if the plug-in generates a dialog box by using controls if (tokens[i] == wxT("trace")) { mDebug = true; } @@ -284,12 +284,12 @@ void EffectNyquist::Parse(wxString line) if (len >= 6 && tokens[0] == wxT("control")) { NyqControl ctrl; - + ctrl.var = tokens[1]; ctrl.name = tokens[2]; ctrl.label = tokens[4]; ctrl.valStr = tokens[5]; - + if (tokens[3] == wxT("string")) { ctrl.type = NYQ_CTRL_STRING; } @@ -300,27 +300,27 @@ void EffectNyquist::Parse(wxString line) if (len < 8) { return; } - - if ((tokens[3] == wxT("real")) || + + if ((tokens[3] == wxT("real")) || (tokens[3] == wxT("float"))) // undocumented, but useful, alternative ctrl.type = NYQ_CTRL_REAL; else if (tokens[3] == wxT("int")) ctrl.type = NYQ_CTRL_INT; - else + else { wxString str; - str.Printf(_("Bad Nyquist 'control' type specification: '%s' in plugin file '%s'.\nControl not created."), + str.Printf(_("Bad Nyquist 'control' type specification: '%s' in plugin file '%s'.\nControl not created."), tokens[3].c_str(), mFileName.GetFullPath().c_str()); // Too disturbing to show alert before Audacity frame is up. // wxMessageBox(str, wxT("Nyquist Warning"), wxOK | wxICON_EXCLAMATION); - // Note that the AudacityApp's mLogger has not yet been created, + // Note that the AudacityApp's mLogger has not yet been created, // so this brings up an alert box, but after the Audacity frame is up. wxLogWarning(str); return; } - + ctrl.lowStr = tokens[6]; ctrl.highStr = tokens[7]; } @@ -329,7 +329,7 @@ void EffectNyquist::Parse(wxString line) mControls.Add(ctrl); } - + if (len >= 2 && tokens[0] == wxT("categories")) { for (size_t i = 1; i < tokens.GetCount(); ++i) { mCategories.Add(tokens[i]); @@ -376,7 +376,7 @@ void EffectNyquist::SetCommand(wxString cmd) wxStringTokenizer lines(cmd, wxT("\n")); while (lines.HasMoreTokens()) { wxString line = lines.GetNextToken(); - + if (line.Length() > 1 && line[0] == wxT(';')) { Parse(line); } @@ -453,7 +453,7 @@ bool EffectNyquist::TransferParameters( Shuttle & shuttle ) //str is coma separated labels for each choice wxString str = ctrl->label; wxArrayString choices; - + while (1) { int ci = str.Find( ',' ); //coma index @@ -464,7 +464,7 @@ bool EffectNyquist::TransferParameters( Shuttle & shuttle ) else { choices.Add(str.Left(ci)); } - + str = str.Right(str.length() - ci - 1); } @@ -523,7 +523,7 @@ bool EffectNyquist::PromptUser() // Is this LISP or SAL? Both allow comments. After comments, LISP // must begin with "(". Technically, a LISP expression could be a - // symbol or number or string, etc., but these are not really + // symbol or number or string, etc., but these are not really // useful expressions. If the input begins with a symbol, number, // or string, etc., it is more likely an erroneous attempt to type // a SAL expression (which should probably begin with "return"), @@ -541,17 +541,17 @@ bool EffectNyquist::PromptUser() inComment = (mCmd[i] != wxT('\n')); } else if (mCmd[i] == wxT(';')) { inComment = true; - } else if (!wxIsspace(mCmd[i])) { + } else if (!wxIsspace(mCmd[i])) { break; // found the first non-comment, non-space character } i++; } - // invariant: i == mCmd.Len() | + // invariant: i == mCmd.Len() | // mCmd[i] is first non-comment, non-space character - + mIsSal = false; - if (mCmd.Len() > i && mCmd[i] != wxT('(') && + if (mCmd.Len() > i && mCmd[i] != wxT('(') && (mCmd[i] != wxT('#') || mCmd.Len() <= i + 1 || mCmd[i + 1] != wxT('|'))) { mIsSal = true; @@ -591,7 +591,7 @@ bool EffectNyquist::PromptUser() if (ctrl->type == NYQ_CTRL_CHOICE) { continue; } - + ctrl->low = GetCtrlValue(ctrl->lowStr); ctrl->high = GetCtrlValue(ctrl->highStr); @@ -621,7 +621,7 @@ bool EffectNyquist::PromptUser() if (result == wxID_CANCEL) { return false; } - + /* if (result == eDebugID) { mDebug = true; } */ @@ -671,7 +671,7 @@ bool EffectNyquist::Process() mCurTrack[1] = (WaveTrack *)iter.Next(); if (mCurTrack[1]->GetRate() != mCurTrack[0]->GetRate()) { - wxMessageBox(_("Sorry, cannot apply effect on stereo tracks where the tracks don't match."), + wxMessageBox(_("Sorry, cannot apply effect on stereo tracks where the tracks don't match."), wxT("Nyquist"), wxOK | wxCENTRE, mParent); success = false; @@ -700,7 +700,7 @@ bool EffectNyquist::Process() // // MB: setlocale is not thread-safe. Should use uselocale() // if available, or fix libnyquist to be locale-independent. - // See also http://bugzilla.audacityteam.org/show_bug.cgi?id=642#c9 + // See also http://bugzilla.audacityteam.org/show_bug.cgi?id=642#c9 // for further info about this thread safety question. wxString prevlocale = wxSetlocale(LC_NUMERIC, NULL); wxSetlocale(LC_NUMERIC, wxT("C")); @@ -773,7 +773,7 @@ bool EffectNyquist::ProcessOne() } // Restore the Nyquist sixteenth note symbol for Generate plugins. - // See http://bugzilla.audacityteam.org/show_bug.cgi?id=490. + // See http://bugzilla.audacityteam.org/show_bug.cgi?id=490. if (GetEffectFlags() & INSERT_EFFECT) { cmd += wxT("(setf s 0.25)\n"); } @@ -788,7 +788,7 @@ bool EffectNyquist::ProcessOne() mControls[j].var.c_str(), Internat::ToString(mControls[j].val, 14).c_str()); } - else if (mControls[j].type == NYQ_CTRL_INT || + else if (mControls[j].type == NYQ_CTRL_INT || mControls[j].type == NYQ_CTRL_CHOICE) { cmd += wxString::Format(wxT("(setf %s %d)\n"), mControls[j].var.c_str(), @@ -854,7 +854,7 @@ bool EffectNyquist::ProcessOne() rval = nyx_eval_expression(cmd.mb_str(wxConvUTF8)); if (rval == nyx_string) { - wxMessageBox(NyquistToWxString(nyx_get_string()), + wxMessageBox(NyquistToWxString(nyx_get_string()), wxT("Nyquist"), wxOK | wxCENTRE, mParent); return true; @@ -890,7 +890,7 @@ bool EffectNyquist::ProcessOne() break; } } - + if (!ltrack) { ltrack = mFactory->NewLabelTrack(); this->AddToOutputTracks((Track *)ltrack); @@ -912,7 +912,7 @@ bool EffectNyquist::ProcessOne() wxOK | wxCENTRE, mParent); return false; } - + int outChannels; outChannels = nyx_get_audio_num_channels(); @@ -1190,7 +1190,7 @@ NyquistDialog::NyquistDialog(wxWindow * parent, wxWindowID id, //str is coma separated labels for each choice wxString str = ctrl->label; wxArrayString choices; - + while (1) { int ci = str.Find( ',' ); //coma index @@ -1201,19 +1201,19 @@ NyquistDialog::NyquistDialog(wxWindow * parent, wxWindowID id, else { choices.Add(str.Left(ci)); } - + str = str.Right(str.length() - ci - 1); } - wxChoice *choice = new wxChoice(this, ID_NYQ_CHOICE + i, + wxChoice *choice = new wxChoice(this, ID_NYQ_CHOICE + i, wxDefaultPosition, wxSize(150, -1), choices); choice->SetName(ctrl->name); - + int val = (int)ctrl->val; if (val >= 0 && val < (int)choice->GetCount()) { choice->SetSelection(val); } - + grid->Add(10, 10); grid->Add(choice, 0, wxALIGN_CENTRE | wxALIGN_CENTER_VERTICAL | wxALL, 5); } @@ -1246,14 +1246,14 @@ NyquistDialog::NyquistDialog(wxWindow * parent, wxWindowID id, } grid->Add(item, 0, wxALIGN_CENTRE | wxALIGN_CENTER_VERTICAL | wxALL, 5); - + item = new wxSlider(this, ID_NYQ_SLIDER+i, val, 0, ctrl->ticks, wxDefaultPosition, wxSize(150, -1)); item->SetName(ctrl->name); grid->Add(item, 0, wxALIGN_CENTRE | wxALIGN_CENTER_VERTICAL | wxALL, 5); } - + if (ctrl->type == NYQ_CTRL_CHOICE) { grid->Add( 10, 10 ); } @@ -1298,7 +1298,7 @@ void NyquistDialog::OnSlider(wxCommandEvent & /* event */) wxSlider *slider = (wxSlider *)FindWindow(ID_NYQ_SLIDER + i); wxTextCtrl *text = (wxTextCtrl *)FindWindow(ID_NYQ_TEXT + i); wxASSERT(slider && text); - + int val = slider->GetValue(); double newVal = (val / (double)ctrl->ticks)* @@ -1314,7 +1314,7 @@ void NyquistDialog::OnSlider(wxCommandEvent & /* event */) // change it (this prevents changes from manually entered values unless // the slider actually moved) if (fabs(newVal - ctrl->val) >= (1 / (double)ctrl->ticks) * - (ctrl->high - ctrl->low) && + (ctrl->high - ctrl->low) && fabs(newVal - ctrl->val) >= pow(0.1, precision) / 2 ) { // First round to the appropriate precision @@ -1340,14 +1340,14 @@ void NyquistDialog::OnChoice( wxCommandEvent &event ) unsigned int ctrlId = event.GetId() - ID_NYQ_CHOICE; wxASSERT(ctrlId >= 0 && ctrlId < mControls->GetCount()); - + NyqControl *ctrl = &(mControls->Item(ctrlId)); wxChoice *choice = (wxChoice *)FindWindow(ID_NYQ_CHOICE + ctrlId); wxASSERT(choice); ctrl->val = choice->GetSelection(); - mInHandler = false; + mInHandler = false; } void NyquistDialog::OnText(wxCommandEvent &event) @@ -1382,9 +1382,9 @@ void NyquistDialog::OnText(wxCommandEvent &event) } slider->SetValue(pos); - } + } - mInHandler = false; + mInHandler = false; } void NyquistDialog::OnOk(wxCommandEvent & /* event */) diff --git a/src/effects/nyquist/Nyquist.h b/src/effects/nyquist/Nyquist.h index c65fa163b..3b4a926a5 100644 --- a/src/effects/nyquist/Nyquist.h +++ b/src/effects/nyquist/Nyquist.h @@ -53,8 +53,8 @@ WX_DECLARE_USER_EXPORTED_OBJARRAY(NyqControl, NyqControlArray, AUDACITY_DLL_API class AUDACITY_DLL_API EffectNyquist:public Effect { public: - - /** @param fName File name of the Nyquist script defining this effect. If + + /** @param fName File name of the Nyquist script defining this effect. If * an empty string, then prompt the user for the Nyquist code to interpret. */ EffectNyquist(wxString fName); @@ -80,7 +80,7 @@ class AUDACITY_DLL_API EffectNyquist:public Effect virtual wxString GetEffectName() { return mName; } - + virtual std::set GetEffectCategories() { std::set cats; for (size_t i = 0; i < mCategories.GetCount(); i++) { @@ -94,7 +94,7 @@ class AUDACITY_DLL_API EffectNyquist:public Effect // Disabled for now... return wxT(""); } - + wxStringTokenizer st(mName, wxT(" ")); wxString id; @@ -107,19 +107,19 @@ class AUDACITY_DLL_API EffectNyquist:public Effect return id; } - + virtual wxString GetEffectAction() { return mAction; } virtual bool PromptUser(); - + virtual bool Process(); // Batch chain support - virtual bool SupportsChains(); + virtual bool SupportsChains(); virtual bool TransferParameters( Shuttle & shuttle ); - + private: static wxString NyquistToWxString(const char *nyqString); @@ -165,7 +165,7 @@ class AUDACITY_DLL_API EffectNyquist:public Effect * the "Nyquist Prompt", false for all other effects (lisp code read from * files) */ - bool mInteractive; + bool mInteractive; bool mOK; wxString mInputCmd; // history: exactly what the user typed wxString mCmd; // the command to be processed diff --git a/src/effects/vamp/LoadVamp.cpp b/src/effects/vamp/LoadVamp.cpp index a91406ea0..bb27a3bb9 100644 --- a/src/effects/vamp/LoadVamp.cpp +++ b/src/effects/vamp/LoadVamp.cpp @@ -49,9 +49,9 @@ static wxString VampHierarchyToUri(const PluginLoader::PluginCategoryHierarchy& { // Else, generate URIs and add them to the EffectManager EffectManager& em = EffectManager::Get(); - wxString vampCategory = + wxString vampCategory = wxString::FromAscii("http://audacityteam.org/namespace#VampCategories"); - EffectCategory* parent = + EffectCategory* parent = em.LookupCategory(wxT("http://lv2plug.in/ns/lv2core#AnalyserPlugin")); if (parent) { for (size_t c = 0; c < h.size(); ++c) { @@ -77,9 +77,9 @@ void LoadVampPlugins() #endif PluginLoader *loader = PluginLoader::getInstance(); - + EffectManager& em = EffectManager::Get(); - + PluginLoader::PluginKeyList keys = loader->listPlugins(); for (PluginLoader::PluginKeyList::iterator i = keys.begin(); @@ -87,15 +87,15 @@ void LoadVampPlugins() Plugin *vp = loader->loadPlugin(*i, 48000); // rate doesn't matter here if (!vp) continue; - + #ifdef EFFECT_CATEGORIES - PluginLoader::PluginCategoryHierarchy category = + PluginLoader::PluginCategoryHierarchy category = loader->getPluginCategory(*i); wxString vampCategory = VampHierarchyToUri(category); #endif - + // We limit the listed plugin outputs to those whose results can // readily be displayed in an Audacity label track. // @@ -104,7 +104,7 @@ void LoadVampPlugins() // // - Any output whose features have more than one value, or an // unknown or variable number of values, is right out - // + // // - Any output whose features have exactly one value, with // variable sample rate or with duration, should be OK -- // this implies a sparse feature, of which the time and/or @@ -120,7 +120,7 @@ void LoadVampPlugins() int n = 0; bool hasParameters = !vp->getParameterDescriptors().empty(); - + for (Plugin::OutputList::iterator j = outputs.begin(); j != outputs.end(); ++j) { @@ -134,7 +134,7 @@ void LoadVampPlugins() ++n; continue; } - + wxString name = LAT1CTOWX(vp->getName().c_str()); if (outputs.size() > 1) { diff --git a/src/effects/vamp/VampEffect.cpp b/src/effects/vamp/VampEffect.cpp index 2e173ca31..284be4ff1 100644 --- a/src/effects/vamp/VampEffect.cpp +++ b/src/effects/vamp/VampEffect.cpp @@ -86,7 +86,7 @@ bool VampEffect::Init() { Vamp::HostExt::PluginLoader *loader = Vamp::HostExt::PluginLoader::getInstance(); - + delete mPlugin; mPlugin = 0; @@ -98,17 +98,17 @@ bool VampEffect::Init() while (left) { if (mRate == 0.0) mRate = left->GetRate(); - + if (left->GetLinked()) { WaveTrack *right = (WaveTrack *)iter.Next(); - + if (left->GetRate() != right->GetRate()) { wxMessageBox(_("Sorry, Vamp Plug-ins cannot be run on stereo tracks where the individual channels of the track do not match.")); return false; } } - + left = (WaveTrack *)iter.Next(); } @@ -165,7 +165,7 @@ bool VampEffect::Process() sampleCount lstart, rstart = 0; sampleCount len; GetSamples(left, &lstart, &len); - + WaveTrack *right = NULL; int channels = 1; @@ -229,7 +229,7 @@ bool VampEffect::Process() sampleCount rs = rstart; while (len) { - + int request = block; if (request > len) request = len; @@ -281,7 +281,7 @@ void VampEffect::AddFeatures(LabelTrack *ltrack, { for (Vamp::Plugin::FeatureList::iterator fli = features[mOutput].begin(); fli != features[mOutput].end(); ++fli) { - + Vamp::RealTime ftime0 = fli->timestamp; double ltime0 = ftime0.sec + (double(ftime0.nsec) / 1000000000.0); @@ -297,7 +297,7 @@ void VampEffect::AddFeatures(LabelTrack *ltrack, label = wxString::Format(LAT1CTOWX("%.3f"), *fli->values.begin()); } } - + ltrack->AddLabel(ltime0, ltime1, label); } } @@ -335,9 +335,9 @@ VampEffectDialog::VampEffectDialog(VampEffect *effect, #ifdef __WXMSW__ // On Windows, for some reason, wxWidgets calls OnTextCtrl during creation - // of the text control, and VampEffectDialog::OnTextCtrl calls HandleText, - // which assumes all the fields have been initialized. - // This can give us a bad pointer crash, so manipulate inSlider to + // of the text control, and VampEffectDialog::OnTextCtrl calls HandleText, + // which assumes all the fields have been initialized. + // This can give us a bad pointer crash, so manipulate inSlider to // no-op HandleText during creation. inSlider = true; #else @@ -345,7 +345,7 @@ VampEffectDialog::VampEffectDialog(VampEffect *effect, #endif inText = false; - + int count = mParameters.size(); toggles = new wxCheckBox*[count]; @@ -372,7 +372,7 @@ VampEffectDialog::VampEffectDialog(VampEffect *effect, + LAT1CTOWX(plugin->getMaker().c_str())); vSizer->Add(item, 0, wxALL, 5); - + item = new wxStaticText(this, 0, LAT1CTOWX(plugin->getCopyright().c_str())); vSizer->Add(item, 0, wxALL, 5); @@ -387,7 +387,7 @@ VampEffectDialog::VampEffectDialog(VampEffect *effect, w->SetMinSize(wxSize( wxMax(400, parent->GetSize().GetWidth() / 2), parent->GetSize().GetHeight() / 2)); - + w->SetScrollRate(0, 20); vSizer->Add(w, 1, wxEXPAND|wxALL, 5); @@ -415,7 +415,7 @@ VampEffectDialog::VampEffectDialog(VampEffect *effect, choices.Add(choice); } - gridSizer->Add(new wxStaticText(w, 0, _("Program")), + gridSizer->Add(new wxStaticText(w, 0, _("Program")), 0, wxALIGN_CENTER_VERTICAL | wxALL, 5); programCombo = new wxComboBox(w, 9999, currentProgram, @@ -524,7 +524,7 @@ VampEffectDialog::VampEffectDialog(VampEffect *effect, // text fields inSlider = false; // Now we're ready for HandleText to actually do something. HandleText(); - + paramSizer->Add(gridSizer, 1, wxEXPAND | wxALL, 5); w->SetSizer(paramSizer); @@ -677,7 +677,7 @@ void VampEffectDialog::HandleText() mPlugin->setParameter(mParameters[p].identifier, val); - sliders[p]->SetValue((int)(((val-lower)/range) * 1000.0 + 0.5)); + sliders[p]->SetValue((int)(((val-lower)/range) * 1000.0 + 0.5)); } inText = false; diff --git a/src/effects/vamp/VampEffect.h b/src/effects/vamp/VampEffect.h index a340739ed..e3c3823fa 100644 --- a/src/effects/vamp/VampEffect.h +++ b/src/effects/vamp/VampEffect.h @@ -27,7 +27,7 @@ class wxComboBox; void LoadVampPlugins(); class VampEffect : public Effect { - + public: VampEffect(Vamp::HostExt::PluginLoader::PluginKey key, @@ -38,7 +38,7 @@ class VampEffect : public Effect { virtual ~VampEffect(); virtual wxString GetEffectName(); - + virtual std::set GetEffectCategories(); virtual wxString GetEffectIdentifier(); @@ -64,7 +64,7 @@ class VampEffect : public Effect { wxString mName; double mRate; wxString mCategory; - + Vamp::Plugin *mPlugin; void AddFeatures(LabelTrack *track, diff --git a/src/export/Export.cpp b/src/export/Export.cpp index 496db6b75..2c7165199 100644 --- a/src/export/Export.cpp +++ b/src/export/Export.cpp @@ -379,7 +379,7 @@ bool Exporter::Process(AudacityProject *project, bool selectedOnly, double t0, d return false; } - // Let user edit MetaData + // Let user edit MetaData if (mPlugins[mFormat]->GetCanMetaData(mSubFormat)) { if (!(project->GetTags()->ShowEditDialog(project, _("Edit Metadata"), mProject->GetShowId3Dialog()))) { return false; @@ -466,7 +466,7 @@ bool Exporter::ExamineTracks() else if (tr->GetChannel() == Track::MonoChannel) { // It's a mono channel, but it may be panned float pan = ((WaveTrack*)tr)->GetPan(); - + if (pan == -1.0) mNumLeft++; else if (pan == 1.0) @@ -602,7 +602,7 @@ bool Exporter::GetFilename() wxString prompt = _("Are you sure you want to export the file as \"") + mFilename.GetFullName() + wxT("\"?\n"); - + int action = wxMessageBox(prompt, _("Warning"), wxYES_NO | wxICON_EXCLAMATION); @@ -667,7 +667,7 @@ If you still wish to export, please choose a different filename or folder.")); prompt.Printf(_("A file named \"%s\" already exists. Replace?"), mFilename.GetFullPath().c_str()); - + int action = wxMessageBox(prompt, _("Warning"), wxYES_NO | wxICON_EXCLAMATION); @@ -675,7 +675,7 @@ If you still wish to export, please choose a different filename or folder.")); continue; } } - + break; } @@ -774,7 +774,7 @@ bool Exporter::CheckMix() int numLeft = mNumLeft + mNumMono; int numRight = mNumRight + mNumMono; - + if (numLeft > 1 || numRight > 1 || mNumLeft + mNumRight + mNumMono > mChannels) { if (mChannels == 2) { if (ShowWarningDialog(mProject, @@ -797,10 +797,10 @@ bool Exporter::CheckMix() ExportMixerDialog md(mProject->GetTracks(), mSelectedOnly, mPlugins[mFormat]->GetMaxChannels(mSubFormat), - NULL, + NULL, 1, _("Advanced Mixing Options")); - + if (md.ShowModal() != wxID_OK) { return false; } @@ -855,8 +855,8 @@ BEGIN_EVENT_TABLE(ExportMixerPanel, wxPanel) EVT_MOUSE_EVENTS(ExportMixerPanel::OnMouseEvent) END_EVENT_TABLE() -ExportMixerPanel::ExportMixerPanel( MixerSpec *mixerSpec, - wxArrayString trackNames,wxWindow *parent, wxWindowID id, +ExportMixerPanel::ExportMixerPanel( MixerSpec *mixerSpec, + wxArrayString trackNames,wxWindow *parent, wxWindowID id, const wxPoint& pos, const wxSize& size): wxPanel(parent, id, pos, size) { @@ -910,8 +910,8 @@ void ExportMixerPanel::OnPaint(wxPaintEvent & WXUNUSED(event)) int width, height; GetSize( &width, &height ); - - if( !mBitmap || mWidth != width || mHeight != height ) + + if( !mBitmap || mWidth != width || mHeight != height ) { if( mBitmap ) delete mBitmap; @@ -923,7 +923,7 @@ void ExportMixerPanel::OnPaint(wxPaintEvent & WXUNUSED(event)) wxColour bkgnd = GetBackgroundColour(); wxBrush bkgndBrush( bkgnd, wxSOLID ); - + wxMemoryDC memDC; memDC.SelectObject( *mBitmap ); @@ -940,11 +940,11 @@ void ExportMixerPanel::OnPaint(wxPaintEvent & WXUNUSED(event)) //box dimensions mBoxWidth = mWidth / 6; - + mTrackHeight = ( mHeight * 3 ) / ( mMixerSpec->GetNumTracks() * 4 ); if( mTrackHeight > 30 ) mTrackHeight = 30; - + mChannelHeight = ( mHeight * 3 ) / ( mMixerSpec->GetNumChannels() * 4 ); if( mChannelHeight > 30 ) mChannelHeight = 30; @@ -957,48 +957,48 @@ void ExportMixerPanel::OnPaint(wxPaintEvent & WXUNUSED(event)) //draw tracks memDC.SetBrush( AColor::envelopeBrush ); angle = totAngle / ( mMixerSpec->GetNumTracks() + 1 ); - + int max = 0, w, h; for( int i = 1; i < mMixerSpec->GetNumTracks(); i++ ) if( mTrackNames[ i ].length() > mTrackNames[ max ].length() ) max = i; - + SetFont( memDC, mTrackNames[ max ], mBoxWidth, mTrackHeight ); - + for( int i = 0; i < mMixerSpec->GetNumTracks(); i++ ) { - mTrackRects[ i ].x = ( int )( mBoxWidth * 2 + radius - radius * + mTrackRects[ i ].x = ( int )( mBoxWidth * 2 + radius - radius * cos( totAngle / 2.0 - angle * ( i + 1 ) ) - mBoxWidth + 0.5 ); - mTrackRects[ i ].y = ( int )( mHeight * 0.5 - radius * - sin( totAngle * 0.5 - angle * ( i + 1.0 ) ) - + mTrackRects[ i ].y = ( int )( mHeight * 0.5 - radius * + sin( totAngle * 0.5 - angle * ( i + 1.0 ) ) - 0.5 * mTrackHeight + 0.5 ); mTrackRects[ i ].width = mBoxWidth; mTrackRects[ i ].height = mTrackHeight; - + memDC.SetPen( mSelectedTrack == i ? *wxRED_PEN : *wxBLACK_PEN ); memDC.DrawRectangle( mTrackRects[ i ] ); memDC.GetTextExtent( mTrackNames[ i ], &w, &h ); - memDC.DrawText( mTrackNames[ i ], - mTrackRects[ i ].x + ( mBoxWidth - w ) / 2, + memDC.DrawText( mTrackNames[ i ], + mTrackRects[ i ].x + ( mBoxWidth - w ) / 2, mTrackRects[ i ].y + ( mTrackHeight - h ) / 2 ); } //draw channels memDC.SetBrush( AColor::playRegionBrush[ 0 ] ); - angle = ( asin( mHeight / ( 2.0 * radius ) ) * 2.0 ) / + angle = ( asin( mHeight / ( 2.0 * radius ) ) * 2.0 ) / ( mMixerSpec->GetNumChannels() + 1 ); SetFont( memDC, wxT( "Channel: XX" ), mBoxWidth, mChannelHeight ); memDC.GetTextExtent( wxT( "Channel: XX" ), &w, &h ); - + for( int i = 0; i < mMixerSpec->GetNumChannels(); i++ ) { - mChannelRects[ i ].x = ( int )( mBoxWidth * 4 - radius + radius * + mChannelRects[ i ].x = ( int )( mBoxWidth * 4 - radius + radius * cos( totAngle * 0.5 - angle * ( i + 1 ) ) + 0.5 ); - mChannelRects[ i ].y = ( int )( mHeight * 0.5 - radius * - sin( totAngle * 0.5 - angle * ( i + 1 ) ) - + mChannelRects[ i ].y = ( int )( mHeight * 0.5 - radius * + sin( totAngle * 0.5 - angle * ( i + 1 ) ) - 0.5 * mChannelHeight + 0.5 ); mChannelRects[ i ].width = mBoxWidth; @@ -1006,21 +1006,21 @@ void ExportMixerPanel::OnPaint(wxPaintEvent & WXUNUSED(event)) memDC.SetPen( mSelectedChannel == i ? *wxRED_PEN : *wxBLACK_PEN ); memDC.DrawRectangle( mChannelRects[ i ] ); - + memDC.DrawText( wxString::Format( _( "Channel: %2d" ), i + 1 ), mChannelRects[ i ].x + ( mBoxWidth - w ) / 2, mChannelRects[ i ].y + ( mChannelHeight - h ) / 2 ); } - + //draw links memDC.SetPen( wxPen( *wxBLACK, mHeight / 200 ) ); for( int i = 0; i < mMixerSpec->GetNumTracks(); i++ ) for( int j = 0; j < mMixerSpec->GetNumChannels(); j++ ) if( mMixerSpec->mMap[ i ][ j ] ) - AColor::Line(memDC, mTrackRects[ i ].x + mBoxWidth, + AColor::Line(memDC, mTrackRects[ i ].x + mBoxWidth, mTrackRects[ i ].y + mTrackHeight / 2, mChannelRects[ j ].x, mChannelRects[ j ].y + mChannelHeight / 2 ); - + dc.Blit( 0, 0, mWidth, mHeight, &memDC, 0, 0, wxCOPY, FALSE ); } @@ -1037,10 +1037,10 @@ bool ExportMixerPanel::IsOnLine( wxPoint p, wxPoint la, wxPoint lb ) void ExportMixerPanel::OnMouseEvent(wxMouseEvent & event) { - if( event.ButtonDown() ) + if( event.ButtonDown() ) { bool reset = true; - //check tracks + //check tracks for( int i = 0; i < mMixerSpec->GetNumTracks(); i++ ) if( mTrackRects[ i ].Contains( event.m_x, event.m_y ) ) { @@ -1051,7 +1051,7 @@ void ExportMixerPanel::OnMouseEvent(wxMouseEvent & event) { mSelectedTrack = i; if( mSelectedChannel != -1 ) - mMixerSpec->mMap[ mSelectedTrack ][ mSelectedChannel ] = + mMixerSpec->mMap[ mSelectedTrack ][ mSelectedChannel ] = !mMixerSpec->mMap[ mSelectedTrack ][ mSelectedChannel ]; } goto found; @@ -1068,7 +1068,7 @@ void ExportMixerPanel::OnMouseEvent(wxMouseEvent & event) { mSelectedChannel = i; if( mSelectedTrack != -1 ) - mMixerSpec->mMap[ mSelectedTrack ][ mSelectedChannel ] = + mMixerSpec->mMap[ mSelectedTrack ][ mSelectedChannel ] = !mMixerSpec->mMap[ mSelectedTrack ][ mSelectedChannel ]; } goto found; @@ -1078,9 +1078,9 @@ void ExportMixerPanel::OnMouseEvent(wxMouseEvent & event) for( int i = 0; i < mMixerSpec->GetNumTracks(); i++ ) for( int j = 0; j < mMixerSpec->GetNumChannels(); j++ ) if( mMixerSpec->mMap[ i ][ j ] && IsOnLine( wxPoint( event.m_x, - event.m_y ), wxPoint( mTrackRects[ i ].x + mBoxWidth, + event.m_y ), wxPoint( mTrackRects[ i ].x + mBoxWidth, mTrackRects[ i ].y + mTrackHeight / 2 ), - wxPoint( mChannelRects[ j ].x, mChannelRects[ j ].y + + wxPoint( mChannelRects[ j ].x, mChannelRects[ j ].y + mChannelHeight / 2 ) ) ) mMixerSpec->mMap[ i ][ j ] = false; @@ -1109,7 +1109,7 @@ BEGIN_EVENT_TABLE( ExportMixerDialog,wxDialog ) END_EVENT_TABLE() ExportMixerDialog::ExportMixerDialog( TrackList *tracks, bool selectedOnly, - int maxNumChannels, wxWindow *parent, wxWindowID id, const wxString &title, + int maxNumChannels, wxWindow *parent, wxWindowID id, const wxString &title, const wxPoint &position, const wxSize& size, long style ) : wxDialog( parent, id, title, position, size, style | wxRESIZE_BORDER ) { @@ -1145,7 +1145,7 @@ ExportMixerDialog::ExportMixerDialog( TrackList *tracks, bool selectedOnly, wxBoxSizer *vertSizer = new wxBoxSizer( wxVERTICAL ); - wxWindow *mixerPanel = new ExportMixerPanel( mMixerSpec, mTrackNames, this, + wxWindow *mixerPanel = new ExportMixerPanel( mMixerSpec, mTrackNames, this, ID_MIXERPANEL, wxDefaultPosition, wxSize( 400, -1 ) ); mixerPanel->SetName(_("Mixer Panel")); vertSizer->Add( mixerPanel, 1, wxEXPAND | wxALIGN_CENTRE | wxALL, 5 ); @@ -1157,12 +1157,12 @@ ExportMixerDialog::ExportMixerDialog( TrackList *tracks, bool selectedOnly, mChannelsText = new wxStaticText( this, -1, label); horSizer->Add( mChannelsText, 0, wxALIGN_LEFT | wxALL, 5 ); - wxSlider *channels = new wxSlider( this, ID_SLIDER_CHANNEL, + wxSlider *channels = new wxSlider( this, ID_SLIDER_CHANNEL, mMixerSpec->GetNumChannels(), 1, mMixerSpec->GetMaxNumChannels(), wxDefaultPosition, wxSize( 300, -1 ) ); channels->SetName(label); horSizer->Add( channels, 0, wxEXPAND | wxALL, 5 ); - + vertSizer->Add( horSizer, 0, wxALIGN_CENTRE | wxALL, 5 ); vertSizer->Add( CreateStdButtonSizer(this, eCancelButton|eOkButton), 0, wxEXPAND ); diff --git a/src/export/Export.h b/src/export/Export.h index da9c20bba..92d55fb13 100644 --- a/src/export/Export.h +++ b/src/export/Export.h @@ -64,7 +64,7 @@ public: void SetMask(const wxString & mask, int index); void SetMaxChannels(int maxchannels, int index); void SetCanMetaData(bool canmetadata, int index); - + virtual int GetFormatCount(); virtual wxString GetFormat(int index); virtual wxString GetDescription(int index); @@ -77,7 +77,7 @@ public: virtual wxString GetMask(int index); virtual int GetMaxChannels(int index); virtual bool GetCanMetaData(int index); - + virtual bool IsExtension(wxString & ext, int index); virtual bool DisplayOptions(wxWindow *parent, int format = 0); @@ -193,7 +193,7 @@ private: class ExportMixerPanel: public wxPanel { public: - ExportMixerPanel( MixerSpec *mixerSpec, wxArrayString trackNames, + ExportMixerPanel( MixerSpec *mixerSpec, wxArrayString trackNames, wxWindow *parent, wxWindowID id, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize); virtual ~ExportMixerPanel(); @@ -213,7 +213,7 @@ private: wxArrayString mTrackNames; int mBoxWidth, mChannelHeight, mTrackHeight; - void SetFont( wxMemoryDC &memDC, wxString text, int width, int height ); + void SetFont( wxMemoryDC &memDC, wxString text, int width, int height ); double Distance( wxPoint &a, wxPoint &b ); bool IsOnLine( wxPoint p, wxPoint la, wxPoint lb ); @@ -228,9 +228,9 @@ class ExportMixerDialog : public wxDialog public: // constructors and destructors ExportMixerDialog( TrackList * tracks, bool selectedOnly, int maxNumChannels, - wxWindow *parent, wxWindowID id, const wxString &title, + wxWindow *parent, wxWindowID id, const wxString &title, const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, + const wxSize& size = wxDefaultSize, long style = wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER ); virtual ~ExportMixerDialog(); @@ -240,7 +240,7 @@ private: wxStaticText *mChannelsText; MixerSpec *mMixerSpec; wxArrayString mTrackNames; - + private: void OnOk( wxCommandEvent &event ); void OnCancel( wxCommandEvent &event ); diff --git a/src/export/ExportCL.cpp b/src/export/ExportCL.cpp index ddf8b38d8..52dffb736 100644 --- a/src/export/ExportCL.cpp +++ b/src/export/ExportCL.cpp @@ -58,8 +58,8 @@ BEGIN_EVENT_TABLE(ExportCLOptions, wxDialog) EVT_BUTTON(ID_BROWSE, ExportCLOptions::OnBrowse) END_EVENT_TABLE() -/// -/// +/// +/// ExportCLOptions::ExportCLOptions(wxWindow *parent) : wxDialog(parent, wxID_ANY, wxString(_("Specify Command Line Encoder"))) @@ -80,8 +80,8 @@ ExportCLOptions::ExportCLOptions(wxWindow *parent) PopulateOrExchange(S); } -/// -/// +/// +/// void ExportCLOptions::PopulateOrExchange(ShuttleGui & S) { wxArrayString cmds; @@ -127,8 +127,8 @@ void ExportCLOptions::PopulateOrExchange(ShuttleGui & S) return; } -/// -/// +/// +/// void ExportCLOptions::OnOK(wxCommandEvent& WXUNUSED(event)) { ShuttleGui S(this, eIsSavingToPrefs); @@ -147,8 +147,8 @@ void ExportCLOptions::OnOK(wxCommandEvent& WXUNUSED(event)) return; } -/// -/// +/// +/// void ExportCLOptions::OnBrowse(wxCommandEvent& WXUNUSED(event)) { wxString path; @@ -243,7 +243,7 @@ struct wav_header { char riffID[4]; /* "RIFF" */ wxUint32 lenAfterRiff; /* basically the file len - 8, or samples len + 36 */ char riffType[4]; /* "WAVE" */ - + /* format chunk */ char fmtID[4]; /* "fmt " */ wxUint32 formatChunkLen; /* (format chunk len - first two fields) 16 in our case */ @@ -301,7 +301,7 @@ int ExportCL::Export(AudacityProject *project, wxString fName, bool selectionOnly, double t0, - double t1, + double t1, MixerSpec *mixerSpec, Tags *WXUNUSED(metadata), int WXUNUSED(subformat)) @@ -443,7 +443,7 @@ int ExportCL::Export(AudacityProject *project, if (numSamples == 0) { break; } - + mixed = mixer->GetBuffer(); numBytes = numSamples * channels; diff --git a/src/export/ExportFFmpegDialogs.h b/src/export/ExportFFmpegDialogs.h index 5ab7379ab..3c52316c4 100644 --- a/src/export/ExportFFmpegDialogs.h +++ b/src/export/ExportFFmpegDialogs.h @@ -22,7 +22,7 @@ LRN /// Identifiers for pre-set export types. -enum FFmpegExposedFormat +enum FFmpegExposedFormat { FMT_M4A, FMT_AC3, @@ -237,7 +237,7 @@ private: wxButton *mDeletePreset; wxButton *mImportPresets; wxButton *mExportPresets; - + int mBitRateFromChoice; int mSampleRateFromChoice; @@ -247,7 +247,7 @@ private: /// Finds the format currently selected and returns it's name and description void FindSelectedFormat(wxString **name, wxString **longname); - + /// Finds the codec currently selected and returns it's name and description void FindSelectedCodec(wxString **name, wxString **longname); @@ -275,7 +275,7 @@ private: // Enables/disables controls based on format/codec combination, // leaving only relevant controls enabled. // Hiding the controls may have been a better idea, - // but it's hard to hide their text labels too + // but it's hard to hide their text labels too void EnableDisableControls(AVCodec *cdc, wxString *selfmt); DECLARE_EVENT_TABLE() }; diff --git a/src/export/ExportFLAC.cpp b/src/export/ExportFLAC.cpp index 782133405..50d89535f 100644 --- a/src/export/ExportFLAC.cpp +++ b/src/export/ExportFLAC.cpp @@ -61,8 +61,8 @@ BEGIN_EVENT_TABLE(ExportFLACOptions, wxDialog) EVT_BUTTON(wxID_OK, ExportFLACOptions::OnOK) END_EVENT_TABLE() -/// -/// +/// +/// ExportFLACOptions::ExportFLACOptions(wxWindow *parent) : wxDialog(parent, wxID_ANY, wxString(_("Specify FLAC Options"))) @@ -72,8 +72,8 @@ ExportFLACOptions::ExportFLACOptions(wxWindow *parent) PopulateOrExchange(S); } -/// -/// +/// +/// void ExportFLACOptions::PopulateOrExchange(ShuttleGui & S) { wxArrayString flacLevelNames, flacLevelLabels; @@ -118,8 +118,8 @@ void ExportFLACOptions::PopulateOrExchange(ShuttleGui & S) return; } -/// -/// +/// +/// void ExportFLACOptions::OnOK(wxCommandEvent& WXUNUSED(event)) { ShuttleGui S(this, eIsSavingToPrefs); @@ -225,8 +225,8 @@ int ExportFLAC::Export(AudacityProject *project, { double rate = project->GetRate(); TrackList *tracks = project->GetTracks(); - - wxLogNull logNo; // temporarily disable wxWidgets error messages + + wxLogNull logNo; // temporarily disable wxWidgets error messages int updateResult = eProgressSuccess; int levelPref; @@ -251,7 +251,7 @@ int ExportFLAC::Export(AudacityProject *project, if (mMetadata) { encoder.set_metadata(&mMetadata, 1); } - + sampleFormat format; if (bitDepthPref == wxT("24")) { format = int24Sample; @@ -357,9 +357,9 @@ int ExportFLAC::Export(AudacityProject *project, free(tmpsmplbuf[i]); } delete mixer; - + delete[] tmpsmplbuf; - + return updateResult; } @@ -372,11 +372,11 @@ bool ExportFLAC::DisplayOptions(wxWindow *parent, int WXUNUSED(format)) return true; } -// LL: There's a bug in libflac++ 1.1.2 that prevents us from using +// LL: There's a bug in libflac++ 1.1.2 that prevents us from using // FLAC::Metadata::VorbisComment directly. The set_metadata() // function allocates an array on the stack, but the base library // expects that array to be valid until the stream is initialized. -// +// // This has been fixed in 1.1.4. bool ExportFLAC::GetMetadata(AudacityProject *project, Tags *tags) { diff --git a/src/export/ExportMP2.cpp b/src/export/ExportMP2.cpp index 40ea06efc..0baa5d3ed 100644 --- a/src/export/ExportMP2.cpp +++ b/src/export/ExportMP2.cpp @@ -59,7 +59,7 @@ #define LIBTWOLAME_STATIC #include "twolame.h" -#ifdef USE_LIBID3TAG +#ifdef USE_LIBID3TAG #include // DM: the following functions were supposed to have been // included in id3tag.h - should be fixed in the next release @@ -68,7 +68,7 @@ struct id3_frame *id3_frame_new(char const *); id3_length_t id3_latin1_length(id3_latin1_t const *); void id3_latin1_decode(id3_latin1_t const *, id3_ucs4_t *); - } + } #endif //---------------------------------------------------------------------------- @@ -85,8 +85,8 @@ class ExportMP2Options : public wxDialog { public: - /// - /// + /// + /// ExportMP2Options(wxWindow *parent); void PopulateOrExchange(ShuttleGui & S); void OnOK(wxCommandEvent& event); @@ -102,8 +102,8 @@ BEGIN_EVENT_TABLE(ExportMP2Options, wxDialog) EVT_BUTTON(wxID_OK, ExportMP2Options::OnOK) END_EVENT_TABLE() -/// -/// +/// +/// ExportMP2Options::ExportMP2Options(wxWindow *parent) : wxDialog(parent, wxID_ANY, wxString(_("Specify MP2 Options"))) @@ -119,8 +119,8 @@ ExportMP2Options::ExportMP2Options(wxWindow *parent) PopulateOrExchange(S); } -/// -/// +/// +/// void ExportMP2Options::PopulateOrExchange(ShuttleGui & S) { S.StartHorizontalLay(wxEXPAND, 0); @@ -129,7 +129,7 @@ void ExportMP2Options::PopulateOrExchange(ShuttleGui & S) { S.StartTwoColumn(); { - S.TieChoice(_("Bit Rate:"), wxT("/FileFormats/MP2Bitrate"), + S.TieChoice(_("Bit Rate:"), wxT("/FileFormats/MP2Bitrate"), 160, mBitRateNames, mBitRateLabels); } S.EndTwoColumn(); @@ -148,8 +148,8 @@ void ExportMP2Options::PopulateOrExchange(ShuttleGui & S) return; } -/// -/// +/// +/// void ExportMP2Options::OnOK(wxCommandEvent& WXUNUSED(event)) { ShuttleGui S(this, eIsSavingToPrefs); @@ -187,7 +187,7 @@ public: private: int AddTags(AudacityProject *project, char **buffer, bool *endOfFile, Tags *tags); -#ifdef USE_LIBID3TAG +#ifdef USE_LIBID3TAG void AddFrame(struct id3_tag *tp, const wxString & n, const wxString & v, const char *name); #endif @@ -285,7 +285,7 @@ int ExportMP2::Export(AudacityProject *project, if (pcmNumSamples == 0) break; - + short *pcmBuffer = (short *)mixer->GetBuffer(); int mp2BufferNumBytes = twolame_encode_buffer_interleaved( @@ -317,7 +317,7 @@ int ExportMP2::Export(AudacityProject *project, delete[] mp2Buffer; /* Write ID3 tag if it was supposed to be at the end of the file */ - + if (id3len && endOfFile) outFile.Write(id3buffer, id3len); @@ -326,7 +326,7 @@ int ExportMP2::Export(AudacityProject *project, } /* Close file */ - + outFile.Close(); return updateResult; @@ -344,7 +344,7 @@ bool ExportMP2::DisplayOptions(wxWindow *parent, int WXUNUSED(format)) // returns buffer len; caller frees int ExportMP2::AddTags(AudacityProject * WXUNUSED(project), char **buffer, bool *endOfFile, Tags *tags) { -#ifdef USE_LIBID3TAG +#ifdef USE_LIBID3TAG struct id3_tag *tp = id3_tag_new(); wxString n, v; @@ -391,7 +391,7 @@ int ExportMP2::AddTags(AudacityProject * WXUNUSED(project), char **buffer, bool *endOfFile = false; id3_length_t len; - + len = id3_tag_render(tp, 0); *buffer = (char *)malloc(len); len = id3_tag_render(tp, (id3_byte_t *)*buffer); @@ -399,12 +399,12 @@ int ExportMP2::AddTags(AudacityProject * WXUNUSED(project), char **buffer, bool id3_tag_delete(tp); return len; -#else //ifdef USE_LIBID3TAG +#else //ifdef USE_LIBID3TAG return 0; #endif } -#ifdef USE_LIBID3TAG +#ifdef USE_LIBID3TAG void ExportMP2::AddFrame(struct id3_tag *tp, const wxString & n, const wxString & v, const char *name) { struct id3_frame *frame = id3_frame_new(name); @@ -434,7 +434,7 @@ void ExportMP2::AddFrame(struct id3_tag *tp, const wxString & n, const wxString free(ucs4); ucs4 = id3_utf8_ucs4duplicate((id3_utf8_t *) (const char *) n.mb_str(wxConvUTF8)); - + id3_field_setstring(id3_frame_field(frame, 1), ucs4); } else { diff --git a/src/export/ExportMP3.cpp b/src/export/ExportMP3.cpp index 9afba695b..3c998bf34 100644 --- a/src/export/ExportMP3.cpp +++ b/src/export/ExportMP3.cpp @@ -93,7 +93,7 @@ #include -#ifdef USE_LIBID3TAG +#ifdef USE_LIBID3TAG #include #endif @@ -303,8 +303,8 @@ BEGIN_EVENT_TABLE(ExportMP3Options, wxDialog) EVT_BUTTON(wxID_OK, ExportMP3Options::OnOK) END_EVENT_TABLE() -/// -/// +/// +/// ExportMP3Options::ExportMP3Options(wxWindow *parent) : wxDialog(parent, wxID_ANY, wxString(_("Specify MP3 Options"))) @@ -321,8 +321,8 @@ ExportMP3Options::ExportMP3Options(wxWindow *parent) PopulateOrExchange(S); } -/// -/// +/// +/// void ExportMP3Options::PopulateOrExchange(ShuttleGui & S) { S.StartHorizontalLay(wxEXPAND, 0); @@ -380,13 +380,13 @@ void ExportMP3Options::PopulateOrExchange(ShuttleGui & S) } mRate = S.Id(ID_QUALITY).TieChoice(_("Quality"), - wxT("/FileFormats/MP3Bitrate"), + wxT("/FileFormats/MP3Bitrate"), defrate, GetNames(choices, cnt), GetLabels(choices, cnt)); mMode = S.TieChoice(_("Variable Speed:"), - wxT("/FileFormats/MP3VarMode"), + wxT("/FileFormats/MP3VarMode"), ROUTINE_FAST, GetNames(varModes, WXSIZEOF(varModes)), GetLabels(varModes, WXSIZEOF(varModes))); @@ -422,8 +422,8 @@ void ExportMP3Options::PopulateOrExchange(ShuttleGui & S) return; } -/// -/// +/// +/// void ExportMP3Options::OnOK(wxCommandEvent& WXUNUSED(event)) { ShuttleGui S(this, eIsSavingToPrefs); @@ -440,8 +440,8 @@ void ExportMP3Options::OnOK(wxCommandEvent& WXUNUSED(event)) return; } -/// -/// +/// +/// void ExportMP3Options::OnSET(wxCommandEvent& WXUNUSED(event)) { LoadNames(setRates, WXSIZEOF(setRates)); @@ -451,8 +451,8 @@ void ExportMP3Options::OnSET(wxCommandEvent& WXUNUSED(event)) mMode->Enable(true); } -/// -/// +/// +/// void ExportMP3Options::OnVBR(wxCommandEvent& WXUNUSED(event)) { LoadNames(varRates, WXSIZEOF(varRates)); @@ -462,8 +462,8 @@ void ExportMP3Options::OnVBR(wxCommandEvent& WXUNUSED(event)) mMode->Enable(true); } -/// -/// +/// +/// void ExportMP3Options::OnABR(wxCommandEvent& WXUNUSED(event)) { LoadNames(fixRates, WXSIZEOF(fixRates)); @@ -473,8 +473,8 @@ void ExportMP3Options::OnABR(wxCommandEvent& WXUNUSED(event)) mMode->Enable(false); } -/// -/// +/// +/// void ExportMP3Options::OnCBR(wxCommandEvent& WXUNUSED(event)) { LoadNames(fixRates, WXSIZEOF(fixRates)); @@ -559,7 +559,7 @@ public: #ifndef DISABLE_DYNAMIC_LOADING_LAME FindDialog(wxWindow *parent, wxString path, wxString name, wxString type) - : wxDialog(parent, wxID_ANY, + : wxDialog(parent, wxID_ANY, /* i18n-hint: LAME is the name of an MP3 converter and should not be translated*/ wxString(_("Locate Lame"))) { @@ -631,7 +631,7 @@ public: * "Where would I find the file %s" instead if you want. */ question.Printf(_("Where is %s?"), mName.c_str()); - wxString path = FileSelector(question, + wxString path = FileSelector(question, mLibPath.GetPath(), mLibPath.GetName(), wxT(""), @@ -854,7 +854,7 @@ private: lame_encode_flush_t* lame_encode_flush; lame_close_t* lame_close; get_lame_version_t* get_lame_version; - + lame_set_in_samplerate_t* lame_set_in_samplerate; lame_set_out_samplerate_t* lame_set_out_samplerate; lame_set_num_channels_t* lame_set_num_channels; @@ -882,7 +882,7 @@ private: static const int mSamplesPerChunk = 220500; // See lame.h/lame_encode_buffer() for further explanation // As coded here, this should be the worst case. - static const int mOutBufferSize = + static const int mOutBufferSize = mSamplesPerChunk * (320 / 8) / 8 + 4 * 1152 * (320 / 8) / 8 + 512; // See MAXFRAMESIZE in libmp3lame/VbrTag.c for explanation of 2880. @@ -943,7 +943,7 @@ bool MP3Exporter::FindLibrary(wxWindow *parent) } path = fd.GetLibPath(); - + if (!::wxFileExists(path)) { return false; } @@ -1082,7 +1082,7 @@ bool MP3Exporter::InitLibrary(wxString libpath) lame_lib.GetSymbol(wxT("lame_set_VBR_q")); lame_set_VBR_min_bitrate_kbps = (lame_set_VBR_min_bitrate_kbps_t *) lame_lib.GetSymbol(wxT("lame_set_VBR_min_bitrate_kbps")); - lame_set_mode = (lame_set_mode_t *) + lame_set_mode = (lame_set_mode_t *) lame_lib.GetSymbol(wxT("lame_set_mode")); lame_set_preset = (lame_set_preset_t *) lame_lib.GetSymbol(wxT("lame_set_preset")); @@ -1572,7 +1572,7 @@ private: wxString FindName(CHOICES *choices, int cnt, int needle); int AskResample(int bitrate, int rate, int lowrate, int highrate); int AddTags(AudacityProject *project, char **buffer, bool *endOfFile, Tags *tags); -#ifdef USE_LIBID3TAG +#ifdef USE_LIBID3TAG void AddFrame(struct id3_tag *tp, const wxString & n, const wxString & v, const char *name); #endif }; @@ -1629,10 +1629,10 @@ int ExportMP3::Export(AudacityProject *project, } if (!exporter.ValidLibraryLoaded()) { - wxMessageBox(_("Not a valid or supported MP3 encoding library!")); + wxMessageBox(_("Not a valid or supported MP3 encoding library!")); gPrefs->Write(wxT("/MP3/MP3LibPath"), wxString(wxT(""))); gPrefs->Flush(); - + return false; } #endif // DISABLE_DYNAMIC_LOADING_LAME @@ -1777,7 +1777,7 @@ int ExportMP3::Export(AudacityProject *project, if (blockLen == 0) { break; } - + short *mixed = (short *)mixer->GetBuffer(); if (blockLen < inSamples) { @@ -1840,7 +1840,7 @@ int ExportMP3::Export(AudacityProject *project, outFile.Close(); delete [] buffer; - + return updateResult; } @@ -1946,7 +1946,7 @@ int ExportMP3::AskResample(int bitrate, int rate, int lowrate, int highrate) // returns buffer len; caller frees int ExportMP3::AddTags(AudacityProject *WXUNUSED(project), char **buffer, bool *endOfFile, Tags *tags) { -#ifdef USE_LIBID3TAG +#ifdef USE_LIBID3TAG struct id3_tag *tp = id3_tag_new(); wxString n, v; @@ -1993,7 +1993,7 @@ int ExportMP3::AddTags(AudacityProject *WXUNUSED(project), char **buffer, bool * *endOfFile = false; id3_length_t len; - + len = id3_tag_render(tp, 0); *buffer = (char *)malloc(len); len = id3_tag_render(tp, (id3_byte_t *)*buffer); @@ -2001,12 +2001,12 @@ int ExportMP3::AddTags(AudacityProject *WXUNUSED(project), char **buffer, bool * id3_tag_delete(tp); return len; -#else //ifdef USE_LIBID3TAG +#else //ifdef USE_LIBID3TAG return 0; #endif } -#ifdef USE_LIBID3TAG +#ifdef USE_LIBID3TAG void ExportMP3::AddFrame(struct id3_tag *tp, const wxString & n, const wxString & v, const char *name) { struct id3_frame *frame = id3_frame_new(name); @@ -2040,7 +2040,7 @@ void ExportMP3::AddFrame(struct id3_tag *tp, const wxString & n, const wxString free(ucs4); ucs4 = id3_utf8_ucs4duplicate((id3_utf8_t *) (const char *) n.mb_str(wxConvUTF8)); - + id3_field_setstring(id3_frame_field(frame, 1), ucs4); } else { diff --git a/src/export/ExportMultiple.cpp b/src/export/ExportMultiple.cpp index 8a588097e..62920e043 100644 --- a/src/export/ExportMultiple.cpp +++ b/src/export/ExportMultiple.cpp @@ -158,7 +158,7 @@ void ExportMultiple::CountTracksAndLabels() // Only support one label track??? case Track::Label: { - // Supports only one LabelTrack. + // Supports only one LabelTrack. if (mLabels == NULL) { mLabels = (LabelTrack*)pTrack; mNumLabels = mLabels->GetNumLabels(); @@ -172,7 +172,7 @@ void ExportMultiple::CountTracksAndLabels() int ExportMultiple::ShowModal() { // Cannot export if all audio tracks are muted. - if (mNumWaveTracks == 0) + if (mNumWaveTracks == 0) { ::wxMessageBox(_("All audio is muted."), _("Cannot Export Multiple"), @@ -180,7 +180,7 @@ int ExportMultiple::ShowModal() return wxID_CANCEL; } - if ((mNumWaveTracks == 1) && (mNumLabels < 1)) + if ((mNumWaveTracks == 1) && (mNumLabels < 1)) { ::wxMessageBox(_( "You have only one unmuted Audio Track and no applicable \ @@ -241,7 +241,7 @@ void ExportMultiple::PopulateOrExchange(ShuttleGui& S) S.StartMultiColumn(4, true); { wxArrayString formats; - + for (size_t i = 0; i < mPlugins.GetCount(); i++) { for (int j = 0; j < mPlugins[i]->GetFormatCount(); j++) { @@ -274,7 +274,7 @@ void ExportMultiple::PopulateOrExchange(ShuttleGui& S) S.StartStatic(_("Split files based on:"), true); { // Row 1 - S.SetBorder(1); + S.SetBorder(1); mLabel = S.Id(LabelID).AddRadioButton(wxString(_("Labels"))); mLabel->SetName(_("Labels")); S.SetBorder(3); @@ -366,9 +366,9 @@ void ExportMultiple::EnableControls() } mFirst->Enable(mLabel->GetValue()); - + enable = mLabel->GetValue() && - (mByName->GetValue() || mByNumberAndName->GetValue()) && + (mByName->GetValue() || mByNumberAndName->GetValue()) && mFirst->GetValue(); mFirstFileLabel->Enable(enable); mFirstFileName->Enable(enable); @@ -537,7 +537,7 @@ void ExportMultiple::OnExport(wxCommandEvent& WXUNUSED(event)) msg.Printf( ok == eProgressSuccess ? _("Successfully exported the following %ld file(s).") : (ok == eProgressFailed ? _("Something went wrong after exporting the following %ld file(s).") - : (ok == eProgressCancelled ? _("Export canceled after exporting the following %ld file(s).") + : (ok == eProgressCancelled ? _("Export canceled after exporting the following %ld file(s).") : (ok == eProgressStopped ? _("Export stopped after exporting the following %ld file(s).") : _("Something went really wrong after exporting the following %ld file(s).") ) @@ -550,10 +550,10 @@ void ExportMultiple::OnExport(wxCommandEvent& WXUNUSED(event)) FileList += '\n'; } // This results dialog is a child of this dialog. - ShowInfoDialog( this, + ShowInfoDialog( this, _("Export Multiple"), msg, - FileList, + FileList, 450,400); } @@ -576,7 +576,7 @@ bool ExportMultiple::DirOk() prompt.Printf(_("\"%s\" doesn't exist.\n\nWould you like to create it?"), fn.GetFullPath().c_str()); - + int action = wxMessageBox(prompt, wxT("Warning"), wxYES_NO | wxICON_EXCLAMATION); @@ -587,7 +587,7 @@ bool ExportMultiple::DirOk() return fn.Mkdir(0777, wxPATH_MKDIR_FULL); } -int ExportMultiple::ExportMultipleByLabel(bool byName, +int ExportMultiple::ExportMultipleByLabel(bool byName, wxString prefix, bool addNumber) { wxASSERT(mProject); @@ -606,7 +606,7 @@ int ExportMultiple::ExportMultipleByLabel(bool byName, // Figure out how many channels we should export. int channels = mTracks->GetNumExportChannels(false); - + wxArrayString otherNames; // keep track of file names we will use, so we // don't duplicate them ExportKit setting; // the current batch of settings @@ -621,10 +621,10 @@ int ExportMultiple::ExportMultipleByLabel(bool byName, /* Examine all labels a first time, sort out all data but don't do any * exporting yet (so this run is quick but interactive) */ while (l < mNumLabels) { - + // Get file name and starting time if (l < 0) { - // create wxFileName for output file + // create wxFileName for output file name = (mFirstFileName->GetValue()); setting.t0 = 0.0; } @@ -704,7 +704,7 @@ int ExportMultiple::ExportMultipleByLabel(bool byName, return ok; } -int ExportMultiple::ExportMultipleByTrack(bool byName, +int ExportMultiple::ExportMultipleByTrack(bool byName, wxString prefix, bool addNumber) { wxASSERT(mProject); @@ -863,8 +863,8 @@ int ExportMultiple::ExportMultipleByTrack(bool byName, // increment export counter count++; - } - + } + // Restore the selection states for (size_t i = 0; i < mSelected.GetCount(); i++) { ((Track *) selected[i])->SetSelected(true); diff --git a/src/export/ExportMultiple.h b/src/export/ExportMultiple.h index 5576ba21f..a1cc8324a 100644 --- a/src/export/ExportMultiple.h +++ b/src/export/ExportMultiple.h @@ -46,7 +46,7 @@ private: bool DirOk(); /** \brief Export multiple labeled regions of the project to separate files * - * Uses a single label track in the project to split up the audio into a + * Uses a single label track in the project to split up the audio into a * series of sections, each of which is exported to a separate file. * @param byName Controls whether files are named after the text in the * labels that define them (true), or just numbered (false). @@ -56,7 +56,7 @@ private: /** \brief Export each track in the project to a separate file * - * @param byName Controls whether files are named after the track names + * @param byName Controls whether files are named after the track names * (true), or just numbered (false). * @param prefix The string used to prefix the file number if files are being * numbered rather than named */ @@ -83,7 +83,7 @@ private: * name produced */ wxString MakeFileName(wxString input); // Dialog - void PopulateOrExchange(ShuttleGui& S); + void PopulateOrExchange(ShuttleGui& S); void EnableControls(); void OnFormat(wxCommandEvent& event); @@ -113,7 +113,7 @@ private: int mNumLabels; int mNumWaveTracks; wxArrayPtrVoid mSelected; - int mFilterIndex; /**< The index in the drop-down list of export + int mFilterIndex; /**< The index in the drop-down list of export formats (mFormat) of the selected export format. This list includes all possible plug-in - subformat combinations. */ @@ -123,13 +123,13 @@ private: selected export plug-in set by mPluginIndex */ bool mInitialized; - // List of file actually exported + // List of file actually exported wxArrayString mExported; /** Array of characters not allowed to be in file names on this platform */ wxArrayString exclude; - wxChoice *mFormat; /**< Drop-down list of export formats + wxChoice *mFormat; /**< Drop-down list of export formats (combinations of plug-in and subformat) */ wxButton *mOptions; @@ -137,7 +137,7 @@ private: up in */ wxButton *mCreate; wxButton *mChoose; - + wxRadioButton *mLabel; /**< button to choose export based on Labels */ wxStaticText *mLabelLabel; /**< description text for mLabel */ @@ -148,7 +148,7 @@ private: wxRadioButton *mTrack; /**< button to choose export based on tracks */ wxStaticText *mTrackLabel; - + wxRadioButton *mByNumberAndName; /**< button to choose number AND name for exported files */ wxRadioButton *mByName; /**< button to choose naming exported file from label text */ wxRadioButton *mByNumber; /**< button to choose numbering exported files */ @@ -162,13 +162,13 @@ private: wxButton *mExport; DECLARE_EVENT_TABLE() - + }; class SuccessDialog : public wxDialog { public: - SuccessDialog(wxWindow *parent, wxWindowID id, const wxString &title) : + SuccessDialog(wxWindow *parent, wxWindowID id, const wxString &title) : wxDialog(parent, id, title, wxDefaultPosition, wxDefaultSize, wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER) {}; void OnKeyDown(wxListEvent& event); // dismisses dialog when is pressed with list control having focus diff --git a/src/export/ExportOGG.cpp b/src/export/ExportOGG.cpp index a39e81cf0..376059cdb 100644 --- a/src/export/ExportOGG.cpp +++ b/src/export/ExportOGG.cpp @@ -58,8 +58,8 @@ BEGIN_EVENT_TABLE(ExportOGGOptions, wxDialog) EVT_BUTTON(wxID_OK, ExportOGGOptions::OnOK) END_EVENT_TABLE() -/// -/// +/// +/// ExportOGGOptions::ExportOGGOptions(wxWindow *parent, int WXUNUSED(format)) : wxDialog(parent, wxID_ANY, wxString(_("Specify Ogg Vorbis Options"))) @@ -71,8 +71,8 @@ ExportOGGOptions::ExportOGGOptions(wxWindow *parent, int WXUNUSED(format)) PopulateOrExchange(S); } -/// -/// +/// +/// void ExportOGGOptions::PopulateOrExchange(ShuttleGui & S) { S.StartHorizontalLay(wxEXPAND, 0); @@ -100,8 +100,8 @@ void ExportOGGOptions::PopulateOrExchange(ShuttleGui & S) return; } -/// -/// +/// +/// void ExportOGGOptions::OnOK(wxCommandEvent& WXUNUSED(event)) { ShuttleGui S(this, eIsSavingToPrefs); @@ -176,7 +176,7 @@ int ExportOGG::Export(AudacityProject *project, TrackList *tracks = project->GetTracks(); double quality = (gPrefs->Read(wxT("/FileFormats/OggExportQuality"), 50)/(float)100.0); - wxLogNull logNo; // temporarily disable wxWidgets error messages + wxLogNull logNo; // temporarily disable wxWidgets error messages int updateResult = eProgressSuccess; int eos = 0; @@ -267,7 +267,7 @@ int ExportOGG::Export(AudacityProject *project, vorbis_analysis_wrote(&dsp, 0); } else { - + for (int i = 0; i < numChannels; i++) { float *temp = (float *)mixer->GetBuffer(i); memcpy(vorbis_buffer[i], temp, sizeof(float)*SAMPLES_PER_RUN); diff --git a/src/export/ExportPCM.cpp b/src/export/ExportPCM.cpp index 5780a5624..5997e8d56 100644 --- a/src/export/ExportPCM.cpp +++ b/src/export/ExportPCM.cpp @@ -38,7 +38,7 @@ #include "Export.h" #include "ExportPCM.h" -#ifdef USE_LIBID3TAG +#ifdef USE_LIBID3TAG #include // DM: the following functions were supposed to have been // included in id3tag.h - should be fixed in the next release @@ -47,7 +47,7 @@ struct id3_frame *id3_frame_new(char const *); id3_length_t id3_latin1_length(id3_latin1_t const *); void id3_latin1_decode(id3_latin1_t const *, id3_ucs4_t *); - } + } #endif //---------------------------------------------------------------------------- @@ -115,7 +115,7 @@ ExportPCMOptions::ExportPCMOptions(wxWindow * WXUNUSED(parent), int selformat) : wxDialog(NULL, wxID_ANY, wxString(_("Specify Uncompressed Options"))) { - mOk = NULL; + mOk = NULL; int format = 0; switch (selformat) { @@ -163,7 +163,7 @@ ExportPCMOptions::ExportPCMOptions(wxWindow * WXUNUSED(parent), int selformat) mEncodingFormats.Add(enc); if ((format & SF_FORMAT_SUBMASK) == (int)sf_encoding_index_to_subtype(i)) mEncodingFromChoice = sel; - else + else sel++; } } @@ -176,7 +176,7 @@ ExportPCMOptions::ExportPCMOptions(wxWindow * WXUNUSED(parent), int selformat) Fit(); Center(); } - + void ExportPCMOptions::PopulateOrExchange(ShuttleGui & S) { S.StartHorizontalLay(wxEXPAND, true); @@ -315,7 +315,7 @@ public: double t1, MixerSpec *mixerSpec = NULL, Tags *metadata = NULL, - int subformat = 0); + int subformat = 0); // optional wxString GetExtension(int index = 0); @@ -396,9 +396,9 @@ void ExportPCM::Destroy() /** * * @param subformat Control whether we are doing a "preset" export to a popular - * file type, or giving the user full control over libsndfile. Set to 0 - * (default) gives full control, 1 gives 16-bit AIFF, 2 gives 16-bit WAV - * 3 gives a GSM 6.10 WAV file */ + * file type, or giving the user full control over libsndfile. Set to 0 + * (default) gives full control, 1 gives 16-bit AIFF, 2 gives 16-bit WAV + * 3 gives a GSM 6.10 WAV file */ int ExportPCM::Export(AudacityProject *project, int numChannels, wxString fName, @@ -407,7 +407,7 @@ int ExportPCM::Export(AudacityProject *project, double t1, MixerSpec *mixerSpec, Tags *metadata, - int subformat) + int subformat) { double rate = project->GetRate(); TrackList *tracks = project->GetTracks(); @@ -438,12 +438,12 @@ int ExportPCM::Export(AudacityProject *project, SNDFILE *sf = NULL; int err; - //This whole operation should not occur while a file is being loaded on OD, + //This whole operation should not occur while a file is being loaded on OD, //(we are worried about reading from a file being written to,) so we block. //Furthermore, we need to do this because libsndfile is not threadsafe. ODManager::LockLibSndFileMutex(); formatStr = sf_header_name(sf_format & SF_FORMAT_TYPEMASK); - + ODManager::UnlockLibSndFileMutex(); // Use libsndfile to export file @@ -490,8 +490,8 @@ int ExportPCM::Export(AudacityProject *project, // WAV and WAVEX formats) if ((sf_format & SF_FORMAT_TYPEMASK) != SF_FORMAT_WAV && (sf_format & SF_FORMAT_TYPEMASK) != SF_FORMAT_WAVEX) { - if (!AddStrings(project, sf, metadata, sf_format)) { - sf_close(sf); + if (!AddStrings(project, sf, metadata, sf_format)) { + sf_close(sf); return false; } } @@ -528,7 +528,7 @@ int ExportPCM::Export(AudacityProject *project, if (numSamples == 0) break; - + samplePtr mixed = mixer->GetBuffer(); ODManager::LockLibSndFileMutex(); @@ -558,13 +558,13 @@ int ExportPCM::Export(AudacityProject *project, delete mixer; - delete[] waveTracks; + delete[] waveTracks; // Install the WAV metata in a "LIST" chunk at the end of the file if ((sf_format & SF_FORMAT_TYPEMASK) == SF_FORMAT_WAV || (sf_format & SF_FORMAT_TYPEMASK) == SF_FORMAT_WAVEX) { - if (!AddStrings(project, sf, metadata, sf_format)) { - sf_close(sf); + if (!AddStrings(project, sf, metadata, sf_format)) { + sf_close(sf); return false; } } @@ -591,7 +591,7 @@ int ExportPCM::Export(AudacityProject *project, fn.MacSetTypeAndCreator(sf_header_mactype(sf_format & SF_FORMAT_TYPEMASK), AUDACITY_CREATOR); #endif - + return updateResult; } @@ -606,8 +606,8 @@ char *ExportPCM::AdjustString(const wxString wxStr, int sf_format) if(sz == 0) return NULL; // Size for secure malloc in case of local wide char usage - size_t sr = (sz+4) * 2; - + size_t sr = (sz+4) * 2; + char *pDest = (char *)malloc(sr); if (!pDest) return NULL; @@ -619,7 +619,7 @@ char *ExportPCM::AdjustString(const wxString wxStr, int sf_format) } memset(pDest, 0, sr); memset(pSrc, 0, sr); - + if(wxStr.mb_str(wxConvISO8859_1)) strncpy(pSrc, wxStr.mb_str(wxConvISO8859_1), sz); else if(wxStr.mb_str()) @@ -667,7 +667,7 @@ char *ExportPCM::AdjustString(const wxString wxStr, int sf_format) 0x61, 0x61, 0x61, 0x61, 0x61, 0x61, 0x61, 0x63, 0x65, 0x65, 0x65, 0x65, 0x69, 0x69, 0x69, 0x69, 0x64, 0x6e, 0x6f, 0x6f, 0x6f, 0x6f, 0x6f, 0x2f, - 0x6f, 0x75, 0x75, 0x75, 0x75, 0x79, 0x70, 0x79 + 0x6f, 0x75, 0x75, 0x75, 0x75, 0x79, 0x70, 0x79 }; size_t i; @@ -676,7 +676,7 @@ char *ExportPCM::AdjustString(const wxString wxStr, int sf_format) *pD++ = aASCII7Table[c]; if(c == 0) break; - } + } *pD = '\0'; free(pSrc); @@ -771,7 +771,7 @@ bool ExportPCM::AddStrings(AudacityProject * WXUNUSED(project), SNDFILE *sf, Tag void ExportPCM::AddID3Chunk(wxString fName, Tags *tags, int sf_format) { -#ifdef USE_LIBID3TAG +#ifdef USE_LIBID3TAG struct id3_tag *tp = id3_tag_new(); wxString n, v; @@ -830,7 +830,7 @@ void ExportPCM::AddID3Chunk(wxString fName, Tags *tags, int sf_format) free(ucs4); ucs4 = id3_utf8_ucs4duplicate((id3_utf8_t *) (const char *) n.mb_str(wxConvUTF8)); - + id3_field_setstring(id3_frame_field(frame, 1), ucs4); } else { @@ -864,9 +864,9 @@ void ExportPCM::AddID3Chunk(wxString fName, Tags *tags, int sf_format) id3_tag_delete(tp); return; } - // Zero all locations, for ending odd UTF16 content + // Zero all locations, for ending odd UTF16 content // correctly, i.e., two '\0's at the end. - memset(buffer, 0, len); + memset(buffer, 0, len); id3_tag_render(tp, buffer); @@ -876,12 +876,12 @@ void ExportPCM::AddID3Chunk(wxString fName, Tags *tags, int sf_format) if (f.IsOpened()) { wxUint32 sz; - sz = (wxUint32) len; + sz = (wxUint32) len; f.SeekEnd(0); - if ((sf_format & SF_FORMAT_TYPEMASK) == SF_FORMAT_WAV) + if ((sf_format & SF_FORMAT_TYPEMASK) == SF_FORMAT_WAV) f.Write("id3 ", 4); // Must be lower case for foobar2000. else { - f.Write("ID3 ", 4); + f.Write("ID3 ", 4); sz = wxUINT32_SWAP_ON_LE(sz); } f.Write(&sz, 4); @@ -908,8 +908,8 @@ void ExportPCM::AddID3Chunk(wxString fName, Tags *tags, int sf_format) bool ExportPCM::DisplayOptions(wxWindow *parent, int format) { wxString nopt(_("There are no options for this format.\n")); - /* i18n-hint: This is pointing users at another possible export format in - * the list. So you should translate the quoted string + /* i18n-hint: This is pointing users at another possible export format in + * the list. So you should translate the quoted string * 'Other uncompressed files' exactly the same as you do the same string * when it comes up on it's own.*/ wxString usepcm(_("If you need more control over the export format please use the 'Other uncompressed files' format.")); diff --git a/src/float_cast.h b/src/float_cast.h index 0b7d207af..69d7644a7 100644 --- a/src/float_cast.h +++ b/src/float_cast.h @@ -1,36 +1,36 @@ /* ** Copyright (C) 2001 Erik de Castro Lopo ** -** Permission to use, copy, modify, distribute, and sell this file for any -** purpose is hereby granted without fee, provided that the above copyright +** Permission to use, copy, modify, distribute, and sell this file for any +** purpose is hereby granted without fee, provided that the above copyright ** and this permission notice appear in all copies. No representations are -** made about the suitability of this software for any purpose. It is +** made about the suitability of this software for any purpose. It is ** provided "as is" without express or implied warranty. */ /* Version 1.1 */ -/*============================================================================ +/*============================================================================ ** On Intel Pentium processors (especially PIII and probably P4), converting -** from float to int is very slow. To meet the C specs, the code produced by -** most C compilers targeting Pentium needs to change the FPU rounding mode -** before the float to int conversion is performed. +** from float to int is very slow. To meet the C specs, the code produced by +** most C compilers targeting Pentium needs to change the FPU rounding mode +** before the float to int conversion is performed. ** -** Changing the FPU rounding mode causes the FPU pipeline to be flushed. It +** Changing the FPU rounding mode causes the FPU pipeline to be flushed. It ** is this flushing of the pipeline which is so slow. ** ** Fortunately the ISO C99 specifications define the functions lrint, lrintf, -** llrint and llrintf which fix this problem as a side effect. +** llrint and llrintf which fix this problem as a side effect. ** -** On Unix-like systems, the configure process should have detected the -** presence of these functions. If they weren't found we have to replace them +** On Unix-like systems, the configure process should have detected the +** presence of these functions. If they weren't found we have to replace them ** here with a standard C cast. */ -/* +/* ** The C99 prototypes for lrint and lrintf are as follows: -** +** ** long int lrintf (float x) ; ** long int lrint (double x) ; */ @@ -46,7 +46,7 @@ /* These defines enable functionality introduced with the 1999 ISO C ** standard. They must be defined before the inclusion of math.h to - ** engage them. If optimisation is enabled, these functions will be + ** engage them. If optimisation is enabled, these functions will be ** inlined. With optimisation switched off, you have to link in the ** maths library using -lm. */ @@ -58,14 +58,14 @@ #define __USE_ISOC99 1 #include - + #elif (defined (WIN32) || defined (_WIN32)) - /* Win32 doesn't seem to have these functions. + /* Win32 doesn't seem to have these functions. ** Therefore implement inline versions of these functions here. */ - - __inline long int + + __inline long int lrint (double flt) { int intgr; @@ -73,11 +73,11 @@ { fld flt fistp intgr } ; - + return intgr ; - } - - __inline long int + } + + __inline long int lrintf (float flt) { int intgr; @@ -85,11 +85,11 @@ { fld flt fistp intgr } ; - + return intgr ; } - __inline long long int + __inline long long int llrint (double flt) { long long int intgr; @@ -97,11 +97,11 @@ { fld flt fistp intgr } ; - + return intgr ; - } - - __inline long long int + } + + __inline long long int llrintf (float flt) { long long int intgr; @@ -109,7 +109,7 @@ { fld flt fistp intgr } ; - + return intgr ; } @@ -124,7 +124,7 @@ */ #include - + #define lrint(dbl) ((int)rint(dbl)) #define lrintf(flt) ((int)rint(flt)) diff --git a/src/import/Import.cpp b/src/import/Import.cpp index 751078483..d7d5214bf 100644 --- a/src/import/Import.cpp +++ b/src/import/Import.cpp @@ -14,7 +14,7 @@ any type of sampled audio file (i.e. anything except MIDI) and return the tracks that were imported. This function just figures out which one to call; the actual importers are in - ImportPCM, ImportMP3, ImportOGG, ImportRawData, ImportLOF, + ImportPCM, ImportMP3, ImportOGG, ImportRawData, ImportLOF, ImportQT and ImportFLAC. *//***************************************************************//** @@ -27,10 +27,10 @@ It's defined in Import.h *//***************************************************************//** \class Importer -\brief Class which actulaly imports the auido, using functions defined -in ImportPCM.cpp, ImportMP3.cpp, ImportOGG.cpp, ImportRawData.cpp, +\brief Class which actulaly imports the auido, using functions defined +in ImportPCM.cpp, ImportMP3.cpp, ImportOGG.cpp, ImportRawData.cpp, and ImportLOF.cpp. - + *//******************************************************************/ @@ -120,7 +120,7 @@ void Importer::GetSupportedImportFormats(FormatList *formatList) void Importer::StringToList(wxString &str, wxString &delims, wxArrayString &list, wxStringTokenizerMode mod) { wxStringTokenizer toker; - + for (toker.SetString(str, delims, mod); toker.HasMoreTokens(); list.Add (toker.GetNextToken())); } @@ -133,10 +133,10 @@ void Importer::ReadImportItems() wxString item_value; ExtImportItem *new_item; ImportPluginList::compatibility_iterator importPluginNode; - + if (this->mExtImportItems != NULL) delete this->mExtImportItems; - + this->mExtImportItems = new ExtImportItems(); /* Rule string format is: * extension1:extension2:extension3\mime_type1:mime_type2:mime_type3|filter1:filter2:filter3\unusedfilter1:unusedfilter2 @@ -149,14 +149,14 @@ void Importer::ReadImportItems() /* Break at first non-existent item */ if (!gPrefs->Read(item_name, &item_value)) break; - + toker.SetString(item_value, wxT("|"), wxTOKEN_RET_EMPTY_ALL); /* Break at first broken item */ if (toker.CountTokens() != 2) break; new_item = new ExtImportItem(); - + /* First token is the filtering condition, second - the filter list */ condition = toker.GetNextToken(); filters = toker.GetNextToken(); @@ -173,13 +173,13 @@ void Importer::ReadImportItems() if (mime_types != wxEmptyString) StringToList (mime_types, delims, new_item->mime_types); - + /* Filter token consists of used and unused filter lists */ toker.SetString(filters, wxT("\\"), wxTOKEN_RET_EMPTY_ALL); used_filters = toker.GetNextToken(); if (toker.HasMoreTokens()) unused_filters = toker.GetNextToken(); - + StringToList (used_filters, delims, new_item->filters); if (unused_filters != wxEmptyString) @@ -192,7 +192,7 @@ void Importer::ReadImportItems() } else new_item->divider = -1; - + /* Find corresponding filter object for each filter ID */ for (size_t i = 0; i < new_item->filters.Count(); i++) { @@ -284,7 +284,7 @@ void Importer::WriteImportItems() gPrefs->Flush(); } /* If we used to have more items than we have now, delete the excess items. - We just keep deleting items and incrementing until we find there aren't any + We just keep deleting items and incrementing until we find there aren't any more to delete.*/ i = this->mExtImportItems->Count(); do { @@ -293,7 +293,7 @@ void Importer::WriteImportItems() if (!gPrefs->Read(name, &val)) break; // Failure to delete probably means a read-only config file. - // no point continuing. + // no point continuing. // TODO: Possibly report (once). if( !gPrefs->DeleteEntry (name, false)) break; @@ -342,11 +342,11 @@ int Importer::Import(wxString fName, // This list is used to remember plugins that should have been compatible with the file. ImportPluginList compatiblePlugins; - + // If user explicitly selected a filter, // then we should try importing via corresponding plugin first wxString type = gPrefs->Read(wxT("/LastOpenType"),wxT("")); - + // Not implemented (yet?) wxString mime_type = wxT("*"); @@ -437,8 +437,8 @@ int Importer::Import(wxString fName, // We want to save this for later insertion ahead of libmad, if libmad supports the extension. // The order of plugins in mImportPluginList is determined by the Importer constructor alone and // is not changed by user selection overrides or any other mechanism, but we include an assert - // in case subsequent code revisions to the constructor should break this assumption that - // libsndfile is first. + // in case subsequent code revisions to the constructor should break this assumption that + // libsndfile is first. ImportPlugin *libsndfilePlugin = importPluginNode->GetData(); wxASSERT(libsndfilePlugin->GetPluginStringID().IsSameAs(wxT("libsndfile"))); @@ -452,11 +452,11 @@ int Importer::Import(wxString fName, { // If libmad is accidentally fed a wav file which has been incorrectly // given an .mp3 extension then it can choke on the contents and crash. - // To avoid this, put libsndfile ahead of libmad in the lists created for - // mp3 files, or for any of the extensions supported by libmad. + // To avoid this, put libsndfile ahead of libmad in the lists created for + // mp3 files, or for any of the extensions supported by libmad. // A genuine .mp3 file will first fail an attempted import with libsndfile // but then get processed as desired by libmad. - // But a wav file which bears an incorrect .mp3 extension will be successfully + // But a wav file which bears an incorrect .mp3 extension will be successfully // processed by libsndfile and thus avoid being submitted to libmad. if (plugin->GetPluginStringID().IsSameAs(wxT("libmad"))) { @@ -476,7 +476,7 @@ int Importer::Import(wxString fName, } // Add remaining plugins, except for libmad, which should not be used as a fallback for anything. - // Otherwise, if FFmpeg (libav) has not been installed, libmad will still be there near the + // Otherwise, if FFmpeg (libav) has not been installed, libmad will still be there near the // end of the preference list importPlugins, where it will claim success importing FFmpeg file // formats unsuitable for it, and produce distorted results. importPluginNode = mImportPluginList->GetFirst(); @@ -507,7 +507,7 @@ int Importer::Import(wxString fName, { wxLogMessage(wxT("Open(%s) succeeded"),(const char *) fName.c_str()); // File has more than one stream - display stream selector - if (inFile->GetStreamCount() > 1) + if (inFile->GetStreamCount() > 1) { ImportStreamDialog ImportDlg(inFile, NULL, -1, _("Select stream(s) to import")); @@ -523,7 +523,7 @@ int Importer::Import(wxString fName, inFile->SetStreamUsage(0,TRUE); int res; - + res = inFile->Import(trackFactory, tracks, &numTracks, tags); delete inFile; @@ -537,7 +537,7 @@ int Importer::Import(wxString fName, return 1; } - if (numTracks > 0) + if (numTracks > 0) { // success! pProj->mbBusyImporting = false; @@ -599,7 +599,7 @@ int Importer::Import(wxString fName, pProj->mbBusyImporting = false; return 0; } - + // playlist type files if ((extension.IsSameAs(wxT("m3u"), false))||(extension.IsSameAs(wxT("ram"), false))||(extension.IsSameAs(wxT("pls"), false))) { errorMessage.Printf(_("\"%s\" is a playlist file. \nAudacity cannot open this file because it only contains links to other files. \nYou may be able to open it in a text editor and download the actual audio files."), fName.c_str()); @@ -630,42 +630,42 @@ int Importer::Import(wxString fName, pProj->mbBusyImporting = false; return 0; } - + // Other notes-based formats if ((extension.IsSameAs(wxT("kar"), false))||(extension.IsSameAs(wxT("mod"), false))||(extension.IsSameAs(wxT("rmi"), false))) { errorMessage.Printf(_("\"%s\" is a notes-based file, not an audio file. \nAudacity cannot open this type of file. \nTry converting it to an audio file such as WAV or AIFF and \nthen import it, or record it into Audacity."), fName.c_str()); pProj->mbBusyImporting = false; return 0; } - + // MusePack files if ((extension.IsSameAs(wxT("mp+"), false))||(extension.IsSameAs(wxT("mpc"), false))||(extension.IsSameAs(wxT("mpp"), false))) { errorMessage.Printf(_("\"%s\" is a Musepack audio file. \nAudacity cannot open this type of file. \nIf you think it might be an mp3 file, rename it to end with \".mp3\" \nand try importing it again. Otherwise you need to convert it to a supported audio \nformat, such as WAV or AIFF."), fName.c_str()); pProj->mbBusyImporting = false; return 0; } - + // WavPack files if ((extension.IsSameAs(wxT("wv"), false))||(extension.IsSameAs(wxT("wvc"), false))) { errorMessage.Printf(_("\"%s\" is a Wavpack audio file. \nAudacity cannot open this type of file. \nYou need to convert it to a supported audio format, such as WAV or AIFF."), fName.c_str()); pProj->mbBusyImporting = false; return 0; } - + // AC3 files if ((extension.IsSameAs(wxT("ac3"), false))) { errorMessage.Printf(_("\"%s\" is a Dolby Digital audio file. \nAudacity cannot currently open this type of file. \nYou need to convert it to a supported audio format, such as WAV or AIFF."), fName.c_str()); pProj->mbBusyImporting = false; return 0; } - + // Speex files if ((extension.IsSameAs(wxT("spx"), false))) { errorMessage.Printf(_("\"%s\" is an Ogg Speex audio file. \nAudacity cannot currently open this type of file. \nYou need to convert it to a supported audio format, such as WAV or AIFF."), fName.c_str()); pProj->mbBusyImporting = false; return 0; } - + // Video files of various forms if ((extension.IsSameAs(wxT("mpg"), false))||(extension.IsSameAs(wxT("mpeg"), false))||(extension.IsSameAs(wxT("avi"), false))||(extension.IsSameAs(wxT("wmv"), false))||(extension.IsSameAs(wxT("rv"), false))) { errorMessage.Printf(_("\"%s\" is a video file. \nAudacity cannot currently open this type of file. \nYou need to extract the audio to a supported format, such as WAV or AIFF."), fName.c_str()); diff --git a/src/import/Import.h b/src/import/Import.h index 252094922..108fbe319 100644 --- a/src/import/Import.h +++ b/src/import/Import.h @@ -56,7 +56,7 @@ class ExtImportItem * Unused filters will not be used for matching files, unless forced. */ wxArrayString filters; - + /** * The index of first unused filter in @filters array * 0 - divider is at the top of the list (in the list control @@ -76,7 +76,7 @@ class ExtImportItem * i.e. "*.wav". */ wxArrayString extensions; - + /** * Mime-types. Each one is a string in form of "foo/bar-baz" or * something like that. diff --git a/src/import/ImportFLAC.cpp b/src/import/ImportFLAC.cpp index b021daa61..8ce76f32c 100644 --- a/src/import/ImportFLAC.cpp +++ b/src/import/ImportFLAC.cpp @@ -80,7 +80,7 @@ void GetFLACImportPlugin(ImportPluginList *importPluginList, #include "../ondemand/ODDecodeFlacTask.h" #include "../ondemand/ODManager.h" -#ifdef USE_LIBID3TAG +#ifdef USE_LIBID3TAG extern "C" { #include } @@ -108,7 +108,7 @@ class MyFLACFile : public FLAC::Decoder::File set_metadata_respond(FLAC__METADATA_TYPE_VORBIS_COMMENT); set_metadata_respond(FLAC__METADATA_TYPE_STREAMINFO); } - + bool get_was_error() const { return mWasError; @@ -221,7 +221,7 @@ void MyFLACFile::metadata_callback(const FLAC__StreamMetadata *metadata) void MyFLACFile::error_callback(FLAC__StreamDecoderErrorStatus WXUNUSED(status)) { mWasError = true; - + /* switch (status) { @@ -305,7 +305,7 @@ ImportFileHandle *FLACImportPlugin::Open(wxString filename) cnt = binaryFile.Read(query, sizeof(query)); cnt = id3_tag_query(query, cnt); binaryFile.Seek(cnt); -#endif +#endif char buf[5]; cnt = binaryFile.Read(buf, 4); @@ -313,9 +313,9 @@ ImportFileHandle *FLACImportPlugin::Open(wxString filename) if (cnt == wxInvalidOffset || strncmp(buf, FLAC_HEADER, 4) != 0) { // File is not a FLAC file - return false; + return false; } - + // Open the file for import FLACImportFileHandle *handle = new FLACImportFileHandle(filename); @@ -342,9 +342,9 @@ FLACImportFileHandle::FLACImportFileHandle(const wxString & name) bool FLACImportFileHandle::Init() { -#ifdef EXPERIMENTAL_OD_FLAC +#ifdef EXPERIMENTAL_OD_FLAC mDecoderTask=new ODDecodeFlacTask; - + ODFlacDecoder* odDecoder = (ODFlacDecoder*)mDecoderTask->CreateFileDecoder(mFilename); if(!odDecoder || !odDecoder->ReadHeader()) { @@ -353,19 +353,19 @@ bool FLACImportFileHandle::Init() return false; } //copy the meta data over to the class - + mSampleRate=odDecoder->mSampleRate; mNumChannels=odDecoder->mNumChannels; mBitsPerSample=odDecoder->mBitsPerSample; - + mNumSamples=odDecoder->mNumSamples; mBitsPerSample=odDecoder->mBitsPerSample; mFormat=odDecoder->mFormat; mStreamInfoDone=true; - + return true; -#endif +#endif #ifdef LEGACY_FLAC bool success = mFile->set_filename(OSINPUT(mFilename)); if (!success) { @@ -443,7 +443,7 @@ int FLACImportFileHandle::Import(TrackFactory *trackFactory, unsigned long c; for (c = 0; c < mNumChannels; c++) { mChannels[c] = trackFactory->NewWaveTrack(mFormat, mSampleRate); - + if (mNumChannels == 2) { switch (c) { case 0: @@ -479,22 +479,22 @@ int FLACImportFileHandle::Import(TrackFactory *trackFactory, //add the task to the ODManager if(useOD) - { + { sampleCount fileTotalFrames = mNumSamples; sampleCount maxBlockSize = mChannels[0]->GetMaxBlockSize(); for (sampleCount i = 0; i < fileTotalFrames; i += maxBlockSize) { sampleCount blockLen = maxBlockSize; if (i + blockLen > fileTotalFrames) blockLen = fileTotalFrames - i; - + for (c = 0; c < mNumChannels; c++) mChannels[c]->AppendCoded(mFilename, i, blockLen, c,ODTask::eODFLAC); - + mUpdateResult = mProgress->Update(i, fileTotalFrames); if (mUpdateResult != eProgressSuccess) break; } - + bool moreThanStereo = mNumChannels>2; for (c = 0; c < mNumChannels; c++) { @@ -521,7 +521,7 @@ int FLACImportFileHandle::Import(TrackFactory *trackFactory, return mUpdateResult; } - + *outNumTracks = mNumChannels; *outTracks = new Track *[mNumChannels]; for (c = 0; c < mNumChannels; c++) { diff --git a/src/import/ImportGStreamer.cpp b/src/import/ImportGStreamer.cpp index 723d4c281..256ef65d2 100644 --- a/src/import/ImportGStreamer.cpp +++ b/src/import/ImportGStreamer.cpp @@ -166,7 +166,7 @@ private: Tags mTags; //!< Tags to be passed back to Audacity TrackFactory *mTrackFactory; //!< Factory to create tracks when samples arrive - gchar *mUri; //!< URI of file + gchar *mUri; //!< URI of file GstElement *mPipeline; //!< GStreamer pipeline GstBus *mBus; //!< Message bus GstElement *mDec; //!< uridecodebin element @@ -583,7 +583,7 @@ GStreamerImportFileHandle::OnPadAdded(GstPad *pad) gst_app_sink_set_caps(GST_APP_SINK(c->mSink), caps); gst_caps_unref(caps); - // Do not sync to the clock...process as quickly as possible + // Do not sync to the clock...process as quickly as possible gst_base_sink_set_sync(GST_BASE_SINK(c->mSink), FALSE); // Don't drop buffers...allow queue to build unfettered @@ -674,7 +674,7 @@ GStreamerImportFileHandle::OnNewSample(GStreamContext *c, GstSample *sample) WARN(mPipeline, ("OnNewSample: missing audio format")); return; } - + // Determinate sample format based on negotiated format if (strcmp(fmt, GST_AUDIO_NE(S16)) == 0) { @@ -695,7 +695,7 @@ GStreamerImportFileHandle::OnNewSample(GStreamContext *c, GstSample *sample) WARN(mPipeline, ("OnNewSample: unrecognized sample format %s", fmt)); return; } - + // Allocate the track array c->mChannels = new WaveTrack *[c->mNumChannels]; if (!c->mChannels) @@ -820,34 +820,34 @@ GStreamerImportFileHandle::~GStreamerImportFileHandle() } delete[] c->mChannels; } - + // Remove the appsink element if (c->mSink) { gst_bin_remove(GST_BIN(mPipeline), c->mSink); } - + // Remove the audioconvert element if (c->mConv) { gst_bin_remove(GST_BIN(mPipeline), c->mConv); } - + // Free the audio type if (c->mType) { g_free(c->mType); } - + // And finally get rid of the context g_free(c); } g_mutex_unlock(&mStreamsLock); - + // Done with the context array g_ptr_array_free(mStreams, TRUE); } - + // Release the decoder if (mDec != NULL) { @@ -929,7 +929,7 @@ GStreamerImportFileHandle::Init() mPipeline = gst_pipeline_new("pipeline"); // Get its bus - mBus = gst_pipeline_get_bus(GST_PIPELINE(mPipeline)); + mBus = gst_pipeline_get_bus(GST_PIPELINE(mPipeline)); // Create uridecodebin and set up signal handlers mDec = gst_element_factory_make("uridecodebin", "decoder"); @@ -1063,7 +1063,7 @@ GStreamerImportFileHandle::Import(TrackFactory *trackFactory, // Remove them from the bin gst_bin_remove_many(GST_BIN(mPipeline), c->mConv, c->mSink, NULL); - + // All done with them c->mConv = NULL; c->mSink = NULL; diff --git a/src/import/ImportLOF.cpp b/src/import/ImportLOF.cpp index 35bb2d2ce..9bd2d999f 100644 --- a/src/import/ImportLOF.cpp +++ b/src/import/ImportLOF.cpp @@ -38,7 +38,7 @@ file "C:\sample2.wav" offset 5 # sample2 is displayed with a 5s offset File "C:\sample3.wav" # sample3 is displayed with no offset File "foo.aiff" # foo is loaded from the same directory as the LOF file - window offset 5 duration 10 # open a new window, zoom to display + window offset 5 duration 10 # open a new window, zoom to display # 10 seconds total starting at 5 (ending at 15) seconds file "C:\sample3.wav" offset 2.5 \endverbatim @@ -194,7 +194,7 @@ ImportFileHandle *LOFImportPlugin::Open(wxString filename) for (int i = 0; i < count; i++) { - // Check if this char is below the space character, but not a + // Check if this char is below the space character, but not a // line feed or carriage return if (buf[i] < 32 && buf[i] != 10 && buf[i] != 13) { @@ -207,7 +207,7 @@ ImportFileHandle *LOFImportPlugin::Open(wxString filename) // Close it again so it can be opened as a text file binaryFile.Close(); - // Now open the file again as text file + // Now open the file again as text file wxTextFile *file = new wxTextFile(filename); file->Open(); @@ -246,7 +246,7 @@ int LOFImportFileHandle::Import(TrackFactory * WXUNUSED(trackFactory), Track *** while (!mTextFile->Eof()) { lofOpenFiles(&line); - line = mTextFile->GetNextLine(); + line = mTextFile->GetNextLine(); } // for last line @@ -268,7 +268,7 @@ static int CountNumTracks(AudacityProject *proj) int count = 0; Track *t; TrackListIterator iter(proj->GetTracks()); - + t = iter.First(); while(t) { @@ -286,37 +286,37 @@ static int CountNumTracks(AudacityProject *proj) * caller will continue to the next line of the input file */ void LOFImportFileHandle::lofOpenFiles(wxString* ln) -{ +{ wxStringTokenizer tok(*ln, wxT(" ")); wxStringTokenizer temptok1(*ln, wxT("\"")); wxStringTokenizer temptok2(*ln, wxT(" ")); int tokenplace = 0; - + wxString targetfile; wxString tokenholder = tok.GetNextToken(); - + if (tokenholder.IsSameAs(wxT("window"), false)) { // set any duration/offset factors for last window, as all files were called doDuration(); doScrollOffset(); - + if (windowCalledOnce) { mProject = CreateNewAudacityProject(); } windowCalledOnce = true; - + while (tok.HasMoreTokens()) { tokenholder = tok.GetNextToken(); - + if (tokenholder.IsSameAs(wxT("offset"), false)) { if (tok.HasMoreTokens()) tokenholder = tok.GetNextToken(); - + if (Internat::CompatibleToDouble(tokenholder, &scrollOffset)) { callScrollOffset = true; @@ -328,16 +328,16 @@ void LOFImportFileHandle::lofOpenFiles(wxString* ln) /* i18n-hint: You do not need to translate "LOF" */ _("LOF Error"), wxOK | wxCENTRE); } - + if (tok.HasMoreTokens()) tokenholder = tok.GetNextToken(); } - + if (tokenholder.IsSameAs(wxT("duration"), false)) { if (tok.HasMoreTokens()) tokenholder = tok.GetNextToken(); - + if (Internat::CompatibleToDouble(tokenholder, &durationFactor)) { callDurationFactor = true; @@ -358,7 +358,7 @@ void LOFImportFileHandle::lofOpenFiles(wxString* ln) } } // End while loop } // End if statement handling "window" lines - + else if (tokenholder.IsSameAs(wxT("file"), false)) { @@ -374,20 +374,20 @@ void LOFImportFileHandle::lofOpenFiles(wxString* ln) targetfile = fName.GetFullPath(); } } - + #ifdef USE_MIDI // If file is a midi if (targetfile.AfterLast(wxT('.')).IsSameAs(wxT("mid"), false) || targetfile.AfterLast(wxT('.')).IsSameAs(wxT("midi"), false)) { NoteTrack *nTrack = new NoteTrack(mProject->GetDirManager()); - + if (::ImportMIDI(targetfile, nTrack)) mProject->GetTracks()->Add(nTrack); else delete nTrack; } - + // If not a midi, open audio file else { @@ -402,34 +402,34 @@ void LOFImportFileHandle::lofOpenFiles(wxString* ln) // Set tok to right after filename temptok2.SetString(targetfile); tokenplace = temptok2.CountTokens(); - + for (int i = 0; i < tokenplace; i++) tokenholder = tok.GetNextToken(); - + if (tok.HasMoreTokens()) { tokenholder = tok.GetNextToken(); - + if (tokenholder.IsSameAs(wxT("#"))) { // # indicates comments; ignore line tok = wxStringTokenizer(wxT(""), wxT(" ")); } - + if (tokenholder.IsSameAs(wxT("offset"), false)) { if (tok.HasMoreTokens()) tokenholder = tok.GetNextToken(); double offset; - + // handle an "offset" specifier if (Internat::CompatibleToDouble(tokenholder, &offset)) { Track *t; TrackListIterator iter(mProject->GetTracks()); - + t = iter.First(); - + for (int i = 1; i < CountNumTracks(mProject) - 1; i++) t = iter.Next(); @@ -453,7 +453,7 @@ void LOFImportFileHandle::lofOpenFiles(wxString* ln) { if (t->GetLinked()) t->SetOffset(offset); - + t = iter.Next(); t->SetOffset(offset); } @@ -468,7 +468,7 @@ void LOFImportFileHandle::lofOpenFiles(wxString* ln) } // End if statement for "offset" parameters } // End if statement (more tokens after file name) } // End if statement "file" lines - + else if (tokenholder.IsSameAs(wxT("#"))) { // # indicates comments; ignore line diff --git a/src/import/ImportLOF.h b/src/import/ImportLOF.h index 88ff1a819..912725df0 100644 --- a/src/import/ImportLOF.h +++ b/src/import/ImportLOF.h @@ -26,7 +26,7 @@ file "C:\folder1\sample1.wav" # sample1.wav is displayed file "C:\sample2.wav" offset 5 # sample2 is displayed with a 5s offset File "C:\sample3.wav" # sample3 is displayed with no offset - window offset 5 duration 10 # open a new window, zoom to display + window offset 5 duration 10 # open a new window, zoom to display # 10 seconds total starting at 5 (ending at 15) seconds file "C:\sample3.wav" offset 2.5 diff --git a/src/import/ImportMIDI.h b/src/import/ImportMIDI.h index 14729161a..1abf35135 100644 --- a/src/import/ImportMIDI.h +++ b/src/import/ImportMIDI.h @@ -9,7 +9,7 @@ *******************************************************************//** \class MIDIParser -\brief Unused class that might someday be used again to read MIDI files +\brief Unused class that might someday be used again to read MIDI files into a NoteTrack. *//*******************************************************************/ diff --git a/src/import/ImportMP3.cpp b/src/import/ImportMP3.cpp index b56906c38..b75d85c98 100644 --- a/src/import/ImportMP3.cpp +++ b/src/import/ImportMP3.cpp @@ -78,7 +78,7 @@ void GetMP3ImportPlugin(ImportPluginList *importPluginList, extern "C" { #include "mad.h" -#ifdef USE_LIBID3TAG +#ifdef USE_LIBID3TAG #include #endif } @@ -286,7 +286,7 @@ void MP3ImportFileHandle::ImportID3(Tags *tags) // file with a Unicode name and id3_file_open() can't (under Windows). fp = id3_file_fdopen(f.fd(), ID3_FILE_MODE_READONLY); } - + if (!fp) { return; } @@ -399,7 +399,7 @@ void MP3ImportFileHandle::ImportID3(Tags *tags) } id3_file_close(fp); -#endif // ifdef USE_LIBID3TAG +#endif // ifdef USE_LIBID3TAG } // @@ -422,7 +422,7 @@ enum mad_flow input_cb(void *_data, struct mad_stream *stream) return MAD_FLOW_STOP; } -#ifdef USE_LIBID3TAG +#ifdef USE_LIBID3TAG if (!data->id3checked) { data->file->Read(data->inputBuffer, ID3_TAG_QUERYSIZE); int len = id3_tag_query(data->inputBuffer, ID3_TAG_QUERYSIZE); @@ -432,7 +432,7 @@ enum mad_flow input_cb(void *_data, struct mad_stream *stream) else { data->file->Seek(0); } - + data->id3checked = true; } #endif @@ -501,7 +501,7 @@ enum mad_flow output_cb(void *_data, } data->numChannels = channels; } - else { + else { // This is not the first run, protect us from libmad glitching // on the number of channels channels = data->numChannels; @@ -532,7 +532,7 @@ enum mad_flow output_cb(void *_data, return MAD_FLOW_CONTINUE; } -enum mad_flow error_cb(void * WXUNUSED(_data), struct mad_stream * WXUNUSED(stream), +enum mad_flow error_cb(void * WXUNUSED(_data), struct mad_stream * WXUNUSED(stream), struct mad_frame * WXUNUSED(frame)) { /* enum mad_flow { diff --git a/src/import/ImportOGG.cpp b/src/import/ImportOGG.cpp index 5225e4394..347e590a9 100644 --- a/src/import/ImportOGG.cpp +++ b/src/import/ImportOGG.cpp @@ -50,7 +50,7 @@ static const wxChar *exts[] = #ifndef USE_LIBVORBIS /* BPF There is no real reason to compile without LIBVORBIS, but if you do, you will needs this header */ -#include "ImportPlugin.h" +#include "ImportPlugin.h" void GetOGGImportPlugin(ImportPluginList *importPluginList, UnusableImportPluginList *unusableImportPluginList) @@ -113,7 +113,7 @@ public: mStreamInfo->Add(strinfo); mStreamUsage[i] = 0; } - + } ~OggImportFileHandle(); @@ -297,7 +297,7 @@ int OggImportFileHandle::Import(TrackFactory *trackFactory, Track ***outTracks, // causes them to be read correctly. Otherwise they have lots of // zeros inserted at the beginning ov_pcm_seek(mVorbisFile, 0); - + do { /* get data from the decoder */ bytesRead = ov_read(mVorbisFile, (char *) mainBuffer, @@ -375,7 +375,7 @@ int OggImportFileHandle::Import(TrackFactory *trackFactory, Track ***outTracks, } *outTracks = new Track *[*outNumTracks]; - + int trackindex = 0; for (i = 0; i < mVorbisFile->links; i++) { @@ -386,7 +386,7 @@ int OggImportFileHandle::Import(TrackFactory *trackFactory, Track ***outTracks, (*outTracks)[trackindex++] = mChannels[i][c]; } delete[] mChannels[i]; - } + } } delete[] mChannels; diff --git a/src/import/ImportPCM.cpp b/src/import/ImportPCM.cpp index 89050b314..bf0b3fd76 100644 --- a/src/import/ImportPCM.cpp +++ b/src/import/ImportPCM.cpp @@ -53,7 +53,7 @@ #include "../WaveTrack.h" #include "ImportPlugin.h" -#ifdef USE_LIBID3TAG +#ifdef USE_LIBID3TAG #include // DM: the following functions were supposed to have been // included in id3tag.h - should be fixed in the next release @@ -62,7 +62,7 @@ struct id3_frame *id3_frame_new(char const *); id3_length_t id3_latin1_length(id3_latin1_t const *); void id3_latin1_decode(id3_latin1_t const *, id3_ucs4_t *); - } + } #endif #define DESC _("WAV, AIFF, and other uncompressed types") @@ -194,7 +194,7 @@ PCMImportFileHandle::PCMImportFileHandle(wxString name, // the file is higher-quality, go with a format which preserves // the quality of the original file. // - + mFormat = (sampleFormat) gPrefs->Read(wxT("/SamplingRate/DefaultProjectSampleFormat"), floatSample); @@ -253,9 +253,9 @@ File > Check Dependencies will show the original names and location of any files How do you want to import the current file(s)?"), oldCopyPref == wxT("copy") ? _("copy in") : _("read directly"))); message->Wrap(500); message->SetName(message->GetLabel()); - + vbox->Add(message, 1, wxALL | wxEXPAND, 10); - + wxStaticBox *box = new wxStaticBox(&dialog, -1, _("Choose an import method")); box->SetName(box->GetLabel()); wxStaticBoxSizer *boxsizer = new wxStaticBoxSizer(box, wxVERTICAL); @@ -272,14 +272,14 @@ How do you want to import the current file(s)?"), oldCopyPref == wxT("copy") ? _ boxsizer->Add(dontAskNextTimeBox, 0, wxALL); vbox->Add(boxsizer, 0, wxALL, 10); dontAskNextTimeBox->SetName(wxStripMenuCodes(dontAskNextTimeBox->GetLabel())); - + wxRadioButton *prefsRadio = oldCopyPref == wxT("copy") ? copyRadio : aliasRadio; prefsRadio->SetValue(true); wxSizer *buttonSizer = dialog.CreateButtonSizer(wxOK | wxCANCEL); vbox->Add(buttonSizer, 0, wxALL | wxEXPAND, 10); - + dialog.SetSize(dialog.GetBestSize()); dialog.Layout(); dialog.Center(); @@ -323,7 +323,7 @@ int PCMImportFileHandle::Import(TrackFactory *trackFactory, bool doEdit = false; if (copyEdit.IsSameAs(wxT("edit"), false)) doEdit = true; - + CreateProgress(); @@ -353,7 +353,7 @@ int PCMImportFileHandle::Import(TrackFactory *trackFactory, sampleCount fileTotalFrames = (sampleCount)mInfo.frames; sampleCount maxBlockSize = channels[0]->GetMaxBlockSize(); int updateResult = false; - + // If the format is not seekable, we must use 'copy' mode, // because 'edit' mode depends on the ability to seek to an // arbitrary location in the file. @@ -364,7 +364,7 @@ int PCMImportFileHandle::Import(TrackFactory *trackFactory, // If this mode has been selected, we form the tracks as // aliases to the files we're editing, i.e. ("foo.wav", 12000-18000) // instead of actually making fresh copies of the samples. - + // lets use OD only if the file is longer than 30 seconds. Otherwise, why wake up extra threads. //todo: make this a user pref. bool useOD =fileTotalFrames>kMinimumODFileSampleSize; @@ -387,9 +387,9 @@ int PCMImportFileHandle::Import(TrackFactory *trackFactory, } } updateResult = mProgress->Update(fileTotalFrames, fileTotalFrames); - + if(useOD) - { + { ODComputeSummaryTask* computeTask=new ODComputeSummaryTask; bool moreThanStereo = mInfo.channels>2; for (c = 0; c < mInfo.channels; c++) @@ -411,23 +411,23 @@ int PCMImportFileHandle::Import(TrackFactory *trackFactory, // Otherwise, we're in the "copy" mode, where we read in the actual // samples from the file and store our own local copy of the // samples in the tracks. - + samplePtr srcbuffer = NewSamples(maxBlockSize * mInfo.channels, mFormat); samplePtr buffer = NewSamples(maxBlockSize, mFormat); unsigned long framescompleted = 0; - + long block; do { block = maxBlockSize; - + if (mFormat == int16Sample) block = sf_readf_short(mFile, (short *)srcbuffer, block); //import 24 bit int as float and have the append function convert it. This is how PCMAliasBlockFile works too. else block = sf_readf_float(mFile, (float *)srcbuffer, block); - + if (block) { for(c=0; cAppend(buffer, (mFormat == int16Sample)?int16Sample:floatSample, block); } framescompleted += block; @@ -521,7 +521,7 @@ int PCMImportFileHandle::Import(TrackFactory *trackFactory, } #if defined(USE_LIBID3TAG) - if (((mInfo.format & SF_FORMAT_TYPEMASK) == SF_FORMAT_AIFF) || + if (((mInfo.format & SF_FORMAT_TYPEMASK) == SF_FORMAT_AIFF) || ((mInfo.format & SF_FORMAT_TYPEMASK) == SF_FORMAT_WAV)) { wxFFile f(mFilename, wxT("rb")); if (f.IsOpened()) { diff --git a/src/import/ImportPlugin.h b/src/import/ImportPlugin.h index 54a151822..775a85aea 100644 --- a/src/import/ImportPlugin.h +++ b/src/import/ImportPlugin.h @@ -22,14 +22,14 @@ \class ImportFileHandle \brief Base class for FlacImportFileHandle, LOFImportFileHandle, -MP3ImportFileHandle, OggImportFileHandle and PCMImportFileHandle. +MP3ImportFileHandle, OggImportFileHandle and PCMImportFileHandle. Gives API for sound file import. *//****************************************************************//** \class ImportPlugin \brief Base class for FlacImportPlugin, LOFImportPlugin, -MP3ImportPlugin, OggImportPlugin and PCMImportPlugin. +MP3ImportPlugin, OggImportPlugin and PCMImportPlugin. Gives API for sound file import. *//****************************************************************//** @@ -37,7 +37,7 @@ Gives API for sound file import. \class UnusableImportPlugin \brief Used in place of a real plug in for plug ins that have not been compiled or are not available in this version of Audacity. Has -enough information to identify the file extensions that would be used, +enough information to identify the file extensions that would be used, but little else. *//****************************************************************//** diff --git a/src/import/ImportQT.cpp b/src/import/ImportQT.cpp index 38bb88ad5..d27f470ba 100644 --- a/src/import/ImportQT.cpp +++ b/src/import/ImportQT.cpp @@ -200,7 +200,7 @@ ImportFileHandle *QTImportPlugin::Open(wxString Filename) } // instantiate the movie - err = NewMovieFromDataRef(&theMovie, + err = NewMovieFromDataRef(&theMovie, newMovieActive | newMovieDontAskUnresolvedDataRefs, &resID, dataRef, @@ -399,7 +399,7 @@ done: if (maer) { MovieAudioExtractionEnd(maer); } - + return (res ? eProgressSuccess : eProgressFailed); } @@ -434,7 +434,7 @@ names[] = void QTImportFileHandle::AddMetadata(Tags *tags) { QTMetaDataRef metaDataRef = NULL; - OSErr err; + OSErr err; err = QTCopyMovieMetaData(mMovie, &metaDataRef); if (err != noErr) { @@ -466,7 +466,7 @@ void QTImportFileHandle::AddMetadata(Tags *tags) ByteCount outPropValueSizeUsed = 0; UInt32 outPropFlags; UInt32 dataType; - + // Get data type err = QTMetaDataGetItemProperty(metaDataRef, item, @@ -493,7 +493,7 @@ void QTImportFileHandle::AddMetadata(Tags *tags) // Alloc memory for it outValPtr = malloc(outPropValueSize); - + // Retrieve the data err = QTMetaDataGetItemProperty(metaDataRef, item, @@ -527,7 +527,7 @@ void QTImportFileHandle::AddMetadata(Tags *tags) } free(outValPtr); - } + } // we are done so release our metadata object QTMetaDataRelease(metaDataRef); diff --git a/src/import/ImportRaw.cpp b/src/import/ImportRaw.cpp index 78c03d30d..6e56b4715 100644 --- a/src/import/ImportRaw.cpp +++ b/src/import/ImportRaw.cpp @@ -15,7 +15,7 @@ unknown sample audio data. Implements ImportRawDialog. *//****************************************************************//** \class ImportRawDialog -\brief ImportRawDialog prompts you with options such as endianness +\brief ImportRawDialog prompts you with options such as endianness and sample size to help you importing data of an unknown format. *//*******************************************************************/ @@ -156,7 +156,7 @@ int ImportRaw(wxWindow *parent, wxString fileName, } sf_seek(sndFile, 0, SEEK_SET); - + totalFrames = (sampleCount)(sndInfo.frames * percent / 100.0); // @@ -166,7 +166,7 @@ int ImportRaw(wxWindow *parent, wxString fileName, // the file is higher-quality, go with a format which preserves // the quality of the original file. // - + format = (sampleFormat) gPrefs->Read(wxT("/SamplingRate/DefaultProjectSampleFormat"), floatSample); @@ -202,7 +202,7 @@ int ImportRaw(wxWindow *parent, wxString fileName, samplePtr srcbuffer = NewSamples(maxBlockSize * numChannels, format); samplePtr buffer = NewSamples(maxBlockSize, format); - + sampleCount framescompleted = 0; wxString msg; @@ -218,7 +218,7 @@ int ImportRaw(wxWindow *parent, wxString fileName, if (block + framescompleted > totalFrames) block = totalFrames - framescompleted; - + if (format == int16Sample) block = sf_readf_short(sndFile, (short *)srcbuffer, block); else @@ -236,7 +236,7 @@ int ImportRaw(wxWindow *parent, wxString fileName, ((float *)buffer)[j] = ((float *)srcbuffer)[numChannels*j+c]; } - + channels[c]->Append(buffer, format, block); } framescompleted += block; @@ -246,7 +246,7 @@ int ImportRaw(wxWindow *parent, wxString fileName, (wxULongLong_t)totalFrames); if (updateResult != eProgressSuccess) break; - + } while (block > 0 && framescompleted < totalFrames); sf_close(sndFile); @@ -401,7 +401,7 @@ ImportRawDialog::ImportRawDialog(wxWindow * parent, wxT("100"), 12); S.AddUnits(wxT("%")); - + // Rate text /* i18n-hint: (noun)*/ mRateText = S.AddTextBox(_("Sample rate:"), @@ -439,7 +439,7 @@ ImportRawDialog::~ImportRawDialog() void ImportRawDialog::OnOK(wxCommandEvent & WXUNUSED(event)) { long l; - + mEncoding = mEncodingSubtype[mEncodingChoice->GetSelection()]; mEncoding += (mEndianChoice->GetSelection() * 0x10000000); mChannels = mChannelChoice->GetSelection() + 1; diff --git a/src/import/RawAudioGuess.cpp b/src/import/RawAudioGuess.cpp index 7fff30fe5..a2ff6e07d 100644 --- a/src/import/RawAudioGuess.cpp +++ b/src/import/RawAudioGuess.cpp @@ -126,7 +126,7 @@ static void ExtractFloats(bool doublePrec, dataSize -= offset; } - #if WORDS_BIGENDIAN + #if WORDS_BIGENDIAN swap = !bigendian; #else swap = bigendian; @@ -168,7 +168,7 @@ static void ExtractFloats(bool doublePrec, data1[dataCount1] = u.f; dataCount1++; rawCount += 4; - } + } } if (stereo) { @@ -181,7 +181,7 @@ static void ExtractFloats(bool doublePrec, } *len1 = dataCount1; - *len2 = dataCount2; + *len2 = dataCount2; } static void Extract(bool bits16, @@ -304,7 +304,7 @@ static int GuessFloatFormats(int numTests, char **rawData, int dataSize, bool guessStereo = false; int stereoVotes = 0; int monoVotes = 0; - + #if RAW_GUESS_DEBUG FILE *af = g_raw_debug_file; fprintf(af, "Testing float\n"); @@ -383,7 +383,7 @@ static int GuessFloatFormats(int numTests, char **rawData, int dataSize, smoothAvg /= numTests; - #if RAW_GUESS_DEBUG + #if RAW_GUESS_DEBUG fprintf(af, "finite: %d/%d maxmin: %d/%d smooth: %f\n", finiteVotes, numTests, maxminVotes, numTests, smoothAvg); @@ -437,30 +437,30 @@ static int GuessFloatFormats(int numTests, char **rawData, int dataSize, rawData[test], dataSize, data1, data2, &len1, &len2); combinedChannel = JumpStat(data1, len1); - + if (leftChannel > combinedChannel && rightChannel > combinedChannel) stereoVotes++; else monoVotes++; } - + #if RAW_GUESS_DEBUG fprintf(af, "stereo: %d mono: %d\n", stereoVotes, monoVotes); #endif - + if (stereoVotes > monoVotes) guessStereo = true; else guessStereo = false; - + if (guessStereo == false) { - + /* test for repeated-byte, redundant stereo */ - + int rstereoVotes = 0; int rmonoVotes = 0; - + for (test = 0; test < numTests; test++) { float redundant; @@ -470,11 +470,11 @@ static int GuessFloatFormats(int numTests, char **rawData, int dataSize, rawData[test], dataSize, data1, data2, &len1, &len2); redundant = RedundantStereo(data1, len1); - + #if RAW_GUESS_DEBUG fprintf(af, "redundant: %f\n", redundant); #endif - + if (redundant > 0.8) rstereoVotes++; else @@ -484,10 +484,10 @@ static int GuessFloatFormats(int numTests, char **rawData, int dataSize, #if RAW_GUESS_DEBUG fprintf(af, "rstereo: %d rmono: %d\n", rstereoVotes, rmonoVotes); #endif - + if (rstereoVotes > rmonoVotes) guessStereo = true; - + } #if RAW_GUESS_DEBUG @@ -495,7 +495,7 @@ static int GuessFloatFormats(int numTests, char **rawData, int dataSize, fprintf(af, "stereo\n"); else fprintf(af, "mono\n"); - #endif + #endif *out_offset = bestOffset; @@ -503,12 +503,12 @@ static int GuessFloatFormats(int numTests, char **rawData, int dataSize, *out_channels = 2; else *out_channels = 1; - + if (bestPrec) format = SF_FORMAT_RAW | SF_FORMAT_DOUBLE; else format = SF_FORMAT_RAW | SF_FORMAT_FLOAT; - + if (bestEndian) format |= SF_ENDIAN_BIG; else @@ -516,7 +516,7 @@ static int GuessFloatFormats(int numTests, char **rawData, int dataSize, free(data1); free(data2); - + return format; } @@ -548,8 +548,8 @@ static int Guess8Bit(int numTests, char **rawData, int dataSize, int *out_channe * * The JumpTest measures the average jump between two successive samples * and returns a value 0-1. 0 is maximally discontinuous, 1 is smooth. - */ - + */ + for (test = 0; test < numTests; test++) { float signL, signR, unsignL, unsignR; @@ -563,12 +563,12 @@ static int Guess8Bit(int numTests, char **rawData, int dataSize, int *out_channe data1, data2, &len1, &len2); unsignL = JumpStat(data1, len1); unsignR = JumpStat(data2, len2); - + if (signL > unsignL) signvotes++; else unsignvotes++; - + if (signR > unsignR) signvotes++; else @@ -583,7 +583,7 @@ static int Guess8Bit(int numTests, char **rawData, int dataSize, int *out_channe guessSigned = true; else guessSigned = false; - + #if RAW_GUESS_DEBUG if (guessSigned) fprintf(af, "signed\n"); @@ -607,41 +607,41 @@ static int Guess8Bit(int numTests, char **rawData, int dataSize, int *out_channe Extract(0, guessSigned, 0, 0, 0, rawData[test], dataSize, data1, data2, &len1, &len2); combinedChannel = JumpStat(data1, len1); - + if (leftChannel > combinedChannel && rightChannel > combinedChannel) stereoVotes++; else monoVotes++; } - + #if RAW_GUESS_DEBUG fprintf(af, "stereo: %d mono: %d\n", stereoVotes, monoVotes); #endif - + if (stereoVotes > monoVotes) guessStereo = true; else guessStereo = false; - + if (guessStereo == false) { - + /* test for repeated-byte, redundant stereo */ - + int rstereoVotes = 0; int rmonoVotes = 0; - + for (test = 0; test < numTests; test++) { float redundant; Extract(0, guessSigned, 0, 0, 0, rawData[test], dataSize, data1, data2, &len1, &len2); redundant = RedundantStereo(data1, len1); - + #if RAW_GUESS_DEBUG fprintf(af, "redundant: %f\n", redundant); #endif - + if (redundant > 0.8) rstereoVotes++; else @@ -651,10 +651,10 @@ static int Guess8Bit(int numTests, char **rawData, int dataSize, int *out_channe #if RAW_GUESS_DEBUG fprintf(af, "rstereo: %d rmono: %d\n", rstereoVotes, rmonoVotes); #endif - + if (rstereoVotes > rmonoVotes) guessStereo = true; - + } #if RAW_GUESS_DEBUG @@ -662,7 +662,7 @@ static int Guess8Bit(int numTests, char **rawData, int dataSize, int *out_channe fprintf(af, "stereo\n"); else fprintf(af, "mono\n"); - #endif + #endif free(data1); free(data2); @@ -705,7 +705,7 @@ static int Guess16Bit(int numTests, char **rawData, fprintf(af, "16-bit\n"); #endif - /* + /* * Do the signed/unsigned test by using only the MSB. */ @@ -829,7 +829,7 @@ static int Guess16Bit(int numTests, char **rawData, if (rstereoVotes > rmonoVotes) guessStereo = true; - + } #if RAW_GUESS_DEBUG @@ -841,7 +841,7 @@ static int Guess16Bit(int numTests, char **rawData, /* * Finally, determine the endianness and offset. - * + * * Even MSB -> BigEndian or LittleEndian with Offset * Odd MSB -> LittleEndian or BigEndian with Offset */ @@ -854,7 +854,7 @@ static int Guess16Bit(int numTests, char **rawData, #endif for (test = 0; test < numTests; test++) { - + float former, latter; int i, offs; @@ -868,7 +868,7 @@ static int Guess16Bit(int numTests, char **rawData, for (i = 0; i < (dataSize/2)-1; i++) rawData2[i] = rawData[test][2 * i + (evenMSB ? 0 : 1)]; - + former = 0.0; Extract(1, guessSigned, guessStereo, guessBigEndian, guessOffset, rawData[test], dataSize-4, data1, data2, &len1, &len2); @@ -935,7 +935,7 @@ static int Guess16Bit(int numTests, char **rawData, #endif format = SF_FORMAT_RAW | SF_FORMAT_PCM_16; - + if (guessBigEndian) format |= SF_ENDIAN_BIG; else @@ -990,7 +990,7 @@ static int GuessIntFormats(int numTests, char **rawData, int dataSize, * * Note that this correctly makes the distinction whether we are dealing * with mono or stereo data. - */ + */ for (test = 0; test < numTests; test++) { float even, odd; diff --git a/src/ondemand/ODComputeSummaryTask.h b/src/ondemand/ODComputeSummaryTask.h index e8bc894ca..e8170a3f8 100644 --- a/src/ondemand/ODComputeSummaryTask.h +++ b/src/ondemand/ODComputeSummaryTask.h @@ -35,41 +35,41 @@ class ODComputeSummaryTask:public ODTask /// Constructs an ODTask ODComputeSummaryTask(); virtual ~ODComputeSummaryTask(){}; - + virtual ODTask* Clone(); - + ///Subclasses should override to return respective type. virtual unsigned int GetODType(){return eODPCMSummary;} - + ///Return the task name virtual const char* GetTaskName(){return "ODComputeSummaryTask";} - + virtual const wxChar* GetTip(){return _("Import complete. Calculating waveform");} - + virtual bool UsesCustomWorkUntilPercentage(){return true;} virtual float ComputeNextWorkUntilPercentageComplete(); - + ///releases memory that the ODTask owns. Subclasses should override. virtual void Terminate(); - + protected: ///recalculates the percentage complete. virtual void CalculatePercentComplete(); - - ///Computes and writes the data for one BlockFile if it still has a refcount. + + ///Computes and writes the data for one BlockFile if it still has a refcount. virtual void DoSomeInternal(); - + ///Readjusts the blockfile order in the default manner. If we have had an ODRequest ///Then it updates in the OD manner. virtual void Update(); - + ///Orders the input as either On-Demand or default layered order. void OrderBlockFiles(std::vector &unorderedBlocks); - ///tells us whether or not Update has been run at least once. + ///tells us whether or not Update has been run at least once. void MarkUpdateRan(); bool HasUpdateRan(); - + //mBlockFiles is touched on several threads- the OD terminate thread, and the task thread, so we need to mutex it. ODLock mBlockFilesMutex; std::vector mBlockFiles; diff --git a/src/ondemand/ODDecodeFFmpegTask.cpp b/src/ondemand/ODDecodeFFmpegTask.cpp index 8e173517e..8712162f8 100644 --- a/src/ondemand/ODDecodeFFmpegTask.cpp +++ b/src/ondemand/ODDecodeFFmpegTask.cpp @@ -18,7 +18,7 @@ #include #endif -#include "../Experimental.h" +#include "../Experimental.h" #ifdef USE_FFMPEG #ifdef EXPERIMENTAL_OD_FFMPEG @@ -60,22 +60,22 @@ public: ///This should handle unicode converted to UTF-8 on mac/linux, but OD TODO:check on windows ODFFmpegDecoder(const wxString & fileName, streamContext** scs, int numStreams,WaveTrack*** channels, AVFormatContext* formatContext, int streamIndex); virtual ~ODFFmpegDecoder(); - - ///Decodes the samples for this blockfile from the real file into a float buffer. + + ///Decodes the samples for this blockfile from the real file into a float buffer. ///This is file specific, so subclasses must implement this only. ///the buffer was defined like ///samplePtr sampleData = NewSamples(mLen, floatSample); ///this->ReadData(sampleData, floatSample, 0, mLen); - ///This class should call ReadHeader() first, so it knows the length, and can prepare - ///the file object if it needs to. + ///This class should call ReadHeader() first, so it knows the length, and can prepare + ///the file object if it needs to. virtual int Decode(samplePtr & data, sampleFormat & format, sampleCount start, sampleCount len, unsigned int channel); - ///This is a must implement abstract virtual in the superclass. + ///This is a must implement abstract virtual in the superclass. ///However it doesn't do anything because ImportFFMpeg does all that for us. virtual bool ReadHeader() {return true;} - + bool SeekingAllowed() ; - + private: void InsertCache(FFMpegDecodeCache* cache); @@ -85,13 +85,13 @@ private: ///! Reads next audio frame ///\return pointer to the stream context structure to which the frame belongs to or NULL on error, or 1 if stream is not to be imported. streamContext* ReadNextFrame(); - + ///! Decodes the frame ///\param sc - stream context (from ReadNextFrame) ///\param flushing - true if flushing (no more frames left), false otherwise ///\return 0 on success, -1 if it can't decode any further int DecodeFrame(streamContext *sc, bool flushing); - + int mNumStreams; streamContext **mScs; //!< Array of pointers to stream contexts. Length is mNumStreams. WaveTrack*** mChannels; @@ -100,13 +100,13 @@ private: int mNumSamplesInCache; sampleCount mCurrentPos; //the index of the next sample to be decoded sampleCount mCurrentLen; //length of the last packet decoded - + bool mSeekingAllowedStatus; int mStreamIndex; }; -//------ ODDecodeFFmpegTask definitions +//------ ODDecodeFFmpegTask definitions ODDecodeFFmpegTask::ODDecodeFFmpegTask(void* scs,int numStreams, WaveTrack*** channels, void* formatContext, int streamIndex) { mScs=scs; @@ -149,7 +149,7 @@ ODFileDecoder* ODDecodeFFmpegTask::CreateFileDecoder(const wxString & fileName) /// subclasses need to override this if they cannot always seek. /// seeking will be enabled once this is true. -bool ODFFmpegDecoder::SeekingAllowed() +bool ODFFmpegDecoder::SeekingAllowed() { return false; /* @@ -157,7 +157,7 @@ bool ODFFmpegDecoder::SeekingAllowed() return mSeekingAllowedStatus == ODFFMPEG_SEEKING_TEST_SUCCESS; //we can seek if the following checks pass: - //-sample rate is less than the reciprocal of the time_base of the seeking stream. + //-sample rate is less than the reciprocal of the time_base of the seeking stream. //-a seek test has been made and dts updates as expected. //we want to clone this to run a seek test. AVFormatContext* ic = (AVFormatContext*)mFormatContext; @@ -168,27 +168,27 @@ bool ODFFmpegDecoder::SeekingAllowed() for (unsigned int i = 0; i < ic->nb_streams; i++) { if (ic->streams[i]->codec->codec_type == AVMEDIA_TYPE_AUDIO) - { - audioStreamExists = true; + { + audioStreamExists = true; st = ic->streams[i]; if(st->duration <= 0 || st->codec->sample_rate <= 0) goto test_failed; - - //if the time base reciprocal is less than the sample rate it means we can't accurately represent a sample with the timestamp in av. - float time_base_inv = ((float)st->time_base.den/st->time_base.num); + + //if the time base reciprocal is less than the sample rate it means we can't accurately represent a sample with the timestamp in av. + float time_base_inv = ((float)st->time_base.den/st->time_base.num); if(time_base_inv < st->codec->sample_rate) goto test_failed; - + } } - + if(!audioStreamExists) goto test_failed; - //TODO: now try a seek and see if dts/pts (decode/presentation timestamp) is updated as we expected it to be. + //TODO: now try a seek and see if dts/pts (decode/presentation timestamp) is updated as we expected it to be. //This should be done using a new AVFormatContext clone so that we don't ruin the file pointer if we fail. -// url_fseek(mFormatContext->pb,0,SEEK_SET); +// url_fseek(mFormatContext->pb,0,SEEK_SET); + - AVFormatContext* tempContext; int err; err = ufile_fopen_input(&tempContext, mFName); @@ -230,8 +230,8 @@ mCurrentLen(0), mSeekingAllowedStatus(ODFFMPEG_SEEKING_TEST_UNKNOWN), mStreamIndex(streamIndex) { - PickFFmpegLibs(); - + PickFFmpegLibs(); + //do a shallow copy of the 2d array. mChannels = new WaveTrack **[mNumStreams]; @@ -251,8 +251,8 @@ mStreamIndex(streamIndex) stream_delay = mScs[streamIndex]->m_stream->start_time; } mCurrentPos = double(stream_delay) / AV_TIME_BASE; - - //TODO: add a ref counter to scs? This will be necessary if we want to allow copy and paste of not-yet decoded + + //TODO: add a ref counter to scs? This will be necessary if we want to allow copy and paste of not-yet decoded //ODDecodeBlockFiles that point to FFmpeg files. } @@ -273,15 +273,15 @@ ODFFmpegDecoder::~ODFFmpegDecoder() delete mScs[i]; } free(mScs); - + //delete our caches. while(mDecodeCache.size()) { free(mDecodeCache[0]->samplePtr); delete mDecodeCache[0]; - mDecodeCache.erase(mDecodeCache.begin()); + mDecodeCache.erase(mDecodeCache.begin()); } - + //free the channel pointer arrays for (int s = 0; s < mNumStreams; s++) { @@ -295,7 +295,7 @@ ODFFmpegDecoder::~ODFFmpegDecoder() //this value controls this amount. this should be a value that is much larger than the payload for a single packet, and around block file size around 1-10 secs. #define kDecodeSampleAllowance 400000 //number of jump backwards seeks -#define kMaxSeekRewindAttempts 8 +#define kMaxSeekRewindAttempts 8 int ODFFmpegDecoder::Decode(samplePtr & data, sampleFormat & format, sampleCount start, sampleCount len, unsigned int channel) { format = mScs[mStreamIndex]->m_osamplefmt; @@ -303,17 +303,17 @@ int ODFFmpegDecoder::Decode(samplePtr & data, sampleFormat & format, sampleCount data = NewSamples(len, format); samplePtr bufStart = data; streamContext* sc = NULL; - + int nChannels; - - // printf("start %llu len %llu\n", start, len); + + // printf("start %llu len %llu\n", start, len); //TODO update this to work with seek - this only works linearly now. if(mCurrentPos > start && mCurrentPos <= start+len + kDecodeSampleAllowance) { //this next call takes data, start and len as reference variables and updates them to reflect the new area that is needed. FillDataFromCache(bufStart, format, start,len,channel); } - + bool seeking = false; //look at the decoding timestamp and see if the next sample that will be decoded is not the next sample we need. if(len && (mCurrentPos > start + len || mCurrentPos + kDecodeSampleAllowance < start ) && SeekingAllowed()) { @@ -321,14 +321,14 @@ int ODFFmpegDecoder::Decode(samplePtr & data, sampleFormat & format, sampleCount AVStream* st = sc->m_stream; int stindex = -1; uint64_t targetts; - - //printf("attempting seek to %llu\n", start); + + //printf("attempting seek to %llu\n", start); //we have to find the index for this stream. for (unsigned int i = 0; i < mFormatContext->nb_streams; i++) { if (mFormatContext->streams[i] == sc->m_stream ) stindex =i; } - + if(stindex >=0) { int numAttempts = 0; //reset mCurrentPos to a bogus value @@ -336,18 +336,18 @@ int ODFFmpegDecoder::Decode(samplePtr & data, sampleFormat & format, sampleCount while(numAttempts++ < kMaxSeekRewindAttempts && mCurrentPos > start) { //we want to move slightly before the start of the block file, but not too far ahead targetts = (start-kDecodeSampleAllowance*numAttempts/kMaxSeekRewindAttempts) * ((double)st->time_base.den/(st->time_base.num * st->codec->sample_rate )); - if(targetts<0) + if(targetts<0) targetts=0; - //printf("attempting seek to %llu, attempts %d\n", targetts, numAttempts); + //printf("attempting seek to %llu, attempts %d\n", targetts, numAttempts); if(av_seek_frame(mFormatContext,stindex,targetts,0) >= 0){ - //find out the dts we've seekd to. + //find out the dts we've seekd to. sampleCount actualDecodeStart = 0.5 + st->codec->sample_rate * st->cur_dts * ((double)st->time_base.num/st->time_base.den); //this is mostly safe because den is usually 1 or low number but check for high values. - + mCurrentPos = actualDecodeStart; seeking = true; - //if the seek was past our desired position, rewind a bit. + //if the seek was past our desired position, rewind a bit. //printf("seek ok to %llu samps, float: %f\n",actualDecodeStart,actualDecodeStartDouble); } else { printf("seek failed"); @@ -356,14 +356,14 @@ int ODFFmpegDecoder::Decode(samplePtr & data, sampleFormat & format, sampleCount } if(mCurrentPos>start){ mSeekingAllowedStatus = (bool)ODFFMPEG_SEEKING_TEST_FAILED; - // url_fseek(mFormatContext->pb,sc->m_pkt.pos,SEEK_SET); + // url_fseek(mFormatContext->pb,sc->m_pkt.pos,SEEK_SET); printf("seek fail, reverting to previous pos\n"); return -1; } } } bool firstpass = true; - + //we decode up to the end of the blockfile while (len>0 && (mCurrentPos < start+len) && (sc = ReadNextFrame()) != NULL) { @@ -378,7 +378,7 @@ int ODFFmpegDecoder::Decode(samplePtr & data, sampleFormat & format, sampleCount // for some formats // The only other case for inserting silence is for initial offset and ImportFFmpeg.cpp does this for us if (seeking) { - actualDecodeStart = 0.52 + (sc->m_stream->codec->sample_rate * sc->m_pkt.dts + actualDecodeStart = 0.52 + (sc->m_stream->codec->sample_rate * sc->m_pkt.dts * ((double)sc->m_stream->time_base.num / sc->m_stream->time_base.den)); //this is mostly safe because den is usually 1 or low number but check for high values. @@ -398,9 +398,9 @@ int ODFFmpegDecoder::Decode(samplePtr & data, sampleFormat & format, sampleCount FFMpegDecodeCache* cache = new FFMpegDecodeCache; //printf("skipping/zeroing %i samples. - now:%llu (%f), last:%llu, lastlen:%llu, start %llu, len %llu\n",amt,actualDecodeStart, actualDecodeStartdouble, mCurrentPos, mCurrentLen, start, len); - + //put it in the cache so the other channels can use it. - cache->numChannels = sc->m_stream->codec->channels; + cache->numChannels = sc->m_stream->codec->channels; cache->len = amt; cache->start=start; // 8 bit and 16 bit audio output from ffmpeg means @@ -414,7 +414,7 @@ int ODFFmpegDecoder::Decode(samplePtr & data, sampleFormat & format, sampleCount cache->samplePtr = (uint8_t*) malloc(amt * cache->numChannels * SAMPLE_SIZE(format)); memset(cache->samplePtr, 0, amt * cache->numChannels * SAMPLE_SIZE(format)); - + InsertCache(cache); } firstpass=false; @@ -431,7 +431,7 @@ int ODFFmpegDecoder::Decode(samplePtr & data, sampleFormat & format, sampleCount { av_free_packet(&sc->m_pkt); sc->m_pktValid = 0; - } + } } } @@ -446,14 +446,14 @@ int ODFFmpegDecoder::Decode(samplePtr & data, sampleFormat & format, sampleCount { av_free_packet(&mScs[i]->m_pkt); mScs[i]->m_pktValid = 0; - } + } } } } - + //this next call takes data, start and len as reference variables and updates them to reflect the new area that is needed. FillDataFromCache(bufStart, format, start, len, channel); - + // CHECK: not sure if we need this. In any case it has to be updated for the new float case (not just int16) //if for some reason we couldn't get the samples, fill them with silence /* @@ -475,10 +475,10 @@ int ODFFmpegDecoder::FillDataFromCache(samplePtr & data, sampleFormat outFormat, if(mDecodeCache.size() <= 0) return 0; int samplesFilled=0; - - //do a search for the best position to start at. + + //do a search for the best position to start at. //Guess that the array is evenly spaced from end to end - (dictionary sort) - //assumes the array is sorted. + //assumes the array is sorted. //all we need for this to work is a location in the cache array //that has a start time of less than our start sample, but try to get closer with binary search int searchStart = 0; @@ -491,7 +491,7 @@ int ODFFmpegDecoder::FillDataFromCache(samplePtr & data, sampleFormat outFormat, while(searchStart+1start )/mDecodeCache[searchEnd]->start; - + //we want guess to point at the first index that hits even if there are duplicate start times (which can happen) if(mDecodeCache[guess]->start+mDecodeCache[guess]->len >= start) searchEnd = --guess; @@ -499,15 +499,15 @@ int ODFFmpegDecoder::FillDataFromCache(samplePtr & data, sampleFormat outFormat, searchStart = guess; } } - + //this is a sorted array for(int i=searchStart; i < (int)mDecodeCache.size(); i++) - { + { //check for a cache hit - be careful to include the first/last sample an nothing more. //we only accept cache hits that touch either end - no piecing out of the middle. //this way the amount to be decoded remains set. if(start < mDecodeCache[i]->start+mDecodeCache[i]->len && - start + len > mDecodeCache[i]->start) + start + len > mDecodeCache[i]->start) { uint8_t* outBuf; outBuf = (uint8_t*)data; @@ -515,12 +515,12 @@ int ODFFmpegDecoder::FillDataFromCache(samplePtr & data, sampleFormat outFormat, //a method of dealing with this yet, and it won't happen very often. if(startstart && start+len > mDecodeCache[i]->start+mDecodeCache[i]->len) continue; - + int samplesHit; int hitStartInCache; int hitStartInRequest; int nChannels = mDecodeCache[i]->numChannels; - samplesHit = FFMIN(start+len,mDecodeCache[i]->start+mDecodeCache[i]->len) + samplesHit = FFMIN(start+len,mDecodeCache[i]->start+mDecodeCache[i]->len) - FFMAX(mDecodeCache[i]->start,start); //find the start of the hit relative to the cache buffer start. hitStartInCache = FFMAX(0,start-mDecodeCache[i]->start); @@ -537,24 +537,24 @@ int ODFFmpegDecoder::FillDataFromCache(samplePtr & data, sampleFormat outFormat, //printf("u8 in %llu out %llu cachelen %llu outLen %llu\n", inIndex, outIndex, mDecodeCache[i]->len, len); ((int16_t *)outBuf)[outIndex] = (int16_t) (((uint8_t*)mDecodeCache[i]->samplePtr)[inIndex] - 0x80) << 8; break; - + case SAMPLE_FMT_S16: //printf("u16 in %llu out %llu cachelen %llu outLen %llu\n", inIndex, outIndex, mDecodeCache[i]->len, len); ((int16_t *)outBuf)[outIndex] = ((int16_t*)mDecodeCache[i]->samplePtr)[inIndex]; break; - + case SAMPLE_FMT_S32: - //printf("s32 in %llu out %llu cachelen %llu outLen %llu\n", inIndex, outIndex, mDecodeCache[i]->len, len); + //printf("s32 in %llu out %llu cachelen %llu outLen %llu\n", inIndex, outIndex, mDecodeCache[i]->len, len); ((float *)outBuf)[outIndex] = (float) ((int32_t*)mDecodeCache[i]->samplePtr)[inIndex] * (1.0 / (1 << 31)); break; - + case SAMPLE_FMT_FLT: //printf("f in %llu out %llu cachelen %llu outLen %llu\n", inIndex, outIndex, mDecodeCache[i]->len, len); ((float *)outBuf)[outIndex] = (float) ((float*)mDecodeCache[i]->samplePtr)[inIndex]; break; - + case SAMPLE_FMT_DBL: - //printf("dbl in %llu out %llu cachelen %llu outLen %llu\n", inIndex, outIndex, mDecodeCache[i]->len, len); + //printf("dbl in %llu out %llu cachelen %llu outLen %llu\n", inIndex, outIndex, mDecodeCache[i]->len, len); ((float *)outBuf)[outIndex] = (float) ((double*)mDecodeCache[i]->samplePtr)[inIndex]; break; @@ -566,7 +566,7 @@ int ODFFmpegDecoder::FillDataFromCache(samplePtr & data, sampleFormat outFormat, } //update the cursor samplesFilled += samplesHit; - + //update the input start/len params - if the end was hit we can take off just len. //otherwise, we can assume only the front of the request buffer was hit since we don't allow it to be split. if(start < mDecodeCache[i]->start) @@ -601,7 +601,7 @@ int ODFFmpegDecoder::DecodeFrame(streamContext *sc, bool flushing) if (ret == 0 && sc->m_frameValid) { //stick it in the cache. - //TODO- consider growing/unioning a few cache buffers like WaveCache does. + //TODO- consider growing/unioning a few cache buffers like WaveCache does. //however we can't use wavecache as it isn't going to handle our stereo interleaved part, and isn't for samples //However if other ODDecode tasks need this, we should do a new class for caching. FFMpegDecodeCache* cache = new FFMpegDecodeCache; @@ -613,7 +613,7 @@ int ODFFmpegDecoder::DecodeFrame(streamContext *sc, bool flushing) cache->samplePtr = (uint8_t*) malloc(sc->m_decodedAudioSamplesValidSiz); cache->samplefmt = sc->m_samplefmt; memcpy(cache->samplePtr, sc->m_decodedAudioSamples, sc->m_decodedAudioSamplesValidSiz); - + InsertCache(cache); } return ret; @@ -621,11 +621,11 @@ int ODFFmpegDecoder::DecodeFrame(streamContext *sc, bool flushing) void ODFFmpegDecoder::InsertCache(FFMpegDecodeCache* cache) { int searchStart = 0; - int searchEnd = mDecodeCache.size(); //size() is also a valid insert index. + int searchEnd = mDecodeCache.size(); //size() is also a valid insert index. int guess = 0; //first just guess that the cache is contiguous and we can just use math to figure it out like a dictionary //by guessing where our hit will be. - + // printf("inserting cache start %llu, mCurrentPos %llu\n", cache->start, mCurrentPos); while(searchStartlen; - mCurrentPos=cache->start+cache->len; + mCurrentPos=cache->start+cache->len; mDecodeCache.insert(mDecodeCache.begin()+guess, cache); // mDecodeCache.push_back(cache); - + mNumSamplesInCache+=cache->len; - - //if the cache is too big, drop some. + + //if the cache is too big, drop some. while(mNumSamplesInCache>kMaxSamplesInCache) { int dropindex; @@ -656,7 +656,7 @@ void ODFFmpegDecoder::InsertCache(FFMpegDecodeCache* cache) { mNumSamplesInCache-=mDecodeCache[dropindex]->len; free(mDecodeCache[dropindex]->samplePtr); delete mDecodeCache[dropindex]; - mDecodeCache.erase(mDecodeCache.begin()+dropindex); + mDecodeCache.erase(mDecodeCache.begin()+dropindex); } } diff --git a/src/ondemand/ODDecodeFFmpegTask.h b/src/ondemand/ODDecodeFFmpegTask.h index bdd3b39d3..cb140c2ce 100644 --- a/src/ondemand/ODDecodeFFmpegTask.h +++ b/src/ondemand/ODDecodeFFmpegTask.h @@ -34,8 +34,8 @@ class ODDecodeFFmpegTask:public ODDecodeTask virtual ODTask* Clone(); ///Creates an ODFileDecoder that decodes a file of filetype the subclass handles. virtual ODFileDecoder* CreateFileDecoder(const wxString & fileName); - - ///Lets other classes know that this class handles the ffmpeg type + + ///Lets other classes know that this class handles the ffmpeg type ///Subclasses should override to return respective type. virtual unsigned int GetODType(){return eODFFMPEG;} diff --git a/src/ondemand/ODDecodeFlacTask.cpp b/src/ondemand/ODDecodeFlacTask.cpp index f7afa3256..37c03b033 100644 --- a/src/ondemand/ODDecodeFlacTask.cpp +++ b/src/ondemand/ODDecodeFlacTask.cpp @@ -15,7 +15,7 @@ #include #include -#ifdef USE_LIBID3TAG +#ifdef USE_LIBID3TAG extern "C" { #include } @@ -85,8 +85,8 @@ void ODFLACFile::metadata_callback(const FLAC__StreamMetadata *metadata) void ODFLACFile::error_callback(FLAC__StreamDecoderErrorStatus status) { mWasError = true; - - + + switch (status) { case FLAC__STREAM_DECODER_ERROR_STATUS_LOST_SYNC: @@ -109,16 +109,16 @@ void ODFLACFile::error_callback(FLAC__StreamDecoderErrorStatus status) FLAC__StreamDecoderWriteStatus ODFLACFile::write_callback(const FLAC__Frame *frame, const FLAC__int32 * const buffer[]) { - + unsigned int bytesToCopy = frame->header.blocksize; if(bytesToCopy>mDecoder->mDecodeBufferLen-mDecoder->mDecodeBufferWritePosition) bytesToCopy=mDecoder->mDecodeBufferLen-mDecoder->mDecodeBufferWritePosition; - + //the decodeBuffer was allocated to be the same format as the flac buffer, so we can do a straight up memcpy. memcpy(mDecoder->mDecodeBuffer+SAMPLE_SIZE(mDecoder->mFormat)*mDecoder->mDecodeBufferWritePosition,buffer[mDecoder->mTargetChannel],SAMPLE_SIZE(mDecoder->mFormat) * bytesToCopy); - + mDecoder->mDecodeBufferWritePosition+=bytesToCopy; -/* +/* short *tmp=new short[frame->header.blocksize]; for (unsigned int chn=0; chnmNumChannels; chn++) { @@ -142,10 +142,10 @@ FLAC__StreamDecoderWriteStatus ODFLACFile::write_callback(const FLAC__Frame *fra */ mDecoder->mSamplesDone += frame->header.blocksize; - + return FLAC__STREAM_DECODER_WRITE_STATUS_CONTINUE; // return FLAC__STREAM_DECODER_WRITE_STATUS_ABORT; - + // mDecoder->mUpdateResult = mDecoder->mProgress->Update((wxULongLong_t) mDecoder->mSamplesDone, mDecoder->mNumSamples != 0 ? (wxULongLong_t)mDecoder->mNumSamples : 1); /* if (mDecoder->mUpdateResult != eProgressSuccess) @@ -159,44 +159,44 @@ FLAC__StreamDecoderWriteStatus ODFLACFile::write_callback(const FLAC__Frame *fra //--Decoder stuff: - ///Decodes the samples for this blockfile from the real file into a float buffer. + ///Decodes the samples for this blockfile from the real file into a float buffer. ///This is file specific, so subclasses must implement this only. ///the buffer was defined like ///samplePtr sampleData = NewSamples(mLen, floatSample); ///this->ReadData(sampleData, floatSample, 0, mLen); - ///This class should call ReadHeader() first, so it knows the length, and can prepare - ///the file object if it needs to. + ///This class should call ReadHeader() first, so it knows the length, and can prepare + ///the file object if it needs to. int ODFlacDecoder::Decode(samplePtr & data, sampleFormat & format, sampleCount start, sampleCount len, unsigned int channel) { //we need to lock this so the target stays fixed over the seek/write callback. mFlacFileLock.Lock(); - + bool usingCache=mLastDecodeStartSample==start; if(usingCache) { - //we've just decoded this, so lets use a cache. (often so for + //we've just decoded this, so lets use a cache. (often so for } - - + + mDecodeBufferWritePosition=0; mDecodeBufferLen = len; data = NewSamples(len, mFormat); mDecodeBuffer=data; format = mFormat; - + mTargetChannel=channel; - + if(!mFile->seek_absolute(start)) { mFlacFileLock.Unlock(); return -1; - } - + } + while(mDecodeBufferWritePositionprocess_single(); - + mFlacFileLock.Unlock(); if(!usingCache) { @@ -206,9 +206,9 @@ int ODFlacDecoder::Decode(samplePtr & data, sampleFormat & format, sampleCount s //calculate summary happen in ODDecodeBlockFile::WriteODDecodeBlockFile, where this method is also called. return 1; } - + ///Read header. Subclasses must override. Probably should save the info somewhere. -///Ideally called once per decoding of a file. This complicates the task because +///Ideally called once per decoding of a file. This complicates the task because ///returns true if the file exists and the header was read alright. //Note:we are not using LEGACY_FLAC defs (see ImportFlac.cpp FlacImportFileHandle::Init() @@ -219,7 +219,7 @@ bool ODFlacDecoder::ReadHeader() //we want to use the native flac type for quick conversion. /* (sampleFormat) gPrefs->Read(wxT("/SamplingRate/DefaultProjectSampleFormat"), floatSample);*/ - if(mFile) + if(mFile) delete mFile; mFile = new ODFLACFile(this); @@ -252,11 +252,11 @@ bool ODFlacDecoder::ReadHeader() // This probably is not a FLAC file at all return false; } - + MarkInitialized(); return true; -} +} ODFLACFile* ODFlacDecoder::GetFlacFile() { @@ -264,7 +264,7 @@ ODFLACFile* ODFlacDecoder::GetFlacFile() } ODFlacDecoder::~ODFlacDecoder(){ - if(mFile) + if(mFile) { mFile->finish(); delete mFile; @@ -290,7 +290,7 @@ ODFileDecoder* ODDecodeFlacTask::CreateFileDecoder(const wxString & fileName) cnt = binaryFile.Read(query, sizeof(query)); cnt = id3_tag_query(query, cnt); binaryFile.Seek(cnt); -#endif +#endif char buf[5]; cnt = binaryFile.Read(buf, 4); @@ -298,9 +298,9 @@ ODFileDecoder* ODDecodeFlacTask::CreateFileDecoder(const wxString & fileName) if (cnt == wxInvalidOffset || strncmp(buf, FLAC_HEADER, 4) != 0) { // File is not a FLAC file - return NULL; + return NULL; } - + // Open the file for import ODFlacDecoder *decoder = new ODFlacDecoder(fileName); */ diff --git a/src/ondemand/ODDecodeFlacTask.h b/src/ondemand/ODDecodeFlacTask.h index 618ce6c25..19375954b 100644 --- a/src/ondemand/ODDecodeFlacTask.h +++ b/src/ondemand/ODDecodeFlacTask.h @@ -15,7 +15,7 @@ This is an abstract class that subclasses will have to derive the types from. For any type there should only be one ODDecodeTask associated with -a given track. +a given track. There could be the ODBlockFiles of several FLACs in one track (after copy and pasting), so things aren't as simple as they seem - the implementation needs to be robust enough to allow all the user changes such as copy/paste, delete, and so on. @@ -49,13 +49,13 @@ class ODDecodeFlacTask:public ODDecodeTask /// Constructs an ODTask ODDecodeFlacTask(){} virtual ~ODDecodeFlacTask(); - - + + virtual ODTask* Clone(); ///Creates an ODFileDecoder that decodes a file of filetype the subclass handles. virtual ODFileDecoder* CreateFileDecoder(const wxString & fileName); - - ///Lets other classes know that this class handles flac + + ///Lets other classes know that this class handles flac ///Subclasses should override to return respective type. virtual unsigned int GetODType(){return eODFLAC;} }; @@ -71,7 +71,7 @@ class ODFLACFile : public FLAC::Decoder::File set_metadata_respond(FLAC__METADATA_TYPE_VORBIS_COMMENT); set_metadata_respond(FLAC__METADATA_TYPE_STREAMINFO); } - + bool get_was_error() const { return mWasError; @@ -81,7 +81,7 @@ class ODFLACFile : public FLAC::Decoder::File ODFlacDecoder *mDecoder; bool mWasError; wxArrayString mComments; - + protected: virtual FLAC__StreamDecoderWriteStatus write_callback(const FLAC__Frame *frame, const FLAC__int32 * const buffer[]); @@ -98,20 +98,20 @@ public: ///This should handle unicode converted to UTF-8 on mac/linux, but OD TODO:check on windows ODFlacDecoder(const wxString & fileName):ODFileDecoder(fileName),mSamplesDone(0){mFile=NULL;} virtual ~ODFlacDecoder(); - - ///Decodes the samples for this blockfile from the real file into a float buffer. + + ///Decodes the samples for this blockfile from the real file into a float buffer. ///This is file specific, so subclasses must implement this only. ///the buffer was defined like ///samplePtr sampleData = NewSamples(mLen, floatSample); ///this->ReadData(sampleData, floatSample, 0, mLen); - ///This class should call ReadHeader() first, so it knows the length, and can prepare - ///the file object if it needs to. + ///This class should call ReadHeader() first, so it knows the length, and can prepare + ///the file object if it needs to. virtual int Decode(samplePtr & data, sampleFormat & format, sampleCount start, sampleCount len, unsigned int channel); - + ///Read header. Subclasses must override. Probably should save the info somewhere. - ///Ideally called once per decoding of a file. This complicates the task because - virtual bool ReadHeader(); + ///Ideally called once per decoding of a file. This complicates the task because + virtual bool ReadHeader(); ///FLAC specific file (inherited from FLAC::Decoder::File) ODFLACFile* GetFlacFile(); diff --git a/src/ondemand/ODDecodeTask.cpp b/src/ondemand/ODDecodeTask.cpp index 81fcd0a75..3761d4ebf 100644 --- a/src/ondemand/ODDecodeTask.cpp +++ b/src/ondemand/ODDecodeTask.cpp @@ -26,9 +26,9 @@ ODDecodeTask::ODDecodeTask() mMaxBlockFiles = 0; mComputedBlockFiles = 0; } - - -///Computes and writes the data for one BlockFile if it still has a refcount. + + +///Computes and writes the data for one BlockFile if it still has a refcount. void ODDecodeTask::DoSomeInternal() { if(mBlockFiles.size()<=0) @@ -38,20 +38,20 @@ void ODDecodeTask::DoSomeInternal() mPercentCompleteMutex.Unlock(); return; } - + ODDecodeBlockFile* bf; ODFileDecoder* decoder; sampleCount blockStartSample = 0; sampleCount blockEndSample = 0; bool success =false; - + for(size_t i=0; i < mWaveTracks.size() && mBlockFiles.size();i++) { bf = mBlockFiles[0]; - + int ret = 1; - - //first check to see if the ref count is at least 2. It should have one + + //first check to see if the ref count is at least 2. It should have one //from when we added it to this instance's mBlockFiles array, and one from //the Wavetrack/sequence. If it doesn't it has been deleted and we should forget it. if(bf->RefCount()>=2) @@ -67,7 +67,7 @@ void ODDecodeTask::DoSomeInternal() bf->SetODFileDecoder(decoder); ret = bf->DoWriteBlockFile(); bf->UnlockRead(); - + if(ret >= 0) { success = true; blockStartSample = bf->GetStart(); @@ -81,13 +81,13 @@ void ODDecodeTask::DoSomeInternal() //because now there is less work to do. mMaxBlockFiles--; } - + //Release the refcount we placed on it if we are successful if(ret >= 0 ) { bf->Deref(); //take it out of the array - we are done with it. mBlockFiles.erase(mBlockFiles.begin()); - + //upddate the gui for all associated blocks. It doesn't matter that we're hitting more wavetracks then we should //because this loop runs a number of times equal to the number of tracks, they probably are getting processed in //the next iteration at the same sample window. @@ -99,8 +99,8 @@ void ODDecodeTask::DoSomeInternal() } mWaveTrackMutex.Unlock(); } - } - + } + //update percentage complete. CalculatePercentComplete(); } @@ -112,7 +112,7 @@ void ODDecodeTask::CalculatePercentComplete() mPercentCompleteMutex.Unlock(); } -bool ODDecodeTask::SeekingAllowed() +bool ODDecodeTask::SeekingAllowed() { for (unsigned int i = 0; i < mDecoders.size(); i++) { if(!mDecoders[i]->SeekingAllowed()) @@ -126,9 +126,9 @@ void ODDecodeTask::Update() { std::vector tempBlocks; - + mWaveTrackMutex.Lock(); - + for(size_t j=0;jGetClipIterator(); - + while(node) { clip = node->GetData(); seq = clip->GetSequence(); //TODO:this lock is way to big since the whole file is one sequence. find a way to break it down. seq->LockDeleteUpdateMutex(); - + //See Sequence::Delete() for why need this for now.. blocks = clip->GetSequenceBlockArray(); int i; int insertCursor; - + insertCursor =0;//OD TODO:see if this works, removed from inner loop (bfore was n*n) for(i=0; i<(int)blocks->GetCount(); i++) { @@ -160,24 +160,24 @@ void ODDecodeTask::Update() blocks->Item(i)->f->Ref(); ((ODDecodeBlockFile*)blocks->Item(i)->f)->SetStart(blocks->Item(i)->start); ((ODDecodeBlockFile*)blocks->Item(i)->f)->SetClipOffset((sampleCount)(clip->GetStartTime()*clip->GetRate())); - + //these will always be linear within a sequence-lets take advantage of this by keeping a cursor. - while(insertCursor<(int)tempBlocks.size()&& - (sampleCount)(tempBlocks[insertCursor]->GetStart()+tempBlocks[insertCursor]->GetClipOffset()) < + while(insertCursor<(int)tempBlocks.size()&& + (sampleCount)(tempBlocks[insertCursor]->GetStart()+tempBlocks[insertCursor]->GetClipOffset()) < (sampleCount)(((ODDecodeBlockFile*)blocks->Item(i)->f)->GetStart()+((ODDecodeBlockFile*)blocks->Item(i)->f)->GetClipOffset())) insertCursor++; - + tempBlocks.insert(tempBlocks.begin()+insertCursor++,(ODDecodeBlockFile*)blocks->Item(i)->f); } - } - + } + seq->UnlockDeleteUpdateMutex(); node = node->GetNext(); } } } mWaveTrackMutex.Unlock(); - + //get the new order. OrderBlockFiles(tempBlocks); } @@ -194,23 +194,23 @@ void ODDecodeTask::OrderBlockFiles(std::vector &unorderedBlo //TODO:order the blockfiles into our queue in a fancy convenient way. (this could be user-prefs) //for now just put them in linear. We start the order from the first block that includes the ondemand sample //(which the user sets by clicking.) note that this code is pretty hacky - it assumes that the array is sorted in time. - + //find the startpoint - sampleCount processStartSample = GetDemandSample(); + sampleCount processStartSample = GetDemandSample(); for(int i= ((int)unorderedBlocks.size())-1;i>= 0;i--) { //check to see if the refcount is at least two before we add it to the list. - //There should be one Ref() from the one added by this ODTask, and one from the track. + //There should be one Ref() from the one added by this ODTask, and one from the track. //If there isn't, then the block was deleted for some reason and we should ignore it. if(unorderedBlocks[i]->RefCount()>=2) { //test if the blockfiles are near the task cursor. we use the last mBlockFiles[0] as our point of reference - //and add ones that are closer. + //and add ones that are closer. //since the order is linear right to left, this will add blocks so that the ones on the right side of the target //are processed first, with the ones closer being processed earlier. Then the ones on the left side get processed. - if(mBlockFiles.size() && - unorderedBlocks[i]->GetGlobalEnd() >= processStartSample && - ( mBlockFiles[0]->GetGlobalEnd() < processStartSample || + if(mBlockFiles.size() && + unorderedBlocks[i]->GetGlobalEnd() >= processStartSample && + ( mBlockFiles[0]->GetGlobalEnd() < processStartSample || unorderedBlocks[i]->GetGlobalStart() <= mBlockFiles[0]->GetGlobalStart()) ) { //insert at the front of the list if we get blockfiles that are after the demand sample @@ -230,11 +230,11 @@ void ODDecodeTask::OrderBlockFiles(std::vector &unorderedBlo unorderedBlocks[i]->Deref(); } } - -} + +} + - ///changes the tasks associated with this Waveform to process the task from a different point in the track ///this is overridden from ODTask because certain classes don't allow users to seek sometimes, or not at all. void ODDecodeTask::DemandTrackUpdate(WaveTrack* track, double seconds) @@ -266,7 +266,7 @@ ODFileDecoder* ODDecodeTask::GetOrCreateMatchingFileDecoder(ODDecodeBlockFile* b break; } } - + //otherwise, create and add one, and return it. if(!ret) { @@ -297,7 +297,7 @@ bool ODFileDecoder::IsInitialized() bool ret; mInitedLock.Lock(); ret = mInited; - mInitedLock.Unlock(); + mInitedLock.Unlock(); return ret; } @@ -306,6 +306,6 @@ void ODFileDecoder::MarkInitialized() { mInitedLock.Lock(); mInited=true; - mInitedLock.Unlock(); + mInitedLock.Unlock(); } diff --git a/src/ondemand/ODDecodeTask.h b/src/ondemand/ODDecodeTask.h index 6b784c4e5..33b410e92 100644 --- a/src/ondemand/ODDecodeTask.h +++ b/src/ondemand/ODDecodeTask.h @@ -15,7 +15,7 @@ This is an abstract class that subclasses will have to derive the types from. For any type there should only be one ODDecodeTask associated with -a given track. +a given track. There could be the ODBlockFiles of several FLACs in one track (after copy and pasting), so things aren't as simple as they seem - the implementation needs to be robust enough to allow all the user changes such as copy/paste, delete, and so on. @@ -42,26 +42,26 @@ class ODDecodeTask:public ODTask public: ODDecodeTask(); virtual ~ODDecodeTask(){}; - + virtual ODTask* Clone()=0; - + virtual bool SeekingAllowed(); - + ///changes the tasks associated with this Waveform to process the task from a different point in the track ///this is overridden from ODTask because certain classes don't allow users to seek sometimes, or not at all. virtual void DemandTrackUpdate(WaveTrack* track, double seconds); - + ///Return the task name virtual const char* GetTaskName(){return "ODDecodeTask";} - + virtual const wxChar* GetTip(){return _("Decoding Waveform");} - + ///Subclasses should override to return respective type. virtual unsigned int GetODType(){return eODNone;} - + ///Creates an ODFileDecoder that decodes a file of filetype the subclass handles. virtual ODFileDecoder* CreateFileDecoder(const wxString & fileName)=0; - + ///there could be the ODBlockFiles of several FLACs in one track (after copy and pasting) ///so we keep a list of decoders that keep track of the file names, etc, and check the blocks against them. ///Blocks that have IsDataAvailable()==false are blockfiles to be decoded. if BlockFile::GetDecodeType()==ODDecodeTask::GetODType() then @@ -69,27 +69,27 @@ class ODDecodeTask:public ODTask ///be called from the decoding thread. virtual ODFileDecoder* GetOrCreateMatchingFileDecoder(ODDecodeBlockFile* blockFile); virtual int GetNumFileDecoders(); - - + + protected: ///recalculates the percentage complete. virtual void CalculatePercentComplete(); - - ///Computes and writes the data for one BlockFile if it still has a refcount. + + ///Computes and writes the data for one BlockFile if it still has a refcount. virtual void DoSomeInternal(); - + ///Readjusts the blockfile order in the default manner. If we have had an ODRequest ///Then it updates in the OD manner. virtual void Update(); - + ///Orders the input as either On-Demand or default layered order. void OrderBlockFiles(std::vector &unorderedBlocks); - + std::vector mBlockFiles; std::vector mDecoders; - + int mMaxBlockFiles; int mComputedBlockFiles; diff --git a/src/ondemand/ODTask.cpp b/src/ondemand/ODTask.cpp index 6c8017a7b..c15b73d0e 100644 --- a/src/ondemand/ODTask.cpp +++ b/src/ondemand/ODTask.cpp @@ -23,7 +23,7 @@ in a background thread. #include "../WaveTrack.h" #include "../Project.h" //temporarilly commented out till it is added to all projects -//#include "../Profiler.h" +//#include "../Profiler.h" DEFINE_EVENT_TYPE(EVT_ODTASK_COMPLETE) @@ -38,30 +38,30 @@ ODTask::ODTask() mTerminate = false; mNeedsODUpdate=false; mIsRunning = false; - + mTaskNumber=sTaskNumber++; - + mDemandSample=0; } //outside code must ensure this task is not scheduled again. void ODTask::TerminateAndBlock() -{ +{ //one mutex pair for the value of mTerminate mTerminateMutex.Lock(); mTerminate=true; //release all data the derived class may have allocated mTerminateMutex.Unlock(); - + //and one mutex pair for the exit of the function mBlockUntilTerminateMutex.Lock(); //TODO lock mTerminate? mBlockUntilTerminateMutex.Unlock(); - - //wait till we are out of doSome() to terminate. + + //wait till we are out of doSome() to terminate. Terminate(); } - + ///Do a modular part of the task. For example, if the task is to load the entire file, load one BlockFile. ///Relies on DoSomeInternal(), which is the subclasses must implement. ///@param amountWork the percent amount of the total job to do. 1.0 represents the entire job. the default of 0.0 @@ -74,11 +74,11 @@ void ODTask::DoSome(float amountWork) // printf("%s %i subtask starting on new thread with priority\n", GetTaskName(),GetTaskNumber()); mDoingTask=mTaskStarted=true; - + float workUntil = amountWork+PercentComplete(); - - - + + + //check periodically to see if we should exit. mTerminateMutex.Lock(); if(mTerminate) @@ -87,45 +87,45 @@ void ODTask::DoSome(float amountWork) SetIsRunning(false); mBlockUntilTerminateMutex.Unlock(); return; - } + } mTerminateMutex.Unlock(); - Update(); - - + Update(); + + if(UsesCustomWorkUntilPercentage()) workUntil = ComputeNextWorkUntilPercentageComplete(); - + if(workUntilYield(); //release within the loop so we can cut the number of iterations short - + DoSomeInternal(); //keep the terminate mutex on so we don't remo - mTerminateMutex.Unlock(); + mTerminateMutex.Unlock(); //check to see if ondemand has been called if(GetNeedsODUpdate() && PercentComplete() < 1.0) ODUpdate(); - - + + //But add the mutex lock back before we check the value again. mTerminateMutex.Lock(); } mTerminateMutex.Unlock(); mDoingTask=false; - + mTerminateMutex.Lock(); //if it is not done, put it back onto the ODManager queue. if(PercentComplete() < 1.0&& !mTerminate) { ODManager::Instance()->AddTask(this); - + //we did a bit of progress - we should allow a resave. AudacityProject::AllProjectsDeleteLock(); for(unsigned i=0; iAddPendingEvent( event ); //mark the changes so that the project can be resaved. gAudacityProjects[i]->GetUndoManager()->SetODChangesFlag(); @@ -179,10 +179,10 @@ bool ODTask::IsTaskAssociatedWithProject(AudacityProject* proj) TrackListIterator iter1(tracks); Track *tr = iter1.First(); - while (tr) + while (tr) { //go over all tracks in the project - if (tr->GetKind() == Track::Wave) + if (tr->GetKind() == Track::Wave) { //look inside our task's track list for one that matches this projects one. mWaveTrackMutex.Lock(); @@ -199,7 +199,7 @@ bool ODTask::IsTaskAssociatedWithProject(AudacityProject* proj) } tr = iter1.Next(); } - + return false; } @@ -216,7 +216,7 @@ void ODTask::SetIsRunning(bool value) mIsRunning=value; mIsRunningMutex.Unlock(); } - + bool ODTask::IsRunning() { bool ret; @@ -224,8 +224,8 @@ bool ODTask::IsRunning() ret= mIsRunning; mIsRunningMutex.Unlock(); return ret; -} - +} + sampleCount ODTask::GetDemandSample() { sampleCount retval; @@ -234,16 +234,16 @@ sampleCount ODTask::GetDemandSample() mDemandSampleMutex.Unlock(); return retval; } - + void ODTask::SetDemandSample(sampleCount sample) { - + mDemandSampleMutex.Lock(); mDemandSample=sample; mDemandSampleMutex.Unlock(); } - - + + ///return the amount of the task that has been completed. 0.0 to 1.0 float ODTask::PercentComplete() { @@ -252,8 +252,8 @@ float ODTask::PercentComplete() mPercentCompleteMutex.Unlock(); return ret; } - -///return + +///return bool ODTask::IsComplete() { return PercentComplete() >= 1.0 && !IsRunning(); @@ -319,7 +319,7 @@ void ODTask::RecalculatePercentComplete() CalculatePercentComplete(); } } - + ///changes the tasks associated with this Waveform to process the task from a different point in the track ///@param track the track to update ///@param seconds the point in the track from which the tasks associated with track should begin processing from. @@ -330,18 +330,18 @@ void ODTask::DemandTrackUpdate(WaveTrack* track, double seconds) for(size_t i=0;iGetRate()); demandSampleChanged = newDemandSample != GetDemandSample(); SetDemandSample(newDemandSample); break; } - } + } mWaveTrackMutex.Unlock(); - + if(demandSampleChanged) SetNeedsODUpdate(); - + } @@ -366,6 +366,6 @@ void ODTask::ReplaceWaveTrack(WaveTrack* oldTrack,WaveTrack* newTrack) { mWaveTracks[i] = newTrack; } - } + } mWaveTrackMutex.Unlock(); } diff --git a/src/ondemand/ODTask.h b/src/ondemand/ODTask.h index ff1bf6311..bfa87709f 100644 --- a/src/ondemand/ODTask.h +++ b/src/ondemand/ODTask.h @@ -50,73 +50,73 @@ class ODTask /// Constructs an ODTask ODTask(); - + virtual ~ODTask(){}; - + //clones everything except information about the tracks. virtual ODTask* Clone()=0; - + ///Subclasses should override to return respective type. virtual unsigned int GetODType(){return eODNone;} - + ///Do a modular part of the task. For example, if the task is to load the entire file, load one BlockFile. ///Relies on DoSomeInternal(), which is the subclasses must implement. ///@param amountWork the percent amount of the total job to do. 1.0 represents the entire job. the default of 0.0 /// will do the smallest unit of work possible void DoSome(float amountWork=0.0); - + ///Call DoSome until PercentComplete >= 1.0 void DoAll(); - + virtual float PercentComplete(); - + virtual bool UsesCustomWorkUntilPercentage(){return false;} virtual float ComputeNextWorkUntilPercentageComplete(){return 1.0;} - + ///returns whether or not this task and another task can merge together, as when we make two mono tracks stereo. ///for Loading/Summarizing, this is not an issue because the entire track is processed ///Effects that affect portions of a track will need to check this. - virtual bool CanMergeWith(ODTask* otherTask){return strcmp(GetTaskName(),otherTask->GetTaskName())==0;} - + virtual bool CanMergeWith(ODTask* otherTask){return strcmp(GetTaskName(),otherTask->GetTaskName())==0;} + virtual void StopUsingWaveTrack(WaveTrack* track); - + ///Replaces all instances to a wavetrack with a new one, effectively transferring the task. ///ODTask has no wavetrack, so it does nothing. But subclasses that do should override this. virtual void ReplaceWaveTrack(WaveTrack* oldTrack,WaveTrack* newTrack); - + ///Adds a WaveTrack to do the task for void AddWaveTrack(WaveTrack* track); virtual int GetNumWaveTracks(); virtual WaveTrack* GetWaveTrack(int i); - + ///changes the tasks associated with this Waveform to process the task from a different point in the track virtual void DemandTrackUpdate(WaveTrack* track, double seconds); - + bool IsComplete(); - + void TerminateAndBlock(); ///releases memory that the ODTask owns. Subclasses should override. virtual void Terminate(){} - + virtual const char* GetTaskName(){return "ODTask";} - + virtual sampleCount GetDemandSample(); - + virtual void SetDemandSample(sampleCount sample); - + ///does an od update and then recalculates the data. virtual void RecalculatePercentComplete(); - + ///returns the number of tasks created before this instance. int GetTaskNumber(){return mTaskNumber;} - + void SetNeedsODUpdate(); bool GetNeedsODUpdate(); void ResetNeedsODUpdate(); - + virtual const wxChar* GetTip()=0; - + ///returns true if the task is associated with the project. virtual bool IsTaskAssociatedWithProject(AudacityProject* proj); @@ -124,26 +124,26 @@ class ODTask protected: - + ///calculates the percentage complete from existing data. - virtual void CalculatePercentComplete() = 0; - - ///pure virtual function that does some part of the task this object represents. - ///this function is meant to be called repeatedly until the IsComplete is true. + virtual void CalculatePercentComplete() = 0; + + ///pure virtual function that does some part of the task this object represents. + ///this function is meant to be called repeatedly until the IsComplete is true. ///Does the smallest unit of work for this task. virtual void DoSomeInternal() = 0; - + ///virtual method called before DoSomeInternal is used from DoSome. virtual void Update(){} - + ///virtual method called in DoSome everytime the user has demanded some OD function so that the ///ODTask can readjust its computation order. By default just calls Update(), but subclasses with ///special needs can override this virtual void ODUpdate(); - + void SetIsRunning(bool value); - + int mTaskNumber; volatile float mPercentComplete; @@ -154,23 +154,23 @@ class ODTask ODLock mTerminateMutex; //for a function not a member var. ODLock mBlockUntilTerminateMutex; - + std::vector mWaveTracks; ODLock mWaveTrackMutex; - + volatile sampleCount mDemandSample; ODLock mDemandSampleMutex; - + volatile bool mIsRunning; ODLock mIsRunningMutex; - - + + private: - + volatile bool mNeedsODUpdate; ODLock mNeedsODUpdateMutex; - - + + }; diff --git a/src/ondemand/ODTaskThread.cpp b/src/ondemand/ODTaskThread.cpp index c85942bf1..fd92a40ae 100644 --- a/src/ondemand/ODTaskThread.cpp +++ b/src/ondemand/ODTaskThread.cpp @@ -3,7 +3,7 @@ Audacity: A Digital Audio Editor ODTaskThread.cpp - + Created by Michael Chinen (mchinen) on 6/8/08 Audacity(R) is copyright (c) 1999-2008 Audacity Team. License: GPL v2. See License.txt. @@ -28,16 +28,16 @@ ODTaskThread::ODTaskThread(ODTask* task) { mTask=task; #ifdef __WXMAC__ - mDestroy = false; + mDestroy = false; mThread = NULL; #endif - -} + +} #ifdef __WXMAC__ - + void ODTaskThread::Entry() -#else +#else void *ODTaskThread::Entry() #endif @@ -46,11 +46,11 @@ void *ODTaskThread::Entry() //wxThread::This()->SetPriority( 40); //Do at least 5 percent of the task mTask->DoSome(0.05f); - + //release the thread count so that the ODManager knows how many active threads are alive. ODManager::Instance()->DecrementCurrentThreads(); - - + + #ifndef __WXMAC__ return NULL; #endif @@ -65,7 +65,7 @@ ODCondition::ODCondition(ODLock *lock) } ODCondition::~ODCondition() { - pthread_cond_destroy (condition); + pthread_cond_destroy (condition); free(condition); } @@ -73,7 +73,7 @@ void ODCondition::Signal() { pthread_cond_signal(condition); } - + void ODCondition::Broadcast() { pthread_cond_broadcast(condition); @@ -82,7 +82,6 @@ void ODCondition::Wait() { pthread_cond_wait(condition,m_lock->mutex); } - + #endif - \ No newline at end of file diff --git a/src/ondemand/ODTaskThread.h b/src/ondemand/ODTaskThread.h index 580fe3350..4ca533162 100644 --- a/src/ondemand/ODTaskThread.h +++ b/src/ondemand/ODTaskThread.h @@ -3,7 +3,7 @@ Audacity: A Digital Audio Editor ODTaskThread.h - + Created by Michael Chinen (mchinen) on 6/8/08 Audacity(R) is copyright (c) 1999-2008 Audacity Team. License: GPL v2. See License.txt. @@ -64,7 +64,7 @@ class ODTaskThread { void Run() { pthread_create(&mThread, NULL, callback, this); } - + ///Specifies the priority the thread will run at. Currently doesn't work. ///@param priority value from 0 (min priority) to 100 (max priority) void SetPriority(int priority) @@ -86,7 +86,7 @@ class ODLock { mutex = (pthread_mutex_t *) malloc (sizeof (pthread_mutex_t)); pthread_mutex_init (mutex, NULL); } - + void Lock() { pthread_mutex_lock (mutex); @@ -96,19 +96,19 @@ class ODLock { { pthread_mutex_unlock (mutex); } - + virtual ~ODLock() { - pthread_mutex_destroy (mutex); + pthread_mutex_destroy (mutex); free(mutex); } - + private: friend class ODCondition; //needs friendship for wait() pthread_mutex_t *mutex ; }; -class ODCondition +class ODCondition { public: ODCondition(ODLock *lock); @@ -116,7 +116,7 @@ public: void Signal(); void Broadcast(); void Wait(); - + protected: pthread_cond_t *condition; ODLock* m_lock; @@ -160,7 +160,7 @@ public: //void Signal(); //void Broadcast(); //void Wait(); - + protected: }; diff --git a/src/ondemand/ODWaveTrackTaskQueue.cpp b/src/ondemand/ODWaveTrackTaskQueue.cpp index a548c3242..51a285a60 100644 --- a/src/ondemand/ODWaveTrackTaskQueue.cpp +++ b/src/ondemand/ODWaveTrackTaskQueue.cpp @@ -23,7 +23,7 @@ tasks associated with a WaveTrack. ODWaveTrackTaskQueue::ODWaveTrackTaskQueue() { } - + ODWaveTrackTaskQueue::~ODWaveTrackTaskQueue() { //we need to delete all ODTasks. We will have to block or wait until block for the active ones. @@ -34,7 +34,7 @@ ODWaveTrackTaskQueue::~ODWaveTrackTaskQueue() ODManager::Instance()->RemoveTaskIfInQueue(mTasks[i]); delete mTasks[i]; } - + } ///returns whether or not this queue's task list and another's can merge together, as when we make two mono tracks stereo. @@ -43,7 +43,7 @@ bool ODWaveTrackTaskQueue::CanMergeWith(ODWaveTrackTaskQueue* otherQueue) //have to be very careful when dealing with two lists that need to be locked. if(GetNumTasks()!=otherQueue->GetNumTasks()) return false; - + mTasksMutex.Lock(); for(unsigned int i=0;iGetNumWaveTracks();i++) { //task->GetWaveTrack(i) may return NULL, but we handle it by checking before using. - //The other worry that the WaveTrack returned and was deleted in the meantime is also - //handled since mQueuesMutex is locked one up in the stack from here, + //The other worry that the WaveTrack returned and was deleted in the meantime is also + //handled since mQueuesMutex is locked one up in the stack from here, //and WaveTrack deletion is bound to that. mTracks.push_back(task->GetWaveTrack(i)); - } - + } + mTracksMutex.Unlock(); } @@ -127,22 +127,22 @@ void ODWaveTrackTaskQueue::RemoveWaveTrack(WaveTrack* track) { if(track) { - + mTasksMutex.Lock(); for(unsigned int i=0;iStopUsingWaveTrack(track); mTasksMutex.Unlock(); - + mTracksMutex.Lock(); for(unsigned int i=0;iAddWaveTrack(track); //AddNewTask requires us to relinquish this lock. However, it is safe because ODManager::MakeWaveTrackIndependent //has already locked the m_queuesMutex. - mTasksMutex.Unlock(); + mTasksMutex.Unlock(); //AddNewTask locks the m_queuesMutex which is already locked by ODManager::MakeWaveTrackIndependent, //so we pass a boolean flag telling it not to lock again. ODManager::Instance()->AddNewTask(task,false); @@ -196,7 +196,7 @@ void ODWaveTrackTaskQueue::DemandTrackUpdate(WaveTrack* track, double seconds) { mTasks[i]->DemandTrackUpdate(track,seconds); } - + mTracksMutex.Unlock(); } } @@ -211,7 +211,7 @@ void ODWaveTrackTaskQueue::ReplaceWaveTrack(WaveTrack* oldTrack, WaveTrack* newT for(unsigned int i=0;iReplaceWaveTrack(oldTrack,newTrack); mTasksMutex.Unlock(); - + mTracksMutex.Lock(); for(unsigned int i=0;iRecalculatePercentComplete(); - bool ret; + bool ret; ret = mTasks[0]->IsComplete(); mTasksMutex.Unlock(); - + return ret; } mTasksMutex.Unlock(); return false; } - + ///Removes and deletes the front task from the list. void ODWaveTrackTaskQueue::RemoveFrontTask() { @@ -310,7 +310,7 @@ void ODWaveTrackTaskQueue::RemoveFrontTask() } mTasksMutex.Unlock(); } - + ///gets the front task for immediate execution ODTask* ODWaveTrackTaskQueue::GetFrontTask() { @@ -329,13 +329,13 @@ void ODWaveTrackTaskQueue::FillTipForWaveTrack( WaveTrack * t, const wxChar ** p { if(ContainsWaveTrack(t) && GetNumTasks()) { - + // if(GetNumTasks()==1) mTipMsg.Printf(_("%s %2.0f%% complete. Click to change task focal point."), GetFrontTask()->GetTip(), GetFrontTask()->PercentComplete()*100.0 ); // else // msg.Printf(_("%s %n additional tasks remaining."), GetFrontTask()->GetTip().c_str(), GetNumTasks()); - + *ppTip = mTipMsg.c_str(); - + } } diff --git a/src/ondemand/ODWaveTrackTaskQueue.h b/src/ondemand/ODWaveTrackTaskQueue.h index c41d5e096..678215130 100644 --- a/src/ondemand/ODWaveTrackTaskQueue.h +++ b/src/ondemand/ODWaveTrackTaskQueue.h @@ -36,74 +36,74 @@ class ODWaveTrackTaskQueue /// Constructs an ODWaveTrackTaskQueue ODWaveTrackTaskQueue(); - + virtual ~ODWaveTrackTaskQueue(); - - - + + + ///Adds a track to the associated list. void AddWaveTrack(WaveTrack* track); ///Removes a track from the list. Also notifies mTasks to stop using references ///to the instance in a thread-safe manner (may block) - void RemoveWaveTrack(WaveTrack* track); - + void RemoveWaveTrack(WaveTrack* track); + ///changes the tasks associated with this Waveform to process the task from a different point in the track void DemandTrackUpdate(WaveTrack* track, double seconds); - - ///replaces all instances of a WaveTrack within this task with another. - void ReplaceWaveTrack(WaveTrack* oldTrack,WaveTrack* newTrack); - - //if the wavetrack is in this queue, and is not the only wavetrack, clones the tasks and schedules it. + + ///replaces all instances of a WaveTrack within this task with another. + void ReplaceWaveTrack(WaveTrack* oldTrack,WaveTrack* newTrack); + + //if the wavetrack is in this queue, and is not the only wavetrack, clones the tasks and schedules it. void MakeWaveTrackIndependent(WaveTrack* track); - + ///returns whether or not this queue's task list and another's can merge together, as when we make two mono tracks stereo. - virtual bool CanMergeWith(ODWaveTrackTaskQueue* otherQueue); + virtual bool CanMergeWith(ODWaveTrackTaskQueue* otherQueue); void MergeWaveTrack(WaveTrack* track); - + //returns true if the agrument is in the WaveTrack list. bool ContainsWaveTrack(WaveTrack* track); - + //returns the wavetrack at position x. WaveTrack* GetWaveTrack(size_t x); - + ///returns the number of wavetracks in this queue. int GetNumWaveTracks(); - - ///Add a task to the queue. + + ///Add a task to the queue. void AddTask(ODTask* task); - + //returns true if either tracks or tasks are empty bool IsEmpty(); - + //returns true if the foremost task exists and is empty. bool IsFrontTaskComplete(); - + ///Removes and deletes the front task from the list. void RemoveFrontTask(); - + ///Schedules the front task for immediate execution ODTask* GetFrontTask(); - + ///returns the number of ODTasks in this queue int GetNumTasks(); - + ///returns a ODTask at position x ODTask* GetTask(size_t x); - + ///fills in the status bar message for a given track void FillTipForWaveTrack( WaveTrack * t, const wxChar ** ppTip ); - + protected: - + //because we need to save this around for the tool tip. wxString mTipMsg; - - + + ///the list of tracks associated with this queue. std::vector mTracks; ODLock mTracksMutex; - + ///the list of tasks associated with the tracks. This class owns these tasks. std::vector mTasks; ODLock mTasksMutex; diff --git a/src/prefs/BatchPrefs.cpp b/src/prefs/BatchPrefs.cpp index dd10dc0cc..8f7664d2c 100644 --- a/src/prefs/BatchPrefs.cpp +++ b/src/prefs/BatchPrefs.cpp @@ -45,7 +45,7 @@ void BatchPrefs::Populate( ) { //------------------------- Main section -------------------- // Now construct the GUI itself. - // Use 'eIsCreatingFromPrefs' so that the GUI is + // Use 'eIsCreatingFromPrefs' so that the GUI is // initialised with values from gPrefs. ShuttleGui S(this, eIsCreatingFromPrefs); PopulateOrExchange(S); @@ -60,7 +60,7 @@ void BatchPrefs::PopulateOrExchange( ShuttleGui & S ) S.StartStatic( _("Behaviors"),1 ); { #ifdef __WXDEBUG__ - S.TieCheckBox( _("&Don't apply effects in batch mode"), + S.TieCheckBox( _("&Don't apply effects in batch mode"), wxT("/Batch/Debug"), false); #endif } diff --git a/src/prefs/BatchPrefs.h b/src/prefs/BatchPrefs.h index 311494664..3b2936f04 100644 --- a/src/prefs/BatchPrefs.h +++ b/src/prefs/BatchPrefs.h @@ -20,7 +20,7 @@ #include "PrefsPanel.h" -class BatchPrefs : public PrefsPanel +class BatchPrefs : public PrefsPanel { public: BatchPrefs(wxWindow * parent); diff --git a/src/prefs/DevicePrefs.cpp b/src/prefs/DevicePrefs.cpp index a35f471b8..8e8e6f267 100644 --- a/src/prefs/DevicePrefs.cpp +++ b/src/prefs/DevicePrefs.cpp @@ -75,7 +75,7 @@ void DevicePrefs::Populate() //------------------------- Main section -------------------- // Now construct the GUI itself. - // Use 'eIsCreatingFromPrefs' so that the GUI is + // Use 'eIsCreatingFromPrefs' so that the GUI is // initialised with values from gPrefs. ShuttleGui S(this, eIsCreatingFromPrefs); PopulateOrExchange(S); @@ -113,7 +113,7 @@ void DevicePrefs::PopulateOrExchange(ShuttleGui & S) { S.Id(HostID); mHost = S.TieChoice(_("&Host") + wxString(wxT(":")), - wxT("/AudioIO/Host"), + wxT("/AudioIO/Host"), wxT(""), mHostNames, mHostLabels); @@ -123,7 +123,7 @@ void DevicePrefs::PopulateOrExchange(ShuttleGui & S) S.AddFixedText(wxString(Pa_GetVersionText(), wxConvLocal)); } S.EndMultiColumn(); - } + } S.EndStatic(); S.StartStatic(_("Playback")); @@ -228,7 +228,7 @@ void DevicePrefs::OnHost(wxCommandEvent & e) } } } - + /* deal with not having any devices at all */ if (mPlay->GetCount() == 0) { playnames.Add(_("No devices found")); @@ -241,7 +241,7 @@ void DevicePrefs::OnHost(wxCommandEvent & e) mRecord->SetSelection(0); } - /* what if we have no device selected? we should choose the default on + /* what if we have no device selected? we should choose the default on * this API, as defined by PortAudio. We then fall back to using 0 only if * that fails */ if (mPlay->GetCount() && mPlay->GetSelection() == wxNOT_FOUND) { @@ -298,11 +298,11 @@ void DevicePrefs::OnDevice(wxCommandEvent & WXUNUSED(event)) // Place an artifical limit on the number of channels to prevent an // outrageous number. I don't know if this is really necessary, but - // it doesn't hurt. + // it doesn't hurt. if (cnt > 256) { cnt = 256; } - + wxArrayString channelnames; // Channel counts, mono, stereo etc... diff --git a/src/prefs/DirectoriesPrefs.cpp b/src/prefs/DirectoriesPrefs.cpp index f0c4f71f3..606e3891b 100644 --- a/src/prefs/DirectoriesPrefs.cpp +++ b/src/prefs/DirectoriesPrefs.cpp @@ -65,7 +65,7 @@ void DirectoriesPrefs::Populate() { //------------------------- Main section -------------------- // Now construct the GUI itself. - // Use 'eIsCreatingFromPrefs' so that the GUI is + // Use 'eIsCreatingFromPrefs' so that the GUI is // initialised with values from gPrefs. ShuttleGui S(this, eIsCreatingFromPrefs); PopulateOrExchange(S); @@ -100,7 +100,7 @@ void DirectoriesPrefs::PopulateOrExchange(ShuttleGui & S) } S.EndStatic(); -#ifdef DEPRECATED_AUDIO_CACHE +#ifdef DEPRECATED_AUDIO_CACHE // See http://bugzilla.audacityteam.org/show_bug.cgi?id=545. S.StartStatic(_("Audio cache")); { @@ -125,9 +125,9 @@ void DirectoriesPrefs::PopulateOrExchange(ShuttleGui & S) void DirectoriesPrefs::OnChooseTempDir(wxCommandEvent & e) { - wxDirDialog dlog(this, - _("Choose a location to place the temporary directory"), - gPrefs->Read(wxT("/Directories/TempDir"), + wxDirDialog dlog(this, + _("Choose a location to place the temporary directory"), + gPrefs->Read(wxT("/Directories/TempDir"), wxGetApp().defaultTempDir)); int retval = dlog.ShowModal(); if (retval != wxID_CANCEL && dlog.GetPath() != wxT("")) { diff --git a/src/prefs/DirectoriesPrefs.h b/src/prefs/DirectoriesPrefs.h index a561c5a67..4793420ed 100644 --- a/src/prefs/DirectoriesPrefs.h +++ b/src/prefs/DirectoriesPrefs.h @@ -18,7 +18,7 @@ #include "PrefsPanel.h" -class DirectoriesPrefs:public PrefsPanel +class DirectoriesPrefs:public PrefsPanel { public: DirectoriesPrefs(wxWindow * parent); diff --git a/src/prefs/EffectsPrefs.cpp b/src/prefs/EffectsPrefs.cpp index 02a5be482..55742d40e 100644 --- a/src/prefs/EffectsPrefs.cpp +++ b/src/prefs/EffectsPrefs.cpp @@ -42,7 +42,7 @@ void EffectsPrefs::Populate() { //------------------------- Main section -------------------- // Now construct the GUI itself. - // Use 'eIsCreatingFromPrefs' so that the GUI is + // Use 'eIsCreatingFromPrefs' so that the GUI is // initialised with values from gPrefs. ShuttleGui S(this, eIsCreatingFromPrefs); PopulateOrExchange(S); @@ -99,11 +99,11 @@ void EffectsPrefs::PopulateOrExchange(ShuttleGui & S) #if USE_AUDIO_UNITS S.StartStatic(_("Audio Unit Effects")); { - S.TieCheckBox(_("Display Audio Unit effects in graphical mode"), + S.TieCheckBox(_("Display Audio Unit effects in graphical mode"), wxT("/AudioUnits/GUI"), true); #if 0 - S.TieCheckBox(_("Rescan VST effects next time Audacity is started"), + S.TieCheckBox(_("Rescan VST effects next time Audacity is started"), wxT("/VST/Rescan"), false); #endif @@ -114,10 +114,10 @@ void EffectsPrefs::PopulateOrExchange(ShuttleGui & S) #if USE_VST S.StartStatic(_("VST Effects")); { - S.TieCheckBox(_("&Display VST effects in graphical mode"), + S.TieCheckBox(_("&Display VST effects in graphical mode"), wxT("/VST/GUI"), true); - S.TieCheckBox(_("&Rescan VST effects next time Audacity is started"), + S.TieCheckBox(_("&Rescan VST effects next time Audacity is started"), wxT("/VST/Rescan"), false); } @@ -127,7 +127,7 @@ void EffectsPrefs::PopulateOrExchange(ShuttleGui & S) #ifdef EXPERIMENTAL_EQ_SSE_THREADED S.StartStatic(_("Instruction Set")); { - S.TieCheckBox(_("&Use SSE/SSE2/.../AVX"), + S.TieCheckBox(_("&Use SSE/SSE2/.../AVX"), wxT("/SSE/GUI"), true); } diff --git a/src/prefs/EffectsPrefs.h b/src/prefs/EffectsPrefs.h index 7f314d132..845e101cb 100644 --- a/src/prefs/EffectsPrefs.h +++ b/src/prefs/EffectsPrefs.h @@ -22,7 +22,7 @@ #include "PrefsPanel.h" -class EffectsPrefs:public PrefsPanel +class EffectsPrefs:public PrefsPanel { public: EffectsPrefs(wxWindow * parent); diff --git a/src/prefs/ExtImportPrefs.cpp b/src/prefs/ExtImportPrefs.cpp index f04049abe..ff1992fcc 100644 --- a/src/prefs/ExtImportPrefs.cpp +++ b/src/prefs/ExtImportPrefs.cpp @@ -42,7 +42,7 @@ enum ExtImportPrefsControls BEGIN_EVENT_TABLE(ExtImportPrefs, PrefsPanel) EVT_LIST_KEY_DOWN(EIPPluginList,ExtImportPrefs::OnPluginKeyDown) EVT_LIST_BEGIN_DRAG(EIPPluginList,ExtImportPrefs::OnPluginBeginDrag) - EVT_KEY_DOWN (ExtImportPrefs::OnRuleTableKeyDown) + EVT_KEY_DOWN (ExtImportPrefs::OnRuleTableKeyDown) EVT_GRID_CELL_LEFT_CLICK (ExtImportPrefs::OnRuleTableCellClick) EVT_GRID_EDITOR_HIDDEN (ExtImportPrefs::OnRuleTableEdit) EVT_GRID_SELECT_CELL (ExtImportPrefs::OnRuleTableSelect) @@ -78,7 +78,7 @@ void ExtImportPrefs::Populate() { //------------------------- Main section -------------------- // Now construct the GUI itself. - // Use 'eIsCreatingFromPrefs' so that the GUI is + // Use 'eIsCreatingFromPrefs' so that the GUI is // initialised with values from gPrefs. ShuttleGui S(this, eIsCreatingFromPrefs); PopulateOrExchange(S); @@ -101,7 +101,7 @@ void ExtImportPrefs::PopulateOrExchange(ShuttleGui & S) if (RuleTable == NULL) { RuleTable = new Grid(S.GetParent(),EIPRuleTable); - + RuleTable->SetColLabelSize(RuleTable->GetDefaultRowSize()); #if EXTIMPORT_MIME_SUPPORT RuleTable->CreateGrid (0, 2, wxGrid::wxGridSelectRows); @@ -124,9 +124,9 @@ void ExtImportPrefs::PopulateOrExchange(ShuttleGui & S) fillRuleTable = true; } S.AddWindow(RuleTable, wxEXPAND | wxALL); - + PluginList = S.Id(EIPPluginList).AddListControl (); - + if (fillRuleTable) { PluginList->SetSingleStyle (wxLC_REPORT, true); @@ -134,7 +134,7 @@ void ExtImportPrefs::PopulateOrExchange(ShuttleGui & S) PluginList->InsertColumn (0, _("Importer order")); PluginList->SetDropTarget (dragtarget2); - ExtImportItems *items = wxGetApp().mImporter->GetImportItems(); + ExtImportItems *items = wxGetApp().mImporter->GetImportItems(); for (unsigned int i = 0; i < items->Count(); i++) AddItemToTable (i, &(*items)[i]); if (items->Count() > 0) @@ -142,7 +142,7 @@ void ExtImportPrefs::PopulateOrExchange(ShuttleGui & S) RuleTable->SelectRow(0); RuleTable->SetGridCursor(0,0); } - } + } } S.EndHorizontalLay(); S.StartHorizontalLay (wxSHRINK, 0); @@ -170,10 +170,10 @@ void ExtImportPrefs::PopulateOrExchange(ShuttleGui & S) } bool ExtImportPrefs::Apply() -{ +{ ShuttleGui S(this, eIsSavingToPrefs); - PopulateOrExchange(S); - + PopulateOrExchange(S); + return true; } @@ -188,7 +188,7 @@ void ExtImportPrefs::OnPluginKeyDown(wxListEvent& event) if (!mFakeKeyEvent && !wxGetKeyState(WXK_CONTROL)) break; #endif - + if (DoOnPluginKeyDown (event.GetKeyCode())) event.Skip(); } @@ -245,18 +245,18 @@ bool ExtImportPrefs::DoOnPluginKeyDown (int code) wxLIST_NEXT_ALL, wxLIST_STATE_SELECTED); if (itemIndex == -1) return false; - + if (last_selected == -1) return false; ExtImportItems *items = wxGetApp().mImporter->GetImportItems(); ExtImportItem *item = &(*items)[last_selected]; - + if (code == WXK_UP && itemIndex == 0) return false; else if (code == WXK_DOWN && itemIndex == PluginList->GetItemCount() - 1) return false; - + if (code == WXK_UP) { itemIndex2 = itemIndex - 1; @@ -278,10 +278,10 @@ bool ExtImportPrefs::DoOnPluginKeyDown (int code) } if (item->divider < -1) item->divider = item->filter_objects.Count() - 1; - + return true; } - + void ExtImportPrefs::SwapRows (int row1, int row2) { @@ -319,7 +319,7 @@ void ExtImportPrefs::OnPluginBeginDrag(wxListEvent& WXUNUSED(event)) mDragFocus = NULL; switch (result) { - case wxDragCopy: + case wxDragCopy: case wxDragMove: case wxDragNone: return; @@ -400,7 +400,7 @@ void ExtImportPrefs::OnRuleTableSelectRange (wxGridRangeSelectEvent& event) void ExtImportPrefs::DoOnRuleTableSelect (int toprow) { ExtImportItems *items = wxGetApp().mImporter->GetImportItems(); - + if (toprow < 0 || toprow > (int)items->GetCount()) { return; @@ -408,7 +408,7 @@ void ExtImportPrefs::DoOnRuleTableSelect (int toprow) ExtImportItem *item = &(*items)[toprow]; PluginList->DeleteAllItems(); - + int fcount; fcount = item->filters.Count(); int shift = 0; @@ -469,11 +469,11 @@ void ExtImportPrefs::OnRuleTableEdit (wxGridEvent& event) case 1: item->mime_types.Clear(); break; - } - + } + for (size_t i = 0; i < vals.Count(); i++) { - + wxString trimmed = vals[i]; trimmed.Trim().Trim(false); if (trimmed.Cmp(vals[i]) != 0) @@ -505,7 +505,7 @@ Audacity to trim spaces for you?" case 1: item->mime_types.Add (trimmed); break; - } + } } if (fixSpaces == wxYES) { @@ -543,7 +543,7 @@ void ExtImportPrefs::AddItemToTable (int index, ExtImportItem *item) mime_types.Append (item->mime_types[i]); } } - + RuleTable->InsertRows (index, 1); RuleTable->SetCellValue (index, 0, extensions); #if EXTIMPORT_MIME_SUPPORT @@ -569,12 +569,12 @@ void ExtImportPrefs::OnDelRule(wxCommandEvent& WXUNUSED(event)) if (last_selected < 0) return; ExtImportItems *items = wxGetApp().mImporter->GetImportItems(); - + int msgres = wxMessageBox (_("Do you really want to delete selected rule?"), _("Rule deletion confirmation"), wxYES_NO, RuleTable); if (msgres == wxNO || msgres != wxYES) return; - + RuleTable->DeleteRows (last_selected); items->RemoveAt (last_selected); RuleTable->AutoSizeColumns (); @@ -623,7 +623,7 @@ void ExtImportPrefs::OnRuleTableCellClick (wxGridEvent& event) int row = event.GetRow(); RuleTable->SelectRow (row, false); RuleTable->SetGridCursor (row, 0); - + wxDropSource dragSource(this); dragtext1->SetText(wxT("")); dragSource.SetData(*dragtext1); @@ -639,7 +639,7 @@ void ExtImportPrefs::OnRuleTableCellClick (wxGridEvent& event) break; default: /* do nothing */ break; } - + event.Skip(); } @@ -710,7 +710,7 @@ bool ExtImportPrefsDropTarget::OnDrop(wxCoord x, wxCoord y) if (item < 0) return false; } - + return true; } @@ -734,8 +734,8 @@ wxDragResult ExtImportPrefsDropTarget::OnDragOver(wxCoord x, wxCoord y, RuleTable->GetColLabelSize ()); if (row == wxNOT_FOUND) return wxDragNone; - - + + int cRow = RuleTable->GetGridCursorRow (); if (row != cRow) { @@ -754,13 +754,13 @@ wxDragResult ExtImportPrefsDropTarget::OnDragOver(wxCoord x, wxCoord y, #endif if (item < 0) return wxDragNone; - + long selected = -1; selected = PluginList->GetNextItem(selected, wxLIST_NEXT_ALL, wxLIST_STATE_SELECTED); if (selected == -1) return wxDragNone; - + if (item != selected) { mPrefs->SwapPluginRows(selected, item); diff --git a/src/prefs/ExtImportPrefs.h b/src/prefs/ExtImportPrefs.h index af2d8e47d..f859cc3c0 100644 --- a/src/prefs/ExtImportPrefs.h +++ b/src/prefs/ExtImportPrefs.h @@ -64,27 +64,27 @@ class ExtImportPrefs:public PrefsPanel void OnFilterMoveDown(wxCommandEvent& event); void OnNavKey (wxNavigationKeyEvent& event); - + void SwapRows (int row1, int row2); void SwapPluginRows (int row1, int row2); - + Grid *GetRuleTable() { return RuleTable; } wxListCtrl *GetPluginList() { return PluginList; } - + wxWindow *GetDragFocus() { return mDragFocus; } - + private: - + Grid *RuleTable; wxListCtrl *PluginList; - + wxButton *AddRule; wxButton *DelRule; wxButton *MoveRuleUp; wxButton *MoveRuleDown; wxButton *MoveFilterUp; wxButton *MoveFilterDown; - + wxTextDataObject *dragtext1; wxTextDataObject *dragtext2; ExtImportPrefsDropTarget *dragtarget1; @@ -94,9 +94,9 @@ class ExtImportPrefs:public PrefsPanel wxWindow *mDragFocus; bool mFakeKeyEvent; bool mStopRecursiveSelection; - + int last_selected; - + void FakeOnPluginKeyDown (int keycode); void DoOnRuleTableKeyDown (int keycode); bool DoOnPluginKeyDown (int code); diff --git a/src/prefs/GUIPrefs.cpp b/src/prefs/GUIPrefs.cpp index 10a7b9111..e7871cba8 100644 --- a/src/prefs/GUIPrefs.cpp +++ b/src/prefs/GUIPrefs.cpp @@ -71,7 +71,7 @@ void GUIPrefs::Populate() //------------------------- Main section -------------------- // Now construct the GUI itself. - // Use 'eIsCreatingFromPrefs' so that the GUI is + // Use 'eIsCreatingFromPrefs' so that the GUI is // initialised with values from gPrefs. ShuttleGui S(this, eIsCreatingFromPrefs); PopulateOrExchange(S); diff --git a/src/prefs/GUIPrefs.h b/src/prefs/GUIPrefs.h index 1c50dbe34..0fe055f67 100644 --- a/src/prefs/GUIPrefs.h +++ b/src/prefs/GUIPrefs.h @@ -22,7 +22,7 @@ #include "PrefsPanel.h" -class GUIPrefs:public PrefsPanel +class GUIPrefs:public PrefsPanel { public: GUIPrefs(wxWindow * parent); diff --git a/src/prefs/ImportExportPrefs.cpp b/src/prefs/ImportExportPrefs.cpp index a25194cf8..f6e9538f2 100644 --- a/src/prefs/ImportExportPrefs.cpp +++ b/src/prefs/ImportExportPrefs.cpp @@ -39,7 +39,7 @@ void ImportExportPrefs::Populate() { //------------------------- Main section -------------------- // Now construct the GUI itself. - // Use 'eIsCreatingFromPrefs' so that the GUI is + // Use 'eIsCreatingFromPrefs' so that the GUI is // initialised with values from gPrefs. ShuttleGui S(this, eIsCreatingFromPrefs); PopulateOrExchange(S); @@ -61,7 +61,7 @@ void ImportExportPrefs::PopulateOrExchange(ShuttleGui & S) } S.EndRadioButtonGroup(); - S.TieCheckBox(_("&Normalize all tracks in project"), + S.TieCheckBox(_("&Normalize all tracks in project"), wxT("/AudioFiles/NormalizeOnLoad"), false); } @@ -81,8 +81,8 @@ void ImportExportPrefs::PopulateOrExchange(ShuttleGui & S) S.TieCheckBox(_("S&how Metadata Editor prior to export step"), wxT("/AudioFiles/ShowId3Dialog"), true); - // This documentation is unlikely to help somebody who cannot figure it out by discovering the Options button in the dialog. - // It's only clutter in this Prefs tab, so removed. + // This documentation is unlikely to help somebody who cannot figure it out by discovering the Options button in the dialog. + // It's only clutter in this Prefs tab, so removed. // S.AddFixedText(_("Note: Export quality options can be chosen by clicking the Options\nbutton in the Export dialog.")); } S.EndStatic(); @@ -103,9 +103,9 @@ void ImportExportPrefs::PopulateOrExchange(ShuttleGui & S) } bool ImportExportPrefs::Apply() -{ +{ ShuttleGui S(this, eIsSavingToPrefs); - PopulateOrExchange(S); - + PopulateOrExchange(S); + return true; } diff --git a/src/prefs/ImportExportPrefs.h b/src/prefs/ImportExportPrefs.h index 7b7c52398..9c67ff1b2 100644 --- a/src/prefs/ImportExportPrefs.h +++ b/src/prefs/ImportExportPrefs.h @@ -27,7 +27,7 @@ class ImportExportPrefs:public PrefsPanel ImportExportPrefs(wxWindow * parent); ~ImportExportPrefs(); virtual bool Apply(); - + private: void Populate(); void PopulateOrExchange(ShuttleGui & S); diff --git a/src/prefs/KeyConfigPrefs.cpp b/src/prefs/KeyConfigPrefs.cpp index c3413baa1..fda1d177b 100644 --- a/src/prefs/KeyConfigPrefs.cpp +++ b/src/prefs/KeyConfigPrefs.cpp @@ -14,7 +14,7 @@ \brief A PrefsPanel for keybindings. The code for displaying keybindings is similar to code in MousePrefs. -It would be nice to create a new 'Bindings' class which both +It would be nice to create a new 'Bindings' class which both KeyConfigPrefs and MousePrefs use. *//*********************************************************************/ @@ -153,7 +153,7 @@ void KeyConfigPrefs::Populate() } } -/// Normally in classes derived from PrefsPanel this function +/// Normally in classes derived from PrefsPanel this function /// is used both to populate the panel and to exchange data with it. /// With KeyConfigPrefs all the exchanges are handled specially, /// so this is only used in populating the panel. @@ -198,7 +198,7 @@ void KeyConfigPrefs::PopulateOrExchange(ShuttleGui & S) FilterID, wxT(""), wxDefaultPosition, -#if defined(__WXMAC__) +#if defined(__WXMAC__) wxSize(300, -1), #else wxSize(210, -1), @@ -239,7 +239,7 @@ void KeyConfigPrefs::PopulateOrExchange(ShuttleGui & S) CurrentComboID, wxT(""), wxDefaultPosition, -#if defined(__WXMAC__) +#if defined(__WXMAC__) wxSize(300, -1), #else wxSize(210, -1), @@ -301,10 +301,10 @@ void KeyConfigPrefs::RefreshBindings() mKeys.Clear(); mDefaultKeys.Clear(); mManager->GetAllCommandData( - mNames, - mKeys, + mNames, + mKeys, mDefaultKeys, - Labels, + Labels, Categories, Prefixes, true); // True to include effects (list items), false otherwise. @@ -374,7 +374,7 @@ void KeyConfigPrefs::OnExport(wxCommandEvent & WXUNUSED(event)) gPrefs->Flush(); XMLFileWriter prefFile; - + try { prefFile.Open(file, wxT("wb")); @@ -446,7 +446,7 @@ void KeyConfigPrefs::OnFilterTimer(wxTimerEvent & WXUNUSED(e)) // The filter timer has expired, so set the filter if (mFilterPending) { - // Do not reset mFilterPending here...possible race + // Do not reset mFilterPending here...possible race mView->SetFilter(mFilter->GetValue()); } } @@ -501,7 +501,7 @@ void KeyConfigPrefs::OnFilterChar(wxKeyEvent & e) } } -// Given a hotkey combination, returns the name (description) of the +// Given a hotkey combination, returns the name (description) of the // corresponding command, or the empty string if none is found. wxString KeyConfigPrefs::NameFromKey(const wxString & key) { @@ -564,7 +564,7 @@ void KeyConfigPrefs::OnSet(wxCommandEvent & WXUNUSED(event)) mView->SetKeyByName(oldname, wxEmptyString); mManager->SetKeyFromName(oldname, wxEmptyString); mNewKeys[mNames.Index(oldname)].Empty(); - + } SetKeyForSelected(key); @@ -745,7 +745,7 @@ void KeyConfigPrefs::Populate() mCommandSelected = -1; } -/// Normally in classes derived from PrefsPanel this function +/// Normally in classes derived from PrefsPanel this function /// is used both to populate the panel and to exchange data with it. /// With KeyConfigPrefs all the exchanges are handled specially, /// so this is only used in populating the panel. @@ -763,7 +763,7 @@ void KeyConfigPrefs::PopulateOrExchange(ShuttleGui & S) &mCats); } S.EndHorizontalLay(); - + mList = S.Id(CommandsListID).AddListControlReportMode(); mList->SetName(_("Key Bindings")); @@ -774,7 +774,7 @@ void KeyConfigPrefs::PopulateOrExchange(ShuttleGui & S) CurrentComboID, wxT(""), wxDefaultPosition, -#if defined(__WXMAC__) +#if defined(__WXMAC__) wxSize(300, -1)); #else wxSize(210, -1)); @@ -845,13 +845,13 @@ void KeyConfigPrefs::RepopulateBindingsList() wxArrayString Keys,Labels,Categories; mManager->GetAllCommandData( - mNames, - Keys, + mNames, + Keys, mDefaultKeys, - Labels, + Labels, Categories, // True to include effects (list items), false otherwise. - true + true ); bool save = (mKeys.GetCount() == 0); @@ -868,7 +868,7 @@ void KeyConfigPrefs::RepopulateBindingsList() // mNewKeys is what mKeys will change to. mNewKeys.Add(key); } - else + else mNewKeys[i] = key; // Make sure mNewKeys is updated. // if (cat != _("All") && ! Categories[i].StartsWith(cat)) { @@ -959,7 +959,7 @@ void KeyConfigPrefs::OnExport(wxCommandEvent & WXUNUSED(event)) gPrefs->Flush(); XMLFileWriter prefFile; - + try { prefFile.Open(file, wxT("wb")); @@ -1009,7 +1009,7 @@ void KeyConfigPrefs::OnCaptureChar(wxKeyEvent & WXUNUSED(event)) { } -// Given a hotkey combination, returns the name (description) of the +// Given a hotkey combination, returns the name (description) of the // corresponding command, or the empty string if none is found. wxString KeyConfigPrefs::NameFromKey( const wxString & key ) { @@ -1032,7 +1032,7 @@ void KeyConfigPrefs::SetKeyForSelected( const wxString & key ) #if 0 int i=mNames.Index( name ); - if( i!=wxNOT_FOUND ) + if( i!=wxNOT_FOUND ) mNewKeys[i]=key; #endif @@ -1088,7 +1088,7 @@ void KeyConfigPrefs::OnKeyDown(wxListEvent & e) // and does not need the following code return; -#else +#else // The following code seems to work well on at least some versions of Linux int keycode = e.GetKeyCode(); int selected = mList->GetNextItem(-1, wxLIST_NEXT_ALL, wxLIST_STATE_SELECTED); diff --git a/src/prefs/KeyConfigPrefs.h b/src/prefs/KeyConfigPrefs.h index 9947dd772..bacb99d35 100644 --- a/src/prefs/KeyConfigPrefs.h +++ b/src/prefs/KeyConfigPrefs.h @@ -29,7 +29,7 @@ #include "PrefsPanel.h" -class KeyConfigPrefs:public PrefsPanel +class KeyConfigPrefs:public PrefsPanel { public: KeyConfigPrefs(wxWindow * parent); @@ -98,7 +98,7 @@ private: #include "PrefsPanel.h" -class KeyConfigPrefs:public PrefsPanel +class KeyConfigPrefs:public PrefsPanel { public: KeyConfigPrefs(wxWindow * parent); diff --git a/src/prefs/LibraryPrefs.cpp b/src/prefs/LibraryPrefs.cpp index beee155f7..4b579a3d9 100644 --- a/src/prefs/LibraryPrefs.cpp +++ b/src/prefs/LibraryPrefs.cpp @@ -57,7 +57,7 @@ void LibraryPrefs::Populate() { //------------------------- Main section -------------------- // Now construct the GUI itself. - // Use 'eIsCreatingFromPrefs' so that the GUI is + // Use 'eIsCreatingFromPrefs' so that the GUI is // initialised with values from gPrefs. ShuttleGui S(this, eIsCreatingFromPrefs); PopulateOrExchange(S); @@ -68,11 +68,11 @@ void LibraryPrefs::Populate() SetFFmpegVersionText(); } -/// This PopulateOrExchange function is a good example of mixing the fully +/// This PopulateOrExchange function is a good example of mixing the fully /// automatic style of reading/writing from GUI to prefs with the partial form. -/// +/// /// You'll notice that some of the Tie functions have Prefs identifiers in them -/// and others don't. +/// and others don't. void LibraryPrefs::PopulateOrExchange(ShuttleGui & S) { S.SetBorder(2); @@ -128,7 +128,7 @@ void LibraryPrefs::PopulateOrExchange(ShuttleGui & S) true, wxALL | wxALIGN_RIGHT | wxALIGN_CENTRE_VERTICAL); S.Id(ID_FFMPEG_FIND_BUTTON); - wxButton *bfnd = S.AddButton(_("Loca&te..."), + wxButton *bfnd = S.AddButton(_("Loca&te..."), wxALL | wxALIGN_LEFT | wxALIGN_CENTRE_VERTICAL); S.AddVariableText(_("FFmpeg Library:"), true, @@ -227,9 +227,9 @@ void LibraryPrefs::OnFFmpegDownButton(wxCommandEvent & WXUNUSED(event)) } bool LibraryPrefs::Apply() -{ +{ ShuttleGui S(this, eIsSavingToPrefs); - PopulateOrExchange(S); - + PopulateOrExchange(S); + return true; } diff --git a/src/prefs/LibraryPrefs.h b/src/prefs/LibraryPrefs.h index f0e656eb8..1ff51adde 100644 --- a/src/prefs/LibraryPrefs.h +++ b/src/prefs/LibraryPrefs.h @@ -22,7 +22,7 @@ #include "PrefsPanel.h" -class LibraryPrefs:public PrefsPanel +class LibraryPrefs:public PrefsPanel { public: LibraryPrefs(wxWindow * parent); diff --git a/src/prefs/MidiIOPrefs.cpp b/src/prefs/MidiIOPrefs.cpp index 31a489588..a3e548bd4 100644 --- a/src/prefs/MidiIOPrefs.cpp +++ b/src/prefs/MidiIOPrefs.cpp @@ -78,7 +78,7 @@ void MidiIOPrefs::Populate() //------------------------- Main section -------------------- // Now construct the GUI itself. - // Use 'eIsCreatingFromPrefs' so that the GUI is + // Use 'eIsCreatingFromPrefs' so that the GUI is // initialised with values from gPrefs. ShuttleGui S(this, eIsCreatingFromPrefs); PopulateOrExchange(S); @@ -121,7 +121,7 @@ void MidiIOPrefs::PopulateOrExchange( ShuttleGui & S ) { S.Id(HostID); /* i18n-hint: (noun) */ mHost = S.TieChoice(_("Host") + wxString(wxT(":")), - wxT("/MidiIO/Host"), + wxT("/MidiIO/Host"), wxT(""), mHostNames, mHostLabels); @@ -130,7 +130,7 @@ void MidiIOPrefs::PopulateOrExchange( ShuttleGui & S ) { S.AddPrompt(_("Using: PortMidi")); } S.EndMultiColumn(); - } + } S.EndStatic(); S.StartStatic(_("Playback")); @@ -141,7 +141,7 @@ void MidiIOPrefs::PopulateOrExchange( ShuttleGui & S ) { mPlay = S.AddChoice(_("Device") + wxString(wxT(":")), wxEmptyString, &empty); - int latency = gPrefs->Read(wxT("/MidiIO/OutputLatency"), + int latency = gPrefs->Read(wxT("/MidiIO/OutputLatency"), DEFAULT_SYNTH_LATENCY); mLatency = S.TieNumericTextBox(_("MIDI Synthesizer Latency (ms):"), wxT("/MidiIO/SynthLatency"), diff --git a/src/prefs/ModulePrefs.cpp b/src/prefs/ModulePrefs.cpp index b192fbf7f..a515fafa7 100644 --- a/src/prefs/ModulePrefs.cpp +++ b/src/prefs/ModulePrefs.cpp @@ -41,7 +41,7 @@ void ModulePrefs::Populate() { //------------------------- Main section -------------------- // Now construct the GUI itself. - // Use 'eIsCreatingFromPrefs' so that the GUI is + // Use 'eIsCreatingFromPrefs' so that the GUI is // initialised with values from gPrefs. ShuttleGui S(this, eIsCreatingFromPrefs); PopulateOrExchange(S); @@ -58,7 +58,7 @@ void ModulePrefs::PopulateOrExchange(ShuttleGui & S) S.TieCheckBox(_("mod-&script-pipe"), wxT("/Module/mod-script-pipe"), false); - S.TieCheckBox(_("mod-&nyq-bench"), + S.TieCheckBox(_("mod-&nyq-bench"), wxT("/Module/mod-nyq-bench"), false); S.TieCheckBox(_("mod-&track-panel"), diff --git a/src/prefs/MousePrefs.cpp b/src/prefs/MousePrefs.cpp index d032c3d06..afbc910b6 100644 --- a/src/prefs/MousePrefs.cpp +++ b/src/prefs/MousePrefs.cpp @@ -9,25 +9,25 @@ ********************************************************************//*! \class MousePrefs -\brief A PrefsPanel that presents an interface for user to view the +\brief A PrefsPanel that presents an interface for user to view the default bindings of mouse buttons to commands. - April/2003: These are default bindings and are not yet configurable. + April/2003: These are default bindings and are not yet configurable. They are provided to give information about what the bindings are. - Configuration when available will be mostly used by power users - who are unlikely to change the default bindings, but will add - bindings (e.g. for cut, play, and their own nyquist filters) + Configuration when available will be mostly used by power users + who are unlikely to change the default bindings, but will add + bindings (e.g. for cut, play, and their own nyquist filters) using currently unused combinations. - Unlike key-bindings which are parameterless, mouse bindings + Unlike key-bindings which are parameterless, mouse bindings provide parameters: - - a single point for a click, and - - a stream of points or a start and end point for a drag. + - a single point for a click, and + - a stream of points or a start and end point for a drag. - If we allow a nyquist filter to be bound to the mouse, instead of - being applied to the current selection it would be applied to the + If we allow a nyquist filter to be bound to the mouse, instead of + being applied to the current selection it would be applied to the start and end points of the drag. *//********************************************************************/ @@ -68,7 +68,7 @@ void MousePrefs::Populate() { //------------------------- Main section -------------------- // Now construct the GUI itself. - // Use 'eIsCreatingFromPrefs' so that the GUI is + // Use 'eIsCreatingFromPrefs' so that the GUI is // initialised with values from gPrefs. ShuttleGui S(this, eIsCreatingFromPrefs); PopulateOrExchange(S); @@ -91,7 +91,7 @@ void MousePrefs::PopulateOrExchange(ShuttleGui & S) /// Creates the contents of mList void MousePrefs::CreateList() { - //An empty first column is a workaround - under Win98 the first column + //An empty first column is a workaround - under Win98 the first column //can't be right aligned. mList->InsertColumn(BlankColumn, wxT(""), wxLIST_FORMAT_LEFT); mList->InsertColumn(ToolColumn, _("Tool"), wxLIST_FORMAT_RIGHT); @@ -115,10 +115,10 @@ void MousePrefs::CreateList() AddItem(_("Left-Drag"), _("Time-Shift"),_("Time shift clip or move up/down between tracks")); AddItem(_("Shift-Left-Drag"), _("Time-Shift"),_("Time shift all clips in track")); AddItem(_("Ctrl-Left-Drag"), _("Time-Shift"),_("Move clip up/down between tracks")); - - AddItem(_("Left-Drag"), + + AddItem(_("Left-Drag"), /* i18n-hint: The envelope is a curve that controls the audio loudness.*/ - _("Envelope"), + _("Envelope"), _("Change Amplification Envelope")); AddItem(_("Left-Click"), _("Pencil"), _("Change Sample")); @@ -144,7 +144,7 @@ void MousePrefs::CreateList() // Anyway, 5 pixels wide is wide enough that some people who are curious will drag it // wider to see what's there (the comments show that the duplication of functions // is for a reason, and not just random). - mList->SetColumnWidth(CommentColumn, 5); + mList->SetColumnWidth(CommentColumn, 5); } /// Adds an item to mList @@ -157,7 +157,7 @@ void MousePrefs::AddItem(wxString const & buttons, wxString const & tool, mList->SetItem(i, ActionColumn, action); mList->SetItem(i, ButtonsColumn, buttons); - // Add a space before the text to work around a minor bug in the + // Add a space before the text to work around a minor bug in the // list control when showing narrow columns. mList->SetItem(i, CommentColumn, wxT(" ") + comment); } diff --git a/src/prefs/MousePrefs.h b/src/prefs/MousePrefs.h index 3876e986e..e4efb35ed 100644 --- a/src/prefs/MousePrefs.h +++ b/src/prefs/MousePrefs.h @@ -30,8 +30,8 @@ class MousePrefs:public PrefsPanel void Populate(); void PopulateOrExchange(ShuttleGui & S); void CreateList(); - void AddItem(wxString const & buttons, - wxString const & tool, + void AddItem(wxString const & buttons, + wxString const & tool, wxString const & action, wxString const & comment = wxEmptyString); diff --git a/src/prefs/PlaybackPrefs.cpp b/src/prefs/PlaybackPrefs.cpp index 2a6ac5646..997d9be13 100644 --- a/src/prefs/PlaybackPrefs.cpp +++ b/src/prefs/PlaybackPrefs.cpp @@ -41,7 +41,7 @@ void PlaybackPrefs::Populate() { //------------------------- Main section -------------------- // Now construct the GUI itself. - // Use 'eIsCreatingFromPrefs' so that the GUI is + // Use 'eIsCreatingFromPrefs' so that the GUI is // initialised with values from gPrefs. ShuttleGui S(this, eIsCreatingFromPrefs); PopulateOrExchange(S); diff --git a/src/prefs/PrefsDialog.cpp b/src/prefs/PrefsDialog.cpp index 40ddecb1f..d6cc2ba9b 100644 --- a/src/prefs/PrefsDialog.cpp +++ b/src/prefs/PrefsDialog.cpp @@ -87,14 +87,14 @@ public: }; -int wxTreebookExt::ChangeSelection(size_t n) { +int wxTreebookExt::ChangeSelection(size_t n) { int i = wxTreebook::ChangeSelection(n); wxString Temp = GetPageText( n ); ((wxDialog*)GetParent())->SetTitle( Temp ); return i; }; -int wxTreebookExt::SetSelection(size_t n) +int wxTreebookExt::SetSelection(size_t n) { int i = wxTreebook::SetSelection(n); wxString Temp = wxString(_("Preferences: ")) + GetPageText( n ); @@ -195,9 +195,9 @@ PrefsDialog::PrefsDialog(wxWindow * parent) sz.y = 600; } - // Set the minimum height to be slightly bigger than default, as fix for bug 161. - // The magic number 7 was determined by Ed's experimentation. - // Frankly, this is a hack to work around a bug in wxTreebook, and + // Set the minimum height to be slightly bigger than default, as fix for bug 161. + // The magic number 7 was determined by Ed's experimentation. + // Frankly, this is a hack to work around a bug in wxTreebook, and // will have to be revisited if we add another category to mCategories. // JKC later added a category and 20 onto the 7. SetSizeHints(sz.x, sz.y + 7 + 20, 800, 600); @@ -253,20 +253,20 @@ void PrefsDialog::OnOK(wxCommandEvent & WXUNUSED(event)) #if USE_PORTMIXER if (gAudioIO) { - // We cannot have opened this dialog if gAudioIO->IsAudioTokenActive(), - // per the setting of AudioIONotBusyFlag and AudioIOBusyFlag in + // We cannot have opened this dialog if gAudioIO->IsAudioTokenActive(), + // per the setting of AudioIONotBusyFlag and AudioIOBusyFlag in // AudacityProject::GetUpdateFlags(). - // However, we can have an invalid audio token (so IsAudioTokenActive() - // is false), but be monitoring. - // If monitoring, have to stop the stream, so HandleDeviceChange() can work. - // We could disable the Preferences command while monitoring, i.e., - // set AudioIONotBusyFlag/AudioIOBusyFlag according to monitoring, as well. - // Instead allow it because unlike recording, for example, monitoring - // is not clearly something that should prohibit opening prefs. - // TODO: We *could* be smarter in this method and call HandleDeviceChange() + // However, we can have an invalid audio token (so IsAudioTokenActive() + // is false), but be monitoring. + // If monitoring, have to stop the stream, so HandleDeviceChange() can work. + // We could disable the Preferences command while monitoring, i.e., + // set AudioIONotBusyFlag/AudioIOBusyFlag according to monitoring, as well. + // Instead allow it because unlike recording, for example, monitoring + // is not clearly something that should prohibit opening prefs. + // TODO: We *could* be smarter in this method and call HandleDeviceChange() // only when the device choices actually changed. True of lots of prefs! // As is, we always stop monitoring before handling the device change. - if (gAudioIO->IsMonitoring()) + if (gAudioIO->IsMonitoring()) { gAudioIO->StopStream(); while (gAudioIO->IsBusy()) @@ -301,5 +301,5 @@ void PrefsDialog::SelectPageByName(wxString pageName) void PrefsDialog::ShowTempDirPage() { - SelectPageByName(_("Directories")); + SelectPageByName(_("Directories")); } diff --git a/src/prefs/PrefsPanel.h b/src/prefs/PrefsPanel.h index 25a6cbbb9..e35eacf44 100644 --- a/src/prefs/PrefsPanel.h +++ b/src/prefs/PrefsPanel.h @@ -40,7 +40,7 @@ ThemePrefs. #define TOP_LEVEL_BORDER 5 #define GENERIC_CONTROL_BORDER 5 -class PrefsPanel:public wxPanel +class PrefsPanel:public wxPanel { public: PrefsPanel(wxWindow * parent, wxString title) @@ -49,7 +49,7 @@ class PrefsPanel:public wxPanel SetLabel(title); // Provide visual label SetName(title); // Provide audible label } - + virtual ~PrefsPanel() { } diff --git a/src/prefs/ProjectsPrefs.cpp b/src/prefs/ProjectsPrefs.cpp index aea7b55d6..56f22f8c8 100644 --- a/src/prefs/ProjectsPrefs.cpp +++ b/src/prefs/ProjectsPrefs.cpp @@ -45,7 +45,7 @@ void ProjectsPrefs::Populate() { //------------------------- Main section -------------------- // Now construct the GUI itself. - // Use 'eIsCreatingFromPrefs' so that the GUI is + // Use 'eIsCreatingFromPrefs' so that the GUI is // initialised with values from gPrefs. ShuttleGui S(this, eIsCreatingFromPrefs); PopulateOrExchange(S); @@ -73,9 +73,9 @@ void ProjectsPrefs::PopulateOrExchange(ShuttleGui & S) } bool ProjectsPrefs::Apply() -{ +{ ShuttleGui S(this, eIsSavingToPrefs); - PopulateOrExchange(S); - + PopulateOrExchange(S); + return true; } diff --git a/src/prefs/ProjectsPrefs.h b/src/prefs/ProjectsPrefs.h index 80a72bf95..065dab57c 100644 --- a/src/prefs/ProjectsPrefs.h +++ b/src/prefs/ProjectsPrefs.h @@ -27,7 +27,7 @@ class ProjectsPrefs:public PrefsPanel ProjectsPrefs(wxWindow * parent); ~ProjectsPrefs(); virtual bool Apply(); - + private: void Populate(); void PopulateOrExchange(ShuttleGui & S); diff --git a/src/prefs/QualityPrefs.cpp b/src/prefs/QualityPrefs.cpp index 2252f99db..d3d3e7521 100644 --- a/src/prefs/QualityPrefs.cpp +++ b/src/prefs/QualityPrefs.cpp @@ -54,7 +54,7 @@ void QualityPrefs::Populate() //------------------------- Main section -------------------- // Now construct the GUI itself. - // Use 'eIsCreatingFromPrefs' so that the GUI is + // Use 'eIsCreatingFromPrefs' so that the GUI is // initialised with values from gPrefs. ShuttleGui S(this, eIsCreatingFromPrefs); PopulateOrExchange(S); @@ -70,7 +70,7 @@ void QualityPrefs::Populate() /// The corresponding labels are what gets stored. void QualityPrefs::GetNamesAndLabels() { - //------------ Dither Names + //------------ Dither Names mDitherNames.Add(_("None")); mDitherLabels.Add(Dither::none); mDitherNames.Add(_("Rectangle")); mDitherLabels.Add(Dither::rectangle); mDitherNames.Add(_("Triangle")); mDitherLabels.Add(Dither::triangle); diff --git a/src/prefs/QualityPrefs.h b/src/prefs/QualityPrefs.h index 7c421e20b..4cfd924c1 100644 --- a/src/prefs/QualityPrefs.h +++ b/src/prefs/QualityPrefs.h @@ -23,7 +23,7 @@ #include "PrefsPanel.h" -class QualityPrefs:public PrefsPanel +class QualityPrefs:public PrefsPanel { public: QualityPrefs(wxWindow * parent); diff --git a/src/prefs/RecordingPrefs.cpp b/src/prefs/RecordingPrefs.cpp index 8bb6bff4a..a6afa33a4 100644 --- a/src/prefs/RecordingPrefs.cpp +++ b/src/prefs/RecordingPrefs.cpp @@ -47,7 +47,7 @@ void RecordingPrefs::Populate() { //------------------------- Main section -------------------- // Now construct the GUI itself. - // Use 'eIsCreatingFromPrefs' so that the GUI is + // Use 'eIsCreatingFromPrefs' so that the GUI is // initialised with values from gPrefs. ShuttleGui S(this, eIsCreatingFromPrefs); PopulateOrExchange(S); @@ -185,7 +185,7 @@ bool RecordingPrefs::Apply() double targetpeak, deltapeak; gPrefs->Read(wxT("/AudioIO/TargetPeak"), &targetpeak); gPrefs->Read(wxT("/AudioIO/DeltaPeakVolume"), &deltapeak); - if (targetpeak + deltapeak > 100.0 || targetpeak - deltapeak < 0.0) + if (targetpeak + deltapeak > 100.0 || targetpeak - deltapeak < 0.0) { gPrefs->Write(wxT("/AudioIO/DeltaPeakVolume"), min(100.0 - targetpeak, targetpeak)); gPrefs->Flush(); diff --git a/src/prefs/SpectrumPrefs.cpp b/src/prefs/SpectrumPrefs.cpp index b4cdf6a91..aa9d13577 100644 --- a/src/prefs/SpectrumPrefs.cpp +++ b/src/prefs/SpectrumPrefs.cpp @@ -80,14 +80,14 @@ void SpectrumPrefs::PopulateOrExchange(ShuttleGui & S) S.StartMultiColumn(2); { S.TieChoice(_("Window &size") + wxString(wxT(":")), - wxT("/Spectrum/FFTSize"), + wxT("/Spectrum/FFTSize"), 256, mSizeChoices, mSizeCodes); S.SetSizeHints(mSizeChoices); S.TieChoice(_("Window &type") + wxString(wxT(":")), - wxT("/Spectrum/WindowType"), + wxT("/Spectrum/WindowType"), 3, mTypeChoices, mTypeCodes); diff --git a/src/prefs/ThemePrefs.cpp b/src/prefs/ThemePrefs.cpp index 15c475f02..2cbfd7ba3 100644 --- a/src/prefs/ThemePrefs.cpp +++ b/src/prefs/ThemePrefs.cpp @@ -73,7 +73,7 @@ void ThemePrefs::Populate() //------------------------- Main section -------------------- // Now construct the GUI itself. - // Use 'eIsCreatingFromPrefs' so that the GUI is + // Use 'eIsCreatingFromPrefs' so that the GUI is // initialised with values from gPrefs. ShuttleGui S(this, eIsCreatingFromPrefs); PopulateOrExchange(S); @@ -125,10 +125,10 @@ void ThemePrefs::PopulateOrExchange(ShuttleGui & S) S.Id(idReadThemeInternal).AddButton(_("&Defaults")); } S.EndHorizontalLay(); - + S.StartHorizontalLay(wxALIGN_LEFT); { - S.TieCheckBox(_("Load Theme Cache At Startup"), + S.TieCheckBox(_("Load Theme Cache At Startup"), wxT("/Theme/LoadAtStart"), false); } @@ -137,11 +137,11 @@ void ThemePrefs::PopulateOrExchange(ShuttleGui & S) S.EndStatic(); // JKC: 'Ergonomic' details: - // Theme components are used much less frequently than + // Theme components are used much less frequently than // the ImageCache. Yet it's easy to click them 'by mistake'. // - // To reduce that risk, we use a separate box to separate them off. - // And choose text on the buttons that is shorter, making the + // To reduce that risk, we use a separate box to separate them off. + // And choose text on the buttons that is shorter, making the // buttons smaller and less tempting to click. S.StartStatic( _("Individual Theme Files"),1); { diff --git a/src/prefs/TracksPrefs.cpp b/src/prefs/TracksPrefs.cpp index cb28d695e..df53e312b 100644 --- a/src/prefs/TracksPrefs.cpp +++ b/src/prefs/TracksPrefs.cpp @@ -63,7 +63,7 @@ void TracksPrefs::Populate() //------------------------- Main section -------------------- // Now construct the GUI itself. - // Use 'eIsCreatingFromPrefs' so that the GUI is + // Use 'eIsCreatingFromPrefs' so that the GUI is // initialised with values from gPrefs. ShuttleGui S(this, eIsCreatingFromPrefs); PopulateOrExchange(S); @@ -79,7 +79,7 @@ void TracksPrefs::PopulateOrExchange(ShuttleGui & S) S.TieCheckBox(_("&Update display while playing"), wxT("/GUI/AutoScroll"), true); - S.TieCheckBox(_("Automatically &fit tracks vertically zoomed"), + S.TieCheckBox(_("Automatically &fit tracks vertically zoomed"), wxT("/GUI/TracksFitVerticallyZoomed"), false); @@ -100,7 +100,7 @@ void TracksPrefs::PopulateOrExchange(ShuttleGui & S) S.StartStatic(_("Behaviors")); { - S.TieCheckBox(_("&Select all audio in project, if none selected"), + S.TieCheckBox(_("&Select all audio in project, if none selected"), wxT("/GUI/SelectAllOnNone"), true); /* i18n-hint: cut-lines are a lines indicating where to cut.*/ @@ -110,7 +110,7 @@ void TracksPrefs::PopulateOrExchange(ShuttleGui & S) S.TieCheckBox(_("Enable &dragging of left and right selection edges"), wxT("/GUI/AdjustSelectionEdges"), true); - S.TieCheckBox(_("\"Move track focus\" c&ycles repeatedly through tracks"), + S.TieCheckBox(_("\"Move track focus\" c&ycles repeatedly through tracks"), wxT("/GUI/CircularTrackNavigation"), false); S.TieCheckBox(_("Editing a clip can &move other clips"), diff --git a/src/prefs/WarningsPrefs.cpp b/src/prefs/WarningsPrefs.cpp index 064d86e62..68d344593 100644 --- a/src/prefs/WarningsPrefs.cpp +++ b/src/prefs/WarningsPrefs.cpp @@ -41,7 +41,7 @@ void WarningsPrefs::Populate() { //------------------------- Main section -------------------- // Now construct the GUI itself. - // Use 'eIsCreatingFromPrefs' so that the GUI is + // Use 'eIsCreatingFromPrefs' so that the GUI is // initialised with values from gPrefs. ShuttleGui S(this, eIsCreatingFromPrefs); PopulateOrExchange(S); @@ -57,7 +57,7 @@ void WarningsPrefs::PopulateOrExchange(ShuttleGui & S) S.TieCheckBox(_("Saving &projects"), wxT("/Warnings/FirstProjectSave"), true); - S.TieCheckBox(_("Saving &empty project"), + S.TieCheckBox(_("Saving &empty project"), wxT("/GUI/EmptyCanBeDirty"), true); S.TieCheckBox(_("&Low disk space at program start up"), diff --git a/src/toolbars/ControlToolBar.cpp b/src/toolbars/ControlToolBar.cpp index 93af1f284..bf5d30b56 100644 --- a/src/toolbars/ControlToolBar.cpp +++ b/src/toolbars/ControlToolBar.cpp @@ -8,14 +8,14 @@ Shane T. Mueller James Crook Leland Lucius - + *******************************************************************//** \class ControlToolBar \brief A ToolBar that has the main Transport buttons. - In the GUI, this is referred to as "Transport Toolbar", as - it corresponds to commands in the Transport menu. + In the GUI, this is referred to as "Transport Toolbar", as + it corresponds to commands in the Transport menu. "Control Toolbar" is historic. This class, which is a child of Toolbar, creates the window containing the Transport (rewind/play/stop/record/ff) @@ -28,7 +28,7 @@ Audacity - they are not native controls on any platform - however, it is intended that the images could be easily replaced to allow "skinning" or just customization to - match the look and feel of each platform. + match the look and feel of each platform. *//*******************************************************************/ @@ -178,7 +178,7 @@ void ControlToolBar::Populate() mPause = MakeButton(bmpPause, bmpPause, bmpPauseDisabled, ID_PAUSE_BUTTON, true, _("Pause")); - mPlay = MakeButton( bmpPlay, bmpPlay, bmpPlayDisabled, + mPlay = MakeButton( bmpPlay, bmpPlay, bmpPlayDisabled, ID_PLAY_BUTTON, true, _("Play")); MakeLoopImage(); @@ -197,7 +197,7 @@ void ControlToolBar::Populate() #if wxUSE_TOOLTIPS RegenerateToolsTooltips(); - wxToolTip::Enable(true); + wxToolTip::Enable(true); wxToolTip::SetDelay(1000); #endif @@ -210,7 +210,7 @@ void ControlToolBar::RegenerateToolsTooltips() #if wxUSE_TOOLTIPS for (long iWinID = ID_PLAY_BUTTON; iWinID < BUTTON_COUNT; iWinID++) { - wxWindow* pCtrl = this->FindWindow(iWinID); + wxWindow* pCtrl = this->FindWindow(iWinID); wxString strToolTip = pCtrl->GetLabel(); AudacityProject* pProj = GetActiveProject(); CommandManager* pCmdMgr = (pProj) ? pProj->GetCommandManager() : NULL; @@ -274,9 +274,9 @@ void ControlToolBar::UpdatePrefs() Updated(); } else - // The other reason to regenerate tooltips is if keyboard shortcuts for - // transport buttons changed, but that's too much work to check for, so just - // always do it. (Much cheaper than calling ReCreateButtons() in all cases. + // The other reason to regenerate tooltips is if keyboard shortcuts for + // transport buttons changed, but that's too much work to check for, so just + // always do it. (Much cheaper than calling ReCreateButtons() in all cases. RegenerateToolsTooltips(); @@ -389,7 +389,7 @@ void ControlToolBar::EnableDisableButtons() if (t->GetKind() == Track::Wave #if defined(USE_MIDI) || t->GetKind() == Track::Note -#endif +#endif ) { tracks = true; break; @@ -455,7 +455,7 @@ void ControlToolBar::PlayPlayRegion(double t0, double t1, SetPlay(false); return; } - + if (cutpreview && t0==t1) { SetPlay(false); return; /* msmeyer: makes no sense */ @@ -494,8 +494,8 @@ void ControlToolBar::PlayPlayRegion(double t0, double t1, double maxofmins,minofmaxs; #if defined(EXPERIMENTAL_SEEK_BEHIND_CURSOR) double init_seek = 0.0; -#endif - +#endif + // JS: clarified how the final play region is computed; if (t1 == t0) { // msmeyer: When playing looped, we play the whole file, if @@ -518,7 +518,7 @@ void ControlToolBar::PlayPlayRegion(double t0, double t1, } #endif } - + // always play to end t1 = t->GetEndTime(); } @@ -531,14 +531,14 @@ void ControlToolBar::PlayPlayRegion(double t0, double t1, maxofmins = t->GetStartTime(); else maxofmins = t0; - + // minimum of upper bounds if (t1 > t->GetEndTime()) minofmaxs = t->GetEndTime(); else minofmaxs = t1; - // we test if the intersection has no volume + // we test if the intersection has no volume if (minofmaxs <= maxofmins) { // no volume; play nothing return; @@ -553,7 +553,7 @@ void ControlToolBar::PlayPlayRegion(double t0, double t1, if (t0 < 0.0) { t0 = 0.0; } - + bool success = false; if (t1 > t0) { int token; @@ -681,7 +681,7 @@ void ControlToolBar::OnKeyDown(wxKeyEvent & event) { event.Skip(); - if (event.GetKeyCode() == WXK_SHIFT) + if (event.GetKeyCode() == WXK_SHIFT) { // Turn the "Play" button into a "Loop" button if (!mPlay->IsDown()) @@ -694,7 +694,7 @@ void ControlToolBar::OnKeyUp(wxKeyEvent & event) { event.Skip(); - if (event.GetKeyCode() == WXK_SHIFT) + if (event.GetKeyCode() == WXK_SHIFT) { // Turn the "Loop" button into a "Play" button if (!mPlay->IsDown()) @@ -706,9 +706,9 @@ void ControlToolBar::OnTimer(wxTimerEvent & event) { event.Skip(); - // bug 307 fix: - // Shift key-up events get swallowed if a command with a Shift in its keyboard - // shortcut opens a dialog, and ControlToolBar::OnKeyUp() doesn't get called. + // bug 307 fix: + // Shift key-up events get swallowed if a command with a Shift in its keyboard + // shortcut opens a dialog, and ControlToolBar::OnKeyUp() doesn't get called. if (!wxGetKeyState(WXK_SHIFT)) { wxKeyEvent dummyEvent; @@ -724,7 +724,7 @@ void ControlToolBar::OnPlay(wxCommandEvent & WXUNUSED(evt)) StopPlaying(); AudacityProject *p = GetActiveProject(); - if (p) p->TP_DisplaySelection(); + if (p) p->TP_DisplaySelection(); PlayDefault(); } @@ -764,7 +764,7 @@ void ControlToolBar::StopPlaying(bool stopStream /* = true*/) mPaused=false; //Make sure you tell gAudioIO to unpause gAudioIO->SetPaused(mPaused); - + ClearCutPreviewTracks(); mBusyProject = NULL; @@ -811,7 +811,7 @@ void ControlToolBar::OnRecord(wxCommandEvent &evt) #endif bool duplex; gPrefs->Read(wxT("/AudioIO/Duplex"), &duplex, true); - + if(duplex){ playbackTracks = t->GetWaveTrackArray(false); #ifdef EXPERIMENTAL_MIDI_OUT @@ -824,7 +824,7 @@ void ControlToolBar::OnRecord(wxCommandEvent &evt) midiTracks = NoteTrackArray(); #endif } - + // If SHIFT key was down, the user wants append to tracks int recordingChannels = 0; bool shifted = mRecord->WasShiftDown(); @@ -840,7 +840,7 @@ void ControlToolBar::OnRecord(wxCommandEvent &evt) if (wt->GetEndTime() > allt0) { allt0 = wt->GetEndTime(); } - + if (tt->GetSelected()) { sel = true; if (duplex) @@ -902,7 +902,7 @@ void ControlToolBar::OnRecord(wxCommandEvent &evt) newRecordingTracks.Add(newTrack); } - + // msmeyer: StartStream calls a callback which triggers auto-save, so // we add the tracks where recording is done into now. We remove them // later if starting the stream fails @@ -917,14 +917,14 @@ void ControlToolBar::OnRecord(wxCommandEvent &evt) int token = gAudioIO->StartStream(playbackTracks, newRecordingTracks, -#ifdef EXPERIMENTAL_MIDI_OUT +#ifdef EXPERIMENTAL_MIDI_OUT midiTracks, #endif t->GetTimeTrack(), p->GetRate(), t0, t1, p); bool success = (token != 0); - + if (success) { p->SetAudioIOToken(token); mBusyProject = p; @@ -953,18 +953,18 @@ void ControlToolBar::OnRecord(wxCommandEvent &evt) void ControlToolBar::OnPause(wxCommandEvent & WXUNUSED(evt)) -{ +{ if(mPaused) { mPause->PopUp(); mPaused=false; } else - { + { mPause->PushDown(); mPaused=true; } - + gAudioIO->SetPaused(mPaused); } @@ -1009,7 +1009,7 @@ void ControlToolBar::SetupCutPreviewTracks(double WXUNUSED(playStart), double cu break; } } - + if (track1) { // Duplicate and change tracks @@ -1020,7 +1020,7 @@ void ControlToolBar::SetupCutPreviewTracks(double WXUNUSED(playStart), double cu track2 = track2->Duplicate(); track2->Clear(cutStart, cutEnd); } - + mCutPreviewTracks = new TrackList(); mCutPreviewTracks->Add(track1); if (track2) diff --git a/src/toolbars/ControlToolBar.h b/src/toolbars/ControlToolBar.h index 23d1bee25..30de42ab4 100644 --- a/src/toolbars/ControlToolBar.h +++ b/src/toolbars/ControlToolBar.h @@ -2,13 +2,13 @@ Audacity: A Digital Audio Editor - + ControlToolbar.h - + Dominic Mazzoni Shane T. Mueller Leland Lucius - + **********************************************************************/ #ifndef __AUDACITY_CONTROL_TOOLBAR__ @@ -75,7 +75,7 @@ class ControlToolBar:public ToolBar { bool cutpreview = false, TimeTrack *timetrack = NULL); void PlayDefault(); - + // Stop playing void StopPlaying(bool stopStream = true); @@ -108,7 +108,7 @@ class ControlToolBar:public ToolBar { ID_STOP_BUTTON, ID_FF_BUTTON, ID_REW_BUTTON, - BUTTON_COUNT, + BUTTON_COUNT, }; AButton *mRewind; diff --git a/src/toolbars/DeviceToolBar.cpp b/src/toolbars/DeviceToolBar.cpp index 6ed6bdd63..b9fcaa31d 100644 --- a/src/toolbars/DeviceToolBar.cpp +++ b/src/toolbars/DeviceToolBar.cpp @@ -5,7 +5,7 @@ DeviceToolBar.cpp Dominic Mazzoni - + *******************************************************************//*! \class DeviceToolBar @@ -84,7 +84,7 @@ void DeviceToolBar::DeinitChildren() { mPlayBitmap = NULL; mRecordBitmap = NULL; - + mInput = NULL; mOutput = NULL; mInputChannels = NULL; @@ -106,7 +106,7 @@ void DeviceToolBar::Populate() // Output device mPlayBitmap = new wxBitmap(theTheme.Bitmap(bmpSpeaker)); Add(new wxStaticBitmap(this, - wxID_ANY, + wxID_ANY, *mPlayBitmap), 0, wxALIGN_CENTER); mOutput = new wxChoice(this, @@ -121,7 +121,7 @@ void DeviceToolBar::Populate() mRecordBitmap = new wxBitmap(theTheme.Bitmap(bmpMic)); Add(new wxStaticBitmap(this, - wxID_ANY, + wxID_ANY, *mRecordBitmap), 0, wxALIGN_CENTER); mInput = new wxChoice(this, @@ -244,7 +244,7 @@ void DeviceToolBar::UpdatePrefs() if (sourceName == wxT("")) desc = devName; else - desc = devName + wxString(": ", wxConvLocal) + sourceName; + desc = devName + wxString(": ", wxConvLocal) + sourceName; if (mInput->GetStringSelection() != desc && mInput->FindString(desc) != wxNOT_FOUND) { @@ -274,7 +274,7 @@ void DeviceToolBar::UpdatePrefs() if (sourceName == wxT("")) desc = devName; else - desc = devName + wxString(": ", wxConvLocal) + sourceName; + desc = devName + wxString(": ", wxConvLocal) + sourceName; if (mOutput->GetStringSelection() != desc && mOutput->FindString(desc) != wxNOT_FOUND) { @@ -315,7 +315,7 @@ void DeviceToolBar::UpdatePrefs() // Give base class a chance ToolBar::UpdatePrefs(); - + Layout(); Refresh(); } @@ -326,10 +326,10 @@ void DeviceToolBar::EnableDisableButtons() if (gAudioIO) { // we allow changes when monitoring, but not when recording bool audioStreamActive = gAudioIO->IsStreamActive() && !gAudioIO->IsMonitoring(); - + // Here we should relinquish focus if (audioStreamActive) { - wxWindow *focus = wxWindow::FindFocus(); + wxWindow *focus = wxWindow::FindFocus(); if (focus == mHost || focus == mInput || focus == mOutput || focus == mInputChannels) { AudacityProject *activeProject = GetActiveProject(); if (activeProject) { @@ -337,7 +337,7 @@ void DeviceToolBar::EnableDisableButtons() } } } - + mHost->Enable(!audioStreamActive); mInput->Enable(!audioStreamActive); mOutput->Enable(!audioStreamActive); @@ -374,7 +374,7 @@ static bool RepositionCombo(wxWindow *combo, int toolbarWidth, wxSize desiredSiz float ratioChange; bool constrained = false; - // push margin pixels + // push margin pixels desiredSize.x += marginPixels; // truncate the window size if necessary @@ -420,7 +420,7 @@ void DeviceToolBar::RepositionCombos() // as the toolbar's with can extend past this. GetClientSize(&w, &h); - // FIXME: Note that there's some bug in here, in that even if the prefs show the toolbar + // FIXME: Note that there's some bug in here, in that even if the prefs show the toolbar // docked, on initialization, this call to IsDocked() returns false. if (IsDocked()) { // If the toolbar is docked its width can be larger than what is actually viewable @@ -436,7 +436,7 @@ void DeviceToolBar::RepositionCombos() w -= grabberWidth + GetResizeGrabberWidth(); if (w <= 0) return; - + // set up initial sizes and ratios hostRatio = kHostWidthRatio; inputRatio = kInputWidthRatio; @@ -464,7 +464,7 @@ void DeviceToolBar::RepositionCombos() i++; constrained = RepositionCombo(mHost, w, desiredHost, hostRatio, ratioUnused, 0, true); constrained |= RepositionCombo(mInput, w, desiredInput, inputRatio, ratioUnused, mRecordBitmap->GetWidth(), true); - constrained |= RepositionCombo(mOutput, w, desiredOutput, outputRatio, ratioUnused, mPlayBitmap->GetWidth(), true); + constrained |= RepositionCombo(mOutput, w, desiredOutput, outputRatio, ratioUnused, mPlayBitmap->GetWidth(), true); constrained |= RepositionCombo(mInputChannels, w, desiredChannels, channelsRatio, ratioUnused, 0, true); } @@ -475,7 +475,7 @@ void DeviceToolBar::FillHosts() { wxArrayString hosts; size_t i; - + const std::vector &inMaps = DeviceManager::Instance()->GetInputDeviceMaps(); const std::vector &outMaps = DeviceManager::Instance()->GetOutputDeviceMaps(); // go over our lists add the host to the list if it isn't there yet @@ -488,7 +488,7 @@ void DeviceToolBar::FillHosts() mHost->Clear(); mHost->Append(hosts); - + if (hosts.GetCount() == 0) mHost->Enable(false); } @@ -514,14 +514,14 @@ void DeviceToolBar::FillHostDevices() break; } } - + if (foundHostIndex == -1) { for (i = 0; i < inMaps.size(); i++) { if (inMaps[i].hostString == host) { foundHostIndex = inMaps[i].hostIndex; break; } - } + } } // If no host was found based on the prefs device host, load the first available one @@ -576,10 +576,10 @@ int DeviceToolBar::ChangeHost() wxString oldHost = gPrefs->Read(wxT("/AudioIO/Host"), wxT("")); wxString newHost = hostSelectionIndex >= 0 ? mHost->GetString(hostSelectionIndex) : oldHost; - + if (oldHost == newHost) return 0; - + //change the host and switch to correct devices. gPrefs->Write(wxT("/AudioIO/Host"), newHost); gPrefs->Flush(); @@ -597,7 +597,7 @@ void DeviceToolBar::FillInputChannels() wxString device = gPrefs->Read(wxT("/AudioIO/RecordingDevice"), wxT("")); wxString source = gPrefs->Read(wxT("/AudioIO/RecordingSource"), wxT("")); long oldChannels = 2, newChannels; - + gPrefs->Read(wxT("/AudioIO/RecordChannels"), &oldChannels); int index = -1; size_t i, j; @@ -712,20 +712,20 @@ void DeviceToolBar::OnChoice(wxCommandEvent &event) } if (gAudioIO) { - // We cannot have gotten here if gAudioIO->IsAudioTokenActive(), - // per the setting of AudioIONotBusyFlag and AudioIOBusyFlag in + // We cannot have gotten here if gAudioIO->IsAudioTokenActive(), + // per the setting of AudioIONotBusyFlag and AudioIOBusyFlag in // AudacityProject::GetUpdateFlags(). - // However, we can have an invalid audio token (so IsAudioTokenActive() - // is false), but be monitoring. - // If monitoring, have to stop the stream, so HandleDeviceChange() can work. - // We could disable the Preferences command while monitoring, i.e., - // set AudioIONotBusyFlag/AudioIOBusyFlag according to monitoring, as well. - // Instead allow it because unlike recording, for example, monitoring - // is not clearly something that should prohibit changing device. - // TODO: We *could* be smarter in this method and call HandleDeviceChange() + // However, we can have an invalid audio token (so IsAudioTokenActive() + // is false), but be monitoring. + // If monitoring, have to stop the stream, so HandleDeviceChange() can work. + // We could disable the Preferences command while monitoring, i.e., + // set AudioIONotBusyFlag/AudioIOBusyFlag according to monitoring, as well. + // Instead allow it because unlike recording, for example, monitoring + // is not clearly something that should prohibit changing device. + // TODO: We *could* be smarter in this method and call HandleDeviceChange() // only when the device choices actually changed. True of lots of prefs! // As is, we always stop monitoring before handling the device change. - if (gAudioIO->IsMonitoring()) + if (gAudioIO->IsMonitoring()) { gAudioIO->StopStream(); while (gAudioIO->IsBusy()) diff --git a/src/toolbars/DeviceToolBar.h b/src/toolbars/DeviceToolBar.h index a2d65bfc2..165e2a644 100644 --- a/src/toolbars/DeviceToolBar.h +++ b/src/toolbars/DeviceToolBar.h @@ -3,9 +3,9 @@ Audacity: A Digital Audio Editor DeviceToolbar.h - + Dominic Mazzoni - + **********************************************************************/ #ifndef __AUDACITY_DEVICE_TOOLBAR__ diff --git a/src/toolbars/EditToolBar.cpp b/src/toolbars/EditToolBar.cpp index e1edd07d3..c81c51b18 100644 --- a/src/toolbars/EditToolBar.cpp +++ b/src/toolbars/EditToolBar.cpp @@ -7,14 +7,14 @@ Dominic Mazzoni Shane T. Mueller Leland Lucius - + See EditToolBar.h for details *******************************************************************//*! \class EditToolBar \brief A ToolBar that has the edit buttons on it. - + This class, which is a child of Toolbar, creates the window containing interfaces to commonly-used edit functions that are otherwise only available through @@ -109,7 +109,7 @@ AButton *EditToolBar::AddButton( bmpRecoloredUpSmall, bmpRecoloredDownSmall, bmpRecoloredHiliteSmall, eEnabledUp, eEnabledDown, eDisabled, wxWindowID(id), - wxDefaultPosition, + wxDefaultPosition, toggle, theTheme.ImageSize( bmpRecoloredUpSmall )); @@ -150,10 +150,10 @@ void EditToolBar::Populate() #ifdef EXPERIMENTAL_SYNC_LOCK AddButton(bmpSyncLockTracksUp, bmpSyncLockTracksDown, bmpSyncLockTracksDisabled, ETBSyncLockID, _("Sync-Lock Tracks"), true); - + AddSeparator(); #endif - + AddButton(bmpZoomIn, bmpZoomIn, bmpZoomInDisabled, ETBZoomInID, _("Zoom In")); AddButton(bmpZoomOut, bmpZoomOut, bmpZoomOutDisabled, ETBZoomOutID, @@ -170,7 +170,7 @@ void EditToolBar::Populate() mButtons[ETBZoomSelID]->SetEnabled(false); mButtons[ETBZoomFitID]->SetEnabled(false); mButtons[ETBPasteID]->SetEnabled(false); - + #ifdef EXPERIMENTAL_SYNC_LOCK mButtons[ETBSyncLockID]->PushDown(); #endif @@ -282,7 +282,7 @@ void EditToolBar::EnableDisableButtons() break; } selection &= (p->GetSel0() < p->GetSel1()); - + mButtons[ETBCutID]->SetEnabled(selection); mButtons[ETBCopyID]->SetEnabled(selection); mButtons[ETBTrimID]->SetEnabled(selection); @@ -304,7 +304,7 @@ void EditToolBar::EnableDisableButtons() mButtons[ETBZoomFitID]->SetEnabled(tracks); mButtons[ETBPasteID]->SetEnabled(p->Clipboard()); - + #ifdef EXPERIMENTAL_SYNC_LOCK bool bSyncLockTracks; gPrefs->Read(wxT("/GUI/SyncLockTracks"), &bSyncLockTracks, false); diff --git a/src/toolbars/EditToolBar.h b/src/toolbars/EditToolBar.h index 5127d7847..33989493d 100644 --- a/src/toolbars/EditToolBar.h +++ b/src/toolbars/EditToolBar.h @@ -2,9 +2,9 @@ Audacity: A Digital Audio Editor - + EditToolbar.h - + Dominic Mazzoni Shane T. Mueller Leland Lucius @@ -80,7 +80,7 @@ class EditToolBar:public ToolBar { void MakeButtons(); void RegenerateTooltips(); - + AButton *mButtons[ETBNumButtons]; wxImage *upImage; diff --git a/src/toolbars/MeterToolBar.cpp b/src/toolbars/MeterToolBar.cpp index 1c8897840..6d1cba3db 100644 --- a/src/toolbars/MeterToolBar.cpp +++ b/src/toolbars/MeterToolBar.cpp @@ -6,7 +6,7 @@ Dominic Mazzoni Leland Lucius - + See MeterToolBar.h for details *******************************************************************//*! diff --git a/src/toolbars/MeterToolBar.h b/src/toolbars/MeterToolBar.h index e91b9c00f..24fa86504 100644 --- a/src/toolbars/MeterToolBar.h +++ b/src/toolbars/MeterToolBar.h @@ -1,12 +1,12 @@ /********************************************************************** Audacity: A Digital Audio Editor - + MeterToolbar.h - + Dominic Mazzoni Leland Lucius - + ToolBar to hold the VU Meter **********************************************************************/ @@ -58,7 +58,7 @@ class MeterToolBar:public ToolBar { DECLARE_CLASS(MeterToolBar); DECLARE_EVENT_TABLE(); - + }; #endif diff --git a/src/toolbars/MixerToolBar.cpp b/src/toolbars/MixerToolBar.cpp index ff5982f90..1e3e5cdf4 100644 --- a/src/toolbars/MixerToolBar.cpp +++ b/src/toolbars/MixerToolBar.cpp @@ -5,7 +5,7 @@ MixerToolBar.cpp Dominic Mazzoni - + *******************************************************************//*! \class MixerToolBar @@ -85,7 +85,7 @@ void MixerToolBar::Populate() mPlayBitmap = new wxBitmap(theTheme.Bitmap(bmpSpeaker)); Add(new wxStaticBitmap(this, - wxID_ANY, + wxID_ANY, *mPlayBitmap), 0, wxALIGN_CENTER); mOutputSlider = new ASlider(this, wxID_ANY, _("Output Volume"), @@ -97,7 +97,7 @@ void MixerToolBar::Populate() mRecordBitmap = new wxBitmap(theTheme.Bitmap(bmpMic)); Add(new wxStaticBitmap(this, - wxID_ANY, + wxID_ANY, *mRecordBitmap), 0, wxALIGN_CENTER); mInputSlider = new ASlider(this, wxID_ANY, _("Input Volume"), diff --git a/src/toolbars/MixerToolBar.h b/src/toolbars/MixerToolBar.h index 10474a4f8..450a92a61 100644 --- a/src/toolbars/MixerToolBar.h +++ b/src/toolbars/MixerToolBar.h @@ -3,9 +3,9 @@ Audacity: A Digital Audio Editor MixerToolbar.h - + Dominic Mazzoni - + **********************************************************************/ #ifndef __AUDACITY_MIXER_TOOLBAR__ diff --git a/src/toolbars/SelectionBar.cpp b/src/toolbars/SelectionBar.cpp index 438d71648..4e676dc26 100644 --- a/src/toolbars/SelectionBar.cpp +++ b/src/toolbars/SelectionBar.cpp @@ -5,7 +5,7 @@ SelectionBar.cpp Copyright 2005 Dominic Mazzoni - + This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or @@ -14,13 +14,13 @@ *******************************************************************//** \class SelectionBar -\brief (not quite a Toolbar) at foot of screen for setting and viewing the +\brief (not quite a Toolbar) at foot of screen for setting and viewing the selection range. *//****************************************************************//** \class SelectionBarListener -\brief A parent class of SelectionBar, used to forward events to do +\brief A parent class of SelectionBar, used to forward events to do with changes in the SelectionBar. *//*******************************************************************/ @@ -112,7 +112,7 @@ void SelectionBar::Populate() wxBoxSizer *hSizer; /* we don't actually need a control yet, but we want to use it's methods - * to do some look-ups, so we'll have to create one. We can't make the + * to do some look-ups, so we'll have to create one. We can't make the * look-ups static because they depend on translations which are done at * runtime */ wxString formatName = mListener ? mListener->AS_GetSelectionFormat() : wxString(wxEmptyString); @@ -144,7 +144,7 @@ void SelectionBar::Populate() bool showSelectionLength = false; gPrefs->Read(wxT("/ShowSelectionLength"), &showSelectionLength); - + hSizer = new wxBoxSizer(wxHORIZONTAL); mRightEndButton = new wxRadioButton(this, OnEndRadioID, _("End"), wxDefaultPosition, wxDefaultSize, @@ -163,7 +163,7 @@ void SelectionBar::Populate() // to why this is needed. We've only experienced it under Win2k // so it's probably been fixed. But, it doesn't hurt to have this // in for all versions. - wxRadioButton* dummyButton = + wxRadioButton* dummyButton = new wxRadioButton(this, wxID_ANY, _("hidden"), wxDefaultPosition, wxDefaultSize, wxRB_GROUP); @@ -245,7 +245,7 @@ void SelectionBar::Populate() wxFocusEventHandler(SelectionBar::OnFocus), NULL, this); - + mLeftTime = new TimeTextCtrl(this, OnLeftTimeID, formatName, 0.0, mRate); mLeftTime->SetName(_("Selection Start:")); mLeftTime->EnableMenu(); @@ -356,9 +356,9 @@ void SelectionBar::OnUpdate(wxCommandEvent &evt) bool leftFocus = (w == mLeftTime); bool rightFocus = (w == mRightTime); bool audioFocus = (w == mAudioTime); - + evt.Skip(false); - + wxString format; // Save format name before recreating the controls so they resize properly @@ -368,7 +368,7 @@ void SelectionBar::OnUpdate(wxCommandEvent &evt) #if wxUSE_TOOLTIPS mSnapTo->SetToolTip(wxString::Format(_("Snap Clicks/Selections to %s"), format.c_str())); #endif - + // ToolBar::ReCreateButtons() will get rid of our sizers and controls // so reset pointers first. mLeftTime = @@ -472,7 +472,7 @@ void SelectionBar::SetSelectionFormat(const wxString & format) wxCommandEvent e; e.SetInt(mLeftTime->GetFormatIndex()); - OnUpdate(e); + OnUpdate(e); } void SelectionBar::SetRate(double rate) @@ -558,7 +558,7 @@ void SelectionBar::OnCaptureKey(wxCommandEvent &event) return; } } - + event.Skip(); return; diff --git a/src/toolbars/ToolBar.cpp b/src/toolbars/ToolBar.cpp index 070d7ccdc..601ba8b13 100644 --- a/src/toolbars/ToolBar.cpp +++ b/src/toolbars/ToolBar.cpp @@ -3,7 +3,7 @@ Audacity: A Digital Audio Editor ToolBar.cpp - + Dominic Mazzoni Shane T. Mueller Leland Lucius @@ -19,7 +19,7 @@ *//*******************************************************************//** \class ToolBar -\brief Works with ToolManager and ToolDock to provide a dockable window +\brief Works with ToolManager and ToolDock to provide a dockable window in which buttons can be placed. *//**********************************************************************/ @@ -80,7 +80,7 @@ BEGIN_EVENT_TABLE( ToolBar, wxPanel ) EVT_LEFT_UP( ToolBar::OnLeftUp ) EVT_MOTION( ToolBar::OnMotion ) EVT_MOUSE_CAPTURE_LOST( ToolBar::OnCaptureLost ) -END_EVENT_TABLE() +END_EVENT_TABLE() // // Constructor @@ -481,12 +481,12 @@ AButton * ToolBar::MakeButton(teBmps eUp, teBmps eDisabled, wxWindowID id, wxPoint placement, - bool processdownevents, - wxSize size) + bool processdownevents, + wxSize size) { int xoff = (size.GetWidth() - theTheme.Image(eStandardUp).GetWidth())/2; int yoff = (size.GetHeight() - theTheme.Image(eStandardUp).GetHeight())/2; - + wxImage * up2 = OverlayImage(eUp, eStandardUp, xoff, yoff); wxImage * hilite2 = OverlayImage(eHilite, eStandardUp, xoff, yoff); wxImage * down2 = OverlayImage(eDown, eStandardDown, xoff + 1, yoff + 1); @@ -561,17 +561,17 @@ void ToolBar::OnPaint( wxPaintEvent & event ) for(y=0;yGetRed( 0, yPix), mpBackGradient->GetGreen( 0, yPix), mpBackGradient->GetBlue( 0, yPix)); // Set background colour so that controls placed on this // toolbar such as radio buttons will draw reasonably. - // It's a little tacky setting the background colour + // It's a little tacky setting the background colour // here, but we can't do it in the constructor as the gradient // may not be available yet. - // Better than this would be to set the colour when the image + // Better than this would be to set the colour when the image // is loaded. // We use the colour at the half way point as a suitable 'average'. if( y==(sz.y/2) ) @@ -673,7 +673,7 @@ void ToolBar::OnMotion( wxMouseEvent & event ) if( !HasCapture() ) { - // JKC: Wrong place for this? Surely the cursor should change on + // JKC: Wrong place for this? Surely the cursor should change on // mouse-down and capture-lost rather than with mouse movement? if( IsResizable() ) { @@ -707,7 +707,7 @@ void ToolBar::OnMotion( wxMouseEvent & event ) r.SetRight( psz.x - 3 ); } else - { + { // Remember for next go round mResizeStart = pos; } diff --git a/src/toolbars/ToolBar.h b/src/toolbars/ToolBar.h index 514d1091b..9df1c0dde 100644 --- a/src/toolbars/ToolBar.h +++ b/src/toolbars/ToolBar.h @@ -69,7 +69,7 @@ enum DeviceBarID, ToolBarCount }; - + class ToolBar:public wxPanel { @@ -113,7 +113,7 @@ class ToolBar:public wxPanel teBmps eDisabled, wxWindowID id, wxPoint placement, - bool processdownevents, + bool processdownevents, wxSize size); void SetButton(bool down, AButton *button); @@ -170,7 +170,7 @@ class ToolBar:public wxPanel void Init(wxWindow *parent, int type, const wxString & title, const wxString & label); wxWindow *mParent; - + Grabber *mGrabber; wxBoxSizer *mHSizer; wxSizerItem *mSpacer; diff --git a/src/toolbars/ToolDock.cpp b/src/toolbars/ToolDock.cpp index 692d55c2a..5edfb3426 100644 --- a/src/toolbars/ToolDock.cpp +++ b/src/toolbars/ToolDock.cpp @@ -3,7 +3,7 @@ Audacity: A Digital Audio Editor ToolBar.cpp - + Dominic Mazzoni Shane T. Mueller Leland Lucius @@ -80,7 +80,7 @@ ToolDock::ToolDock( ToolManager *manager, wxWindow *parent, int dockid ): // Use for testing gaps // SetOwnBackgroundColour( wxColour( 255, 0, 0 ) ); -} +} // // Destructer @@ -189,7 +189,7 @@ void ToolDock::LayoutToolBars() // Will this one fit in remaining horizontal space? if( ( tw > stack[ stkcnt ].GetWidth() ) || - ( th > stack[ stkcnt ].GetHeight() ) ) + ( th > stack[ stkcnt ].GetHeight() ) ) { // Destack entries until one is found in which this bar // will fit or until we run out of stacked entries @@ -343,7 +343,7 @@ int ToolDock::PositionBar( ToolBar *t, wxPoint & pos, wxRect & rect ) // Will this one fit in remaining horizontal space? if( ( tw > stack[ stkcnt ].GetWidth() ) || - ( th > stack[ stkcnt ].GetHeight() ) ) + ( th > stack[ stkcnt ].GetHeight() ) ) { // Destack entries until one is found in which this bar // will fit or until we run out of stacked entries @@ -475,7 +475,7 @@ void ToolDock::Updated() GetParent()->GetEventHandler()->AddPendingEvent( e ); } -// +// // Handle grabber clicking // void ToolDock::OnGrabber( GrabberEvent & event ) diff --git a/src/toolbars/ToolDock.h b/src/toolbars/ToolDock.h index a37d50dde..6f19d9e5f 100644 --- a/src/toolbars/ToolDock.h +++ b/src/toolbars/ToolDock.h @@ -44,7 +44,7 @@ enum BotDockID, DockCount = 2 }; - + class ToolDock:public wxPanel { diff --git a/src/toolbars/ToolManager.cpp b/src/toolbars/ToolManager.cpp index 4dbe57d68..011193e6a 100644 --- a/src/toolbars/ToolManager.cpp +++ b/src/toolbars/ToolManager.cpp @@ -3,7 +3,7 @@ Audacity: A Digital Audio Editor ToolManager.cpp - + Dominic Mazzoni Shane T. Mueller Leland Lucius @@ -159,7 +159,7 @@ class ToolFrame:public wxFrame mManager->ProcessEvent( event ); } - // + // // Handle toolbar updates // void OnToolBarUpdate( wxCommandEvent & event ) @@ -227,7 +227,7 @@ class ToolFrame:public wxFrame if( rect.height < mMinSize.y ) { rect.height = mMinSize.y; - } + } SetMinSize( rect.GetSize() ); SetSize( rect.GetSize() ); @@ -420,7 +420,7 @@ ToolManager::ToolManager( AudacityProject *parent ) // Process the toolbar config settings ReadConfig(); -} +} // // Destructer @@ -524,7 +524,7 @@ void ToolManager::Reset() // SetVUMeters(AudacityProject *p); LayoutToolBars(); Updated(); -} +} // // Read the toolbar states @@ -544,7 +544,7 @@ void ToolManager::ReadConfig() // Disable window animation wxSystemOptions::SetOption( wxMAC_WINDOW_PLAIN_TRANSITION, 1 ); #endif - + // Invalidate all order entries for( dock = 0; dock < DockCount; dock++ ) { @@ -682,7 +682,7 @@ void ToolManager::ReadConfig() // Dock it d->Dock( t ); - // Hide the bar + // Hide the bar if( !show[ t->GetId() ] ) { d->ShowHide( t->GetId() ); @@ -698,7 +698,7 @@ void ToolManager::ReadConfig() // Dock it d->Dock( t ); - // Hide the bar + // Hide the bar if( !show[ t->GetId() ] ) { d->ShowHide( t->GetId() ); @@ -888,7 +888,7 @@ void ToolManager::LayoutToolBars() // void ToolManager::UpdatePrefs() { - for( int ndx = 0; ndx < ToolBarCount; ndx++ ) + for( int ndx = 0; ndx < ToolBarCount; ndx++ ) { ToolBar *bar = mBars[ ndx ]; if( bar ) @@ -1043,7 +1043,7 @@ void ToolManager::OnMouse( wxMouseEvent & event ) // Hide the indicator if it's still shown if( mBarPos.x != -1 ) { - // Hide any + // Hide any mIndicator->Hide(); mBarPos.x = -1; mBarPos.y = -1; @@ -1158,7 +1158,7 @@ void ToolManager::OnGrabber( GrabberEvent & event ) // Calculate the drag offset wxPoint mp = event.GetPosition(); - mDragOffset = mp - + mDragOffset = mp - mDragBar->GetParent()->ClientToScreen( mDragBar->GetPosition() ) + wxPoint( 1, 1 ); @@ -1181,7 +1181,7 @@ void ToolManager::OnGrabber( GrabberEvent & event ) // Make sure the ferry is visible mDragWindow->Show(); - + // Notify parent of change Updated(); diff --git a/src/toolbars/ToolsToolBar.cpp b/src/toolbars/ToolsToolBar.cpp index a964b77f1..2fcecab28 100644 --- a/src/toolbars/ToolsToolBar.cpp +++ b/src/toolbars/ToolsToolBar.cpp @@ -7,7 +7,7 @@ Dominic Mazzoni Shane T. Mueller Leland Lucius - + See ToolsToolBar.h for details *******************************************************************//*! @@ -115,27 +115,27 @@ void ToolsToolBar::Create(wxWindow * parent) mCurrentTool = multiTool; else mCurrentTool = selectTool; - + mTool[mCurrentTool]->PushDown(); } void ToolsToolBar::RegenerateToolsTooltips() { -// JKC: +// JKC: // Under Win98 Tooltips appear to be buggy, when you have a lot of -// tooltip messages flying around. I found that just creating a -// twelfth tooltip caused Audacity to crash when it tried to show +// tooltip messages flying around. I found that just creating a +// twelfth tooltip caused Audacity to crash when it tried to show // any tooltip. // -// Win98 does NOT recover from this crash - for any application which is +// Win98 does NOT recover from this crash - for any application which is // using tooltips will also crash thereafter... so you must reboot. -// Rather weird. +// Rather weird. // // Getting windows to process more of its stacked up messages seems // to workaround the problem. The problem is not fully understood though // (as of April 2003). - + // Vaughan, October 2003: Now we're crashing on Win2K if // "Quit when closing last window" is unchecked, when we come back // through here, on either of the wxSafeYield calls. @@ -161,7 +161,7 @@ void ToolsToolBar::UpdatePrefs() RegenerateToolsTooltips(); } -AButton * ToolsToolBar::MakeTool( teBmps eTool, +AButton * ToolsToolBar::MakeTool( teBmps eTool, int id, const wxChar *label) { AButton *button = ToolBar::MakeButton( @@ -174,7 +174,7 @@ AButton * ToolsToolBar::MakeTool( teBmps eTool, mToolSizer->Add( button ); return button; } - + void ToolsToolBar::Populate() { @@ -206,15 +206,15 @@ int ToolsToolBar::GetCurrentTool() /// @param show - should we update the button display? void ToolsToolBar::SetCurrentTool(int tool, bool show) { - //In multi-mode the current tool is shown by the + //In multi-mode the current tool is shown by the //cursor icon. The buttons are not updated. - + bool leavingMulticlipMode = IsDown(multiTool) && show && tool != multiTool; - + if (leavingMulticlipMode) mTool[multiTool]->PopUp(); - + if (tool != mCurrentTool || leavingMulticlipMode) { if (show) mTool[mCurrentTool]->PopUp(); @@ -246,9 +246,9 @@ bool ToolsToolBar::IsDown(int tool) int ToolsToolBar::GetDownTool() { int tool; - + for (tool = firstTool; tool <= lastTool; tool++) - if (IsDown(tool)) + if (IsDown(tool)) return tool; return firstTool; // Should never happen @@ -266,7 +266,7 @@ void ToolsToolBar::OnTool(wxCommandEvent & evt) { mCurrentTool = evt.GetId() - firstTool; for (int i = 0; i < numTools; i++) - if (i == mCurrentTool) + if (i == mCurrentTool) mTool[i]->PushDown(); else mTool[i]->PopUp(); diff --git a/src/toolbars/ToolsToolBar.h b/src/toolbars/ToolsToolBar.h index 85a5248cc..4481831ad 100644 --- a/src/toolbars/ToolsToolBar.h +++ b/src/toolbars/ToolsToolBar.h @@ -2,9 +2,9 @@ Audacity: A Digital Audio Editor - + ToolsToolBar.h - + Dominic Mazzoni Shane T. Mueller Leland Lucius diff --git a/src/toolbars/TranscriptionToolBar.cpp b/src/toolbars/TranscriptionToolBar.cpp index f7fbedb2b..29451d25d 100644 --- a/src/toolbars/TranscriptionToolBar.cpp +++ b/src/toolbars/TranscriptionToolBar.cpp @@ -47,7 +47,7 @@ IMPLEMENT_CLASS(TranscriptionToolBar, ToolBar); /////////////////////////////////////////// /// Methods for TranscriptionToolBar /////////////////////////////////////////// - + BEGIN_EVENT_TABLE(TranscriptionToolBar, ToolBar) EVT_CHAR(TranscriptionToolBar::OnKeyEvent) @@ -148,7 +148,7 @@ AButton *TranscriptionToolBar::AddButton( bmpRecoloredUpSmall, bmpRecoloredDownSmall, bmpRecoloredHiliteSmall, eFore, eFore, eDisabled, wxWindowID(id), - wxDefaultPosition, + wxDefaultPosition, false, theTheme.ImageSize( bmpRecoloredUpSmall )); @@ -169,12 +169,12 @@ void TranscriptionToolBar::Populate() AddButton(bmpPlay, bmpPlayDisabled, TTB_PlaySpeed, _("Play at selected speed")); - + //Add a slider that controls the speed of playback. const int SliderWidth=100; mPlaySpeedSlider = new ASlider(this, TTB_PlaySpeedSlider, - _("Playback Speed"), + _("Playback Speed"), wxDefaultPosition, wxSize(SliderWidth,25), SPEED_SLIDER); @@ -193,7 +193,7 @@ void TranscriptionToolBar::Populate() this); #ifdef EXPERIMENTAL_VOICE_DETECTION -// If we need these strings translated, then search and replace +// If we need these strings translated, then search and replace // TRANSLATBLE by _ and remove this #define. #define TRANSLATABLE( x ) wxT( x ) AddButton(bmpTnStartOn, bmpTnStartOnDisabled, TTB_StartOn, @@ -210,11 +210,11 @@ void TranscriptionToolBar::Populate() TRANSLATABLE("Select region of silence around cursor")); AddButton(bmpTnAutomateSelection, bmpTnAutomateSelectionDisabled, TTB_AutomateSelection, TRANSLATABLE("Automatically make labels from words")); - AddButton(bmpTnMakeTag, bmpTnMakeTagDisabled, TTB_MakeLabel, + AddButton(bmpTnMakeTag, bmpTnMakeTagDisabled, TTB_MakeLabel, TRANSLATABLE("Add label at selection")); AddButton(bmpTnCalibrate, bmpTnCalibrateDisabled, TTB_Calibrate, TRANSLATABLE("Calibrate voicekey")); - + mSensitivitySlider = new ASlider(this, TTB_SensitivitySlider, TRANSLATABLE("Adjust Sensitivity"), @@ -233,7 +233,7 @@ void TranscriptionToolBar::Populate() TRANSLATABLE("Direction Changes (Low Threshold)"), TRANSLATABLE("Direction Changes (High Threshold)") }; - + mKeyTypeChoice = new wxChoice(this, TTB_KeyType, wxDefaultPosition, wxDefaultSize, @@ -277,7 +277,7 @@ void TranscriptionToolBar::RegenerateTooltips() mButtons[TTB_AutomateSelection]->SetToolTip( TRANSLATABLE("Make Labels")); mButtons[TTB_MakeLabel]->SetToolTip( TRANSLATABLE("Add Label")); mButtons[TTB_Calibrate]->SetToolTip( TRANSLATABLE("Calibrate")); - + mSensitivitySlider->SetToolTip(TRANSLATABLE("Sensitivity")); mKeyTypeChoice->SetToolTip(TRANSLATABLE("Key type")); #endif @@ -323,7 +323,7 @@ void TranscriptionToolBar::OnKeyEvent(wxKeyEvent & event) event.Skip(); return; } - + if (event.GetKeyCode() == WXK_SPACE) { if (gAudioIO->IsBusy()) { /*Do Stuff Here*/ @@ -349,7 +349,7 @@ void TranscriptionToolBar::SetButton(bool down, AButton* button) void TranscriptionToolBar::GetSamples(WaveTrack *t, sampleCount *s0, sampleCount *slen) { - // GetSamples attempts to translate the start and end selection markers into sample indices + // GetSamples attempts to translate the start and end selection markers into sample indices // These selection numbers are doubles. AudacityProject *p = GetActiveProject(); @@ -359,10 +359,10 @@ void TranscriptionToolBar::GetSamples(WaveTrack *t, sampleCount *s0, sampleCount //First, get the current selection. It is part of the mViewInfo, which is //part of the project - + double start = p->GetSel0(); double end = p->GetSel1(); - + sampleCount ss0 = sampleCount( (start - t->GetOffset()) * t->GetRate() ); sampleCount ss1 = sampleCount( (end - t->GetOffset()) * t->GetRate() ); @@ -402,7 +402,7 @@ void TranscriptionToolBar::OnPlaySpeed(wxCommandEvent & WXUNUSED(event)) } // Pop up the button - SetButton(false, mButtons[TTB_PlaySpeed]); + SetButton(false, mButtons[TTB_PlaySpeed]); // If IO is busy, abort immediately if (gAudioIO->IsBusy()) { @@ -459,21 +459,21 @@ void TranscriptionToolBar::OnStartOn(wxCommandEvent & WXUNUSED(event)) TrackListOfKindIterator iter(Track::Wave, tl); Track *t = iter.First(); //Make a track - if(t ) { + if(t ) { sampleCount start,len; GetSamples((WaveTrack*)t, &start,&len); - + //Adjust length to end if selection is null //if(len == 0) //len = (WaveTrack*)t->GetSequence()->GetNumSamples()-start; - + sampleCount newstart = mVk->OnForward(*(WaveTrack*)t,start,len); double newpos = newstart / ((WaveTrack*)t)->GetRate(); - + p->SetSel0(newpos); p->RedrawProject(); - SetButton(false, mButtons[TTB_StartOn]); + SetButton(false, mButtons[TTB_StartOn]); } } @@ -486,27 +486,27 @@ void TranscriptionToolBar::OnStartOff(wxCommandEvent & WXUNUSED(event)) } mVk->AdjustThreshold(GetSensitivity()); AudacityProject *p = GetActiveProject(); - + TrackList *tl = p->GetTracks(); TrackListOfKindIterator iter(Track::Wave, tl); - + SetButton(false, mButtons[TTB_StartOff]); Track *t = iter.First(); //Make a track - if(t) { + if(t) { sampleCount start,len; GetSamples((WaveTrack*)t, &start,&len); - + //Adjust length to end if selection is null //if(len == 0) //len = (WaveTrack*)t->GetSequence()->GetNumSamples()-start; - + sampleCount newstart = mVk->OffForward(*(WaveTrack*)t,start,len); double newpos = newstart / ((WaveTrack*)t)->GetRate(); - + p->SetSel0(newpos); p->RedrawProject(); - - SetButton(false, mButtons[TTB_StartOn]); + + SetButton(false, mButtons[TTB_StartOn]); } } @@ -518,17 +518,17 @@ void TranscriptionToolBar::OnEndOn(wxCommandEvent & WXUNUSED(event)) SetButton(false,mButtons[TTB_EndOn]); return; } - + mVk->AdjustThreshold(GetSensitivity()); AudacityProject *p = GetActiveProject(); TrackList *tl = p->GetTracks(); TrackListOfKindIterator iter(Track::Wave, tl); Track *t = iter.First(); //Make a track - if(t) { + if(t) { sampleCount start,len; GetSamples((WaveTrack*)t, &start,&len); - + //Adjust length to end if selection is null if(len == 0) { @@ -537,11 +537,11 @@ void TranscriptionToolBar::OnEndOn(wxCommandEvent & WXUNUSED(event)) } sampleCount newEnd = mVk->OnBackward(*(WaveTrack*)t,start+ len,len); double newpos = newEnd / ((WaveTrack*)t)->GetRate(); - + p->SetSel1(newpos); p->RedrawProject(); - - SetButton(false, mButtons[TTB_EndOn]); + + SetButton(false, mButtons[TTB_EndOn]); } } @@ -561,10 +561,10 @@ void TranscriptionToolBar::OnEndOff(wxCommandEvent & WXUNUSED(event)) TrackListOfKindIterator iter(Track::Wave, tl); Track *t = iter.First(); //Make a track - if(t) { + if(t) { sampleCount start,len; GetSamples((WaveTrack*)t, &start,&len); - + //Adjust length to end if selection is null if(len == 0) { len = start; @@ -572,10 +572,10 @@ void TranscriptionToolBar::OnEndOff(wxCommandEvent & WXUNUSED(event)) } sampleCount newEnd = mVk->OffBackward(*(WaveTrack*)t,start+ len,len); double newpos = newEnd / ((WaveTrack*)t)->GetRate(); - + p->SetSel1(newpos); p->RedrawProject(); - + SetButton(false, mButtons[TTB_EndOff]); } } @@ -594,21 +594,21 @@ void TranscriptionToolBar::OnSelectSound(wxCommandEvent & WXUNUSED(event)) mVk->AdjustThreshold(GetSensitivity()); AudacityProject *p = GetActiveProject(); - - + + TrackList *tl = p->GetTracks(); TrackListIterator iter(tl); Track *t = iter.First(); //Make a track - if(t) - { + if(t) + { sampleCount start,len; GetSamples((WaveTrack*)t, &start,&len); - + //Adjust length to end if selection is null //if(len == 0) //len = (WaveTrack*)t->GetSequence()->GetNumSamples()-start; - + double rate = ((WaveTrack*)t)->GetRate(); sampleCount newstart = mVk->OffBackward(*(WaveTrack*)t,start,start); sampleCount newend = mVk->OffForward(*(WaveTrack*)t,start+len,(int)(tl->GetEndTime()*rate)); @@ -619,7 +619,7 @@ void TranscriptionToolBar::OnSelectSound(wxCommandEvent & WXUNUSED(event)) p->RedrawProject(); } - + SetButton(false,mButtons[TTB_SelectSound]); } @@ -634,17 +634,17 @@ void TranscriptionToolBar::OnSelectSilence(wxCommandEvent & WXUNUSED(event)) mVk->AdjustThreshold(GetSensitivity()); AudacityProject *p = GetActiveProject(); - - + + TrackList *tl = p->GetTracks(); TrackListIterator iter(tl); Track *t = iter.First(); //Make a track - if(t) - { + if(t) + { sampleCount start,len; GetSamples((WaveTrack*)t, &start,&len); - + //Adjust length to end if selection is null //if(len == 0) //len = (WaveTrack*)t->GetSequence()->GetNumSamples()-start; @@ -658,7 +658,7 @@ void TranscriptionToolBar::OnSelectSilence(wxCommandEvent & WXUNUSED(event)) p->RedrawProject(); } - + SetButton(false,mButtons[TTB_SelectSilence]); } @@ -679,12 +679,12 @@ void TranscriptionToolBar::OnCalibrate(wxCommandEvent & WXUNUSED(event)) TrackList *tl = p->GetTracks(); TrackListIterator iter(tl); Track *t = iter.First(); //Get a track - - if(t) - { + + if(t) + { sampleCount start,len; GetSamples((WaveTrack*)t, &start,&len); - + mVk->CalibrateNoise(*((WaveTrack*)t),start,len); mVk->AdjustThreshold(3); @@ -694,15 +694,15 @@ void TranscriptionToolBar::OnCalibrate(wxCommandEvent & WXUNUSED(event)) mButtons[TTB_EndOff]->Enable(); //mThresholdSensitivity->Set(3); - SetButton(false,mButtons[TTB_Calibrate]); + SetButton(false,mButtons[TTB_Calibrate]); } - + mButtons[TTB_StartOn]->Enable(); mButtons[TTB_StartOff]->Enable(); mButtons[TTB_EndOn]->Enable(); mButtons[TTB_EndOff]->Enable(); - mButtons[TTB_SelectSound]->Enable(); - mButtons[TTB_SelectSilence]->Enable(); + mButtons[TTB_SelectSound]->Enable(); + mButtons[TTB_SelectSilence]->Enable(); mButtons[TTB_AutomateSelection]->Enable(); //Make the sensititivy slider set the sensitivity by processing an event. @@ -731,13 +731,13 @@ void TranscriptionToolBar::OnAutomateSelection(wxCommandEvent & WXUNUSED(event)) AudacityProject *p = GetActiveProject(); TrackList *tl = p->GetTracks(); TrackListIterator iter(tl); - + Track *t = iter.First(); //Make a track - if(t) - { + if(t) + { sampleCount start,len; GetSamples((WaveTrack*)t, &start,&len); - + //Adjust length to end if selection is null if(len == 0) { @@ -747,37 +747,37 @@ void TranscriptionToolBar::OnAutomateSelection(wxCommandEvent & WXUNUSED(event)) int lastlen = 0; sampleCount newStart, newEnd; double newStartPos, newEndPos; - + //This is the minumum word size in samples (.05 is 50 ms) int minWordSize = (int)(((WaveTrack*)t)->GetRate() * .05); - + //Continue until we have processed the entire //region, or we are making no progress. while(len > 0 && lastlen != len) { - + lastlen = len; - + newStart = mVk->OnForward(*(WaveTrack*)t,start,len); //JKC: If no start found then don't add any labels. if( newStart==start) break; - + //Adjust len by the new start position len -= (newStart - start); - + //Adjust len by the minimum word size len -= minWordSize; - - - //OK, now we have found a new starting point. A 'word' should be at least + + + //OK, now we have found a new starting point. A 'word' should be at least //50 ms long, so jump ahead minWordSize - + newEnd = mVk->OffForward(*(WaveTrack*)t,newStart+minWordSize, len); - + //If newEnd didn't move, we should give up, because // there isn't another end before the end of the selection. if(newEnd == (newStart + minWordSize)) @@ -786,15 +786,15 @@ void TranscriptionToolBar::OnAutomateSelection(wxCommandEvent & WXUNUSED(event)) //Adjust len by the new word end len -= (newEnd - newStart); - + //Calculate the start and end of the words, in seconds newStartPos = newStart / ((WaveTrack*)t)->GetRate(); newEndPos = newEnd / ((WaveTrack*)t)->GetRate(); - - + + //Increment start = newEnd; - + p->DoAddLabel(newStartPos, newEndPos); p->RedrawProject(); } @@ -805,7 +805,7 @@ void TranscriptionToolBar::OnAutomateSelection(wxCommandEvent & WXUNUSED(event)) void TranscriptionToolBar::OnMakeLabel(wxCommandEvent & WXUNUSED(event)) { AudacityProject *p = GetActiveProject(); - SetButton(false, mButtons[TTB_MakeLabel]); + SetButton(false, mButtons[TTB_MakeLabel]); p->DoAddLabel(p->GetSel0(), p->GetSel1()); } diff --git a/src/toolbars/TranscriptionToolBar.h b/src/toolbars/TranscriptionToolBar.h index 630bedeac..47264e2ca 100644 --- a/src/toolbars/TranscriptionToolBar.h +++ b/src/toolbars/TranscriptionToolBar.h @@ -61,7 +61,7 @@ enum class TranscriptionToolBar:public ToolBar { public: - + TranscriptionToolBar(); virtual ~TranscriptionToolBar(); @@ -106,18 +106,18 @@ class TranscriptionToolBar:public ToolBar { void GetSamples(WaveTrack *t, sampleCount *s0, sampleCount *slen); void SetButton(bool newstate, AButton *button); void RegenerateTooltips(); - + AButton *mButtons[TTBNumButtons]; wxImage *upImage; wxImage *downImage; wxImage *hiliteImage; - + ASlider *mPlaySpeedSlider; double mPlaySpeed; ASlider *mSensitivitySlider; double mSensitivity; VoiceKey *mVk; - + wxBrush mBackgroundBrush; wxPen mBackgroundPen; int mBackgroundWidth; diff --git a/src/widgets/AButton.cpp b/src/widgets/AButton.cpp index e3c4ba5cc..795d1368c 100644 --- a/src/widgets/AButton.cpp +++ b/src/widgets/AButton.cpp @@ -12,11 +12,11 @@ \brief A wxButton with mouse-over behaviour. AButton is a custom button class for Audacity. The main feature it - supports that a wxButton does not is mouseovers. - - It uses an image for all of its states: up, over, down, and - disabled, allowing any sort of customization you want. Currently - it does not support transparency effects, so the image musts be + supports that a wxButton does not is mouseovers. + + It uses an image for all of its states: up, over, down, and + disabled, allowing any sort of customization you want. Currently + it does not support transparency effects, so the image musts be rectangular and opaque. *//*******************************************************************/ @@ -156,7 +156,7 @@ void AButton::SetAlternateImages(ImageRoll up, void AButton::SetAlternate(bool useAlternateImages) { - // If alternate-image-state is already correct then + // If alternate-image-state is already correct then // nothing to do (saves repainting button). if( mAlternate == useAlternateImages ) return; @@ -208,7 +208,7 @@ AButton::AButtonState AButton::GetState() state = mButtonIsDown ? AButtonDown : AButtonUp; } } - + return state; } @@ -283,15 +283,15 @@ void AButton::OnMouseEvent(wxMouseEvent & event) mButtonIsDown = !mButtonIsDown; else mButtonIsDown = true; - + mWasShiftDown = event.ShiftDown(); mWasControlDown = event.ControlDown(); - + Click(); } } } - + // Only redraw and change tooltips if the state has changed. AButtonState newState = GetState(); diff --git a/src/widgets/ASlider.cpp b/src/widgets/ASlider.cpp index b3a79cd7e..a7f6449bb 100644 --- a/src/widgets/ASlider.cpp +++ b/src/widgets/ASlider.cpp @@ -9,16 +9,16 @@ *******************************************************************//** \class ASlider -\brief ASlider is a custom slider, allowing for a slicker look and +\brief ASlider is a custom slider, allowing for a slicker look and feel. -It allows you to use images for the slider background and +It allows you to use images for the slider background and the thumb. *//****************************************************************//** \class LWSlider -\brief Lightweight version of ASlider. In other words it does not +\brief Lightweight version of ASlider. In other words it does not have a window permanently associated with it. *//****************************************************************//** @@ -234,10 +234,10 @@ BEGIN_EVENT_TABLE(SliderDialog, wxDialog) END_EVENT_TABLE(); SliderDialog::SliderDialog(wxWindow * parent, wxWindowID id, - const wxString & title, + const wxString & title, wxPoint position, wxSize size, - int style, + int style, float value, float line, float page): @@ -245,7 +245,7 @@ SliderDialog::SliderDialog(wxWindow * parent, wxWindowID id, mStyle(style) { ShuttleGui S(this, eIsCreating); - + S.StartVerticalLay(); { mTextCtrl = S.AddTextBox(wxEmptyString, @@ -264,7 +264,7 @@ SliderDialog::SliderDialog(wxWindow * parent, wxWindowID id, S.AddWindow(mSlider, wxEXPAND); } S.EndVerticalLay(); - + S.AddStandardButtons(eOkButton | eCancelButton); Fit(); @@ -348,8 +348,8 @@ void LWSlider::SetStyle(int style) mMinValue = DB_MIN; if (mOrientation == wxHORIZONTAL) mMaxValue = DB_MAX; - else - mMaxValue = DB_MAX; // for MixerBoard //v Previously was 6dB for MixerBoard, but identical for now. + else + mMaxValue = DB_MAX; // for MixerBoard //v Previously was 6dB for MixerBoard, but identical for now. mStepValue = 1.0f; mSpeed = 0.5; mName = _("Gain"); @@ -390,7 +390,7 @@ LWSlider::LWSlider(wxWindow *parent, int style, bool heavyweight /* = false */, bool popup /* = true */, - int orientation /* = wxHORIZONTAL */) // wxHORIZONTAL or wxVERTICAL. wxVERTICAL is currently only for DB_SLIDER. + int orientation /* = wxHORIZONTAL */) // wxHORIZONTAL or wxVERTICAL. wxVERTICAL is currently only for DB_SLIDER. { wxString leftLabel, rightLabel; #ifdef EXPERIMENTAL_MIDI_OUT @@ -417,8 +417,8 @@ LWSlider::LWSlider(wxWindow *parent, minValue = -36.0f; if (orientation == wxHORIZONTAL) maxValue = 36.0f; - else - maxValue = 36.0f; // for MixerBoard //v Previously was 6dB for MixerBoard, but identical for now. + else + maxValue = 36.0f; // for MixerBoard //v Previously was 6dB for MixerBoard, but identical for now. stepValue = 1.0f; speed = 0.5; break; @@ -457,8 +457,8 @@ void LWSlider::Init(wxWindow * parent, int style, bool heavyweight, bool popup, - float speed, - int orientation /* = wxHORIZONTAL */) // wxHORIZONTAL or wxVERTICAL. wxVERTICAL is currently only for DB_SLIDER. + float speed, + int orientation /* = wxHORIZONTAL */) // wxHORIZONTAL or wxVERTICAL. wxVERTICAL is currently only for DB_SLIDER. { mEnabled = true; mName = name; @@ -519,7 +519,7 @@ void LWSlider::SetDefaultValue(float value) void LWSlider::SetDefaultShortcut(bool value) { - mDefaultShortcut = value; + mDefaultShortcut = value; } void LWSlider::GetScroll(float & line, float & page) @@ -540,12 +540,12 @@ wxWindow* LWSlider::GetToolTipParent() const while(top && top->GetParent()) { top = top->GetParent(); } - + return top; } void LWSlider::CreatePopWin() -{ +{ maxTipLabel = mName + wxT(": 000000"); if (mStyle == PAN_SLIDER || mStyle == DB_SLIDER || mStyle == SPEED_SLIDER @@ -555,7 +555,7 @@ void LWSlider::CreatePopWin() ) maxTipLabel += wxT("000"); - + if(!LWSlider::sharedTipPanel) { #ifdef USE_POPUPWIN TipPanel::sharedDummyParent = new wxFrame(NULL, -1, wxT("offscreentip"), wxPoint(kDummyOffsetX, kDummyOffsetY)); @@ -703,7 +703,7 @@ void LWSlider::Draw() if (mOrientation == wxHORIZONTAL) mCenterY = mHeight - 9; else - mCenterX = mWidth - 9; + mCenterX = mWidth - 9; mThumbWidth = mThumbBitmap->GetWidth(); mThumbHeight = mThumbBitmap->GetHeight(); @@ -717,7 +717,7 @@ void LWSlider::Draw() else { mTopY = mThumbWidth/2; - mBottomY = mHeight - mThumbWidth/2 - 1; + mBottomY = mHeight - mThumbWidth/2 - 1; mHeightY = mBottomY - mTopY; } @@ -729,7 +729,7 @@ void LWSlider::Draw() // cleared. dc->SelectObject(*mBitmap); - wxColour TransparentColour = wxColour( 255, 254, 255 ); + wxColour TransparentColour = wxColour( 255, 254, 255 ); // DO-THEME Mask colour!! JC-Aug-2007 // Needed with experimental theming! // ... because windows blends against this colour. @@ -767,7 +767,7 @@ void LWSlider::Draw() dc->SetTextBackground( theTheme.Colour( clrTrackInfo ) ); dc->SetBackground( theTheme.Colour( clrTrackInfo ) ); // HAVE to use solid and not transparent here, - // otherwise windows will do it's clever font optimisation trick, + // otherwise windows will do it's clever font optimisation trick, // but against a default colour of white, which is not OK on a dark // background. dc->SetBackgroundMode( wxSOLID ); @@ -803,12 +803,12 @@ void LWSlider::Draw() AColor::Line(*dc, mRightX-5, mCenterY-10, mRightX-1, mCenterY-10); AColor::Line(*dc, mRightX-3, mCenterY-12, mRightX-3, mCenterY-8); } - else + else { - // Vertical DB_SLIDER is for gain slider in MixerBoard. + // Vertical DB_SLIDER is for gain slider in MixerBoard. // We use a Ruler instead of marks & ticks. - // Draw '+' and '-' only for other vertical sliders. - if (mStyle != DB_SLIDER) + // Draw '+' and '-' only for other vertical sliders. + if (mStyle != DB_SLIDER) { AColor::Line(*dc, mCenterX-12, mBottomY-3, mCenterX-8, mBottomY-3); AColor::Line(*dc, mCenterX-12, mTopY+3, mCenterX-8, mTopY+3); @@ -841,19 +841,19 @@ void LWSlider::Draw() // mpRuler->SetRange(mMaxValue, mMinValue); // mpRuler->SetFormat(Ruler::LinearDBFormat); // } - // mpRuler->SetBounds(mLeft, mTop, mWidth, mHeightY); //v Why the magic number reqd on height to get it to line up? + 9); + // mpRuler->SetBounds(mLeft, mTop, mWidth, mHeightY); //v Why the magic number reqd on height to get it to line up? + 9); // mpRuler->Draw(*dc); //} - //else + //else { // tick marks int divs = 10; double upp; - if (mOrientation == wxHORIZONTAL) + if (mOrientation == wxHORIZONTAL) upp = divs / (double)(mWidthX-1); - else + else { - if (mStyle == DB_SLIDER) + if (mStyle == DB_SLIDER) divs = mMaxValue - mMinValue + 1; upp = divs / (double)(mHeightY-1); } @@ -881,7 +881,7 @@ void LWSlider::Draw() } } - + // Must preceed creating the mask as that will attempt to // select the bitmap into another DC. delete dc; @@ -899,14 +899,14 @@ void LWSlider::FormatPopWin() case FRAC_SLIDER: label.Printf(wxT("%s: %.2f"), mName.c_str(), mCurrentValue); break; - + case DB_SLIDER: valstr.Printf(wxT("%.1f"), mCurrentValue); if (valstr.Right(1) == wxT("0")) valstr = valstr.Left(valstr.Length() - 2); if (mCurrentValue > 0) valstr = wxT("+") + valstr; - + label.Printf(wxT("%s: %s dB"), mName.c_str(), valstr.c_str()); break; case PAN_SLIDER: @@ -921,15 +921,15 @@ void LWSlider::FormatPopWin() label.Printf(wxT("%s: %.0f%% %s"), mName.c_str(), mCurrentValue * 100.0f, _("Right")); } - + break; case SPEED_SLIDER: label.Printf(wxT("%s: %.2fx"), mName.c_str(), mCurrentValue); break; #ifdef EXPERIMENTAL_MIDI_OUT case VEL_SLIDER: - label.Printf(wxT("%s: %s%d"), mName.c_str(), - (mCurrentValue > 0.0f ? _("+") : wxT("")), + label.Printf(wxT("%s: %s%d"), mName.c_str(), + (mCurrentValue > 0.0f ? _("+") : wxT("")), (int) mCurrentValue); #endif } @@ -994,7 +994,7 @@ void LWSlider::OnMouseEvent(wxMouseEvent & event) if (event.Entering()) { #if wxUSE_TOOLTIPS // Not available in wxX11 // Display the tooltip in the status bar - if (mParent->GetToolTip()) + if (mParent->GetToolTip()) { wxString tip = mParent->GetToolTip()->GetTip(); GetActiveProject()->TP_DisplayStatusMessage(tip); @@ -1021,7 +1021,7 @@ void LWSlider::OnMouseEvent(wxMouseEvent & event) r.x = mLeft + ValueToPosition(mCurrentValue); r.y = mTop + (mCenterY - (mThumbHeight / 2)); } - else + else { r.x = mLeft + (mCenterX - (mThumbWidth / 2)); r.y = mTop + ValueToPosition(mCurrentValue); @@ -1064,9 +1064,9 @@ void LWSlider::OnMouseEvent(wxMouseEvent & event) // Clicked to set location? else { - mCurrentValue = + mCurrentValue = ClickPositionToValue( - (mOrientation == wxHORIZONTAL) ? event.m_x : event.m_y, + (mOrientation == wxHORIZONTAL) ? event.m_x : event.m_y, event.ShiftDown()); } @@ -1237,7 +1237,7 @@ int LWSlider::ValueToPosition(float val) if (mOrientation == wxHORIZONTAL) return (int)rint((val - mMinValue) * mWidthX / fRange); else - // low values at bottom + // low values at bottom return (int)rint((mMaxValue - val) * mHeightY / fRange); } @@ -1295,14 +1295,14 @@ float LWSlider::ClickPositionToValue(int fromPos, bool shiftDown) float LWSlider::DragPositionToValue(int fromPos, bool shiftDown) { int delta = (fromPos - mClickPos); - + float speed = mSpeed; // Precision enhancement for Shift drags if (mCanUseShift && shiftDown) speed *= 0.4f; // wxVERTICAL => Low values at bottom, so throw in the minus sign here with -mHeightY. - float denominator = (mOrientation == wxHORIZONTAL) ? mWidthX : -mHeightY; + float denominator = (mOrientation == wxHORIZONTAL) ? mWidthX : -mHeightY; float val = mClickValue + speed * (delta / denominator) * (mMaxValue - mMinValue); @@ -1430,13 +1430,13 @@ END_EVENT_TABLE() ASlider::ASlider( wxWindow * parent, wxWindowID id, wxString name, - const wxPoint & pos, + const wxPoint & pos, const wxSize & size, int style, bool popup, bool canUseShift, - float stepValue, - int orientation /*= wxHORIZONTAL*/) + float stepValue, + int orientation /*= wxHORIZONTAL*/) : wxPanel( parent, id, pos, size, wxWANTS_CHARS ) { mLWSlider = new LWSlider( this, @@ -1445,7 +1445,7 @@ ASlider::ASlider( wxWindow * parent, size, style, canUseShift, - popup, + popup, orientation); mLWSlider->mStepValue = stepValue; mLWSlider->SetId( id ); @@ -1598,7 +1598,7 @@ bool ASlider::Enable(bool enable) { if (mLWSlider->GetEnabled() == enable) return false; - + mLWSlider->SetEnabled(enable); return true; } @@ -1610,7 +1610,7 @@ bool ASlider::IsEnabled() const #if wxUSE_ACCESSIBILITY -ASliderAx::ASliderAx( wxWindow * window ) : +ASliderAx::ASliderAx( wxWindow * window ) : wxWindowAccessible( window ) { } @@ -1796,7 +1796,7 @@ wxAccStatus ASliderAx::GetValue(int childId, wxString* strValue) case FRAC_SLIDER: strValue->Printf( wxT("%.0f"), as->mLWSlider->mCurrentValue * 100 ); break; - + case DB_SLIDER: strValue->Printf( wxT("%.0f"), as->mLWSlider->mCurrentValue ); break; @@ -1813,7 +1813,7 @@ wxAccStatus ASliderAx::GetValue(int childId, wxString* strValue) strValue->Printf( wxT("%.0f"), as->mLWSlider->mCurrentValue); break; #endif - + } return wxACC_OK; diff --git a/src/widgets/ASlider.h b/src/widgets/ASlider.h index d405a7aef..df52fdc1f 100644 --- a/src/widgets/ASlider.h +++ b/src/widgets/ASlider.h @@ -6,7 +6,7 @@ Dominic Mazzoni - This class is a custom slider. + This class is a custom slider. **********************************************************************/ @@ -38,7 +38,7 @@ class Ruler; #define FRAC_SLIDER 1 // 0.0...1.0 #define DB_SLIDER 2 // -36...36 dB #define PAN_SLIDER 3 // -1.0...1.0 -#define SPEED_SLIDER 4 // 0.01 ..3.0 +#define SPEED_SLIDER 4 // 0.01 ..3.0 #ifdef EXPERIMENTAL_MIDI_OUT #define VEL_SLIDER 5 // -50..50 #endif @@ -83,9 +83,9 @@ class LWSlider bool canUseShift, int style, bool heavyweight=false, - bool popup=true, + bool popup=true, int orientation = wxHORIZONTAL); // wxHORIZONTAL or wxVERTICAL. wxVERTICAL is currently only for DB_SLIDER. - + // Construct predefined slider LWSlider(wxWindow * parent, wxString name, @@ -93,7 +93,7 @@ class LWSlider const wxSize &size, int style, bool heavyweight=false, - bool popup=true, + bool popup=true, int orientation = wxHORIZONTAL); // wxHORIZONTAL or wxVERTICAL. wxVERTICAL is currently only for DB_SLIDER. void Init(wxWindow * parent, @@ -107,7 +107,7 @@ class LWSlider int style, bool heavyweight, bool popup, - float speed, + float speed, int orientation = wxHORIZONTAL); // wxHORIZONTAL or wxVERTICAL. wxVERTICAL is currently only for DB_SLIDER. virtual ~LWSlider(); @@ -148,7 +148,7 @@ class LWSlider void SetEnabled(bool enabled); bool GetEnabled(); - + static void DeleteSharedTipPanel(); private: @@ -165,11 +165,11 @@ class LWSlider int ValueToPosition(float val); float DragPositionToValue(int fromPos, bool shiftDown); float ClickPositionToValue(int fromPos, bool shiftDown); - + wxWindow* GetToolTipParent() const; - + wxWindow *mParent; - + wxString maxTipLabel; //string with the max num of chars for tip int mStyle; @@ -195,7 +195,7 @@ class LWSlider int mCenterX; int mTopY; - int mBottomY; // low values at bottom + int mBottomY; // low values at bottom int mHeightY; @@ -250,12 +250,12 @@ class ASlider :public wxPanel ASlider( wxWindow * parent, wxWindowID id, wxString name, - const wxPoint & pos, + const wxPoint & pos, const wxSize & size, int style = FRAC_SLIDER, bool popup = true, bool canUseShift = true, - float stepValue = STEP_CONTINUOUS, + float stepValue = STEP_CONTINUOUS, int orientation = wxHORIZONTAL); virtual ~ASlider(); @@ -313,15 +313,15 @@ class SliderDialog: public wxDialog { public: SliderDialog(wxWindow * parent, wxWindowID id, - const wxString & title, + const wxString & title, wxPoint position, - wxSize size, + wxSize size, int style, float value, float line, float page); ~SliderDialog(); - + float Get(); private: diff --git a/src/widgets/AttachableScrollBar.cpp b/src/widgets/AttachableScrollBar.cpp index 3278cc608..5e3221b12 100644 --- a/src/widgets/AttachableScrollBar.cpp +++ b/src/widgets/AttachableScrollBar.cpp @@ -5,18 +5,18 @@ AttachableScrollBar.cpp James Crook - + Audacity is free software. This file is licensed under the wxWidgets license, see License.txt *****************************************************************//** \class AttachableScrollBar -\brief An AttachableScrollBar is a scroll bar that can be attached -to multiple items and so control their scrolling. Uses floats +\brief An AttachableScrollBar is a scroll bar that can be attached +to multiple items and so control their scrolling. Uses floats internally, not ints, allowing for (external) control of zooming. - - Limitations: + + Limitations: - Currently horizontal only. - Attached item repainting not yet supported. Instead for now place the diff --git a/src/widgets/AttachableScrollBar.h b/src/widgets/AttachableScrollBar.h index b5c1ea002..a05f180bd 100644 --- a/src/widgets/AttachableScrollBar.h +++ b/src/widgets/AttachableScrollBar.h @@ -5,8 +5,8 @@ AttachableScrollBar.h James Crook - - A scroll bar that can be attached to multiple items and so control + + A scroll bar that can be attached to multiple items and so control their scrolling. Audacity is free software. diff --git a/src/widgets/ErrorDialog.cpp b/src/widgets/ErrorDialog.cpp index 7dee52ca8..1d49d889a 100644 --- a/src/widgets/ErrorDialog.cpp +++ b/src/widgets/ErrorDialog.cpp @@ -43,9 +43,9 @@ class ErrorDialog : public wxDialog { public: // constructors and destructors - ErrorDialog(wxWindow *parent, - const wxString & dlogTitle, - const wxString & message, + ErrorDialog(wxWindow *parent, + const wxString & dlogTitle, + const wxString & message, const wxString & helpURL, const bool Close = true, const bool modal = true); @@ -66,9 +66,9 @@ private: class AliasedFileMissingDialog : public ErrorDialog { public: - AliasedFileMissingDialog(AudacityProject *parent, - const wxString & dlogTitle, - const wxString & message, + AliasedFileMissingDialog(AudacityProject *parent, + const wxString & dlogTitle, + const wxString & message, const wxString & helpURL, const bool Close = true, const bool modal = true); virtual ~AliasedFileMissingDialog(); @@ -80,9 +80,9 @@ BEGIN_EVENT_TABLE(ErrorDialog, wxDialog) END_EVENT_TABLE() -AliasedFileMissingDialog::AliasedFileMissingDialog(AudacityProject *parent, - const wxString & dlogTitle, - const wxString & message, +AliasedFileMissingDialog::AliasedFileMissingDialog(AudacityProject *parent, + const wxString & dlogTitle, + const wxString & message, const wxString & helpURL, const bool Close, const bool modal): ErrorDialog(parent, dlogTitle, message, helpURL, Close, modal) @@ -96,9 +96,9 @@ AliasedFileMissingDialog::~AliasedFileMissingDialog() } ErrorDialog::ErrorDialog( - wxWindow *parent, - const wxString & dlogTitle, - const wxString & message, + wxWindow *parent, + const wxString & dlogTitle, + const wxString & message, const wxString & helpURL, const bool Close, const bool modal): wxDialog(parent, (wxWindowID)-1, dlogTitle) @@ -132,9 +132,9 @@ ErrorDialog::ErrorDialog( // Layout did not look good on Windows. wxBoxSizer *mainSizer = new wxBoxSizer(wxVERTICAL); wxBoxSizer *vSizer = new wxBoxSizer(wxVERTICAL); - + wxBoxSizer *hSizer = new wxBoxSizer(wxHORIZONTAL); - + wxStaticText *statText = new wxStaticText(this, -1, message); mainSizer->Add(statText, 0, wxALIGN_LEFT|wxALL, 5); @@ -145,11 +145,11 @@ ErrorDialog::ErrorDialog( ok->SetDefault(); ok->SetFocus(); hSizer->Add(ok, 0, wxALIGN_RIGHT|wxALL, 5); - + vSizer->Add(hSizer, 0, wxALIGN_CENTER|wxALL, 5); - + mainSizer->Add(vSizer, 0, wxALL, 15 ); - + SetAutoLayout(true); SetSizer(mainSizer); mainSizer->Fit(this); @@ -274,7 +274,7 @@ void ErrorDialog::OnHelp(wxCommandEvent & WXUNUSED(event)) if( dhelpURL.StartsWith(wxT("innerlink:")) ) { ShowHtmlText( - this, + this, TitleText(dhelpURL.Mid( 10 ) ), HelpText( dhelpURL.Mid( 10 )), false, @@ -306,7 +306,7 @@ void ShowModelessErrorDialog(wxWindow *parent, ErrorDialog *dlog = new ErrorDialog(parent, dlogTitle, message, helpURL, Close, false); dlog->CentreOnParent(); dlog->Show(); - // ANSWER-ME: Vigilant Sentry flags this method as not deleting dlog, so a mem leak. + // ANSWER-ME: Vigilant Sentry flags this method as not deleting dlog, so a mem leak. // ANSWER-ME: This is unused. Delete it or are there plans for it? } @@ -321,16 +321,16 @@ void ShowAliasMissingDialog(AudacityProject *parent, // instead put it just above or on the top of the project. wxPoint point; point.x = 0; - + point.y = parent ? parent->GetPosition().y - 200 : 100; - + if (point.y < 100) point.y = 100; dlog->SetPosition(point); dlog->CentreOnParent(wxHORIZONTAL); dlog->Show(); - // ANSWER-ME: Vigilant Sentry flags this method as not deleting dlog, so a mem leak. + // ANSWER-ME: Vigilant Sentry flags this method as not deleting dlog, so a mem leak. // ANSWER-ME: Why is this modeless? Shouldn't it require user action before proceeding? } @@ -353,7 +353,7 @@ void ShowInfoDialog( wxWindow *parent, S.StartVerticalLay(1); { S.AddTitle( shortMsg); - S.SetStyle( wxTE_MULTILINE | wxTE_READONLY | wxTE_RICH | wxTE_RICH2 | + S.SetStyle( wxTE_MULTILINE | wxTE_READONLY | wxTE_RICH | wxTE_RICH2 | wxTE_AUTO_URL | wxTE_NOHIDESEL | wxHSCROLL ); S.AddTextWindow(message); } @@ -418,9 +418,9 @@ void ShowHelpDialog(wxWindow *parent, Text.Replace( wxT("*URL*"), remoteURL ); ShowHtmlText( parent, _("Help on the Internet"), Text ); } - else if( HelpMode == wxT("Local") ) + else if( HelpMode == wxT("Local") ) { - // Local file, External browser + // Local file, External browser OpenInDefaultBrowser( wxString(wxT("file:"))+localFileName ); } else diff --git a/src/widgets/ErrorDialog.h b/src/widgets/ErrorDialog.h index ad7352416..21040cb4f 100644 --- a/src/widgets/ErrorDialog.h +++ b/src/widgets/ErrorDialog.h @@ -21,21 +21,21 @@ class AudacityProject; /// Displays an error dialog with a button that offers help void ShowErrorDialog(wxWindow *parent, const wxString &dlogTitle, - const wxString &message, + const wxString &message, const wxString &helpURL, bool Close = true); /// Displays a modeless error dialog with a button that offers help void ShowModelessErrorDialog(wxWindow *parent, const wxString &dlogTitle, - const wxString &message, + const wxString &message, const wxString &helpURL, bool Close = true); /// Displays a custom modeless error dialog for aliased file errors void ShowAliasMissingDialog(AudacityProject *parent, const wxString &dlogTitle, - const wxString &message, + const wxString &message, const wxString &helpURL, const bool Close = true); @@ -43,11 +43,11 @@ void ShowAliasMissingDialog(AudacityProject *parent, void ShowInfoDialog( wxWindow *parent, const wxString &dlogTitle, const wxString &shortMsg, - const wxString &message, + const wxString &message, const int xSize, const int ySize); /// Displays a new window with wxHTML help. -void ShowHtmlText( wxWindow * pParent, +void ShowHtmlText( wxWindow * pParent, const wxString &Title, const wxString &HtmlText, bool bIsFile, bool bModal); diff --git a/src/widgets/ExpandingToolBar.cpp b/src/widgets/ExpandingToolBar.cpp index 865341505..801aa534d 100644 --- a/src/widgets/ExpandingToolBar.cpp +++ b/src/widgets/ExpandingToolBar.cpp @@ -52,13 +52,13 @@ modeless presentation. \class ToolBarArea \brief An alterantive to ToolBarFrame which can contain an -ExpandingToolBar. ToolBarArea is used for a 'docked' ToolBar, +ExpandingToolBar. ToolBarArea is used for a 'docked' ToolBar, ToolBarFrame for a floating one. *//****************************************************************//** \class ToolBarArrangement -\brief Small class that holds some layout information for an +\brief Small class that holds some layout information for an ExpandingToolBar. *//*******************************************************************/ @@ -84,7 +84,7 @@ ExpandingToolBar. #include "../Experimental.h" const int kToggleButtonHeight = 8; -const int kTimerInterval = 50; // every 50 ms -> ~20 updates per second +const int kTimerInterval = 50; // every 50 ms -> ~20 updates per second const wxRect kDummyRect = wxRect(-9999, -9999, 0, 0); enum { @@ -181,7 +181,7 @@ void ExpandingToolBar::OnSize(wxSizeEvent & WXUNUSED(event)) // our parent that we've just joined the window, so we check // for it during our first OnSize event. - if (!mFrameParent) { + if (!mFrameParent) { ToolBarFrame *toolBarParent = dynamic_cast(GetParent()); if (toolBarParent) { @@ -191,7 +191,7 @@ void ExpandingToolBar::OnSize(wxSizeEvent & WXUNUSED(event)) } } - if (!mDialogParent) { + if (!mDialogParent) { ToolBarDialog *toolBarParent = dynamic_cast(GetParent()); if (toolBarParent) { @@ -310,7 +310,7 @@ void ExpandingToolBar::RecursivelyPushEventHandlers(wxWindow *win) win->PushEventHandler(evtHandler); mWindowHash[win] = 1; } - + wxWindowList children = win->GetChildren(); typedef wxWindowList::compatibility_iterator Node; @@ -435,7 +435,7 @@ void ExpandingToolBar::MoveDrawer(wxSize prevSize) SetSizeHints(mCurrentTotalSize, mCurrentTotalSize); SetSize(mCurrentTotalSize); - + GetParent()->Fit(); } @@ -444,7 +444,7 @@ void ExpandingToolBar::MoveDrawer(wxSize prevSize) SetSizeHints(mCurrentTotalSize, mCurrentTotalSize); SetSize(mCurrentTotalSize); - + GetParent()->Fit(); } @@ -477,7 +477,7 @@ void ExpandingToolBar::OnTimer(wxTimerEvent & WXUNUSED(event)) // This accelerates the current size towards the target size; // it's a neat way for the window to roll open, but in such a - // way that it + // way that it wxSize prevSize = mCurrentDrawerSize; mCurrentDrawerSize = (mCurrentDrawerSize*2 + mTargetDrawerSize) / 3; @@ -535,7 +535,7 @@ void ExpandingToolBar::StartMoving() mDropTargets = mAreaParent->GetDropTargets(); mDropTarget = kDummyRect; - + wxColour magicColor = wxColour(0, 255, 255); wxImage tgtImage = theTheme.Image(bmpToolBarTarget); ImageRoll tgtImageRoll = ImageRoll(ImageRoll::VerticalRoll, @@ -579,7 +579,7 @@ void ExpandingToolBar::UpdateMoving() if (dist_sq < best_dist_sq) { best_dist_sq = dist_sq; mDropTarget = mDropTargets[i]; - } + } } if (!mAreaParent->GetRect().Contains(cursorPos)) @@ -603,7 +603,7 @@ void ExpandingToolBar::UpdateMoving() r.Inflate(4, 4); dc.DrawRectangle(r); #endif - + // This gives time for wx to finish redrawing the window that way. // HACK: why do we need to do it so many times??? for(i=0; i<500; i++) @@ -659,7 +659,7 @@ BEGIN_EVENT_TABLE(ToolBarGrabber, wxPanel) EVT_SIZE(ToolBarGrabber::OnSize) EVT_MOUSE_EVENTS(ToolBarGrabber::OnMouse) END_EVENT_TABLE() - + IMPLEMENT_CLASS(ToolBarGrabber, wxPanel) ToolBarGrabber::ToolBarGrabber(wxWindow *parent, @@ -739,12 +739,12 @@ ToolBarDialog::ToolBarDialog(wxWindow* parent, wxWindowID id, const wxString& name, const wxPoint& pos): - wxDialog(parent, id, name, pos, wxSize(1, 1), + wxDialog(parent, id, name, pos, wxSize(1, 1), // Workaround for bug in __WXMSW__. No close box on a wxDialog unless wxSYSTEM_MENU is used. #ifdef __WXMSW__ wxSYSTEM_MENU | #endif - wxCAPTION|wxCLOSE_BOX), + wxCAPTION|wxCLOSE_BOX), mChild(NULL) { } @@ -849,7 +849,7 @@ ToolBarArea::ToolBarArea(wxWindow* parent, mInOnSize(false), mCapturedChild(NULL) { - + } ToolBarArea::~ToolBarArea() @@ -889,7 +889,7 @@ bool ToolBarArea::ExpandRow(int rowIndex) int leftoverSpace = 0; int expandableCount = 0; int toolbarCount = 0; - + for(i=0; i<(int)mChildArray.GetCount(); i++) if (mRowArray[i] == rowIndex) { ExpandingToolBar *child = mChildArray[i]; @@ -966,7 +966,7 @@ void ToolBarArea::LayoutOne(int childIndex) ContractRow(prevRow); wxPoint prevPos = mChildArray[childIndex-1]->GetPosition(); wxSize prevSize = mChildArray[childIndex-1]->GetSize(); - + int prevX = prevPos.x + prevSize.x; int availableWidth = area.x - prevX; @@ -1047,7 +1047,7 @@ void ToolBarArea::AdjustLayout() return; } } - } + } } void ToolBarArea::Fit() @@ -1146,7 +1146,7 @@ void ToolBarArea::OnMouse(wxMouseEvent &evt) void ToolBarArea::CollapseAll(bool now) { int i; - + for(i=0; i<(int)mChildArray.GetCount(); i++) mChildArray[i]->Collapse(now); } @@ -1275,7 +1275,7 @@ void ToolBarArea::MoveChild(ExpandingToolBar *toolBar, wxRect dropTarget) return; } } -} +} void ToolBarArea::SetCapturedChild(ExpandingToolBar *child) { diff --git a/src/widgets/ExpandingToolBar.h b/src/widgets/ExpandingToolBar.h index 02d2b5526..68fda4398 100644 --- a/src/widgets/ExpandingToolBar.h +++ b/src/widgets/ExpandingToolBar.h @@ -82,7 +82,7 @@ class ExpandingToolBar : public wxPanel void ReparentExtraPanel(); void MoveDrawer(wxSize prevSize); wxBitmap GetToolbarBitmap(); - + void TryAutoExpand(); void TryAutoCollapse(); @@ -125,22 +125,22 @@ class ToolBarGrabber : public wxPanel { public: DECLARE_DYNAMIC_CLASS(ToolBarGrabber); - + ToolBarGrabber(wxWindow *parent, wxWindowID id, ExpandingToolBar *ownerToolbar, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize); - + void OnPaint(wxPaintEvent &evt); void OnSize(wxSizeEvent &evt); void OnMouse(wxMouseEvent &evt); - + protected: int mState; ImageRoll mImageRoll[2]; ExpandingToolBar *mOwnerToolBar; - + DECLARE_EVENT_TABLE(); }; diff --git a/src/widgets/FileHistory.cpp b/src/widgets/FileHistory.cpp index 0740c3860..8ff5d05fd 100644 --- a/src/widgets/FileHistory.cpp +++ b/src/widgets/FileHistory.cpp @@ -35,7 +35,7 @@ FileHistory::~FileHistory() void FileHistory::AddFileToHistory(const wxString & file, bool update) { // Needed to transition from wxFileHistory to FileHistory since there - // can be empty history "slots". + // can be empty history "slots". if (file.IsEmpty()) { return; } diff --git a/src/widgets/Grabber.cpp b/src/widgets/Grabber.cpp index d752a9a5a..cf1d1fbdd 100644 --- a/src/widgets/Grabber.cpp +++ b/src/widgets/Grabber.cpp @@ -3,7 +3,7 @@ Audacity: A Digital Audio Editor Grabber.cpp - + Leland Lucius *******************************************************************//** @@ -15,7 +15,7 @@ *//*******************************************************************//** \class Grabber -\brief The widget to the left of a ToolBar that allows it to be dragged +\brief The widget to the left of a ToolBar that allows it to be dragged around to new positions. *//**********************************************************************/ @@ -44,7 +44,7 @@ BEGIN_EVENT_TABLE(Grabber, wxWindow) EVT_LEAVE_WINDOW(Grabber::OnLeave) EVT_LEFT_DOWN(Grabber::OnLeftDown) EVT_PAINT(Grabber::OnPaint) -END_EVENT_TABLE() +END_EVENT_TABLE() // // Constructor @@ -60,10 +60,10 @@ Grabber::Grabber(wxWindow * parent, wxWindowID id) mPressed = false; /* i18n-hint: A 'Grabber' is a region you can click and drag on - It's used to drag a track around (when in multi-tool mode) rather + It's used to drag a track around (when in multi-tool mode) rather than requiring that you use the drag tool. It's shown as a series of horizontal bumps */ - + SetLabel(_("Grabber")); SetName(_("Grabber")); } @@ -112,7 +112,7 @@ void Grabber::DrawGrabber( wxDC & dc ) } else { - // Get colour from parent... + // Get colour from parent... // when parent colour changes, child colour might not! wxBrush brush( GetParent()->GetBackgroundColour() ); dc.SetBrush( brush ); diff --git a/src/widgets/Grabber.h b/src/widgets/Grabber.h index 8f671814a..6e4257c72 100644 --- a/src/widgets/Grabber.h +++ b/src/widgets/Grabber.h @@ -3,7 +3,7 @@ Audacity: A Digital Audio Editor Grabber.cpp - + Leland Lucius *******************************************************************//** @@ -15,7 +15,7 @@ *//*******************************************************************//** \class Grabber -\brief The widget to the left of a ToolBar that allows it to be dragged +\brief The widget to the left of a ToolBar that allows it to be dragged around to new positions. *//**********************************************************************/ diff --git a/src/widgets/Grid.cpp b/src/widgets/Grid.cpp index 04b195e5a..cd246d8b4 100644 --- a/src/widgets/Grid.cpp +++ b/src/widgets/Grid.cpp @@ -170,7 +170,7 @@ void TimeRenderer::Draw(wxGrid &grid, } dc.SetBackgroundMode(wxTRANSPARENT); - + if (grid.IsEnabled()) { if (isSelected) @@ -189,7 +189,7 @@ void TimeRenderer::Draw(wxGrid &grid, dc.SetTextBackground(wxSystemSettings::GetColour(wxSYS_COLOUR_BTNFACE)); dc.SetTextForeground(wxSystemSettings::GetColour(wxSYS_COLOUR_GRAYTEXT)); } - + dc.SetFont(attr.GetFont()); int hAlign, vAlign; @@ -533,7 +533,7 @@ bool Grid::InsertRows(int pos, int numRows, bool updateLabels) bool Grid::AppendRows(int numRows, bool updateLabels) { bool res = wxGrid::AppendRows(numRows, updateLabels); - + mAx->TableUpdated(); return res; @@ -542,7 +542,7 @@ bool Grid::AppendRows(int numRows, bool updateLabels) bool Grid::DeleteRows(int pos, int numRows, bool updateLabels) { bool res = wxGrid::DeleteRows(pos, numRows, updateLabels); - + mAx->TableUpdated(); return res; diff --git a/src/widgets/Grid.h b/src/widgets/Grid.h index 30241b353..fbdf553b6 100644 --- a/src/widgets/Grid.h +++ b/src/widgets/Grid.h @@ -170,7 +170,7 @@ public: class Grid : public wxGrid { - + public: Grid(wxWindow *parent, @@ -225,7 +225,7 @@ class GridAx { public: - + GridAx(Grid *grid); void SetCurrentCell(int row, int col); diff --git a/src/widgets/HtmlWindow.cpp b/src/widgets/HtmlWindow.cpp index ba430bcab..2d4333d5c 100644 --- a/src/widgets/HtmlWindow.cpp +++ b/src/widgets/HtmlWindow.cpp @@ -3,7 +3,7 @@ Audacity: A Digital Audio Editor HtmlWindow.cpp - + Leland Lucius *******************************************************************//** @@ -15,7 +15,7 @@ *//*******************************************************************//** \class HtmlWindow -\brief The widget to the left of a ToolBar that allows it to be dragged +\brief The widget to the left of a ToolBar that allows it to be dragged around to new positions. *//**********************************************************************/ diff --git a/src/widgets/HtmlWindow.h b/src/widgets/HtmlWindow.h index dbaa2ec06..a5418c691 100644 --- a/src/widgets/HtmlWindow.h +++ b/src/widgets/HtmlWindow.h @@ -3,7 +3,7 @@ Audacity: A Digital Audio Editor HtmlWindow.cpp - + Leland Lucius *******************************************************************//** @@ -15,7 +15,7 @@ *//*******************************************************************//** \class HtmlWindow -\brief The widget to the left of a ToolBar that allows it to be dragged +\brief The widget to the left of a ToolBar that allows it to be dragged around to new positions. *//**********************************************************************/ diff --git a/src/widgets/ImageRoll.cpp b/src/widgets/ImageRoll.cpp index bcc5f8451..dd8c2005c 100644 --- a/src/widgets/ImageRoll.cpp +++ b/src/widgets/ImageRoll.cpp @@ -11,9 +11,9 @@ \class ImageRoll \brief An ImageRoll is an image that can be expanded to an arbitrary size; - it is made up of both fixed pieces and repeating pieces. - - + it is made up of both fixed pieces and repeating pieces. + + A typical ImageRoll might be made up of two fixed ends and a repeating middle part: @@ -122,7 +122,7 @@ ImageArray ImageRoll::SplitH(const wxImage &src, wxColour magicColor) // Sanity check... if (width<=0 || height<=0 || data==NULL) return result; - + prev = false; start = 0; for(i=0; i= 0 && depth > 0; j--) { - // Found a parent + // Found a parent if (mNodes[j].depth < depth) { // Examine all previously added nodes to see if this nodes @@ -978,7 +978,7 @@ KeyView::RefreshLines() // Tell listbox the new count and refresh the entire view SetItemCount(mLines.GetCount()); RefreshAll(); - + #if wxUSE_ACCESSIBILITY // Let accessibility know that the list has changed mAx->ListUpdated(); @@ -1066,7 +1066,7 @@ KeyView::OnDrawBackground(wxDC & dc, const wxRect & rect, size_t line) const // If the line width is less than the client width, then we want to // extend the background to the right edge of the client view. Otherwise, - // go all the way to the end of the line width...this will draw past the + // go all the way to the end of the line width...this will draw past the // right edge, but that's what we want. r.width = wxMax(mWidth, r.width); @@ -1177,7 +1177,7 @@ KeyView::OnDrawItem(wxDC & dc, const wxRect & rect, size_t line) const // Provide the height of the given line // // This is called by the listbox when it needs to redraw the view. -// +// wxCoord KeyView::OnMeasureItem(size_t WXUNUSED(line)) const { @@ -1537,7 +1537,7 @@ KeyView::OnLeftDown(wxMouseEvent & event) // "command" nodes. // // To accomplish this, we prepend each label with it's line number -// (in hex) for "menu" nodes. This ensures they will remain in +// (in hex) for "menu" nodes. This ensures they will remain in // their original order. // // We prefix all "command" nodes with "ffffffff" (highest hex value) @@ -1551,7 +1551,7 @@ KeyView::CmpKeyNodeByTree(KeyNode ***n1, KeyNode ***n2) wxString k1 = t1->label; wxString k2 = t2->label; - // This is a "command" node if its category is "Command" + // This is a "command" node if its category is "Command" // and it is a child of the "Command" category. This latter // test ensures that the "Command" parent will be handled // as a "menu" node and remain at the bottom of the list. @@ -2151,7 +2151,7 @@ KeyViewAx::GetState(int childId, long *state) if (mView->HasChildren(line)) { - flag |= mView->IsExpanded(line) ? + flag |= mView->IsExpanded(line) ? wxACC_STATE_SYSTEM_EXPANDED : wxACC_STATE_SYSTEM_COLLAPSED; } diff --git a/src/widgets/KeyView.h b/src/widgets/KeyView.h index 5fdd5624c..50ddf0a8a 100644 --- a/src/widgets/KeyView.h +++ b/src/widgets/KeyView.h @@ -156,7 +156,7 @@ private: wxCoord mScrollX; wxCoord mWidth; - + size_t mLineCount; wxCoord mLineHeight; wxCoord mKeyX; diff --git a/src/widgets/LinkingHtmlWindow.cpp b/src/widgets/LinkingHtmlWindow.cpp index e69adb7f9..5c666a6b7 100644 --- a/src/widgets/LinkingHtmlWindow.cpp +++ b/src/widgets/LinkingHtmlWindow.cpp @@ -7,8 +7,8 @@ Vaughan Johnson Dominic Mazzoni - utility fn and - descendant of HtmlWindow that opens links in the user's + utility fn and + descendant of HtmlWindow that opens links in the user's default browser **********************************************************************/ @@ -56,7 +56,7 @@ void BrowserFrame::OnKeyDown(wxKeyEvent & event) bool bSkip = true; if (event.GetKeyCode() == WXK_ESCAPE) { - bSkip = false; + bSkip = false; Close(false); } event.Skip(bSkip); @@ -81,9 +81,9 @@ void OpenInDefaultBrowser(const wxHtmlLinkInfo& link) wxLaunchDefaultBrowser(link.GetHref()); } -LinkingHtmlWindow::LinkingHtmlWindow(wxWindow *parent, wxWindowID id /*= -1*/, - const wxPoint& pos /*= wxDefaultPosition*/, - const wxSize& size /*= wxDefaultSize*/, +LinkingHtmlWindow::LinkingHtmlWindow(wxWindow *parent, wxWindowID id /*= -1*/, + const wxPoint& pos /*= wxDefaultPosition*/, + const wxSize& size /*= wxDefaultSize*/, long style /*= wxHW_SCROLLBAR_AUTO*/) : HtmlWindow(parent, id, pos, size, style) { @@ -94,7 +94,7 @@ void LinkingHtmlWindow::OnLinkClicked(const wxHtmlLinkInfo& link) wxString href = link.GetHref(); if( href.StartsWith(wxT("innerlink:")) ) { - wxString FileName = + wxString FileName = wxFileName( FileNames::HtmlHelpDir(), href.Mid( 10 ) + wxT(".htm") ).GetFullPath(); if( wxFileExists( FileName ) ) { diff --git a/src/widgets/LinkingHtmlWindow.h b/src/widgets/LinkingHtmlWindow.h index 12d402e44..b4652f0ba 100644 --- a/src/widgets/LinkingHtmlWindow.h +++ b/src/widgets/LinkingHtmlWindow.h @@ -7,10 +7,10 @@ Vaughan Johnson Dominic Mazzoni - utility fn and - descendant of HtmlWindow that opens links in the user's + utility fn and + descendant of HtmlWindow that opens links in the user's default browser - + **********************************************************************/ #ifndef __AUDACITY_LINKINGHTMLWINDOW__ @@ -24,12 +24,12 @@ void OpenInDefaultBrowser(const wxHtmlLinkInfo& link); -class AUDACITY_DLL_API LinkingHtmlWindow : public HtmlWindow +class AUDACITY_DLL_API LinkingHtmlWindow : public HtmlWindow { public: - LinkingHtmlWindow(wxWindow *parent, wxWindowID id = -1, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, + LinkingHtmlWindow(wxWindow *parent, wxWindowID id = -1, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, long style = wxHW_SCROLLBAR_AUTO); virtual void OnLinkClicked(const wxHtmlLinkInfo& link); //virtual void OnSetTitle(const wxString& title); diff --git a/src/widgets/Meter.cpp b/src/widgets/Meter.cpp index 8dbeb9aa1..a845eccfa 100644 --- a/src/widgets/Meter.cpp +++ b/src/widgets/Meter.cpp @@ -17,8 +17,8 @@ This is a bunch of common code that can display many different forms of VU meters and other displays. - But note that a lot of later code here assumes these are - MeterToolBar meters, e.g., Meter::StartMonitoring, + But note that a lot of later code here assumes these are + MeterToolBar meters, e.g., Meter::StartMonitoring, so these are not as generic/common as originally intended. *//****************************************************************//** @@ -212,8 +212,8 @@ IMPLEMENT_CLASS(Meter, wxPanel) Meter::Meter(wxWindow* parent, wxWindowID id, bool isInput, const wxPoint& pos /*= wxDefaultPosition*/, - const wxSize& size /*= wxDefaultSize*/, - Style style /*= HorizontalStereo*/, + const wxSize& size /*= wxDefaultSize*/, + Style style /*= HorizontalStereo*/, float fDecayRate /*= 60.0f*/) : wxPanel(parent, id, pos, size), mQueue(1024), @@ -255,8 +255,8 @@ Meter::Meter(wxWindow* parent, wxWindowID id, mClipBrush = wxBrush( theTheme.Colour( clrMeterInputClipBrush ), wxSOLID); mLightPen = wxPen( theTheme.Colour( clrMeterInputLightPen ), 1, wxSOLID); mDarkPen = wxPen( theTheme.Colour( clrMeterInputDarkPen ), 1, wxSOLID); - } - else { + } + else { mPen = wxPen( theTheme.Colour( clrMeterOutputPen ), 1, wxSOLID); mBrush = wxBrush( theTheme.Colour( clrMeterOutputBrush ), wxSOLID); mRMSBrush = wxBrush( theTheme.Colour( clrMeterOutputRMSBrush ), wxSOLID); @@ -340,9 +340,9 @@ void Meter::UpdatePrefs() // MixerTrackCluster style has no menu, so disallows disabling the meter. if (mStyle == MixerTrackCluster) mMeterDisabled = 0L; - else if (mIsInput) + else if (mIsInput) mMeterDisabled = gPrefs->Read(wxT("/Meter/MeterInputDisabled"), (long)0); - else + else mMeterDisabled = gPrefs->Read(wxT("/Meter/MeterOutputDisabled"), (long)0); } @@ -365,7 +365,7 @@ void Meter::OnPaint(wxPaintEvent & WXUNUSED(event)) memDC.SelectObject(*mBitmap); HandlePaint(memDC); dc.Blit(0, 0, mWidth, mHeight, &memDC, 0, 0, wxCOPY, FALSE); - #endif + #endif } void Meter::OnSize(wxSizeEvent & WXUNUSED(event)) @@ -398,7 +398,7 @@ void Meter::OnMouse(wxMouseEvent &evt) #endif if (evt.RightDown() || - (evt.ButtonDown() && mMenuRect.Contains(evt.m_x, evt.m_y))) + (evt.ButtonDown() && mMenuRect.Contains(evt.m_x, evt.m_y))) { wxMenu *menu = new wxMenu(); // Note: these should be kept in the same order as the enum @@ -580,10 +580,10 @@ void Meter::UpdateDisplay(int numChannels, int numFrames, float *sampleData) } // Vaughan, 2010-11-29: This not currently used. See comments in MixerTrackCluster::UpdateMeter(). -//void Meter::UpdateDisplay(int numChannels, int numFrames, +//void Meter::UpdateDisplay(int numChannels, int numFrames, // // Need to make these double-indexed arrays if we handle more than 2 channels. -// float* maxLeft, float* rmsLeft, -// float* maxRight, float* rmsRight, +// float* maxLeft, float* rmsLeft, +// float* maxRight, float* rmsRight, // const sampleCount kSampleCount) //{ // int i, j; @@ -606,7 +606,7 @@ void Meter::UpdateDisplay(int numChannels, int numFrames, float *sampleData) // // // In addition to looking for mNumPeakSamplesToClip peaked // // samples in a row, also send the number of peaked samples -// // at the head and tail, in case there's a run +// // at the head and tail, in case there's a run // // of peaked samples that crosses block boundaries. // if (fabs((j == 0) ? maxLeft[i] : maxRight[i]) >= MAX_AUDIO) // { @@ -648,8 +648,8 @@ void Meter::OnMeterUpdate(wxTimerEvent & WXUNUSED(event)) numChanges++; double deltaT = msg.numFrames / mRate; int j; - - // if (mMeterDisabled) return; @@ -678,16 +678,16 @@ void Meter::OnMeterUpdate(wxTimerEvent & WXUNUSED(event)) // This smooths out the RMS signal float smooth = pow(0.9, (double)msg.numFrames/1024.0); mBar[j].rms = mBar[j].rms * smooth + msg.rms[j] * (1.0 - smooth); - + if (mT - mBar[j].peakHoldTime > mPeakHoldDuration || mBar[j].peak > mBar[j].peakHold) { mBar[j].peakHold = mBar[j].peak; mBar[j].peakHoldTime = mT; } - + if (mBar[j].peak > mBar[j].peakPeakHold ) mBar[j].peakPeakHold = mBar[j].peak; - + if (msg.clipping[j] || mBar[j].tailPeakCount+msg.headPeakCount[j] >= mNumPeakSamplesToClip){ @@ -863,7 +863,7 @@ void Meter::HandleLayout() mIconPos = wxPoint(-999, -999); // Don't display icon mMenuRect = wxRect(2, mHeight - menuHeight - 2, menuWidth, menuHeight); - } + } else { mIconPos = wxPoint(2, mHeight - iconHeight); mMenuRect = wxRect(iconWidth + 2, mHeight - menuHeight - 5, @@ -937,7 +937,7 @@ void Meter::HandleLayout() } // MixerTrackCluster style has no popup, so disallows SetStyle, so never needs icon. - if (mStyle != MixerTrackCluster) + if (mStyle != MixerTrackCluster) CreateIcon(mIconPos.y % 4); mLayoutValid = true; @@ -992,7 +992,7 @@ void Meter::HandlePaint(wxDC &dc) dc.DrawBitmap(*mIcon, mIconPos.x, mIconPos.y, true); // Draws a beveled button and a down pointing triangle. - // The style and sizing matches the ones in the title + // The style and sizing matches the ones in the title // bar of the waveform left-hand-side panels. wxRect r = mMenuRect; @@ -1007,7 +1007,7 @@ void Meter::HandlePaint(wxDC &dc) if (mNumBars>0) mRuler.Draw(dc); - + // MixerTrackCluster style has no L/R labels. if (mStyle != MixerTrackCluster) { @@ -1021,7 +1021,7 @@ void Meter::HandlePaint(wxDC &dc) } void Meter::RepaintBarsNow() -{ +{ if (!mLayoutValid) return; @@ -1044,7 +1044,7 @@ void Meter::RepaintBarsNow() mAllBarsRect.width, mAllBarsRect.height, &memDC, mAllBarsRect.x, mAllBarsRect.y, wxCOPY, false); - #endif + #endif } void Meter::DrawMeterBar(wxDC &dc, MeterBar *meterBar) @@ -1103,7 +1103,7 @@ void Meter::DrawMeterBar(wxDC &dc, MeterBar *meterBar) AColor::Line(dc, r.x + wd, r.y + 1, r.x + wd, r.y + r.height - 1); if (wd > 1) AColor::Line(dc, r.x + wd - 1, r.y + 1, r.x + wd - 1, r.y + r.height - 1); - + dc.SetPen(mPen); wd = (int)(meterBar->peak * r.width + 0.5); r = wxRect(r.x, r.y, @@ -1312,6 +1312,6 @@ void Meter::OnPreferences(wxCommandEvent & WXUNUSED(event)) gPrefs->Write(wxT("/Meter/MeterRefreshRate"), mMeterRefreshRate); gPrefs->Flush(); } - + mTimer.Start(1000 / mMeterRefreshRate); } diff --git a/src/widgets/Meter.h b/src/widgets/Meter.h index ab1abb2a9..511e81675 100644 --- a/src/widgets/Meter.h +++ b/src/widgets/Meter.h @@ -93,7 +93,7 @@ class Meter : public wxPanel VerticalStereo, VerticalMulti, Equalizer, - Waveform, + Waveform, MixerTrackCluster // Doesn't show menu, icon, or L/R labels, but otherwise like VerticalStereo. }; @@ -101,8 +101,8 @@ class Meter : public wxPanel Meter(wxWindow* parent, wxWindowID id, bool isInput, const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - Style style = HorizontalStereo, + const wxSize& size = wxDefaultSize, + Style style = HorizontalStereo, float fDecayRate = 60.0f); ~Meter(); @@ -145,10 +145,10 @@ class Meter : public wxPanel void UpdateDisplay(int numChannels, int numFrames, float *sampleData); // Vaughan, 2010-11-29: This not currently used. See comments in MixerTrackCluster::UpdateMeter(). - //void UpdateDisplay(int numChannels, int numFrames, + //void UpdateDisplay(int numChannels, int numFrames, // // Need to make these double-indexed max and min arrays if we handle more than 2 channels. - // float* maxLeft, float* rmsLeft, - // float* maxRight, float* rmsRight, + // float* maxLeft, float* rmsLeft, + // float* maxRight, float* rmsRight, // const sampleCount kSampleCount); /** \brief Find out if the level meter is disabled or not. @@ -157,7 +157,7 @@ class Meter : public wxPanel * different thread (like from an audio I/O callback). */ bool IsMeterDisabled(); - + float GetMaxPeak(); double ToLinearIfDB(double value); @@ -196,7 +196,7 @@ class Meter : public wxPanel void OnFloat(wxCommandEvent &evt); void OnPreferences(wxCommandEvent &evt); bool IsClipping(); - + void StartMonitoring(); private: diff --git a/src/widgets/MultiDialog.cpp b/src/widgets/MultiDialog.cpp index 7d9d90339..376df5405 100644 --- a/src/widgets/MultiDialog.cpp +++ b/src/widgets/MultiDialog.cpp @@ -40,7 +40,7 @@ public: wxString title, const wxChar **buttons, wxString boxMsg, bool log); ~MultiDialog() {}; - + private: void OnOK( wxCommandEvent &event ); void OnShowLog(wxCommandEvent& event); @@ -56,13 +56,13 @@ BEGIN_EVENT_TABLE(MultiDialog, wxDialog) EVT_BUTTON( wxID_OK, MultiDialog::OnOK ) EVT_BUTTON(ID_SHOW_LOG_BUTTON, MultiDialog::OnShowLog) END_EVENT_TABLE() - + MultiDialog::MultiDialog(wxString message, wxString title, const wxChar **buttons, wxString boxMsg, bool log) - : wxDialog(NULL, (wxWindowID)-1, title, - wxDefaultPosition, wxDefaultSize, - wxCAPTION) // not wxDEFAULT_DIALOG_STYLE because we don't want wxCLOSE_BOX and wxSYSTEM_MENU + : wxDialog(NULL, (wxWindowID)-1, title, + wxDefaultPosition, wxDefaultSize, + wxCAPTION) // not wxDEFAULT_DIALOG_STYLE because we don't want wxCLOSE_BOX and wxSYSTEM_MENU { wxBoxSizer *mainSizer = new wxBoxSizer(wxVERTICAL); wxBoxSizer *vSizer = new wxBoxSizer(wxVERTICAL); diff --git a/src/widgets/ProgressDialog.cpp b/src/widgets/ProgressDialog.cpp index 5c3f4d93f..59f1b9908 100644 --- a/src/widgets/ProgressDialog.cpp +++ b/src/widgets/ProgressDialog.cpp @@ -7,7 +7,7 @@ Copyright Leland Lucius Vaughan Johnson - + This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or @@ -993,7 +993,7 @@ BEGIN_EVENT_TABLE(ProgressDialog, wxDialog) EVT_BUTTON(wxID_CANCEL, ProgressDialog::OnCancel) EVT_BUTTON(wxID_OK, ProgressDialog::OnStop) EVT_CLOSE(ProgressDialog::OnCloseWindow) -END_EVENT_TABLE() +END_EVENT_TABLE() // // Constructor @@ -1044,7 +1044,7 @@ ProgressDialog::ProgressDialog(const wxString & title, const wxString & message, wxID_ANY, message, wxDefaultPosition, - wxDefaultSize, + wxDefaultSize, wxALIGN_LEFT); mMessage->SetName(message); // fix for bug 577 (NVDA/Narrator screen readers do not read static text in dialogs) v->Add(mMessage, 0, wxEXPAND | wxALL, 10); @@ -1071,7 +1071,7 @@ ProgressDialog::ProgressDialog(const wxString & title, const wxString & message, wxID_ANY, _("Elapsed Time:"), wxDefaultPosition, - wxDefaultSize, + wxDefaultSize, wxALIGN_RIGHT); w->SetName(w->GetLabel()); // fix for bug 577 (NVDA/Narrator screen readers do not read static text in dialogs) g->Add(w, 0, wxALIGN_RIGHT); @@ -1080,12 +1080,12 @@ ProgressDialog::ProgressDialog(const wxString & title, const wxString & message, wxID_ANY, wxT("00:00:00"), wxDefaultPosition, - wxDefaultSize, + wxDefaultSize, wxALIGN_LEFT); mElapsed->SetName(mElapsed->GetLabel()); // fix for bug 577 (NVDA/Narrator screen readers do not read static text in dialogs) g->Add(mElapsed, 0, wxALIGN_LEFT); ds.y += mElapsed->GetSize().y + 10; - + // // // @@ -1093,7 +1093,7 @@ ProgressDialog::ProgressDialog(const wxString & title, const wxString & message, wxID_ANY, _("Remaining Time:"), wxDefaultPosition, - wxDefaultSize, + wxDefaultSize, wxALIGN_RIGHT); w->SetName(w->GetLabel()); // fix for bug 577 (NVDA/Narrator screen readers do not read static text in dialogs) g->Add(w, 0, wxALIGN_RIGHT); @@ -1102,7 +1102,7 @@ ProgressDialog::ProgressDialog(const wxString & title, const wxString & message, wxID_ANY, wxT("00:00:00"), wxDefaultPosition, - wxDefaultSize, + wxDefaultSize, wxALIGN_LEFT); mRemaining->SetName(mRemaining->GetLabel()); // fix for bug 577 (NVDA/Narrator screen readers do not read static text in dialogs) g->Add(mRemaining, 0, wxALIGN_LEFT); @@ -1118,7 +1118,7 @@ ProgressDialog::ProgressDialog(const wxString & title, const wxString & message, h->Add(w, 0, wxALIGN_RIGHT | wxRIGHT | wxBOTTOM, 10); ds.x += w->GetSize().x + 10; } - + if (!(flags & pdlgHideCancelButton)) { w = new wxButton(this, wxID_CANCEL, _("Cancel")); @@ -1185,7 +1185,7 @@ ProgressDialog::ProgressDialog(const wxString & title, const wxString & message, // See Bug #334 // LL: On Windows, the application message loop is still active even though // all of the windows have been disabled. So, keyboard shortcuts still - // work in windows not related to the progress diawhich allows interaction + // work in windows not related to the progress diawhich allows interaction // when it should be blocked. // This disabled the application message loop so keyboard shortcuts will // no longer be processed. @@ -1307,7 +1307,7 @@ ProgressDialog::Update(int value, const wxString & message) if (mCancel) { // for compatibility with old Update, that returned false on cancel - return eProgressCancelled; + return eProgressCancelled; } else if (mStop) { @@ -1520,9 +1520,9 @@ ProgressDialog::Beep() } } -TimerProgressDialog::TimerProgressDialog(const wxLongLong_t duration, - const wxString & title, - const wxString & message /*= wxEmptyString*/, +TimerProgressDialog::TimerProgressDialog(const wxLongLong_t duration, + const wxString & title, + const wxString & message /*= wxEmptyString*/, ProgressDialogFlags flags /*= pdlgEmptyFlags*/) : ProgressDialog(title, message, flags) { @@ -1534,7 +1534,7 @@ int TimerProgressDialog::Update(const wxString & message /*= wxEmptyString*/) if (mCancel) { // for compatibility with old Update, that returned false on cancel - return eProgressCancelled; + return eProgressCancelled; } else if (mStop) { diff --git a/src/widgets/ProgressDialog.h b/src/widgets/ProgressDialog.h index b0231c94b..28b3b9315 100644 --- a/src/widgets/ProgressDialog.h +++ b/src/widgets/ProgressDialog.h @@ -7,7 +7,7 @@ Copyright Leland Lucius Vaughan Johnson - + This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or @@ -86,16 +86,16 @@ class AUDACITY_DLL_API ProgressDialog:public wxDialog wxWindow *mHadFocus; wxStaticText *mMessage; wxWindowDisabler *mDisable; - + DECLARE_EVENT_TABLE(); }; class AUDACITY_DLL_API TimerProgressDialog : public ProgressDialog { public: - TimerProgressDialog(const wxLongLong_t duration, - const wxString & title, - const wxString & message = wxEmptyString, + TimerProgressDialog(const wxLongLong_t duration, + const wxString & title, + const wxString & message = wxEmptyString, ProgressDialogFlags flags = pdlgEmptyFlags); int Update(const wxString & message = wxEmptyString); diff --git a/src/widgets/Ruler.cpp b/src/widgets/Ruler.cpp index acf30728e..be89b9dbc 100644 --- a/src/widgets/Ruler.cpp +++ b/src/widgets/Ruler.cpp @@ -12,7 +12,7 @@ \brief Used to display a Ruler. This is a generic class which can be used to display just about - any kind of ruler. + any kind of ruler. At a minimum, the user must specify the dimensions of the ruler, its orientation (horizontal or vertical), and the @@ -30,7 +30,7 @@ two other formats for its display: Integer - never shows tick marks for fractions of an integer - + Time - Assumes values represent seconds, and labels the tick marks in "HH:MM:SS" format, e.g. 4000 seconds becomes "1:06:40", for example. Will display fractions of @@ -45,7 +45,7 @@ *//***************************************************************//** \class Ruler::Label -\brief An array of these created by the Ruler is used to determine +\brief An array of these created by the Ruler is used to determine what and where text annotations to the numbers on the Ruler get drawn. \todo Check whether Ruler is costing too much time in malloc/free of @@ -135,7 +135,7 @@ Ruler::Ruler() mBits = NULL; mUserBits = NULL; mUserBitLen = 0; - + mValid = false; mCustom = false; @@ -169,7 +169,7 @@ void Ruler::SetFormat(RulerFormat format) if (mFormat != format) { mFormat = format; - + Invalidate(); } } @@ -180,7 +180,7 @@ void Ruler::SetLog(bool log) if (mLog != log) { mLog = log; - + Invalidate(); } } @@ -192,7 +192,7 @@ void Ruler::SetUnits(wxString units) if (mUnits != units) { mUnits = units; - + Invalidate(); } } @@ -203,10 +203,10 @@ void Ruler::SetOrientation(int orient) if (mOrientation != orient) { mOrientation = orient; - + if (mOrientation == wxVERTICAL && !mHasSetSpacing) mSpacing = 2; - + Invalidate(); } } @@ -220,7 +220,7 @@ void Ruler::SetRange(double min, double max) if (mMin != min || mMax != max) { mMin = min; mMax = max; - + Invalidate(); } } @@ -244,7 +244,7 @@ void Ruler::SetLabelEdges(bool labelEdges) if (mLabelEdges != labelEdges) { mLabelEdges = labelEdges; - + Invalidate(); } } @@ -257,7 +257,7 @@ void Ruler::SetFlip(bool flip) if (mFlip != flip) { mFlip = flip; - + Invalidate(); } } @@ -278,7 +278,7 @@ void Ruler::SetFonts(const wxFont &minorFont, const wxFont &majorFont, const wxF mMinorFont->SetNoAntiAliasing(true); mMajorFont->SetNoAntiAliasing(true); #endif - + // Won't override these fonts mUserFonts = true; @@ -293,7 +293,7 @@ void Ruler::OfflimitsPixels(int start, int end) if (mOrientation == wxHORIZONTAL) mLength = mRight-mLeft; else - mLength = mBottom-mTop; + mLength = mBottom-mTop; mUserBits = new int[mLength+1]; for(i=0; i<=mLength; i++) mUserBits[i] = 0; @@ -691,7 +691,7 @@ wxString Ruler::LabelString(double d, bool major) else { } } - + if (mUnits != wxT("")) s = (s + mUnits); @@ -976,7 +976,7 @@ void Ruler::Update(TimeTrack* timetrack)// Envelope *speedEnv, long minSpeed, lo } // If ruler is being resized, we could end up with it being too small. - // Values of mLength of zero or below cause bad array allocations and + // Values of mLength of zero or below cause bad array allocations and // division by zero. So... // IF too small THEN bail out and don't draw. if( mLength <= 0 ) @@ -994,8 +994,8 @@ void Ruler::Update(TimeTrack* timetrack)// Envelope *speedEnv, long minSpeed, lo } // FIXME: Surely we do not need to allocate storage for the labels? - // We can just recompute them as we need them? Yes, but only if - // mCustom is false!!!! + // We can just recompute them as we need them? Yes, but only if + // mCustom is false!!!! if(!mCustom) { mNumMajor = 0; @@ -1027,38 +1027,38 @@ void Ruler::Update(TimeTrack* timetrack)// Envelope *speedEnv, long minSpeed, lo // *************** Label calculation routine ************** if(mCustom == true) { - + // SET PARAMETER IN MCUSTOM CASE // Works only with major labels - + int numLabel = mNumMajor; - + i = 0; while((i 0.0? 1.0: -1.0; - + // Major ticks double d, warpedD; d = mMin - UPP/2; @@ -1066,7 +1066,7 @@ void Ruler::Update(TimeTrack* timetrack)// Envelope *speedEnv, long minSpeed, lo warpedD = timetrack->ComputeWarpedLength(0.0, d); else warpedD = d; - // using ints for majorint doesn't work, as + // using ints for majorint doesn't work, as // majorint will overflow and be negative at high zoom. double majorInt = floor(sg * warpedD / mMajor); i = -1; @@ -1077,20 +1077,20 @@ void Ruler::Update(TimeTrack* timetrack)// Envelope *speedEnv, long minSpeed, lo else warpedD += UPP; d += UPP; - + if (floor(sg * warpedD / mMajor) > majorInt) { majorInt = floor(sg * warpedD / mMajor); Tick(i, sg * majorInt * mMajor, true, false); } } - + // Minor ticks d = mMin - UPP/2; if(timetrack) warpedD = timetrack->ComputeWarpedLength(0.0, d); else warpedD = d; - // using ints for majorint doesn't work, as + // using ints for majorint doesn't work, as // majorint will overflow and be negative at high zoom. // MB: I assume the same applies to minorInt double minorInt = floor(sg * warpedD / mMinor); @@ -1102,19 +1102,19 @@ void Ruler::Update(TimeTrack* timetrack)// Envelope *speedEnv, long minSpeed, lo else warpedD += UPP; d += UPP; - + if (floor(sg * warpedD / mMinor) > minorInt) { minorInt = floor(sg * warpedD / mMinor); Tick(i, sg * minorInt * mMinor, false, true); } } - + // Left and Right Edges if (mLabelEdges) { Tick(0, mMin, true, false); Tick(mLength, mMax, true, false); } - + } else { // log case @@ -1123,18 +1123,18 @@ void Ruler::Update(TimeTrack* timetrack)// Envelope *speedEnv, long minSpeed, lo double hiLog = log10(mMax); double scale = mLength/(hiLog - loLog); int loDecade = (int) floor(loLog); - + int pos; double val; double startDecade = pow(10., (double)loDecade); - + // Major ticks are the decades double decade = startDecade; double delta=hiLog-loLog, steps=fabs(delta); double step = delta>=0 ? 10 : 0.1; double rMin=wxMin(mMin, mMax), rMax=wxMax(mMin, mMax); - for(i=0; i<=steps; i++) - { // if(i!=0) + for(i=0; i<=steps; i++) + { // if(i!=0) { val = decade; if(val > rMin && val < rMax) { pos = (int)(((log10(val) - loLog)*scale)+0.5); @@ -1192,7 +1192,7 @@ void Ruler::Update(TimeTrack* timetrack)// Envelope *speedEnv, long minSpeed, lo int d=mTop+mRect.GetHeight()+5; mRect.Offset(0,d); mRect.Inflate(0,5); - displacementx=0; + displacementx=0; displacementy=d; } else { @@ -1206,7 +1206,7 @@ void Ruler::Update(TimeTrack* timetrack)// Envelope *speedEnv, long minSpeed, lo else { if (mOrientation==wxHORIZONTAL) { mRect.Inflate(0,5); - displacementx=0; + displacementx=0; displacementy=0; } } @@ -1316,7 +1316,7 @@ void Ruler::Draw(wxDC& dc, TimeTrack* timetrack) int pos = mMinorLabels[i].pos; if( mbTicksAtExtremes || ((pos!=0)&&(pos!=iMaxPos))) { - if (mOrientation == wxHORIZONTAL) + if (mOrientation == wxHORIZONTAL) { if (mFlip) mDC->DrawLine(mLeft + pos, mTop, @@ -1325,7 +1325,7 @@ void Ruler::Draw(wxDC& dc, TimeTrack* timetrack) mDC->DrawLine(mLeft + pos, mBottom - 2, mLeft + pos, mBottom); } - else + else { if (mFlip) mDC->DrawLine(mLeft, mTop + pos, @@ -1351,7 +1351,7 @@ void Ruler::Draw(wxDC& dc, TimeTrack* timetrack) if( mbTicksAtExtremes || ((pos!=0)&&(pos!=iMaxPos))) { - if (mOrientation == wxHORIZONTAL) + if (mOrientation == wxHORIZONTAL) { if (mFlip) mDC->DrawLine(mLeft + pos, mTop, @@ -1360,7 +1360,7 @@ void Ruler::Draw(wxDC& dc, TimeTrack* timetrack) mDC->DrawLine(mLeft + pos, mBottom - 2, mLeft + pos, mBottom); } - else + else { if (mFlip) mDC->DrawLine(mLeft, mTop + pos, @@ -1374,7 +1374,7 @@ void Ruler::Draw(wxDC& dc, TimeTrack* timetrack) mMinorMinorLabels[i].lx, mMinorMinorLabels[i].ly); } - } + } } // ********** Draw grid *************************** @@ -1420,7 +1420,7 @@ void Ruler::DrawGrid(wxDC& dc, int length, bool minor, bool major, int xOffset, mDC->DrawLine(xOffset, gridPos+yOffset, mGridLineLength+xOffset, gridPos+yOffset); } } - + int zeroPosition = GetZeroPosition(); if(zeroPosition > 0) { // Draw 'zero' grid line in black @@ -1458,7 +1458,7 @@ int Ruler::FindZero(Label * label, const int len) return -1; } -int Ruler::GetZeroPosition() +int Ruler::GetZeroPosition() { int zero; if((zero = FindZero(mMajorLabels, mNumMajor)) < 0) @@ -1668,7 +1668,7 @@ void AdornedRulerPanel::OnPaint(wxPaintEvent & WXUNUSED(evt)) { DoDrawCursor(&dc); } - + DoDrawPlayRegion(&dc); } @@ -1711,11 +1711,11 @@ bool AdornedRulerPanel::IsWithinMarker(int mousePosX, double markerTime) { if (markerTime < 0) return false; - + int pixelPos = Time2Pos(markerTime); int boundLeft = pixelPos - SELECT_TOLERANCE_PIXEL; int boundRight = pixelPos + SELECT_TOLERANCE_PIXEL; - + return mousePosX >= boundLeft && mousePosX < boundRight; } @@ -1730,12 +1730,12 @@ void AdornedRulerPanel::OnMouseEvents(wxMouseEvent &evt) SetCursor(wxCursor(wxCURSOR_SIZEWE)); else SetCursor(wxCursor(wxCURSOR_HAND)); - + double mouseTime = Pos2Time(evt.GetX()); if (mouseTime < 0.0) { mouseTime = 0.0; } - + if (evt.LeftDown()) { mButtonDownMousePos = evt.GetX(); @@ -1759,10 +1759,10 @@ void AdornedRulerPanel::OnMouseEvents(wxMouseEvent &evt) mPlayRegionEnd = mouseTime; Refresh(); } - + CaptureMouse(); } - + switch (mMouseEventState) { case mesNone: @@ -1791,7 +1791,7 @@ void AdornedRulerPanel::OnMouseEvents(wxMouseEvent &evt) Refresh(); break; } - + if (evt.LeftUp()) { if (HasCapture()) @@ -1803,7 +1803,7 @@ void AdornedRulerPanel::OnMouseEvents(wxMouseEvent &evt) mPlayRegionStart = -1; mPlayRegionEnd = -1; } - + if (mPlayRegionEnd < mPlayRegionStart) { // Swap values to make sure mPlayRegionStart > mPlayRegionEnd @@ -1811,13 +1811,13 @@ void AdornedRulerPanel::OnMouseEvents(wxMouseEvent &evt) mPlayRegionStart = mPlayRegionEnd; mPlayRegionEnd = tmp; } - - bool startPlaying = mPlayRegionStart >= 0 && + + bool startPlaying = mPlayRegionStart >= 0 && (mMouseEventState == mesSelectingPlayRegionClick || mMouseEventState == mesSelectingPlayRegionRange); - + mMouseEventState = mesNone; - + if (startPlaying) { ControlToolBar* ctb = mProject->GetControlToolBar(); @@ -1847,7 +1847,7 @@ void AdornedRulerPanel::DoDrawPlayRegion(wxDC * dc) bool isLocked = mProject->IsPlayRegionLocked(); AColor::PlayRegionColor(dc, isLocked); - + wxPoint tri[3]; wxRect r; @@ -1864,7 +1864,7 @@ void AdornedRulerPanel::DoDrawPlayRegion(wxDC * dc) r.width = PLAY_REGION_RECT_WIDTH; r.height = PLAY_REGION_TRIANGLE_SIZE*2 + 1; dc->DrawRectangle(r); - + if (end != start) { tri[0].x = x2; @@ -1880,7 +1880,7 @@ void AdornedRulerPanel::DoDrawPlayRegion(wxDC * dc) r.width = PLAY_REGION_RECT_WIDTH; r.height = PLAY_REGION_TRIANGLE_SIZE*2 + 1; dc->DrawRectangle(r); - + r.x = x1 + PLAY_REGION_TRIANGLE_SIZE; r.y = y - PLAY_REGION_RECT_HEIGHT/2 + PLAY_REGION_GLOBAL_OFFSET_Y; r.width = x2-x1 - PLAY_REGION_TRIANGLE_SIZE*2; @@ -1912,7 +1912,7 @@ void AdornedRulerPanel::DoDrawMarks(wxDC * dc, bool /*text */ ) { double min = mViewInfo->h - mLeftOffset / mViewInfo->zoom; double max = min + mInner.width / mViewInfo->zoom; - + ruler.SetTickColour( theTheme.Colour( clrTrackPanelText ) ); ruler.SetRange( min, max ); ruler.Draw( *dc ); @@ -1966,7 +1966,7 @@ void AdornedRulerPanel::DoDrawCursor(wxDC * dc) } // -//This draws the little triangular indicator on the +//This draws the little triangular indicator on the //AdornedRulerPanel. // void AdornedRulerPanel::ClearIndicator() @@ -2021,7 +2021,7 @@ void AdornedRulerPanel::SetPlayRegion(double playRegionStart, // with the mouse directly in the ruler, changes from outside are blocked. if (mMouseEventState != mesNone) return; - + mPlayRegionStart = playRegionStart; mPlayRegionEnd = playRegionEnd; Refresh(); diff --git a/src/widgets/Ruler.h b/src/widgets/Ruler.h index 75c18bc3e..10d59a6ba 100644 --- a/src/widgets/Ruler.h +++ b/src/widgets/Ruler.h @@ -101,7 +101,7 @@ class AUDACITY_DLL_API Ruler { // The following functions should allow a custom ruler setup: // autosize is a GREAT thing, but for some applications it's - // useful the definition of a label array and label step by + // useful the definition of a label array and label step by // the user. void SetCustomMode(bool value); // If this is the case, you should provide a wxString array of labels, start @@ -109,7 +109,7 @@ class AUDACITY_DLL_API Ruler { // ignored. void SetCustomMajorLabels(wxArrayString *label, int numLabel, int start, int step); void SetCustomMinorLabels(wxArrayString *label, int numLabel, int start, int step); - + // // Drawing // @@ -147,7 +147,7 @@ public: private: wxColour mTickColour; wxPen mPen; - + int mMaxWidth, mMaxHeight; int mLeft, mTop, mRight, mBottom, mLead; int mLength; @@ -177,17 +177,17 @@ private: int lx, ly; wxString text; }; - + int mNumMajor; Label *mMajorLabels; int mNumMinor; - Label *mMinorLabels; + Label *mMinorLabels; int mNumMinorMinor; - Label *mMinorMinorLabels; + Label *mMinorMinorLabels; // Returns 'zero' label coordinate (for grid drawing) int FindZero(Label * label, int len); - + public: int GetZeroPosition(); @@ -238,7 +238,7 @@ private: // This is an Audacity Specific ruler panel which additionally // has border, selection markers, play marker. -// Once TrackPanel uses wxSizers, we will derive it from some +// Once TrackPanel uses wxSizers, we will derive it from some // wxWindow and the GetSize and SetSize functions // will then be wxWidgets functions instead. class AUDACITY_DLL_API AdornedRulerPanel : public wxPanel @@ -264,7 +264,7 @@ public: void SetPlayRegion(double playRegionStart, double playRegionEnd); void ClearPlayRegion(); void GetPlayRegion(double* playRegionStart, double* playRegionEnd); - + void SetProject(AudacityProject* project) {mProject = project;}; void GetMaxSize(wxCoord *width, wxCoord *height); @@ -305,7 +305,7 @@ private: double mPlayRegionStart; double mPlayRegionEnd; - + enum MouseEventState { mesNone, mesDraggingPlayRegionStart, @@ -313,7 +313,7 @@ private: mesSelectingPlayRegionClick, mesSelectingPlayRegionRange }; - + MouseEventState mMouseEventState; int mButtonDownMousePos; int mLastMouseX; diff --git a/src/widgets/TimeTextCtrl.cpp b/src/widgets/TimeTextCtrl.cpp index cc3486ee8..4a0af86b1 100644 --- a/src/widgets/TimeTextCtrl.cpp +++ b/src/widgets/TimeTextCtrl.cpp @@ -9,7 +9,7 @@ ********************************************************************//** -\class TimeTextCtrl +\class TimeTextCtrl \brief TimeTextCtrl provides the advanced time formatting control used in the status bar of Audacity. @@ -95,7 +95,7 @@ in the status bar of Audacity. 3758.5 seconds, "*.01000 frames|29.97002997" -> "112642.358 frames" - Finally there is a further special character that can be used after a "|" + Finally there is a further special character that can be used after a "|" and that is "N". This applies special rule for NTSC drop-frame timecode. Summary of format string rules: @@ -132,17 +132,17 @@ in the status bar of Audacity. *******************************************************************//** \class TimeConverter -\brief TimeConverter has all the time conversion and snapping -functionality that used to live in TimeTextCtrl. The idea is to have -a GUI-less class which can do the conversions, so that we can use it +\brief TimeConverter has all the time conversion and snapping +functionality that used to live in TimeTextCtrl. The idea is to have +a GUI-less class which can do the conversions, so that we can use it in sanpping without having a window created each time. *//****************************************************************//** \class BuiltinFormatString -\brief BuiltinFormatString is a structure used in the TimeTextCtrl -and holds both a descriptive name for the string format and a -printf inspired style format string, optimised for displaying time in +\brief BuiltinFormatString is a structure used in the TimeTextCtrl +and holds both a descriptive name for the string format and a +printf inspired style format string, optimised for displaying time in different formats. *//****************************************************************//** @@ -305,7 +305,7 @@ TimeConverter::TimeConverter(const wxString & formatName, * unless there aren't 60 seconds in a minute in your locale */ BuiltinFormatStrings[5].formatStr = _("0100 h 060 m 060 s+.# samples"); /* i18n-hint: Name of time display format that shows time in samples (at the - * current project sample rate). For example the number of a sample at 1 + * current project sample rate). For example the number of a sample at 1 * second into a recording at 44.1KHz would be 44,100. */ BuiltinFormatStrings[6].name = _("samples"); @@ -345,7 +345,7 @@ TimeConverter::TimeConverter(const wxString & formatName, /* i18n-hint: Format string for displaying time in hours, minutes, seconds * and frames with NTSC drop frames. Change the 'h' to the abbreviation * for hours, 'm' to the abbreviation for minutes, 's' to the abbreviation - * for seconds and translate 'frames'. Leave the | .999000999 alone, + * for seconds and translate 'frames'. Leave the | .999000999 alone, * the whole things really is slightly off-speed! */ BuiltinFormatStrings[10].formatStr = _("0100 h 060 m 060 s+.030 frames| .999000999"); /* i18n-hint: Name of time display format that shows time in frames at NTSC @@ -469,7 +469,7 @@ void TimeConverter::ParseFormatString( const wxString & format) // Hack: always zeropad zeropad = true; - + if (inFrac) { int base = fracMult * range; mFields.Add(TimeField(inFrac, base, range, zeropad)); @@ -596,7 +596,7 @@ void TimeConverter::ValueToControls(double RawTime, bool nearest /* = true */) if(round) t_int = sampleCount(theValue + (nearest ? 0.5f : 0.0f)); else - { + { wxASSERT( mFields[mFields.GetCount()-1].frac ); theValue += (nearest ? 0.5f : 0.0f) / mFields[mFields.GetCount()-1].base; t_int = sampleCount(theValue); @@ -646,7 +646,7 @@ void TimeConverter::ValueToControls(double RawTime, bool nearest /* = true */) // The rounding is not propogating to earlier fields in the frac case. //value = (int)(t_frac * mFields[i].base + 0.5); // +0.5 as rounding required // I did the rounding earlier. - value = (int)(t_frac * mFields[i].base); + value = (int)(t_frac * mFields[i].base); // JKC: TODO: Find out what the range is supposed to do. // It looks bogus too. //if (mFields[i].range > 0) @@ -762,7 +762,7 @@ int TimeConverter::GetFormatIndex() return ndx; } - + int TimeConverter::GetNumBuiltins() { return (sizeof(BuiltinFormatStrings) / sizeof(BuiltinFormatStrings[0])); @@ -938,7 +938,7 @@ TimeTextCtrl::TimeTextCtrl(wxWindow *parent, Fit(); ValueToControls(); //mchinen - aug 15 09 - this seems to put the mTimeValue back to zero, and do nothing else. - //ControlsToValue(); + //ControlsToValue(); mScrollRemainder = 0.0; @@ -1283,7 +1283,7 @@ void TimeTextCtrl::OnMouse(wxMouseEvent &event) } else if( event.m_wheelRotation != 0 ) { double steps = event.m_wheelRotation / - (event.m_wheelDelta > 0 ? (double)event.m_wheelDelta : 120.0) + + (event.m_wheelDelta > 0 ? (double)event.m_wheelDelta : 120.0) + mScrollRemainder; mScrollRemainder = steps - floor(steps); steps = floor(steps); @@ -1343,7 +1343,7 @@ void TimeTextCtrl::OnKeyUp(wxKeyEvent &event) int keyCode = event.GetKeyCode(); event.Skip(true); - + if ((keyCode >= WXK_NUMPAD0) && (keyCode <= WXK_NUMPAD9)) keyCode -= WXK_NUMPAD0 - '0'; @@ -1407,12 +1407,12 @@ void TimeTextCtrl::OnKeyDown(wxKeyEvent &event) mFocusedDigit %= mDigits.GetCount(); Refresh(); } - + else if (keyCode == WXK_HOME) { mFocusedDigit = 0; Refresh(); } - + else if (keyCode == WXK_END) { mFocusedDigit = mDigits.GetCount() - 1; Refresh(); @@ -1428,7 +1428,7 @@ void TimeTextCtrl::OnKeyDown(wxKeyEvent &event) Updated(); } - else if (keyCode == WXK_TAB) { + else if (keyCode == WXK_TAB) { wxWindow *parent = GetParent(); wxNavigationKeyEvent nevent; nevent.SetWindowChange(event.ControlDown()); @@ -1437,7 +1437,7 @@ void TimeTextCtrl::OnKeyDown(wxKeyEvent &event) nevent.SetCurrentFocus(parent); GetParent()->ProcessEvent(nevent); event.Skip(false); - } + } else if (keyCode == WXK_RETURN || keyCode == WXK_NUMPAD_ENTER) { wxTopLevelWindow *tlw = wxDynamicCast(wxGetTopLevelParent(this), wxTopLevelWindow); @@ -1633,9 +1633,9 @@ wxAccStatus TimeTextCtrlAx::GetKeyboardShortcut(int WXUNUSED(childId), wxString // rect is in screen coordinates. wxAccStatus TimeTextCtrlAx::GetLocation(wxRect & rect, int elementId) { - if ((elementId != wxACC_SELF) && + if ((elementId != wxACC_SELF) && // We subtract 1, below, and need to avoid neg index to mDigits. - (elementId > 0)) + (elementId > 0)) { // rect.x += mCtrl->mFields[elementId - 1].fieldX; // rect.width = mCtrl->mFields[elementId - 1].fieldW; @@ -1656,17 +1656,17 @@ wxAccStatus TimeTextCtrlAx::GetName(int childId, wxString *name) { // Slightly messy trick to save us some prefixing. TimeFieldArray & mFields = mCtrl->mFields; - + wxString value = mCtrl->GetTimeString(); int field = mCtrl->GetFocusedField(); // Return the entire time string including the control label // when the requested child ID is wxACC_SELF. (Mainly when // the control gets the focus.) - if ((childId == wxACC_SELF) || - // We subtract 1 from childId in the other cases below, and + if ((childId == wxACC_SELF) || + // We subtract 1 from childId in the other cases below, and // need to avoid neg index to mDigits, so funnel into this clause. - (childId < 1)) + (childId < 1)) { *name = mCtrl->GetName(); if (name->IsEmpty()) { diff --git a/src/widgets/Warning.cpp b/src/widgets/Warning.cpp index c763c4cd3..64f50bdb0 100644 --- a/src/widgets/Warning.cpp +++ b/src/widgets/Warning.cpp @@ -35,10 +35,10 @@ class WarningDialog : public wxDialog { public: // constructors and destructors - WarningDialog(wxWindow *parent, + WarningDialog(wxWindow *parent, wxString message, bool showCancelButton); - + private: void OnOK(wxCommandEvent& event); @@ -52,8 +52,8 @@ BEGIN_EVENT_TABLE(WarningDialog, wxDialog) END_EVENT_TABLE() WarningDialog::WarningDialog(wxWindow *parent, wxString message, bool showCancelButton) -: wxDialog(parent, wxID_ANY, (wxString)_("Warning"), - wxDefaultPosition, wxDefaultSize, +: wxDialog(parent, wxID_ANY, (wxString)_("Warning"), + wxDefaultPosition, wxDefaultSize, (showCancelButton ? wxDEFAULT_DIALOG_STYLE : wxCAPTION | wxSYSTEM_MENU)) // Unlike wxDEFAULT_DIALOG_STYLE, no wxCLOSE_BOX. { SetIcon(wxArtProvider::GetIcon(wxART_WARNING, wxART_MESSAGE_BOX)); diff --git a/src/xml/XMLFileReader.cpp b/src/xml/XMLFileReader.cpp index 480324c16..1709966e6 100644 --- a/src/xml/XMLFileReader.cpp +++ b/src/xml/XMLFileReader.cpp @@ -27,7 +27,7 @@ XMLFileReader::XMLFileReader() mParser = XML_ParserCreate(NULL); XML_SetUserData(mParser, (void *)this); XML_SetElementHandler(mParser, startElement, endElement); - XML_SetCharacterDataHandler(mParser, charHandler); + XML_SetCharacterDataHandler(mParser, charHandler); mBaseHandler = NULL; mMaxDepth = 128; mHandler = new XMLTagHandler*[mMaxDepth]; diff --git a/src/xml/XMLTagHandler.cpp b/src/xml/XMLTagHandler.cpp index 46d3b9cc6..0d20b6869 100644 --- a/src/xml/XMLTagHandler.cpp +++ b/src/xml/XMLTagHandler.cpp @@ -16,7 +16,7 @@ using XML files. \class XMLValueChecker -\brief XMLValueChecker implements static bool methods for checking +\brief XMLValueChecker implements static bool methods for checking input values from XML files. *//*******************************************************************/ @@ -52,7 +52,7 @@ bool XMLValueChecker::IsGoodString(const wxString str) bool XMLValueChecker::IsGoodFileName(const wxString strFileName, const wxString strDirName /* = "" */) { // Test strFileName. - if (!IsGoodFileString(strFileName) || + if (!IsGoodFileString(strFileName) || (strDirName.Length() + 1 + strFileName.Length() > PLATFORM_MAX_PATH)) return false; @@ -63,24 +63,24 @@ bool XMLValueChecker::IsGoodFileName(const wxString strFileName, const wxString bool XMLValueChecker::IsGoodFileString(wxString str) { - return (IsGoodString(str) && - !str.IsEmpty() && + return (IsGoodString(str) && + !str.IsEmpty() && - // FILENAME_MAX is 260 in MSVC, but inconsistent across platforms, + // FILENAME_MAX is 260 in MSVC, but inconsistent across platforms, // sometimes huge, but we use 260 for all platforms. - (str.Length() <= 260) && + (str.Length() <= 260) && - (str.Find(wxFileName::GetPathSeparator()) == -1)); // No path separator characters. + (str.Find(wxFileName::GetPathSeparator()) == -1)); // No path separator characters. } bool XMLValueChecker::IsGoodSubdirName(const wxString strSubdirName, const wxString strDirName /* = "" */) { - // Test strSubdirName. - // Note this prevents path separators, and relative path to parents (strDirName), - // so fixes vulnerability #3 in the NGS report for UmixIt, + // Test strSubdirName. + // Note this prevents path separators, and relative path to parents (strDirName), + // so fixes vulnerability #3 in the NGS report for UmixIt, // where an attacker could craft an AUP file with relative pathnames to get to system files, for example. - if (!IsGoodFileString(strSubdirName) || - (strSubdirName == wxT(".")) || (strSubdirName == wxT("..")) || + if (!IsGoodFileString(strSubdirName) || + (strSubdirName == wxT(".")) || (strSubdirName == wxT("..")) || (strDirName.Length() + 1 + strSubdirName.Length() > PLATFORM_MAX_PATH)) return false; @@ -98,8 +98,8 @@ bool XMLValueChecker::IsGoodPathName(const wxString strPathName) bool XMLValueChecker::IsGoodPathString(wxString str) { - return (IsGoodString(str) && - !str.IsEmpty() && + return (IsGoodString(str) && + !str.IsEmpty() && (str.Length() <= PLATFORM_MAX_PATH)); } @@ -124,7 +124,7 @@ bool XMLValueChecker::IsGoodInt(const wxString strInt) for (i = 0; i < lenMAXABS; i++) if (strInt[i+1] < '0' || strInt[i+1] > '9') return false; // not a digit - + for (i = 0; i < lenMAXABS; i++) if (strInt[i+1] - '0' < digitsMAXABS[i]) return true; // number is small enough @@ -165,7 +165,7 @@ bool XMLValueChecker::IsGoodInt64(const wxString strInt) for (i = 0; i < lenMAXABS; i++) if (strInt[i+1] < '0' || strInt[i+1] > '9') return false; // not a digit - + for (i = 0; i < lenMAXABS; i++) if (strInt[i+1] - '0' < digitsMAXABS[i]) return true; // number is small enough @@ -214,7 +214,7 @@ bool XMLTagHandler::ReadXMLTag(const char *tag, const char **attrs) // JKC: Previously the next line was: // const char **out_attrs = new char (const char *)[tmp_attrs.GetCount()+1]; -// however MSVC doesn't like the constness in this position, so this is now +// however MSVC doesn't like the constness in this position, so this is now // added by a cast after creating the array of pointers-to-non-const chars. const wxChar **out_attrs = (const wxChar**)new wxChar *[tmp_attrs.GetCount()+1]; for (size_t i=0; i\n")); mInTag = false; } - + for (i = 0; i < mDepth; i++) { Write(wxT("\t")); } @@ -98,7 +98,7 @@ void XMLWriter::EndTag(const wxString &name) if (mInTag) { Write(wxT("/>\n")); } - else { + else { for (i = 0; i < mDepth - 1; i++) { Write(wxT("\t")); } @@ -296,7 +296,7 @@ wxString XMLWriter::XMLEsc(const wxString & s) //see xmltok.c in expat checkCharRefNumber() to see how expat bails on these chars. //also see wxWidgets-2.8.12/src/expat/lib/asciitab.h to see which characters are nonxml compatible //post decode (we can still encode '&' and '<' with this table, but it prevents us from encoding eot) - //everything is compatible past ascii 0x20, so we don't check higher than this. + //everything is compatible past ascii 0x20, so we don't check higher than this. if(c> 0x1F || charXMLCompatiblity[c]!=0) result += wxString::Format(wxT("&#x%04x;"), c); } @@ -346,7 +346,7 @@ void XMLFileWriter::CloseWithoutEndingTags() if (!wxFFile::Flush()) { wxFFile::Close(); - /* i18n-hint: 'flushing' means writing any remaining queued up changes + /* i18n-hint: 'flushing' means writing any remaining queued up changes * to disk that have not yet been written.*/ throw new XMLFileWriterException(_("Error Flushing File")); } diff --git a/src/xml/XMLWriter.h b/src/xml/XMLWriter.h index d51c95517..c8518b01e 100644 --- a/src/xml/XMLWriter.h +++ b/src/xml/XMLWriter.h @@ -81,7 +81,7 @@ class AUDACITY_DLL_API XMLFileWriter:public wxFFile, public XMLWriter { /// Open the file. Might throw XMLFileWriterException. void Open(const wxString &name, const wxString &mode); - + /// Close file. Might throw XMLFileWriterException. void Close();