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


C++ Signal::getArgAsInt32方法代码示例

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


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

示例1: convertToNotePressure

bool SignalModifier::convertToNotePressure(Signal &s)
{
    // reference counted Signal ( string command, string origin )
    Signal::SignalP midiSignal = new Signal("SEND_MIDI", "SIG_MOD");
    
    // allow this to set the MIDI Channel
    midiSignal->addStringArg("NOTE");
    midiSignal->addIntArg(1);
    midiSignal->addIntArg(s.getArgAsInt32(1));
    int pressureValue = int((s.getArgAsInt32(2)/1024.00)*127.00);
    midiSignal->addIntArg(pressureValue);
    
    _mCenter->handleSignal(*midiSignal); 
    
    // reference counted Signal ( string command, string origin )
    Signal::SignalP ledStateSignal = new Signal("SEND_OSC", "SIG_MOD");
    
    ledStateSignal->addStringArg("/nomestate/grid/led/set");
    // get the x position: LED bumber % 8
    ledStateSignal->addIntArg(s.getArgAsInt32(1) % 8);
    // get the y position: LED number / 8
    ledStateSignal->addIntArg(s.getArgAsInt32(1) / 8);
    // get the LED state: toggleState
    int state = 0;
    
    if(s.getArgAsInt32(2) > 0) 
        state = 1;
    
    ledStateSignal->addIntArg(state);
    
    _mCenter->handleSignal(*ledStateSignal); 
    
    return true;
}
开发者ID:,项目名称:,代码行数:34,代码来源:

示例2: convertToTrigger

bool SignalModifier::convertToTrigger(Signal &s)
{    
    // reference counted Signal ( string command, string origin )
    Signal::SignalP midiSignal = new Signal("SEND_MIDI", "SIG_MOD");
    
    midiSignal->addStringArg("CC");
    // TODO: allow this to set the MIDI Channel
    midiSignal->addIntArg(1);
    midiSignal->addIntArg(s.getArgAsInt32(1));
    midiSignal->addIntArg(s.getArgAsInt32(2) * 127);
    
    _mCenter->handleSignal(*midiSignal); 
    
    // reference counted Signal ( string command, string origin )
    Signal::SignalP ledStateSignal = new Signal("SEND_OSC", "SIG_MOD");
    
    ledStateSignal->addStringArg("/nomestate/grid/led/set");
    // get the x position: LED bumber % 8
    ledStateSignal->addIntArg(s.getArgAsInt32(1) % 8);
    // get the y position: LED number / 8
    ledStateSignal->addIntArg(s.getArgAsInt32(1) / 8);
    // get the LED state: toggleState    
    ledStateSignal->addIntArg(s.getArgAsInt32(2));

    _mCenter->handleSignal(*ledStateSignal); 
    
    return true;
}
开发者ID:,项目名称:,代码行数:28,代码来源:

示例3: convertToToggle

bool SignalModifier::convertToToggle(Signal &s)
{
    if(s.getArgAsInt32(2))
    {
        int toggleState = PropertiesManager::getInstance()->getButtonPropertyContainer(s.getArgAsInt32(1))->propertyTree.getProperty("buttonState") ? 0 : 1;
        
        PropertiesManager::getInstance()->getButtonPropertyContainer(s.getArgAsInt32(1))->propertyTree.setProperty("buttonState", toggleState, NULL);
        
        // reference counted Signal ( string command, string origin )
        Signal::SignalP midiSignal = new Signal("SEND_MIDI", "SIG_MOD");
        
        // allow this to set the MIDI Channel
        midiSignal->addStringArg("CC");
        midiSignal->addIntArg(1);
        midiSignal->addIntArg(s.getArgAsInt32(1));
        
        
        midiSignal->addIntArg(toggleState * 127);
        
        _mCenter->handleSignal(*midiSignal); 
        
        // reference counted Signal ( string command, string origin )
        Signal::SignalP ledStateSignal = new Signal("SEND_OSC", "SIG_MOD");
        
        ledStateSignal->addStringArg("/nomestate/grid/led/set");
        // get the x position: LED bumber % 8
        ledStateSignal->addIntArg(s.getArgAsInt32(1) % 8);
        // get the y position: LED number / 8
        ledStateSignal->addIntArg(s.getArgAsInt32(1) / 8);
        // get the LED state: toggleState
        ledStateSignal->addIntArg(toggleState);
        
        _mCenter->handleSignal(*ledStateSignal); 
    }
    
    return true;
}
开发者ID:,项目名称:,代码行数:37,代码来源:

示例4: convertSignal

bool SignalModifier::convertSignal(Signal &s)
{
    if(s.command == "SIGNAL_MOD") {
        // only listen to grid/key and /press
        if((int(PropertiesManager::getInstance()->getButtonPropertyContainer(s.getArgAsInt32(1))->propertyTree.getProperty("Pressure")) == 0 
            && (s.getArgAsString(0) == "nomestategridkey" || s.getArgAsString(0) == "nomestatepress")) )
        {
            switch(int(PropertiesManager::getInstance()->getButtonPropertyContainer(s.getArgAsInt32(1))->propertyTree.getProperty("ButtonMode"))) // this seems ugly
            {
                case 0:         convertToToggle(s); break;
                case 1:         convertToTrigger(s); break;
                case 2:         convertToNote(s); break;
                    
                default:        jassertfalse; break;
            }
        } 
        
        // only listen to grid/pressure if pressure is selected
        else if ((int(PropertiesManager::getInstance()->getButtonPropertyContainer(s.getArgAsInt32(1))->propertyTree.getProperty("Pressure")) == 1 
                  && s.getArgAsString(0) == "nomestategridpressure") )
        { 
            DBG("pressure");
            switch(int(PropertiesManager::getInstance()->getButtonPropertyContainer(s.getArgAsInt32(1))->propertyTree.getProperty("ButtonMode"))) // this seems ugly
            {
                case 0:         convertToTogglePressure(s); break;
                case 1:         convertToTriggerPressure(s); break;
                case 2:         convertToNotePressure(s); break;
                    
                default:        jassertfalse; break;
            }
        }
        s.command = "SEND_OSC";
    }
    
    return true;
}
开发者ID:,项目名称:,代码行数:36,代码来源:


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