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