195
205
return TotalProgress((whichGroup+frac)/mNumGroups);
211
// Use these two methods to copy the input tracks to m_pOutputWaveTracks, if
212
// doing the processing on them, and replacing the originals only on success (and not cancel).
213
void Effect::CopyInputWaveTracks()
215
if (this->GetNumWaveTracks() <= 0)
218
// Copy the mWaveTracks, to process the copies.
219
TrackListIterator iterIn(mWaveTracks);
220
WaveTrack* pInWaveTrack = (WaveTrack*)(iterIn.First());
221
m_pOutputWaveTracks = new TrackList();
222
WaveTrack* pOutWaveTrack = NULL;
223
while (pInWaveTrack != NULL)
225
pOutWaveTrack = mFactory->DuplicateWaveTrack(*(WaveTrack*)pInWaveTrack);
226
m_pOutputWaveTracks->Add(pOutWaveTrack);
227
pInWaveTrack = (WaveTrack*)(iterIn.Next());
232
// If bGoodResult, replace mWaveTracks tracks in mTracks with successfully processed
233
// m_pOutputWaveTracks copies, get rid of old mWaveTracks, and set mWaveTracks to m_pOutputWaveTracks.
234
// Else clear and delete m_pOutputWaveTracks copies.
235
void Effect::ReplaceProcessedWaveTracks(const bool bGoodResult)
239
// Circular replacement of the input wave tracks with the processed m_pOutputWaveTracks tracks.
240
// But mWaveTracks is temporary, so replace in mTracks. More bookkeeping.
241
TrackListIterator iterIn(mWaveTracks);
242
WaveTrack* pInWaveTrack = (WaveTrack*)(iterIn.First());
244
wxASSERT(m_pOutputWaveTracks != NULL); // Make sure we at least did the CopyInputWaveTracks().
245
TrackListIterator iterOut(m_pOutputWaveTracks);
246
WaveTrack* pOutWaveTrack = (WaveTrack*)(iterOut.First());
248
TrackListIterator iterAllTracks(mTracks);
249
Track* pFirstTrack = iterAllTracks.First();
250
Track* pTrack = pFirstTrack;
253
if (pTrack == pInWaveTrack)
255
// Replace pInWaveTrack with processed pOutWaveTrack, at end of list.
256
mTracks->Add(pOutWaveTrack);
258
if (pTrack == pFirstTrack)
259
pFirstTrack = pOutWaveTrack; // We replaced the first track, so update stop condition.
261
pInWaveTrack = (WaveTrack*)(iterIn.Next());
262
pOutWaveTrack = (WaveTrack*)(iterOut.Next());
265
mTracks->Add(pTrack); // Add pTrack back to end of list.
267
// Remove former pTrack from front of list and set pTrack to next.
268
pTrack = iterAllTracks.RemoveCurrent();
269
} while (pTrack != pFirstTrack);
271
// Also need to clean up mWaveTracks, primarily because Preview uses it as the processed tracks.
273
mWaveTracks = m_pOutputWaveTracks;
277
// Processing failed or was cancelled so throw away the processed tracks.
278
m_pOutputWaveTracks->Clear(true); // true => delete the tracks
198
282
void Effect::CountWaveTracks()
312
396
WaveTrackArray playbackTracks;
313
397
WaveTrackArray recordingTracks;
398
// Probably not the same tracks post-processing, so can't rely on previous values of mixLeft & mixRight.
399
TrackListIterator iter(mWaveTracks);
400
mixLeft = (WaveTrack*)(iter.First());
401
mixRight = (WaveTrack*)(iter.Next());
314
402
playbackTracks.Add(mixLeft);
316
404
playbackTracks.Add(mixRight);
319
406
// Start audio playing
373
460
PopulateOrExchange(S);
376
S.StartHorizontalLay(wxALIGN_BOTTOM | wxALIGN_CENTER, false);
462
long buttons = eOkButton;
464
if (mType == PROCESS_EFFECT || mType == INSERT_EFFECT)
466
buttons |= eCancelButton;
378
467
if (mType == PROCESS_EFFECT)
380
S.StartHorizontalLay(wxALIGN_LEFT, false);
382
S.Id(ID_EFFECT_PREVIEW).AddButton(_("Pre&view"));
384
S.EndHorizontalLay();
387
S.StartHorizontalLay(wxALIGN_LEFT, false);
389
// Everyone needs a little space sometime
391
S.EndHorizontalLay();
395
S.StartHorizontalLay(wxALIGN_CENTER, false);
397
#if defined(__WXGTK20__) || defined(__WXMAC__)
399
.AddButton(_("&Cancel"))
400
->Show( mType == PROCESS_EFFECT || mType == INSERT_EFFECT);
401
S.Id(wxID_OK).AddButton(_("&OK"))->SetDefault();
403
S.Id(wxID_OK).AddButton(_("&OK"))->SetDefault();
405
.AddButton(_("&Cancel"))
406
->Show( mType == PROCESS_EFFECT || mType == INSERT_EFFECT);
469
buttons |= ePreviewButton;
410
S.EndHorizontalLay();
472
S.AddStandardButtons(buttons);
412
474
S.EndVerticalLay();
413
GetSizer()->AddSpacer(5);
416
478
SetMinSize(GetSize());