Trouble integrating into openFrameworks app

After getting up & running compiling the samples from source, I was trying to get a simple app working with openFrameworks. I adapted code from the ColorReaderEventCPP sample, and looked through the docs here but don’t see what I’m doing wrong. I’m getting an EXC_BAD_ACCESS error in astra_streamset_open(). Code for the app is here: ofxOrbbecAstra/example/src at master · mattfelsen/ofxOrbbecAstra · GitHub

If I instead declare/intialize the StreamSet and StreamReader inside FrameListener::setup() then instead I get the error inside FrameListener::update() when calling astra_temp_update(). Maybe because the set & reader have fallen out of scope though? It’s a little difficult to tell the “proper” way to handle this since most of the samples have them declared inside main().

On a related-note, are there html-formatted docs anywhere? GitHub does a decent job of rendering the .rst files, but doesn’t show the code blocks so I have to read the raw .rst files anyway. Hope I’m not jumping the gun too much since I know OF is on your road map :wink:

Cheers

Check the Windows download zip from Develop – Orbbec for HTML formatted docs. They were accidentally omitted supposed to be in the OSX download as well.

As is, your code fails because streamset is being constructed before Astra::initialize(). And you are correct, they would fall out of scope if you declared them inside of setup. Two options - first and easiest is to move the call to initialize (and terminate, but make sure it will get called during cleanup) to ofApp.h or main.cpp. Second would be to use unique_ptr to wrap StreamSet and StreamReader … initialize with nullptr to start but then update with a real streamset/streamreader after call initialize(). (I’d just go with the first option for now.)

1 Like

Awesome, thanks for the tips. The html docs are so much nicer to read :blush: I’m good to go now with unique_ptr’s since I wanted to keep everything inside FrameListener.