~ubuntu-branches/ubuntu/gutsy/audacity/gutsy-backports

« back to all changes in this revision

Viewing changes to src/effects/ladspa/LadspaEffect.cpp

  • Committer: Bazaar Package Importer
  • Author(s): John Dong
  • Date: 2008-02-18 21:58:19 UTC
  • mfrom: (13.1.2 hardy)
  • Revision ID: james.westby@ubuntu.com-20080218215819-tmbcf1rx238r8gdv
Tags: 1.3.4-1.1ubuntu1~gutsy1
Automated backport upload; no source changes.

Show diffs side-by-side

added added

removed removed

Lines of Context:
246
246
 
247
247
bool LadspaEffect::Process()
248
248
{
249
 
   TrackListIterator iter(mWaveTracks);
 
249
   this->CopyInputWaveTracks(); // Set up m_pOutputWaveTracks.
 
250
   bool bGoodResult = true;
 
251
 
 
252
   TrackListIterator iter(m_pOutputWaveTracks);
250
253
   int count = 0;
251
254
   Track *left = iter.First();
252
255
   Track *right;
261
264
         GetSamples((WaveTrack *)right, &rstart, &len);
262
265
      }
263
266
 
264
 
      bool success = false;
265
 
 
266
267
      if (inputs < 2 && right) {
267
268
         // If the effect is mono, apply to each channel separately
268
269
 
269
 
         success = ProcessStereo(count, (WaveTrack *)left, NULL,
270
 
                                 lstart, 0, len);
271
 
         if (success)
272
 
            success = ProcessStereo(count, (WaveTrack *)right, NULL,
 
270
         bGoodResult = ProcessStereo(count, (WaveTrack *)left, NULL,
 
271
                                 lstart, 0, len) && 
 
272
                        ProcessStereo(count, (WaveTrack *)right, NULL,
273
273
                                    rstart, 0, len);
274
274
      }
275
 
      else success = ProcessStereo(count,
 
275
      else bGoodResult = ProcessStereo(count,
276
276
                                   (WaveTrack *)left, (WaveTrack *)right,
277
277
                                   lstart, rstart, len);
278
 
      if (!success)
279
 
         return false;
 
278
      if (!bGoodResult)
 
279
         break;
280
280
   
281
281
      left = iter.Next();
282
282
      count++;
283
283
   }
284
284
 
285
 
   return true;
 
285
   this->ReplaceProcessedWaveTracks(bGoodResult); 
 
286
   return bGoodResult;
286
287
}
287
288
 
288
289
bool LadspaEffect::ProcessStereo(int count, WaveTrack *left, WaveTrack *right,
506
507
    EVT_SET_FOCUS(TextCtrl::OnSetFocus)
507
508
END_EVENT_TABLE()
508
509
 
509
 
const int LADSPA_PREVIEW_ID = 13100;
510
510
const int LADSPA_SECONDS_ID = 13101;
511
511
 
512
512
BEGIN_EVENT_TABLE(LadspaEffectDialog, wxDialog)
513
513
    EVT_BUTTON(wxID_OK, LadspaEffectDialog::OnOK)
514
514
    EVT_BUTTON(wxID_CANCEL, LadspaEffectDialog::OnCancel)
515
 
    EVT_BUTTON(LADSPA_PREVIEW_ID, LadspaEffectDialog::OnPreview)
 
515
    EVT_BUTTON(ID_EFFECT_PREVIEW, LadspaEffectDialog::OnPreview)
516
516
    EVT_SLIDER(wxID_ANY, LadspaEffectDialog::OnSlider)
517
517
    EVT_TEXT(wxID_ANY, LadspaEffectDialog::OnTextCtrl)
518
518
    EVT_CHECKBOX(wxID_ANY, LadspaEffectDialog::OnCheckBox)
599
599
   w->SetScrollRate(0, 20);
600
600
   vSizer->Add(w, 1, wxEXPAND|wxALL, 5);
601
601
 
602
 
   wxBoxSizer *okSizer = new wxBoxSizer(wxHORIZONTAL);
603
 
 
604
 
   wxButton *button;
605
 
 
606
 
   button = new wxButton(this, LADSPA_PREVIEW_ID, effect->GetPreviewName());
607
 
   okSizer->Add(button, 0, wxALIGN_CENTRE | wxALL, 5);
608
 
 
609
 
   button = new wxButton(this, wxID_CANCEL, _("&Cancel"));
610
 
   okSizer->Add(button, 0, wxALIGN_CENTRE | wxALL, 5);
611
 
 
612
 
   button = new wxButton(this, wxID_OK, _("&OK"));
613
 
   button->SetDefault();
614
 
   okSizer->Add(button, 0, wxALIGN_CENTRE | wxALL, 5);
615
 
 
616
 
   vSizer->Add(okSizer, 0, wxALIGN_CENTRE | wxALL, 5);
 
602
   // Preview, OK, & Cancel buttons
 
603
   vSizer->Add(CreateStdButtonSizer(this, ePreviewButton|eCancelButton|eOkButton), 0, wxEXPAND);
617
604
 
618
605
   SetSizer(vSizer);
619
606