From 4ec1393c271c0a5cfeb85099e54ed4599d301b08 Mon Sep 17 00:00:00 2001 From: Steve Daulton Date: Tue, 21 Aug 2018 16:28:59 +0100 Subject: [PATCH] Error if Nyquist Prompt requires track election --- src/effects/nyquist/Nyquist.cpp | 24 ++++++++++++++++-------- 1 file changed, 16 insertions(+), 8 deletions(-) diff --git a/src/effects/nyquist/Nyquist.cpp b/src/effects/nyquist/Nyquist.cpp index 49f8adc41..7f27ff5c0 100644 --- a/src/effects/nyquist/Nyquist.cpp +++ b/src/effects/nyquist/Nyquist.cpp @@ -637,6 +637,17 @@ bool NyquistEffect::Process() mTrackIndex = 0; mNumSelectedChannels = 0; + + // If in tool mode, then we don't do anything with the track and selection. + bool bOnePassTool = (GetType() == EffectTypeTool); + + // We must copy all the tracks, because Paste needs label tracks to ensure + // correct sync-lock group behavior when the timeline is affected; then we just want + // to operate on the selected wave tracks. + // Also need to set up mOutputTracks for channel count. + if( !bOnePassTool ) + CopyInputTracks(Track::All); + SelectedTrackListOfKindIterator sel(Track::Wave, mOutputTracks.get()); for (WaveTrack *t = (WaveTrack *) sel.First(); t; t = (WaveTrack *) sel.Next()) { mNumSelectedChannels++; @@ -773,15 +784,12 @@ bool NyquistEffect::Process() mProps += wxString::Format(wxT("(putprop '*SELECTION* %d 'CHANNELS)\n"), mNumSelectedChannels); } - // If in tool mode, then we don't do anything with the track and selection. - bool bOnePassTool = (GetType() == EffectTypeTool); + // Nyquist Prompt does not require a selection, but effects do. + if (!bOnePassTool && (mNumSelectedChannels == 0)) { + wxString message = _("Cannot run command without a selection."); + Effect::MessageBox(message, wxOK | wxCENTRE | wxICON_EXCLAMATION, _("Nyquist Error")); + } - - // We must copy all the tracks, because Paste needs label tracks to ensure - // correct sync-lock group behavior when the timeline is affected; then we just want - // to operate on the selected wave tracks - if( !bOnePassTool ) - CopyInputTracks(Track::All); SelectedTrackListOfKindIterator iter(Track::Wave, mOutputTracks.get()); mCurTrack[0] = (WaveTrack *)iter.First();