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


C++ NoteData::noteLength方法代码示例

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


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

示例1: doUpdate

void VibratoTimeAxis::doUpdate()
{
  Channel *active = gdata->getActiveChannel();

  int myStartChunk = -1;
  int myCurrentChunk = -1;
  int myEndChunk = -1;
  double myNoteLength = 0.0;
  int myWindowOffset = -999999;

  if (active) {
    AnalysisData *data = active->dataAtCurrentChunk();
    if(data && active->isVisibleNote(data->getNoteIndex()) && active->isLabelNote(data->getNoteIndex())) {
      NoteData *note = new NoteData();
      note = &active->noteData[data->getNoteIndex()];

      myStartChunk = note->startChunk();
      myCurrentChunk = active->chunkAtCurrentTime();
      myEndChunk = note->endChunk();
      myNoteLength = note->noteLength();

      // Calculate windowoffset
      if ((myEndChunk - myStartChunk) * zoomFactorX > width() - 2 * noteLabelOffset) {
        // The vibrato-polyline doesn't fit in the window
        if ((myCurrentChunk - myStartChunk) * zoomFactorX < (width() - 2 * noteLabelOffset)/2) {
          // We're at the left side of the vibrato-polyline
          myWindowOffset = 0 - noteLabelOffset;
        } else if ((myEndChunk - myCurrentChunk) * zoomFactorX < (width() - 2 * noteLabelOffset)/2) {
          // We're at the right side of the vibrato-polyline
          myWindowOffset = toInt((myEndChunk - myStartChunk) * zoomFactorX - width() + noteLabelOffset + 1);
        } else {
          // We're somewhere in the middle of the vibrato-polyline
          myWindowOffset = toInt((myCurrentChunk - myStartChunk) * zoomFactorX - width()/2);
        }
      } else {
        // The vibrato-polyline does fit in the window
        myWindowOffset = 0 - noteLabelOffset;
      }
    }
  }

  if (myCurrentChunk == -1) {
    // No note
    if (prevCurrentChunk == myCurrentChunk) {
      // Still no timeaxis needed, no update needed

    } else {
      // Timeaxis should be erased, update widget

      prevCurrentChunk = -1;
      prevWindowOffset = -999999;

      currentChunkToUse = -1;
    }
  } else {
    // Note
    if (prevWindowOffset == myWindowOffset) {
      // No movement, don't redraw timeaxis

    } else {
      // Position in note to draw has changed, so draw the timeaxis

      prevCurrentChunk = myCurrentChunk;
      prevWindowOffset = myWindowOffset;

      startChunkToUse = myStartChunk;
      currentChunkToUse = myCurrentChunk;
      endChunkToUse = myEndChunk;
      noteLengthToUse = myNoteLength;
      windowOffsetToUse = myWindowOffset;
    }
  }
}
开发者ID:nsauzede,项目名称:tartini,代码行数:73,代码来源:vibratotimeaxis.cpp


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