本文整理汇总了C++中MidiMessage::getNoteValue方法的典型用法代码示例。如果您正苦于以下问题:C++ MidiMessage::getNoteValue方法的具体用法?C++ MidiMessage::getNoteValue怎么用?C++ MidiMessage::getNoteValue使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MidiMessage
的用法示例。
在下文中一共展示了MidiMessage::getNoteValue方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: runVideo
void Gear_PushButton::runVideo()
{
bool accept_midi = _settings.get(Gear_PushButton::SETTING_ACCEPTMIDI)->valueBool();
if(accept_midi)
{
bool noteOff;
MidiMessage* msg;
std::vector<MidiMessage*> messages = MidiEngine::getInstance().getMessages();
if(messages.size())
{
int channel = _settings.get(Gear_PushButton::SETTING_MIDICHANNEL)->valueInt();
int Note = _settings.get(Gear_PushButton::SETTING_MIDINOTE)->valueInt();
// we only consider the LAST Note value
float on =_settings.get(Gear_PushButton::SETTING_ONVALUE)->valueFloat();
float off =_settings.get(Gear_PushButton::SETTING_OFFVALUE)->valueFloat();
float highValue = -1,lastStamp;
noteOff=false;
for(int i=0;i<messages.size();i++)
{
msg = messages[i];
if(msg->isNoteEvent() && msg->getChannel()==channel && msg->getNote()==Note)
{
std::cerr<<"have event!!!!!!!"<<std::endl;
if(msg->getNoteValue()==0)
noteOff=true;
else
{
noteOff=false;
highValue = (float)msg->getNoteValue() / 127;
}
lastStamp = msg->getStamp();
}
}
if(highValue!=-1)
{
//std::cout<<"set Value !! :"<<lastValue<<" "<<lastStamp<<std::endl;
setState(ON);
// can't call this from here since we're in a different thread than the GUI
//getGearGui()->reDraw();
}
}
if (noteOff)
{
_havePendingRelease=true;
}
}
// keyboard part
if(_settings.get(Gear_PushButton::SETTING_ONESHOT)->valueBool() && _lastWasOn)
setState(OFF);
if(_VALUE_OUT->type()->value()==_settings.get(Gear_PushButton::SETTING_ONVALUE)->valueFloat())
_lastWasOn=true;
else
_lastWasOn=false;
_haveUnconsumedClick=false;
if(_havePendingRelease)
setState(OFF);
}