<?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: Getting matrix type</title>
		<atom:link href="http://cycling74.com/forums/topic/getting-matrix-type/feed" rel="self" type="application/rss+xml" />
		<link>http://cycling74.com/forums/topic/getting-matrix-type/feed</link>
		<description></description>
		<pubDate>Thu, 20 Jun 2013 03:04:08 +0000</pubDate>
		<generator>http://bbpress.org/?v=2.2.4</generator>
		<language></language>

		
														
					
				<item>
					<guid>http://cycling74.com/forums/topic/getting-matrix-type/#post-26460</guid>
					<title><![CDATA[Getting matrix type]]></title>
					<link>http://cycling74.com/forums/topic/getting-matrix-type/#post-26460</link>
					<pubDate>Sat, 17 Jun 2006 19:28:16 +0000</pubDate>
					<dc:creator>Peter Castine</dc:creator>

					<description>
						<![CDATA[
						<p>This is probably for Jeremy or Joshua.</p>
<p>I have an object that wants to query its type as part of a custom  <br />
attribute set method. I have tried to find sample code doing this in  <br />
the SDK projects without success.</p>
<p>Here&#8217;s what I want to do in pseudo-code, starting with a stripped  <br />
down Jitter initialization function:</p>
<p>===================<br />
t_jit_err InitializeJitterObject(void)<br />
   {<br />
   jit_class_new(&#8230;);<br />
   jit_object_new(&#8230;);<br />
   jit_class_addadomrnment(&#8230;);<br />
   jit_class_addmethod(&#8230;);     // repeat for all methods</p>
<p>   // AddAttributes  &#8212; This is the interesting part<br />
   attr = jit_object_new(_jit_sym_jit_attr_offset_array,<br />
                         &#8220;loc&#8221;, _jit_sym_float64,<br />
                         JIT_MATRIX_MAX_PLANECOUNT, kAttrRWFlags,<br />
                         (method) NIL,<br />
                         (method) ExpoSetLoc,           // SEE BELOW<br />
                         calcoffset(jcobExpo, planeCount),<br />
                         calcoffset(jcobExpo, loc)<br />
                         );</p>
<p>   // Finish off<br />
   jit_class_register(gExpoJitClass);<br />
   return JIT_ERR_NONE;<br />
   }</p>
<p>&#8230;</p>
<p>static void ExpoSetLoc(<br />
   objExpo*   me,	// This is the Jitter object<br />
   void*      attr,	// Unused<br />
   long       iArgC,<br />
   Atom       iArgVec[])</p>
<p>   {<br />
   Symbol typeSym = GetObjectType(me);  // HOW DO I DO THIS??</p>
<p>   if (typeSym == _jit_sym_char) {<br />
     // Clip input values in iArgVec to 0 .. 256 and store<br />
     }<br />
   else if (typeSym == _jit_sym_long) {<br />
     // Clip input values to kLongMin .. kLongMax and store<br />
     // A little anal retentive, but just to be safe<br />
     }<br />
   // otherwise just store without clipping</p>
<p>   }</p>
<p>===================</p>
<p>Is this reasonable to want to do? If so, how?</p>
<p>It seems likely that the pseudo-function GetObjectType() will do  <br />
something like</p>
<p>   jit_object_method(me, _jit_sym_gettype, &#8230;);</p>
<p>but I can&#8217;t find an example of how this would work.</p>
<p>Thanks,<br />
Peter</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</p>
<p>iCE:  Sequencing,  Recording &#038;                   |home    | chez nous|<br />
       Interface  Building  for                   |bei uns |  i nostri|<br />
       Max/MSP   Extremely cool                   <a href="http://www.castine.de" rel="nofollow">http://www.castine.de</a></p>
<p><a href="http://www.dspaudio.com/" rel="nofollow">http://www.dspaudio.com/</a></p>
						]]>
					</description>

					
					
				</item>

			
				<item>
					<guid>http://cycling74.com/forums/topic/getting-matrix-type/#post-79120</guid>
					<title><![CDATA[Re: Getting matrix type]]></title>
					<link>http://cycling74.com/forums/topic/getting-matrix-type/#post-79120</link>
					<pubDate>Sat, 17 Jun 2006 19:47:52 +0000</pubDate>
					<dc:creator>Wesley Smith</dc:creator>

					<description>
						<![CDATA[
						<p>What do you mean by type?  Do you mean like if the object is say<br />
jit.wake that the type will be &#8220;jit_wake&#8221;?  If this is the case, you<br />
just need the function</p>
<p>t_symbol *jit_object_classname(void *x);</p>
<p>Hopefully this helps you out.  Otherwise, I need some clarification.<br />
best,<br />
wes</p>
						]]>
					</description>

					
					
				</item>

			
				<item>
					<guid>http://cycling74.com/forums/topic/getting-matrix-type/#post-79121</guid>
					<title><![CDATA[Re: Getting matrix type]]></title>
					<link>http://cycling74.com/forums/topic/getting-matrix-type/#post-79121</link>
					<pubDate>Sat, 17 Jun 2006 19:53:24 +0000</pubDate>
					<dc:creator>Joshua Kit Clayton</dc:creator>

					<description>
						<![CDATA[
						<p>
On Jun 17, 2006, at 12:28 PM, Peter Castine wrote:</p>
<p>> This is probably for Jeremy or Joshua.<br />
><br />
>   jit_object_method(me, _jit_sym_gettype, &#8230;);</p>
<p>t_symbol *mytype = jit_attr_getsym(me,_jit_sym_type);</p>
<p>Or if you really prefer, here&#8217;s how you would accomplish with  <br />
jit_object_method:</p>
<p>t_atom *av=NULL;<br />
long ac=0;<br />
t_symbol *mytype;</p>
<p>jit_object_method(me,_jit_sym_gettype,&#038;ac,&#038;av);</p>
<p>if (ac&#038;&#038;av) {<br />
	mytype = jit_atom_getsymbol(av);<br />
	jit_freebytes(av);<br />
}</p>
<p>Lastly, we typically look at this with matrices using the standard  <br />
getinfo with the matrixinfo struct.</p>
<p>-Joshua</p>
						]]>
					</description>

					
					
				</item>

			
				<item>
					<guid>http://cycling74.com/forums/topic/getting-matrix-type/#post-79122</guid>
					<title><![CDATA[Re: Getting matrix type]]></title>
					<link>http://cycling74.com/forums/topic/getting-matrix-type/#post-79122</link>
					<pubDate>Sun, 18 Jun 2006 05:56:30 +0000</pubDate>
					<dc:creator>Peter Castine</dc:creator>

					<description>
						<![CDATA[
						<p>On 17-Jun-2006, at 21:53, Joshua Kit Clayton wrote:<br />
> t_symbol *mytype = jit_attr_getsym(me,_jit_sym_type);</p>
<p>That&#8217;s pretty easy. Thanks.</p>
<p>> Or if you really prefer, here&#8217;s how you would accomplish with  <br />
> jit_object_method:<br />
[schnipp]</p>
<p>Useful to know.</p>
<p>> Lastly, we typically look at this with matrices using the standard  <br />
> getinfo with the matrixinfo struct.</p>
<p>You mean a t_jit_matrix_info? That&#8217;s the way I do it in my  <br />
matrix_calc method. But I&#8217;m not sure how to get a pointer to a  <br />
t_jit_matrix_info in the situation I was describing, namely inside a  <br />
custom set-attribute method.</p>
<p>It might actually be better to clip the attribute values inside the  <br />
matrix_calc method anyway. I&#8217;m not sure.</p>
<p>&#8211;</p>
<p>Thanks also to Wes. The issue is whether my Jitter object is dealing  <br />
with a char/long/float32/float64 matrix (ie &#8220;type&#8221; as in the  <br />
attribute &#8220;type&#8221; that shows up in the &#8220;messages for <object>&#8221; popup  <br />
menu). Sorry if there was confusion.</object></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</p>
<p>iCE:  Sequencing,  Recording &#038;                   |home    | chez nous|<br />
       Interface  Building  for                   |bei uns |  i nostri|<br />
       Max/MSP   Extremely cool                   <a href="http://www.castine.de" rel="nofollow">http://www.castine.de</a></p>
<p><a href="http://www.dspaudio.com/" rel="nofollow">http://www.dspaudio.com/</a></p>
						]]>
					</description>

					
					
				</item>

			
				<item>
					<guid>http://cycling74.com/forums/topic/getting-matrix-type/#post-79123</guid>
					<title><![CDATA[Re: Getting matrix type]]></title>
					<link>http://cycling74.com/forums/topic/getting-matrix-type/#post-79123</link>
					<pubDate>Sun, 18 Jun 2006 06:40:05 +0000</pubDate>
					<dc:creator>jeremy</dc:creator>

					<description>
						<![CDATA[
						<p>I think so, since if your object is adapting, the output matrix type  <br />
could change with each inoming matrix.</p>
<p>Here&#8217;s some untested code for getting the type on the fly from an  <br />
arbitrary point in your code, given the Jitter object pointer.</p>
<p>void *mop = jit_class_adornment_get(_myobject_class, _jit_sym_jit_mop);<br />
void *o = jit_object_method(mop, _jit_sym_getoutput, 1);<br />
void *m = jit_object_method(o, _jit_sym_getmatrix);<br />
t_jit_matrix_info info;</p>
<p>jit_object_method(m, _jit_sym_getinfo, &#038;info);<br />
t_symbol *type = info.type;</p>
<p>Am 18.06.2006 um 07:56 schrieb Peter Castine:</p>
<p>> It might actually be better to clip the attribute values inside the  <br />
> matrix_calc method anyway. I&#8217;m not sure.</p>
						]]>
					</description>

					
					
				</item>

			
				<item>
					<guid>http://cycling74.com/forums/topic/getting-matrix-type/#post-79124</guid>
					<title><![CDATA[Re: Getting matrix type]]></title>
					<link>http://cycling74.com/forums/topic/getting-matrix-type/#post-79124</link>
					<pubDate>Sun, 18 Jun 2006 06:57:28 +0000</pubDate>
					<dc:creator>Peter Castine</dc:creator>

					<description>
						<![CDATA[
						<p>On 18-Jun-2006, at 8:40, Jeremy Bernstein wrote about when to check  <br />
matrix type:<br />
> I think so, since if your object is adapting, the output matrix  <br />
> type could change with each inoming matrix.</p>
<p>That was what was concerning me, although I wasn&#8217;t able to formulate  <br />
the concern succinctly last night. I was trying to shave a  <br />
performance improvement by clipping at set-attribute time (happens  <br />
typically less often than process-matrix time), but that&#8217;s a false  <br />
economy.</p>
<p>> Here&#8217;s some untested code for getting the type on the fly from an  <br />
> arbitrary point in your code, given the Jitter object pointer.</p>
<p>The snippet gets filed under &#8220;Very Good to Know&#8221;. Cool, vielen Dank!</p>
<p>&#8211; P.</p>
<p>PS: You&#8217;re up and about early on a Sunday morning!</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</p>
<p>iCE:  Sequencing,  Recording &#038;                   |home    | chez nous|<br />
       Interface  Building  for                   |bei uns |  i nostri|<br />
       Max/MSP   Extremely cool                   <a href="http://www.castine.de" rel="nofollow">http://www.castine.de</a></p>
<p><a href="http://www.dspaudio.com/" rel="nofollow">http://www.dspaudio.com/</a></p>
						]]>
					</description>

					
					
				</item>

					
		
	</channel>
	</rss>

