Example #1
0
//-----------------------------------------------------------------------------
// name: cb_hid_input
// desc: called by device implementations to push a message onto the buffer
//-----------------------------------------------------------------------------
void HidInManager::push_message( HidMsg & msg )
{
    // find the queue
    if( the_matrix[msg.device_type][msg.device_num] != NULL )
    {
        CBufferAdvance * cbuf = the_matrix[msg.device_type][msg.device_num]->cbuf;
        if( cbuf != NULL )
            // queue the thing
            cbuf->put( &msg, 1 );
    }
}
Example #2
0
//-----------------------------------------------------------------------------
// name: cb_midi_output
// desc: call back
//-----------------------------------------------------------------------------
void MidiInManager::cb_midi_input( double deltatime, std::vector<unsigned char> * msg,
                                   void * userData )
{
    unsigned int nBytes = msg->size();
    CBufferAdvance * cbuf = (CBufferAdvance *)userData;
    MidiMsg m;
    if( nBytes >= 1 ) m.data[0] = msg->at(0);
    if( nBytes >= 2 ) m.data[1] = msg->at(1);
    if( nBytes >= 3 ) m.data[2] = msg->at(2);

    // put in the buffer, make sure not active sensing
    if( m.data[2] != 0xfe )
    {
        cbuf->put( &m, 1 );
    }
}