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


C++ MidiMessage::getMidiMachineControlCommand方法代码示例

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


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

示例1: midiCcReceived

//------------------------------------------------------------------------------
void MidiMappingManager::midiCcReceived(const MidiMessage& message,
										double secondsSinceStart)
{
	if(message.isController())
	{
		multimap<int, MidiMapping *>::iterator it;
		multimap<int, MidiAppMapping *>::iterator it2;
		int cc = message.getControllerNumber();
		int value = message.getControllerValue();

		//Check if it matches any MidiMappings.
		for(it=mappings.lower_bound(cc);
			it!=mappings.upper_bound(cc);
			++it)
		{
			it->second->ccReceived(value);
		}

		if(value > 64)
		{
			//Check if it matches any MidiAppMappings.
			for(it2=appMappings.lower_bound(cc);
				it2!=appMappings.upper_bound(cc);
				++it2)
			{
				CommandID id = it2->second->getId();
				MainPanel *panel = dynamic_cast<MainPanel *>(appManager->getFirstCommandTarget(MainPanel::TransportPlay));

				if(panel)
				{
					if(id != MainPanel::TransportTapTempo)
						panel->invokeCommandFromOtherThread(id);
					else
					{
						double tempo = tapHelper.updateTempo(secondsSinceStart);

						if(tempo > 0.0)
							panel->updateTempoFromOtherThread(tempo);
					}
				}
			}
		}
	}
	else if(message.isMidiMachineControlMessage())
	{
		if(PropertiesSingleton::getInstance().getUserSettings()->getBoolValue(L"mmcTransport", false))
		{
			CommandID id = -1;
			MainPanel *panel = dynamic_cast<MainPanel *>(appManager->getFirstCommandTarget(MainPanel::TransportPlay));

			switch(message.getMidiMachineControlCommand())
			{
				case MidiMessage::mmc_stop:
					id = MainPanel::TransportPlay;
					break;
				case MidiMessage::mmc_play:
					id = MainPanel::TransportPlay;
					break;
				case MidiMessage::mmc_rewind:
					id = MainPanel::TransportRtz;
					break;
				case MidiMessage::mmc_pause:
					id = MainPanel::TransportPlay;
					break;
				default:
					break;
			}
			if((id > -1) && panel)
				panel->invokeCommandFromOtherThread(id);
		}
	}
	else if(message.isProgramChange())
	{
		if(PropertiesSingleton::getInstance().getUserSettings()->getBoolValue(L"midiProgramChange", false))
		{
			int newPatch;
			MainPanel *panel = dynamic_cast<MainPanel *>(appManager->getFirstCommandTarget(MainPanel::TransportPlay));

			newPatch = message.getProgramChangeNumber();

			if(panel)
				panel->switchPatchFromProgramChange(newPatch);
		}
	}
}
开发者ID:eriser,项目名称:guitareffectvst,代码行数:86,代码来源:MidiMappingManager.cpp

示例2: timerCallback


//.........这里部分代码省略.........
                midiLine += MidiMessage::getGMInstrumentName (msg.getProgramChangeNumber());
                midiLine += ")";
           }
           else if (msg.isController())
           {
                midiLine += "CC: #";
                midiLine += String (msg.getControllerNumber());
                midiLine += " (";
                midiLine += MidiMessage::getControllerName (msg.getControllerNumber());
                midiLine += ") = ";
                midiLine += String (msg.getControllerValue());
           }
            else if (msg.isTimeSignatureMetaEvent ())
            {
                int newNumerator, newDenominator;
                msg.getTimeSignatureInfo (newNumerator, newDenominator);

                midiLine += "TIME SIGNATURE: ";
                midiLine += String (newNumerator);
                midiLine += " / ";
                midiLine += String (newDenominator);
            }
            else if (msg.isTempoMetaEvent ())
            {
                midiLine += "TEMPO: ";
                midiLine += String (msg.getTempoSecondsPerQuarterNote ());
                //midiLine += " ";
                //midiLine += String (msg.getTempoMetaEventTickLength (ticksPerQuarterNote));
            }
            else if (msg.isMidiMachineControlMessage())
            {
                midiLine += "MIDI CONTROL: ";
                
                switch (msg.getMidiMachineControlCommand())
                {
                    case MidiMessage::mmc_stop:             midiLine += "stop"; break;
                    case MidiMessage::mmc_play:             midiLine += "play"; break;
                    case MidiMessage::mmc_deferredplay:     midiLine += "deferredplay"; break;
                    case MidiMessage::mmc_fastforward:      midiLine += "fastforward"; break;
                    case MidiMessage::mmc_rewind:           midiLine += "rewind"; break;
                    case MidiMessage::mmc_recordStart:      midiLine += "recordStart"; break;
                    case MidiMessage::mmc_recordStop:       midiLine += "recordStop"; break;
                    case MidiMessage::mmc_pause:            midiLine += "pause"; break;
                }
            }
            else if (msg.isMidiStart ())
            {
                midiLine += "MIDI START: ";
            }
            else if (msg.isMidiContinue ())
            {
                midiLine += "MIDI CONTINUE: ";
            }
            else if (msg.isMidiStop ())
            {
                midiLine += "MIDI STOP: ";
            }
            else if (msg.isSongPositionPointer ())
            {
                midiLine += "SONG POSITION: ";
                midiLine += String (msg.getSongPositionPointerMidiBeat ());
            }
            else if (msg.isQuarterFrame ())
            {
                midiLine += "QUARTER FRAME: ";
                midiLine += String (msg.getQuarterFrameSequenceNumber ());
开发者ID:alessandropetrolati,项目名称:juced,代码行数:67,代码来源:MidiMonitorEditor.cpp


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