“library_setup()” in this case is probably “xsample_setup();”
EDIT: Looks like it might be “xsample_main()” judging from the main.cpp, although the usual pd external conventions noted in the readme is LIBRARYNAME_setup(). In this case, xsample is using Flext which abstracts writing dsp externals between pd and max so I imagine “xsample_setup()” is probably declared via Flext for compatibility with pd.
Yeah, that’s due to the instance functions not being currently thread safe and the main and audio threads trying to grab them at the same time. I added a mutex to the example so it no longer segfaults.
Is there a way to get around the dropouts you get when you refill a soundfiler? Is this is due to soundfiler not being multithreaded?
We have to do this dynamically in app. At the moment we use ofsoundplayer to mask the loading dropouts whilst PD silently starts and stops underneath.
This feels a bit hacks to me, so I was wondering if there was any c++ trickery that can solve this issue
There’s a trick to speed up table loading via using a smaller block size within a subpath. Check the pd-list archives.
This might be a few years late, but I added info on setting the audio background mode for iOS projects to the readme: https://github.com/danomatika/ofxPd#running-app-in-the-background-on-ios
Attention @cerupcat, et al.
I created a “reinit” branch which automatically reinits the libpd audio settings if the current values are different than the incoming sound stream values aka buffer size & number of channels. This should be helpful on iOS since the incoming buffer size seems to change depending on other apps.
You can find it here: https://github.com/danomatika/ofxPd/tree/reinit
Please test this and let me know if it’s working. My tests seem fine but I don’t have the newest hardware or a ton of other audio apps.
Related discussion: How to get audio buffersize through Audio Unit RemoteIO
Awesome, thanks! I’ve been using a somewhat hacky way of doing this in the past, but this solution is much better. I’ll give it a try when I can get a few minutes.
Went ahead and merged the reinit branch. Seems to be working as far as I can tell. Note: produces a verbose log print on a change, so turn on verbosity when debugging.
have you guys had issues recently using ofSoundPlayer with ofxPD?
Once an ofSoundPlayer has been played the mic input to PD then sounds like a saw/square wave
I haven’t tried it, no. I bet ofSoundPlayer is somehow changing the samplerate and/or buffer size of the sound stream.
Why not use [readsf~] in your patch and send it the full path to the file to play?
Sorry, i should have followed up…
I found that i had to define the AudioSession Category, ofSoundplayer seemed to set it as just Playback, not Playback and record.
Also I’ve found that ofSoundplayer crashes on iPhone 6s, i beleiiive to be because of the 48Khz capability
iPhone 6S is locked to 48k, regardless of what you try to set. We noticed this with libpd & the Obj-C wrapper.
oh ok, interesting. so to have it work on 6S properly, would you set the sample rate of PD to 48khz?
Yes. It’s always 48KHz no matter what you try to tell CoreAudio to use.
gotcha, so it’s a case of making sure that sample calculations for timings etc within PD are done using a value relative to the sample rate, not just a fixed int of 44100.
ofxPd now updated to libpd 0.9.0 which include pd vanilla 0.47-0:
- new clone object
- expr now BSD licensed
Also, now that OF uses C++11, ofxPd now uses the PdBase std::mutex.
It is recommended to regenerate your projects with the ProjectGenerator as there are new pd source files and a define which needs to be set for the mutex.
ooo lovely stuff!
Is the current ofxPD working on Android? I’ve tried to implement, but with no avail
Hey guys, I am interested in using this addon too. But I am on Windows so wondering if it’s even remotely possible: I don’t use Code::block anymore, looking for a solution for either Visual Studio or Qt Creator.
So far I couldn’t find anything compiling but looking at the libpd page, I see that it can be compiled on Windows using msys2, which is installed on my computer since it is needed for Qt Creator.
Do you guys have any hint if it would be possible to compile libpd with msys2, then include it in Qt Creator for example?
If the openFrameworks Project Generator can generate QT Creator project files, it should build fine in QT Creator as long as it’s using MinGW & the gcc compiler on Windows. libpd currently doesn’t compile well in Visual Studio, but should be fine in gcc.
I’ve updated ofxPd to use Semantic Versioning. The changelog has been updated and ofxPd-specific version tags to replace the previous tags which were based on OF versions.