Howdy Miller,
Here's how I modified libpd_wrapper/z_libpd.c:
55d54
< sys_time = 0;
110c109
< sched_tick(sys_time + sys_time_per_dsp_tick);
---
>
sched_tick();
130c129
< sched_tick(sys_time + sys_time_per_dsp_tick); \
---
>
sched_tick(); \
Here’s a gdb backtrace:
#0 0x0000000100091f2f in outlet_float (x=0x3f7ffc2a3f7ffc38, f=0.999937057) at m_obj.c:388
#1 0x00000001000ac572 in pdfloat_bang (x=0x10021ac20) at x_connective.c:89
#2 0x0000000100093d58 in pd_bang (x=0x10021ac20) at m_pd.c:267
#3 0x0000000100091ddd in outlet_bang (x=0x10021ae20) at m_obj.c:363
#4 0x00000001000c45e4 in metro_tick (x=0x10021ada0) at x_time.c:162
#5 0x0000000100095021 in sched_tick () at m_sched.c:418
#6 0x00000001000c5d4d in libpd_process_float (ticks=1, inBuffer=0x7fff5fbffa50, outBuffer=0x7fff5fbff750) at z_libpd.c:173
#7 0x0000000100000d18 in main ()
If I don’t optimize, it works fine:
print: 0
1003-frequency: bang
print: 0
1004-frequency: bang
1003-frequency: 1
1004-frequency: 2
1.000000 1.000000 0.999999 0.999999 0.999998 0.999998 0.999997 0.999997
1.000000 1.000000 0.999998 0.999998 0.999996 0.999996 0.999995 0.999995
print: 1
0.999944 0.999944 0.999943 0.999943 0.999942 0.999942 0.999941 0.999941
print: 1
0.999815 0.999815 0.999810 0.999810 0.999804 0.999804 0.999799 0.999799
print: 2
print: 2
But for libpd, are you sure you need to add anything? Can't just the user
call the pdinstance_new and pd_setinstance functions directly?
http://lists.puredata.info/pipermail/pd-dev/2014-05/019832.html
(BTW. When I wrote about libpds, I hadn't forgotten about the support for pd instances,
but since I didn't have all details in my head then, I didn't mention it. I should have though.)