Closed moebiussurfing closed 5 years ago
i made a vector to enqueue all the osc/lists received and to trig them on next update. it seems to work nice.
//ofApp.h
vector<ofxOscMessage> mOled_messages;
//ofApp.cpp
void ofApp::receiveList(const std::string& dest, const List& list)
{
//...
else if (list.isFloat(1))
{
float listF = list.getFloat(i);
if (address == "/gDrawInfoBar")
{
ofLogNotice() << " " << i << " LIST FLOAT " << ofToString(listF) << " ";
mOled.addFloatArg(listF);
}
}
//...
}
//update()
// dequeue all osc messages and trig their drawing commands
if (mOled_messages.size() > 0)
{
for (int i = 0; i < mOled_messages.size(); i++)
{
oled.OSC_filter(mOled_messages[i]);
}
mOled_messages.clear();
}
Hey I am receiving some lists from the ofxPd pd instance and it's being tricky because there are more flood speed that the app update() / framerate happens... (more than one incoming messages in a 'frame pass')
To avoid drawing from the callback function (void ofApp::receiveList(const std::string& dest, const List& list), [because even calling another drawing in ofApp methods makes the app unstable and crashing], I store the message and I use a bool trigger that I listen on ofApp update().
But when it's trigged, the list message (that I packed into an osc message) has changed. So there's arriving too much list callbacks than framerate can handle.
Maybe I should enqueue all the osc messages/lists into a vector and then process one by one when trig is detected on update(). Do you think It's the clean way?
I see on the example some related things but I don't know how to handle in a good way. Any tips or example to check into?