libpd / pd-for-ios

Pure Data for iOS
Other
265 stars 72 forks source link

libpd for ios - not working in 64 bit #9

Closed tonysnail closed 7 years ago

tonysnail commented 9 years ago

I'm currently upgrading my app to 64-bit so I can release it to the app store.. It relies extensively on the libpd libraries.

My code works perfectly in 32 bit.. However, on arm64 standard architectures (as specified by Apple's new standards) - libpd compiles, but crashes immediately at runtime.. The offending code is here, in d_arithmetic.c :


static void scalartimes_dsp(t_scalartimes _x, t_signal *_sp) { if (sp[0]->s_n&7) dsp_add(scalartimes_perform, 4, sp[0]->s_vec, &x->x_g, sp[1]->s_vec, sp[0]->s_n); else dsp_add(scalartimes_perf8, 4, sp[0]->s_vec, &x->x_g, sp[1]->s_vec, sp[0]->s_n); }


dsp_add is causing an EXC_BAD_ACCESS error. Has anyone managed to compile libpd in 64 bit?

I've been through every single instance of 'malloc' in the project and added 'sizeof' to them, but it still crashes here.

I tried replacing the libpd source with the files from Miller Puckette's 64-bit update - Pd version 0.46-5, 64 bits, compiled for Macintosh OSX 10.8 or later, from Miller's website - but now I'm getting compile errors in z_libpd.c here:


sched_tick(sys_time + sys_time_per_dsp_tick);

and

int libpd_process_short(int ticks, short inBuffer, short outBuffer) { PROCESS( short_to_sample, \ sample_to_short) }


with PROCESS returning the error: 'too many arguments to function call, expected 0 have 1'

I hope someone can help, I'm ready to release my app, and Apple's new standards have caused me to pull my hair out.

Here's dsp_add():


void dsp_add(t_perfroutine f, int n, ...) { int newsize = dsp_chainsize + n+1, i; va_list ap;

dsp_chain = t_resizebytes(dsp_chain, dsp_chainsize * sizeof (t_int), newsize * sizeof (t_int)); dsp_chain[dsp_chainsize-1] = (t_int)f; va_start(ap, n); for (i = 0; i < n; i++) dsp_chain[dsp_chainsize + i] = va_arg(ap, t_int); va_end(ap); dsp_chain[newsize-1] = (t_int)dsp_done; dsp_chainsize = newsize; }


Thanks,

Carl

danomatika commented 7 years ago

This issue was fixed on libpd for a while. Can you confirm?

Also, this repo is more for a set of examples. Issues with libpd itself, and not these examples, are best submitted to the main libpd repo.

danomatika commented 7 years ago

Closing for now.