From 8ae361d41592b46ea6180cad98246fdb2f9d56c7 Mon Sep 17 00:00:00 2001 From: Paul Licameli Date: Sat, 2 Apr 2016 15:43:37 -0400 Subject: [PATCH] Fix some of the compilation breakage in EXPERIMENTAL_SCOREALIGN... ... But some of the header files and functions just don't exist any more. --- src/Menus.cpp | 26 ++++++++++---------------- src/effects/ScoreAlignDialog.cpp | 2 +- 2 files changed, 11 insertions(+), 17 deletions(-) diff --git a/src/Menus.cpp b/src/Menus.cpp index ebae67322..8acb837af 100644 --- a/src/Menus.cpp +++ b/src/Menus.cpp @@ -6128,7 +6128,6 @@ void AudacityProject::OnScoreAlign() int numNoteTracksSelected = 0; int numOtherTracksSelected = 0; NoteTrack *nt; - NoteTrack *alignedNoteTrack; double endTime = 0.0; // Iterate through once to make sure that there is exactly @@ -6167,14 +6166,14 @@ void AudacityProject::OnScoreAlign() //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 - alignedNoteTrack = (NoteTrack *) nt->Duplicate(); + auto holder = nt->Duplicate(); + auto alignedNoteTrack = static_cast(holder.get()); // Duplicate() on note tracks serializes seq to a buffer, but we need // the seq, so Duplicate again and discard the track with buffer. The // test is here in case Duplicate() is changed in the future. if (alignedNoteTrack->GetSequence() == NULL) { - NoteTrack *temp = (NoteTrack *) alignedNoteTrack->Duplicate(); - delete alignedNoteTrack; - alignedNoteTrack = temp; + holder = alignedNoteTrack->Duplicate(); + alignedNoteTrack = static_cast(holder.get()); assert(alignedNoteTrack->GetSequence()); } // Remove offset from NoteTrack because audio is @@ -6187,15 +6186,14 @@ void AudacityProject::OnScoreAlign() } alignedNoteTrack->SetOffset(0); - WaveTrack **waveTracks; - mTracks->GetWaveTracks(true /* selectionOnly */, - &numWaveTracksSelected, &waveTracks); + WaveTrackConstArray waveTracks = + mTracks->GetWaveTrackConstArray(true /* selectionOnly */); int result; { - Mixer mix(numWaveTracksSelected, // int numInputTracks - waveTracks, // WaveTrack **inputTracks - mTracks->GetTimeTrack(), // TimeTrack *timeTrack + Mixer mix( + waveTracks, // const WaveTrackConstArray &inputTracks + Mixer::WarpOptions{ mTracks->GetTimeTrack() }, // const WarpOptions &warpOptions 0.0, // double startTime endTime, // double stopTime 2, // int numOutChannels @@ -6205,7 +6203,6 @@ void AudacityProject::OnScoreAlign() floatSample, // sampleFormat outFormat true, // bool highQuality = true NULL); // MixerSpec *mixerSpec = NULL - delete [] waveTracks; ASAProgress progress; @@ -6225,7 +6222,7 @@ void AudacityProject::OnScoreAlign() } if (result == SA_SUCCESS) { - mTracks->Replace(nt, alignedNoteTrack, true); + mTracks->Replace(nt, std::move(holder)); RedrawProject(); wxMessageBox(wxString::Format( _("Alignment completed: MIDI from %.2f to %.2f secs, Audio from %.2f to %.2f secs."), @@ -6233,7 +6230,6 @@ void AudacityProject::OnScoreAlign() 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, @@ -6241,11 +6237,9 @@ void AudacityProject::OnScoreAlign() } else if (result == SA_CANCEL) { // wrong way to recover... //GetActiveProject()->OnUndo(); // recover any changes to note track - delete alignedNoteTrack; return; // no message when user cancels alignment } else { //GetActiveProject()->OnUndo(); // recover any changes to note track - delete alignedNoteTrack; wxMessageBox(_("Internal error reported by alignment process.")); } } diff --git a/src/effects/ScoreAlignDialog.cpp b/src/effects/ScoreAlignDialog.cpp index f0e3370a0..3fb207d74 100644 --- a/src/effects/ScoreAlignDialog.cpp +++ b/src/effects/ScoreAlignDialog.cpp @@ -106,7 +106,7 @@ ScoreAlignDialog::ScoreAlignDialog(wxWindow *parent, ScoreAlignParams ¶ms) mFramePeriodText = S.AddVariableText(SA_DFT_FRAME_PERIOD_TEXT, true, wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL); - mWindowSizeLabel = S.AddVariableText(_("Window Size":), true, + mWindowSizeLabel = S.AddVariableText(_("Window Size:"), true, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL); S.SetStyle(wxSL_HORIZONTAL); mWindowSizeSlider = S.Id(ID_WINDOWSIZE).AddSlider(wxT(""),