<?xml version="1.0" encoding="UTF-8"?>
	<rss version="2.0"
		xmlns:content="http://purl.org/rss/1.0/modules/content/"
		xmlns:wfw="http://wellformedweb.org/CommentAPI/"
		xmlns:dc="http://purl.org/dc/elements/1.1/"
		xmlns:atom="http://www.w3.org/2005/Atom"

			>

	<channel>
		<title>Cycling 74  &#187;  Topic: msp external problem</title>
		<atom:link href="http://cycling74.com/forums/topic/msp-external-problem/feed" rel="self" type="application/rss+xml" />
		<link>http://cycling74.com/forums/topic/msp-external-problem/feed</link>
		<description></description>
		<pubDate>Thu, 20 Jun 2013 03:30:47 +0000</pubDate>
		<generator>http://bbpress.org/?v=2.2.4</generator>
		<language></language>

		
														
					
				<item>
					<guid>http://cycling74.com/forums/topic/msp-external-problem/#post-27263</guid>
					<title><![CDATA[msp external problem]]></title>
					<link>http://cycling74.com/forums/topic/msp-external-problem/#post-27263</link>
					<pubDate>Wed, 23 Aug 2006 00:47:13 +0000</pubDate>
					<dc:creator>aengus</dc:creator>

					<description>
						<![CDATA[
						<p>Hi,</p>
<p>Having written a few max objects in C, I&#8217;ve started my first msp<br />
object. I am working with Visual Studio .NET 2003 under Windows XP. I<br />
am using Max 4.5.5.</p>
<p>To take some first steps, I copied the sample plussz~ Visual Studio<br />
project (which compiles and works fine), and exchanged the code in<br />
plussz~.c for the code at the end of the e-mail. I have found that if<br />
the line</p>
<p>x->ltestvar = 0;</p>
<p>in the amstring_new function is removed, the external works fine,<br />
passing the audio through unchanged. But with this line, it does not<br />
work. If you try to place the external in a patch it does not give the<br />
 object any inputs or outputs. However, it does not say &#8216;No such<br />
object&#8217; in the Max window.</p>
<p>Does anyone have any idea why this might be the case?</p>
<p>Thanks,</p>
<p>Aengus.</p>
<p>
#include &#8220;ext.h&#8221;<br />
#include &#8220;z_dsp.h&#8221;</p>
<p>void* amstring_class;</p>
<p>typedef struct _amstring<br />
{<br />
	t_pxobject* x_obj;<br />
	long ltestvar;<br />
} t_amstring;</p>
<p>void amstring_dsp(t_amstring *x, t_signal **sp, short *count);<br />
t_int *amstring_perform(t_int *w);<br />
void* amstring_new(long delay, float feedback);</p>
<p>void main(void)<br />
{<br />
	setup((t_messlist **)&#038;amstring_class, (method)amstring_new, (method)dsp_free,<br />
		(short)sizeof(t_amstring), 0L, A_DEFLONG, A_DEFFLOAT, A_NOTHING);<br />
	addmess((method)amstring_dsp, &#8220;dsp&#8221;, A_CANT, 0);<br />
	dsp_initclass(); // must call this function for MSP object classes<br />
}</p>
<p>void amstring_dsp(t_amstring *x, t_signal **sp, short *count)<br />
{<br />
	dsp_add(amstring_perform, 4, sp[0]->s_vec, sp[1]->s_vec, x, sp[0]->s_n);<br />
}</p>
<p>t_int *amstring_perform(t_int* w) // 4 args. in memory pointed to by w.<br />
{<br />
	t_float *in = (t_float *)(w[1]);<br />
    t_float *out = (t_float *)(w[2]);<br />
	t_amstring *x = (t_amstring *)(w[3]);<br />
	int n = (int)(w[4]);</p>
<p>	while (&#8211;n) *++out = *++in; // copy input to output</p>
<p>	return (w+5);<br />
}</p>
<p>void* amstring_new(long delay_length, float feedback_gain)<br />
{<br />
	t_amstring* x = (t_amstring *)newobject(amstring_class);<br />
	dsp_setup((t_pxobject *)x, 1);<br />
	outlet_new((t_pxobject *)x, &#8220;signal&#8221;);</p>
<p>	x->ltestvar = 0; // external works if this line is removed</p>
<p>	return(x);<br />
}</p>
<p>
____________________<br />
<a href="http://www.am-process.org" rel="nofollow">http://www.am-process.org</a></p>
						]]>
					</description>

					
					
				</item>

			
				<item>
					<guid>http://cycling74.com/forums/topic/msp-external-problem/#post-82294</guid>
					<title><![CDATA[Re: msp external problem]]></title>
					<link>http://cycling74.com/forums/topic/msp-external-problem/#post-82294</link>
					<pubDate>Wed, 23 Aug 2006 01:04:14 +0000</pubDate>
					<dc:creator>projects</dc:creator>

					<description>
						<![CDATA[
						<p>Hi Aengus,</p>
<p>Look here:</p>
<p>typedef struct _amstring<br />
{<br />
       t_pxobject* x_obj;<br />
       long ltestvar;<br />
} t_amstring;</p>
<p>
I don&#8217;t think x_obj should be a pointer to a t_pxobject, but rather an<br />
actual t_pxobject instance.  so change it to</p>
<p>typedef struct _amstring<br />
{<br />
       t_pxobject x_obj;<br />
       long ltestvar;<br />
} t_amstring;</p>
<p>and see if that works out.</p>
<p>Ben</p>
						]]>
					</description>

					
					
				</item>

			
				<item>
					<guid>http://cycling74.com/forums/topic/msp-external-problem/#post-82295</guid>
					<title><![CDATA[Re: msp external problem]]></title>
					<link>http://cycling74.com/forums/topic/msp-external-problem/#post-82295</link>
					<pubDate>Wed, 23 Aug 2006 01:04:22 +0000</pubDate>
					<dc:creator>Eric Lyon</dc:creator>

					<description>
						<![CDATA[
						<p>It looks like you have half of a pre-dec/incr approach to passing your vectors<br />
(which I recommend avoiding), which could potentially lead to a crash. Perhaps<br />
your DSP line should instead be:</p>
<p>while (n&#8211;) *out++ = *in++; // copy input to output</p>
<p>Good luck,</p>
<p>Eric</p>
						]]>
					</description>

					
					
				</item>

			
				<item>
					<guid>http://cycling74.com/forums/topic/msp-external-problem/#post-82296</guid>
					<title><![CDATA[Re: msp external problem]]></title>
					<link>http://cycling74.com/forums/topic/msp-external-problem/#post-82296</link>
					<pubDate>Wed, 23 Aug 2006 09:57:54 +0000</pubDate>
					<dc:creator>aengus</dc:creator>

					<description>
						<![CDATA[
						<p>Thanks to you both.</p>
<p>That pointer which was the culprit might have taken a long time to<br />
find. Usually a typo like that causes a problem compiling (so you find<br />
them soon after you make them), so I guess I was somewhat unlucky to<br />
get as far as I did with that mistake in there.</p>
<p>I was a little uncomfortable with the line which passes the vectors<br />
myself. I had copied it straight from the plussz~ example, just to get<br />
something working.</p>
<p>Cheers,</p>
<p>Aengus.</p>
<p>On 8/23/06, Eric Lyon <eric .Lyon@manchester.ac.uk> wrote:<br />
> It looks like you have half of a pre-dec/incr approach to passing your vectors<br />
> (which I recommend avoiding), which could potentially lead to a crash. Perhaps<br />
> your DSP line should instead be:<br />
><br />
> while (n&#8211;) *out++ = *in++; // copy input to output<br />
><br />
> Good luck,<br />
><br />
> Eric<br />
><br />
><br />
> Quoting Aengus Martin <aengus @am-process.org>:<br />
><br />
> > Hi,<br />
> ><br />
> > Having written a few max objects in C, I&#8217;ve started my first msp<br />
> > object. I am working with Visual Studio .NET 2003 under Windows XP. I<br />
> > am using Max 4.5.5.<br />
> ><br />
> > To take some first steps, I copied the sample plussz~ Visual Studio<br />
> > project (which compiles and works fine), and exchanged the code in<br />
> > plussz~.c for the code at the end of the e-mail. I have found that if<br />
> > the line<br />
> ><br />
> > x->ltestvar = 0;<br />
> ><br />
> > in the amstring_new function is removed, the external works fine,<br />
> > passing the audio through unchanged. But with this line, it does not<br />
> > work. If you try to place the external in a patch it does not give the<br />
> > object any inputs or outputs. However, it does not say &#8216;No such<br />
> > object&#8217; in the Max window.<br />
> ><br />
> > Does anyone have any idea why this might be the case?<br />
> ><br />
> > Thanks,<br />
> ><br />
> > Aengus.<br />
> ><br />
> ><br />
> > #include &#8220;ext.h&#8221;<br />
> > #include &#8220;z_dsp.h&#8221;<br />
> ><br />
> > void* amstring_class;<br />
> ><br />
> > typedef struct _amstring<br />
> > {<br />
> >       t_pxobject* x_obj;<br />
> >       long ltestvar;<br />
> > } t_amstring;<br />
> ><br />
> > void amstring_dsp(t_amstring *x, t_signal **sp, short *count);<br />
> > t_int *amstring_perform(t_int *w);<br />
> > void* amstring_new(long delay, float feedback);<br />
> ><br />
> > void main(void)<br />
> > {<br />
> >       setup((t_messlist **)&#038;amstring_class, (method)amstring_new,<br />
> > (method)dsp_free,<br />
> >               (short)sizeof(t_amstring), 0L, A_DEFLONG, A_DEFFLOAT, A_NOTHING);<br />
> >       addmess((method)amstring_dsp, &#8220;dsp&#8221;, A_CANT, 0);<br />
> >       dsp_initclass(); // must call this function for MSP object classes<br />
> > }<br />
> ><br />
> > void amstring_dsp(t_amstring *x, t_signal **sp, short *count)<br />
> > {<br />
> >       dsp_add(amstring_perform, 4, sp[0]->s_vec, sp[1]->s_vec, x, sp[0]->s_n);<br />
> > }<br />
> ><br />
> > t_int *amstring_perform(t_int* w) // 4 args. in memory pointed to by w.<br />
> > {<br />
> >       t_float *in = (t_float *)(w[1]);<br />
> >    t_float *out = (t_float *)(w[2]);<br />
> >       t_amstring *x = (t_amstring *)(w[3]);<br />
> >       int n = (int)(w[4]);<br />
> ><br />
> >       while (&#8211;n) *++out = *++in; // copy input to output<br />
> ><br />
> >       return (w+5);<br />
> > }<br />
> ><br />
> > void* amstring_new(long delay_length, float feedback_gain)<br />
> > {<br />
> >       t_amstring* x = (t_amstring *)newobject(amstring_class);<br />
> >       dsp_setup((t_pxobject *)x, 1);<br />
> >       outlet_new((t_pxobject *)x, &#8220;signal&#8221;);<br />
> ><br />
> >       x->ltestvar = 0; // external works if this line is removed<br />
> ><br />
> >       return(x);<br />
> > }<br />
> ><br />
> ><br />
> > ____________________<br />
> > <a href="http://www.am-process.org" rel="nofollow">http://www.am-process.org</a><br />
> ><br />
><br />
><br />
><br />
></aengus></eric></p>
<p>
&#8211; <br />
____________________<br />
<a href="http://www.am-process.org" rel="nofollow">http://www.am-process.org</a></p>
						]]>
					</description>

					
					
				</item>

			
				<item>
					<guid>http://cycling74.com/forums/topic/msp-external-problem/#post-82297</guid>
					<title><![CDATA[Re: msp external problem]]></title>
					<link>http://cycling74.com/forums/topic/msp-external-problem/#post-82297</link>
					<pubDate>Wed, 23 Aug 2006 11:30:56 +0000</pubDate>
					<dc:creator>Peter Castine</dc:creator>

					<description>
						<![CDATA[
						<p>Both Ben and Eric are right, but there&#8217;s more.</p>
<p>> typedef struct _amstring<br />
> {<br />
> 	t_pxobject* x_obj;<br />
recto:   t_pxobject x_obj;</p>
<p>The SDK underscores that the first member of your object must be the  <br />
whole entire t_pxobject struct, not a pointer.</p>
<p>> 	long ltestvar;<br />
> } t_amstring;<br />
><br />
> void amstring_dsp(t_amstring *x, t_signal **sp, short *count);<br />
> t_int *amstring_perform(t_int *w);<br />
> void* amstring_new(long delay, float feedback);<br />
><br />
> void main(void)<br />
> {<br />
> 	setup((t_messlist **)&#038;amstring_class, (method)amstring_new,  <br />
> (method)dsp_free,<br />
> 		(short)sizeof(t_amstring), 0L, A_DEFLONG, A_DEFFLOAT, A_NOTHING);</p>
<p>Consider yourself lucky that Max isn&#8217;t already croaking here. In your  <br />
declaration, sizeof(t_amstring) is 8, but the smallest possible Max  <br />
object must be at least 16 bytes in size.</p>
<p>> 	addmess((method)amstring_dsp, &#8220;dsp&#8221;, A_CANT, 0);<br />
> 	dsp_initclass(); // must call this function for MSP object classes<br />
> }<br />
><br />
> void amstring_dsp(t_amstring *x, t_signal **sp, short *count)<br />
> {<br />
> 	dsp_add(amstring_perform, 4, sp[0]->s_vec, sp[1]->s_vec, x, sp[0]- <br />
> >s_n);<br />
> }</p>
<p>The parameters to dsp_add() must match what you&#8217;re doing in your  <br />
perform method, which they don&#8217;t. At this stage of the game, you&#8217;re  <br />
better off to leave the dsp_add() call as is and modify your perform  <br />
method. See below.</p>
<p>><br />
> t_int *amstring_perform(t_int* w) // 4 args. in memory pointed to  <br />
> by w.<br />
> {<br />
> 	t_float *in = (t_float *)(w[1]);<br />
>    t_float *out = (t_float *)(w[2]);<br />
> 	t_amstring *x = (t_amstring *)(w[3]);<br />
> 	int n = (int)(w[4]);<br />
><br />
> 	while (&#8211;n) *++out = *++in; // copy input to output</p>
<p>recto: while (n&#8211;) *out++ = *in++;</p>
<p>Some of the SDK examples and documentation use predec and/or preinc  <br />
instead of the postfix ops, but look *very* carefully at how they  <br />
call dsp_add()! Objects that do this sort of stuff need to tweak the  <br />
dsp_add() parameters to  compensate for the fact that the main loop  <br />
is &#8220;one too few&#8221; and that the read/write vectors &#8220;start one too  <br />
early&#8221;. This is easily overlooked when reading the SDK examples.</p>
<p>Some processors can, indeed, shave a few cycles off by using predec  <br />
instead of postdec. But there are other, less error-prone ways of  <br />
doing this, such as:</p>
<p>	do { *out++ = *in++; } while (n&#8211; > 0);</p>
<p>This requires that the initial value for n be guaranteed to be  <br />
strictly positive, which is more than a reasonable presumption for  <br />
the size of an MSP signal vector.</p>
<p>In either case, I find</p>
<p>	while (n&#8211; > 0)</p>
<p>far more readable for the loop condition, and most compilers will  <br />
generate identical machine code with or without the explicit less- <br />
than-zero. But check your disassembly code if it worries you.</p>
<p>> 	return (w+5);<br />
> }<br />
><br />
> void* amstring_new(long delay_length, float feedback_gain)<br />
> {<br />
> 	t_amstring* x = (t_amstring *)newobject(amstring_class);<br />
> 	dsp_setup((t_pxobject *)x, 1);<br />
> 	outlet_new((t_pxobject *)x, &#8220;signal&#8221;);<br />
><br />
> 	x->ltestvar = 0; // external works if this line is removed</p>
<p>This is writing four bytes at offset 4 into the t_pxobject struct  <br />
that newobject() and dsp_setup() so carefully initialized. Max  <br />
finally crashes.</p>
<p>The offset at 4 bytes is actually the o_magic member of the basic  <br />
t_object struct at the heart of every Max object. The Max engine  <br />
checks this member at certain points to make sure that valid objects  <br />
are being passed around. Overwriting this value behind Max&#8217; back is a  <br />
good way to wreck havoc. As you have seen.</p>
<p>><br />
> 	return(x);<br />
> }</p>
<p>This is just a style thing, but I don&#8217;t know why people insist upon  <br />
writing return statements as if they were functions. The parentheses  <br />
are completely superfluous. They don&#8217;t actually hurt anything; so  <br />
don&#8217;t worry, just be aware that they&#8217;re superfluous.-</p>
<p>	return x;</p>
<p>
&#8211; P</p>
<p>&#8212;&#8212;&#8212;&#8212;&#8211;    <a href="http://www.bek.no/~pcastine/Litter/" rel="nofollow">http://www.bek.no/~pcastine/Litter/</a>    &#8212;&#8212;&#8212;&#8212;-<br />
Peter Castine             +&#8211;> Litter Power &#038; Litter Bundle for Jitter<br />
                                Universal Binaries on the way<br />
iCE:  Sequencing,  Recording &#038;<br />
       Interface  Building  for                   |home    | chez nous|<br />
       Max/MSP   Extremely cool                   |bei uns |  i nostri|<br />
       <a href="http://www.dspaudio.com/" rel="nofollow">http://www.dspaudio.com/</a>                   <a href="http://www.castine.de" rel="nofollow">http://www.castine.de</a></p>
						]]>
					</description>

					
					
				</item>

			
				<item>
					<guid>http://cycling74.com/forums/topic/msp-external-problem/#post-82298</guid>
					<title><![CDATA[Re: msp external problem]]></title>
					<link>http://cycling74.com/forums/topic/msp-external-problem/#post-82298</link>
					<pubDate>Sun, 27 Aug 2006 05:05:42 +0000</pubDate>
					<dc:creator>aengus</dc:creator>

					<description>
						<![CDATA[
						<p>Hi,</p>
<p>Peter, thanks for the pointing those issues out- I think I&#8217;ve<br />
addressed all of them now.</p>
<p>In fact the external seems to work exactly as I want it to except for<br />
one new problem which I don&#8217;t understand at all.  I&#8217;ve included a<br />
patcher in the email and a windows binary of the external is attached.<br />
It may not be appropriate to attach a binary like that, but it is tiny<br />
and it should not be necessary to use it to understand the issue- only<br />
to demonstrate it.</p>
<p>The patcher contains a click~ object, which sends audio along two<br />
signal chains, each of which contains an instance of my am-string~<br />
object. One chain ends at dac~ 1 and the other at dac~ 2. The only<br />
difference between the two is that the *~ 0.9 in the right hand one is<br />
connected to another *~ object as well as to an instance of the<br />
am-string~ object. This extra *~ object is not connected to anything.</p>
<p>If you click the bang, which sends a click down both signal chains,<br />
there is only output on the right hand chain. This is the one which<br />
has the extra *~ object which, by my understanding of the way max<br />
works, should not have any effect on anything.</p>
<p>Can someone please explain? (I&#8217;ll post the current source code for the<br />
object if it&#8217;d help)</p>
<p>Thanks,</p>
<p>Aengus.</p>
<p>max v2;<br />
#N vpatcher 384 172 896 638;<br />
#P origin 0 -4;<br />
#P window setfont &#8220;Sans Serif&#8221; 9.;<br />
#P newex 317 189 27 9109513 *~;<br />
#P newex 226 343 33 9109513 *~ 0.3;<br />
#P newex 173 343 33 9109513 *~ 0.3;<br />
#P newex 289 162 33 9109513 *~ 0.9;<br />
#P user meter~ 334 301 414 314 50 0 168 0 103 103 103 255 153 0 255 0<br />
0 217 217 0 153 186 0 12 3 3 3 3;<br />
#P message 393 232 28 9109513 4000;<br />
#P newex 393 211 45 9109513 loadbang;<br />
#P message 251 211 39 9109513 params;<br />
#P newex 300 252 104 9109513 am-string~ 600 165 0.8;<br />
#P user meter~ 19 301 99 314 50 0 168 0 103 103 103 255 153 0 255 0 0<br />
217 217 0 153 186 0 12 3 3 3 3;<br />
#P message 175 232 28 9109513 4000;<br />
#P newex 175 211 45 9109513 loadbang;<br />
#P newex 110 162 33 9109513 *~ 0.9;<br />
#P user meter~ 258 105 338 118 50 0 168 0 103 103 103 255 153 0 255 0<br />
0 217 217 0 153 186 0 12 3 3 3 3;<br />
#P button 206 31 33 0;<br />
#P newex 206 67 32 9109513 click~;<br />
#P message 56 211 39 9109513 params;<br />
#P newex 82 252 104 9109513 am-string~ 600 165 0.8;<br />
#P newex 186 391 44 9109513 dac~ 1 2;<br />
#P toggle 138 349 19 0;<br />
#P connect 2 0 10 0;<br />
#P connect 3 0 2 0;<br />
#P connect 7 0 2 0;<br />
#P connect 4 0 7 0;<br />
#P connect 2 0 17 0;<br />
#P connect 8 0 9 0;<br />
#P connect 9 0 2 3;<br />
#P connect 0 0 1 0;<br />
#P connect 17 0 1 0;<br />
#P connect 5 0 4 0;<br />
#P connect 18 0 1 1;<br />
#P connect 11 0 18 0;<br />
#P connect 4 0 6 0;<br />
#P connect 4 0 16 0;<br />
#P connect 16 0 11 0;<br />
#P connect 12 0 11 0;<br />
#P connect 16 0 19 0;<br />
#P connect 11 0 15 0;<br />
#P connect 13 0 14 0;<br />
#P connect 14 0 11 3;<br />
#P pop;</p>
<p>On 8/23/06, Peter Castine
<pcastine @gmx.net> wrote:<br />
> Both Ben and Eric are right, but there&#8217;s more.<br />
><br />
> > typedef struct _amstring<br />
> > {<br />
> >       t_pxobject* x_obj;<br />
> recto:   t_pxobject x_obj;<br />
><br />
> The SDK underscores that the first member of your object must be the<br />
> whole entire t_pxobject struct, not a pointer.<br />
><br />
> >       long ltestvar;<br />
> > } t_amstring;<br />
> ><br />
> > void amstring_dsp(t_amstring *x, t_signal **sp, short *count);<br />
> > t_int *amstring_perform(t_int *w);<br />
> > void* amstring_new(long delay, float feedback);<br />
> ><br />
> > void main(void)<br />
> > {<br />
> >       setup((t_messlist **)&#038;amstring_class, (method)amstring_new,<br />
> > (method)dsp_free,<br />
> >               (short)sizeof(t_amstring), 0L, A_DEFLONG, A_DEFFLOAT, A_NOTHING);<br />
><br />
> Consider yourself lucky that Max isn&#8217;t already croaking here. In your<br />
> declaration, sizeof(t_amstring) is 8, but the smallest possible Max<br />
> object must be at least 16 bytes in size.<br />
><br />
> >       addmess((method)amstring_dsp, &#8220;dsp&#8221;, A_CANT, 0);<br />
> >       dsp_initclass(); // must call this function for MSP object classes<br />
> > }<br />
> ><br />
> > void amstring_dsp(t_amstring *x, t_signal **sp, short *count)<br />
> > {<br />
> >       dsp_add(amstring_perform, 4, sp[0]->s_vec, sp[1]->s_vec, x, sp[0]-<br />
> > >s_n);<br />
> > }<br />
><br />
> The parameters to dsp_add() must match what you&#8217;re doing in your<br />
> perform method, which they don&#8217;t. At this stage of the game, you&#8217;re<br />
> better off to leave the dsp_add() call as is and modify your perform<br />
> method. See below.<br />
><br />
> ><br />
> > t_int *amstring_perform(t_int* w) // 4 args. in memory pointed to<br />
> > by w.<br />
> > {<br />
> >       t_float *in = (t_float *)(w[1]);<br />
> >    t_float *out = (t_float *)(w[2]);<br />
> >       t_amstring *x = (t_amstring *)(w[3]);<br />
> >       int n = (int)(w[4]);<br />
> ><br />
> >       while (&#8211;n) *++out = *++in; // copy input to output<br />
><br />
> recto: while (n&#8211;) *out++ = *in++;<br />
><br />
> Some of the SDK examples and documentation use predec and/or preinc<br />
> instead of the postfix ops, but look *very* carefully at how they<br />
> call dsp_add()! Objects that do this sort of stuff need to tweak the<br />
> dsp_add() parameters to  compensate for the fact that the main loop<br />
> is &#8220;one too few&#8221; and that the read/write vectors &#8220;start one too<br />
> early&#8221;. This is easily overlooked when reading the SDK examples.<br />
><br />
> Some processors can, indeed, shave a few cycles off by using predec<br />
> instead of postdec. But there are other, less error-prone ways of<br />
> doing this, such as:<br />
><br />
>         do { *out++ = *in++; } while (n&#8211; > 0);<br />
><br />
> This requires that the initial value for n be guaranteed to be<br />
> strictly positive, which is more than a reasonable presumption for<br />
> the size of an MSP signal vector.<br />
><br />
> In either case, I find<br />
><br />
>         while (n&#8211; > 0)<br />
><br />
> far more readable for the loop condition, and most compilers will<br />
> generate identical machine code with or without the explicit less-<br />
> than-zero. But check your disassembly code if it worries you.<br />
><br />
> >       return (w+5);<br />
> > }<br />
> ><br />
> > void* amstring_new(long delay_length, float feedback_gain)<br />
> > {<br />
> >       t_amstring* x = (t_amstring *)newobject(amstring_class);<br />
> >       dsp_setup((t_pxobject *)x, 1);<br />
> >       outlet_new((t_pxobject *)x, &#8220;signal&#8221;);<br />
> ><br />
> >       x->ltestvar = 0; // external works if this line is removed<br />
><br />
> This is writing four bytes at offset 4 into the t_pxobject struct<br />
> that newobject() and dsp_setup() so carefully initialized. Max<br />
> finally crashes.<br />
><br />
> The offset at 4 bytes is actually the o_magic member of the basic<br />
> t_object struct at the heart of every Max object. The Max engine<br />
> checks this member at certain points to make sure that valid objects<br />
> are being passed around. Overwriting this value behind Max&#8217; back is a<br />
> good way to wreck havoc. As you have seen.<br />
><br />
> ><br />
> >       return(x);<br />
> > }<br />
><br />
> This is just a style thing, but I don&#8217;t know why people insist upon<br />
> writing return statements as if they were functions. The parentheses<br />
> are completely superfluous. They don&#8217;t actually hurt anything; so<br />
> don&#8217;t worry, just be aware that they&#8217;re superfluous.-<br />
><br />
>         return x;<br />
><br />
><br />
> &#8212; P<br />
><br />
><br />
><br />
> &#8212;&#8212;&#8212;&#8212;&#8211;    <a href="http://www.bek.no/~pcastine/Litter/" rel="nofollow">http://www.bek.no/~pcastine/Litter/</a>    &#8212;&#8212;&#8212;&#8212;-<br />
> Peter Castine             +&#8211;> Litter Power &#038; Litter Bundle for Jitter<br />
>                                 Universal Binaries on the way<br />
> iCE:  Sequencing,  Recording &#038;<br />
>        Interface  Building  for                   |home    | chez nous|<br />
>        Max/MSP   Extremely cool                   |bei uns |  i nostri|<br />
>        <a href="http://www.dspaudio.com/" rel="nofollow">http://www.dspaudio.com/</a>                   <a href="http://www.castine.de" rel="nofollow">http://www.castine.de</a><br />
><br />
><br />
></pcastine></p>
<p>
&#8211; <br />
____________________<br />
<a href="http://www.am-process.org" rel="nofollow">http://www.am-process.org</a></p>
						]]>
					</description>

					
					
				</item>

					
		
	</channel>
	</rss>

