当前位置: 首页>>代码示例>>C++>>正文


C++ Track::GetLinked方法代码示例

本文整理汇总了C++中Track::GetLinked方法的典型用法代码示例。如果您正苦于以下问题:C++ Track::GetLinked方法的具体用法?C++ Track::GetLinked怎么用?C++ Track::GetLinked使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Track的用法示例。


在下文中一共展示了Track::GetLinked方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: Init

bool LadspaEffect::Init()
{
    mBlockSize = 0;
    mainRate = 0;

    TrackListIterator iter(mWaveTracks);
    Track *left = iter.First();
    while(left) {
        if (mainRate == 0)
            mainRate = (int)(((WaveTrack *)left)->GetRate() + 0.5);

        if (left->GetLinked()) {
            Track *right = iter.Next();

            if (((WaveTrack *)left)->GetRate() !=
                    ((WaveTrack *)right)->GetRate()) {
                wxMessageBox(_("Sorry, Plug-in Effects cannot be performed on stereo tracks where the individual channels of the track do not match."));
                return false;
            }
        }

        left = iter.Next();
    }

    if (mainRate<=0)
        mainRate = (int)(mProjectRate + 0.5);

    return true;
}
开发者ID:ruthmagnus,项目名称:audacity,代码行数:29,代码来源:LadspaEffect.cpp

示例2: IsMono

bool BatchCommands::IsMono()
{
   AudacityProject *project = GetActiveProject();
   if( project == NULL )
   {
      //wxMessageBox( wxT("No project and no Audio to process!") );
      return false;
   }

   TrackList * tracks = project->GetTracks();
   if( tracks == NULL )
   {
      //wxMessageBox( wxT("No tracks to process!") );
      return false;
   }

   TrackListIterator iter(tracks);
   Track *t = iter.First();
   bool mono = true;
   while (t) {
      if (t->GetLinked()) {
         mono = false;
         break;
      }
      t = iter.Next();
   }

   return mono;
}
开发者ID:JordanGraves,项目名称:TabMagic,代码行数:29,代码来源:BatchCommands.cpp

示例3: CountTracksAndLabels

void ExportMultiple::CountTracksAndLabels()
{
   mLabels = NULL;
   mNumLabels = 0;
   mNumWaveTracks = 0;

   Track* pTrack;
   for (pTrack = mIterator.First(mTracks); pTrack != NULL; pTrack = mIterator.Next())
   {
      switch (pTrack->GetKind())
      {
         // Count WaveTracks, and for linked pairs, count only the second of the pair.
         case Track::Wave:
         {
            if (pTrack->GetLinked() == false)
               mNumWaveTracks++;
            break;
         }
         case Track::Label:
         {
            // Supports only one LabelTrack. 
            if (mLabels == NULL) {
               mLabels = (LabelTrack*)pTrack;
               mNumLabels = mLabels->GetNumLabels();
            }
            break;
         }
      }
   }
}
开发者ID:andreipaga,项目名称:audacity,代码行数:30,代码来源:ExportMultiple.cpp

示例4: CountTracksAndLabels

void ExportMultiple::CountTracksAndLabels()
{
   mLabels = NULL;
   mNumLabels = 0;
   mNumWaveTracks = 0;

   Track* pTrack;
   for (pTrack = mIterator->First(mTracks); pTrack != NULL; pTrack = mIterator->Next())
   {
      switch (pTrack->GetKind())
      {
         // Count WaveTracks, and for linked pairs, count only the second of the pair.
         case Track::Wave:
         {
            if (!pTrack->GetMute() && !pTrack->GetLinked()) // Don't count muted tracks.
               mNumWaveTracks++;
            break;
         }

         // Only support one label track???
         case Track::Label:
         {
            // Supports only one LabelTrack.
            if (mLabels == NULL) {
               mLabels = (LabelTrack*)pTrack;
               mNumLabels = mLabels->GetNumLabels();
            }
            break;
         }
      }
   }
}
开发者ID:jengelh,项目名称:audacity,代码行数:32,代码来源:ExportMultiple.cpp

示例5: ShowModal

int ExportMultiple::ShowModal()
{
   Track *tr;

   mLabels = NULL;
   mNumLabels = 0;
   mNumTracks = 0;

   // Examine the track list looking for Wave and Label tracks
   for (tr = mIterator.First(mTracks); tr != NULL; tr = mIterator.Next()) {
      switch (tr->GetKind())
      {
         // Only count WaveTracks, and for linked pairs, only count the
         // second one of the pair
         case Track::Wave:
         {
            if (tr->GetLinked() == false) {
               mNumTracks++;
            }

            break;
         }

         // Only support one label track???
         case Track::Label:
         {
            if (mLabels == NULL) {
               mLabels = (LabelTrack *)tr;
               mNumLabels = mLabels->GetNumLabels();
            }

            break;
         }
      }
   }

   if (mNumTracks < 2 && mNumLabels < 1) {
      ::wxMessageBox(_("If you have more than one Audio Track, you can export each track as a separate file,\nor if you have a Label Track, you can export a new file for each label.\n\nThis project does not have multiple tracks or a Label Track, so you cannot export multiple files."),
                     _("Can't export multiple files"),
                     wxOK | wxCENTRE, this);
      return wxID_CANCEL;
   }

   if (mNumLabels < 1) {
      mLabel->Enable(false);
      mTrack->SetValue(true);
      mLabel->SetValue(false);
   }

   if (mNumTracks < 2) {
      mTrack->Enable(false);
      mLabel->SetValue(true);
      mTrack->SetValue(false);
   }

   EnableControls();

   return wxDialog::ShowModal();
}
开发者ID:ruthmagnus,项目名称:audacity,代码行数:59,代码来源:ExportMultiple.cpp

示例6: iter

bool LV2Effect::Process()
{
   CopyInputTracks();
   bool bGoodResult = true;

   TrackListIterator iter(mOutputTracks);
   int count = 0;
   Track *left = iter.First();
   Track *right = NULL;
   while (left)
   {
      sampleCount lstart = 0, rstart = 0;
      sampleCount len;
      GetSamples((WaveTrack *)left, &lstart, &len);
      
      right = NULL;
      if (left->GetLinked() && mAudioInputs.GetCount() > 1)
      {
         right = iter.Next();         
         GetSamples((WaveTrack *)right, &rstart, &len);
      }

      if (mAudioInputs.GetCount() < 2 && right)
      {
         // If the effect is mono, apply to each channel separately

         bGoodResult = ProcessStereo(count, (WaveTrack *)left, NULL,
                                     lstart, 0, len) && 
            ProcessStereo(count, (WaveTrack *)right, NULL,
                          rstart, 0, len);
      }
      else
      {
         bGoodResult = ProcessStereo(count,
                                     (WaveTrack *)left, (WaveTrack *)right,
                                      lstart, rstart, len);
      }

      if (!bGoodResult)
      {
         break;
      }
   
      left = iter.Next();
      count++;
   }

   ReplaceProcessedTracks(bGoodResult);

   return bGoodResult;
}
开发者ID:jazhaozhao,项目名称:audacity,代码行数:51,代码来源:LV2Effect.cpp

示例7: LinkConsistencyCheck

bool Track::LinkConsistencyCheck()
{
   // Sanity checks for linked tracks; unsetting the linked property
   // doesn't fix the problem, but it likely leaves us with orphaned
   // blockfiles instead of much worse problems.
   bool err = false;
   if (GetLinked())
   {
      Track *l = GetLink();
      if (l)
      {
         // A linked track's partner should never itself be linked
         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."),
               GetName(), l->GetName());
            err = true;
            l->SetLinked(false);
         }

         // Channels should be left and right
         if ( !(  (GetChannel() == Track::LeftChannel &&
                     l->GetChannel() == Track::RightChannel) ||
                  (GetChannel() == Track::RightChannel &&
                     l->GetChannel() == Track::LeftChannel) ) )
         {
            wxLogWarning(
               wxT("Track %s and %s had left/right track links out of order. Setting tracks to not be linked."),
               GetName(), l->GetName());
            err = true;
            SetLinked(false);
         }
      }
      else
      {
         wxLogWarning(
            wxT("Track %s had link to NULL track. Setting it to not be linked."),
            GetName());
         err = true;
         SetLinked(false);
      }
   }

   return ! err;
}
开发者ID:SteveDaulton,项目名称:audacity,代码行数:46,代码来源:Track.cpp

示例8: Process

bool LadspaEffect::Process()
{
    this->CopyInputWaveTracks(); // Set up mOutputWaveTracks.
    bool bGoodResult = true;

    TrackListIterator iter(mOutputWaveTracks);
    int count = 0;
    Track *left = iter.First();
    Track *right;
    while(left) {
        sampleCount lstart = 0, rstart = 0;
        sampleCount len;
        GetSamples((WaveTrack *)left, &lstart, &len);

        right = NULL;
        if (left->GetLinked() && inputs>1) {
            right = iter.Next();
            GetSamples((WaveTrack *)right, &rstart, &len);
        }

        if (inputs < 2 && right) {
            // If the effect is mono, apply to each channel separately

            bGoodResult = ProcessStereo(count, (WaveTrack *)left, NULL,
                                        lstart, 0, len) &&
                          ProcessStereo(count, (WaveTrack *)right, NULL,
                                        rstart, 0, len);
        }
        else bGoodResult = ProcessStereo(count,
                                             (WaveTrack *)left, (WaveTrack *)right,
                                             lstart, rstart, len);
        if (!bGoodResult)
            break;

        left = iter.Next();
        count++;
    }

    this->ReplaceProcessedWaveTracks(bGoodResult);
    return bGoodResult;
}
开发者ID:ruthmagnus,项目名称:audacity,代码行数:41,代码来源:LadspaEffect.cpp

示例9: Process

bool LadspaEffect::Process()
{
   TrackListIterator iter(mWaveTracks);
   int count = 0;
   Track *left = iter.First();
   Track *right;
   while(left) {
      longSampleCount lstart, rstart;
      sampleCount len;
      GetSamples((WaveTrack *)left, &lstart, &len);
      
      right = NULL;
      if (left->GetLinked() && inputs>1) {
         right = iter.Next();         
         GetSamples((WaveTrack *)right, &rstart, &len);
      }

      bool success = false;

      if (inputs < 2 && right) {
         // If the effect is mono, apply to each channel separately

         success = ProcessStereo(count, (WaveTrack *)left, NULL,
                                 lstart, 0, len);
         if (success)
            success = ProcessStereo(count, (WaveTrack *)right, NULL,
                                    rstart, 0, len);
      }
      else success = ProcessStereo(count,
                                   (WaveTrack *)left, (WaveTrack *)right,
                                   lstart, rstart, len);
      if (!success)
         return false;
   
      left = iter.Next();
      count++;
   }

   return true;
}
开发者ID:CoolOppo,项目名称:audacity,代码行数:40,代码来源:LadspaEffect.cpp

示例10: CountWaveTracks

void Effect::CountWaveTracks()
{
   mNumTracks = 0;
   mNumGroups = 0;

   TrackListOfKindIterator iter(Track::Wave, mTracks);
   Track *t = iter.First();

   while(t) {
      if (!t->GetSelected()) {
         t = iter.Next();
         continue;
      }
      
      if (t->GetKind() == Track::Wave) {
         mNumTracks++;
         if (!t->GetLinked())
            mNumGroups++;
      }
      t = iter.Next();
   }
}
开发者ID:tuanmasterit,项目名称:audacity,代码行数:22,代码来源:Effect.cpp

示例11: FillBuffers

void AudioIO::FillBuffers()
{
   unsigned int numEmpty = 0;
   unsigned int i;
   
   // Playback buffers

   for(i=0; i<mNumOutBuffers; i++) {
      if (mOutBuffer[i].ID == 0)
         numEmpty++;
   }
   
   if (numEmpty > (mNumOutBuffers/2)) {
      sampleCount block = numEmpty * mBufferSize;   
      double deltat = block / mRate;
      if (mT + deltat > mT1) {
         deltat = mT1 - mT;
         if(deltat < 0.0) return;
         block = (sampleCount)(deltat * mRate + 0.5);
      }
      
      Mixer *mixer = new Mixer(mNumOutChannels, block, true,
                               mRate, mFormat);
      mixer->UseVolumeSlider(mProject->GetControlToolBar());

      mixer->Clear();

      TrackListIterator iter2(mTracks);
      int numSolo = 0;
      Track *vt = iter2.First();
      while (vt) {
         if (vt->GetKind() == Track::Wave && vt->GetSolo())
            numSolo++;
         vt = iter2.Next();
      }

      TrackListIterator iter(mTracks);
      vt = iter.First();
      while (vt) {
         if (vt->GetKind() == Track::Wave) {      

            Track *mt = vt;
         
            // We want to extract mute and solo information from
            // the top of the two tracks if they're linked
            // (i.e. a stereo pair only has one set of mute/solo buttons)
            Track *partner = mTracks->GetLink(vt);
            if (partner && !vt->GetLinked())
               mt = partner;
            else
               mt = vt;

            // Cut if somebody else is soloing
            if (numSolo>0 && !mt->GetSolo()) {
               vt = iter.Next();
               continue;
            }
            
            // Cut if we're muted (unless we're soloing)
            if (mt->GetMute() && !mt->GetSolo()) {
               vt = iter.Next();
               continue;
            }

            WaveTrack *t = (WaveTrack *) vt;
            
            switch (t->GetChannel()) {
            case Track::LeftChannel:
               mixer->MixLeft(t, mT, mT + deltat);
               break;
            case Track::RightChannel:
               mixer->MixRight(t, mT, mT + deltat);
               break;
            case Track::MonoChannel:
               mixer->MixMono(t, mT, mT + deltat);
               break;
            }
         }

         vt = iter.Next();
      }     
   
      // Copy the mixed samples into the buffers

      samplePtr outbytes = mixer->GetBuffer();   

      for(i=0; i<mNumOutBuffers && block>0; i++)
         if (mOutBuffer[i].ID == 0) {
            sampleCount count;
            if (block > mBufferSize)
               count = mBufferSize;
            else
               count = block;
            
            memcpy(mOutBuffer[i].data, outbytes,
                   count*mNumOutChannels*SAMPLE_SIZE(mFormat));
            block -= count;
            outbytes += (count*mNumOutChannels*SAMPLE_SIZE(mFormat));
            mOutBuffer[i].len = count;
            mOutBuffer[i].ID = mOutID;
//.........这里部分代码省略.........
开发者ID:ruthmagnus,项目名称:audacity,代码行数:101,代码来源:AudioIO.cpp

示例12: lofOpenFiles


//.........这里部分代码省略.........
      }     // End while loop
   }        // End if statement
   
   else if (tokenholder.IsSameAs(wxT("file"), false))
   {

      // To identify filename and open it
      tokenholder = temptok1.GetNextToken();
      targetfile = temptok1.GetNextToken();
     
      #ifdef USE_MIDI
      // If file is a midi
      if (targetfile.AfterLast(wxT('.')).IsSameAs(wxT("mid"), false)
          ||  targetfile.AfterLast(wxT('.')).IsSameAs(wxT("midi"), false))
      {
         NoteTrack *nTrack = new NoteTrack(mProject->GetDirManager());
         
         if (::ImportMIDI(targetfile, nTrack))
            mProject->GetTracks()->Add(nTrack);
         else
            delete nTrack;
      }
      
      // If not a midi, open audio file
      else
      {
      #else // !USE_MIDI
         /* if we don't have midi support, go straight on to opening as an
          * audio file. TODO: Some sort of message here? */
      {
      #endif // USE_MIDI
         mProject->OpenFile(targetfile);
      }

      // Set tok to right after filename
      temptok2.SetString(targetfile);
      tokenplace = temptok2.CountTokens();
      
      for (int i = 0; i < tokenplace; i++)
         tokenholder = tok.GetNextToken();
      
      if (tok.HasMoreTokens())
      {
         tokenholder = tok.GetNextToken();
         
         if (tokenholder.IsSameAs(wxT("#")))
         {
            // # indicates comments; ignore line
            tok = wxStringTokenizer(wxT(""), wxT(" "));
         }
         
         if (tokenholder.IsSameAs(wxT("offset"), false))
         {
            if (tok.HasMoreTokens())
               tokenholder = tok.GetNextToken();
            double offset;
            
            if (Internat::CompatibleToDouble(tokenholder, &offset))
            {
               Track *t;
               TrackListIterator iter(mProject->GetTracks());
               
               t = iter.First();
               
               for (int i = 1; i < CountNumTracks(mProject) - 1; i++)
                  t = iter.Next();

#ifdef USE_MIDI
               if (targetfile.AfterLast(wxT('.')).IsSameAs(wxT("mid"), false) ||
                   targetfile.AfterLast(wxT('.')).IsSameAs(wxT("midi"), false))
               {
                  wxMessageBox(_("MIDI tracks cannot be offset individually, only audio files can be."),
                               _("LOF Error"), wxOK | wxCENTRE, gParentWindow);
               }
               else
#endif
               {
                  if (CountNumTracks(mProject) == 1)
                     t->SetOffset(offset);
                  else
                  {
                     if (t->GetLinked())
                        t->SetOffset(offset);
                     
                     t = iter.Next();
                     t->SetOffset(offset);
                  }
               }
            }            
            else
            {
               /* i18n-hint: You do not need to translate "LOF" */
               wxMessageBox(_("Invalid track offset in LOF file."),
                            _("LOF Error"), wxOK | wxCENTRE, gParentWindow);
            }
         }     // End if statement
      }     // End if statement
   }     // End if statement
   
   else if (tokenholder.IsSameAs(wxT("#")))
开发者ID:ruthmagnus,项目名称:audacity,代码行数:101,代码来源:ImportLOF.cpp

示例13: lofOpenFiles


//.........这里部分代码省略.........
         if(fName.FileExists()) {
            targetfile = fName.GetFullPath();
         }
      }
     
      #ifdef USE_MIDI
      // If file is a midi
      if (targetfile.AfterLast(wxT('.')).IsSameAs(wxT("mid"), false)
          ||  targetfile.AfterLast(wxT('.')).IsSameAs(wxT("midi"), false))
      {
         NoteTrack *nTrack = new NoteTrack(mProject->GetDirManager());
         
         if (::ImportMIDI(targetfile, nTrack))
            mProject->GetTracks()->Add(nTrack);
         else
            delete nTrack;
      }
      
      // If not a midi, open audio file
      else
      {
      #else // !USE_MIDI
         /* if we don't have midi support, go straight on to opening as an
          * audio file. TODO: Some sort of message here? */
      {
      #endif // USE_MIDI
         mProject->OpenFile(targetfile);
      }

      // Set tok to right after filename
      temptok2.SetString(targetfile);
      tokenplace = temptok2.CountTokens();
      
      for (int i = 0; i < tokenplace; i++)
         tokenholder = tok.GetNextToken();
      
      if (tok.HasMoreTokens())
      {
         tokenholder = tok.GetNextToken();
         
         if (tokenholder.IsSameAs(wxT("#")))
         {
            // # indicates comments; ignore line
            tok = wxStringTokenizer(wxT(""), wxT(" "));
         }
         
         if (tokenholder.IsSameAs(wxT("offset"), false))
         {
            if (tok.HasMoreTokens())
               tokenholder = tok.GetNextToken();
            double offset;
           
            // handle an "offset" specifier
            if (Internat::CompatibleToDouble(tokenholder, &offset))
            {
               Track *t;
               TrackListIterator iter(mProject->GetTracks());
               
               t = iter.First();
               
               for (int i = 1; i < CountNumTracks(mProject) - 1; i++)
                  t = iter.Next();

               // t is now the last track in the project, unless the import of
               // all tracks failed, in which case it will be null. In that
               // case we return because we cannot offset a non-existent track.
               if (t == NULL) return;
#ifdef USE_MIDI
               if (targetfile.AfterLast(wxT('.')).IsSameAs(wxT("mid"), false) ||
                   targetfile.AfterLast(wxT('.')).IsSameAs(wxT("midi"), false))
               {
                  wxMessageBox(_("MIDI tracks cannot be offset individually, only audio files can be."),
                               _("LOF Error"), wxOK | wxCENTRE);
               }
               else
#endif
               {
                  if (CountNumTracks(mProject) == 1)
                     t->SetOffset(offset);
                  else
                  {
                     if (t->GetLinked())
                        t->SetOffset(offset);
                     
                     t = iter.Next();
                     t->SetOffset(offset);
                  }
               }
            } // end of converting "offset" argument
            else
            {
               /* i18n-hint: You do not need to translate "LOF" */
               wxMessageBox(_("Invalid track offset in LOF file."),
                            _("LOF Error"), wxOK | wxCENTRE);
            }
         }     // End if statement for "offset" parameters
      }     // End if statement (more tokens after file name)
   }     // End if statement "file" lines
   
   else if (tokenholder.IsSameAs(wxT("#")))
开发者ID:Kirushanr,项目名称:audacity,代码行数:101,代码来源:ImportLOF.cpp

示例14: Apply


//.........这里部分代码省略.........
   {
      CaptureToolbar(context.proj->mToolManager, TranscriptionBarID, fileName);
   }
   else if (captureMode.IsSameAs(wxT("trackpanel")))
   {
      TrackPanel *panel = context.proj->mTrackPanel;
      AdornedRulerPanel *ruler = panel->mRuler;

      int h = ruler->GetRulerHeight();
      int x = 0, y = -h;
      int width, height;

      panel->ClientToScreen(&x, &y);
      panel->GetParent()->ScreenToClient(&x, &y);
      panel->GetClientSize(&width, &height);

      Capture(fileName, panel, x, y, width, height + h);
   }
   else if (captureMode.IsSameAs(wxT("ruler")))
   {
      TrackPanel *panel = context.proj->mTrackPanel;
      AdornedRulerPanel *ruler = panel->mRuler;

      int x = 0, y = 0;
      int width, height;

      ruler->ClientToScreen(&x, &y);
      ruler->GetParent()->ScreenToClient(&x, &y);
      ruler->GetClientSize(&width, &height);
      height = ruler->GetRulerHeight();

      Capture(fileName, ruler, x, y, width, height);
   }
   else if (captureMode.IsSameAs(wxT("tracks")))
   {
      TrackPanel *panel = context.proj->mTrackPanel;

      int x = 0, y = 0;
      int width, height;

      panel->ClientToScreen(&x, &y);
      panel->GetParent()->ScreenToClient(&x, &y);
      panel->GetClientSize(&width, &height);

      Capture(fileName, panel, x, y, width, height);
   }
   else if (captureMode.IsSameAs(wxT("firsttrack")))
   {
      TrackPanel *panel = context.proj->mTrackPanel;
      TrackListIterator iter(context.proj->GetTracks());
      Track * t = iter.First();
      if (!t) {
         return false;
      }
      wxRect r = panel->FindTrackRect(t, true);

      int x = 0, y = r.y - 3;
      int width, height;

      panel->ClientToScreen(&x, &y);
      panel->GetParent()->ScreenToClient(&x, &y);
      panel->GetClientSize(&width, &height);

      Capture(fileName, panel, x, y, width, r.height + 6);

   }
   else if (captureMode.IsSameAs(wxT("secondtrack")))
   {
      TrackPanel *panel = context.proj->mTrackPanel;
      TrackListIterator iter(context.proj->GetTracks());
      Track * t = iter.First();
      if (!t) {
         return false;
      }
      if (t->GetLinked()) {
         t = iter.Next();
      }
      t = iter.Next();
      if (!t) {
         return false;
      }
      wxRect r = panel->FindTrackRect(t, true);

      int x = 0, y = r.y - 3;
      int width, height;

      panel->ClientToScreen(&x, &y);
      panel->GetParent()->ScreenToClient(&x, &y);
      panel->GetClientSize(&width, &height);

      Capture(fileName, panel, x, y, width, r.height + 6);
   }
   else
   {
      // Invalid capture mode!
      return false;
   }

   return true;
}
开发者ID:ruthmagnus,项目名称:audacity,代码行数:101,代码来源:ScreenshotCommand.cpp

示例15: UpdateTrackClusters

void MixerBoard::UpdateTrackClusters() 
{
   if (mImageMuteUp == NULL) 
      this->CreateMuteSoloImages();

   const int nClusterHeight = mScrolledWindow->GetClientSize().GetHeight() - kDoubleInset;
   const size_t nClusterCount = mMixerTrackClusters.GetCount();
   unsigned int nClusterIndex = 0;
   TrackListIterator iterTracks(mTracks);
   MixerTrackCluster* pMixerTrackCluster = NULL;
   Track* pLeftTrack;
   Track* pRightTrack;

   pLeftTrack = iterTracks.First();
   while (pLeftTrack) {
      pRightTrack = pLeftTrack->GetLinked() ? iterTracks.Next() : NULL;

      if (pLeftTrack->GetKind() == Track::Wave) 
      {
         if (nClusterIndex < nClusterCount)
         {
            // 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 
            // on the undo stack, so update the pointers and display name.
            mMixerTrackClusters[nClusterIndex]->mLeftTrack = (WaveTrack*)pLeftTrack;
            mMixerTrackClusters[nClusterIndex]->mRightTrack = (WaveTrack*)pRightTrack;
            mMixerTrackClusters[nClusterIndex]->UpdateForStateChange();
         }
         else
         {
            // Not already showing it. Add a new MixerTrackCluster.
            wxPoint clusterPos(
               (kInset +                                       // extra inset to left for first one.
                  (nClusterIndex * 
                     (kInset + kMixerTrackClusterWidth)) +     // left margin and width for each to its left
                  kInset),                                     // plus left margin for new cluster
               kInset); 
            wxSize clusterSize(kMixerTrackClusterWidth, nClusterHeight);
            pMixerTrackCluster = 
               new MixerTrackCluster(mScrolledWindow, this, mProject, 
                                       (WaveTrack*)pLeftTrack, (WaveTrack*)pRightTrack, 
                                       clusterPos, clusterSize);
            if (pMixerTrackCluster)
            {
               mMixerTrackClusters.Add(pMixerTrackCluster);
               this->IncrementSoloCount((int)(pLeftTrack->GetSolo()));
            }
         }
         nClusterIndex++;
      }
      pLeftTrack = iterTracks.Next();
   }

   if (pMixerTrackCluster)
   {
      // Added at least one MixerTrackCluster.
      this->UpdateWidth();
      for (nClusterIndex = 0; nClusterIndex < mMixerTrackClusters.GetCount(); nClusterIndex++)
         mMixerTrackClusters[nClusterIndex]->HandleResize();
   }
   else if (nClusterIndex < nClusterCount)
   {
      // We've got too many clusters. 
      // This can only on things like Undo New Audio Track or Undo Import
      // that don't call RemoveTrackCluster explicitly. 
      // We've already updated the track pointers for the clusters to the left, so just remove these.
      for (; nClusterIndex < nClusterCount; nClusterIndex++)
         this->RemoveTrackCluster(mMixerTrackClusters[nClusterIndex]->mLeftTrack);
   }
}
开发者ID:tuanmasterit,项目名称:audacity,代码行数:71,代码来源:MixerBoard.cpp


注:本文中的Track::GetLinked方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。