<?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: obex and DSP objects &#8211; is it possible?</title>
		<atom:link href="http://cycling74.com/forums/topic/obex-and-dsp-objects-is-it-possible/feed" rel="self" type="application/rss+xml" />
		<link>http://cycling74.com/forums/topic/obex-and-dsp-objects-is-it-possible/feed</link>
		<description></description>
		<pubDate>Wed, 19 Jun 2013 17:01:05 +0000</pubDate>
		<generator>http://bbpress.org/?v=2.2.4</generator>
		<language></language>

		
														
					
				<item>
					<guid>http://cycling74.com/forums/topic/obex-and-dsp-objects-is-it-possible/#post-26575</guid>
					<title><![CDATA[obex and DSP objects &#8211; is it possible?]]></title>
					<link>http://cycling74.com/forums/topic/obex-and-dsp-objects-is-it-possible/#post-26575</link>
					<pubDate>Mon, 26 Jun 2006 23:35:14 +0000</pubDate>
					<dc:creator>Olaf Matthes</dc:creator>

					<description>
						<![CDATA[
						<p></p>
						]]>
					</description>

					
					
				</item>

			
				<item>
					<guid>http://cycling74.com/forums/topic/obex-and-dsp-objects-is-it-possible/#post-79690</guid>
					<title><![CDATA[Re: obex and DSP objects &#8211; is it possible?]]></title>
					<link>http://cycling74.com/forums/topic/obex-and-dsp-objects-is-it-possible/#post-79690</link>
					<pubDate>Tue, 27 Jun 2006 04:38:19 +0000</pubDate>
					<dc:creator>Jeremy Bernstein</dc:creator>

					<description>
						<![CDATA[
						<p></p>
						]]>
					</description>

					
					
				</item>

			
				<item>
					<guid>http://cycling74.com/forums/topic/obex-and-dsp-objects-is-it-possible/#post-79691</guid>
					<title><![CDATA[Re: obex and DSP objects &#8211; is it possible?]]></title>
					<link>http://cycling74.com/forums/topic/obex-and-dsp-objects-is-it-possible/#post-79691</link>
					<pubDate>Tue, 27 Jun 2006 09:46:41 +0000</pubDate>
					<dc:creator>Olaf Matthes</dc:creator>

					<description>
						<![CDATA[
						<p>Jeremy Bernstein wrote:<br />
> Olaf,<br />
> <br />
> Happy to look at this, but I need source code. I have successfully  <br />
> obex-ified MSP objects, though, so I know it&#8217;s possible.</p>
<p>Hi Jeremy,</p>
<p>example code is attached (I hope attachmewnt will get through). It&#8217;s <br />
basically the myregob example code extended in order to be a DSP object. <br />
While hacking this together I noticed that in case I create one signal <br />
inlet, my object shows up with 1 inlet and I can&#8217;t connect a signal to it.<br />
In case I create the object to have 2 signal inlets, it has two inlets, <br />
I stil can&#8217;t connect a signal to the first, but I can connect a signal <br />
to the second inlet&#8230;</p>
<p>The crashes when I set up the signal inlet too early in the <br />
mydspob_new() don&#8217;t happen with this code, so something else must be <br />
wrong with my orignal code.</p>
<p>Olaf</p>
<p>/* <br />
	mydspob<br />
	Copyright 2004 &#8211; Cycling &#8217;74<br />
	jeremy bernstein &#8211; <a href="mailto:jeremy@bootsquad.com">jeremy@bootsquad.com</a>	</p>
<p>    Modified into DSP object by Olaf Matthes<br />
	in order to demonstrate inability to connect<br />
	a signal cord to the object&#8217;s signal inlet.<br />
*/</p>
<p>#include &#8220;ext.h&#8221;<br />
#include &#8220;ext_common.h&#8221;<br />
#include &#8220;ext_obex.h&#8221;<br />
#include &#8220;z_dsp.h&#8221;</p>
<p>typedef struct _mydspob <br />
{<br />
	t_pxobject					ob;<br />
	void						*obex;<br />
	void						*mmo;	// minimetro objects<br />
	void						*out[4]; //	4 outlets<br />
	long						count;<br />
	long						inlet_no;<br />
} t_mydspob;</p>
<p>void mydspob_dsp(t_mydspob *x, t_mydspob **sp);<br />
void *mydspob_new(t_symbol *s, long argc, t_atom *argv);<br />
void mydspob_free(t_mydspob *x);<br />
void mydspob_assist(t_mydspob *x, void *b, long m, long a, char *s);<br />
void mydspob_notify(t_mydspob *x, t_symbol *s, t_symbol *msg, void *sender, void *data);</p>
<p>void mydspob_int(t_mydspob *x, long c);<br />
void mydspob_speed(t_mydspob *x, double speed);<br />
// pattr support function prototypes<br />
t_max_err mydspob_getvalueof(t_mydspob *x, long *ac, t_atom **av);<br />
t_max_err mydspob_setvalueof(t_mydspob *x, long ac, t_atom *av);</p>
<p>void minimetro_init(void);</p>
<p>void *mydspob_class;</p>
<p>void main(void)<br />
{	<br />
	t_class	*c;<br />
	void	*attr;<br />
	long	attrflags = 0;</p>
<p>	c = class_new(&#8220;mydspob&#8221;, (method)mydspob_new, (method)mydspob_free, (short)sizeof(t_mydspob), <br />
		0L, A_GIMME, 0);</p>
<p>	// initialize the common symbols, since we want to use them<br />
	common_symbols_init();<br />
	dsp_initclass();	// we are a DSP object</p>
<p>	// initialize the minimetro class<br />
	minimetro_init();</p>
<p>	// register the byte offset of obex with the class<br />
	class_obexoffset_set(c, calcoffset(t_mydspob, obex));</p>
<p>	// add some attributes</p>
<p>	// add method for signals<br />
	class_addmethod(c, (method)mydspob_dsp, 	&#8220;dsp&#8221;,		A_CANT, 0);</p>
<p>	// add methods to the class<br />
	class_addmethod(c, (method)mydspob_int, 	&#8220;int&#8221;,	 	A_LONG,0);  <br />
	class_addmethod(c, (method)mydspob_speed, 	&#8220;speed&#8221;, 	A_FLOAT,0);  <br />
	class_addmethod(c, (method)mydspob_assist, 	&#8220;assist&#8221;,	A_CANT,0);  </p>
<p>	// these methods support the pattr set of objects<br />
	class_addmethod(c, (method)mydspob_getvalueof, 		&#8220;getvalueof&#8221;, 	A_CANT,0);  <br />
	class_addmethod(c, (method)mydspob_setvalueof, 		&#8220;setvalueof&#8221;, 	A_CANT,0);</p>
<p>	// add a notify method, so we get notifications from child objects<br />
	class_addmethod(c, (method)mydspob_notify,			&#8220;notify&#8221;,		A_CANT, 0); <br />
	// add methods for dumpout and quickref	<br />
	class_addmethod(c, (method)object_obex_dumpout,		&#8220;dumpout&#8221;,		A_CANT, 0); <br />
	class_addmethod(c, (method)object_obex_quickref,	&#8220;quickref&#8221;,		A_CANT, 0);</p>
<p>	// we want this class to instantiate inside of the Max UI; ergo CLASS_BOX<br />
	class_register(CLASS_BOX, c);<br />
	mydspob_class = c;<br />
}</p>
<p>t_max_err mydspob_getvalueof(t_mydspob *x, long *ac, t_atom **av)<br />
{<br />
	// not implemented<br />
	return MAX_ERR_NONE;<br />
}</p>
<p>t_max_err mydspob_setvalueof(t_mydspob *x, long ac, t_atom *av)<br />
{<br />
	// not implemented<br />
	return MAX_ERR_NONE;<br />
}</p>
<p>void mydspob_assist(t_mydspob *x, void *b, long m, long a, char *s)<br />
{<br />
	if (m == 1) { //input<br />
		sprintf(s, &#8220;0 / 1, speed&#8221;);<br />
	} <br />
	else {	//output<br />
		if (a == x->count)<br />
			sprintf(s, &#8220;dumpout&#8221;); <br />
		else<br />
			sprintf(s, &#8220;bang out&#8221;);<br />
	}<br />
}</p>
<p>void mydspob_int(t_mydspob *x, long c)<br />
{<br />
}</p>
<p>void mydspob_speed(t_mydspob *x, double speed)<br />
{<br />
}</p>
<p>void mydspob_notify(t_mydspob *x, t_symbol *s, t_symbol *msg, void *sender, void *data)<br />
{<br />
	if (msg == _sym_bang) {<br />
		// bang the outlet sent as data<br />
		// outlet_bang(x->out[(long)data]);<br />
	}<br />
	else if (msg == _sym_free) { // this message is sent when the object is freeing<br />
		object_detach(gensym(&#8220;_regob_test&#8221;), s, x);<br />
		object_unregister(sender); <br />
	}<br />
}</p>
<p>void mydspob_dsp(t_mydspob *x, t_mydspob **sp)<br />
{<br />
	;	// just a fake for now<br />
}</p>
<p>void mydspob_free(t_mydspob *x)<br />
{<br />
 	dsp_free((t_pxobject *)x);</p>
<p>	if (x->mmo)<br />
		object_free(x->mmo);<br />
}</p>
<p>void *mydspob_new(t_symbol *s, long ac, t_atom *av)<br />
{<br />
	t_mydspob *x;<br />
	t_symbol *name;<br />
	long i;</p>
<p>	// we use object_alloc here, rather than newobject<br />
	if (x = (t_mydspob *)object_alloc(mydspob_class)) { //only max object, no jit object<br />
		// add a dumpout outlet<br />
		object_obex_store(x, _sym_dumpout, outlet_new(x, NULL));</p>
<p>		/* register us with the DSP chain */<br />
		dsp_setup((t_pxobject *)x, 1);	/* 1 signal input */</p>
<p>		/* create outlets (right to left) */<br />
		x->out[3] = floatout((t_object *)x);<br />
		x->out[2] = floatout((t_object *)x);<br />
		x->out[1] = bangout((t_object *)x);<br />
		x->out[0] = floatout((t_object *)x);</p>
<p>		x->count = 1;</p>
<p>		x->mmo = object_new(CLASS_NOBOX, gensym(&#8220;minimetro&#8221;), 0, 10);<br />
		object_register(gensym(&#8220;_regob_test&#8221;), name = symbol_unique(), x->mmo);<br />
		object_attach(gensym(&#8220;_regob_test&#8221;), name, x);</p>
<p>		attr_args_process(x, ac, av);<br />
	}<br />
	return (x);<br />
}</p>
						]]>
					</description>

					
					
				</item>

			
				<item>
					<guid>http://cycling74.com/forums/topic/obex-and-dsp-objects-is-it-possible/#post-79692</guid>
					<title><![CDATA[Re: obex and DSP objects &#8211; is it possible?]]></title>
					<link>http://cycling74.com/forums/topic/obex-and-dsp-objects-is-it-possible/#post-79692</link>
					<pubDate>Tue, 27 Jun 2006 09:57:39 +0000</pubDate>
					<dc:creator>Jeremy Bernstein</dc:creator>

					<description>
						<![CDATA[
						<p>Try the following in main() &#8211; I think it&#8217;s just the one thing: you  <br />
need class_dspinit() instead of dsp_initclass()</p>
<p>jb</p>
<p>void main(void)<br />
{	<br />
	t_class	*c;<br />
	void	*attr;<br />
	long	attrflags = 0;</p>
<p>	c = class_new(&#8220;mydspob&#8221;, (method)mydspob_new, (method)mydspob_free,  <br />
(short)sizeof(t_mydspob),<br />
		0L, A_GIMME, 0);</p>
<p>	// initialize the common symbols, since we want to use them<br />
	common_symbols_init();<br />
// NO! THIS IS FOR NORMAL MAX CLASSES &#8211; see below<br />
//	dsp_initclass();	// we are a DSP object</p>
<p>	// initialize the minimetro class<br />
	minimetro_init();</p>
<p>	// register the byte offset of obex with the class<br />
	class_obexoffset_set(c, calcoffset(t_mydspob, obex));</p>
<p>	// add some attributes</p>
<p>	// add method for signals<br />
	class_addmethod(c, (method)mydspob_dsp, 	&#8220;dsp&#8221;,		A_CANT, 0);</p>
<p>	// add methods to the class<br />
	class_addmethod(c, (method)mydspob_int, 	&#8220;int&#8221;,	 	A_LONG,0);<br />
	class_addmethod(c, (method)mydspob_speed, 	&#8220;speed&#8221;, 	A_FLOAT,0);<br />
	class_addmethod(c, (method)mydspob_assist, 	&#8220;assist&#8221;,	A_CANT,0);</p>
<p>	// these methods support the pattr set of objects<br />
	class_addmethod(c, (method)mydspob_getvalueof, 		&#8220;getvalueof&#8221;, 	 <br />
A_CANT,0);<br />
	class_addmethod(c, (method)mydspob_setvalueof, 		&#8220;setvalueof&#8221;, 	 <br />
A_CANT,0);</p>
<p>	// add a notify method, so we get notifications from child objects<br />
	class_addmethod(c, (method)mydspob_notify,			&#8220;notify&#8221;,		A_CANT, 0);<br />
	// add methods for dumpout and quickref	<br />
	class_addmethod(c, (method)object_obex_dumpout,		&#8220;dumpout&#8221;,		A_CANT,  <br />
0);<br />
	class_addmethod(c, (method)object_obex_quickref,	&#8220;quickref&#8221;,		 <br />
A_CANT, 0);</p>
<p>	// THIS IS THE OBEX CALL FOR DSPINIT<br />
	class_dspinit(c);<br />
	// we want this class to instantiate inside of the Max UI; ergo  <br />
CLASS_BOX<br />
	class_register(CLASS_BOX, c);<br />
	mydspob_class = c;<br />
}</p>
<p>
Am 27.06.2006 um 11:46 schrieb Olaf Matthes:</p>
<p>> void main(void)<br />
> {	<br />
> 	t_class	*c;<br />
> 	void	*attr;<br />
> 	long	attrflags = 0;<br />
> 	<br />
> 	c = class_new(&#8220;mydspob&#8221;, (method)mydspob_new, (method) <br />
> mydspob_free, (short)sizeof(t_mydspob),<br />
> 		0L, A_GIMME, 0);<br />
> 	<br />
> 	// initialize the common symbols, since we want to use them<br />
> 	common_symbols_init();<br />
> 	dsp_initclass();	// we are a DSP object<br />
><br />
> 	// initialize the minimetro class<br />
> 	minimetro_init();<br />
> 	<br />
> 	// register the byte offset of obex with the class<br />
> 	class_obexoffset_set(c, calcoffset(t_mydspob, obex));<br />
> 	<br />
> 	// add some attributes<br />
> 	<br />
> 	// add method for signals<br />
> 	class_addmethod(c, (method)mydspob_dsp, 	&#8220;dsp&#8221;,		A_CANT, 0);<br />
><br />
> 	// add methods to the class<br />
> 	class_addmethod(c, (method)mydspob_int, 	&#8220;int&#8221;,	 	A_LONG,0);<br />
> 	class_addmethod(c, (method)mydspob_speed, 	&#8220;speed&#8221;, 	A_FLOAT,0);<br />
> 	class_addmethod(c, (method)mydspob_assist, 	&#8220;assist&#8221;,	A_CANT,0);<br />
><br />
> 	// these methods support the pattr set of objects<br />
> 	class_addmethod(c, (method)mydspob_getvalueof, 		&#8220;getvalueof&#8221;, 	 <br />
> A_CANT,0);<br />
> 	class_addmethod(c, (method)mydspob_setvalueof, 		&#8220;setvalueof&#8221;, 	 <br />
> A_CANT,0);<br />
><br />
> 	// add a notify method, so we get notifications from child objects<br />
> 	class_addmethod(c, (method)mydspob_notify,			&#8220;notify&#8221;,		A_CANT, 0);<br />
> 	// add methods for dumpout and quickref	<br />
> 	class_addmethod(c, (method)object_obex_dumpout,		&#8220;dumpout&#8221;,		 <br />
> A_CANT, 0);<br />
> 	class_addmethod(c, (method)object_obex_quickref,	&#8220;quickref&#8221;,		 <br />
> A_CANT, 0);<br />
><br />
> 	// we want this class to instantiate inside of the Max UI; ergo  <br />
> CLASS_BOX<br />
> 	class_register(CLASS_BOX, c);<br />
> 	mydspob_class = c;</p>
						]]>
					</description>

					
					
				</item>

			
				<item>
					<guid>http://cycling74.com/forums/topic/obex-and-dsp-objects-is-it-possible/#post-79693</guid>
					<title><![CDATA[Re: obex and DSP objects &#8211; is it possible?]]></title>
					<link>http://cycling74.com/forums/topic/obex-and-dsp-objects-is-it-possible/#post-79693</link>
					<pubDate>Tue, 27 Jun 2006 10:07:09 +0000</pubDate>
					<dc:creator>Olaf Matthes</dc:creator>

					<description>
						<![CDATA[
						<p>Jeremy Bernstein wrote:</p>
<p>> Try the following in main() &#8211; I think it&#8217;s just the one thing: you  need <br />
> class_dspinit() instead of dsp_initclass()</p>
<p>Thanks, that did the trick! :-)</p>
<p>Olaf</p>
						]]>
					</description>

					
					
				</item>

					
		
	</channel>
	</rss>

