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


C++ TrackList::First方法代码示例

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


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

示例1: Pitch

void AudioView::Pitch()
{
  VTrack *t;
  bool success = false;

  TrackList *tracks = GetTracks();
  t = tracks->First();
  while(t) {
    if (t->selected && t->GetKind() == VTrack::Wave) {
      NoteTrack *note = PitchExtract((WaveTrack *)t,
				     &((AudioDoc *)GetDocument())->dirManager);
      if (note) {
		success = true;
		tracks->Add(note);
      }
    }

    t = tracks->Next();
  }

  if (success) {
    PushState();
    
    FixScrollbars();
    REDRAW(trackPanel);
    REDRAW(rulerPanel);
  }
}
开发者ID:ruthmagnus,项目名称:audacity,代码行数:28,代码来源:AudioView.cpp

示例2: Copy

void AudioView::Copy()
{
  ClearClipboard();

  TrackList *tracks = GetTracks();
  VTrack *n = tracks->First();
  VTrack *dest = 0;

  while(n) {
	if (n->selected) {
	  n->Copy(sel0, sel1, &dest);
	  if (dest)
		clipboard->Add(dest);
	}
	n = tracks->Next();
  }

  clipLen = (sel1 - sel0);

  sel1 = sel0;
  UpdateMenus();

  //  PushState();
  //  Not an undoable operation
}
开发者ID:ruthmagnus,项目名称:audacity,代码行数:25,代码来源:AudioView.cpp

示例3: Paste

void AudioView::Paste()
{
  if (sel0 != sel1)
    Clear();
    
  wxASSERT(sel0 == sel1);

  double tsel = sel0;

  TrackList *tracks = GetTracks();
  VTrack *n = tracks->First();
  VTrack *c = clipboard->First();

  while(n && c) {
	if (n->selected) {
	  n->Paste(tsel, c);
	  c = clipboard->Next();
	}
	  
	n = tracks->Next();
  }

  // TODO: What if we clicked past the end of the track?

  sel0 = tsel;
  sel1 = tsel + clipLen;

  PushState();

  FixScrollbars();
  REDRAW(trackPanel);
  REDRAW(rulerPanel);
  UpdateMenus();
}
开发者ID:ruthmagnus,项目名称:audacity,代码行数:34,代码来源:AudioView.cpp

示例4: ProcessEvent

bool AudioView::ProcessEvent(wxEvent& event)
{
  if (event.GetEventType() == wxEVT_COMMAND_MENU_SELECTED &&
      event.GetId() >= FirstEffectID &&
      event.GetId() < FirstEffectID + numEffects) {
    Effect *f = Effect::GetEffect(event.GetId() - FirstEffectID);

    TrackList *tracks = GetTracks();
    VTrack *t = tracks->First();
    
    while(t) {
      if (t->selected && t->GetKind() == (VTrack::Wave)) {
	f->DoInPlaceEffect((WaveTrack *)t, sel0, sel1);
      }
      
      t = tracks->Next();
    }
    
    PushState();
    
    FixScrollbars();
    REDRAW(trackPanel);
    REDRAW(rulerPanel);
    
    // This indicates we handled the event.
    return true;
  }
  
  return wxView::ProcessEvent(event);
}
开发者ID:ruthmagnus,项目名称:audacity,代码行数:30,代码来源:AudioView.cpp

示例5: Cut

void AudioView::Cut()
{
  ClearClipboard();

  TrackList *tracks = GetTracks();
  VTrack *n = tracks->First();
  VTrack *dest = 0;

  while(n) {
	if (n->selected) {
	  n->Cut(sel0, sel1, &dest);
	  if (dest)
		clipboard->Add(dest);
	}
	n = tracks->Next();
  }

  clipLen = (sel1 - sel0);

  sel1 = sel0;

  PushState();

  FixScrollbars();
  REDRAW(trackPanel);
  REDRAW(rulerPanel);
  UpdateMenus();
}
开发者ID:ruthmagnus,项目名称:audacity,代码行数:28,代码来源:AudioView.cpp

示例6: SelectNone

void AudioView::SelectNone()
{
  TrackList *tracks = GetTracks();

  VTrack *t = tracks->First();
  while(t) {
	t->selected = false;
	t = tracks->Next();
  }
}
开发者ID:ruthmagnus,项目名称:audacity,代码行数:10,代码来源:AudioView.cpp

示例7: QuickMix

void AudioView::QuickMix()
{
  WaveTrack **waveArray;
  VTrack *t;
  int numWaves = 0;
  int w;

  TrackList *tracks = GetTracks();
  t = tracks->First();
  while(t) {
    if (t->selected && t->GetKind() == VTrack::Wave)
      numWaves++;
    t = tracks->Next();
  }
  
  if (numWaves == 0)
	return;

  waveArray = new WaveTrack*[numWaves];
  w = 0;
  t = tracks->First();
  while(t) {
    if (t->selected && t->GetKind() == VTrack::Wave)
      waveArray[w++] = (WaveTrack *)t;
    t = tracks->Next();
  }  

  WaveTrack *mix = ::QuickMix(numWaves, waveArray,
			    &((AudioDoc *)GetDocument())->dirManager);
  if (mix) {
    tracks->Add(mix);

    PushState();
    
    FixScrollbars();
    REDRAW(trackPanel);
    REDRAW(rulerPanel);
  }
}
开发者ID:ruthmagnus,项目名称:audacity,代码行数:39,代码来源:AudioView.cpp

示例8: Export

void AudioView::Export()
{
  VTrack *left = 0;
  VTrack *right = 0;
  VTrack *t;
  int numSelected = 0;

  TrackList *tracks = GetTracks();
  t = tracks->First();
  while(t) {
	if (t->selected)
	  numSelected++;
	if (t->GetKind() != VTrack::Wave) {
	  wxMessageBox("Only audio tracks can be exported.");
	  return;
	}
	t = tracks->Next();
  }

  if (numSelected == 0) {
	wxMessageBox("Please select one or two tracks before trying to export.");
	return;
  }

  if (numSelected > 2) {
	wxMessageBox("Cannot export more than two tracks (stereo).  "
				 "Please select either one or two tracks.");
  }

  left = tracks->First();  
  while (left && (!left->selected))
	left = tracks->Next();
  
  do {
	right = tracks->Next();
  } while (right && (!right->selected));
  
  ::Export((WaveTrack *)left, (WaveTrack *)right);
}
开发者ID:ruthmagnus,项目名称:audacity,代码行数:39,代码来源:AudioView.cpp

示例9: SpectrumDisplay

void AudioView::SpectrumDisplay()
{
  TrackList *tracks = GetTracks();
  VTrack *n = tracks->First();

  while(n) {
	if (n->selected && n->GetKind() == VTrack::Wave)
	  ((WaveTrack *)n)->SetDisplay(WaveTrack::SpectrumDisplay);
	n = tracks->Next();
  }

  REDRAW(trackPanel);
  REDRAW(rulerPanel);
}
开发者ID:ruthmagnus,项目名称:audacity,代码行数:14,代码来源:AudioView.cpp

示例10: SelectAll

void AudioView::SelectAll()
{
  TrackList *tracks = GetTracks();

  VTrack *t = tracks->First();
  while(t) {
	t->selected = true;
	t = tracks->Next();
  }
  sel0 = 0.0;
  sel1 = tracks->GetMaxLen();
  
  REDRAW(trackPanel);
  REDRAW(rulerPanel);
  UpdateMenus();
}
开发者ID:ruthmagnus,项目名称:audacity,代码行数:16,代码来源:AudioView.cpp

示例11: RemoveTracks

void AudioView::RemoveTracks()
{
  TrackList *list = GetTracks();
  VTrack *t = list->First();

  while(t) {
	if (t->selected)
	  t = list->RemoveCurrent();
	else
	  t = list->Next();
  }

  PushState();

  REDRAW(trackPanel);
  REDRAW(rulerPanel);
  UpdateMenus();
}
开发者ID:ruthmagnus,项目名称:audacity,代码行数:18,代码来源:AudioView.cpp

示例12: Clear

void AudioView::Clear()
{
  TrackList *tracks = GetTracks();
  VTrack *n = tracks->First();

  while(n) {
	if (n->selected)
	  n->Clear(sel0, sel1);
	n = tracks->Next();
  }

  sel1 = sel0;

  PushState();
  FixScrollbars();
  REDRAW(trackPanel);
  REDRAW(rulerPanel);
  UpdateMenus();
}
开发者ID:ruthmagnus,项目名称:audacity,代码行数:19,代码来源:AudioView.cpp

示例13: GetTracks

VTrack *AudioView::FindTrack(int mouseX, int mouseY, bool label,
							 wxRect *trackRect, int *trackNum)
{
  wxRect r;
  if (label) {
	r.x = 0;
	r.width = labelWidth - 1;
  }
  else {
	int wid, ht;
	r.x = labelWidth;
	trackPanel->GetSize(&wid, &ht);
	r.width = wid - labelWidth;
  }
  r.y = -vpos;

  TrackList *tracks = GetTracks();
  VTrack *t = tracks->First();

  int n=1;
  
  while(t) {
	r.height = t->GetHeight();
	
  	if (r.Inside(mouseX, mouseY)) {
      if (trackRect)
        *trackRect = r;
      if (trackNum)
        *trackNum = n;
      return t;
    }

	r.y += r.height;
	n++;
	t = tracks->Next();
  }

  if (mouseY >= r.y && trackNum)
	*trackNum = n-1;
  
  return NULL;
}
开发者ID:ruthmagnus,项目名称:audacity,代码行数:42,代码来源:AudioView.cpp

示例14: OnPlayButton

void AudioView::OnPlayButton()
{
  SoundPlayer player;
  double plays0 = sel0;
  double plays1 = sel1;

  if (sel0 == sel1) {
	plays0 = 0.0;
	plays1 = 10000000000.0;
  }

  TrackList *tracks = GetTracks();
  VTrack *t = tracks->First();  
  while(t) {
	if (t->selected && t->GetKind() == (VTrack::Wave)) {
	  player.Begin((WaveTrack *)t, plays0, plays1);
	  return;
	}
	
	t = tracks->Next();
  }
}
开发者ID:ruthmagnus,项目名称:audacity,代码行数:22,代码来源:AudioView.cpp

示例15: DrawTracks

// Draw all tracks
void AudioView::DrawTracks(wxDC *dc, wxRect *visible)
{
  wxRect r;
  
  r.x = visible->x;
  r.y = -vpos;
  r.width = visible->width;
  
  TrackList *tracks = GetTracks();
  VTrack *t;
  int num=0;
  
  t = tracks->First();
  while(t) {
	r.height = t->GetHeight();
	
	// If it's visible at all (vertically)
	if (r.y < (visible->y + visible->height) && (r.y + r.height) > visible->y)
	  {
	    double h = sinfo.h + (r.x / sinfo.zoom);
	    
		bool sel = t->selected;
		
		// Tell VTrack to draw itself

		wxRect innerRect = r;
		innerRect.x += labelWidth;
		innerRect.width -= labelWidth;
		innerRect.y += 4;
		innerRect.height -= 16;
		
		if (!t->IsCollapsed()) {
		  if (sel)
			t->Draw(*dc, innerRect, h, sinfo.zoom, sel0, sel1);
		  else
			t->Draw(*dc, innerRect, h, sinfo.zoom, 0.0, 0.0);
		}
		else {
		  dc->SetBrush(backgroundBrush);
		  dc->SetPen(backgroundPen);
		  
		  dc->DrawRectangle(innerRect);
		}
		
		// Draw label

		wxRect labelRect = r;
		  
		labelRect.width = labelWidth;
		  
		dc->SetBrush(mediumBrush[sel]);
		dc->SetPen(mediumPen[sel]);
		
		dc->DrawRectangle(labelRect);
		
		dc->SetPen(lightPen[sel]);
		
		dc->DrawLine(labelRect.x, labelRect.y,
					 labelRect.x + labelRect.width, labelRect.y);
		dc->DrawLine(labelRect.x, labelRect.y,
					 labelRect.x, labelRect.y + labelRect.height);
		dc->DrawLine(labelRect.x+1, labelRect.y+1,
					 labelRect.x + labelRect.width, labelRect.y+1);
		dc->DrawLine(labelRect.x+1, labelRect.y+1,
					 labelRect.x+1, labelRect.y + labelRect.height);	
		
		dc->SetPen(darkPen[sel]);
		
		dc->DrawLine(labelRect.x, labelRect.y + labelRect.height,
					 labelRect.x + labelRect.width, labelRect.y + labelRect.height);
		dc->DrawLine(labelRect.x+1, labelRect.y + labelRect.height-1,
					 labelRect.x + labelRect.width, labelRect.y + labelRect.height-1);
		
		dc->DrawLine(labelRect.x+labelRect.width-1,labelRect.y+4,
					 labelRect.x+labelRect.width-1,labelRect.y+labelRect.height-10);
		dc->DrawLine(labelRect.x+labelRect.width-2,labelRect.y+4,
					 labelRect.x+labelRect.width-2,labelRect.y+labelRect.height-10);
		
		int ctr = labelRect.y + (labelRect.height/2);
		dc->SetTextForeground(wxColour(0,0,0));
		char str[100];
		sprintf(str,"%d",num+1);		
		dc->DrawText(str, labelRect.x+15, ctr-8);		
		if (t->GetKind()==VTrack::Wave) {
		  sprintf(str,"%dk",(int)(((WaveTrack *)t)->rate/1000));
		  dc->DrawText(str, labelRect.x+5, ctr+8);
		}

		r.x += labelWidth;

		// Draw top bevels

		dc->SetPen(lightPen[sel]);
		dc->DrawLine(r.x, r.y, r.x + r.width, r.y);
		dc->DrawLine(r.x, r.y+1, r.x + r.width, r.y+1);
		dc->SetPen(mediumPen[sel]);
		dc->DrawLine(r.x, r.y+2, r.x + r.width, r.y+2);
		dc->DrawLine(r.x, r.y+3, r.x + r.width, r.y+3);
		dc->SetPen(darkPen[sel]);
//.........这里部分代码省略.........
开发者ID:ruthmagnus,项目名称:audacity,代码行数:101,代码来源:AudioView.cpp


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