本文整理汇总了C++中MidiMessage::isControllerChange方法的典型用法代码示例。如果您正苦于以下问题:C++ MidiMessage::isControllerChange方法的具体用法?C++ MidiMessage::isControllerChange怎么用?C++ MidiMessage::isControllerChange使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MidiMessage
的用法示例。
在下文中一共展示了MidiMessage::isControllerChange方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: runAudio
void Gear_Slider::runAudio()
{
bool accept_midi = _settings.get(Gear_Slider::SETTING_ACCEPTMIDI)->valueBool();
if(accept_midi)
{
MidiMessage* msg;
std::vector<MidiMessage*> messages = MidiEngine::getInstance().getMessages();
if(messages.size())
{
int channel = _settings.get(Gear_Slider::SETTING_MIDICHANNEL)->valueInt();
int controller = _settings.get(Gear_Slider::SETTING_MIDICONTROLLER)->valueInt();
// we only consider the LAST controller value
float low = _settings.get(Gear_Slider::SETTING_LOWERBOUND)->valueFloat();
float hi = _settings.get(Gear_Slider::SETTING_HIGHERBOUND)->valueFloat();
float lastValue = -1,lastStamp;
for(unsigned int i=0;i<messages.size();i++)
{
msg = messages[i];
if(msg->isControllerChange() && msg->getChannel()==channel && msg->getController()==controller)
{
lastValue = (float)msg->getControllerValue() / 127;
lastStamp = msg->getStamp();
}
}
if(lastValue!=-1)
{
//std::cout<<"set Value !! :"<<lastValue<<" "<<lastStamp<<std::endl;
setValue(low + (hi-low)*lastValue);
// can't call this from here since we're in a different thread than the GUI
//getGearGui()->reDraw();
}
}
}
}