void mycallback( double deltatime, std::vector< unsigned char > *message, void *userData ) { unsigned int nBytes = message->size(); for ( unsigned int i=0; i 0 ) cout << "stamp = " << deltatime << '\n'; vector *note; note = static_cast *> (userData); // -------- Note on ---------------------- if ((int) message->at(0) == 144) { stk_note::curr_voices++; note->at(stk_note::curr_voices).exp = (double) message->at(1) / 12.0; note->at(stk_note::curr_voices).frequency = 8.1758 * pow(2,note->at(stk_note::curr_voices).exp); note->at(stk_note::curr_voices).pitch = (int) message->at(1); note->at(stk_note::curr_voices).velocity = (int) message->at(2); note->at(stk_note::curr_voices).state = true; } // ---------- Note off ----------------------- if ((int) message->at(0) == 128) { for (int i = 1; i < (int) note->size(); i++) { if (note->at(i).pitch == (int) message->at(1)) { note->at(i).state = false; stk_note::curr_voices--; } } } cout << "Current Voices: " << stk_note::curr_voices << " "; }