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


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

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


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

示例1: PostLoad


//.........这里部分代码省略.........
				//double centsPerMidiTick = vibrato / midiTicksPerPhase;
				double lfoRatePerMidiTick = (numLfoPhases * 0x20000) / (double)segmentDurTicks;

				const uint8_t tickRes = 16;
				uint32_t lfoRatePerLoop = (uint32_t)((tickRes * lfoRatePerMidiTick) * 256);

				for (int t = 0; t < segmentDurTicks; t += tickRes)
				{
					lfoVal += lfoRatePerLoop;
					if (lfoVal > 0xFFFFFF)
					{
						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);
开发者ID:Kajiu,项目名称:vgmtrans,代码行数:67,代码来源:QSoundSeq.cpp


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