コード例 #1
0
void SmSnDevice::handleOSCBundleInternal(class OSCBundle &bundle) {
    if (bundle.hasError()) {
        errorCue();
        playTone(400,100);
        osc.sendOSCBundleError(bundle);
    } else if (!(handleOSCBundle(bundle)
        // TODO: copying addresses into buffers on the fly (via address()), one by one, is inefficient
        || bundle.dispatch(address(OSC_ERROR), handleErrorMessage)
        || bundle.dispatch(address(OSC_INFO), handleInfoMessage)
        //|| bundle.dispatch(address(OSC_MORSE), handleMorseMessage)
        || bundle.dispatch(address(OSC_OK), handleOkMessage)
        || bundle.dispatch(address(OSC_PING), handlePingMessage)
        || bundle.dispatch(address(OSC_READY), handleReadyMessage)
#ifdef BOUNTIFUL_RAM
        || bundle.dispatch(address(OSC_CONTEXT_SET), handleContextSetMessage)
        || bundle.dispatch(address(OSC_PING_REPLY), handlePingReplyMessage)
        || bundle.dispatch(address(OSC_RGB_SET), handleRGBSetMessage)
        || bundle.dispatch(address(OSC_TONE), handleToneMessage)
        || bundle.dispatch(address(OSC_VIBRO), handleVibroMessage)
#endif // BOUNTIFUL_RAM
        || bundle.dispatch(address(OSC_WARNING), handleWarningMessage)
        )) {
        if (!bundle.size()) {
            osc.sendError(ERR_EMPTY_OSC_BUNDLE);
        } else {
            for (int i = 0; i < bundle.size(); i++) {
                OSCMessage *m = bundle.getOSCMessage(i);
                char address[64];
                m->getAddress(address);
                osc.sendError(ERR_NO_HANDLER, address);
            }
        }
        errorCue();
    }
}
コード例 #2
0
void OSCPacketDispatcher::dispatchMessage(OSCMessage& message, QHostAddress& address, QDateTime& time)
{
    QList<QString> mkeys = iAddressToClassTable->keys();
    for(int i=0; i < mkeys.length(); i++)
    {
        const QString& addresskey = mkeys.at(i);
        if(addresskey==message.getAddress())
        {
            OSCListener* olistener = iAddressToClassTable->value(addresskey);
            olistener->acceptMessage(address,time,message);
        }
    }
}
コード例 #3
0
void check_OSC(){
  
 if ( osc.available() ) {

          //toplevel address matching
          if( !strcmp( recMes.getAddress(0) , topAddress ) ){
                            
              //second level address matching           
             
                if( !strcmp( recMes.getAddress(1) , subAddress[0] ) ) {  // xpos    
                      do_xpos();}
  
                if( !strcmp( recMes.getAddress(1) , subAddress[1] ) ){   // ypos   
                      do_ypos();}
                
                if( !strcmp( recMes.getAddress(1) , "/button1" ) ){   // button1
                      do_button1();}
                
                if( !strcmp( recMes.getAddress(1) , subAddress[6] ) ){   // button2
                      do_button2();}
                
                if( !strcmp( recMes.getAddress(1) , subAddress[7] ) ){   // button3
                      do_button3();}
                
                if( !strcmp( recMes.getAddress(1) , subAddress[8] ) ){   // button4
                      do_button4();}
  
                if( !strcmp( recMes.getAddress(1) , subAddress[9] ) ){   // button5
                      do_button5();}
  
                if( !strcmp( recMes.getAddress(1) , subAddress[10] ) ){   // button6
                      do_button6();}
  
                if( !strcmp( recMes.getAddress(1) , subAddress[11] ) ){   // button7
                      do_button7();}
  
                if( !strcmp( recMes.getAddress(1) , subAddress[12] ) ){   // button8
                      do_button8();}
                                
                if( !strcmp( recMes.getAddress(1) , "/button9" ) ){  
                      do_button9();}                                     
         
                if( !strcmp( recMes.getAddress(1) , "/button16" ) ){  
                      do_button16();}               



                          
                if( !strcmp( recMes.getAddress(1) , subAddress[2] ) ){   // slider1
                      do_slider1();}
                
                if( !strcmp( recMes.getAddress(1) , subAddress[3] ) ){   // slider2
                      do_slider2();}
                
                if( !strcmp( recMes.getAddress(1) , subAddress[4] ) ){   // slider3
                      do_slider3();}
                      
                if( !strcmp( recMes.getAddress(1) , subAddress[13] ) ){   // slider4
                      do_slider4();}
                      
                if( !strcmp( recMes.getAddress(1) , "/slider5" ) ){  
                      do_slider5();}
                
                if( !strcmp( recMes.getAddress(1) , "/slider6" ) ){  
                      do_slider6();}
        
                if( !strcmp( recMes.getAddress(1) , "/slider7" ) ){  
                      do_slider7();}
        
                if( !strcmp( recMes.getAddress(1) , "/slider8" ) ){  
                      do_slider8();}
                      
                if( !strcmp( recMes.getAddress(1) , "/slider9" ) ){  
                      do_slider9();}
                      
                if( !strcmp( recMes.getAddress(1) , "/slider10" ) ){  
                      do_slider10();}
                      
                if( !strcmp( recMes.getAddress(1) , "/slider11" ) ){  
                      do_slider11();}
                      
                if( !strcmp( recMes.getAddress(1) , "/slider12" ) ){  
                      do_slider12();}
          
           }
 
    }
 }      //check_OSC