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("
") + par1Str +
wxT("
") + par2Str + - 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("
"); @@ -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("- 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;i
"); } } - + // 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; i GetChannel() == 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("")) + _(" ") + _("Welcome to Audacity ") + AUDACITY_VERSION_STRING + wxT("! How to Get Help
") + - _("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) && (x xText+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; i GetStreamTime(), 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; i AddItem(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; i GetChannelGain(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;i GetODType() & 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;i AddNewTask(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;i Points;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;i Points;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;i Points;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+1 Item(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/4 CreateGrid(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; i GetNumCachedLocations(); 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 ----------------------------+