<?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>code.compartmental</title>
	<atom:link href="http://code.compartmental.net/feed/" rel="self" type="application/rss+xml" />
	<link>http://code.compartmental.net</link>
	<description></description>
	<lastBuildDate>Sun, 18 Nov 2012 13:23:22 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.5.1</generator>
		<item>
		<title>Portraying The Terran Condition: An Approach To Simulate A Civilization</title>
		<link>http://code.compartmental.net/2012/11/18/portraying-the-terran-condition-an-approach-to-simulate-a-civilization/</link>
		<comments>http://code.compartmental.net/2012/11/18/portraying-the-terran-condition-an-approach-to-simulate-a-civilization/#comments</comments>
		<pubDate>Sun, 18 Nov 2012 13:23:22 +0000</pubDate>
		<dc:creator>ddf</dc:creator>
				<category><![CDATA[Releases]]></category>
		<category><![CDATA[Unity3D]]></category>
		<category><![CDATA[Video Games]]></category>

		<guid isPermaLink="false">http://code.compartmental.net/?p=696</guid>
		<description><![CDATA[I am currently the artist-in-residence for monochrom at the Museumsquartier in Vienna, Austria. Gotta say, hanging out in an old European city thinking about art is pretty sweet. As part of the residency, I decided to participate in Fuck This &#8230; <a href="http://code.compartmental.net/2012/11/18/portraying-the-terran-condition-an-approach-to-simulate-a-civilization/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
				<content:encoded><![CDATA[<p>I am currently the artist-in-residence for <a href="http://monochrom.at/english" target=_new>monochrom</a> at the Museumsquartier in Vienna, Austria. Gotta say, hanging out in an old European city thinking about art is pretty sweet. As part of the residency, I decided to participate in <a href="http://fuckthisjam.com" target=_new>Fuck This Jam</a>, which is a week-long game jam with the theme of &#8220;making a game in a genre you hate.&#8221; So, in collaboration with <a href="http://en.wikipedia.org/wiki/Johannes_Grenzfurthner" target=_new>Johannes Grenzfurthner</a> from monochrom, I created a First Person Research Shooter called Portraying The Terran Condition: An Approach To Simulate A Civilization.</p>
<p><a href="http://code.compartmental.net/wp-content/uploads/2010/09/Screen-Shot-2012-11-15-at-3.13.02-AM.png" target=_new><img src="http://code.compartmental.net/wp-content/uploads/2010/09/Screen-Shot-2012-11-15-at-3.13.02-AM-1024x576.png" alt="" title="The Plaza in Portraying The Terran Condition." width="584" height="328" class="aligncenter size-large wp-image-694" /></a></p>
<p>Portraying The Terran Condition is a 7D (backwards compatible to 2D) world simulation which depicts six different key events in the history of Terra (&#8220;Earth&#8221;), a low-tech civilization that self-destructed several aeons ago. Based on the relatively few biological and cultural artifacts, a team of multi-AI minds was able to recreate a stunningly accurate depiction of this ancient civilization.</p>
<p>The game is available for <a href="http://code.compartmental.net/pttc/PortrayingTheTerranCondition_Win.zip">Windows</a> and <a href="http://code.compartmental.net/pttc/PortrayingTheTerranCondition_Mac.zip">Mac</a>.</p>
<p>Additional thanks are due to <a href="http://klobit.com" target=_new>Eric Wenske</a>, my teammate from <a href="http://www.facebook.com/CosmicDjGame" target=_new>Cosmic DJ</a>, who made a couple models, and to <a href="http://rapport.moboid.com" target=_new>Heather Kelley</a>, fellow <a href="http://kokoromi.org" target=_new>Kokoromi</a> member, whose wise words led me to do procedural level generation for the game. So, I guess it&#8217;s also a rogue-like!</p>
]]></content:encoded>
			<wfw:commentRss>http://code.compartmental.net/2012/11/18/portraying-the-terran-condition-an-approach-to-simulate-a-civilization/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Controlling a Meeblip from Reaper with a JS effect</title>
		<link>http://code.compartmental.net/2012/09/02/controlling-a-meeblip-from-reaper-with-a-js-effect/</link>
		<comments>http://code.compartmental.net/2012/09/02/controlling-a-meeblip-from-reaper-with-a-js-effect/#comments</comments>
		<pubDate>Mon, 03 Sep 2012 01:55:06 +0000</pubDate>
		<dc:creator>ddf</dc:creator>
				<category><![CDATA[Releases]]></category>
		<category><![CDATA[automation]]></category>
		<category><![CDATA[js]]></category>
		<category><![CDATA[meeblip]]></category>
		<category><![CDATA[MIDI]]></category>
		<category><![CDATA[reaper]]></category>

		<guid isPermaLink="false">http://code.compartmental.net/?p=676</guid>
		<description><![CDATA[I recently purchased a Meeblip because I wanted a project to work on with my maker friends that I get together with every week. I decided to buy the full build-it-yourself kit, which meant I was in for a fair &#8230; <a href="http://code.compartmental.net/2012/09/02/controlling-a-meeblip-from-reaper-with-a-js-effect/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
				<content:encoded><![CDATA[<p><a href="http://code.compartmental.net/wp-content/uploads/2012/09/photo-3.jpg"><img src="http://code.compartmental.net/wp-content/uploads/2012/09/photo-3-300x300.jpg" alt="" title="Meeblip!" width="300" height="300" class="aligncenter size-medium wp-image-677" /></a></p>
<p>I recently purchased a <a href="http://meeblip.com/">Meeblip</a> because I wanted a project to work on with my maker friends that I get together with every week. I decided to buy the full build-it-yourself kit, which meant I was in for a fair amount of soldering and so forth. Anyway, that all finally came together and I plugged it into my computer to see if I could control it with a MIDI track in <a href="http://reaper.fm">Reaper</a>. Yup! You sure can! </p>
<p>However, what you can&#8217;t do is create an envelope for any old MIDI CC message. You can put CC messages into the MIDI clips themselves, but that&#8217;s not very conducive to doing the kind of automation I&#8217;m used to doing with bass synth VSTs. It turns out that Reaper comes with a JS effect called MIDI_CCRider, which allows you to put an LFO on any CC message you want. I was able to look up which CC message was filter cutoff for the Meeblip and automate it using that effect. But this was not great because it meant that I&#8217;d need an instance of the effect for every parameter I wanted to control and that I&#8217;d have to constantly remind myself which CC messages controlled which parameters of the synth. So, instead, I decided to use that effect as the basis for a new JS effect that would have all that information baked into it and simply give me a bunch of sliders and combo boxes labeled the same as on the Meeblip. And voila:<br />
<a href="http://code.compartmental.net/wp-content/uploads/2012/09/meeblip_js_effect.png"><img src="http://code.compartmental.net/wp-content/uploads/2012/09/meeblip_js_effect.png" alt="" title="meeblip_js_effect" width="716" height="723" class="aligncenter size-full wp-image-678" /></a></p>
<p>The effect only sends a CC message when the value of a slider changes. This means that you can use it to set some initial values and then play with the knobs on the Meeblip while you loop a bassline. Only parameters of the effect that you choose to automate with an envelope will be constantly overridden. If you&#8217;d like to try it out with your Meeblip, you can grab it from Github: <a href="https://gist.github.com/3606021">https://gist.github.com/3606021</a></p>
]]></content:encoded>
			<wfw:commentRss>http://code.compartmental.net/2012/09/02/controlling-a-meeblip-from-reaper-with-a-js-effect/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Overhead spikes in the Unity3D profiler</title>
		<link>http://code.compartmental.net/2012/08/10/overhead-spikes-in-the-unity3d-profiler/</link>
		<comments>http://code.compartmental.net/2012/08/10/overhead-spikes-in-the-unity3d-profiler/#comments</comments>
		<pubDate>Fri, 10 Aug 2012 19:28:19 +0000</pubDate>
		<dc:creator>ddf</dc:creator>
				<category><![CDATA[iOS]]></category>
		<category><![CDATA[Unity3D]]></category>

		<guid isPermaLink="false">http://code.compartmental.net/?p=666</guid>
		<description><![CDATA[When writing native plugins for Unity3D on iOS, use UnitySendMessage sparingly because it can cause a pretty big spike in Overhead. <a href="http://code.compartmental.net/2012/08/10/overhead-spikes-in-the-unity3d-profiler/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
				<content:encoded><![CDATA[<p>I&#8217;m currently using Unity3D to build an iOS app and the other day I decided to do some profiling, just to make sure nothing is taking up crazy amounts of time. What I saw was pretty strange: </p>
<p><a href="http://code.compartmental.net/wp-content/uploads/2012/08/unity_profiler_overhead_spikes.png"><img src="http://code.compartmental.net/wp-content/uploads/2012/08/unity_profiler_overhead_spikes.png" alt="" title="unity_profiler_overhead_spikes" width="584" height="248" class="aligncenter size-full wp-image-667" /></a></p>
<p>Now, if you Google the title of this post, you&#8217;ll find quite a few people who are seeing spikes in the Unity3D profiler for something called Overhead and if you follow those links you&#8217;ll find that for the most part people aren&#8217;t incredibly certain how to make them go away. The <a href="http://docs.unity3d.com/Documentation/Manual/Profiler.html">Unity3D docs</a> don&#8217;t really explain what Overhead represents, but you can see it in the very first image on the page. Some people on the internet seem to think that Overhead includes garbage collection, but I&#8217;m pretty good about not creating tons of new objects every frame and others point out GC.Collect is what will show up for that. Also, if you look closely at the legend in the image you&#8217;ll see GarbageCollector has its own color.</p>
<p>No, it turned out that the culprit was using UnitySendMessage in a native plugin code! My app has a music system and in order to keep good metronomic time, I run the metronome with native code. This is important because if the metronome is only updated every frame, then you can wind up with wonky rhythm when there are framerate spikes. Lots of things are tied to the metronome in this app, so I needed a way to tell script about &#8220;ticks&#8221;, which simply means calling script on every sixteenth note. I used a line of code that looked like this:</p>
<p></p><pre class="crayon-plain-tag">UnitySendMessage( "Metronome", "Broadcast", m_tickString );</pre><p> </p>
<p>This function tells the Unity runtime to find the object named &#8220;Metronome&#8221; in the scene and then call a function named &#8220;Broadcast&#8221; that takes a string. In my Metronome.cs script I then converted the string to a float and told all of the objects listening to the metronome that a tick just happened. I wrote it this way because the very first tip given for iOS plugins is &#8220;Managed-to-unmanaged calls are quite processor intensive on iOS. Try to avoid calling multiple native methods per frame.&#8221; So I figured having Metronome.cs call a native function every frame to retrieve ticks would probably be a bad idea, but it turns out it&#8217;s better than using UnitySendMessage.</p>
<p>I changed the way the metronome works so that when the native code gets to each tick it pushes it onto the back of a list, then in the Update function for my C# Metronome, I pass a float array to a native Metronome_GetTicks function, which then fills the array with all of the ticks in the tick list and returns how many ticks it put into the array. Then, for each tick in the array, I call the same Broadcast(float) method that I called from Broadcast(string). Now profiling the exact same level that gave me spikes looks like this:</p>
<p><a href="http://code.compartmental.net/wp-content/uploads/2012/08/unity_profiler_overhead_flat.png"><img src="http://code.compartmental.net/wp-content/uploads/2012/08/unity_profiler_overhead_flat.png" alt="" title="unity_profiler_overhead_flat" width="584" height="244" class="aligncenter size-full wp-image-668" /></a></p>
]]></content:encoded>
			<wfw:commentRss>http://code.compartmental.net/2012/08/10/overhead-spikes-in-the-unity3d-profiler/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Elephant in the Room</title>
		<link>http://code.compartmental.net/2012/06/22/elephant-in-the-room/</link>
		<comments>http://code.compartmental.net/2012/06/22/elephant-in-the-room/#comments</comments>
		<pubDate>Fri, 22 Jun 2012 13:32:32 +0000</pubDate>
		<dc:creator>ddf</dc:creator>
				<category><![CDATA[Installations]]></category>
		<category><![CDATA[Minim]]></category>
		<category><![CDATA[Processing]]></category>

		<guid isPermaLink="false">http://code.compartmental.net/?p=626</guid>
		<description><![CDATA[Yesterday was the first day of the Joue le Jeu &#8211; Play Along exhibition at the Gaîté Lyrique in Paris. This show has been curated by two of my Kokoromi cohorts, Heather Kelley and Cindy Poremba, along with Lynn Hughes &#8230; <a href="http://code.compartmental.net/2012/06/22/elephant-in-the-room/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
				<content:encoded><![CDATA[<p>Yesterday was the first day of the <a href="http://www.gaite-lyrique.net/en/theme/joue-le-jeu-play-along-summer-2012">Joue le Jeu &#8211; Play Along</a> exhibition at the Gaîté Lyrique in Paris. This show has been curated by two of my Kokoromi cohorts, <a href="http://www.perfectplum.com/">Heather Kelley</a> and <a href="http://shinyspinning.com/">Cindy Poremba</a>, along with Lynn Hughes from Concordia University in Montréal. These three amazing women have curated a show containing both &#8220;traditional&#8221; videos games, which can be played in the gallery space by visitors, as well as a number of commissioned pieces created especially for the show. One of these commissions is my piece for the Gaîté&#8217;s Chambre Sonore.</p>
<p>The Chambre Sonore is a room that was custom built for the Gaîté, though not specifically for my piece, that contains a 10 channel sound system (8 mounted in the walls around the room, 1 in the ceiling, and a sub behind one of the walls), 8 pressure sensitive floor panels, and 8 color LED lights that ring the ceiling. All of these can be interfaced with from a computer under the stairs next to the room.</p>
<div id="attachment_628" class="wp-caption alignright" style="width: 310px"><a href="http://code.compartmental.net/wp-content/uploads/2012/06/photo.jpg"><img src="http://code.compartmental.net/wp-content/uploads/2012/06/photo-300x300.jpg" alt="" title="Elephant in the Room Wall Text" width="300" height="300" class="size-medium wp-image-628" /></a><p class="wp-caption-text"><i>Elephant in the Room</i> Wall Text</p></div>
<p><strong>High Concept</strong></p>
<p>The high concept of the piece is that the room has a digital creature living in it and that visitors can interact with the creature by stepping on the different floor panels in the room. Over time this interaction with the creature changes how it sounds so that if someone visits it more than once in a day, or comes back several days later, it should sound noticeably different than their previous visit. </p>
<p><strong>Implementation</strong></p>
<p>The actual implementation of the piece differs slightly from the high concept, however. I had originally envisioned creating a single complex sound generating system that would have lots of different values that could be slowly changed by stepping on the various floor panels. In this way, it would have been a very slowly evolving soundscape, without a readily discernible way for visitors to tell that they were making a difference by being in the room. Ultimately, I decided that it would make more sense within the context of the exhibition as a whole if visitors were able to easily figure out that the piece was reacting to them.</p>
<p>So, the piece contains five different modes that it might be in when a visitor enters and by paying close attention to the feedback provided by the lights and sounds, they should be able to figure out the &#8220;puzzle&#8221; of the mode and then intentionally push the mode to its end, triggering a transition to the next mode. The modes have the very unpoetic names of <em>Rainstorm</em>, <em>Pulsing Tones</em>, <em>Soothe</em>, <em>Chirps</em>, and <em>Tune Maker</em>. </p>
<div id="attachment_633" class="wp-caption alignleft" style="width: 310px"><a href="http://code.compartmental.net/wp-content/uploads/2012/06/elephant_in_the_room_footprints.jpg"><img src="http://code.compartmental.net/wp-content/uploads/2012/06/elephant_in_the_room_footprints-300x300.jpg" alt="" title="elephant_in_the_room_footprints" width="300" height="300" class="size-medium wp-image-633" /></a><p class="wp-caption-text">Hyrax footprints stuck to the floor of the Chambre Sonore to indicate where visitors can stand to interact with the piece.</p></div>
<p>Each mode is a very different soundscape, helping to meet the goal of visitors hearing something different if they visit the room a second time. <em>Rainstorm</em> sounds like digital rain with a whooshing wind and if visitors stand in the correct place, they will anger a creature that will roar at them. <em>Pulsing Tones</em> is a large pulsing chord that visitors can turn into high-pitched static by increasing the amplitude modulation frequency applied to each note in the chord. <em>Soothe</em> is a gentle environment with a low frequency noise wash, long glassy tones taken from a harmonic series, and a soft heartbeat emanating from the wall. Visitors can create marimba-like tones by stepping on floor panels. <em>Chirps</em> emits periodic descending or ascending tones that are patched through a modulated delay effect. Visitors can use floor panels to increase and decrease the duration of the tones, or to increase and decrease the speed of the delay modulation. <em>Tune Maker</em> is a generative dance tune that visitors can add musical elements to simply by dancing around the floor. If they dance fast enough they are rewarded with a prerecorded dance tune that has choreographed lighting. Here&#8217;s a short video of what <em>Rainstorm</em> sounds and looks like.</p>
<div align="center">
<iframe width="420" height="315" src="http://www.youtube.com/embed/4BRkritpdHc" frameborder="0" allowfullscreen></iframe>
</div>
<p><br/><br />
<strong>Technology</strong></p>
<p>As mentioned, there are three systems in the room that the computer interfaces with: 10 channel audio, 8 pressure sensitive floor panels, and 8 color LED lights. The audio runs through an audio card installed in the computer, out to two amplifiers. The floor panels send MIDI messages and are plugged into a USB MIDI interface. The lights are controlled using DMX and I chose to use the ENTTEC DMX USB PRO to control them. I was able to interface with all of this hardware using <a href="http://www.processing.org/">Processing</a>.</p>
<div id="attachment_642" class="wp-caption alignright" style="width: 310px"><a href="http://code.compartmental.net/wp-content/uploads/2012/06/photo-1.jpg"><img src="http://code.compartmental.net/wp-content/uploads/2012/06/photo-1-300x300.jpg" alt="" title="elephant_running_on_the_pc" width="300" height="300" class="size-medium wp-image-642" /></a><p class="wp-caption-text">Visual proof that Elephant in the Room was built with Processing.</p></div>
<p>For the audio, I used Minim, my sound library. Almost all of the sound is generated in real-time using the UGen framework. However, to handle the 10 channels, I had to bypass using an AudioOutput object and write a custom class that could deal with the sound card on the computer. JavaSound gives access to audio devices through the Mixer class. Typically, for a multi-channel sound card, the outputs will be made available as stereo pairs. So, there&#8217;s a Mixer for channels 1/2, 3/4, 5/6, and so on. Once you have a Mixer, you can ask it for a SourceDataLine that is used to write out audio data, but if a Mixer represents a stereo pair, you&#8217;re never going to be able to ask for a 10 channel SourceDataLine. In fact, even though two of the Mixers listed for the sound card were named 5.1 and 7.1, I was not able to ask those for 6 and 8 channel outputs. Instead, I gather up all the stereo pairs representing channels 1 through 10 and ask each of them for a stereo output. Then I generate 10 channels of audio from my root UGen and write out two channels of audio to each stereo output in turn. This lets me think about generating audio in 10 channel terms and makes it easy to write UGens that can pan sound around the room, send sound to just one speaker, or expand a stereo signal across several speakers.</p>
<div id="attachment_655" class="wp-caption alignleft" style="width: 370px"><a href="http://code.compartmental.net/wp-content/uploads/2012/06/10450807.gif"><img src="http://code.compartmental.net/wp-content/uploads/2012/06/10450807.gif" alt="" title="chambre_sonore_lights" width="360" height="480" class="size-full wp-image-655" /></a><p class="wp-caption-text">Flashing disco lights during <i>Tune Maker</i>.</p></div>
<p>For the lights, I used a library for Processing called <a href="http://motscousus.com/stuff/2011-01_dmxP512/">dmxP512</a>, which made dealing with the lights super easy. At first, I thought I would have to use MIDI and a light cue building program that had been used with previous installations for the Chambre Sonore, but the direct control that dmxP512 gave me was much better. I wound up writing a wrapper class for it that let me set colors using a color variable in Processing and also let me fade colors over time. A very useful idea I came up with was to allow for animating color and intensity separately. So I can set a light to color(255,15,23), for instance, but then set the intensity to 0.2 and wind up with that color at 20% brightness. I simply multiply the RGB components by the intensity before sending them to the lights and this allows me to do stuff like blink a light by animating the intensity while at the same time slowly shifting the color from blue to pink.</p>
<p>The floor communicates with the computer by sending MIDI messages and I was able to receive these by writing some pretty straightforward JavaSound MIDI code. Basically, you just ask for the Transmitter object of the MIDI device that the floor is plugged into, write a class that implements the Receiver interface, and set an instance of that class as the Receiver for the Transmitter from the MIDI device. So I wrote a FloorReceiver class that I can add a FloorListener to so that the MidiMessage parsing can be in one place and other code can simply receive notifications when a floor panel goes down or up. I believe the floor is made by a French company called Interface-Z and it appears to send only one kind of MIDI message: a NOTE_ON message where the note number indicates which pad sent the message and the velocity indicates whether the panel went down (64) or up (0). I did find the floor to be a little bit frustrating to work with because some panels respond in only a small area and others a comparatively large one. This is the reason for the footprint stickers: to show people where they can stand to best interact with the room and also which direction to face so they will hopefully see a connection between where they are standing and the light that is blinking at them.</p>
<div id="attachment_660" class="wp-caption alignright" style="width: 235px"><a href="http://code.compartmental.net/wp-content/uploads/2012/06/image.jpeg"><img src="http://code.compartmental.net/wp-content/uploads/2012/06/image-e1340371599193-225x300.jpg" alt="" title="chambre_sonore_cyan_lights" width="225" height="300" class="size-medium wp-image-660" /></a><p class="wp-caption-text">The Chambre Sonore lit with cool cyan lights.</p></div>
<p><strong>Reception</strong></p>
<p>From what I have seen, most people enjoy interacting with the room and seem to understand that they are having some kind of effect on the sound. But aside from several people I know personally who really made an effort to figure out the room, I haven&#8217;t seen anyone actually clue in to how to get a mode to an end point. Certainly, part of this is due to the fact that nothing explicitly states that this is possible, but I think it also has to do with the fact that the only feedback is from lights and sound. Each floor panel is associated with a particular light and speaker, and this relationship is maintained throughout all the modes, but unfortunately the layout of the room doesn&#8217;t physically reinforce the relationship. This isn&#8217;t a problem per se, since the piece is meant to work as simply an interactive ambient soundscape, and the piece has been switching between modes despite people not quite getting it. I had hoped to do more observation of the general public interacting with the room, but if I&#8217;m in the room, it sort of changes the experience for people, so I&#8217;ve mostly stayed out of sight. All in all, I&#8217;m pretty happy with how it&#8217;s going so far. </p>
<p><i>Elephant in the Room</i> shows at the Gaîté Lyrique in Paris as part of Joue le Jeu &#8211; Play Along until August 12th, 2012.</p>
]]></content:encoded>
			<wfw:commentRss>http://code.compartmental.net/2012/06/22/elephant-in-the-room/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>WaveShaper Sale: Jan 28 Only!</title>
		<link>http://code.compartmental.net/2012/01/28/waveshaper-sale-jan-28-only/</link>
		<comments>http://code.compartmental.net/2012/01/28/waveshaper-sale-jan-28-only/#comments</comments>
		<pubDate>Sat, 28 Jan 2012 17:54:38 +0000</pubDate>
		<dc:creator>ddf</dc:creator>
				<category><![CDATA[Releases]]></category>
		<category><![CDATA[WaveShaper]]></category>

		<guid isPermaLink="false">http://code.compartmental.net/?p=617</guid>
		<description><![CDATA[Today you can buy WaveShaper for just $1.99!]]></description>
				<content:encoded><![CDATA[<p><a href="http://itunes.com/app/waveshaper"><img src="http://code.compartmental.net/wp-content/uploads/2012/01/waveshaper_blog_image.png" alt="" title="WaveShaper" width="440" height="322" class="aligncenter size-full wp-image-618" /></a></p>
<p><center>Today you can <a href="http://itunes.com/app/waveshaper">buy WaveShaper for just $1.99</a>!</center></p>
]]></content:encoded>
			<wfw:commentRss>http://code.compartmental.net/2012/01/28/waveshaper-sale-jan-28-only/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>WaveShaper Update and Sale!</title>
		<link>http://code.compartmental.net/2012/01/27/waveshaper-update-and-sale/</link>
		<comments>http://code.compartmental.net/2012/01/27/waveshaper-update-and-sale/#comments</comments>
		<pubDate>Sat, 28 Jan 2012 04:40:03 +0000</pubDate>
		<dc:creator>ddf</dc:creator>
				<category><![CDATA[Releases]]></category>
		<category><![CDATA[WaveShaper]]></category>

		<guid isPermaLink="false">http://code.compartmental.net/?p=614</guid>
		<description><![CDATA[Another bug-fix update will be going out on the store later tonight or tomorrow and to celebrate I&#8217;m dropping the price to $1.99 for one day. If you&#8217;ve been reluctant to spend the full $6 on it, grab it on &#8230; <a href="http://code.compartmental.net/2012/01/27/waveshaper-update-and-sale/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
				<content:encoded><![CDATA[<p>Another bug-fix update will be going out on the store later tonight or tomorrow and to celebrate I&#8217;m dropping the price to $1.99 for one day. If you&#8217;ve been reluctant to spend the full $6 on it, grab it on January 28th!</p>
<p>Also coming reasonably soon will be version 2.0, which will include Dropbox integration and Audio Copy/Paste.</p>
]]></content:encoded>
			<wfw:commentRss>http://code.compartmental.net/2012/01/27/waveshaper-update-and-sale/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Auto-rotation in iOS with openFrameworks</title>
		<link>http://code.compartmental.net/2012/01/13/auto-rotation-in-ios-with-openframeworks/</link>
		<comments>http://code.compartmental.net/2012/01/13/auto-rotation-in-ios-with-openframeworks/#comments</comments>
		<pubDate>Fri, 13 Jan 2012 20:02:51 +0000</pubDate>
		<dc:creator>ddf</dc:creator>
				<category><![CDATA[Documentation]]></category>
		<category><![CDATA[iOS]]></category>
		<category><![CDATA[openFrameworks]]></category>
		<category><![CDATA[WaveShaper]]></category>
		<category><![CDATA[auto-rotation]]></category>
		<category><![CDATA[UIKit]]></category>

		<guid isPermaLink="false">http://code.compartmental.net/?p=591</guid>
		<description><![CDATA[I don&#8217;t think that I&#8217;ve mentioned this before, but WaveShaper is a mixture of openFrameworks, UIKit, and Minim for C++. One of the major difficulties I&#8217;ve had in developing the app is getting the UIKit views and controllers to play &#8230; <a href="http://code.compartmental.net/2012/01/13/auto-rotation-in-ios-with-openframeworks/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
				<content:encoded><![CDATA[<p>I don&#8217;t think that I&#8217;ve mentioned this before, but WaveShaper is a mixture of openFrameworks, UIKit, and Minim for C++. One of the major difficulties I&#8217;ve had in developing the app is getting the UIKit views and controllers to play nice. It&#8217;s not hard to render UIKit widgets on top of the EAGLView, you simply add your UIKit widget as a subview of the UIWindow or the EAGLView that openFrameworks creates, but it does <em>not</em> work to directly use openFrameworks coordinates to set the position and size of UIKit widgets. </p>
<p>The reason it doesn&#8217;t work is because (I&#8217;m pretty sure) openGL&#8217;s coordinate system is not the same as Apple&#8217;s. Part of what openFrameworks does is translate the coordinates of incoming touches from Apple&#8217;s coordinate system to openGL&#8217;s before sending touch events. This allows you to always think about the drawing surface in the &#8220;natural&#8221; way for doing openGL apps: upper left corner is always (0,0), positive X is to the right, positive Y is down. You can use this knowledge to simply transform your openGL coordinates to Apple coordinates when setting the position and size of UIKit widgets, but if you are using ofxiPhoneSetOrientation to reorient your openGL surface, the mapping between openGL coordinates and UIKit coordinates changes depending on the orientation. This means you have to reposition all of your UIKit objects every time the device is reoriented. Even worse, what I discovered is that in one of the landscape modes, even though the UIKit widgets <em>looked</em> correct, I actually had the device orientation set to the opposite of what it should have been, so when I displayed popovers, they were upside-down. When I presented modal view controllers, they would appear in the correct orientation, but then not rotate when device orientation changed.</p>
<p>After much hair-pulling, I finally came up with a solution that I think is pretty solid. Essentially, what I have done is embed the EAGLView in a view hierarchy that is well behaved with respect to Apple&#8217;s system and I <em>do not</em> call ofxiPhoneSetOrientation to change the orientation of the app. What this means is that from openFrameworks&#8217; perspective the app never changes orientation, which is true in some sense because the EAGLView is added as a subview to a vanilla UIView that is strictly responsible for handling the rotation.</p>
<p>Ok, onto some actual code. Before setting up any UI, I set the openFrameworks orientation to landscape:</p>
<p></p><pre class="crayon-plain-tag">ofxiPhoneSetOrientation( OF_ORIENTATION_90_RIGHT );</pre><p></p>
<p>Then I rearrange the view hierarchy that openFrameworks creates so that I can set the position and size of UIKit widgets using openFrameworks coordinates. Included in this is creating a root view controller for the window, so that I can take advantage of the auto-rotation behavior they provide (and because Apple expects your app to have a root view controller):</p>
<p></p><pre class="crayon-plain-tag">// remove the glview from the UIWindow, which is where openFrameworks puts it
[ofxiPhoneGetGLView() removeFromSuperview];
            
// create a plain old UIView that is the same size as the app
// just use OF sizes as our reference, everything should work out
CGRect mainFrame    = CGRectMake(0, 0, ofGetWidth(), ofGetHeight());
mMainView           = [[UIView alloc] initWithFrame:mainFrame];
            
// grab the glView and rotate/position it so it looks correct
UIView* glView      = ofxiPhoneGetGLView();
glView.transform    = CGAffineTransformRotate(CGAffineTransformIdentity, M_PI_2);
glView.center       = mMainView.center;
            
// glView goes on our main view to prevent wonky resizing
[mMainView addSubview:glView];
            
// root controller has main view as its view
mRootViewController      = [[LandscapeViewController alloc] init];
mRootViewController.view = mMainView;
            
// and finally we set the root view controller
// which will make mMainView the window's primary view
// all other views are then added as subviews of mMainView
// NOT as subviews of the UIWindow or the EAGLView
ofxiPhoneGetUIWindow().rootViewController = mRootViewController;</pre><p></p>
<p>Here&#8217;s the LandscapeViewController class, which limits supported orientations to landscape orientations and also turns off animations during rotation so that the orientation snaps. If you like the animated orientation change, you can simply remove those lines.</p>
<p></p><pre class="crayon-plain-tag">// barebones UIViewController so we can control allowed orientations of SoundCloud interface.
@interface LandscapeViewController : UIViewController 
{
}
@end

@implementation LandscapeViewController
        
- (BOOL) shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation
{
    if ( UIInterfaceOrientationIsLandscape(toInterfaceOrientation) )
    {
        return YES;
    }
    
    return NO;
}

- (void) willRotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation duration:(NSTimeInterval)duration
{
    // snap to new rotation
    [UIView setAnimationsEnabled:NO];
}

- (void)didRotateFromInterfaceOrientation:(UIInterfaceOrientation)fromInterfaceOrientation 
{
    // animations back on so we get the nice slide-ons for the keyboard and so forth
    [UIView setAnimationsEnabled:YES];
}

@end</pre><p></p>
<p>Finally, the class that registers to receive ofxiPhoneAlerts needs to handle device orientation changes like this:</p>
<p></p><pre class="crayon-plain-tag">void App::deviceOrientationChanged(int newOrientation)
{
    UIApplication * app = [UIApplication sharedApplication];	
    // status bar orientations are reversed from device orientations
    // so that we can use OF coordinates to layout UIKit widgets.
	if ( newOrientation == UIDeviceOrientationLandscapeLeft )
	{
        [app setStatusBarOrientation: UIInterfaceOrientationLandscapeRight 
                            animated:NO];
	}
	else if ( newOrientation == UIDeviceOrientationLandscapeRight )
	{
        [app setStatusBarOrientation: UIInterfaceOrientationLandscapeLeft 
                            animated:NO];
	}
}</pre><p></p>
<p>And again, WaveShaper only displays in landscape, which is why those are the only orientations I handle.</p>
<p>Once all of this is in place, you can happily position buttons, sliders, popovers, and whatever else using the openFrameworks coordinate system and they will all look correct and rotate with the screen. </p>
]]></content:encoded>
			<wfw:commentRss>http://code.compartmental.net/2012/01/13/auto-rotation-in-ios-with-openframeworks/feed/</wfw:commentRss>
		<slash:comments>13</slash:comments>
		</item>
		<item>
		<title>WaveShaper 1.1 Now Available</title>
		<link>http://code.compartmental.net/2012/01/03/waveshaper-1-1-now-available/</link>
		<comments>http://code.compartmental.net/2012/01/03/waveshaper-1-1-now-available/#comments</comments>
		<pubDate>Tue, 03 Jan 2012 20:42:03 +0000</pubDate>
		<dc:creator>ddf</dc:creator>
				<category><![CDATA[iOS]]></category>
		<category><![CDATA[Releases]]></category>
		<category><![CDATA[WaveShaper]]></category>
		<category><![CDATA[iPad]]></category>
		<category><![CDATA[update]]></category>
		<category><![CDATA[waveshaper]]></category>

		<guid isPermaLink="false">http://code.compartmental.net/?p=585</guid>
		<description><![CDATA[The first update for WaveShaper, which addresses a crash that many users were experiencing, is now available on the App Store. I&#8217;ve also fixed a few bugs in the UI and added a support e-mail link at the top of &#8230; <a href="http://code.compartmental.net/2012/01/03/waveshaper-1-1-now-available/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
				<content:encoded><![CDATA[<p><img src="http://code.compartmental.net/wp-content/uploads/2012/01/Icon.png" alt="" title="WaveShaper Icon" width="72" height="72" class="alignleft size-full wp-image-588" />The first update for WaveShaper, which addresses a crash that many users were experiencing, is <a href="http://itunes.com/app/waveshaper">now available on the App Store</a>. I&#8217;ve also fixed a few bugs in the UI and added a support e-mail link at the top of the info page (tap the question mark in the lower left of corner of the screen to see the info page).</p>
]]></content:encoded>
			<wfw:commentRss>http://code.compartmental.net/2012/01/03/waveshaper-1-1-now-available/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>WaveShaper 1.1 Status</title>
		<link>http://code.compartmental.net/2012/01/01/waveshaper-1-1-status/</link>
		<comments>http://code.compartmental.net/2012/01/01/waveshaper-1-1-status/#comments</comments>
		<pubDate>Sun, 01 Jan 2012 18:19:12 +0000</pubDate>
		<dc:creator>ddf</dc:creator>
				<category><![CDATA[WaveShaper]]></category>

		<guid isPermaLink="false">http://code.compartmental.net/?p=583</guid>
		<description><![CDATA[The bug-fix update for WaveShaper is unfortunately still &#8220;Waiting For Review&#8221;, but rest assured that I will post here as soon as it is available. Meanwhile, Happy New Year!]]></description>
				<content:encoded><![CDATA[<p>The bug-fix update for WaveShaper is unfortunately still &#8220;Waiting For Review&#8221;, but rest assured that I will post here as soon as it is available. Meanwhile, Happy New Year!</p>
]]></content:encoded>
			<wfw:commentRss>http://code.compartmental.net/2012/01/01/waveshaper-1-1-status/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>WaveShaper 1.1: bug fix update coming soon!</title>
		<link>http://code.compartmental.net/2011/12/22/waveshaper-1-1-bug-fix-update-coming-soon/</link>
		<comments>http://code.compartmental.net/2011/12/22/waveshaper-1-1-bug-fix-update-coming-soon/#comments</comments>
		<pubDate>Thu, 22 Dec 2011 20:28:14 +0000</pubDate>
		<dc:creator>ddf</dc:creator>
				<category><![CDATA[Apps]]></category>
		<category><![CDATA[WaveShaper]]></category>
		<category><![CDATA[bug fix]]></category>
		<category><![CDATA[iPad]]></category>
		<category><![CDATA[update]]></category>

		<guid isPermaLink="false">http://code.compartmental.net/?p=577</guid>
		<description><![CDATA[I&#8217;ve been seeing several reports of WaveShaper crashing a lot and after spending some time looking into it, I&#8217;m pretty sure I&#8217;ve fixed the problem. It wasn&#8217;t a crash, per se, but actually a lock up in the audio system, &#8230; <a href="http://code.compartmental.net/2011/12/22/waveshaper-1-1-bug-fix-update-coming-soon/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
				<content:encoded><![CDATA[<p>I&#8217;ve been seeing several reports of WaveShaper crashing a lot and after spending some time looking into it, I&#8217;m pretty sure I&#8217;ve fixed the problem. It wasn&#8217;t a crash, per se, but actually a lock up in the audio system, which caused the OS to kill the app. Sometimes this could happen on start up and sometimes when attempting to preview files in the file list.</p>
<p>The update should be <strong>available on December 30th</strong>. This is later than I&#8217;d like it to be available, but the iTunes Connect holiday shutdown began today and lasts through the 29th.</p>
<p>My sincerest apologies to all who have bought the app and experienced these crashes.</p>
]]></content:encoded>
			<wfw:commentRss>http://code.compartmental.net/2011/12/22/waveshaper-1-1-bug-fix-update-coming-soon/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
