To register and login, use your Google, Twitter, Facebook, LinkedIn, or OpenID credentials.

This is allowing us to stop most spam registrations. We've deleted most of the spam accounts that got through, and we're closely watching for more.

print hook not being called in C sample, libpd

owenooweno Posts: 4
edited December 2012 in Pd Everywhere

I compiled libpd and C example on Ubuntu 12.04 without a hitch. Running the C example in 'samples/c_samples/c' seems to work, however the two hooks defined for midi-note-on and print are not being called. When I run:

$./pdtest test.pd ./

The program runs (and I've verified it is computing samples), but the print hook or midi hooks are not called. Anyone have luck with this basic example?
I've also had same experience with ARM architecture (compiled fine on Raspberry Pi, and the sample runs, but the hooks aren't called)

Thanks !


  • owenooweno Posts: 4

    Upon closer inspection, it's not that the print hook isn't being called, but instead the hook isn't being set at all (libpd_printhook still NULL even after it is set in pdtest.c).. line 20:

    libpd_printhook = (t_libpd_printhook) pdprint;

    in pdtest.c has no effect.

    Adding a function to z_libpd.c to set it, and then calling this from pdtest.c fixes the issue:

    void libpd_set_printhook(const t_libpd_printhook hook){
    libpd_printhook = hook;

    This shouldn't be necessary since libpd_printhook is declared as extern (and compiles fine), right? I must be missing some C / linking thing...

  • pbrinkmannpbrinkmann Posts: 686 ✭✭

    Not sure what's going on here. How did you compile the sample?

  • owenooweno Posts: 4
    edited December 2012

    I just compiled using the included makefile:

    git clone git://
    cd libpd
    cd samples/c_samples/c

    running sample (./pdtest test.pd ./), nothing gets printed

  • gmpCodegmpCode Posts: 4

    For me it's the same: program does not deliver output.
    I compiled the example with debug symbols and stepped through the code, but the functions pdprint and pdnoteon are newer called.

    It's not a good start, when a minimal example fails.
    Any hints?

  • gmpCodegmpCode Posts: 4

    I ran test.pd in pd. My only audio interface, which is working is ALSA.
    OSS and JACK are not working on my machine.

    Which is the default audio interface, being inititialized by libpd_init and libpd_init_audio?
    Can that be a reason for the fail of the program?

  • gmpCodegmpCode Posts: 4

    I built this example on Windows using MinGW and it works.

  • pbruelpbruel Posts: 2

    I just did what oweno said, and it finally worked...

    But something is itching, this is probably not the way to solve this. Which flags did you guys use to compile? I just used the ones that come with the example provided.

Sign In or Register to comment.