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


C++ MidiTrack::InsertPitchBendRange方法代码示例

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


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

示例1: PostLoad


//.........这里部分代码省略.........
					{
						lfoVal -= 0x1000000;
						lfoStage = (lfoStage+1) % 4;
					}
					effectiveLfoVal = lfoVal;
					if (lfoStage == 1)
						effectiveLfoVal = 0x1000000 - lfoVal;
					else if (lfoStage == 2)
						effectiveLfoVal = -((long)lfoVal);
					else if (lfoStage == 3)
						effectiveLfoVal = -0x1000000 + lfoVal;

					double lfoPercent = (effectiveLfoVal / (double)0x1000000);

					if (vibrato > 0)
					{
						lfoCents = (short)(lfoPercent * vibrato);
						track->InsertPitchBend(channel, (short)(((lfoCents + pitchbend) / (double)pitchbendRange) * 8192), startAbsTicks + t);
					}

					if (tremelo > 0)
					{
						uint8_t expression = ConvertPercentAmpToStdMidiVal((0x10000 - (tremelo*abs(lfoPercent))) / (double)0x10000);
						track->InsertExpression(channel, expression, startAbsTicks + t);
					}
				}
				// TODO add adjustment for segmentDurTicks % tickRes						
			}


			switch(event->GetEventType())
			{
			case MIDIEVENT_TEMPO:
				{
					TempoEvent* tempoevent = (TempoEvent*)event;
					mpqn = tempoevent->microSecs;
					mpt = mpqn / ppqn;
				}
				break;
			case MIDIEVENT_ENDOFTRACK:

				break;
			case MIDIEVENT_MARKER:
				{
					MarkerEvent* marker = (MarkerEvent*)event;
					if (marker->name == "vibrato")
					{
						vibrato = vibrato_depth_table[marker->databyte1] * (100/256.0);
						//pitchbendRange = max(200, (vibrato + 50));		//50 cents to allow for pitchbend values, which range -50/+50
						pitchbendRange = (int)max(200, ceil((vibrato+50)/100.0)*100);	//+50 cents to allow for pitchbend values, which range -50/+50
						track->InsertPitchBendRange(channel, pitchbendRange/100, pitchbendRange%100, curTicks);
						
						lfoCents = (short)((effectiveLfoVal / (double)0x1000000) * vibrato);
						
						if (curTicks > 0)
							track->InsertPitchBend(channel, (short)(((lfoCents + pitchbend) / (double)pitchbendRange) * 8192), curTicks);
					}
					else if (marker->name == "tremelo")
					{
						tremelo = tremelo_depth_table[marker->databyte1];
						if (tremelo == 0)
							track->InsertExpression(channel, 127, curTicks);
					}
					else if (marker->name == "lfo")
					{
						lfoRate = lfo_rate_table[marker->databyte1];
					}
					else if (marker->name == "resetlfo")
					{
						if (marker->databyte1 != 1)
							break;
						lfoVal = 0;
						effectiveLfoVal = 0;
						lfoStage = 0;
						lfoCents = 0;
						if (vibrato > 0)
							track->InsertPitchBend(channel, (short)(((0 + pitchbend) / (double)pitchbendRange) * 8192), curTicks);
						if (tremelo > 0)
							track->InsertExpression(channel, 127, curTicks);
					}
					else if (marker->name == "pitchbend")
					{
						pitchbend = (short)(((char)marker->databyte1 / 256.0) * 100);
						//stringstream stream;
						//stream << "cents: " << cents << "  finalval: " <<  (cents / (double)pitchbendRange) * 8192 << "\n";
						//ATLTRACE(stream.str().c_str());
						track->InsertPitchBend(channel, (short)(((lfoCents + pitchbend) / (double)pitchbendRange) * 8192), curTicks);
					}
				}
				break;
			}
			startAbsTicks = curTicks;

		}
	}

	

	return VGMSeq::PostLoad();
}
开发者ID:Kajiu,项目名称:vgmtrans,代码行数:101,代码来源:QSoundSeq.cpp


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