<?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"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Greg Surges &#187; Programming</title>
	<atom:link href="http://gregsurges.com/tag/programming/feed/" rel="self" type="application/rss+xml" />
	<link>http://gregsurges.com</link>
	<description>Composer of Electronic and Chamber Music, Freelance Programmer</description>
	<lastBuildDate>Sat, 04 Sep 2010 13:29:19 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.4</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<xhtml:meta xmlns:xhtml="http://www.w3.org/1999/xhtml" name="robots" content="noindex" />
		<item>
		<title>Write your own Pure Data External! (Part 4)</title>
		<link>http://gregsurges.com/programming/write-your-own-pure-data-external-part-4/</link>
		<comments>http://gregsurges.com/programming/write-your-own-pure-data-external-part-4/#comments</comments>
		<pubDate>Thu, 22 Oct 2009 16:35:20 +0000</pubDate>
		<dc:creator>Greg Surges</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[Pure Data]]></category>
		<category><![CDATA[Hack]]></category>
		<category><![CDATA[Tutorial]]></category>

		<guid isPermaLink="false">http://gregsurges.com/?p=317</guid>
		<description><![CDATA[In this section of the tutorial, I&#8217;m going to write about the randomwalk_new() function.

As you can see (in the code available here), the function takes three arguments. These are generic arguments, used in the *_new() function of every external you&#8217;ll write. The arguments are as follows:

t_symbol *s &#8211; a pointer to the symbolic representation of [...]]]></description>
			<content:encoded><![CDATA[<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Helvetica; min-height: 14.0px;">In this section of the tutorial, I&#8217;m going to write about the <code>randomwalk_new() </code>function.</p>

<p><p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Helvetica;">As you can see (in the code available <a href="https://pantherfile.uwm.edu:443/gssurges/GregSurges_PD_Tutorial_Files.zip">here</a>), the function takes three arguments. These are generic arguments, used in the <code>*_new()</code> function of every external you&#8217;ll write. The arguments are as follows:</p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Helvetica; min-height: 14.0px;"></p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Helvetica;"><code>t_symbol *s</code> &#8211; a pointer to the symbolic representation of the objects name. You don&#8217;t have to worry about this, it&#8217;s for PD.</p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Helvetica; min-height: 14.0px;"></p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Helvetica;"><code>int argc</code> &#8211; the number of arguments the user has entered, following the name of the object.</p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Helvetica; min-height: 14.0px;"></p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Helvetica;"><code>t_atom *argv</code> &#8211; a pointer to the first of these arguments.</p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Helvetica; min-height: 14.0px;"></p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Helvetica;">You&#8217;ll use <code>argc</code> to tell you how many arguments to read, starting from the <code>argv</code> pointer. This allows you to create an object that uses default values if a user doesn&#8217;t enter all of the required arguments.</p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Helvetica; min-height: 14.0px;"></p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Helvetica;">In <code>randomwalk.c</code>, I&#8217;m using a <code>switch</code> statement to check the number of arguments provided, and then read the user-provided arguments into their proper variables. The <code>atom_getfloat()</code> function simply takes one of the arguments (of the PD type <code>atom</code>) and returns a C/C++ float, which can be assigned to a variable.</p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Helvetica; min-height: 14.0px;"></p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Helvetica;">Below that, I reuse the <code>argc</code> count to determine which variables have to be assigned to defaults. Finally, I do some error checking to make sure that the highbound is actually a higher number than the lowbound, and swap if needed. This kind of error checking is very important to avoid crashes when actually using the object.</p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Helvetica; min-height: 14.0px;"></p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Helvetica;">Finally, we have to assign inlets and outlets. The three calls to<code> floatinlet_new()</code> assign inlets which allow direct assignment of the lower, upper, and step variables from PD. There should probably be some error checking here too, because what would happen if a user input a list or a symbol instead? We also define<code> f_out</code> to be an outlet, using <code>outlet_new()</code> which takes two arguments, a reference to the object itself, and the type of value that will be output.</p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Helvetica; min-height: 14.0px;"></p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Helvetica;">The return statement simply returns the initialized object to PD, ready for use.</p></p>
]]></content:encoded>
			<wfw:commentRss>http://gregsurges.com/programming/write-your-own-pure-data-external-part-4/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>New Gig.</title>
		<link>http://gregsurges.com/programming/new-gig/</link>
		<comments>http://gregsurges.com/programming/new-gig/#comments</comments>
		<pubDate>Sat, 17 Oct 2009 01:32:17 +0000</pubDate>
		<dc:creator>Greg Surges</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[Arduino]]></category>
		<category><![CDATA[Installation]]></category>
		<category><![CDATA[Max/MSP/Jitter]]></category>
		<category><![CDATA[Sensors]]></category>
		<category><![CDATA[Video Art]]></category>
		<category><![CDATA[Work]]></category>

		<guid isPermaLink="false">http://gregsurges.com/?p=314</guid>
		<description><![CDATA[So, I&#8217;ve got a new job. I&#8217;m working as a programmer for Bruce Charlesworth, a video/installation artist who teaches in the Peck School of the Arts. You can check out his page here &#8211; the current project is going to be a multi-room installation, involving break-beam tracking of audience members, and interactive visuals/audio.

Most of the [...]]]></description>
			<content:encoded><![CDATA[<p>So, I&#8217;ve got a new job. I&#8217;m working as a programmer for Bruce Charlesworth, a video/installation artist who teaches in the Peck School of the Arts. You can check out his page <a href="http://www.brucecharlesworth.net/">here</a> &#8211; the current project is going to be a multi-room installation, involving break-beam tracking of audience members, and interactive visuals/audio.</p>

<p>Most of the code base I&#8217;m working with is Java-based, with Max/MSP/Jitter serving as glue between an Arduino, Java, and the projector. It&#8217;s a good opportunity to use the Arduino, something I&#8217;ve been excited about for a while now.</p>

<p>So, you can see why I haven&#8217;t been posting as much lately&#8230; quite busy. I will continue to post on this as it develops, over the year.</p>
]]></content:encoded>
			<wfw:commentRss>http://gregsurges.com/programming/new-gig/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
	</channel>
</rss>
