On 2017-07-04 03:49, Alexandre Torres Porres wrote:
> howdy, I've been testing libpd for android and some externals. I've managed
> to use pd's extra objects as well as a few objects from cyclone and also
> from another library of my own - but some externals will fail, they compile
> and create and everything, I just do not hear any sound! And they're pretty
> simple so I can't see any reason why they fail, here's one I couldn't run,
> for instance: https://github.com/porres/pd- else/blob/master/classes/ gbman~.c
i don't see any obvious problem, but some generic remarks:
- use `t_sample` for all signals.
don't use different types for input and output signals.
use types consistently and try to not convert between them too often
(even if t_float and t_sample are practically the same on *your* system
right now).
- data sent to perform routine:
you are passing in x, some signal-vectors and the vector length.
you are storing the samplerate as a member of x. why don't you pass it
directly? or rather: why do you pass in sp[0]->s_n directly, but
sp[0]->s_sr via "x".
you are also passing in a member of x (x_val), why don't you just
dereference `x` in the perform routine to get that value? apart from
that, what is this value there for in the first place? you seem to do an
awful lot of referencing/passing around/dereferencing just to never
actually use that value.
- you are mixing variable declarations and code (L118). this is valid
C99 code, but not ANSI compatible.
since/if it doesn't really improve the readability of your code, i'd
stick to ANSI and declare my variables only at the beginning of a code
block.
> What should I know or be careful about building external objects for
> android? How can I get more information about my problem?
often such problems come from uninitialized variables.
i don't know anything about libpd, but sys_getsr() in the constructor
looks fishy. it might well poison the hz (x_freq; hmm, is that used
anywhere?) and x_phase values.
run your program through debuggers:
- valgrind is very easy to use, and it often detects use of
uninitialized variables.
learn to use it: https://www.google.at/search? q=valgrind+tutorial
- if this doesn't give you plenty of hints
gdb is a very powerful debugger, you should probably learn to use it:
https://www.google.at/search? q=gdb+tutorial
- there's also the printf debugger, which might be easier to use in some
specific contexts:
https://stackoverflow.com/ questions/189562
______________________________ _________________
Pd-list@lists.iem.at mailing list
UNSUBSCRIBE and account-management -> https://lists.puredata.info/ listinfo/pd-list