danomatika / ofxPd

(maintained) a Pure Data addon for OpenFrameworks using libpd
Other
202 stars 45 forks source link

Using audio external in 64bit ofxPd app causes crash (WinVS) #67

Closed cuinjune closed 6 years ago

cuinjune commented 6 years ago

I figured out using a custom Pd audio external in 64bit ofxPd app(built with Visual Studio 2015) causes crash on startup.

screen shot 2018-02-03 at 5 22 32 am

This problem doesn't occur with 32bit ofxPd app and everything works fine. And 64bit app doesn't crash if I don't use the custom audio external in Pd patch. (it works fine with internal audio objects and externals that don't use audio) Also, it doesn't crash if I comment out dsp_add() function in void sine_tilde_dsp().

I created a simple example so anyone can easily test this on Windows. Here's the zip archive of my source codes and a test pd patch. Archive.zip

main.cpp, ofApp.cpp and ofApp.h are just simplified version of pdExample which just opens "pd/test.pd" in the setup() function; sine_tilde.c and sine_tilde.h are basically copy/paste of pd's osc~object. Lastly, test.pd basically looks like this [sine~ 440] -> [*~ 0.1] -> [dac~] . If I just replace [sine~ 440] with [osc~ 440], the 64bit app works fine and I can hear the sound too.

@danomatika Any idea why it happens? Thanks in advance!

danomatika commented 6 years ago

You probably need to set the Pd's long int type. It's a known issue with 64 bit windows: https://github.com/pure-data/pure-data/pull/7

Add the following define to the 64 bit build target:

-DPD_LONGINTTYPE=__int64
cuinjune commented 6 years ago

Thanks for the reply. I tried adding it but no luck.

screen shot 2018-02-03 at 7 09 12 pm

I also tried adding -DPD_LONGINTTYPE=__int64 into 'C/C++ -> Command Line -> Additional Options' or 'Linker -> Command Line -> Additional Options' but didn't work either.

danomatika commented 6 years ago

Note that the 64bit externals also need to be built with that define set and that existing 32bit externals will not load with a 64bit Pd/libpd.

danomatika commented 6 years ago

An updates on this? I've updated the libpd version, so perhaps this is now fixed.

danomatika commented 6 years ago

Closing due to inactivity.