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


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

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


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

示例1: 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

示例2: OnPlay

void APalette::OnPlay()
{
   if (gAudioIO->IsBusy())
      return;

   AudacityProject *p = GetActiveProject();
   if (p) {
      TrackList *t = p->GetTracks();
      double t0 = p->GetSel0();
      double t1 = p->GetSel1();
      if (t1 == t0)
         t1 = t->GetMaxLen();
      bool success = gAudioIO->StartPlay(p, t, t0, t1);

      if (!success) {
         SetPlay(false);
         SetStop(false);
         SetRecord(false);
      }

   }
}
开发者ID:ruthmagnus,项目名称:audacity,代码行数:22,代码来源:APalette.cpp

示例3: ExportPCM


//.........这里部分代码省略.........

#ifdef __WXMAC__

    FSSpec spec;

    wxMacFilename2FSSpec(fName, &spec);

    if (trackMarkers) {
        // Export the label track as "CD Spin Doctor" files

        LabelTrack *labels = NULL;
        TrackListIterator iter(tracks);
        VTrack *t = iter.First();
        while (t && !labels) {
            if (t->GetKind() == VTrack::Label)
                labels = (LabelTrack *) t;
            t = iter.Next();
        }
        if (labels) {
            FSpCreateResFile(&spec, 'AIFF', AUDACITY_CREATOR, 0);
            int resFile = FSpOpenResFile(&spec, fsWrPerm);
            if (resFile == -1) {
                int x = ResError();
            }
            if (resFile != -1) {
                UseResFile(resFile);

                int numLabels = labels->mLabels.Count();
                for (int i = 0; i < numLabels; i++) {
                    int startBlock = (int) (labels->mLabels[i]->t * 75);
                    int lenBlock;
                    if (i < numLabels - 1)
                        lenBlock =
                            (int) ((labels->mLabels[i + 1]->t -
                                    labels->mLabels[i]->t) * 75);
                    else
                        lenBlock =
                            (int) ((tracks->GetMaxLen() -
                                    labels->mLabels[i]->t) * 75);
                    int startSample = startBlock * 1176 + 54;
                    int lenSample = lenBlock * 1176 + 54;

                    Handle theHandle = NewHandle(50);
                    HLock(theHandle);
                    char *data = (char *) (*theHandle);
                    *(int *) &data[0] = startSample;
                    *(int *) &data[4] = lenSample;
                    *(int *) &data[8] = startBlock;
                    *(int *) &data[12] = lenBlock;
                    *(short *) &data[16] = i + 1;

                    wxString title = labels->mLabels[i]->title;
                    if (title.Length() > 31)
                        title = title.Left(31);
                    data[18] = title.Length();
                    strcpy(&data[19], (const char *) title);

                    HUnlock(theHandle);
                    AddResource(theHandle, 'SdCv', 128 + i, "\p");
                }
                CloseResFile(resFile);

                wxMessageBox("Saved track information with file.");
            }
        }
    }

    FInfo finfo;
    if (FSpGetFInfo(&spec, &finfo) == noErr) {
        switch (header) {
        case SND_HEAD_AIFF:
            finfo.fdType = 'AIFF';
            break;
        case SND_HEAD_IRCAM:
            finfo.fdType = 'IRCA';
            break;
        case SND_HEAD_NEXT:
            finfo.fdType = 'AU  ';
            break;
        case SND_HEAD_WAVE:
            finfo.fdType = 'WAVE';
            break;
        }

        finfo.fdCreator = AUDACITY_CREATOR;

        FSpSetFInfo(&spec, &finfo);
    }
#endif

    if (progress)
        delete progress;

    return true;

#endif

    return false;

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

示例4: FixScrollbars

void AudioView::FixScrollbars()
{
  if (!hsbar || !vsbar)
    return;

  AudioDoc *doc = ((AudioDoc *)GetDocument());
  if (!doc)
    return;
    
  bool rescroll = false;

  TrackList *tracks = GetTracks();
  int totalHeight = (tracks->GetHeight() + 32);

  int panelWidth, panelHeight;
  trackPanel->GetSize(&panelWidth, &panelHeight);

  sinfo.total = tracks->GetMaxLen() + 1.0;
  sinfo.screen = ((double)panelWidth) / sinfo.zoom;

  if (sinfo.h > sinfo.total - sinfo.screen) {
  	sinfo.h = sinfo.total - sinfo.screen;
  	rescroll = true;
  }
  if (sinfo.h < 0.0) {
  	sinfo.h = 0.0;
  	rescroll = true;
  }

  sinfo.sbarTotal = (int)(sinfo.total * sinfo.zoom) / sinfo.scrollStep;
  sinfo.sbarScreen = (int)(sinfo.screen * sinfo.zoom) / sinfo.scrollStep;

  sinfo.sbarH = (int)(sinfo.h * sinfo.zoom) / sinfo.scrollStep;

  vpos =
	vsbar->GetThumbPosition() * sinfo.scrollStep;

  if (vpos >= totalHeight)
	vpos = totalHeight-1;
  if (vpos < 0)
	vpos = 0;

  hsbar->Show(sinfo.screen < sinfo.total);
  vsbar->Show(panelHeight < totalHeight);

  if (panelHeight >= totalHeight && vpos != 0) {
	vpos = 0;
	REDRAW(trackPanel);
	REDRAW(rulerPanel);
	rescroll = false;
  }
  if (sinfo.screen >= sinfo.total && sinfo.sbarH != 0) {
	sinfo.sbarH = 0;
	REDRAW(trackPanel);
	REDRAW(rulerPanel);
	rescroll = false;
  }

  hsbar->SetScrollbar(sinfo.sbarH, sinfo.sbarScreen,
					  sinfo.sbarTotal, sinfo.sbarScreen, TRUE);
  vsbar->SetScrollbar(vpos / sinfo.scrollStep,
					  panelHeight / sinfo.scrollStep,
					  totalHeight / sinfo.scrollStep,
					  panelHeight / sinfo.scrollStep,
					  TRUE);

  sinfo.lastZoom = sinfo.zoom;
  
  if (rescroll && sinfo.screen < sinfo.total) {
	  REDRAW(trackPanel);
		REDRAW(rulerPanel);
  }
}
开发者ID:ruthmagnus,项目名称:audacity,代码行数:73,代码来源:AudioView.cpp


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