ofxAbletonLive
ofxAbletonLive copied to clipboard
App crashes with Exc_Bad_Access
My app crashes when Ableton is already playing and one of the first update cycles comes through.
if (parameter > 0 && tracks.count(track) != 0 && tracks[track]->getDevices().count(device)) {
tracks[track]->getDevices()[device]->getParameterGroup()->getFloat(parameter).set(m.getArgAsFloat(3));
}
I get an error on this line: tracks[track]->getDevices()[device]->getParameterGroup()->getFloat(parameter).set(m.getArgAsFloat(3));
in void ofxAbletonLive::processParameterUpdate(ofxOscMessage &m)
Maybe this is as easy as doing some extra checks but since I'm only a novice cpp dev, it's hard to figure it out myself :p
Ok, so the quickest solution I could came up with, is to process params only AFTER the liveset was loaded completely. So that, updates to parameters while loading the set get ignored (avoiding bad access).
I changed:
ofxOscMessage m;
receiver.getNextMessage(m);
if (m.getAddress() == "/live/device/param") {
processParameterUpdate(m);
}
to
ofxOscMessage m;
receiver.getNextMessage(m);
if (isLoaded() && m.getAddress() == "/live/device/param") {
processParameterUpdate(m);
}
oh i see... yeah i think that works fine. where are you sending OSC from? i hadn't anticipated cases where an application would send before the set is loaded. but this might be a smart fix.